Fix: remove domain commit codec adapter imports - #703
Conversation
|
Warning Review limit reached
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 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 configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughDomain codec wrappers now point away from the adapter, trailer parsing is implemented in ChangesDomain codec boundary shift
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (4 passed)
Comment |
Release Preflight
If this PR is from a |
There was a problem hiding this comment.
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
📒 Files selected for processing (11)
src/domain/services/codec/AnchorMessageCodec.tssrc/domain/services/codec/AuditMessageCodec.tssrc/domain/services/codec/CheckpointMessageCodec.tssrc/domain/services/codec/MessageCodecInternal.tssrc/domain/services/codec/MessageSchemaDetector.tssrc/domain/services/codec/PatchMessageCodec.tssrc/domain/services/codec/TextCommitMessageCodec.tssrc/domain/services/codec/TrailerValidation.tssrc/domain/services/codec/WarpMessageCodec.tstest/unit/domain/services/MessageCodecModules.test.tstest/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 fromsrc/infrastructure/**insrc/domain/**orsrc/ports/**; depend on a port instead.
Do not use direct Node built-ins insrc/domain/**orsrc/ports/**; use a port instead.
Files:
test/unit/domain/services/WarpMessageCodec.test.tssrc/domain/services/codec/CheckpointMessageCodec.tssrc/domain/services/codec/PatchMessageCodec.tssrc/domain/services/codec/AnchorMessageCodec.tssrc/domain/services/codec/MessageSchemaDetector.tssrc/domain/services/codec/TrailerValidation.tstest/unit/domain/services/MessageCodecModules.test.tssrc/domain/services/codec/AuditMessageCodec.tssrc/domain/services/codec/WarpMessageCodec.tssrc/domain/services/codec/MessageCodecInternal.tssrc/domain/services/codec/TextCommitMessageCodec.ts
src/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
src/**/*.{ts,tsx,js,jsx}: Do not introduceany,as any,as unknown as,unknown(outside adapters),Record<string, unknown>(outside adapters),*Likeplaceholder types,JSON.parse/JSON.stringify(outside adapters),fetch(outside adapters),process.env(outside adapters),@ts-ignore, orz.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 createutils.ts,helpers.ts,misc.ts, orcommon.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 asUint8Array;Bufferbelongs in infrastructure adapters.
Files:
src/domain/services/codec/CheckpointMessageCodec.tssrc/domain/services/codec/PatchMessageCodec.tssrc/domain/services/codec/AnchorMessageCodec.tssrc/domain/services/codec/MessageSchemaDetector.tssrc/domain/services/codec/TrailerValidation.tssrc/domain/services/codec/AuditMessageCodec.tssrc/domain/services/codec/WarpMessageCodec.tssrc/domain/services/codec/MessageCodecInternal.tssrc/domain/services/codec/TextCommitMessageCodec.ts
src/domain/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
src/domain/**/*.{ts,tsx,js,jsx}: Insrc/domain/**, do not useDate.now(),new Date(),Date(),performance.now(),Math.random(),crypto.randomUUID(),crypto.getRandomValues(),setTimeout,setInterval, rawnew 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 extendWarpError.
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.tssrc/domain/services/codec/PatchMessageCodec.tssrc/domain/services/codec/AnchorMessageCodec.tssrc/domain/services/codec/MessageSchemaDetector.tssrc/domain/services/codec/TrailerValidation.tssrc/domain/services/codec/AuditMessageCodec.tssrc/domain/services/codec/WarpMessageCodec.tssrc/domain/services/codec/MessageCodecInternal.tssrc/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, andinstanceofdispatch; domain objects should be runtime-backed nouns, not ad hoc shape bags.
Files:
src/domain/services/codec/CheckpointMessageCodec.tssrc/domain/services/codec/PatchMessageCodec.tssrc/domain/services/codec/AnchorMessageCodec.tssrc/domain/services/codec/MessageSchemaDetector.tssrc/domain/services/codec/TrailerValidation.tssrc/domain/services/codec/AuditMessageCodec.tssrc/domain/services/codec/WarpMessageCodec.tssrc/domain/services/codec/MessageCodecInternal.tssrc/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
Release Preflight
If this PR is from a |
There was a problem hiding this comment.
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 winTighten the codec contract on this exported path.
loadPatchFromCommit()now throws whencommitMessageCodecis omitted, butLoadPatchRangeOptionsstill advertises it as optional andloadPatchRange()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 winDerive 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/codecand 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
📒 Files selected for processing (84)
scripts/migrations/v17.0.0/checkpoint-schema-upgrade.tssrc/domain/RuntimeHost.tssrc/domain/services/PatchBuilder.tssrc/domain/services/PatchCommitter.tssrc/domain/services/WormholeService.tssrc/domain/services/codec/AnchorMessageCodec.tssrc/domain/services/codec/CheckpointMessageCodec.tssrc/domain/services/codec/CommitMessageCodecRequirement.tssrc/domain/services/codec/PatchMessageCodec.tssrc/domain/services/codec/WarpMessageCodec.tssrc/domain/services/controllers/MaterializeCheckpointStrategy.tssrc/domain/services/controllers/MaterializeController.tssrc/domain/services/state/checkpointCreate.tssrc/domain/services/state/checkpointLoad.tssrc/domain/services/strand/StrandPatchService.tssrc/domain/services/sync/syncPatchLoader.tssrc/domain/warp/RuntimeHostBoot.tssrc/domain/warp/Writer.tstest/benchmark/detachedReadBenchmark.fixture.tstest/helpers/WarpGraphMockPersistence.tstest/helpers/WarpGraphPatchFixtures.tstest/integration/api/checkpoint.test.tstest/unit/domain/WarpCore.snapshotHashStability.test.tstest/unit/domain/WarpGraph.autoCheckpoint.test.tstest/unit/domain/WarpGraph.backfill.test.tstest/unit/domain/WarpGraph.checkpoint.test.tstest/unit/domain/WarpGraph.conflicts.test.tstest/unit/domain/WarpGraph.coverageGaps.test.tstest/unit/domain/WarpGraph.frontierChanged.test.tstest/unit/domain/WarpGraph.invalidation.test.tstest/unit/domain/WarpGraph.observerBoundary.test.tstest/unit/domain/WarpGraph.patchCount.test.tstest/unit/domain/WarpGraph.patchesFor.test.tstest/unit/domain/WarpGraph.receipts.test.tstest/unit/domain/WarpGraph.seek.test.tstest/unit/domain/WarpGraph.seekDiff.test.tstest/unit/domain/WarpGraph.status.test.tstest/unit/domain/WarpGraph.strands.compare.test.tstest/unit/domain/WarpGraph.strands.intents.test.tstest/unit/domain/WarpGraph.strands.test.tstest/unit/domain/WarpGraph.test.tstest/unit/domain/WarpGraph.versionVector.test.tstest/unit/domain/WarpGraph.worldline.test.tstest/unit/domain/WarpGraph.writerInvalidation.test.tstest/unit/domain/runtimeReadingBasisErrors.test.tstest/unit/domain/seekCache.test.tstest/unit/domain/services/CheckpointService.anchors.test.tstest/unit/domain/services/CheckpointService.edgeCases.test.tstest/unit/domain/services/CheckpointService.test.tstest/unit/domain/services/EdgePropSetWireMigrationGate.test.tstest/unit/domain/services/MessageCodecModules.test.tstest/unit/domain/services/PatchBuilder.cas.test.tstest/unit/domain/services/PatchBuilder.commit.test.tstest/unit/domain/services/PatchBuilder.test.tstest/unit/domain/services/PatchBuilderTestHarness.tstest/unit/domain/services/PatchCommitter.visibility.test.tstest/unit/domain/services/SchemaCompat.test.tstest/unit/domain/services/SyncProtocol.divergence.test.tstest/unit/domain/services/SyncProtocol.stateCoherence.test.tstest/unit/domain/services/SyncProtocol.test.tstest/unit/domain/services/TreeConstruction.determinism.test.tstest/unit/domain/services/WarpMessageCodec.test.tstest/unit/domain/services/WarpMessageCodec.v3.test.tstest/unit/domain/services/WormholeService.test.tstest/unit/domain/services/controllers/CheckpointController.snapshotCache.test.tstest/unit/domain/services/controllers/CheckpointController.test.tstest/unit/domain/services/controllers/MaterializeController.snapshotCache.test.tstest/unit/domain/services/controllers/MaterializeController.stateSession.test.tstest/unit/domain/services/controllers/MaterializePatchStreamReducer.test.tstest/unit/domain/services/controllers/PatchController.test.tstest/unit/domain/services/controllers/ProvenanceController.test.tstest/unit/domain/services/controllers/StrandController.host-interface.test.tstest/unit/domain/services/optic/CheckpointPatchFactStream.test.tstest/unit/domain/services/optic/CheckpointShardFactReader.manifest.test.tstest/unit/domain/services/optic/CheckpointTailBasisVerifier.test.tstest/unit/domain/services/optic/CoordinateCheckpointTailOpticSource.test.tstest/unit/domain/services/optic/TraversalOptic.test.tstest/unit/domain/services/optic/WorldlineOptic.test.tstest/unit/domain/services/v3-compatibility.test.tstest/unit/domain/warp/PatchSession.operations.test.tstest/unit/domain/warp/Writer.test.tstest/unit/infrastructure/adapters/CborPatchJournalAdapter.test.tstest/unit/scripts/checkpoint-schema-upgrade.test.tstest/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 introduceany,as any,as unknown as,unknown(outside adapters),Record<string, unknown>(outside adapters),*Likeplaceholder types,JSON.parse/JSON.stringify(outside adapters),fetch(outside adapters),process.env(outside adapters),@ts-ignore, orz.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 createutils.ts,helpers.ts,misc.ts, orcommon.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 asUint8Array;Bufferbelongs in infrastructure adapters.
Files:
src/domain/services/codec/CommitMessageCodecRequirement.tssrc/domain/services/controllers/MaterializeCheckpointStrategy.tssrc/domain/services/WormholeService.tssrc/domain/warp/Writer.tssrc/domain/services/strand/StrandPatchService.tssrc/domain/services/controllers/MaterializeController.tssrc/domain/services/state/checkpointCreate.tssrc/domain/services/sync/syncPatchLoader.tssrc/domain/services/PatchBuilder.tssrc/domain/RuntimeHost.tssrc/domain/services/state/checkpointLoad.tssrc/domain/services/PatchCommitter.tssrc/domain/warp/RuntimeHostBoot.ts
src/domain/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
src/domain/**/*.{ts,tsx,js,jsx}: Insrc/domain/**, do not useDate.now(),new Date(),Date(),performance.now(),Math.random(),crypto.randomUUID(),crypto.getRandomValues(),setTimeout,setInterval, rawnew 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 extendWarpError.
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.tssrc/domain/services/controllers/MaterializeCheckpointStrategy.tssrc/domain/services/WormholeService.tssrc/domain/warp/Writer.tssrc/domain/services/strand/StrandPatchService.tssrc/domain/services/controllers/MaterializeController.tssrc/domain/services/state/checkpointCreate.tssrc/domain/services/sync/syncPatchLoader.tssrc/domain/services/PatchBuilder.tssrc/domain/RuntimeHost.tssrc/domain/services/state/checkpointLoad.tssrc/domain/services/PatchCommitter.tssrc/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, andinstanceofdispatch; domain objects should be runtime-backed nouns, not ad hoc shape bags.
Files:
src/domain/services/codec/CommitMessageCodecRequirement.tssrc/domain/services/controllers/MaterializeCheckpointStrategy.tssrc/domain/services/WormholeService.tssrc/domain/warp/Writer.tssrc/domain/services/strand/StrandPatchService.tssrc/domain/services/controllers/MaterializeController.tssrc/domain/services/state/checkpointCreate.tssrc/domain/services/sync/syncPatchLoader.tssrc/domain/services/PatchBuilder.tssrc/domain/RuntimeHost.tssrc/domain/services/state/checkpointLoad.tssrc/domain/services/PatchCommitter.tssrc/domain/warp/RuntimeHostBoot.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx,js,jsx}: Do not use direct imports fromsrc/infrastructure/**insrc/domain/**orsrc/ports/**; depend on a port instead.
Do not use direct Node built-ins insrc/domain/**orsrc/ports/**; use a port instead.
Files:
src/domain/services/codec/CommitMessageCodecRequirement.tstest/unit/domain/WarpGraph.patchesFor.test.tstest/unit/domain/WarpGraph.invalidation.test.tstest/unit/domain/WarpGraph.backfill.test.tstest/unit/domain/WarpGraph.patchCount.test.tsscripts/migrations/v17.0.0/checkpoint-schema-upgrade.tstest/unit/domain/services/controllers/MaterializeController.stateSession.test.tstest/unit/domain/services/SyncProtocol.divergence.test.tstest/unit/domain/WarpGraph.observerBoundary.test.tstest/helpers/WarpGraphPatchFixtures.tssrc/domain/services/controllers/MaterializeCheckpointStrategy.tstest/unit/domain/WarpGraph.receipts.test.tstest/unit/domain/services/controllers/MaterializePatchStreamReducer.test.tstest/unit/scripts/v16-to-v17-upgrade.test.tstest/unit/domain/WarpGraph.autoCheckpoint.test.tstest/unit/domain/WarpGraph.strands.test.tstest/unit/domain/services/WarpMessageCodec.v3.test.tstest/unit/domain/services/SchemaCompat.test.tstest/integration/api/checkpoint.test.tstest/unit/domain/services/controllers/MaterializeController.snapshotCache.test.tstest/unit/domain/services/optic/TraversalOptic.test.tstest/unit/infrastructure/adapters/CborPatchJournalAdapter.test.tstest/unit/domain/services/CheckpointService.anchors.test.tstest/unit/domain/services/WormholeService.test.tstest/benchmark/detachedReadBenchmark.fixture.tstest/unit/domain/WarpGraph.worldline.test.tssrc/domain/services/WormholeService.tstest/unit/domain/seekCache.test.tssrc/domain/warp/Writer.tstest/unit/domain/services/optic/WorldlineOptic.test.tstest/unit/domain/services/optic/CheckpointShardFactReader.manifest.test.tstest/unit/domain/services/optic/CheckpointPatchFactStream.test.tssrc/domain/services/strand/StrandPatchService.tstest/unit/domain/WarpGraph.versionVector.test.tstest/unit/domain/services/PatchBuilder.test.tssrc/domain/services/controllers/MaterializeController.tstest/unit/domain/WarpGraph.test.tstest/unit/domain/services/TreeConstruction.determinism.test.tstest/unit/scripts/checkpoint-schema-upgrade.test.tstest/unit/domain/services/controllers/ProvenanceController.test.tstest/unit/domain/WarpGraph.seekDiff.test.tstest/helpers/WarpGraphMockPersistence.tstest/unit/domain/services/PatchBuilder.commit.test.tstest/unit/domain/services/controllers/CheckpointController.snapshotCache.test.tstest/unit/domain/services/optic/CheckpointTailBasisVerifier.test.tstest/unit/domain/services/EdgePropSetWireMigrationGate.test.tstest/unit/domain/WarpGraph.conflicts.test.tstest/unit/domain/WarpGraph.frontierChanged.test.tstest/unit/domain/WarpGraph.status.test.tstest/unit/domain/services/controllers/StrandController.host-interface.test.tstest/unit/domain/WarpGraph.coverageGaps.test.tstest/unit/domain/services/v3-compatibility.test.tstest/unit/domain/WarpGraph.checkpoint.test.tstest/unit/domain/warp/PatchSession.operations.test.tstest/unit/domain/WarpGraph.writerInvalidation.test.tstest/unit/domain/WarpGraph.seek.test.tstest/unit/domain/WarpGraph.strands.compare.test.tssrc/domain/services/state/checkpointCreate.tstest/unit/domain/services/PatchCommitter.visibility.test.tstest/unit/domain/services/controllers/CheckpointController.test.tstest/unit/domain/runtimeReadingBasisErrors.test.tstest/unit/domain/services/SyncProtocol.stateCoherence.test.tssrc/domain/services/sync/syncPatchLoader.tstest/unit/domain/services/optic/CoordinateCheckpointTailOpticSource.test.tstest/unit/domain/services/controllers/PatchController.test.tssrc/domain/services/PatchBuilder.tstest/unit/domain/WarpCore.snapshotHashStability.test.tstest/unit/domain/services/PatchBuilderTestHarness.tstest/unit/domain/services/WarpMessageCodec.test.tstest/unit/domain/services/SyncProtocol.test.tssrc/domain/RuntimeHost.tstest/unit/domain/WarpGraph.strands.intents.test.tstest/unit/domain/services/PatchBuilder.cas.test.tssrc/domain/services/state/checkpointLoad.tstest/unit/domain/services/CheckpointService.test.tssrc/domain/services/PatchCommitter.tstest/unit/domain/services/CheckpointService.edgeCases.test.tssrc/domain/warp/RuntimeHostBoot.tstest/unit/domain/services/MessageCodecModules.test.tstest/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
There was a problem hiding this comment.
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
📒 Files selected for processing (4)
src/domain/services/codec/MessageCodecInternal.tssrc/domain/services/codec/MessageSchemaDetector.tstest/unit/domain/services/MessageCodecModules.test.tstest/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 introduceany,as any,as unknown as,unknown(outside adapters),Record<string, unknown>(outside adapters),*Likeplaceholder types,JSON.parse/JSON.stringify(outside adapters),fetch(outside adapters),process.env(outside adapters),@ts-ignore, orz.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 createutils.ts,helpers.ts,misc.ts, orcommon.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 asUint8Array;Bufferbelongs in infrastructure adapters.
Files:
src/domain/services/codec/MessageSchemaDetector.tssrc/domain/services/codec/MessageCodecInternal.ts
src/domain/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
src/domain/**/*.{ts,tsx,js,jsx}: Insrc/domain/**, do not useDate.now(),new Date(),Date(),performance.now(),Math.random(),crypto.randomUUID(),crypto.getRandomValues(),setTimeout,setInterval, rawnew 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 extendWarpError.
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.tssrc/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, andinstanceofdispatch; domain objects should be runtime-backed nouns, not ad hoc shape bags.
Files:
src/domain/services/codec/MessageSchemaDetector.tssrc/domain/services/codec/MessageCodecInternal.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx,js,jsx}: Do not use direct imports fromsrc/infrastructure/**insrc/domain/**orsrc/ports/**; depend on a port instead.
Do not use direct Node built-ins insrc/domain/**orsrc/ports/**; use a port instead.
Files:
src/domain/services/codec/MessageSchemaDetector.tstest/unit/domain/services/WarpMessageCodec.test.tssrc/domain/services/codec/MessageCodecInternal.tstest/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!
Release Preflight
If this PR is from a |
There was a problem hiding this comment.
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
📒 Files selected for processing (16)
browser.tsdocs/topics/reference.mdindex.tssrc/application/RuntimeHostCommitMessageCodecDefaults.tssrc/application/WormholeServiceDefaults.tssrc/domain/services/WormholeService.tssrc/domain/services/codec/MessageCodecInternal.tssrc/domain/services/state/checkpointCreate.tssrc/domain/services/state/checkpointLoad.tssrc/domain/warp/RuntimeHostBoot.tstest/helpers/runtimeHostCommitMessageCodecSetup.tstest/unit/domain/services/CheckpointService.edgeCases.test.tstest/unit/domain/services/CheckpointService.test.tstest/unit/domain/services/MessageCodecModules.test.tstest/unit/domain/services/WormholeService.test.tsvitest.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 introduceany,as any,as unknown as,unknown(outside adapters),Record<string, unknown>(outside adapters),*Likeplaceholder types,JSON.parse/JSON.stringify(outside adapters),fetch(outside adapters),process.env(outside adapters),@ts-ignore, orz.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 createutils.ts,helpers.ts,misc.ts, orcommon.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 asUint8Array;Bufferbelongs in infrastructure adapters.
Files:
src/application/RuntimeHostCommitMessageCodecDefaults.tssrc/application/WormholeServiceDefaults.tssrc/domain/services/WormholeService.tssrc/domain/services/state/checkpointCreate.tssrc/domain/warp/RuntimeHostBoot.tssrc/domain/services/state/checkpointLoad.tssrc/domain/services/codec/MessageCodecInternal.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx,js,jsx}: Do not use direct imports fromsrc/infrastructure/**insrc/domain/**orsrc/ports/**; depend on a port instead.
Do not use direct Node built-ins insrc/domain/**orsrc/ports/**; use a port instead.
Files:
src/application/RuntimeHostCommitMessageCodecDefaults.tstest/helpers/runtimeHostCommitMessageCodecSetup.tsbrowser.tsvitest.config.tssrc/application/WormholeServiceDefaults.tstest/unit/domain/services/WormholeService.test.tstest/unit/domain/services/CheckpointService.test.tssrc/domain/services/WormholeService.tsindex.tstest/unit/domain/services/CheckpointService.edgeCases.test.tstest/unit/domain/services/MessageCodecModules.test.tssrc/domain/services/state/checkpointCreate.tssrc/domain/warp/RuntimeHostBoot.tssrc/domain/services/state/checkpointLoad.tssrc/domain/services/codec/MessageCodecInternal.ts
src/domain/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
src/domain/**/*.{ts,tsx,js,jsx}: Insrc/domain/**, do not useDate.now(),new Date(),Date(),performance.now(),Math.random(),crypto.randomUUID(),crypto.getRandomValues(),setTimeout,setInterval, rawnew 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 extendWarpError.
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.tssrc/domain/services/state/checkpointCreate.tssrc/domain/warp/RuntimeHostBoot.tssrc/domain/services/state/checkpointLoad.tssrc/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, andinstanceofdispatch; domain objects should be runtime-backed nouns, not ad hoc shape bags.
Files:
src/domain/services/WormholeService.tssrc/domain/services/state/checkpointCreate.tssrc/domain/warp/RuntimeHostBoot.tssrc/domain/services/state/checkpointLoad.tssrc/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!
Release Preflight
If this PR is from a |
1 similar comment
Release Preflight
If this PR is from a |
Release Preflight
If this PR is from a |
|
@codex Follow-up after keeping
CodeRabbit itself is still reporting a service/rate-limit failure, not a code failure. |
Summary
@git-stunts/trailer-codecas the canonical concrete trailer implementation inTrailerCommitMessageCodecAdapterTextCommitMessageCodecCommitMessageCodecPortinstead of silently importing a concrete defaultScope
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
npx vitest run test/unit/domain/services/MessageCodecModules.test.tsfailed on the oldinfrastructure/adapterswrapper importnpm run test:localfailed on remaining test fixtures that still relied on hidden domain commit-message defaultsnpx 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.tsnpx 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.tsnpx vitest run test/unit/domain/WarpGraph.test.ts test/unit/domain/services/controllers/StrandController.host-interface.test.ts test/unit/domain/services/MessageCodecModules.test.tsnpm run typechecknpm run lintnpm run lint:semgrepnpm run lint:sludgenpm run lint:quarantine-graduatenpm run typecheck:consumernpm run test:localnpm run test:localPart of #695.
Closes #170.
Closes #173.