Skip to content

Delegate materialization cache diagnostics to git-cas - #778

Merged
flyingrobots merged 2 commits into
mainfrom
v19/git-cas-diagnostics
Jul 25, 2026
Merged

Delegate materialization cache diagnostics to git-cas#778
flyingrobots merged 2 commits into
mainfrom
v19/git-cas-diagnostics

Conversation

@flyingrobots

Copy link
Copy Markdown
Member

Summary

  • remove the WARP-owned mutable state-snapshot index, graph-scoped RootSet coordinator, and retention repair protocol
  • compose git-cas CacheSet doctor, sweep, and repair evidence with WARP lane and coordinate meaning
  • replace --repair-state-cache with --repair-materialization-cache, preserving other lanes and never recreating missing bytes or running destructive GC
  • document that unreleased descriptor profiles v2-v4 and old derived-cache refs are not migrated; authoritative WARP history rebuilds misses

Validation

  • npm run test:coverage:ci -- --maxWorkers=4: 613 passed, 1 skipped; 7,339 tests passed, 2 skipped; 92.97% lines versus 92.95% required
  • npm run lint
  • npm run lint:md
  • npm run lint:docs-topology
  • npm run lint:md:code
  • npm run typecheck
  • npm run typecheck:consumer
  • npm run typecheck:surface
  • npx vitest run --maxWorkers=4 test/integration: 22 files, 105 tests
  • PATH="$PWD/bin:$PATH" bats test/bats/cli-doctor.bats: 5 tests
  • repository IRONCLAD pre-push firewall: all gates passed

Closes #741

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@flyingrobots, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 43 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: dcc7653a-ca29-4850-8808-6b4d7454c351

📥 Commits

Reviewing files that changed from the base of the PR and between 015b41a and 276e97c.

📒 Files selected for processing (2)
  • bin/cli/commands/doctor/checksMaterializationCache.ts
  • test/unit/cli/doctor-materialization-cache.test.ts
📝 Walkthrough

Walkthrough

The PR replaces WARP-owned state-cache retention inspection and repair with git-cas materialization-cache diagnostics, updates git warp doctor and its repair flag, removes legacy cache coordination, and adds adapter, CLI, boundary, and documentation coverage.

Changes

Materialization cache diagnostics

