Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #2476, #3312 and #3703: Move hint handler to domain layer #3659

Merged
merged 61 commits into from
Aug 19, 2021

Conversation

MaskedCarrot
Copy link
Contributor

@MaskedCarrot MaskedCarrot commented Aug 8, 2021

Explanation

Fixes #2476
Fixes #3312
Fixes #3703

Note that this PR was made in collaboration between @MaskedCarrot, @yashraj-01, and @BenHenning (see commits for specifics). Further, much of this was built as part of #3696 as a separate rewrite to address specific technical needs for both downstream dependent projects (lightweight checkpointing & developer options menu).

At a high-level, this PR moves & rebuilds HintHandler from the UI layer to being a separate, independent logic unit within the domain layer. Key changes that are meant to simplify hint handling:

  1. HintHandler was moved to be an interface so that multiple implementations can be provided
  2. HelpIndex is now the singular source of truth for all hint/solution state everywhere (domain, checkpoint, and UI); the previous revealed states in Hint/Solution have been removed (which now means those structures are properly immutable for the lifetime of a play session)
  3. HintHandler is responsible for everything hints & solution (when there are new ones available, and managing when they've been shown) by being the sole provider of HelpIndex. This includes both computing the available hints/solution as well as managing when hints & the solution have been revealed. This has led to lots of simplifications in the UI.
  4. HintHandler's API has been reinvented to be a bit more operation-specific and less generic
  5. A monitor was introduced for HintHandler so that the calling controllers know when to re-query for the latest state. There's definitely a data race here, but the data model is eventually consistent so it should be fine.
  6. HintHandler's tests make use of lots of new highly specific explorations. These explorations are not accessible from the topic list; they are only included for testing purposes (and are meant to exemplars for future tests).

This PR introduces a few other examples for future changes:

  • Module-specific test to verify bindings
  • Extensions class tests

While neither of those are unique, the relevant part is that these were the default approaches taken to address the test file presence requirement.

Other details:

  • This also fixes Non-modularized testing module tests not being built in Bazel today #3703 since it was found in passing that //testing module tests were not being built or run in Bazel (except those that are already modularized), leading to some build errors that weren't caught by the CI environment as they should have been.
  • QuestionAssessmentProgressControllerTest has been updated to include new scores since it was previously testing impossible scenarios (i.e. assuming hints could be shown/revealed when they wouldn't actually show up)

Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes. (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The PR explanation includes the words "Fixes #bugnum: ..." (or "Fixes part of #bugnum" if the PR only partially fixes an issue).
  • The PR follows the style guide.
  • The PR does not contain any unnecessary auto-generated code from Android Studio.
  • The PR is made from a branch that's not called "develop".
  • The PR is made from a branch that is up-to-date with "develop".
  • The PR's branch is based on "develop" and not on any other branch.
  • The PR is assigned to an appropriate reviewer in both the Assignees and the Reviewers sections.

Without this fix, tests (added in this PR because they were not present) fail on the latest develop.

Screenshot from 2021-08-12 03-36-02

@MaskedCarrot MaskedCarrot changed the title Move hint handler to domain layer Fix #2476: Move hint handler to domain layer Aug 8, 2021
@MaskedCarrot MaskedCarrot removed their assignment Aug 9, 2021
@MaskedCarrot
Copy link
Contributor Author

@BenHenning PTAL

@MaskedCarrot
Copy link
Contributor Author

The one failing CI is because there are no tests for the file hintHandler (there are that ensure the proper functioning of the hint handler in state fragment local tests)

@yashraj-01 yashraj-01 removed their assignment Aug 9, 2021
This simplifies some data pipelining in the UI, and improves HintHandler
documentation in addition to fixing some more reviewer comments.
@yashraj-01 yashraj-01 changed the title Fix #2476 and #3703: Move hint handler to domain layer Fix #2476, #3312 and #3703: Move hint handler to domain layer Aug 19, 2021
@yashraj-01
Copy link
Contributor

linking issue #3312 as this PR essentially covers the scope of the issue.

Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fast reviews! @rt4914 @vinitamurthi @anandwana001 can you PTAL at the latest changes & make sure they look good (& that the old conversation threads are resolved if so)?

I verified that all static checks, Gradle tests, and Bazel tests seem to work locally before uploading the latest changes. I also synced the branch with develop. If no further questions arise, this PR can probably be merged without waiting for the Bazel tests (to speed things up for @yashraj-01 & @MaskedCarrot).

Also, marking PR as approved since I reviewed all the changes & verified my old comment threads are now addressed.

@BenHenning
Copy link
Member

Ack @yashraj-01 that SGTM. Thanks!

@oppiabot
Copy link

oppiabot bot commented Aug 19, 2021

Unassigning @BenHenning since they have already approved the PR.

@BenHenning
Copy link
Member

Ah excellent. We can see via CI that #3703 is being resolved (all //testing module tests are now showing up in CI as they should have been originally).

Copy link
Contributor

@anandwana001 anandwana001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM,

as per this comment all static and bazel test checked locally, so the PR is gtg.

@oppiabot
Copy link

oppiabot bot commented Aug 19, 2021

Unassigning @anandwana001 since they have already approved the PR.

Copy link
Contributor

@rt4914 rt4914 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@oppiabot oppiabot bot unassigned rt4914 Aug 19, 2021
@oppiabot
Copy link

oppiabot bot commented Aug 19, 2021

Unassigning @rt4914 since they have already approved the PR.

@BenHenning
Copy link
Member

BenHenning commented Aug 19, 2021

All conversation threads have been verified & closed, required CI checks are passing, and required approvals are in. Going ahead and merging this since I verified that the new testing tests are correctly in CI now, and I verified locally that all Bazel tests are passing. This is blocking two separate streams of time-sensitive work, so I think we can take the risk of merging this in now.

Note that it's theoretically possible that the testing module tests that were previously missing from CI now fail on develop. If this occurs, I'll fix forward to avoid reverting this large, blocking PR & because those tests are not yet blocking (we're running them in Gradle & they've been passing on CI--that check is required).

Thanks again all for the repeated reviews & collaboration on this tricky unexpected design challenge. I'm glad we found a workable solution quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants