Skip to content

feat(ci): doc-accuracy reviewer (Layer 2) + weekly audit (Layer 3) - #510

Merged
nockawa merged 3 commits into
mainfrom
feature/490-doc-accuracy-reviewer
Jul 18, 2026
Merged

nockawa merged 3 commits into
mainfrom
feature/490-doc-accuracy-reviewer

Conversation

@nockawa

@nockawa nockawa commented Jul 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Implements Layer 2 + Layer 3 of the doc-accuracy design (claude/design/doc-accuracy-and-generated-artifacts.md) — the semantic drift (prose contradicting code) that no linter or generator can catch. Layer 1 (telemetry --check + broken-link/xref gates) is already live in build-docs.yml.

What's here

  • coverage/docs-affected-map.json — coarse source-area → doc-page map, the hand-authored twin of the test-affected map. Generous values; routes Transactions/ECS/Query/Storage → the agent-guidance page (part of Author 'Using Typhon with an AI coding agent' guidance (idioms + gotchas) #498). Validated: 0 stale entries across all 18 source areas.
  • scripts/docs-affected.py — resolver: changed files → affected pages; surfaces unmapped source areas and stale map entries so the map self-heals.
  • .github/workflows/doc-accuracy-review.yml — Layer 2: scoped, advisory per-PR reviewer (reuses the issue-triage auth — no new secrets). Posts one comment citing file:line for both the doc line and the contradicting code line; fork PRs skipped.
  • .github/workflows/doc-accuracy-audit.yml — Layer 3: weekly whole-corpus sweep that files issues (the recall safety net for what per-PR scoping misses), deduped against open [doc-audit] issues and capped at 5/run.

Also folds in the doc edits from the #498/#502 pass: the agent-guidance page coherence fix, and the attribute-arg fix surfaced by the #502 A/B (bare [Component]/[Archetype] → the required-arg forms) in the page primer and the llms.txt preamble.

Design constraints honored (from the design doc)

  • Scoped, never whole-corpus per PR — the map bounds the read set; recall is delegated to Layer 3.
  • Advisory, non-blocking; every finding cites file:line for both sides.
  • generate > lint > LLM-judge precedence — the LLM only ever sees the irreducible prose residue.

Validation (local)

  • Map: 0 stale entries (every mapped page exists on disk).
  • Resolver: args + stdin paths; the real Foundation/Concurrency/AccessControlSmall.cs routes correctly (the design's headline example).
  • Both workflows: YAML parses clean.

🐕 Dogfood — the net caught real drift on its own PR

Contrary to my initial assumption, a new pull_request workflow does run on the PR that introduces it. The review check ran the Layer-2 reviewer against this PR's doc change, passed, and correctly flagged that the idioms table row 1 still showed bare [Component]/[Archetype] while the §5 primer + §4 example used the required-arg forms — grounding the finding in src/Typhon.Schema.Definition/Attributes.cs (args are required) and citing file:line on both sides. Fixed in 22c9301. The net demonstrated itself on commit #1.

Part of #490.

🤖 Generated with Claude Code

https://claude.ai/code/session_01E8KzH4pPW5Dq7Y94NXfgrM

Implements Layer 2 and Layer 3 of the doc-accuracy design
(claude/design/doc-accuracy-and-generated-artifacts.md) — the semantic
half no linter or generator can catch (prose contradicting code).

- coverage/docs-affected-map.json — coarse source-area -> doc-page map,
  the hand-authored twin of the test-affected map. Generous values;
  routes Transactions/ECS/Query/Storage -> the agent-guidance page.
- scripts/docs-affected.py — resolver: changed files -> affected pages;
  surfaces unmapped source areas and stale map entries (self-healing).
- .github/workflows/doc-accuracy-review.yml — Layer 2: scoped, advisory
  per-PR reviewer (reuses the issue-triage auth), one comment citing
  file:line for both the doc line and the contradicting code line;
  fork PRs skipped.
- .github/workflows/doc-accuracy-audit.yml — Layer 3: weekly whole-corpus
  sweep that files issues (the recall safety net for what the scoped map
  misses), deduped against open findings and capped.

Also folds in the doc edits from the #498/#502 pass: the agent-guidance
page coherence fix, plus the attribute-arg fix surfaced by the #502 A/B
(bare [Component]/[Archetype] -> the required-arg forms) in the page
primer and the llms.txt preamble.

Part of #490.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E8KzH4pPW5Dq7Y94NXfgrM
@github-actions

Copy link
Copy Markdown
Contributor

📝 Doc-accuracy review (advisory · scoped · Layer 2)

Reviewed: doc/guide/using-with-ai-coding-agents.md

Finding:

  • doc/guide/using-with-ai-coding-agents.md:42 — Idioms table row 1 shows bare [Component] / [Archetype] without required constructor args:

    Declare [Component] / [Archetype] types in any namespace — including the global namespace of a top-level-statements file

    This diff updated the primer block (lines 126–130) to explicitly state [Component("Name", 1)] (name + revision required) and [Archetype(1)] (id required). The source confirms: src/Typhon.Schema.Definition/Attributes.cs:42 has ComponentAttribute(string name, int revision) (no defaults); :140 has ArchetypeAttribute(ushort id, …) (id required). The table's bare form now contradicts the primer on the same page.

    Suggested fix: Update row 1's "Do" cell to Declare \[Component("Name", rev)]` / `[Archetype(id)]` types in any namespace …` so the syntax is consistent with the primer and with the code sample in §4.

Advisory & scoped to the pages the change touches — recall for cross-cutting or unmapped drift is covered by the weekly Layer 3 audit.

The Layer-2 doc-accuracy reviewer added in this PR ran on this PR and
flagged that the idioms table row 1 still showed bare [Component] /
[Archetype] while the §5 primer and §4 example use the required-arg
forms. Make row 1 consistent: [Component("Name", rev)] / [Archetype(id)].

A live demonstration of the net catching real drift on its own PR.

Part of #490.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E8KzH4pPW5Dq7Y94NXfgrM
@github-actions

Copy link
Copy Markdown
Contributor

📝 Doc-accuracy review (advisory · scoped · Layer 2)

Reviewed: doc/guide/using-with-ai-coding-agents.md (edited in this PR)

Findings:

  • doc/guide/using-with-ai-coding-agents.md:63 — Code comment // (1) types live in a namespace, never the global one contradicts idiom TestRider #1 at line 42, which this PR updated to say "including the global namespace of a top-level-statements file" and added a "Don't" column explicitly stating "don't assume they must be wrapped in a named namespace." The comment's "never the global one" is now a direct, annotated-with-(1) contradiction of the updated idiom.
    • No contradicting source line needed: src/Typhon.Schema.Definition/Attributes.cs places no namespace restriction on ComponentAttribute or ArchetypeAttribute; any namespace, including global, is valid.
    • Suggested fix: Change the comment to: // (1) named namespace is tidier for a real project — the global namespace also works

Advisory & scoped to the pages the change touches — recall for cross-cutting or unmapped drift is covered by the weekly Layer 3 audit.

Second finding from the Layer-2 reviewer dogfooding on this PR: the §4
minimal-example comment still asserted the pre-#505 "never the global
one" rule, contradicting the softened idiom #1. Align it — a named
namespace is tidier, the global namespace also works.

Part of #490.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E8KzH4pPW5Dq7Y94NXfgrM
@github-actions

Copy link
Copy Markdown
Contributor

📝 Doc-accuracy review (advisory · scoped · Layer 2)

Reviewed: doc/guide/using-with-ai-coding-agents.md

No contradictions found in the reviewed pages.

Cross-checks performed against the diff's substantive claims:

  • [Component("Name", rev)] required args — confirmed: ComponentAttribute(string name, int revision) in src/Typhon.Schema.Definition/Attributes.cs:42
  • [Archetype(id)] required id arg — confirmed: ArchetypeAttribute(ushort id, int revision = 1, string alias = null) at Attributes.cs:140
  • "global namespace also works" — confirmed: src/Typhon.Generators/ArchetypeAccessorGenerator.cs:105-110 explicitly handles IsGlobalNamespace (added in [Archetype] source generator emits unparseable output for global-namespace types (no diagnostic) #505)

Advisory & scoped to the pages the change touches — recall for cross-cutting or unmapped drift is covered by the weekly Layer 3 audit.

@nockawa
nockawa merged commit c8144b6 into main Jul 18, 2026
9 checks passed
@nockawa
nockawa deleted the feature/490-doc-accuracy-reviewer branch July 18, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant