Suggest a sibling problem for a practice focus
Problem and behavior
"Practice this" carries a report's improvement to the lobby as the practice focus, but the next problem had no relation to the report it came from: a due review offered the same problem again a day later, and otherwise the random draw ignored it. After this change, a focus chosen from a report on a problem with a sibling the candidate has not passed shows one line beside the selected problem, where the sequel offer appears, for example "Try your practice focus on a new problem: Chargeback Pair Match (Easy)." with a "Practice it" button that selects it.
practice next from the report
recommendation on the problem list
Selected problem
Approach
Read in this order:
problem-bank/problems.jsonandscripts/problem_bank/bank.py: an optionalsiblingnames another problem at the same level using the same technique. The generator refuses one that is missing, the problem itself, at another level, or not naming this problem back. 14 pairs, each naming the other, from the table in #798. The flag that skips these checks for task sets is renamed fromsequelstolobby_links, since it now covers both.scripts/gen-problem-cards.py: cards carrydata-siblingby page name, likedata-sequel, so no problem id or topic reaches the initial page.web/problem-picker.js: the stored focus keeps the page of the report's problem (practiceFocusFrom(item, problemId)), andsiblingSuggestionreturns that problem's sibling unless it is already passed. Both offers decide a pass through one helper,passedProblem, which reads a report as the progress panel does (normalizeProgressEntrythroughsanitizeReport): a HIRE that is notincompleteand whose contractreportContractStatusdoes not callunsupported. This also changes the sequel: an incomplete HIRE, or one recorded under an older rubric, no longer offers the sequel or hides it.pickProblemkeeps its own rule, aspickerEntryinweb/progress.jsexplains. A focus without a problem offers nothing, so the automatic Carry forward focus, which aggregates several reports, never does.web/interview.js,web/replay.js,web/app.js: the report page, the replay and Past attempts pass the page of the report they show; the replay falls back to the stored row'sproblemIdwhen the payload has none, asweb/progress.jsdoes. The lobby renders the offer beside the sequel's and both buttons share one handler, so the sibling is selected the way the sequel is: across the level filters, focus left on the random draw, disabled while history is refreshing. Each button'saria-labelnames the problem it selects (Practice it: <title>), since both offers can show at once.
The offer selects nothing until pressed, and Strict hides it with the other pickers. Each interview stays one problem, so the interview contract, report schema and history format are unchanged.
Validation
-
tests/browser/problem-picker.test.js: the focus keeps its problem through the session storage handoff (and drops a missing or non-string one), the sibling is offered for a chosen focus, not for a focus without a problem, a problem without a sibling or a sibling with no card, and not once the sibling is passed. A further test takes its expected answer fromnormalizeProgressEntryfor a legacy, a supported, an unsupported-contract and an incomplete HIRE, and checks the sequel trigger, the sequel's passed check and the sibling's passed check against it; removing the contract check, the incomplete check, or restoring the raw sequel trigger each fails it. -
tests/browser/lobby.test.js: no offer before Practice this; Practice this in Past attempts shows it and pressing it selects the sibling and keeps focus on a visible control; a focus handed over from the report page shows it and Strict hides it; a passed sibling is not offered; when a pass on two-sum shows both offers, each button's accessible name names the problem it selects; the sibling button is disabled while an account refresh is pending, as the sequel's is. -
tests/browser/interview-lifecycle.test.jsandtests/browser/replay-practice-focus.test.jsassert that the report page and the replay store the report's page with the item, including a replay row that keepsproblemIdoutside the payload. -
tests/test_gen_problems.py: the sibling rule, including a one-way link, and a card naming its sibling by page. -
./scripts/test.sh browser(3684 pass, 0 fail) passes at e47e07a7, whose code cc31272c keeps (it only correctsdocs/adding-a-problem.md), and./scripts/test.sh rustpasses at cc31272c; the rust run reports:not checked by this run: desktop clippy and tests: libwebkit2gtk-4.1-dev builds desktop/ cargo-deny: `cargo install cargo-deny` checks dependency licenses and sourcesThe full
./scripts/test.shpasses every other gate exceptreview-memory-tests, which fails the same way onmainhere because mygh2.46 lacks the attestation flags, andshell-syntax, where the local shellcheck 0.11.0 warns aboutscripts/git-post-commit.sh, which this change does not touch. -
Checked by hand in the lobby with a stubbed history holding one report with a plan. Not checked: a live interview reaching the report page with real providers; the report page and the replay are covered by the tests above.
Close #798
Summary by cubic
"Practice this" keeps the problem a report was about, so the lobby can offer that problem's sibling as a new problem to try the practice focus on. Previously the focus carried no problem, so the next problem was unrelated.
- An optional
siblingfield inproblems.jsonnames another problem at the same level; the generator validates it and cards carry it by page name. - The stored focus keeps the report problem's page from the report page, replays, and past attempts; the offer selects nothing until pressed and hides once the sibling is passed or the focus has no problem.
- The sibling and sequel offers share one handler and one pass rule that reads a report as the progress panel does, so an incomplete HIRE or an unsupported contract neither triggers the sequel nor hides either offer.
- The
sequelsflag is renamedlobby_linkssince it now covers both sequels and siblings.
Closes #798.