Skip to content

feat: architecture drift and historical plans over Git refs (preview) - #690

Merged
aryamthecodebreaker merged 1 commit into
mainfrom
claude/architecture-history-af0bce
Nov 22, 2026
Merged

aryamthecodebreaker merged 1 commit into
mainfrom
claude/architecture-history-af0bce

Conversation

@aryamthecodebreaker

Copy link
Copy Markdown
Owner

Finishes the CLI/MCP work for the Architecture drift and Time-travel graph ledger rows. Everything new is labelled preview.

What changed

  • Drift over historical refs: fixmap history --from <ref> --to <ref> reports added/removed import edges, new/resolved cycles, .fixmap/policy.json boundary violations and coupling growth, in Markdown and JSON, with both exact commit IDs.
  • ADR disagreement: an accepted decision record can state import rules in frontmatter:
    fixmap-deny-imports:
      - "src/core/** -> src/ui/**"
    Edges at --to that break such a rule are reported as decision disagreements with the ADR path, title, rule, violating edge, and whether the edge was introduced in the range. Only this explicit syntax counts, and prose is never read. A malformed rule fails the whole record (decision-parse-failed), and records with any status other than accepted are ignored.
  • Snapshot cache: per exact commit (plus the policy flag), stored under FIXMAP_CACHE_DIR or the user cache using the scan cache's rules, and never written inside the scanned repo. Writes are atomic, each entry carries a sha256 checksum, and corrupt or edited entries are ignored and rebuilt. Entries expire after 7 days. --no-cache / noCache bypass it.
  • Historical Plan queries: fixmap plan --issue <task> --at <ref> (CLI help Preview:) ranks against the repo at that commit, read from Git objects. It uses that commit's .fixmapignore and package.json scripts and adds a historical-plan diagnostic naming the commit. It rejects diff/working-tree/--explain/verify/remote combinations and runs that have no task.
  • MCP: fixmap_history returns decisionDisagreements and accepts noCache. fixmap_plan accepts at (description Preview (may change before v0.10.0): ), validated inside parsePlanArguments. fixmap_context/fixmap_graph still reject at.
  • The feature catalog gains a "Historical plans" entry (preview: true), the CLI README is updated, and packages/action/dist/index.mjs is rebuilt because Core changed.

Ledger evidence

Architecture drift

  • Historical-ref CLI integration: packages/cli/test/history-drift.test.ts covers Markdown and JSON output with both commit IDs, and packages/core/test/architecture-drift.test.ts asserts added/removed edges, a new cycle, a new policy boundary violation, and coupling growth across two real commits.
  • ADR disagreement: an accepted ADR rule violated by an introduced edge is reported. A proposed ADR whose rule is also violated is not. Parser tests cover rejected malformed, absolute, .. and negated patterns, and confirm prose produces no rules.
  • Snapshot persistence: the cache test checks the per-commit files, proves a hit with a checksum-valid marker entry, rebuilds after an edited entry and after a garbage entry, writes nothing with useCache: false, and writes nothing when the cache dir is inside the repo.

Time-travel graph

  • Historical Plan queries: plan --at excludes files added after the ref and untracked worktree files, and includes the ref commit in diagnostics. The same holds through CLI, MCP and Core.
  • Odd-path fixtures: paths with spaces, unicode and deep nesting (odd dir/ünï cöde/a/b/c/d/e/new file.ts) appear correctly in edges and in the ADR rule pattern.
  • Snapshot caching and unknown refs: an unknown ref fails cleanly in Core, CLI (no child command in the message) and plan.
  • Safety: every integration test asserts that git rev-parse HEAD and git status --porcelain --untracked-files=all are unchanged after the command.

Verification

Per the updated process, the full npm run ci was not run locally. These were run on Windows:

  • npm run typecheck, npm run lint, npm run check:action-bundle: pass
  • npm test -w @aryam/fixmap-core: 75 files, 879 passed, 1 skipped
  • npm test -w @aryam/fixmap: 23 files, all pass after updating two expected lists (the preview catalog and the fixmap_history schema keys)

Known limits

  • The cache is keyed on the commit ID plus a hand-bumped ARCHITECTURE_CACHE_VERSION, the same scheme the scan cache uses. A release that changes import-graph logic without bumping it would serve old snapshots for up to 7 days.
  • A policy boundary's decisionId link is not reported as an ADR disagreement; only rules written in the ADR count.
  • Historical plans have no co-change history.

Not touched: the ledger, CHANGELOG, versions, web changelog, Action source.

🤖 Generated with Claude Code

- fixmap history / fixmap_history report decision disagreements: edges at
  the later ref that break a fixmap-deny-imports rule stated by an accepted
  decision record, with ADR path, rule, edge, and whether it was introduced.
- Per-commit architecture snapshot cache outside the repository (scan cache
  location rules), checksummed; corrupt entries are ignored and rebuilt.
  --no-cache / noCache bypass it.
- fixmap plan --at <ref> and fixmap_plan `at` (preview) rank against a
  committed state read from Git objects, honoring that commit's
  .fixmapignore and package scripts, without checkout or worktree changes.
- Real temporary Git repository tests for drift, cycles, policy and ADR
  violations, odd paths, cache hit/corruption, unknown refs, and unchanged
  HEAD/status.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
fixmap Ready Ready Preview Nov 22, 2026 2:38pm UTC

@aryamthecodebreaker
aryamthecodebreaker merged commit 97f76a2 into main Nov 22, 2026
8 checks passed

This branch was successfully deployed

1 active deployment
Preview — 187a3a47 Deployed Nov 22, 2026 by vercel[bot]
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