Skip to content

Fix: remove domain commit codec adapter imports - #703

Merged
flyingrobots merged 8 commits into
mainfrom
feature/v19-domain-codec-leak-removal
Jun 28, 2026
Merged

Fix: remove domain commit codec adapter imports#703
flyingrobots merged 8 commits into
mainfrom
feature/v19-domain-codec-leak-removal

Conversation

@flyingrobots

@flyingrobots flyingrobots commented Jun 27, 2026

Copy link
Copy Markdown
Member

Summary

  • keep @git-stunts/trailer-codec as the canonical concrete trailer implementation in TrailerCommitMessageCodecAdapter
  • delete the domain-local commit message facade modules and duplicate TextCommitMessageCodec
  • require domain runtime paths to receive a CommitMessageCodecPort instead of silently importing a concrete default
  • resolve the default trailer adapter only at runtime boot/composition wiring
  • update tests and fixtures to import the infrastructure adapter directly when they need concrete trailer serialization
  • add boundary regression coverage that keeps trailer-codec behind the adapter and keeps retired domain facade files deleted

Scope

This is the first #695 PR. It closes the wrapper/trailer dependency leak family:

It intentionally does not close #169 or #695. The remaining #695 work is the broader default codec/crypto leak removal.

Validation

  • red: npx vitest run test/unit/domain/services/MessageCodecModules.test.ts failed on the old infrastructure/adapters wrapper import
  • red: npm run test:local failed on remaining test fixtures that still relied on hidden domain commit-message defaults
  • npx vitest run test/unit/domain/services/MessageCodecModules.test.ts test/unit/domain/services/WarpMessageCodec.test.ts test/unit/domain/services/WarpMessageCodec.v3.test.ts test/unit/infrastructure/adapters/CborPatchJournalAdapter.test.ts test/unit/domain/services/CheckpointService.test.ts test/unit/domain/services/CheckpointService.edgeCases.test.ts test/unit/domain/services/SyncProtocol.test.ts test/unit/domain/services/WormholeService.test.ts test/unit/domain/warp/Writer.test.ts test/unit/domain/warp/PatchSession.operations.test.ts test/unit/domain/services/PatchBuilder.commit.test.ts
  • npx vitest run test/unit/domain/services/PatchBuilder.cas.test.ts test/unit/domain/services/CheckpointService.anchors.test.ts test/unit/domain/services/TreeConstruction.determinism.test.ts
  • npx vitest run test/unit/domain/WarpGraph.test.ts test/unit/domain/services/controllers/StrandController.host-interface.test.ts test/unit/domain/services/MessageCodecModules.test.ts
  • npm run typecheck
  • npm run lint
  • npm run lint:semgrep
  • npm run lint:sludge
  • npm run lint:quarantine-graduate
  • npm run typecheck:consumer
  • npm run test:local
  • pre-push IRONCLAD M9 gate: link check, lint, source/test/consumer typechecks, policy, surface validator, markdown gates, docs topology, source-backed reference, and npm run test:local

Part of #695.
Closes #170.
Closes #173.

@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

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

More reviews will be available in 2 minutes and 57 seconds. Learn how PR review limits work.

To continue reviewing without waiting, enable usage-based billing in the billing tab.

⌛ How to resolve this issue?

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

🚦 How do rate 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 see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 695b69fc-9ff5-4091-bdc7-df859f74fb5d

📥 Commits

Reviewing files that changed from the base of the PR and between cb3009c and b879bf8.

📒 Files selected for processing (2)
  • test/bats/helpers/seed-setup.ts
  • test/runtime/deno/helpers.ts
📝 Walkthrough

Walkthrough

Domain codec wrappers now point away from the adapter, trailer parsing is implemented in MessageCodecInternal, commit-message codec resolution is explicit across runtime/service boundaries, and tests plus fixtures now import the adapter paths and pass codecs directly.

Changes

Domain codec boundary shift

