Skip to content

Add docs drift prevention and docs-triggered Pages deployment - #3

Merged
t11z merged 1 commit into
mainfrom
claude/friendly-ramanujan-yocgol
Oct 7, 2026
Merged

t11z merged 1 commit into
mainfrom
claude/friendly-ramanujan-yocgol

Conversation

@t11z

@t11z t11z commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

What

Docs drift check (scripts/docs-drift.mjs, no dependencies)

  • RULES maps code areas to the documents that describe them (formats, guardrails, trust boundaries, user flows, Gmail add-on, deployment, bundled dependencies).
  • A rule fires when a change touches its area and none of its documents; the report names rule, files and documents to update.
  • Opt-out: Docs-Impact: none – <reason> as a commit trailer or in the PR description. A reason is required.
  • The dependencies rule compares the dependencies keys of web/package.json, so version bumps and dev tooling do not fire it.
  • Unit tests in scripts/docs-drift.test.mjs.

Enforcement

  • .github/workflows/docs-drift.yml: runs on every PR, re-runs when the description is edited. The PR body is passed via env, not interpolated into the shell.
  • .claude/settings.json: a PreToolUse hook blocks git push and create_pull_request while drift is open (exit 2, report goes to the agent). It fails open if no default branch is available; CI stays the gate.

Threshold: CONTRIBUTING.md#documentation defines when docs are required. The criterion is whether a change alters what a document states, not how big it is. CLAUDE.md points the agent there and marks Privacy/Terms/Imprint as legal texts that need explicit approval.

Pages deployment (pages.yml)

  • Also runs on pushes to main that touch docs/, site/, design/ or the workflow itself.
  • The app under /app/ is now always built from a release tag (latest v*, or the pushed tag), via a git worktree.
  • Automatic deployments are skipped while main has app changes not in that tag (excluding web/tests, web/e2e). Otherwise the docs would describe an app that is not deployed.
  • A manual run deploys anyway, with a warning. It is meant for urgent fixes to legal docs.
  • /BUILD.txt records the site commit and the app tag, and both appear in the job summary. README "Verifying a deployment" and SETUP §5 are updated to match.

Behaviour change to note

There is no v* tag yet. Until one exists, both the automatic and the manual Pages deployment fail and say so. Before this change, a manual run built the app from any ref, which contradicted the README's tag-based verification promise. To bootstrap, tag v0.1.0. The github-pages environment also has to allow deployments from main and v* tags.

Verification

  • node --test scripts/docs-drift.test.mjs: 7/7 pass
  • End-to-end in a scratch clone:
    • code-only commit: CI mode exits 1, hook mode exits 2
    • opt-out in the PR body or a commit trailer: passes
    • unrelated Bash command: hook does nothing
  • Simulated the release-resolution step for four cases: no app change → deploy; unreleased app change on push → skip; same on manual run → deploy with warning; no tag → error.
  • site/build.mjs + check.mjs pass; this PR itself passes the drift check.

🤖 Generated with Claude Code

https://claude.ai/code/session_0198cQvPKzb7BqcEw7VLBWvu


Generated by Claude Code

- scripts/docs-drift.mjs maps code areas to the documents that describe
  them and fails when a change touches such an area without updating one
  of its documents, unless it declares "Docs-Impact: none – <reason>".
- Runs on every pull request (Docs drift workflow) and as a Claude Code
  PreToolUse hook that blocks git push and PR creation while drift is open.
- CONTRIBUTING.md defines the threshold: a change needs docs when it alters
  what a document states, not when it is large.
- pages.yml also deploys when docs/, site/ or design/ change on main. The
  app is always built from a release tag; automatic deployments are skipped
  while main has unreleased app changes. BUILD.txt records both refs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0198cQvPKzb7BqcEw7VLBWvu
@t11z t11z self-assigned this Oct 7, 2026
@t11z t11z added the enhancement New feature or request label Oct 7, 2026
@t11z
t11z merged commit 39a2bdb into main Oct 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants