Skip to content

feat(gates): guard README version-badge drift in the docsync gate - #327

Merged
dngioidev merged 1 commit into
mainfrom
feat/309-docsync-badge-gate
Aug 1, 2026
Merged

feat(gates): guard README version-badge drift in the docsync gate#327
dngioidev merged 1 commit into
mainfrom
feat/309-docsync-badge-gate

Conversation

@dngioidev

Copy link
Copy Markdown
Owner

What & why

The docsync gate (plugin/scripts/gates/docsync.mjs) only verified that docs are listed in the docs/README.md route index, so the stale README shields.io version badge (0.16.0 while package.json was 0.18.0) slipped past forge's own gate. #308 fixed the badge value and added a standalone vitest guard (tests/readme-version.test.mjs); this ticket wires the same invariant into the docsync GATE so it's enforced mechanically at ship + CI, not just as a unit test.

Changes

  • parseBadgeVersion / badgeVersionDrift pure helpers + a badge-vs-package.json check in runDocSync (package.json is the source of truth). Runs even when there's no docs/README.md route index, and is a no-op when the README carries no badge (no false positives).
  • MCP gate verdict (server.mjs) surfaces badge drift in its findings.
  • tests/gates/docsync.test.mjs extended with AC-309.1 / AC-309.2 + helper coverage.

Acceptance criteria

  • AC.1 docsync FAILS when the README version badge != package.json version — badge check added to runDocSync; drift sets res.ok=false with a clear message. Verified: AC-309.1 test + running the gate against a drifted tree.
  • AC.2 unit test covers both in-sync (pass) and drifted (fail) cases — AC-309.2 (pass) and AC-309.1 (fail) in tests/gates/docsync.test.mjs.

Verification

  • pnpm verify — 579/579 green (53 files).
  • node plugin/scripts/gates/docsync.mjs --base main on the current tree → doc-sync: clean (52 docs indexed), exit 0 (badge 0.18.0 == package.json 0.18.0), so CI stays green.

Closes #309

🤖 Generated with Claude Code

The docsync gate only checked the docs/README.md route index, so the
stale README shields.io version badge (0.16.0 while package.json was
0.18.0) slipped past forge's own gate. #308 fixed the value and added a
standalone vitest guard; this wires the SAME invariant into the docsync
GATE so it is enforced mechanically at ship + CI, not just as a unit test.

- Add parseBadgeVersion / badgeVersionDrift pure helpers and a badge-vs-
  package.json check to runDocSync (package.json is the source of truth).
  The check runs even when there is no docs/README.md route index, and is
  a no-op when the README carries no badge (no false positives).
- Surface badge drift in the MCP gate verdict findings.
- Extend tests/gates/docsync.test.mjs with AC-309.1 (drift -> fail) and
  AC-309.2 (in-sync -> pass), plus helper-level coverage.

Closes #309

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SATRHKa6mDHDuirhP6QuwL
@dngioidev
dngioidev merged commit d6bb1b0 into main Aug 1, 2026
6 checks passed
@dngioidev
dngioidev deleted the feat/309-docsync-badge-gate branch August 1, 2026 17:03
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.

docsync gate: guard README version-badge drift against package.json

1 participant