Layer / File(s) Summary
Diagnostics contract and runtime integration
src/ports/*, src/infrastructure/adapters/*, test/helpers/InMemoryGitCasFacade.ts, test/unit/infrastructure/adapters/*
Adds typed inspection and repair results, implements git-cas-backed diagnostics, wires it into repository services, and validates missing, malformed, expired, live, and cross-lane entries.
Doctor findings and CLI orchestration
bin/cli/commands/doctor/*, bin/cli/schemas.ts, test/unit/cli/*, test/bats/cli-doctor.bats
Replaces state-cache findings and repair with materialization-cache checks, ordered findings, new codes, and --repair-materialization-cache handling.
Migration documentation
CHANGELOG.md, README.md, docs/*
Documents the git-cas ownership model, removed state-cache machinery, new repair command, and non-recreation of missing bytes.
Boundary and codec validation
test/unit/infrastructure/adapters/GitCasMaterializationReplayBasis.test.ts, test/unit/infrastructure/adapters/GitPlumbingRuntimeAdapter.test.ts, test/unit/infrastructure/codecs/WarpStateCborCodec.test.ts
Adds tests for replay-basis failure cases, plumbing boundary shape, and canonical full-state CBOR compatibility and rejection behavior.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related issues

  • Issue 734 — Covers the broader v19 delegation of WARP cache diagnostics, retention, repair, and ownership to git-cas.

Possibly related PRs

Poem

A rabbit found a cache in the snow,
With stale little keys in a row.
“Git-cas,” said the hare, “will repair what is there—
But lost bytes won’t magically grow.”

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: delegating materialization cache diagnostics to git-cas.
Description check ✅ Passed The description covers summary, validation, and the linked issue; only the ADR checklist section is missing.
Linked Issues check ✅ Passed The changes remove WARP retention code and add git-cas-backed materialization diagnostics and repair, matching #741.
Out of Scope Changes check ✅ Passed Most changes stay on the materialization-cache/doctor refactor, with no clearly unrelated code paths introduced.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

Release Preflight

  • package version: 18.2.1
  • prerelease: false
  • npm dist-tag on release: latest
  • npm pack dry-run: passed
  • jsr publish dry-run: passed

If this PR is from a release/* branch and merges to main, Main Push Release Branch Check will run final preflight and create v18.2.1. A maintainer who is a JSR @git-stunts scope member must then dispatch the Release workflow manually.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@bin/cli/commands/doctor/checksMaterializationCache.ts`:
- Around line 110-124: Update invalidCacheFinding to return a failing
DoctorFinding whenever inspection.healthy is false, even when inspection.issues
is empty; retain the existing null result for healthy inspections and preserve
the current evidence and message behavior for reported issues. Ensure
materializationCacheFindings cannot fall through to healthyCacheFinding and
report status "ok" for any unhealthy inspection.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e164a5d0-bb2c-465b-a90a-4c3091f2947a

📥 Commits

Reviewing files that changed from the base of the PR and between 0c32cbd and 015b41a.

📒 Files selected for processing (42)
  • CHANGELOG.md
  • README.md
  • bin/cli/commands/doctor/checksMaterializationCache.ts
  • bin/cli/commands/doctor/checksStateCache.ts
  • bin/cli/commands/doctor/codes.ts
  • bin/cli/commands/doctor/index.ts
  • bin/cli/commands/doctor/stateCacheCapability.ts
  • bin/cli/commands/doctor/storageCapabilities.ts
  • bin/cli/commands/doctor/types.ts
  • bin/cli/schemas.ts
  • docs/TECHNICAL_TEARDOWN.md
  • docs/topics/cas-first-memoized-materialization.md
  • docs/topics/cli.md
  • docs/topics/getting-started.md
  • src/domain/services/state/WarpStateCacheRepairResult.ts
  • src/domain/services/state/WarpStateCacheRetentionReport.ts
  • src/infrastructure/adapters/GitCasMaterializationCacheDiagnosticsAdapter.ts
  • src/infrastructure/adapters/GitCasRepositoryAdapter.ts
  • src/infrastructure/adapters/GitCasStateCacheIndex.ts
  • src/infrastructure/adapters/GitCasStateCacheIndexCodec.ts
  • src/infrastructure/adapters/GitCasStateCacheRootSetCoordinator.ts
  • src/infrastructure/adapters/GitCasWarpStateCacheAdapter.ts
  • src/ports/MaterializationCacheDiagnosticsPort.ts
  • src/ports/RuntimeStorageProviderPort.ts
  • src/ports/WarpStateCacheRetentionPort.ts
  • test/bats/cli-doctor.bats
  • test/helpers/InMemoryGitCasFacade.ts
  • test/integration/infrastructure/adapters/GitCasWarpStateCacheAdapter.retention.integration.test.ts
  • test/unit/cli/doctor-materialization-cache.test.ts
  • test/unit/cli/doctor-state-cache-retention.test.ts
  • test/unit/cli/doctor.test.ts
  • test/unit/cli/schemas.test.ts
  • test/unit/domain/services/state/WarpStateCacheRetentionResults.test.ts
  • test/unit/infrastructure/adapters/GitCasMaterializationCacheDiagnosticsAdapter.test.ts
  • test/unit/infrastructure/adapters/GitCasMaterializationReplayBasis.test.ts
  • test/unit/infrastructure/adapters/GitCasRepositoryAdapter.test.ts
  • test/unit/infrastructure/adapters/GitCasStateCacheIndexCodec.test.ts
  • test/unit/infrastructure/adapters/GitCasStateCacheRootSetCoordinator.test.ts
  • test/unit/infrastructure/adapters/GitCasWarpStateCacheAdapter.retention.test.ts
  • test/unit/infrastructure/adapters/GitCasWarpStateCacheAdapter.test.ts
  • test/unit/infrastructure/adapters/GitPlumbingRuntimeAdapter.test.ts
  • test/unit/infrastructure/codecs/WarpStateCborCodec.test.ts
💤 Files with no reviewable changes (16)
  • test/unit/infrastructure/adapters/GitCasStateCacheRootSetCoordinator.test.ts
  • test/unit/infrastructure/adapters/GitCasWarpStateCacheAdapter.retention.test.ts
  • test/unit/infrastructure/adapters/GitCasStateCacheIndexCodec.test.ts
  • test/unit/domain/services/state/WarpStateCacheRetentionResults.test.ts
  • test/integration/infrastructure/adapters/GitCasWarpStateCacheAdapter.retention.integration.test.ts
  • src/infrastructure/adapters/GitCasStateCacheIndexCodec.ts
  • bin/cli/commands/doctor/stateCacheCapability.ts
  • test/unit/infrastructure/adapters/GitCasWarpStateCacheAdapter.test.ts
  • test/unit/cli/doctor-state-cache-retention.test.ts
  • src/infrastructure/adapters/GitCasWarpStateCacheAdapter.ts
  • src/ports/WarpStateCacheRetentionPort.ts
  • src/domain/services/state/WarpStateCacheRetentionReport.ts
  • bin/cli/commands/doctor/checksStateCache.ts
  • src/infrastructure/adapters/GitCasStateCacheRootSetCoordinator.ts
  • src/infrastructure/adapters/GitCasStateCacheIndex.ts
  • src/domain/services/state/WarpStateCacheRepairResult.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: test-node (22)
  • GitHub Check: preflight
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js,jsx}: Do not use direct imports from src/infrastructure/** in src/domain/** or src/ports/**; depend on a port instead.
Do not use direct Node built-ins in src/domain/** or src/ports/**; use a port instead.

Files:

  • test/unit/infrastructure/adapters/GitPlumbingRuntimeAdapter.test.ts
  • src/ports/MaterializationCacheDiagnosticsPort.ts
  • test/unit/cli/schemas.test.ts
  • bin/cli/commands/doctor/codes.ts
  • test/unit/infrastructure/adapters/GitCasMaterializationReplayBasis.test.ts
  • test/unit/infrastructure/codecs/WarpStateCborCodec.test.ts
  • bin/cli/commands/doctor/types.ts
  • bin/cli/schemas.ts
  • test/unit/cli/doctor-materialization-cache.test.ts
  • src/ports/RuntimeStorageProviderPort.ts
  • src/infrastructure/adapters/GitCasMaterializationCacheDiagnosticsAdapter.ts
  • bin/cli/commands/doctor/checksMaterializationCache.ts
  • bin/cli/commands/doctor/storageCapabilities.ts
  • test/unit/infrastructure/adapters/GitCasRepositoryAdapter.test.ts
  • test/helpers/InMemoryGitCasFacade.ts
  • bin/cli/commands/doctor/index.ts
  • src/infrastructure/adapters/GitCasRepositoryAdapter.ts
  • test/unit/infrastructure/adapters/GitCasMaterializationCacheDiagnosticsAdapter.test.ts
  • test/unit/cli/doctor.test.ts
src/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.{ts,tsx,js,jsx}: Do not introduce any, as any, as unknown as, unknown (outside adapters), Record<string, unknown> (outside adapters), *Like placeholder types, JSON.parse/JSON.stringify (outside adapters), fetch (outside adapters), process.env (outside adapters), @ts-ignore, or z.any() in core code; use validated boundary models and ports instead.
Use constructor-injected ports for external capabilities; do not rely on ambient dependencies for I/O, clocks, persistence, or entropy.
Do not create utils.ts, helpers.ts, misc.ts, or common.ts; name files after the actual concept they model.
Prefer one file per class, type, or object; if a file accumulates peer concepts, split it.
Keep helper corridors, fake shape trust, transitional duplication, and compile-time theater out of the codebase; runtime-honest TypeScript must reflect actual behavior.
No enum usage; prefer runtime-backed domain forms and unions.
Do not use boolean trap parameters; prefer named option objects or separate methods.
Avoid magic strings or numbers when a named constant should exist.
Keep domain bytes as Uint8Array; Buffer belongs in infrastructure adapters.

Files:

  • src/ports/MaterializationCacheDiagnosticsPort.ts
  • src/ports/RuntimeStorageProviderPort.ts
  • src/infrastructure/adapters/GitCasMaterializationCacheDiagnosticsAdapter.ts
  • src/infrastructure/adapters/GitCasRepositoryAdapter.ts
src/ports/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

In src/ports/**, do not import Node built-ins or src/infrastructure/**; ports must stay abstract and depend only on boundary-safe types.

Files:

  • src/ports/MaterializationCacheDiagnosticsPort.ts
  • src/ports/RuntimeStorageProviderPort.ts
🧠 Learnings (1)
📚 Learning: 2026-03-08T19:50:17.519Z
Learnt from: flyingrobots
Repo: git-stunts/git-warp PR: 65
File: CHANGELOG.md:88-88
Timestamp: 2026-03-08T19:50:17.519Z
Learning: Follow the Keep a Changelog convention for CHANGELOG.md. Allow duplicate subheadings across versions (e.g., '### Added', '### Fixed'). Configure markdownlint MD024 with {"siblings_only": true} to avoid cross-version false positives.

Applied to files:

  • CHANGELOG.md
🔇 Additional comments (28)
CHANGELOG.md (1)

93-96: LGTM!

Also applies to: 107-110

README.md (1)

124-126: LGTM!

docs/TECHNICAL_TEARDOWN.md (1)

246-247: LGTM!

Also applies to: 1663-1664

docs/topics/cas-first-memoized-materialization.md (1)

177-188: LGTM!

Also applies to: 192-215

docs/topics/cli.md (1)

42-47: LGTM!

docs/topics/getting-started.md (1)

106-106: LGTM!

src/ports/MaterializationCacheDiagnosticsPort.ts (1)

1-68: LGTM!

src/ports/RuntimeStorageProviderPort.ts (1)

11-11: LGTM!

Also applies to: 36-38

src/infrastructure/adapters/GitCasMaterializationCacheDiagnosticsAdapter.ts (2)

86-89: LGTM on the deliberate double-handling of the cache-open promise (silence unhandled-rejection while still awaiting the real promise later).


111-136: 🗄️ Data Integrity & Integration

No change needed. @git-stunts/git-cas@6.5.3 defines CacheInspection.state and CacheInspection.policy separately, and CacheSet.repair() only accepts entries, so retained.state.policy is not a hidden policy.limits payload.

			> Likely an incorrect or invalid review comment.
src/infrastructure/adapters/GitCasRepositoryAdapter.ts (1)

37-39: LGTM!

Also applies to: 58-64, 111-139

test/helpers/InMemoryGitCasFacade.ts (1)

356-604: LGTM!

test/unit/infrastructure/adapters/GitCasMaterializationCacheDiagnosticsAdapter.test.ts (1)

1-403: LGTM!

test/unit/infrastructure/adapters/GitCasRepositoryAdapter.test.ts (1)

104-112: LGTM!

Also applies to: 137-137

test/unit/infrastructure/adapters/GitCasMaterializationReplayBasis.test.ts (1)

1-99: LGTM!

test/unit/infrastructure/adapters/GitPlumbingRuntimeAdapter.test.ts (1)

1-14: LGTM!

test/unit/infrastructure/codecs/WarpStateCborCodec.test.ts (1)

1-135: LGTM!

bin/cli/commands/doctor/checksMaterializationCache.ts (2)

1-108: LGTM!


126-159: LGTM!

Also applies to: 179-223

bin/cli/commands/doctor/codes.ts (1)

46-53: LGTM!

bin/cli/commands/doctor/index.ts (1)

17-28: LGTM!

Also applies to: 37-37, 60-96, 105-106, 168-169, 197-202

bin/cli/commands/doctor/storageCapabilities.ts (1)

27-104: LGTM!

bin/cli/commands/doctor/types.ts (1)

9-11: LGTM!

Also applies to: 70-71

bin/cli/schemas.ts (1)

131-131: LGTM!

test/bats/cli-doctor.bats (1)

41-41: LGTM!

Also applies to: 58-58

test/unit/cli/doctor-materialization-cache.test.ts (1)

1-147: LGTM!

test/unit/cli/doctor.test.ts (1)

9-10: LGTM!

Also applies to: 80-94, 239-288

test/unit/cli/schemas.test.ts (1)

66-69: LGTM!

Comment thread bin/cli/commands/doctor/checksMaterializationCache.ts
@github-actions

Copy link
Copy Markdown

Release Preflight

  • package version: 18.2.1
  • prerelease: false
  • npm dist-tag on release: latest
  • npm pack dry-run: passed
  • jsr publish dry-run: passed

If this PR is from a release/* branch and merges to main, Main Push Release Branch Check will run final preflight and create v18.2.1. A maintainer who is a JSR @git-stunts scope member must then dispatch the Release workflow manually.

@flyingrobots
flyingrobots merged commit 1282167 into main Jul 25, 2026
17 checks passed
@flyingrobots
flyingrobots deleted the v19/git-cas-diagnostics branch July 25, 2026 18:09
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.

Delegate WARP doctor, retention repair, and usage evidence to git-cas

1 participant