Skip to content

questionFeed: de-hardcode the fixed question ladder (issue #728) - #756

Merged
WilfordGrimley merged 2 commits into
masterfrom
feat/728-dehardcode-question-ladder
Aug 8, 2026
Merged

questionFeed: de-hardcode the fixed question ladder (issue #728)#756
WilfordGrimley merged 2 commits into
masterfrom
feat/728-dehardcode-question-ladder

Conversation

@WilfordGrimley

@WilfordGrimley WilfordGrimley commented Aug 8, 2026

Copy link
Copy Markdown

Summary

Issue #728 — the stage machine hardcoded a fixed question ladder (level1level2level3), forcing every confirm_suggestion item 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.

  1. QuestionFeed.tsx — remove the fixed ladder. CandidateStage and initialStage() 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.

    • The suggested printing (when present) is judged exactly once, in its own slot on page one (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.
    • The rest of the candidates render in the grid on the same page (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.
    • "Art matches, not an official printing" is now a first-class, page-one fallback in the bottom row (question-feed-custom-art) instead of a Level-2-only escape hatch.
    • The singleton case is preserved: rejecting the only candidate immediately casts the terminal no-match vote.
  2. 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 to question-feed-suggestion-*.

  3. 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-noquestion-feed-suggestion-no) and the 390px mobile overlap spec (question-feed-level1-card-panelquestion-feed-card-panel, control list now the suggestion slot + bottom row).

  4. Downstream specs that keyed off the removed level-1 testidsPDFWaitExperience.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

  • Tests updated/added: unit + Playwright specs ported to the de-laddered flow; two stale ladder specs rewritten to cover the new shape; three downstream specs fixed to the renamed selectors
  • Unit: npx jest src/features/questionFeed/QuestionFeed.test.tsx23 passed
  • Playwright: npx playwright test tests/QuestionFeed.spec.ts28 passed
  • Playwright: npx playwright test tests/PDFWaitExperience.spec.ts3 passed
  • Playwright: npx playwright test tests/QuestionFeedResponsive.spec.ts tests/CardbackPdfWaitFidelity.spec.ts30 passed
  • Playwright: npx playwright test tests/ModerationTab.spec.ts tests/NoMatchReasonStrip.spec.ts tests/WhatsThatPWA.spec.ts tests/WhatsThatWordsAnimation.spec.ts20 passed
  • Lint: prettier --check (pre-commit-pinned 2.7.1) passes on all 6 touched files; eslint 0 errors (5 pre-existing no-img-element warnings, identical count on master); local pre-commit gate passed on commit
  • Build: npm run build (Next.js static export) succeeds
  • Manual: on /whatsthat with a live backend, a confirm_suggestion item 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 one
  • CI — not watched by this session per dispatch convention

Closes #728

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.
@WilfordGrimley
WilfordGrimley merged commit bc9c23a into master Aug 8, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

What's That: the stage machine hardcodes a fixed question ladder

1 participant