Knowledge gate: unmapped new modules can pass with any documentation edit
Back to our planSummary
Part of the knowledge-layer epic #712. Tighten the existing knowledge gate for newly introduced modules without weakening its current mapped-note checks or legitimate exemptions.
Verified problem
knowledge-sync.mjs requires an existing mapped note to change when its behavior-bearing code changes. However, behavior-bearing files outside map.json fall back to checking whether any documentation changed.
Consequently, adding a new module such as src/modules/weather/collector.ts alongside an unrelated edit to docs/project.md can pass without a corresponding module note or map entry. A mapped note that is missing is also skipped; deleted documentation can currently count as a documentation change.
This is a documentation-coverage weakness, not proof that automated semantic detection exists. The independent reviewer must still judge whether the documentation accurately explains the behavior.
Confirmed in the code: knowledgeProblems enforces only map entries whose note exists, and reports unmapped behavior files only when no doc at all changed (uncovered.length > 0 && docs.length === 0).
Acceptance criteria
(Added when filing, from the review's stated direction.)
- Not done: A new behavior-bearing module needs a corresponding note and a valid
map.jsonentry in the same PR, or an explicitly reviewed, scoped exemption; an unrelated documentation edit no longer satisfies the gate. - Not done: A deleted document or note does not count as a documentation change.
- Not done: A map entry whose note is missing is reported, not skipped.
- Not done: Existing mapped-note checks, generated-reference checks and the
Behavior change: noneexemption keep working. - Not done: Regression tests for each case above, including the weather-module example.
Generated by Claude Code, opens in a new tab