pr-explain: author each section in its own provider call #152
No reviewers
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
allod/tools!152
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/pr-explain-sectioned-authoring"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When you run
allod pr explain, the report is now written one piece per provider call: an outline pass plans the sections and writes the front matter, each section gets its own call that re-reads the full reader contract and the report so far, and a final call writes the quiz and provenance; the tool stitches the pieces together. This exists because three straight reads showed report quality decaying in the back half of single-pass generations — every call now starts with the contract a short distance from the text it governs, plus the master-teacher characterization paragraph you asked for. A full run can spend up to 17 provider calls instead of 4 (typically sections + 4; the consent text states the ceiling before anything is sent). One deliberate narrowing: every quiz item now lives in the final quiz section — master could also place an item right after the teaching it tests — so the global quiz rules bind one call that sees the whole report; your next read can judge that trade. Everything else is identical: same consent boundary, same cage and per-call postconditions, same validator with the same blocking errors, same slop and single-repair passes, same flags. The section plan and every fragment are mechanically checked before the next call spends anything, and a bad plan or misplaced fragment fails the run closed with diagnostics preserved. All 896 mocked-runner tests pass, including new sabotage fixtures for every new mechanical guard. If it is wrong, revert this PR — no state, interface, or other tool is touched, and already-generated reports are unaffected. The real witness is your next read of a live report generated from this branch or after merge.Risk
R2 per the dev plan (
allod/strategydev-plans/pr-explain-sectioned-authoring.md). The change is localized to report generation in one CLI; the pipeline glue is deterministic and covered by mocked-runner fixtures; rollback is a straight revert. What local tests cannot witness is the goal itself — register quality held through the last section — which needs a live provider run and an owner read. Worth human eyes: the consent/ceiling text, the assembly path (the validator must see one complete body), and the outline schema gate's forced-T0 tolerance (a triage forced past T0 has no objective vocabulary, so id membership checks stand down and ids are held to shape only).Validation
New coverage: a two-section sequential run (each later pass shown receiving the accepted prose verbatim), five outline schema-gate sabotages (non-JSON, duplicate ids, backward layers, unclaimed objective, reserved id), a plan-contradicting table of contents, a mislabeled section fragment, a section fragment missing
data-layer, a script-bearing fragment, a fragment pass writing the assembled body, a quiz fragment that never closesmain, an outline pass that writes no plan, a mid-section interruption that fails closed, and a valid post-TOC anchor that must pass the TOC guard (the regression witness for the review's finding 3 — the guard now bounds its href scan to the nav element instead of scanning to end-of-fragment). Existing repair, slop, cage-postcondition, consent, and interruption tests were renumbered to the new pass sequence and all still pass. No live provider was run; the mocked-runner rig drives every pass.The review pass (comment below) found no hard defects; its findings 1–4 are addressed by this body revision and the follow-up commit bounding the TOC guard.
Deviations from the plan, with reasons: the heading-naming rule lives in the shared contract rather than the outline prompt, because it also binds the
h3/h4headings, disclosure summaries, and figure captions that section passes write; the front-matter/section/quiz fragments carry themainopen and close lines themselves (front opens it, quiz closes it) so assembly stays a pure concatenation; and quiz items are confined to the final quiz section as stated in the summary.Refs allod/tools#138
Read-only review pass by a fresh agent (adversarial brief; independent re-run of all three suites from the branch worktree). No hard defects. All nine plan interface contracts verified against the code; the cage argv/env path is shared by all six provider-call sites with
ALLOD_PR_EXPLAIN_OUTLINEthe only added variable; validator,report.css,report.js, and gallery are byte-untouched; suites reproduce 699/104/86.Findings, most material first:
docs/pr-explain.md:296). The consent ceiling (17/16/15) is exact and unaffected. Fix: reword to sections + 4. The wording traces to the dev plan; the docs table is the correct one.pr-explain/lib.sh:176). The sed range/class="rx-toc"/,/<\/nav>/never matches its closing address when the nav opens and closes on one line, so the range runs to end-of-fragment and the href scan scoops any anchor after the TOC. Today the objectives block carries no hrefs, so the guard only ever fails closed — but a future front-mattera.rx-termrefwould spuriously reject valid reports. Fix: bound the extraction to the nav element, with a valid-case fixture as the witness.missing data-layerfragment sabotage that has no dedicated fixture. It is functionally covered — the mechanical check is an exact full-opening-tag match, the same assertionsection-wrong-idexercises — which satisfies the one-sabotage-per-validator testing policy; adding the small fixture makes the plan's enumeration literally true. Will add.Verified in passing: the mid-section interruption fixture genuinely blocks inside pass 3 and asserts exit 130, no output, diagnostics preserved; the five outline sabotages each isolate exactly one schema clause; deviation 3 (forced-T0 membership relaxation) opens no hole — the untouched validator still rejects an empty objectives block, and it never cross-checked triage ids on master either.
Fixes for findings 1–4 follow in a commit and PR-body edit on this branch.
Review findings addressed: commit
41abaf8bounds the TOC guard's href scan to the nav element (finding 3, with a valid post-TOC-anchor witness that would have failed under the old sed range) and adds the missing-data-layer fragment sabotage (finding 4). The PR body now says sections + 4 for the typical run (finding 1) and discloses the quiz-placement narrowing (finding 2). Finding 5 stands as a recorded observation, no action. Suites after the fix: 706 / 104 / 86, all passing. One note for a future cleanup, out of scope here and pre-existing on master: the repair-runner-failure case asserts$(cat …/runner.stderr)equals empty, which passes identically whether the file is empty or missing — a vacuous-assert candidate per memory/shell.md.