Skip to content

CI: make coherence docs portable (green the freshness gate) - #7

Merged
daniloc merged 1 commit into
mainfrom
fix-ci-docs-portability
Jun 22, 2026
Merged

CI: make coherence docs portable (green the freshness gate)#7
daniloc merged 1 commit into
mainfrom
fix-ci-docs-portability

Conversation

@daniloc

@daniloc daniloc commented Jun 22, 2026

Copy link
Copy Markdown
Owner

The docs-freshness gate (added with the coherence-improvements work) has been red since #2 — unrelated to any feature. coherence docs stamps two machine-specific fields into the generated artifacts:

  • a wall-clock generatedAt timestamp, and
  • absRoot, the absolute checkout path (/Users/daniloc/… locally vs /home/runner/… in CI).

The tool's own --check normalizes the timestamp but not absRoot, so CI — regenerating at a different path — always saw graph.json/_graph.html as stale. The committed artifacts only ever matched the one machine that produced them.

Fix: a tiny post-generate normalize step (scripts/coherence-normalize.mjs) collapsing the timestamp + absRoot to constants (both derivation-irrelevant — the graph is derived from the spec tree + code + git history, identical across checkouts). Wired into:

  • coherence:docs → generate, then normalize (committed copy is portable)
  • coherence:docs:check → generate, normalize, then git diff --name-only the four artifacts (deterministic across environments)

Regenerated + normalized the committed docs; coherence:docs:check is green locally. The proper long-term home is the coherence tool emitting relative paths (already tracked in coherence-tooling-upstream.md).

🤖 Generated with Claude Code

The docs-freshness gate (added with the coherence-improvements work) has been red
since #2 for a reason unrelated to any feature: `coherence docs` stamps two
machine-specific fields into graph.json / _graph.html / _overview.html —
  - a wall-clock `generatedAt` timestamp, and
  - `absRoot`, the ABSOLUTE checkout path (/Users/daniloc/… locally vs
    /home/runner/… in CI)
so the committed artifacts only ever matched the one machine that generated them.
The tool's own `--check` normalizes the timestamp but not absRoot, so CI
(regenerating at a different path) always saw graph.json/_graph.html as stale.

Fix: a tiny post-generate normalize step (scripts/coherence-normalize.mjs) that
collapses the timestamp + absRoot to constants — both derivation-irrelevant (the
graph is derived from the spec tree + code + git history, identical across
checkouts). Wired into:
  - coherence:docs       → generate, then normalize (committed copy is portable)
  - coherence:docs:check → generate, normalize, then `git diff --name-only` the
    four artifacts (deterministic across environments)

Regenerated + normalized the committed docs. coherence:docs:check is green.
(The proper home for this is the coherence tool emitting relative paths — a
candidate for the upstreaming already tracked in coherence-tooling-upstream.md.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 22, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
mnemion bb497aa Jun 22 2026, 05:40 PM

@daniloc
daniloc merged commit 2b8789e into main Jun 22, 2026
5 checks passed
@daniloc
daniloc deleted the fix-ci-docs-portability branch June 22, 2026 17:41
daniloc added a commit that referenced this pull request Jun 23, 2026
)

Two-layer prevention for the class where a source edit drifts the committed
coherence graph and CI fails late on coherence:docs:check:

1. Tool fix — bump coherence v0.5.0 → v0.5.1, whose freshness gate now
   normalizes out line numbers. A comment/line-shift edit no longer drifts
   graph.json/_graph.html, so the common false positive is gone and committed
   graph diffs show only real structural change. (This is the deeper fix for
   the cross-env gate finickiness #7/#8 worked around.)

2. Shift-left — a pre-push hook (scripts/git-hooks/pre-push, auto-installed
   via the `prepare` script setting core.hooksPath) runs coherence:docs:check
   before a push. With v0.5.1 it fires ONLY on genuine structural drift
   committed without a regenerate — blocking it on your machine instead of in
   CI, with the exact fix command. Bypass with `git push --no-verify`.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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