questionFeed: de-hardcode the fixed question ladder (issue #728) - #756
Merged
Conversation
The stage machine assumed a fixed level1 -> level2 -> level3 sequence: the suggested printing was asked about twice (once in its level-1 slot, again as a highlighted tile in level-2's grid), every non-yes level-1 answer funneled to level 2 by force, and "Art matches, not an official printing" was a level-2-only escape hatch despite being a direct resolution for the exact case level 1 was built around. The feed now has a single candidate question: the suggested printing (when present) is judged once in its own slot, the rest of the candidates sit in the grid on the same page, and the bottom row resolves the whole question (none of these / custom art / skip). Answers resolve or advance by what they mean, not by a hardcoded sequence. The only remaining "stage" is the data-driven post-selection attribute confirmation. Test selectors follow the renamed surface (question-feed-suggestion-*, question-feed-candidate-question), including the embed and responsive specs that keyed off the old level-1 testids.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Issue #728 — the stage machine hardcoded a fixed question ladder (
level1→level2→level3), forcing everyconfirm_suggestionitem through a redundant funnel. The de-laddered feed now has a single candidate question; answers resolve or advance by what they mean, not by a hardcoded sequence.QuestionFeed.tsx— remove the fixed ladder.CandidateStageandinitialStage()are gone; the only remaining "stage" is the data-driven post-selection attribute confirmation (level3Active, entered only when a selected candidate leaves an exclusion group open). Every new item starts outside it.question-feed-suggestion-*), and is never re-offered as a grid tile — the old Level 2 re-presented the same candidate "highlighted", i.e. asked about twice.question-feed-candidate-question), so there is no level1→level2 funnel for non-yes answers: "No" collapses the suggestion slot into a "you said not this one" context line with the grid still carrying the question; "Not sure" records an abstention and advances.question-feed-custom-art) instead of a Level-2-only escape hatch.QuestionFeed.test.tsx— ported stage-machine tests. The Level-1 "Not sure" test now asserts the de-laddered advance (abstention + next fetch, no level-2 re-ask); selectors renamed toquestion-feed-suggestion-*.QuestionFeed.spec.ts— spec updated to the new flow. The confirm_suggestion specs assert the single-page shape (suggestion slot + grid, suggested candidate never a tile). Two stale specs that still encoded the old ladder were fixed: the singleton-NO spec (question-feed-level1-no→question-feed-suggestion-no) and the 390px mobile overlap spec (question-feed-level1-card-panel→question-feed-card-panel, control list now the suggestion slot + bottom row).Downstream specs that keyed off the removed level-1 testids —
PDFWaitExperience.spec.ts,QuestionFeedResponsive.spec.ts,CardbackPdfWaitFidelity.spec.ts— updated to the renamed surface (question-feed-candidate-question,question-feed-suggestion-*). The question feed is embedded in the PDF-wait game and asserted by these specs, so they broke the moment the ladder was removed.Test plan
npx jest src/features/questionFeed/QuestionFeed.test.tsx— 23 passednpx playwright test tests/QuestionFeed.spec.ts— 28 passednpx playwright test tests/PDFWaitExperience.spec.ts— 3 passednpx playwright test tests/QuestionFeedResponsive.spec.ts tests/CardbackPdfWaitFidelity.spec.ts— 30 passednpx playwright test tests/ModerationTab.spec.ts tests/NoMatchReasonStrip.spec.ts tests/WhatsThatPWA.spec.ts tests/WhatsThatWordsAnimation.spec.ts— 20 passedprettier --check(pre-commit-pinned 2.7.1) passes on all 6 touched files;eslint0 errors (5 pre-existingno-img-elementwarnings, identical count on master); local pre-commit gate passed on commitnpm run build(Next.js static export) succeeds/whatsthatwith a live backend, aconfirm_suggestionitem shows the suggested match in its own slot with the remaining candidates on the same page; "No" collapses the slot (never re-presented); the bottom row resolves the whole question from page oneCloses #728