Layer / File(s) Summary
Trailer text codec and validation helpers
src/domain/services/codec/MessageCodecInternal.ts, src/domain/services/codec/TrailerValidation.ts, src/domain/services/codec/AuditMessageCodec.ts, src/domain/services/codec/MessageSchemaDetector.ts
MessageCodecInternal now exposes frozen trailer constants, typed trailer keys, and trailer-text encode/decode helpers; trailer validation uses typed keys; audit messages and schema detection use trailer-text parsing directly.
Domain codec exports and migration imports
src/domain/services/codec/PatchMessageCodec.ts, src/domain/services/codec/CheckpointMessageCodec.ts, src/domain/services/codec/WarpMessageCodec.ts, scripts/migrations/v17.0.0/checkpoint-schema-upgrade.ts, docs/topics/reference.md
Domain wrapper exports are redirected to TextCommitMessageCodec, the WarpMessageCodec adapter re-export block is removed, the migration import now points at the adapter module directly, and the generated reference inventory is refreshed.
Explicit codec requirement and runtime wiring
src/domain/services/codec/CommitMessageCodecRequirement.ts, src/domain/RuntimeHost.ts, src/domain/services/PatchBuilder.ts, src/domain/services/PatchCommitter.ts, src/domain/services/WormholeService.ts, src/domain/services/state/checkpointCreate.ts, src/domain/services/state/checkpointLoad.ts, src/domain/services/sync/syncPatchLoader.ts, src/domain/services/strand/StrandPatchService.ts, src/domain/services/controllers/MaterializeController.ts, src/domain/services/controllers/MaterializeCheckpointStrategy.ts, src/domain/warp/Writer.ts, src/domain/warp/RuntimeHostBoot.ts, src/application/RuntimeHostCommitMessageCodecDefaults.ts, src/application/WormholeServiceDefaults.ts, index.ts, browser.ts, vitest.config.ts, test/helpers/runtimeHostCommitMessageCodecSetup.ts
A new requireCommitMessageCodec guard is added, implicit codec defaults are removed from runtime/service entry points, commitMessageCodec is threaded through materialization and host dependencies, runtime boot resolves the default codec through an installed resolver, and entrypoints/test setup install that default at load time.
Codec module and format tests
test/unit/domain/services/MessageCodecModules.test.ts, test/unit/domain/services/WarpMessageCodec.test.ts, test/unit/infrastructure/adapters/CborPatchJournalAdapter.test.ts, test/integration/api/checkpoint.test.ts, test/unit/scripts/*, test/helpers/*
Boundary tests assert trailer-codec placement and retired-module removal, trailer-text round-trips and formatting checks are added, and adapter-based codec helpers are used for checkpoint and patch message assertions.
Service, controller, and fixture wiring tests
test/unit/domain/services/CheckpointService.*.ts, test/unit/domain/services/controllers/*, test/unit/domain/WarpGraph.*.ts, test/unit/domain/services/*, test/unit/domain/warp/*, test/benchmark/*
Tests move codec imports to TrailerCommitMessageCodecAdapter, add DEFAULT_COMMIT_MESSAGE_CODEC to builders and controllers, and wrap codec-aware service calls so checkpoints, worms, writers, sync, and persistence setup all receive explicit codecs.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related issues

Possibly related PRs

  • git-stunts/git-warp#26: Both PRs touch audit message and trailer parsing paths, including AuditMessageCodec and trailer-key handling.
  • git-stunts/git-warp#94: Both PRs modify PatchCommitter commit flow and commit-message handling in the domain services layer.
  • git-stunts/git-warp#664: Both PRs overlap on MessageCodecInternal and MessageSchemaDetector, changing how commit-message trailers are decoded and detected.

Poem

🐇 Hop, hop, the trailers now sing,
Frozen keys and codecs in spring.
No adapter shadows at the door,
Just tidy paths and a guarded core.
A bunny hops by, whiskers bright—
“This codec garden feels just right!”

🚥 Pre-merge checks | ✅ 4 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning [#169] The PR does not address the domain utils defaultCodec/defaultCrypto/defaultTrustCrypto cleanup described in the linked issue. Either remove the remaining domain default codec/crypto imports or mark #169 as intentionally out of scope and unlink it from this PR.
Docstring Coverage ⚠️ Warning Docstring coverage is 37.88% 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 accurately captures the main change: removing domain commit codec adapter imports.
Description check ✅ Passed The description covers summary, issue references, validation, and scope, but the ADR checklist is left unchecked.
Linked Issues check ✅ Passed [#170, #173] The wrapper re-exports and domain trailer-codec dependency were removed, and codec wiring moved to runtime/application boundaries.
Out of Scope Changes check ✅ Passed The added runtime wiring, adapter defaults, tests, and docs all support the codec-boundary refactor and do not appear unrelated.

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

@github-actions

Copy link
Copy Markdown

Release Preflight

  • package version: 18.1.2
  • 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.1.2. 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: 5

🤖 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/domain/services/codec/MessageCodecInternal.ts`:
- Around line 53-66: encodeTrailerTextMessage currently serializes trailer
values directly into a line-based format, so multiline values can inject extra
trailer lines. Update MessageCodecInternal.encodeTrailerTextMessage to validate
each defined trailer value before pushing it into lines, rejecting any string
containing \r or \n with a MessageCodecError (use a specific code consistent
with the other validation errors). Keep the check local to
encodeTrailerTextMessage so callers like TextCommitMessageCodec that pass
checkpointVersion through unchanged are protected automatically.

In `@src/domain/services/codec/MessageSchemaDetector.ts`:
- Around line 64-67: The MessageSchemaDetector logic is using inline kind
literals in the trailer check, which should be replaced with a named constant or
type guard. Update the kind validation in MessageSchemaDetector to reference a
shared supported-kinds constant (or equivalent guard) instead of repeating the
four string values directly, and keep the return behavior for valid kinds
unchanged.

In `@src/domain/services/codec/TextCommitMessageCodec.ts`:
- Around line 127-129: The readPatchEncryption helper in TextCommitMessageCodec
is too permissive because any non-'true' trailer value is treated as false.
Update the trailer parsing so malformed encrypted values like 'ture' are
rejected instead of coerced, by validating the raw encrypted trailer value in
readPatchEncryption (and its callers such as the decode path in
TextCommitMessageCodec) and throwing or failing parsing when the value is
present but not exactly 'true' or the expected false form.

In `@test/unit/domain/services/MessageCodecModules.test.ts`:
- Around line 43-49: The boundary scan in MessageCodecModules.test.ts is missing
newly rewired codec modules, so update DOMAIN_CODEC_MODULES to include
TextCommitMessageCodec, AuditMessageCodec, and MessageSchemaDetector alongside
the existing codec entries. Keep the test’s forbidden-import coverage aligned
with the moved domain-owned paths so the boundary checks continue to catch
regressions in these modules.

In `@test/unit/domain/services/WarpMessageCodec.test.ts`:
- Around line 854-875: The existing WarpMessageCodec test only covers the
minimal legacy patch trailer order, so add an additional encodePatchMessage case
that includes git-cas and encrypted settings to verify the full conditional
trailer sequence. In WarpMessageCodec.test.ts, extend the preserves legacy patch
trailer line order coverage to assert the positions of eg-storage-version,
eg-storage-schema, and eg-encrypted along with the existing headers, using
encodePatchMessage to lock down the full trailer order.
🪄 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: 0c62f252-0b68-4091-a3a0-52a8f319f912

📥 Commits

Reviewing files that changed from the base of the PR and between ceebc8d and 7cd6d67.

📒 Files selected for processing (11)
  • src/domain/services/codec/AnchorMessageCodec.ts
  • src/domain/services/codec/AuditMessageCodec.ts
  • src/domain/services/codec/CheckpointMessageCodec.ts
  • src/domain/services/codec/MessageCodecInternal.ts
  • src/domain/services/codec/MessageSchemaDetector.ts
  • src/domain/services/codec/PatchMessageCodec.ts
  • src/domain/services/codec/TextCommitMessageCodec.ts
  • src/domain/services/codec/TrailerValidation.ts
  • src/domain/services/codec/WarpMessageCodec.ts
  • test/unit/domain/services/MessageCodecModules.test.ts
  • test/unit/domain/services/WarpMessageCodec.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: preflight
  • GitHub Check: test-node (22)
  • GitHub Check: coverage-threshold
🧰 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/services/WarpMessageCodec.test.ts
  • src/domain/services/codec/CheckpointMessageCodec.ts
  • src/domain/services/codec/PatchMessageCodec.ts
  • src/domain/services/codec/AnchorMessageCodec.ts
  • src/domain/services/codec/MessageSchemaDetector.ts
  • src/domain/services/codec/TrailerValidation.ts
  • test/unit/domain/services/MessageCodecModules.test.ts
  • src/domain/services/codec/AuditMessageCodec.ts
  • src/domain/services/codec/WarpMessageCodec.ts
  • src/domain/services/codec/MessageCodecInternal.ts
  • src/domain/services/codec/TextCommitMessageCodec.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/codec/CheckpointMessageCodec.ts
  • src/domain/services/codec/PatchMessageCodec.ts
  • src/domain/services/codec/AnchorMessageCodec.ts
  • src/domain/services/codec/MessageSchemaDetector.ts
  • src/domain/services/codec/TrailerValidation.ts
  • src/domain/services/codec/AuditMessageCodec.ts
  • src/domain/services/codec/WarpMessageCodec.ts
  • src/domain/services/codec/MessageCodecInternal.ts
  • src/domain/services/codec/TextCommitMessageCodec.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/codec/CheckpointMessageCodec.ts
  • src/domain/services/codec/PatchMessageCodec.ts
  • src/domain/services/codec/AnchorMessageCodec.ts
  • src/domain/services/codec/MessageSchemaDetector.ts
  • src/domain/services/codec/TrailerValidation.ts
  • src/domain/services/codec/AuditMessageCodec.ts
  • src/domain/services/codec/WarpMessageCodec.ts
  • src/domain/services/codec/MessageCodecInternal.ts
  • src/domain/services/codec/TextCommitMessageCodec.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/codec/CheckpointMessageCodec.ts
  • src/domain/services/codec/PatchMessageCodec.ts
  • src/domain/services/codec/AnchorMessageCodec.ts
  • src/domain/services/codec/MessageSchemaDetector.ts
  • src/domain/services/codec/TrailerValidation.ts
  • src/domain/services/codec/AuditMessageCodec.ts
  • src/domain/services/codec/WarpMessageCodec.ts
  • src/domain/services/codec/MessageCodecInternal.ts
  • src/domain/services/codec/TextCommitMessageCodec.ts
🔇 Additional comments (6)
test/unit/domain/services/MessageCodecModules.test.ts (1)

2-4: LGTM!

Also applies to: 15-16, 42-42, 131-139

src/domain/services/codec/PatchMessageCodec.ts (1)

1-5: LGTM!

src/domain/services/codec/CheckpointMessageCodec.ts (1)

1-5: LGTM!

src/domain/services/codec/AnchorMessageCodec.ts (1)

1-5: LGTM!

src/domain/services/codec/WarpMessageCodec.ts (1)

1-10: LGTM!

src/domain/services/codec/AuditMessageCodec.ts (1)

7-8: LGTM!

Also applies to: 32-40, 70-70

Comment thread src/domain/services/codec/MessageCodecInternal.ts
Comment thread src/domain/services/codec/MessageSchemaDetector.ts
Comment thread src/domain/services/codec/TextCommitMessageCodec.ts Outdated
Comment thread test/unit/domain/services/MessageCodecModules.test.ts
Comment thread test/unit/domain/services/WarpMessageCodec.test.ts
@github-actions

Copy link
Copy Markdown

Release Preflight

  • package version: 18.1.2
  • 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.1.2. 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 (1)
src/domain/services/sync/syncPatchLoader.ts (1)

96-109: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Tighten the codec contract on this exported path.

loadPatchFromCommit() now throws when commitMessageCodec is omitted, but LoadPatchRangeOptions still advertises it as optional and loadPatchRange() still accepts omitted codecs. Existing callers compile unchanged and now fail on first decode.

Suggested contract tightening
 export interface LoadPatchRangeOptions {
   patchJournal?: PatchJournalPort;
-  commitMessageCodec?: CommitMessageCodecPort;
+  commitMessageCodec: CommitMessageCodecPort;
 }
 
 export async function loadPatchFromCommit(
   persistence: CommitPort & BlobPort,
   sha: string,
-  { patchJournal, commitMessageCodec }: LoadPatchRangeOptions = {},
+  { patchJournal, commitMessageCodec }: LoadPatchRangeOptions,
 ): Promise<DecodedPatch> {

As per coding guidelines, runtime-honest TypeScript must reflect actual behavior.

🤖 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/sync/syncPatchLoader.ts` around lines 96 - 109, Tighten
the contract around loadPatchFromCommit and loadPatchRange so the exported types
match the new runtime requirement that commitMessageCodec is mandatory for
decode paths. Update LoadPatchRangeOptions to require commitMessageCodec (or
split the options type used by loadPatchRange/loadPatchFromCommit) and adjust
any related signatures so callers cannot omit it, while preserving the existing
requireCommitMessageCodec enforcement in syncPatchLoader.ts.

Source: Coding guidelines

♻️ Duplicate comments (1)
test/unit/domain/services/MessageCodecModules.test.ts (1)

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

Derive the boundary scan from the codec directory.

Hardcoding these module-path lists makes the regression easy to miss the next time a codec file is added or renamed. Scanning src/domain/services/codec and filtering the retired facades would keep the boundary test aligned with the directory it is meant to protect.

Proposed refactor
-import { existsSync, readFileSync } from 'node:fs';
+import { existsSync, readFileSync, readdirSync } from 'node:fs';
 ...
-const DOMAIN_CODEC_MODULES = [
-  'src/domain/services/codec/AuditMessageCodec.ts',
-  'src/domain/services/codec/CommitMessageCodecRequirement.ts',
-  'src/domain/services/codec/MessageCodecInternal.ts',
-  'src/domain/services/codec/MessageSchemaDetector.ts',
-  'src/domain/services/codec/TrailerValidation.ts',
-  'src/domain/services/codec/WarpMessageCodec.ts',
-];
-const RETIRED_DOMAIN_COMMIT_MESSAGE_FACADES = [
+const RETIRED_DOMAIN_COMMIT_MESSAGE_FACADES = new Set([
   'src/domain/services/codec/AnchorMessageCodec.ts',
   'src/domain/services/codec/CheckpointMessageCodec.ts',
   'src/domain/services/codec/PatchMessageCodec.ts',
   'src/domain/services/codec/TextCommitMessageCodec.ts',
-];
+]);
+const CODEC_DIR = 'src/domain/services/codec';
+const DOMAIN_CODEC_MODULES = readdirSync(resolve(ROOT, CODEC_DIR))
+  .filter((entry) => entry.endsWith('.ts'))
+  .map((entry) => `${CODEC_DIR}/${entry}`)
+  .filter((modulePath) => !RETIRED_DOMAIN_COMMIT_MESSAGE_FACADES.has(modulePath));
🤖 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 `@test/unit/domain/services/MessageCodecModules.test.ts` around lines 41 - 54,
The boundary test is hardcoding codec module paths instead of deriving them from
the codec directory, so update MessageCodecModules.test to scan
src/domain/services/codec and build the list dynamically, then filter out the
retired facades and the TrailerCommitMessageCodecAdapter as needed. Keep the
assertion focused on the generated module set in the boundary test
helpers/constants so additions or renames in the codec folder are automatically
covered.
🤖 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/domain/services/state/checkpointCreate.ts`:
- Around line 100-106: Make commitMessageCodec a required part of the exported
CreateCheckpointOptions API so the type system matches
createCheckpointEnvelope’s runtime behavior. Update the CreateCheckpointOptions
definition and any related call sites/usages around createCheckpointEnvelope and
requireCommitMessageCodec so callers must provide commitMessageCodec at compile
time rather than hitting the missing-codec throw at runtime.

In `@src/domain/services/state/checkpointLoad.ts`:
- Around line 79-84: The exported option types for loadCheckpoint and
materializeIncremental still mark commitMessageCodec as optional even though
requireCommitMessageCodec now rejects omission at runtime. Update the relevant
option interfaces/types used by loadCheckpoint and materializeIncremental so
commitMessageCodec is required, or ensure it is resolved before entering the
core path in checkpointLoad so callers must supply it statically. Use the
loadCheckpoint and materializeIncremental symbols to trace the affected API
surface and keep the types aligned with the new E_MESSAGE_CODEC_REQUIRED
behavior.

In `@src/domain/services/WormholeService.ts`:
- Line 126: Make the codec dependency on processCommit() runtime-honest by
updating ProcessCommitOptions so commitMessageCodec is required, or by providing
a default/resolve step before calling requireCommitMessageCodec. The key symbols
to fix are processCommit, ProcessCommitOptions, and requireCommitMessageCodec in
WormholeService, so the type definition matches the hard-fail behavior and the
helper is no longer compile-time optional but runtime required.

In `@src/domain/warp/RuntimeHostBoot.ts`:
- Around line 250-255: Move the default commit message codec resolution out of
`RuntimeHostBoot` in src/domain/warp: `resolveDefaultCommitMessageCodec()`
currently imports `TrailerCommitMessageCodecAdapter`, which reintroduces a
forbidden domain-to-infrastructure dependency. Replace this with a
`CommitMessageCodecPort` dependency injected into the domain/bootstrap flow, and
resolve the default codec in an infrastructure/bootstrap layer instead of
building adapters inside core.

---

Outside diff comments:
In `@src/domain/services/sync/syncPatchLoader.ts`:
- Around line 96-109: Tighten the contract around loadPatchFromCommit and
loadPatchRange so the exported types match the new runtime requirement that
commitMessageCodec is mandatory for decode paths. Update LoadPatchRangeOptions
to require commitMessageCodec (or split the options type used by
loadPatchRange/loadPatchFromCommit) and adjust any related signatures so callers
cannot omit it, while preserving the existing requireCommitMessageCodec
enforcement in syncPatchLoader.ts.

---

Duplicate comments:
In `@test/unit/domain/services/MessageCodecModules.test.ts`:
- Around line 41-54: The boundary test is hardcoding codec module paths instead
of deriving them from the codec directory, so update MessageCodecModules.test to
scan src/domain/services/codec and build the list dynamically, then filter out
the retired facades and the TrailerCommitMessageCodecAdapter as needed. Keep the
assertion focused on the generated module set in the boundary test
helpers/constants so additions or renames in the codec folder are automatically
covered.
🪄 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: 97852fa9-9069-4f05-b715-5e423f78e04e

📥 Commits

Reviewing files that changed from the base of the PR and between 7cd6d67 and 3f5b13d.

📒 Files selected for processing (84)
  • scripts/migrations/v17.0.0/checkpoint-schema-upgrade.ts
  • src/domain/RuntimeHost.ts
  • src/domain/services/PatchBuilder.ts
  • src/domain/services/PatchCommitter.ts
  • src/domain/services/WormholeService.ts
  • src/domain/services/codec/AnchorMessageCodec.ts
  • src/domain/services/codec/CheckpointMessageCodec.ts
  • src/domain/services/codec/CommitMessageCodecRequirement.ts
  • src/domain/services/codec/PatchMessageCodec.ts
  • src/domain/services/codec/WarpMessageCodec.ts
  • src/domain/services/controllers/MaterializeCheckpointStrategy.ts
  • src/domain/services/controllers/MaterializeController.ts
  • src/domain/services/state/checkpointCreate.ts
  • src/domain/services/state/checkpointLoad.ts
  • src/domain/services/strand/StrandPatchService.ts
  • src/domain/services/sync/syncPatchLoader.ts
  • src/domain/warp/RuntimeHostBoot.ts
  • src/domain/warp/Writer.ts
  • test/benchmark/detachedReadBenchmark.fixture.ts
  • test/helpers/WarpGraphMockPersistence.ts
  • test/helpers/WarpGraphPatchFixtures.ts
  • test/integration/api/checkpoint.test.ts
  • test/unit/domain/WarpCore.snapshotHashStability.test.ts
  • test/unit/domain/WarpGraph.autoCheckpoint.test.ts
  • test/unit/domain/WarpGraph.backfill.test.ts
  • test/unit/domain/WarpGraph.checkpoint.test.ts
  • test/unit/domain/WarpGraph.conflicts.test.ts
  • test/unit/domain/WarpGraph.coverageGaps.test.ts
  • test/unit/domain/WarpGraph.frontierChanged.test.ts
  • test/unit/domain/WarpGraph.invalidation.test.ts
  • test/unit/domain/WarpGraph.observerBoundary.test.ts
  • test/unit/domain/WarpGraph.patchCount.test.ts
  • test/unit/domain/WarpGraph.patchesFor.test.ts
  • test/unit/domain/WarpGraph.receipts.test.ts
  • test/unit/domain/WarpGraph.seek.test.ts
  • test/unit/domain/WarpGraph.seekDiff.test.ts
  • test/unit/domain/WarpGraph.status.test.ts
  • test/unit/domain/WarpGraph.strands.compare.test.ts
  • test/unit/domain/WarpGraph.strands.intents.test.ts
  • test/unit/domain/WarpGraph.strands.test.ts
  • test/unit/domain/WarpGraph.test.ts
  • test/unit/domain/WarpGraph.versionVector.test.ts
  • test/unit/domain/WarpGraph.worldline.test.ts
  • test/unit/domain/WarpGraph.writerInvalidation.test.ts
  • test/unit/domain/runtimeReadingBasisErrors.test.ts
  • test/unit/domain/seekCache.test.ts
  • test/unit/domain/services/CheckpointService.anchors.test.ts
  • test/unit/domain/services/CheckpointService.edgeCases.test.ts
  • test/unit/domain/services/CheckpointService.test.ts
  • test/unit/domain/services/EdgePropSetWireMigrationGate.test.ts
  • test/unit/domain/services/MessageCodecModules.test.ts
  • test/unit/domain/services/PatchBuilder.cas.test.ts
  • test/unit/domain/services/PatchBuilder.commit.test.ts
  • test/unit/domain/services/PatchBuilder.test.ts
  • test/unit/domain/services/PatchBuilderTestHarness.ts
  • test/unit/domain/services/PatchCommitter.visibility.test.ts
  • test/unit/domain/services/SchemaCompat.test.ts
  • test/unit/domain/services/SyncProtocol.divergence.test.ts
  • test/unit/domain/services/SyncProtocol.stateCoherence.test.ts
  • test/unit/domain/services/SyncProtocol.test.ts
  • test/unit/domain/services/TreeConstruction.determinism.test.ts
  • test/unit/domain/services/WarpMessageCodec.test.ts
  • test/unit/domain/services/WarpMessageCodec.v3.test.ts
  • test/unit/domain/services/WormholeService.test.ts
  • test/unit/domain/services/controllers/CheckpointController.snapshotCache.test.ts
  • test/unit/domain/services/controllers/CheckpointController.test.ts
  • test/unit/domain/services/controllers/MaterializeController.snapshotCache.test.ts
  • test/unit/domain/services/controllers/MaterializeController.stateSession.test.ts
  • test/unit/domain/services/controllers/MaterializePatchStreamReducer.test.ts
  • test/unit/domain/services/controllers/PatchController.test.ts
  • test/unit/domain/services/controllers/ProvenanceController.test.ts
  • test/unit/domain/services/controllers/StrandController.host-interface.test.ts
  • test/unit/domain/services/optic/CheckpointPatchFactStream.test.ts
  • test/unit/domain/services/optic/CheckpointShardFactReader.manifest.test.ts
  • test/unit/domain/services/optic/CheckpointTailBasisVerifier.test.ts
  • test/unit/domain/services/optic/CoordinateCheckpointTailOpticSource.test.ts
  • test/unit/domain/services/optic/TraversalOptic.test.ts
  • test/unit/domain/services/optic/WorldlineOptic.test.ts
  • test/unit/domain/services/v3-compatibility.test.ts
  • test/unit/domain/warp/PatchSession.operations.test.ts
  • test/unit/domain/warp/Writer.test.ts
  • test/unit/infrastructure/adapters/CborPatchJournalAdapter.test.ts
  • test/unit/scripts/checkpoint-schema-upgrade.test.ts
  • test/unit/scripts/v16-to-v17-upgrade.test.ts
💤 Files with no reviewable changes (4)
  • src/domain/services/codec/AnchorMessageCodec.ts
  • src/domain/services/codec/CheckpointMessageCodec.ts
  • src/domain/services/codec/PatchMessageCodec.ts
  • src/domain/services/codec/WarpMessageCodec.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: preflight
  • GitHub Check: test-node (22)
  • GitHub Check: coverage-threshold
🧰 Additional context used
📓 Path-based instructions (4)
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/codec/CommitMessageCodecRequirement.ts
  • src/domain/services/controllers/MaterializeCheckpointStrategy.ts
  • src/domain/services/WormholeService.ts
  • src/domain/warp/Writer.ts
  • src/domain/services/strand/StrandPatchService.ts
  • src/domain/services/controllers/MaterializeController.ts
  • src/domain/services/state/checkpointCreate.ts
  • src/domain/services/sync/syncPatchLoader.ts
  • src/domain/services/PatchBuilder.ts
  • src/domain/RuntimeHost.ts
  • src/domain/services/state/checkpointLoad.ts
  • src/domain/services/PatchCommitter.ts
  • src/domain/warp/RuntimeHostBoot.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/codec/CommitMessageCodecRequirement.ts
  • src/domain/services/controllers/MaterializeCheckpointStrategy.ts
  • src/domain/services/WormholeService.ts
  • src/domain/warp/Writer.ts
  • src/domain/services/strand/StrandPatchService.ts
  • src/domain/services/controllers/MaterializeController.ts
  • src/domain/services/state/checkpointCreate.ts
  • src/domain/services/sync/syncPatchLoader.ts
  • src/domain/services/PatchBuilder.ts
  • src/domain/RuntimeHost.ts
  • src/domain/services/state/checkpointLoad.ts
  • src/domain/services/PatchCommitter.ts
  • src/domain/warp/RuntimeHostBoot.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/codec/CommitMessageCodecRequirement.ts
  • src/domain/services/controllers/MaterializeCheckpointStrategy.ts
  • src/domain/services/WormholeService.ts
  • src/domain/warp/Writer.ts
  • src/domain/services/strand/StrandPatchService.ts
  • src/domain/services/controllers/MaterializeController.ts
  • src/domain/services/state/checkpointCreate.ts
  • src/domain/services/sync/syncPatchLoader.ts
  • src/domain/services/PatchBuilder.ts
  • src/domain/RuntimeHost.ts
  • src/domain/services/state/checkpointLoad.ts
  • src/domain/services/PatchCommitter.ts
  • src/domain/warp/RuntimeHostBoot.ts
**/*.{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:

  • src/domain/services/codec/CommitMessageCodecRequirement.ts
  • test/unit/domain/WarpGraph.patchesFor.test.ts
  • test/unit/domain/WarpGraph.invalidation.test.ts
  • test/unit/domain/WarpGraph.backfill.test.ts
  • test/unit/domain/WarpGraph.patchCount.test.ts
  • scripts/migrations/v17.0.0/checkpoint-schema-upgrade.ts
  • test/unit/domain/services/controllers/MaterializeController.stateSession.test.ts
  • test/unit/domain/services/SyncProtocol.divergence.test.ts
  • test/unit/domain/WarpGraph.observerBoundary.test.ts
  • test/helpers/WarpGraphPatchFixtures.ts
  • src/domain/services/controllers/MaterializeCheckpointStrategy.ts
  • test/unit/domain/WarpGraph.receipts.test.ts
  • test/unit/domain/services/controllers/MaterializePatchStreamReducer.test.ts
  • test/unit/scripts/v16-to-v17-upgrade.test.ts
  • test/unit/domain/WarpGraph.autoCheckpoint.test.ts
  • test/unit/domain/WarpGraph.strands.test.ts
  • test/unit/domain/services/WarpMessageCodec.v3.test.ts
  • test/unit/domain/services/SchemaCompat.test.ts
  • test/integration/api/checkpoint.test.ts
  • test/unit/domain/services/controllers/MaterializeController.snapshotCache.test.ts
  • test/unit/domain/services/optic/TraversalOptic.test.ts
  • test/unit/infrastructure/adapters/CborPatchJournalAdapter.test.ts
  • test/unit/domain/services/CheckpointService.anchors.test.ts
  • test/unit/domain/services/WormholeService.test.ts
  • test/benchmark/detachedReadBenchmark.fixture.ts
  • test/unit/domain/WarpGraph.worldline.test.ts
  • src/domain/services/WormholeService.ts
  • test/unit/domain/seekCache.test.ts
  • src/domain/warp/Writer.ts
  • test/unit/domain/services/optic/WorldlineOptic.test.ts
  • test/unit/domain/services/optic/CheckpointShardFactReader.manifest.test.ts
  • test/unit/domain/services/optic/CheckpointPatchFactStream.test.ts
  • src/domain/services/strand/StrandPatchService.ts
  • test/unit/domain/WarpGraph.versionVector.test.ts
  • test/unit/domain/services/PatchBuilder.test.ts
  • src/domain/services/controllers/MaterializeController.ts
  • test/unit/domain/WarpGraph.test.ts
  • test/unit/domain/services/TreeConstruction.determinism.test.ts
  • test/unit/scripts/checkpoint-schema-upgrade.test.ts
  • test/unit/domain/services/controllers/ProvenanceController.test.ts
  • test/unit/domain/WarpGraph.seekDiff.test.ts
  • test/helpers/WarpGraphMockPersistence.ts
  • test/unit/domain/services/PatchBuilder.commit.test.ts
  • test/unit/domain/services/controllers/CheckpointController.snapshotCache.test.ts
  • test/unit/domain/services/optic/CheckpointTailBasisVerifier.test.ts
  • test/unit/domain/services/EdgePropSetWireMigrationGate.test.ts
  • test/unit/domain/WarpGraph.conflicts.test.ts
  • test/unit/domain/WarpGraph.frontierChanged.test.ts
  • test/unit/domain/WarpGraph.status.test.ts
  • test/unit/domain/services/controllers/StrandController.host-interface.test.ts
  • test/unit/domain/WarpGraph.coverageGaps.test.ts
  • test/unit/domain/services/v3-compatibility.test.ts
  • test/unit/domain/WarpGraph.checkpoint.test.ts
  • test/unit/domain/warp/PatchSession.operations.test.ts
  • test/unit/domain/WarpGraph.writerInvalidation.test.ts
  • test/unit/domain/WarpGraph.seek.test.ts
  • test/unit/domain/WarpGraph.strands.compare.test.ts
  • src/domain/services/state/checkpointCreate.ts
  • test/unit/domain/services/PatchCommitter.visibility.test.ts
  • test/unit/domain/services/controllers/CheckpointController.test.ts
  • test/unit/domain/runtimeReadingBasisErrors.test.ts
  • test/unit/domain/services/SyncProtocol.stateCoherence.test.ts
  • src/domain/services/sync/syncPatchLoader.ts
  • test/unit/domain/services/optic/CoordinateCheckpointTailOpticSource.test.ts
  • test/unit/domain/services/controllers/PatchController.test.ts
  • src/domain/services/PatchBuilder.ts
  • test/unit/domain/WarpCore.snapshotHashStability.test.ts
  • test/unit/domain/services/PatchBuilderTestHarness.ts
  • test/unit/domain/services/WarpMessageCodec.test.ts
  • test/unit/domain/services/SyncProtocol.test.ts
  • src/domain/RuntimeHost.ts
  • test/unit/domain/WarpGraph.strands.intents.test.ts
  • test/unit/domain/services/PatchBuilder.cas.test.ts
  • src/domain/services/state/checkpointLoad.ts
  • test/unit/domain/services/CheckpointService.test.ts
  • src/domain/services/PatchCommitter.ts
  • test/unit/domain/services/CheckpointService.edgeCases.test.ts
  • src/domain/warp/RuntimeHostBoot.ts
  • test/unit/domain/services/MessageCodecModules.test.ts
  • test/unit/domain/warp/Writer.test.ts
🔇 Additional comments (75)
src/domain/services/codec/CommitMessageCodecRequirement.ts (1)

4-13: LGTM!

src/domain/RuntimeHost.ts (1)

51-51: LGTM!

Also applies to: 310-310, 384-384

src/domain/services/PatchCommitter.ts (1)

125-133: LGTM!

src/domain/services/controllers/MaterializeCheckpointStrategy.ts (1)

26-34: LGTM!

test/unit/domain/services/optic/TraversalOptic.test.ts (1)

16-16: LGTM!

src/domain/services/PatchBuilder.ts (1)

40-40: LGTM!

Also applies to: 80-80, 107-107, 445-445

src/domain/services/strand/StrandPatchService.ts (1)

255-255: LGTM!

src/domain/warp/Writer.ts (1)

21-21: LGTM!

Also applies to: 102-102

test/unit/domain/WarpGraph.checkpoint.test.ts (1)

8-8: LGTM!

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

8-8: LGTM!

test/benchmark/detachedReadBenchmark.fixture.ts (1)

137-137: LGTM!

test/unit/domain/services/PatchBuilder.cas.test.ts (1)

7-7: LGTM!

Also applies to: 82-82, 98-98, 121-121, 152-152, 177-177, 209-209, 244-244, 275-275

test/unit/domain/services/PatchBuilder.test.ts (1)

8-8: LGTM!

scripts/migrations/v17.0.0/checkpoint-schema-upgrade.ts (1)

12-12: LGTM!

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

9-9: LGTM!

Also applies to: 156-156

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

2-12: LGTM!

Also applies to: 23-61

test/unit/domain/services/optic/CheckpointTailBasisVerifier.test.ts (1)

19-19: LGTM!

test/unit/domain/services/optic/CoordinateCheckpointTailOpticSource.test.ts (1)

10-10: LGTM!

test/unit/scripts/v16-to-v17-upgrade.test.ts (1)

9-9: LGTM!

Also applies to: 74-74

src/domain/services/controllers/MaterializeController.ts (1)

39-39: LGTM!

Also applies to: 73-73

test/unit/domain/WarpGraph.status.test.ts (1)

3-3: LGTM!

test/unit/domain/WarpGraph.writerInvalidation.test.ts (1)

3-3: LGTM!

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

6-6: LGTM!

test/unit/domain/services/controllers/MaterializeController.snapshotCache.test.ts (1)

6-6: LGTM!

Also applies to: 121-121

test/unit/domain/services/controllers/MaterializePatchStreamReducer.test.ts (1)

21-21: LGTM!

Also applies to: 163-163

test/unit/domain/services/optic/CheckpointPatchFactStream.test.ts (1)

19-19: LGTM!

test/unit/domain/services/optic/CheckpointShardFactReader.manifest.test.ts (1)

15-15: LGTM!

test/unit/domain/services/MessageCodecModules.test.ts (1)

2-14: LGTM!

Also applies to: 97-125

test/unit/domain/services/WarpMessageCodec.test.ts (1)

10-10: LGTM!

test/unit/domain/services/WarpMessageCodec.v3.test.ts (1)

10-15: LGTM!

test/unit/domain/services/EdgePropSetWireMigrationGate.test.ts (1)

6-6: LGTM!

test/unit/domain/WarpGraph.versionVector.test.ts (1)

8-8: LGTM!

test/unit/domain/WarpGraph.worldline.test.ts (1)

118-118: LGTM!

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

5-5: LGTM!

test/unit/scripts/checkpoint-schema-upgrade.test.ts (1)

16-16: LGTM!

Also applies to: 132-132, 165-165

test/unit/domain/services/SchemaCompat.test.ts (1)

7-7: LGTM!

test/helpers/WarpGraphMockPersistence.ts (1)

3-3: LGTM!

test/helpers/WarpGraphPatchFixtures.ts (1)

15-15: LGTM!

test/integration/api/checkpoint.test.ts (1)

3-3: LGTM!

test/unit/domain/WarpGraph.autoCheckpoint.test.ts (1)

4-4: LGTM!

test/unit/domain/services/TreeConstruction.determinism.test.ts (1)

16-16: LGTM!

Also applies to: 60-60, 169-169

test/unit/domain/services/WormholeService.test.ts (1)

3-3: LGTM!

Also applies to: 15-18, 36-44

test/unit/domain/services/controllers/CheckpointController.snapshotCache.test.ts (1)

6-6: LGTM!

test/unit/domain/WarpCore.snapshotHashStability.test.ts (1)

122-122: LGTM!

test/unit/domain/WarpGraph.conflicts.test.ts (1)

109-109: LGTM!

test/unit/domain/WarpGraph.observerBoundary.test.ts (1)

123-123: LGTM!

test/unit/domain/WarpGraph.receipts.test.ts (1)

102-102: LGTM!

test/unit/domain/WarpGraph.strands.compare.test.ts (1)

124-124: LGTM!

test/unit/domain/WarpGraph.strands.intents.test.ts (1)

123-123: LGTM!

test/unit/domain/WarpGraph.strands.test.ts (1)

123-123: LGTM!

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

9-20: LGTM!

Also applies to: 41-76

test/unit/domain/WarpGraph.backfill.test.ts (1)

8-8: LGTM!

test/unit/domain/WarpGraph.coverageGaps.test.ts (1)

4-4: LGTM!

test/unit/domain/WarpGraph.frontierChanged.test.ts (1)

3-3: LGTM!

test/unit/domain/services/controllers/CheckpointController.test.ts (1)

81-81: LGTM!

test/unit/domain/services/controllers/MaterializeController.stateSession.test.ts (1)

11-11: LGTM!

Also applies to: 165-165

test/unit/domain/services/controllers/PatchController.test.ts (1)

50-50: LGTM!

test/unit/domain/services/controllers/ProvenanceController.test.ts (1)

17-23: LGTM!

test/unit/domain/services/controllers/StrandController.host-interface.test.ts (1)

6-6: LGTM!

test/unit/domain/WarpGraph.invalidation.test.ts (1)

3-3: LGTM!

test/unit/domain/WarpGraph.patchCount.test.ts (1)

4-4: LGTM!

test/unit/domain/WarpGraph.patchesFor.test.ts (1)

3-3: LGTM!

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

12-12: LGTM!

test/unit/domain/services/PatchBuilder.commit.test.ts (1)

4-4: LGTM!

test/unit/domain/services/PatchBuilderTestHarness.ts (1)

9-9: LGTM!

Also applies to: 141-141, 156-156

test/unit/domain/services/PatchCommitter.visibility.test.ts (1)

10-10: LGTM!

test/unit/domain/services/SyncProtocol.divergence.test.ts (1)

10-10: LGTM!

test/unit/domain/WarpGraph.seek.test.ts (1)

4-4: LGTM!

test/unit/domain/WarpGraph.seekDiff.test.ts (1)

5-5: LGTM!

test/unit/domain/services/SyncProtocol.stateCoherence.test.ts (1)

19-19: LGTM!

test/unit/domain/services/SyncProtocol.test.ts (1)

3-3: LGTM!

Also applies to: 18-21, 107-127

test/unit/domain/services/optic/WorldlineOptic.test.ts (1)

6-6: LGTM!

test/unit/domain/services/v3-compatibility.test.ts (1)

3-3: LGTM!

test/unit/domain/warp/PatchSession.operations.test.ts (1)

21-21: LGTM!

Also applies to: 41-41, 64-64, 84-84, 113-113, 133-133, 158-158

test/unit/domain/warp/Writer.test.ts (1)

16-19: LGTM!

Also applies to: 124-124, 149-149, 168-168, 189-189, 208-208, 225-225, 244-244, 269-269, 294-294, 320-320, 353-353, 381-381, 409-409, 434-434, 465-465, 511-511, 543-543, 575-575, 600-600, 627-627, 653-653, 680-680

Comment thread src/domain/services/state/checkpointCreate.ts
Comment thread src/domain/services/state/checkpointLoad.ts Outdated
Comment thread src/domain/services/WormholeService.ts
Comment thread src/domain/warp/RuntimeHostBoot.ts Outdated

@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 `@src/domain/services/codec/MessageCodecInternal.ts`:
- Around line 61-66: The trailer encoding in MessageCodecInternal’s trailer
serialization loop only checks for line breaks, so keys containing “:” can still
be emitted and later misparsed by the decoder. Update the validation in the
trailer key path inside the Object.keys(message.trailers) loop to reject colon
characters as well, alongside the existing single-line check, before pushing the
key/value pair into lines.
🪄 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: 756a114d-c32a-4d3f-934f-f94dfe611b44

📥 Commits

Reviewing files that changed from the base of the PR and between 3f5b13d and 7100015.

📒 Files selected for processing (4)
  • src/domain/services/codec/MessageCodecInternal.ts
  • src/domain/services/codec/MessageSchemaDetector.ts
  • test/unit/domain/services/MessageCodecModules.test.ts
  • test/unit/domain/services/WarpMessageCodec.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: coverage-threshold
  • GitHub Check: test-node (22)
  • GitHub Check: preflight
🧰 Additional context used
📓 Path-based instructions (4)
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/codec/MessageSchemaDetector.ts
  • src/domain/services/codec/MessageCodecInternal.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/codec/MessageSchemaDetector.ts
  • src/domain/services/codec/MessageCodecInternal.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/codec/MessageSchemaDetector.ts
  • src/domain/services/codec/MessageCodecInternal.ts
**/*.{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:

  • src/domain/services/codec/MessageSchemaDetector.ts
  • test/unit/domain/services/WarpMessageCodec.test.ts
  • src/domain/services/codec/MessageCodecInternal.ts
  • test/unit/domain/services/MessageCodecModules.test.ts
🔇 Additional comments (3)
src/domain/services/codec/MessageSchemaDetector.ts (1)

59-78: LGTM!

test/unit/domain/services/MessageCodecModules.test.ts (1)

165-172: LGTM!

test/unit/domain/services/WarpMessageCodec.test.ts (1)

877-902: LGTM!

Comment thread src/domain/services/codec/MessageCodecInternal.ts
@github-actions

Copy link
Copy Markdown

Release Preflight

  • package version: 18.1.2
  • 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.1.2. 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 `@src/domain/services/state/checkpointLoad.ts`:
- Line 79: The checkpoint-loading API now requires a codec, but some callers
still invoke loadCheckpoint(...) with only checkpointStore and omit
commitMessageCodec in materializeIncremental(...), so update those call sites to
thread the test/runtime codec through. Fix the checkpoint service tests and any
other affected callers by passing codec into loadCheckpoint and
commitMessageCodec into materializeIncremental, using the existing
LoadCheckpointOptions and materialization helpers so the
E_MESSAGE_CODEC_REQUIRED path is reached correctly.
🪄 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: 5f4a97b3-15bd-4077-be98-04afe2f9585f

📥 Commits

Reviewing files that changed from the base of the PR and between 7100015 and cb3009c.

📒 Files selected for processing (16)
  • browser.ts
  • docs/topics/reference.md
  • index.ts
  • src/application/RuntimeHostCommitMessageCodecDefaults.ts
  • src/application/WormholeServiceDefaults.ts
  • src/domain/services/WormholeService.ts
  • src/domain/services/codec/MessageCodecInternal.ts
  • src/domain/services/state/checkpointCreate.ts
  • src/domain/services/state/checkpointLoad.ts
  • src/domain/warp/RuntimeHostBoot.ts
  • test/helpers/runtimeHostCommitMessageCodecSetup.ts
  • test/unit/domain/services/CheckpointService.edgeCases.test.ts
  • test/unit/domain/services/CheckpointService.test.ts
  • test/unit/domain/services/MessageCodecModules.test.ts
  • test/unit/domain/services/WormholeService.test.ts
  • vitest.config.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: preflight
  • GitHub Check: coverage-threshold
  • GitHub Check: test-node (22)
🧰 Additional context used
📓 Path-based instructions (4)
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/application/RuntimeHostCommitMessageCodecDefaults.ts
  • src/application/WormholeServiceDefaults.ts
  • src/domain/services/WormholeService.ts
  • src/domain/services/state/checkpointCreate.ts
  • src/domain/warp/RuntimeHostBoot.ts
  • src/domain/services/state/checkpointLoad.ts
  • src/domain/services/codec/MessageCodecInternal.ts
**/*.{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:

  • src/application/RuntimeHostCommitMessageCodecDefaults.ts
  • test/helpers/runtimeHostCommitMessageCodecSetup.ts
  • browser.ts
  • vitest.config.ts
  • src/application/WormholeServiceDefaults.ts
  • test/unit/domain/services/WormholeService.test.ts
  • test/unit/domain/services/CheckpointService.test.ts
  • src/domain/services/WormholeService.ts
  • index.ts
  • test/unit/domain/services/CheckpointService.edgeCases.test.ts
  • test/unit/domain/services/MessageCodecModules.test.ts
  • src/domain/services/state/checkpointCreate.ts
  • src/domain/warp/RuntimeHostBoot.ts
  • src/domain/services/state/checkpointLoad.ts
  • src/domain/services/codec/MessageCodecInternal.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/WormholeService.ts
  • src/domain/services/state/checkpointCreate.ts
  • src/domain/warp/RuntimeHostBoot.ts
  • src/domain/services/state/checkpointLoad.ts
  • src/domain/services/codec/MessageCodecInternal.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/WormholeService.ts
  • src/domain/services/state/checkpointCreate.ts
  • src/domain/warp/RuntimeHostBoot.ts
  • src/domain/services/state/checkpointLoad.ts
  • src/domain/services/codec/MessageCodecInternal.ts
🔇 Additional comments (16)
test/unit/domain/services/MessageCodecModules.test.ts (1)

55-55: LGTM!

Also applies to: 114-120, 181-186

test/helpers/runtimeHostCommitMessageCodecSetup.ts (1)

1-3: LGTM!

src/domain/services/codec/MessageCodecInternal.ts (1)

64-83: LGTM!

docs/topics/reference.md (1)

25-28: LGTM!

Also applies to: 29-195, 197-252

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

17-17: LGTM!

Also applies to: 52-52, 100-106, 209-209

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

17-17: LGTM!

Also applies to: 60-60

src/domain/warp/RuntimeHostBoot.ts (1)

11-11: LGTM!

Also applies to: 44-53, 71-71, 265-276, 321-321

src/application/RuntimeHostCommitMessageCodecDefaults.ts (1)

1-6: LGTM!

index.ts (1)

116-122: LGTM!

Also applies to: 236-238

browser.ts (1)

31-34: LGTM!

src/domain/services/WormholeService.ts (1)

104-104: LGTM!

Also applies to: 195-195, 230-230, 273-273, 312-312

src/application/WormholeServiceDefaults.ts (1)

1-29: LGTM!

vitest.config.ts (1)

11-11: LGTM!

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

51-87: LGTM!

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

35-67: LGTM!

test/unit/domain/services/WormholeService.test.ts (1)

36-48: LGTM!

Comment thread src/domain/services/state/checkpointLoad.ts
@github-actions

Copy link
Copy Markdown

Release Preflight

  • package version: 18.1.2
  • 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.1.2. A maintainer who is a JSR @git-stunts scope member must then dispatch the Release workflow manually.

1 similar comment
@github-actions

Copy link
Copy Markdown

Release Preflight

  • package version: 18.1.2
  • 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.1.2. A maintainer who is a JSR @git-stunts scope member must then dispatch the Release workflow manually.

@github-actions

Copy link
Copy Markdown

Release Preflight

  • package version: 18.1.2
  • 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.1.2. A maintainer who is a JSR @git-stunts scope member must then dispatch the Release workflow manually.

@flyingrobots

Copy link
Copy Markdown
Member Author

@codex Follow-up after keeping @git-stunts/trailer-codec as the canonical runtime codec:

Area Outcome Evidence
Runtime default bridge Application/browser/test roots install the default trailer-codec resolver; domain APIs stay strict and codec-required. npm run typecheck; npm run lint; pre-push IRONCLAD M9
BATS seed helper Seed scripts now install the same runtime default before WarpCore.open, closing the Node 22 CI failure. test-node (22) passed on head b879bf8e
Review threads Remaining CodeRabbit threads were stale/invalid against current code and have been resolved after audit. LoadCheckpointOptions.commitMessageCodec and MaterializeIncrementalOptions.commitMessageCodec are required; tests inject DEFAULT_COMMIT_MESSAGE_CODEC through local wrappers
CI All GitHub Actions checks pass. PR checks green except CodeRabbit service status: Review rate limit exceeded

CodeRabbit itself is still reporting a service/rate-limit failure, not a code failure.

@flyingrobots
flyingrobots merged commit 0aafac0 into main Jun 28, 2026
17 checks passed
@flyingrobots
flyingrobots deleted the feature/v19-domain-codec-leak-removal branch June 28, 2026 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant