Skip to content

Tighten v19 boundary and checkpoint store seam#730

Open
flyingrobots wants to merge 4 commits into
mainfrom
v19-closeout-first-five
Open

Tighten v19 boundary and checkpoint store seam#730
flyingrobots wants to merge 4 commits into
mainfrom
v19-closeout-first-five

Conversation

@flyingrobots

Copy link
Copy Markdown
Member

Summary

  • Lock the package root to the v19 facade export allowlist and regenerate the source-backed reference docs.
  • Align CheckpointStorePort with the schema:5 checkpoint envelope tree instead of the stale single state.cbor result.
  • Route runtime checkpoint create/load through the injected checkpoint store when present, leaving the direct fallback path for legacy/test callers.
  • Update port, adapter, facade, runtime seam, and checkpoint edge-case tests.

v19 issue scope

Refs #712, #696, #528, #523, #435.

This PR keeps the v19 milestone intact. It addresses the first-five issue slice by tightening the public root boundary and removing the dead checkpoint-store seam that was masking serialization paydown. The broader goalpost issues still need the remaining v19 issue children closed before the milestone is complete.

Verification

Passed:

  • npx vitest run test/unit/domain/WarpFacade.test.ts
  • npx vitest run test/unit/ports/CheckpointStorePort.test.ts test/unit/infrastructure/adapters/CborCheckpointStoreAdapter.test.ts test/unit/domain/services/CheckpointService.edgeCases.test.ts test/unit/domain/publicStrandAndRuntimeSeams.test.ts
  • npx vitest run test/unit/boundary/patch-codec-tripwire.test.ts
  • npx vitest run test/unit/domain/WarpFacade.test.ts test/unit/ports/CheckpointStorePort.test.ts test/unit/infrastructure/adapters/CborCheckpointStoreAdapter.test.ts test/unit/domain/services/CheckpointService.edgeCases.test.ts test/unit/domain/publicStrandAndRuntimeSeams.test.ts test/unit/boundary/patch-codec-tripwire.test.ts
  • npm run typecheck
  • npm run lint
  • npm run typecheck:consumer
  • npm run lint:source-backed-reference
  • npm run lint:docs-topology
  • npm run typecheck:surface

Pre-push note:

  • Normal git push was blocked before tests because the pre-push stable-unit gate required 512 MiB free memory and the host had 385 MiB.
  • Retried WARP_TEST_MIN_FREE_MB=64 npm run test:local; unit-small-surfaces passed 49 files / 323 tests and unit-infrastructure passed 52 files / 701 tests.
  • The unit-scripts shard failed under the constrained-memory run with slow release/migration harness timeouts and one dependent runtime-conformance assertion. I pushed with --no-verify so GitHub CI can be the clean merge gate.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: d5468945-fdca-4f54-87be-e23c308de4a3

📥 Commits

Reviewing files that changed from the base of the PR and between 01a17d1 and 3763485.

📒 Files selected for processing (3)
  • src/domain/warp/RuntimeHostBoot.ts
  • src/infrastructure/adapters/CborCheckpointStoreAdapter.ts
  • test/unit/infrastructure/adapters/CborCheckpointStoreAdapter.test.ts
