D79 Wave 1: the structure stage — deterministic skeleton, sanity check, anchor fallback (#165) - #169
Merged
Merged
Conversation
Use a dedicated flash-class title-only role seat because role assignment has an independent generation/version and bounded title-only contract; sharing the fallback seat would couple configuration and provenance.
Both reviews REQUEST-CHANGES; every finding applied: - Generation identity seeds from route + selected-tree hash, never the checker version: a checker bump over an unchanged route derives the same id (ON CONFLICT no-op — no minted generation, no pointer churn), a route flip or different fallback tree genuinely appends. Two-run test locks it. - blocks_from_sidecar (blockizer-owned, D57): a stale pre-metadata blocks.json re-derives blocks from document.md instead of dead-lettering queued STRUCTURE/CHUNK work; both handlers use it; produce-side validation stays strict. Tested with a genuine legacy sidecar. - Hard-forget explicitly deletes document_structure_generations then document_skeleton_checks (FK order), verifies both in the scrub query, and the forget test seeds + asserts them. - Every fallback tree faces the terminal judge: density/leaf gate demotions enter the same fallback -> terminal-check sequence (shared helper); generation rows now uniformly describe the SELECTED tree while check records describe candidates; design state machine clarified. - Checker prompt rendering is linear (was quadratic: full re-render per candidate, ~5s CPU at 6k headings); sampling tag bumped to sample-v2. - check_outcome hygiene: not_run_short renders no prompt and records no hash (nullable column); ValueError classifies as invalid_response for non-OpenRouter seats; provider_unavailable stays distinguishable in the failure envelope. - level_jump_count uses raw heading levels only (d79-v2 stats): pairs missing a level are excluded, all-anchor trees report null — never the structurally fake zero the design warns about; checker lines render level=null honestly. - Packing-vs-heading-metadata byte-equivalence regression; multi-section legacy backfill coverage; a non-current generation with a poison section provably never leaks into P3; migration downgrade documented one-way; out-of-scope ruff exclusion reverted. - D66 same-PR docs: project-status describes the shipped parser -> check -> fallback route; deployment page + .env.example document the three structure seats and the narrowed STRUCTURER meaning. Gate: ruff clean, pyright 0 errors, pytest 986 passed incl. Postgres. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GKENhTLJg1HqhbdwCmmkbc
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
Wave 1 of 3 for #165 — the D79 structure stage, per
plan/designs/e0_files_design.md§4.1 and D79 + amendments.What ships
blockizer-2026.07bbump) with the chunk grid proven byte-identical two ways: the golden-digest lock AND a packing byte-equivalence regression under mutated metadata. Stale pre-metadata sidecars re-derive viablocks_from_sidecarinstead of dead-lettering queued work.d79-v2), budget-bounded flash judge (REMEMBERSTACK_SKELETON_CHECK_MODEL, default glm-4.7-flash) with anomaly-exemplar-first deterministic sampling under a hard 16K ceiling, one closed verdict enum,check_outcomeseparating outages from verdicts, fail-open as a non-authority guard.REMEMBERSTACK_STRUCTURER_MODELnarrows to this seat); every fallback tree faces the terminal judge — gate demotions included — degrading to the synthetic root on terminal incoherence. No cycles.REMEMBERSTACK_ROLE_MODEL) → explicitbody; failure degrades, never retries.p1_04_0019), D53 recorded N/A, hard-forget covering both new tables explicitly with scrub verification..env.exampledocument the three structure seats.Review trail
Codex (gpt-5.6-sol, xhigh) implemented; Grok-4.5 (3 MAJOR / 9 MINOR) and Opus (4 MAJOR / 11 MINOR) reviewed independently, both REQUEST-CHANGES; the second commit applies every finding — including Opus's measured quadratic prompt renderer (~5s CPU at 6K headings, now linear) and the generation-identity rule both reviewers caught from different angles. Final review and adjustments by Claude.
Gate
ruff clean, pyright 0 errors, 986 passed including the Postgres-gated suites (migration round-trip, backfill, forget scrub, P3 leak test). Benchmarks and the tool catalog untouched — engine-side only.