Skip to content

Check carried markdown section presence at DRIFT (#368, PR-2) - #370

Merged
ptr727 merged 3 commits into
developfrom
section-presence-check-368
Jul 20, 2026
Merged

Check carried markdown section presence at DRIFT (#368, PR-2)#370
ptr727 merged 3 commits into
developfrom
section-presence-check-368

Conversation

@ptr727

@ptr727 ptr727 commented Jul 20, 2026

Copy link
Copy Markdown
Owner

What and why

Second of the staged PRs for #368. PR-1 gave sections a scope; this turns on the section-presence check in the audit. Previously spec/audit.py verified only file-path presence — sections were never read, so a repo carrying an AGENTS.md missing half its required sections passed clean.

Change

  • required_sections(item, sel) — the sections a repo must carry from a baseline entry, filtered by each section's own appliesTo (a bare-string section is *; an object section carries its selector).
  • heading_texts(md) — case-insensitive heading extraction.
  • The file-presence loop unions required sections per path, and for a markdown file that exists, reports a DRIFT for any required section heading that is missing.

Why DRIFT, not LETTER

A heading rename reads as "missing," and equivalence is judged by hand (AUDIT.md §7). DRIFT surfaces in every report and blocks a "clean" verdict but does not flip the exit code (only DEFECT/LETTER/ERROR do), so this is safe to turn on fleet-wide. Non-markdown "sections" (e.g. the tasks.json task group) are intent markers, not headings, so the heading check is gated to .md files.

Verified

  • File-presence behavior unchanged: the checked-path list is identical for all 21 cataloged repos, so this only adds section DRIFT findings — it never changes a LETTER finding or the exit code.
  • Hub's own AGENTS.md passes clean (all 8 required sections present); a doc missing a heading is flagged; section-level appliesTo filtering resolves correctly (ready for PR-3's scoped sections).

Held on develop — no develop → main promotion. The fleet triage (running the live audit to see which repos' AGENTS.md drift) happens after merge.

Turn on the section-presence check the scope mechanism (PR-1) made possible.
spec/audit.py previously verified only file-path presence; sections were never
read. Now, for each carried entry, union the sections scoped to the repo
(required_sections filters each section by its own appliesTo), and for a
markdown file that exists, confirm every required section heading is present
(heading_texts, case-insensitive). A missing section is a DRIFT finding, not a
LETTER - a heading rename reads as missing and equivalence is judged by hand,
and DRIFT does not flip the exit code, so this is safe to run fleet-wide.

Non-markdown "sections" (e.g. a tasks.json task group) are intent markers, not
headings, so the heading check is gated to .md files. File-presence behavior is
unchanged: the checked-path list is identical for all 21 cataloged repos, so
this only adds section DRIFT findings. AUDIT.md notes the new check.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 20, 2026 21:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enables section-presence auditing for carried Markdown files so the fleet audit can surface DRIFT when required headings (scoped via appliesTo) are missing from otherwise-present carried docs.

Changes:

  • Add required_sections() to compute required headings per repo scope, including per-section appliesTo.
  • Add heading_texts() and integrate a Markdown heading-presence check into the file-presence audit loop (DRIFT-only).
  • Update AUDIT.md to document the new section-presence behavior and its DRIFT semantics.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
spec/audit.py Implements scoped required-section computation and a Markdown heading-presence DRIFT check during file presence auditing.
AUDIT.md Documents that missing required Markdown sections in carried files are reported as DRIFT (not LETTER).

Comment thread spec/audit.py Outdated
Comment thread AUDIT.md Outdated
Copilot round-1 findings:
- audit.py: the section-presence check silently skipped when the contents API
  returns no inline content (an oversized >1MB file), which is exactly the
  gates-fail-loud-never-narrow-quietly discipline this repo enforces. Emit a
  DRIFT saying the check could not run instead of passing as a false clean.
- AUDIT.md: drop the clause-joining semicolon on the line edited here.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 20, 2026 21:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread spec/audit.py Outdated
Copilot round-2 finding: the DRIFT message and comment assumed a >1MB oversized
file, but the contents API also omits inline content for a symlink or submodule.
State that no inline content was returned and let triage judge the cause.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 20, 2026 21:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@ptr727
ptr727 merged commit e516e90 into develop Jul 20, 2026
7 checks passed
@ptr727
ptr727 deleted the section-presence-check-368 branch July 20, 2026 21:57
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.

2 participants