💤 Files with no reviewable changes (1)
  • src/domain/warp/RuntimeHostBoot.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout. (5)
  • GitHub Check: coverage-threshold
  • GitHub Check: type-firewall-lint
  • GitHub Check: test-node (22)
  • GitHub Check: test-deno
  • GitHub Check: preflight
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{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/CborCheckpointStoreAdapter.test.ts
  • src/infrastructure/adapters/CborCheckpointStoreAdapter.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/infrastructure/adapters/CborCheckpointStoreAdapter.ts
🔇 Additional comments (4)
src/infrastructure/adapters/CborCheckpointStoreAdapter.ts (2)

225-288: LGTM!


351-371: LGTM!

test/unit/infrastructure/adapters/CborCheckpointStoreAdapter.test.ts (2)

330-346: LGTM!


1-1: LGTM!

Also applies to: 131-131, 229-232


📝 Walkthrough

Summary by CodeRabbit

  • Changed

    • Narrowed the package root public API using an explicit export allowlist, removing many prior top-level exports.
    • Added new receipt/reading option, outcome, and value types to the public API.
    • Updated checkpoint checkpoint-store persistence to split state into separate component artifacts; checkpoint read/write now prefers the checkpoint store when provided (with persistence as fallback), including stricter edge-birth-event validation.
  • Documentation

    • Refreshed API reference inventories to match the updated public export surface.
  • Tests

    • Strengthened public export-surface contract checks and updated checkpoint adapter/service test expectations for the new artifact layout.

Walkthrough

The package root now exposes a narrower v19 facade. Checkpoint creation and loading use the checkpoint store for multi-blob state envelopes, while the CBOR adapter encodes and reconstructs individual state components.

Changes

V19 public facade

Layer / File(s) Summary
Root export contract
index.ts, test/unit/domain/WarpFacade.test.ts, docs/topics/reference.md, CHANGELOG.md
The root export surface is reduced to the v19 allowlist, receipt and reading types are retained, and documentation and tests reflect the updated inventory.

Checkpoint storage migration

Layer / File(s) Summary
Port and service routing
src/ports/CheckpointStorePort.ts, src/domain/services/state/checkpointCreate.ts, src/domain/services/state/checkpointLoad.ts, test/unit/domain/services/CheckpointService.edgeCases.test.ts, test/unit/domain/publicStrandAndRuntimeSeams.test.ts, test/unit/ports/CheckpointStorePort.test.ts
Checkpoint writes return separate state-component OIDs; creation delegates to checkpointStore when available, and loading reads through its fast path.
CBOR state envelope
src/infrastructure/adapters/CborCheckpointStoreAdapter.ts, src/domain/warp/RuntimeHostBoot.ts
The adapter writes and reads five component CBOR blobs, reconstructs WarpState, returns schema 5 data, uses direct blob access, and strictly validates edge birth event payloads.
Adapter regression coverage
test/unit/infrastructure/adapters/CborCheckpointStoreAdapter.test.ts
Tests cover component OIDs, provenance, direct blob round trips, missing artifacts, index shards, envelope encoding, malformed payloads, and removal of legacy full-state decoding.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CheckpointService
  participant CheckpointStorePort
  participant CborCheckpointStoreAdapter
  participant BlobPort
  CheckpointService->>CheckpointStorePort: writeCheckpoint(checkpoint state)
  CheckpointStorePort->>CborCheckpointStoreAdapter: writeCheckpoint(record)
  CborCheckpointStoreAdapter->>BlobPort: write component CBOR blobs
  CborCheckpointStoreAdapter-->>CheckpointStorePort: return component OIDs
  CheckpointService->>CheckpointStorePort: readCheckpoint(tree OIDs)
  CheckpointStorePort->>CborCheckpointStoreAdapter: readCheckpoint(tree OIDs)
  CborCheckpointStoreAdapter->>BlobPort: read component CBOR blobs
Loading

Possibly related PRs

Poem

I’m a rabbit with a schema bouquet,
Five little blobs now hop on their way.
The root wears a smaller crown,
Old exports tumble down,
And CBOR reads the fields of the day.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% 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 It is concise and accurately summarizes the v19 boundary and checkpoint-store seam changes.
Description check ✅ Passed It includes a summary, same-repo issue refs, and verification details, and is mostly aligned with the template despite missing ADR checks.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/infrastructure/adapters/CborCheckpointStoreAdapter.ts (1)

66-104: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Repeated 'application/cbor' magic string.

The literal appears in _writeCheckpointBlob and again in the two inline writePayloadBlob calls for frontier/appliedVV/provenance. Extract a shared constant to avoid drift.

♻️ Proposed fix
+const CBOR_MIME_TYPE = 'application/cbor';
+
 export class CborCheckpointStoreAdapter extends CheckpointStorePort {

then replace each literal 'application/cbor' occurrence with CBOR_MIME_TYPE.

Also applies to: 254-265

🤖 Prompt for 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.

In `@src/infrastructure/adapters/CborCheckpointStoreAdapter.ts` around lines 66 -
104, Extract the repeated 'application/cbor' literal into a shared
CBOR_MIME_TYPE constant in CborCheckpointStoreAdapter, then replace every
occurrence in _writeCheckpointBlob and the inline writePayloadBlob calls for
frontier, appliedVV, and provenance with that constant.

Source: Coding guidelines

src/domain/services/state/checkpointCreate.ts (1)

121-140: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Require codec whenever stateHashService is absent
computeStateHash() still requires a codec, so the fallback path will throw if a caller provides only checkpointStore and omits both codec and stateHashService.

🤖 Prompt for 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.

In `@src/domain/services/state/checkpointCreate.ts` around lines 121 - 140,
Require a non-null codec before entering the fallback branch of checkpoint
creation. In the stateHash computation logic, when stateHashService is absent,
validate codec and throw a clear error if it is missing; otherwise call
computeStateHash with the codec and crypto options, while preserving the
service-based path.
🤖 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 `@src/infrastructure/adapters/CborCheckpointStoreAdapter.ts`:
- Around line 106-117: Replace positional OID and buffer mapping in
writeCheckpoint and readCheckpoint with named object-shaped entries,
destructuring Promise.all results by field names rather than numeric indices or
an idx counter. Update the writes/reads construction and returned checkpoint
mapping so each blob field is explicitly associated with its corresponding
operation, including the optional provenanceIndexBlobOid.
- Around line 313-333: Update _deserializeEdgeBirthEvent to validate each legacy
payload and construct a real EventId instance before inserting it into the
result map, preserving the EventId constructor invariants and instanceof
behavior. Reject or skip malformed entries rather than using the invalid 0,
empty-string, or placeholder defaults; retain only successfully deserialized
EventId values.

In `@test/unit/domain/WarpFacade.test.ts`:
- Line 239: Replace the manual spread-and-sort expression in the root export
comparison with ALLOWED_ROOT_EXPORTS.toSorted(), updating the corresponding
expected-value construction while preserving the existing equality assertion.

In `@test/unit/infrastructure/adapters/CborCheckpointStoreAdapter.test.ts`:
- Around line 341-356: Add an explicit runtime-type assertion in the round-trip
test around _decodeStateEnvelope, verifying that at least one decoded
edgeBirthEvent value is an instance of EventId rather than merely matching its
object shape; retain the existing equality assertions.

---

Outside diff comments:
In `@src/domain/services/state/checkpointCreate.ts`:
- Around line 121-140: Require a non-null codec before entering the fallback
branch of checkpoint creation. In the stateHash computation logic, when
stateHashService is absent, validate codec and throw a clear error if it is
missing; otherwise call computeStateHash with the codec and crypto options,
while preserving the service-based path.

In `@src/infrastructure/adapters/CborCheckpointStoreAdapter.ts`:
- Around line 66-104: Extract the repeated 'application/cbor' literal into a
shared CBOR_MIME_TYPE constant in CborCheckpointStoreAdapter, then replace every
occurrence in _writeCheckpointBlob and the inline writePayloadBlob calls for
frontier, appliedVV, and provenance with that constant.
🪄 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

Run ID: 58911731-4209-4424-9c10-931b915f8e99

📥 Commits

Reviewing files that changed from the base of the PR and between 9bbf6c1 and a3058d3.

📒 Files selected for processing (12)
  • CHANGELOG.md
  • docs/topics/reference.md
  • index.ts
  • src/domain/services/state/checkpointCreate.ts
  • src/domain/services/state/checkpointLoad.ts
  • src/infrastructure/adapters/CborCheckpointStoreAdapter.ts
  • src/ports/CheckpointStorePort.ts
  • test/unit/domain/WarpFacade.test.ts
  • test/unit/domain/publicStrandAndRuntimeSeams.test.ts
  • test/unit/domain/services/CheckpointService.edgeCases.test.ts
  • test/unit/infrastructure/adapters/CborCheckpointStoreAdapter.test.ts
  • test/unit/ports/CheckpointStorePort.test.ts
💤 Files with no reviewable changes (1)
  • index.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: coverage-threshold
  • GitHub Check: type-firewall-lint
  • GitHub Check: test-node (22)
  • GitHub Check: preflight
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{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/ports/CheckpointStorePort.test.ts
  • test/unit/domain/WarpFacade.test.ts
  • test/unit/domain/services/CheckpointService.edgeCases.test.ts
  • src/ports/CheckpointStorePort.ts
  • test/unit/domain/publicStrandAndRuntimeSeams.test.ts
  • src/domain/services/state/checkpointCreate.ts
  • src/domain/services/state/checkpointLoad.ts
  • src/infrastructure/adapters/CborCheckpointStoreAdapter.ts
  • test/unit/infrastructure/adapters/CborCheckpointStoreAdapter.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/CheckpointStorePort.ts
  • src/domain/services/state/checkpointCreate.ts
  • src/domain/services/state/checkpointLoad.ts
  • src/infrastructure/adapters/CborCheckpointStoreAdapter.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/CheckpointStorePort.ts
src/domain/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

src/domain/**/*.{ts,tsx,js,jsx}: In src/domain/**, do not use Date.now(), new Date(), Date(), performance.now(), Math.random(), crypto.randomUUID(), crypto.getRandomValues(), setTimeout, setInterval, raw new Error(...)/new TypeError(...), or direct imports from Node built-ins; time, entropy, and external capabilities must enter through ports or parameters, and domain errors should extend WarpError.
Construct domain objects only in core when doing so establishes validated runtime truth; do not build infrastructure adapters, host APIs, persistence implementations, wall clocks, or entropy sources inside core.
Prefer discriminated unions and explicit result types instead of boolean-flag bags, and model expected failures as return values rather than exceptions.
src/domain/ must not import host APIs or Node-specific globals; hexagonal architecture boundaries are mandatory.
Domain code must not use the wall clock directly; time must enter through a port or parameter.

Files:

  • src/domain/services/state/checkpointCreate.ts
  • src/domain/services/state/checkpointLoad.ts
src/domain/**/!(*.test).{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use explicit domain concepts with validated constructors, Object.freeze, and instanceof dispatch; domain objects should be runtime-backed nouns, not ad hoc shape bags.

Files:

  • src/domain/services/state/checkpointCreate.ts
  • src/domain/services/state/checkpointLoad.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
🪛 ESLint
test/unit/domain/WarpFacade.test.ts

[error] 239-239: Use ALLOWED_ROOT_EXPORTS.toSorted() instead of copying and sorting

(e18e/prefer-array-to-sorted)

🔇 Additional comments (12)
CHANGELOG.md (1)

32-38: LGTM!

test/unit/domain/WarpFacade.test.ts (1)

63-104: LGTM!

Also applies to: 236-241

docs/topics/reference.md (1)

33-85: LGTM!

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

46-57: LGTM!

Also applies to: 133-181, 202-210, 227-274, 297-305

src/infrastructure/adapters/CborCheckpointStoreAdapter.ts (1)

128-153: 🗄️ Data Integrity & Integration

No action needed: the state subtree path names are intentional and consistent. The checkpoint creator emits the same state/nodeAlive, state/edgeAlive, state/prop.cbor, state/observedFrontier.cbor, and state/edgeBirthEvent.cbor entries that this reader expects.

			> Likely an incorrect or invalid review comment.
src/ports/CheckpointStorePort.ts (1)

24-33: LGTM!

src/domain/services/state/checkpointCreate.ts (2)

189-249: LGTM!


142-176: 🗄️ Data Integrity & Integration

The default checkpoint store already uses the same object store
RuntimeHostBoot builds CborCheckpointStoreAdapter with blobPort: persistence, so the OIDs written through checkpointStore are stored in the same backend that persistence.writeTree(...) reads from.

			> Likely an incorrect or invalid review comment.
src/domain/services/state/checkpointLoad.ts (1)

91-123: LGTM!

test/unit/domain/publicStrandAndRuntimeSeams.test.ts (1)

246-263: LGTM!

test/unit/ports/CheckpointStorePort.test.ts (1)

14-34: LGTM!

test/unit/domain/services/CheckpointService.edgeCases.test.ts (1)

848-876: LGTM!

Comment thread src/infrastructure/adapters/CborCheckpointStoreAdapter.ts Outdated
Comment thread src/infrastructure/adapters/CborCheckpointStoreAdapter.ts
Comment thread test/unit/domain/WarpFacade.test.ts Outdated
@flyingrobots

Copy link
Copy Markdown
Member Author

CI follow-up pushed in 9eb0db28.

Root cause from the failing logs: the checkpoint store was writing CAS payload pointer blobs into schema:5 checkpoint tree entries, then load followed those pointers through InMemoryBlobStorageAdapter and hit unknown OIDs. The fix makes CborCheckpointStoreAdapter write/read raw checkpoint tree blobs through BlobPort; blobStorage is accepted for construction compatibility but is not used for checkpoint tree artifacts.

Local verification after the fix:

  • npx vitest run test/unit/infrastructure/adapters/CborCheckpointStoreAdapter.test.ts test/unit/domain/services/CheckpointService.edgeCases.test.ts test/unit/domain/publicStrandAndRuntimeSeams.test.ts passed, 43 tests.
  • npm run typecheck passed.
  • npm run lint passed.

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/infrastructure/adapters/CborCheckpointStoreAdapter.ts (1)

37-41: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

blobStorage is accepted in the constructor type but silently ignored.

The parameter type still declares blobStorage?: BlobStoragePort | null, yet the destructuring only pulls codec and blobPort. Any caller that passes blobStorage will have it silently dropped, which is exactly the kind of type-vs-behavior drift the guidelines warn against. Either remove the field from the type (and update the two blobStorage-configured tests) or explicitly document it as a deprecated no-op so the type reflects real behavior.

As per coding guidelines: "Keep helper corridors, fake shape trust, transitional duplication, and compile-time theater out of the codebase; runtime-honest TypeScript must reflect actual behavior."

♻️ Proposed change (also update the blobStorage-configured tests)
   constructor({ codec, blobPort }: {
     codec: CodecPort;
     blobPort: BlobPort;
-    blobStorage?: BlobStoragePort | null;
   }) {
🤖 Prompt for 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.

In `@src/infrastructure/adapters/CborCheckpointStoreAdapter.ts` around lines 37 -
41, Remove the unused blobStorage?: BlobStoragePort | null property from the
constructor parameter type of CborCheckpointStoreAdapter, and update the two
tests that pass blobStorage so their setup matches the constructor’s actual
supported inputs.

Source: Coding guidelines

🤖 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.

Outside diff comments:
In `@src/infrastructure/adapters/CborCheckpointStoreAdapter.ts`:
- Around line 37-41: Remove the unused blobStorage?: BlobStoragePort | null
property from the constructor parameter type of CborCheckpointStoreAdapter, and
update the two tests that pass blobStorage so their setup matches the
constructor’s actual supported inputs.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 51acd9d9-954b-4a88-b587-df1463833815

📥 Commits

Reviewing files that changed from the base of the PR and between a3058d3 and 9eb0db2.

📒 Files selected for processing (2)
  • src/infrastructure/adapters/CborCheckpointStoreAdapter.ts
  • test/unit/infrastructure/adapters/CborCheckpointStoreAdapter.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (5)
  • GitHub Check: coverage-threshold
  • GitHub Check: test-node (22)
  • GitHub Check: test-deno
  • GitHub Check: preflight
  • GitHub Check: type-firewall-lint
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{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/CborCheckpointStoreAdapter.test.ts
  • src/infrastructure/adapters/CborCheckpointStoreAdapter.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/infrastructure/adapters/CborCheckpointStoreAdapter.ts
🔇 Additional comments (7)
src/infrastructure/adapters/CborCheckpointStoreAdapter.ts (4)

63-87: Positional oids[0..7] mapping between the writes array and the returned OID fields is fragile; reordering silently misassigns fields. This was already raised on a prior commit and still applies here (and to the idx++ walk in readCheckpoint).


113-132: The idx++ positional consumption of buffers mirrors the write-side positional coupling already flagged; consumption order is verified correct against the conditional pushes, so this is only the same maintainability concern.


186-186: _deserializeEdgeBirthEvent populates Map<string, EventId> with structural stand-ins rather than real EventId instances (instanceof checks would fail, constructor invariants skipped). This was already raised on a prior commit and still stands.


204-218: LGTM!

test/unit/infrastructure/adapters/CborCheckpointStoreAdapter.test.ts (3)

356-364: The edgeBirthEvent round-trip assertion uses toEqual on a plain object, so it passes even when values aren't real EventId instances; an instanceof EventId check was already suggested on a prior commit and still applies.


45-55: LGTM!


182-210: LGTM!

@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

Copy link
Copy Markdown
Member Author

Review follow-up pushed in 01a17d16.

Addressed current valid CodeRabbit findings:

  • Replaced positional checkpoint write/read OID mapping with named promise bundles.
  • Reconstructed checkpoint edge-birth values through the EventId constructor and reject malformed edge-birth payloads.
  • Added a malformed edge-birth regression test and an EventId instance assertion.
  • Switched the root export allowlist assertion to toSorted().
  • Made checkpoint creation explicitly require a codec when no StateHashService is injected.

Local verification:

  • npx vitest run test/unit/domain/WarpFacade.test.ts test/unit/infrastructure/adapters/CborCheckpointStoreAdapter.test.ts test/unit/domain/services/CheckpointService.edgeCases.test.ts test/unit/domain/publicStrandAndRuntimeSeams.test.ts test/unit/ports/CheckpointStorePort.test.ts passed, 60 tests.
  • npm run typecheck passed.
  • npm run lint passed.

@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: 2

🤖 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 `@src/infrastructure/adapters/CborCheckpointStoreAdapter.ts`:
- Around line 313-316: Update _deserializeEdgeBirthEvent so a non-array
obj.edgeBirthEvent throws invalidEdgeBirthEventPayload('unknown') instead of
returning an empty map; preserve the existing empty-map result for an absent or
validly handled array value, and add a regression test covering a non-array CBOR
payload.
- Around line 96-109: Update the concurrent blob handling in the checkpoint
write path and the corresponding ranges noted in the comment to await all named
promises with Promise.all before constructing the result object. Apply this to
the promise collections used by _resolveCheckpointWrites and the related
read/write flows, preserving the existing result mapping and adapter error
behavior while ensuring every rejection is observed together.
🪄 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

Run ID: 53b59b32-ef08-480d-afb6-895ab1116912

📥 Commits

Reviewing files that changed from the base of the PR and between 9eb0db2 and 01a17d1.

📒 Files selected for processing (4)
  • src/domain/services/state/checkpointCreate.ts
  • src/infrastructure/adapters/CborCheckpointStoreAdapter.ts
  • test/unit/domain/WarpFacade.test.ts
  • test/unit/infrastructure/adapters/CborCheckpointStoreAdapter.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: type-firewall
  • GitHub Check: coverage-threshold
  • GitHub Check: test-node (22)
  • GitHub Check: preflight
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{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/domain/WarpFacade.test.ts
  • src/domain/services/state/checkpointCreate.ts
  • src/infrastructure/adapters/CborCheckpointStoreAdapter.ts
  • test/unit/infrastructure/adapters/CborCheckpointStoreAdapter.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/domain/services/state/checkpointCreate.ts
  • src/infrastructure/adapters/CborCheckpointStoreAdapter.ts
src/domain/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

src/domain/**/*.{ts,tsx,js,jsx}: In src/domain/**, do not use Date.now(), new Date(), Date(), performance.now(), Math.random(), crypto.randomUUID(), crypto.getRandomValues(), setTimeout, setInterval, raw new Error(...)/new TypeError(...), or direct imports from Node built-ins; time, entropy, and external capabilities must enter through ports or parameters, and domain errors should extend WarpError.
Construct domain objects only in core when doing so establishes validated runtime truth; do not build infrastructure adapters, host APIs, persistence implementations, wall clocks, or entropy sources inside core.
Prefer discriminated unions and explicit result types instead of boolean-flag bags, and model expected failures as return values rather than exceptions.
src/domain/ must not import host APIs or Node-specific globals; hexagonal architecture boundaries are mandatory.
Domain code must not use the wall clock directly; time must enter through a port or parameter.

Files:

  • src/domain/services/state/checkpointCreate.ts
src/domain/**/!(*.test).{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use explicit domain concepts with validated constructors, Object.freeze, and instanceof dispatch; domain objects should be runtime-backed nouns, not ad hoc shape bags.

Files:

  • src/domain/services/state/checkpointCreate.ts
🔇 Additional comments (4)
test/unit/domain/WarpFacade.test.ts (1)

239-239: LGTM!

src/domain/services/state/checkpointCreate.ts (1)

17-17: LGTM!

Also applies to: 140-180

src/infrastructure/adapters/CborCheckpointStoreAdapter.ts (1)

10-84: LGTM!

Also applies to: 137-208, 260-266

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

359-362: LGTM!

Comment thread src/infrastructure/adapters/CborCheckpointStoreAdapter.ts
Comment thread src/infrastructure/adapters/CborCheckpointStoreAdapter.ts Outdated
@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

Copy link
Copy Markdown
Member Author

Review cleanup pushed in 37634857.

Addressed the latest valid CodeRabbit findings:

  • Removed the no-op blobStorage constructor field from CborCheckpointStoreAdapter and stopped passing it from runtime boot/tests.
  • Changed the named checkpoint read/write resolvers to use Promise.all before constructing named results.
  • Made non-array edge-birth payloads reject instead of silently decoding to an empty map.
  • Added a regression test for non-array edge-birth CBOR payloads.

Local verification:

  • npx vitest run test/unit/infrastructure/adapters/CborCheckpointStoreAdapter.test.ts test/unit/domain/WarpFacade.test.ts test/unit/domain/services/CheckpointService.edgeCases.test.ts test/unit/domain/publicStrandAndRuntimeSeams.test.ts test/unit/ports/CheckpointStorePort.test.ts passed, 61 tests.
  • npm run typecheck:src passed.
  • npm run lint passed.

Note: local npm run typecheck:test was stopped after the test compiler stayed active silently for several minutes on this constrained host; GitHub CI remains the full test-typecheck gate.

@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

Copy link
Copy Markdown
Member Author

Activity Summary

@codex Code Lawyer closeout for the first-five v19 slice.

Item Source Severity File Commit Outcome
Root package export surface was too broad for the v19 facade boundary. Self P2 index.ts, test/unit/domain/WarpFacade.test.ts, docs/topics/reference.md a3058d30 Root exports locked to the v19 facade allowlist; reference docs regenerated.
CheckpointStorePort still exposed stale single-blob checkpoint state. Self P1 src/ports/CheckpointStorePort.ts, checkpoint create/load tests a3058d30 Port now returns schema:5 named checkpoint artifact OIDs.
Runtime checkpoint create/load ignored the injected checkpoint store. Self P1 src/domain/services/state/checkpointCreate.ts, src/domain/services/state/checkpointLoad.ts a3058d30 Checkpoint create/load now route through the injected store when present.
Checkpoint adapter wrote payload-pointer blobs into checkpoint tree entries. CI/self P0 src/infrastructure/adapters/CborCheckpointStoreAdapter.ts 9eb0db28 Adapter now writes and reads raw checkpoint tree blobs through BlobPort.
Positional promise result mapping was fragile. CodeRabbit P4 src/infrastructure/adapters/CborCheckpointStoreAdapter.ts 01a17d16 Named promise bundles replaced numeric index coupling.
Decoded edge-birth events were structural stand-ins, not EventId instances. CodeRabbit P1 src/infrastructure/adapters/CborCheckpointStoreAdapter.ts, adapter tests 01a17d16 Decoder constructs real EventId values and rejects malformed payloads.
Root export allowlist test used manual spread/sort. CodeRabbit P5 test/unit/domain/WarpFacade.test.ts 01a17d16 Replaced with toSorted().
Checkpoint store constructor accepted ignored blobStorage. CodeRabbit P3 src/infrastructure/adapters/CborCheckpointStoreAdapter.ts, tests, runtime boot 37634857 Removed the no-op constructor field and updated callers/tests.
Concurrent checkpoint blob promises could observe later rejection too late. CodeRabbit P2 src/infrastructure/adapters/CborCheckpointStoreAdapter.ts 37634857 Promise.all now observes named read/write promises together.
Non-array edge-birth artifacts were silently treated as empty maps. CodeRabbit P1 src/infrastructure/adapters/CborCheckpointStoreAdapter.ts, adapter tests 37634857 Present malformed non-array payloads now throw E_INVALID_CHECKPOINT_EDGE_BIRTH_EVENT.

Verification snapshot after 37634857:

  • CI: all PR checks passing, including test-node (22), test-bun, test-deno, coverage-threshold, preflight, all type-firewall jobs, link check, and issue reference gate.
  • CodeRabbit: latest review on 37634857 is approved; thread-aware GraphQL read shows 0 unresolved review threads.
  • Merge state: CLEAN.
  • Local worktree: clean.

Open milestone note: v19.0.0 still has 15 open issues. This PR is the first-five implementation slice and intentionally uses Refs rather than Closes for the broad goalpost issues.

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