Tasks: quiz only — standalone quizzes, and a code quiz every reviewer can see
The last spec artifact. A DAG of implementation tasks derived from
design.mdandtesting-plan.md.
The short version
Twenty tasks in four tracks, delivered by one pull request, #558.
- Rename track (1–4). The graph, the state reader, the selection row and the records take their new names, with the old ones still read.
- Quiz track (5–8). The
microbypass, the Part 1 check, the page template, the command and the reference. - Reviewer track (9–16). The GitHub operations, the taken record, the banner writer, the keyword and its two ingresses, and the gate's refresh calls.
- Wrap-up track (17–20). The briefing template, the end-to-end scenarios, the documents and the regression run.
The risk sits in tasks 13 and 14. They put a test in front of the authorization check on each ingress, which is the trust boundary of this change. Each starts with its negative tests.
Task list
Each task writes or changes its test first, watches it fail, then makes it pass.
- [x] 1. Rename the graph's quiz nodes and declare the renamed ids
- In
cli/the_loop/graph/pdlc-work-item-loop.yaml: skip setquiz; nodesspec-quiz-writeandcode-quiz-writewithcommand: quizandstage: quiz; every edge that named the old ids; the comments. - A new top-level
renamedmap in the graph file (spec-explainer,code-explainer, and the skip setexplainer), parsed bygraph/model.pyand rejected when it names a target that does not exist. expand_skip_tokensresolves a renamed token before it validates.- Depends on: none
- Requirements: R1.4, R1.5, R2.1, R2.2
- Test: T1 —
pytest tests/test_graph_model.py tests/test_graph_skips.py tests/test_graph_parity.py(red→green)
- In
- [x] 2. Translate old names when state is read
WorkItemState.loadapplies the graph'srenamedmap to the current node, the node history, the frozen selection's node ids and the skip records. The runtime'sdeclared_skipsand_frozen_node_idssee only new ids.explainerExperimentsis read and dropped. Remove the field and its writers:graph/state.py,graph/runtime.py,archive.py,state.py,graphlink.py(withEXPLAINER_NODES),commands/graph_cmd.py, and the prompt fileprompts/graph-context/explainer-experiments.md.- A fixture
work-item-state.jsonin the pre-change format, parked atspec-explainer, with theexplainertoken skipped in a second fixture. - Depends on: 1
- Requirements: R1.7, R10.1–R10.3, R10.6
- Test: T10 —
pytest tests/test_quiz.py tests/test_state_portability.py -k "legacy or renamed or pre_change"; deletetests/test_explainer_experiments*.py(red→green)
- [x] 3. Phase selection offers one
quizrowgraph/hooks/selection.py: the tokenquiz, the row and its text, the parse (an untickedquizorexplainerrow means off), grouped skips underquiz, no experiment rows, noexplainerExperimentsin the result.channels/slack.py: the setting token.strings/en.json:graph.selection.quiz.*andgraph.selection.confirm.quiz-*replace the explainer keys; the experiment keys are deleted.- Regenerate the golden checklists under
tests/fixtures/handoff/andtests/fixtures/jira/. - Depends on: 1
- Requirements: R1.1–R1.3, R1.5, R1.6, R1.8
- Test: T1, T6 —
pytest tests/test_selection_layout.py tests/test_selection_control.py tests/test_graph_skips.pyand the fixture tests (red→green)
- [x] 4. New record names, old ones still read; a quiz comment without an explainer
templates/evidence/spec-quiz.mdandcode-quiz.md(fields Depth, Questions, Location, Artifact, and Part 1 for the code quiz) replace the two explainer records..the-loop/manifest.yamlroles follow.- The graph's hook parameters name the new records. The human gates'
recordaccepts the old name as a fallback, in thea|bformspecalready uses. quizmarks.py: new attestation sentences; the pre-change sentences, the read-only one included, stay accepted by the tick check.graph/hooks/quiz.pyandgraph.quiz.*strings: the comment asks the reader to take the quiz, gives the artifact URL when the record has one, and always gives the two one-liners for the committed file. The agent node blocks on a record with no committed Location.- Depends on: 1
- Requirements: R5.6–R5.8, R6.1–R6.7, R10.4, R10.5
- Test: T1, T10 —
pytest tests/test_quiz.py tests/test_quiz_integration.py(red→green)
- [x] 5. The
microbypass- A hook that ends the exit chain of
spec-quiz-writeand ofreviewer-briefing: it reads the quiz's record and returns the outcomemicrowhen the depth ismicro, and nothing when the record is absent. - Edges
spec-quiz-write → tasks-breakdownandreviewer-briefing → human-approvalonmicro. the-loop checkrenders the bypassed gate as no quiz (micro).- Remove the posting of a read-only checkbox for a
microrecord. - Depends on: 4
- Requirements: R3.1–R3.4, R8.11
- Test: T1 —
pytest tests/test_quiz.py -k micro tests/test_graph_model.py(red→green)
- A hook that ends the exit chain of
- [x] 6. Part 1 must not be carried over a changed spec
- At
code-quiz-write's exit: when the record says Part 1carried over, run the "record postdates spec" check against the spec quiz's record and block when the spec is newer. Rename the hookexplainer-postdates-spectoquiz-postdates-spec. - Depends on: 4
- Requirements: R4.2, R5.9
- Test: T1 —
pytest tests/test_quiz.py -k "postdates or part1"(red→green)
- At
- [x] 7. The quiz page template
skills/the-loop/templates/quiz.htmlfromdesign/code-quiz.html, with placeholders in the header and an example JSON block; deletetemplates/explainer.html.docs/specs/issue-557/evidence/ui/check.mjs, from issue-488's script: the four forms, the hostile-string probe in every field, no feedback before a selection, no network request, axe, the keyboard walk, the Part 2 link.- Depends on: none
- Requirements: R2.4, R4.1, R4.3–R4.6; abuse case 7
- Test: T5, T9, T8 (7) —
node docs/specs/issue-557/evidence/ui/check.mjs skills/the-loop/templates/quiz.html docs/specs/issue-557/evidence/ui(red→green)
- [x] 8. The command and the reference
commands/quiz.mdreplacescommands/explain.md.skills/the-loop/reference/quiz.mdreplacesreference/explainer.md: the two nodes, the depth ladder, the quiz rules with the richerwhy, the two-part code quiz, filling the JSON block, publishing (commit always, own artifact when possible, never a tab), the records.skills/the-loop/SKILL.md,reference/workflow.mdandcommands/work-on.md: the quiz paragraphs, the doc and artifact sections (no quiz tabs), the command list.- Depends on: 5, 6, 7
- Requirements: R2.3, R2.5–R2.8, R5.1–R5.5, R11.1
- Test: T6 —
pytest tests/test_writing_parity.py tests/test_docs_parity.py tests/test_graph_parity.py(red→green)
- [x] 9. GitHub operations the banner needs
- In
ghapi.pyandgraph/integrations/github.py: read a pull request with its author, description and requested reviewers; list the authors of its submitted reviews, empty-bodied ones included; update a description; create a comment and return its id; edit a comment by id; read one comment by id. - Jira's integration reports each as unsupported.
- Depends on: none
- Requirements: R8.1, R8.3, R9.1
- Test: T1 —
pytest tests/test_graph_integrations.py tests/test_ghapi.py(red→green)
- In
- [x] 10. The taken record
- A
quizTakensection of the portable record with its store, modelled on the collaborator store: per pull request, the round, the logins with their times, and the fallback comment's id. Adding a login that is present is a no-op. A new round starts an empty list. - Depends on: none
- Requirements: R7.1, R7.6, R8.10
- Test: T1 —
pytest tests/test_quiz_taken.py -k store(red→green)
- A
- [x] 11. The banner writer
- A module that, for one pull request: checks it delivers a work item with a posted code quiz; reads the pull request, the reviews, the taken record and the attester; builds the rows; renders from
graph.quiz.banner.*strings; re-reads the description; places the banner per the design's table; writes only on a difference. - The fallback comment, created once and edited by its stored id.
- Events
graph.quiz_bannerandgraph.quiz_banner_failed, registered ineventlog.pywith their strings. No failure propagates to the caller. - Depends on: 9, 10
- Requirements: R8.1–R8.10, R9.1–R9.4; abuse cases 4, 5; NFR idempotent, bounded, no lost edits
- Test: T1, T8 (4, 5) —
pytest tests/test_quiz_banner.py(red→green)
- A module that, for one pull request: checks it delivers a work item with a posted code quiz; reads the pull request, the reviews, the taken record and the attester; builds the rows; renders from
- [x] 12. The keyword
quiz-takencontrol.py: the constant, its default keyword, anOPEN_COMMANDSfamily kept outsideCOMMANDS, and a parser that says whether a body is this keyword and opens no line with any other.schemas/cli-config.schema.jsonandskills/the-loop/templates/cli-config.yaml:routing.control.keywords.quiz-taken.- Depends on: none
- Requirements: R7.9, R7.10
- Test: T1, T6 —
pytest tests/test_control.py tests/test_cli_config.py(red→green)
- [x] 13. The reply on the webhook: signal and handler
- Negative tests first: abuse cases 1, 3, 6, 8 and 9.
webhook/router.py: after the self-authored check and before the authorization check, a created comment or submitted review on a pull request whose body is the keyword becomes a body-lessquiz_takenevent with the pull request's ref, the comment's id and the author's login.webhook/dispatcher.py: a short-circuit before control parsing. It confirms the author by reading the comment, checks the login grammar, checks the pull request delivers a work item with a posted code quiz, records, emitsgraph.quiz_takenorgraph.quiz_taken_refused, settles with the matching reaction, and asks for a refresh. It never calls the graph runtime.- Depends on: 10, 11, 12
- Requirements: R7.1–R7.8; abuse cases 1, 3, 6, 8, 9
- Test: T2, T8 —
pytest tests/test_quiz_taken_integration.py -k webhook(red→green)
- [x] 14. The reply and the reviewers on the poller
- Negative tests first: an unauthorized comment that is not the keyword is still dropped silently.
poller/poller.py: the comment filter tests for the keyword before it drops an unauthorized comment, and hands the same signal to the dispatcher.ghapi.py: the pull request query gains requested reviewers and review authors. The poller keeps a fingerprint of both per pull request, in memory, and signals a refresh when it changes. A restart refreshes each banner once, which writes nothing when nothing changed.- Depends on: 13
- Requirements: R7.1, R7.3, R8.6, R8.7, R8.12
- Test: T2 —
pytest tests/test_quiz_taken_integration.py -k poller(red→green)
- [x] 15. Reviewer changes on the webhook
- A
pull_requestevent with the actionreview_requestedorreview_request_removed, and a submittedpull_request_review, yield a refresh signal before the authorization check. Whether the event is also delivered to a session is unchanged. - Depends on: 13
- Requirements: R8.6, R8.7, R8.12
- Test: T2 —
pytest tests/test_quiz_taken_integration.py -k reviewer(red→green)
- A
- [x] 16. The gate asks for a refresh and records the attester
post-quiz-attestationatcode-quiz: after posting, set the round in the taken record and refresh each open delivering pull request.quiz-attested: on a pass, record the attesting login in the node's decision, and atcode-quizrefresh.- A refresh failure leaves the hook's result unchanged.
- Depends on: 4, 11
- Requirements: R6.7, R8.1, R8.4, R8.6, R8.10, R9.4
- Test: T2 —
pytest tests/test_quiz_integration.py -k "banner or attester or round"(red→green)
- [x] 17. The briefing template carries the banner
templates/pr-briefing.md: the two markers with a one-line placeholder after The short version, the fallback note, and no "Start here" line.- Regenerate
tests/fixtures/jira/pr-briefing.*. - Depends on: 11
- Requirements: R8.2, R8.11, R9.2
- Test: T6 — the Jira rendering fixture tests (red→green)
- [x] 18. End-to-end scenarios
happy-pathandquiz-gatesundertests/test_pdlc_e2e/scenarios/: new node ids, records and artifacts. A newquiz-microscenario for the bypass. The banner after the code quiz is posted is proven by the gate's integration tests (task 16): the scenario runner has no portable record to write one from.trivial-tier,review-rejectionandask-reply: thequizrow.runner.py: the helpers that name records and nodes.- Depends on: 3, 5, 16
- Requirements: R11.4
- Test: T4 —
pytest tests/test_pdlc_e2e_integration.py(red→green)
- [x] 19. Documents and decisions
- Capability docs:
process-graph.md,spec-workflow.md,webhook-triggers.md, each with a history row. docs/cli/commands/graph.md,docs/cli/state.md,docs/config/cli/routing-options.md(the keyword is not a CLI command, so it is documented with the other keywords, not as a command page; event types are listed bythe-loop events --typesfrom the string catalog),docs/reference/commands.md,docs/.vitepress/config.mts,README.md,ui/src/demo/fixture.ts.docs/decisions/decision-157.md(the explainer page is removed) anddecision-158.md(an open keyword: what a reply can and cannot do), with their rows indecisions.md.- Depends on: 8, 13, 14, 15, 16, 17
- Requirements: R11.1–R11.3, R11.5
- Test: T6, T12 —
pytest tests/test_docs_parity.py tests/test_eventlog.py,npm --prefix ui test, markdown lint (red→green)
- Capability docs:
- [x] 20. Regression run
make check, the markdown lint over the whole tree, andgit diff --stat origin/main...HEAD -- docs/specs ':!docs/specs/issue-557'showing no other work item's files changed.- Depends on: 1–19
- Requirements: R10.6, R11.4
- Test: T12, T10
Dependency graph (DAG)
Checkpoints
- After task 4: the whole CLI test suite, because tasks 1–4 rename things many tests pin.
- After task 8: the parity tests and the page check.
- After task 13: the abuse-case tests, before the second ingress is built on the same handler.
- After task 16: the whole CLI test suite.
- After task 20: the
verificationnode executestesting-plan.md, then the self-review, critic and security rounds run. The work item's risk tier is 4, so the security review waits for a named human sign-off.
The red→green record for each new behaviour is in evidence/unit.md. The tasks were committed in groups with their tests, not one commit per task.
Review comments
Appended by the-loop's
record-feedbackhook when a human gate approves with comments (issue-109). Append-only and attributed: an approval never silently discards a reviewer's suggestions, and the feedback travels with the document it concerns rather than living in a side-channel tracker.