Skip to content

Complete V18-GP4 streamed optic slices#643

Merged
flyingrobots merged 17 commits into
mainfrom
checkpoint-basis-streamed-optics
Jun 6, 2026
Merged

Complete V18-GP4 streamed optic slices#643
flyingrobots merged 17 commits into
mainfrom
checkpoint-basis-streamed-optics

Conversation

@flyingrobots

@flyingrobots flyingrobots commented Jun 6, 2026

Copy link
Copy Markdown
Member

Summary

  • add manifest-backed neighborhood optics for checkpoint basis adjacency reads
  • add cursorized traversal optics over streamed checkpoint basis reads
  • add optic witness CLI playback with deterministic basis and read-identity evidence
  • document the compact progress report footer contract

Issues

Verification

  • npm run lint
  • npm run typecheck:src
  • npm run typecheck:test
  • npx vitest run test/conformance/v18NeighborhoodOpticReadBasis.test.ts test/conformance/v18TraversalOpticReadBasis.test.ts test/unit/cli/optic.test.ts test/unit/cli/parseArgs.test.ts test/unit/domain/services/optic/CheckpointBasisManifest.test.ts test/unit/domain/services/optic/StreamingCheckpointBasisBuilder.test.ts test/unit/domain/services/optic/CheckpointPatchFactStream.test.ts
  • npm run test:local

Notes

  • Pre-push IRONCLAD M9 also passed link checks, static gates, markdown gates, surface validation, and the full unit suite.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added optic witness CLI command to query graph data with optional property filtering.
    • Added neighborhood read capability to inspect adjacent nodes and edges with configurable direction and label filtering.
    • Added graph traversal API supporting breadth-first search with depth and edge limits.
  • Documentation

    • Updated progress tracking instructions with new footer format specifications.

@coderabbitai

coderabbitai Bot commented Jun 6, 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 24 minutes and 12 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more 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.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 04d5124f-399a-4e8a-bb28-f6a8181d34c9

📥 Commits

Reviewing files that changed from the base of the PR and between cf9868e and d96437d.

📒 Files selected for processing (25)
  • .github/workflows/ci.yml
  • package.json
  • scripts/release-preflight.sh
  • src/domain/services/optic/CheckpointAdjacencyFact.ts
  • src/domain/services/optic/CheckpointBasisFact.ts
  • src/domain/services/optic/CheckpointBasisFactBase.ts
  • src/domain/services/optic/CheckpointBasisFactTypes.ts
  • src/domain/services/optic/CheckpointBasisFactValidation.ts
  • src/domain/services/optic/CheckpointBasisManifest.ts
  • src/domain/services/optic/CheckpointContentAnchorFact.ts
  • src/domain/services/optic/CheckpointEdgeFact.ts
  • src/domain/services/optic/CheckpointNodeLivenessFact.ts
  • src/domain/services/optic/CheckpointNodePropertyFact.ts
  • src/domain/services/optic/CheckpointPatchFactStream.ts
  • src/domain/services/optic/CheckpointProvenanceFact.ts
  • src/domain/services/optic/CheckpointShardFactReader.ts
  • src/domain/services/optic/CheckpointTailReadIdentityBuilder.ts
  • src/domain/services/optic/CheckpointTailTraversalReader.ts
  • src/domain/services/optic/TraversalOptic.ts
  • test/conformance/v18TraversalOpticReadBasis.test.ts
  • test/unit/domain/services/optic/CheckpointBasisManifest.test.ts
  • test/unit/domain/services/optic/CheckpointPatchFactStream.test.ts
  • test/unit/domain/services/optic/CheckpointShardFactReader.manifest.test.ts
  • test/unit/domain/services/optic/CheckpointTailReadIdentityBuilder.test.ts
  • test/unit/domain/services/optic/TraversalOptic.test.ts
📝 Walkthrough

Walkthrough

This pull request implements neighborhood and traversal optics for v18 holographic graph slicing, backed by a complete checkpoint basis infrastructure. It adds one-hop and multi-hop graph navigation with deterministic witness output, bounded shard-resident reads, and a new CLI optic witness command without materialization.

Changes

Holographic Optic Reads

Layer / File(s) Summary
Checkpoint basis fact model and transport
src/domain/services/optic/CheckpointBasisFact.ts
Discriminated fact types (node-liveness, node-property, adjacency, edge-fact, provenance, content-anchor) with transport shapes, event identity, shard routing, sort keys, and validation helpers.
Checkpoint basis manifest model and validation
src/domain/services/optic/CheckpointBasisManifest.ts, test/unit/domain/services/optic/CheckpointBasisManifest.test.ts
Manifest validation, immutable value objects for root maps/geometry/chunking/completeness/posture, identity separation enforcement, and cross-field invariant validation with comprehensive error context.
Streaming checkpoint basis builder from facts
src/domain/services/optic/StreamingCheckpointBasisBuilder.ts, test/unit/domain/services/optic/StreamingCheckpointBasisBuilder.test.ts
Async iterable fact consumption with buffered shard flushing, deterministic chunk naming and tree construction, manifest derivation from fact streams, and publications for root-family accumulation.
Patch-to-fact streaming pipeline
src/domain/services/optic/CheckpointPatchFactStream.ts, test/unit/domain/services/optic/CheckpointPatchFactStream.test.ts
Converts checkpoint patch chains into ordered fact streams by normalizing operations, emitting per-op facts, validating patch coverage, and sorting by event ID for deterministic output.
Integrate checkpoint basis manifest into tail basis loading
src/domain/services/optic/CheckpointTailBasisLoader.ts
Extends CheckpointTailBasisLoader to construct and return a CheckpointBasisManifest as part of the loaded basis, computing root maps for all root families and configuring manifest geometry/chunking from observed shard counts.
Neighborhood read infrastructure
src/domain/services/optic/CheckpointShardFactReader.ts, src/domain/services/optic/CheckpointTailFactReducer.ts, src/domain/services/optic/CheckpointTailReadIdentityBuilder.ts
Adds neighborhood shard reading (direction-aware adjacency/labels shards, edge deduplication/ordering), tail neighborhood detection and stability assertion, and neighborhood-scoped read identity construction.
Neighborhood optic public types and wrappers
src/domain/services/optic/NeighborhoodOpticReadResult.ts, src/domain/services/optic/NeighborhoodOptic.ts
Defines NeighborhoodOpticReadResult with direction/completeness/edges/cursor, NeighborhoodOptic wrapper exposing read() method, and public optic type exports for direction/completeness/edge shapes.
Traversal optic reader and result types
src/domain/services/optic/CheckpointTailTraversalReader.ts, src/domain/services/optic/TraversalOpticReadResult.ts, src/domain/services/optic/TraversalOptic.ts
Implements breadth-first frontier-based expansion with cursor state preservation, depth/node/edge bounding, goal detection, and completeness determination. Defines result types and cursor state.
CheckpointTailWitnessLocator neighborhood/traversal methods
src/domain/services/optic/CheckpointTailWitnessLocator.ts
Adds readNeighborhood() and readTraversal() public methods with QueryError wrapping, cursor/limit windowing, tail scanning and stability checks, and read identity construction.
Public optic API surface: NodeOptic and WorldlineOptic navigation
src/domain/services/optic/NodeOptic.ts, src/domain/services/optic/WorldlineOptic.ts, src/domain/services/optic/CheckpointTailReadFailure.ts, src/domain/services/optic/OpticReadFailureCause.ts, src/domain/services/optic/OpticReadTarget.ts
Extends NodeOptic with neighbors() and traverse() methods; extends WorldlineOptic with neighborhood() and traversal() methods; updates failure/target/cause enums for new optic kinds.
CLI optic witness command implementation
bin/cli/commands/optic.ts, bin/cli/commands/registry.ts, bin/cli/infrastructure.ts, bin/cli/schemas.ts, AGENTS.md
Implements complete CLI handler for optic witness subcommand: parses node id and optional property, opens optic worldline, reads node or property, and returns machine-readable JSON payload with basis id, completeness, read result, evidence (shard ids, tail witness range), and obstruction details on error.
Neighborhood and traversal conformance tests
test/conformance/v18NeighborhoodOpticReadBasis.test.ts, test/conformance/v18TraversalOpticReadBasis.test.ts
Validates deterministic reads, direction/label/limit filtering, cursor pagination, completeness/goal detection, and failure modes without materialization fallback.
CLI optic command unit tests
test/unit/cli/optic.test.ts
Tests CLI handler success path (complete witness payload with basis/selection/read/evidence), bounded-basis failure handling, mixed success/failure, and source-level guards against materialization APIs.
Test fixtures for manifest-backed shard reading
test/unit/domain/services/optic/CheckpointShardFactReader.manifest.test.ts
Adds manifest-backed routing tests with ManifestShardSource test double, manifestBasis helper for manifest construction, and metaShardBytes for shard serialization.
Conformance test fixture extensions for new optic kinds
test/conformance/fixtures/V17OpticFailureExpectations.ts, test/conformance/fixtures/V17PublicOpticReadPath.ts
Widens fixtures to support neighborhood and traversal optic kinds with updated error/read APIs and dynamic method invocation with arguments.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related issues

  • #631: Implements CheckpointPatchFactStream that directly matches PROTO-0271D patch-to-fact streaming functionality.
  • #629: Adds CheckpointBasisManifest implementation that directly implements PROTO-0271B checkpoint basis manifest contract.
  • #632: Implements manifest-backed streamed checkpoint bases routing optics through manifest-backed shards, fulfilling PROTO-0271E objective.
  • #630: Implements StreamingCheckpointBasisBuilder that directly implements PROTO-0271C streaming checkpoint-basis builder.

🐰 Through facts we weave,
Each shard tells stories,
Paths unfold with grace.
Neighborhood whispers,
Traversal finds its way. 🌿

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch checkpoint-basis-streamed-optics

@flyingrobots

Copy link
Copy Markdown
Member Author

@codex Self-review found one actionable issue before merge.

Severity File:Lines Infraction Evidence Recommended mitigation prompt
P1 High src/domain/services/optic/CheckpointTailTraversalReader.ts:118-141 Traversal resume cursor can duplicate edges and stall when maxNodes opens the frontier mid-neighborhood. processNeighborhoodRead iterates edges without tracking the edge offset. maybeOpenForNodeLimit requeues current unchanged (edgeCursor remains null for the common first-page case). A resumed traversal rereads the same neighborhood from the beginning, re-emits already returned edges for visited neighbors, and hits the same node limit again before reaching the blocked neighbor. Add a deterministic regression covering maxNodes frontier-open resume, prove RED first, then encode the blocked edge offset into the requeued TraversalOpticFrontierEntry.edgeCursor so resume starts at the blocked edge instead of replaying earlier edges.

@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown

Release Preflight

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

If you tag this commit as v18.0.0, release workflow will publish.

@flyingrobots

Copy link
Copy Markdown
Member Author

@codex Self-review issue resolved.

Issue Severity Fix commit Outcome Verification
Traversal node-budget cursor requeued a frontier entry without the blocked edge offset, allowing resume to duplicate already emitted edges. P1 High 617405b1 Added a deterministic RED regression and fixed requeued frontier entries to store the blocked edge cursor. npx vitest run test/conformance/v18TraversalOpticReadBasis.test.ts; npm run lint; npm run typecheck:src; npm run typecheck:test; focused optic suite; npm run test:local.

@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown

Release Preflight

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

If you tag this commit as v18.0.0, release workflow will publish.

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

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/optic/CheckpointBasisManifest.ts (1)

1-545: 🛠️ Refactor suggestion | 🟠 Major | 🏗️ Heavy lift

This source file exceeds the size cap and mixes too many peer concepts.

At 545 LOC, this file is over the source-file limit and combines multiple domain value objects plus manifest orchestration/validators in one place.

As per coding guidelines, **/*.{ts,tsx,js,mjs} source files must stay within 500 LOC, and **/*.{ts,tsx} should use one file per class/type/object.

🤖 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/optic/CheckpointBasisManifest.ts` around lines 1 - 545,
The file is too large and mixes multiple domain VOs and
validation/orchestration; split it into smaller modules: extract
CheckpointBasisManifest (with constructor, rootMaps, validateManifestState call)
into its own file, extract each value object class (CheckpointBasisShardRootMap,
CheckpointBasisShardGeometry, CheckpointBasisChunking,
CheckpointBasisCompleteness, CheckpointBasisSupportPosture) into separate files
(one per class), and move related validators/helpers (validateManifestOptions,
manifestRootMaps, nullableManifestRefs, validateShardGeometryObjects,
validateReadingIdentitySeparation, initialByteIdentityValues,
add*IdentityValues, throwManifestError, freezeStringList, copy* helpers,
compareMapEntries, validation primitives like
validateNonEmptyString/validatePositiveInteger/validateNonNegativeInteger/validateSupportedSchema/validateRootFamily/validateCompletenessKind/validatePostureKind/validateFrontier/validateAppliedVersionVector/validateRoots/validateSupportPosture/validateCompleteness/validateShardGeometry/validatePostureShape/validationPostureOrDefault/verificationPostureOrDefault)
into a validators/utilities module; update imports/exports so
CheckpointBasisManifest imports the VO classes and validator functions by name
(e.g., CheckpointBasisShardRootMap, CheckpointBasisShardGeometry,
CheckpointBasisChunking, CheckpointBasisCompleteness,
CheckpointBasisSupportPosture, validateManifestOptions, manifestRootMaps,
nullableManifestRefs, validateManifestState, throwManifestError), preserve
exported CHECKPOINT_BASIS_MANIFEST_SCHEMA and types, and run tests to ensure no
API changes.

Source: Coding guidelines

🧹 Nitpick comments (1)
test/conformance/fixtures/V17PublicOpticReadPath.ts (1)

24-34: ⚡ Quick win

Extract reflected method names into constants.

Line 26 through Line 33 and Line 60 add more string-literal reflective method names; centralizing them as constants lowers typo risk in this dynamic dispatch path.

Proposed refactor
+const WORLDLINE_OPTIC_METHODS = Object.freeze({
+  optic: 'optic',
+  neighborhood: 'neighborhood',
+  traversal: 'traversal',
+  read: 'read',
+} as const);
+
   async readNeighborhood(nodeId: string, options: object): Promise<object> {
-    const optic = this.invokeObject(this.worldline, 'optic');
-    const neighborhoodScope = this.invokeObject(optic, 'neighborhood', [nodeId]);
-    return await this.invokePromiseObject(neighborhoodScope, 'read', [options]);
+    const optic = this.invokeObject(this.worldline, WORLDLINE_OPTIC_METHODS.optic);
+    const neighborhoodScope = this.invokeObject(optic, WORLDLINE_OPTIC_METHODS.neighborhood, [nodeId]);
+    return await this.invokePromiseObject(neighborhoodScope, WORLDLINE_OPTIC_METHODS.read, [options]);
   }

   async readTraversal(startNodeId: string, options: object): Promise<object> {
-    const optic = this.invokeObject(this.worldline, 'optic');
-    const traversalScope = this.invokeObject(optic, 'traversal', [startNodeId]);
-    return await this.invokePromiseObject(traversalScope, 'read', [options]);
+    const optic = this.invokeObject(this.worldline, WORLDLINE_OPTIC_METHODS.optic);
+    const traversalScope = this.invokeObject(optic, WORLDLINE_OPTIC_METHODS.traversal, [startNodeId]);
+    return await this.invokePromiseObject(traversalScope, WORLDLINE_OPTIC_METHODS.read, [options]);
   }
As per coding guidelines, "Use named constants instead of magic strings or numbers in TypeScript".

Also applies to: 60-60

🤖 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/conformance/fixtures/V17PublicOpticReadPath.ts` around lines 24 - 34,
The code in readNeighborhood and readTraversal uses repeated string-literal
reflective method names ("optic", "neighborhood", "traversal", "read") which
should be centralized into named constants to reduce typos and improve
maintainability; update V17PublicOpticReadPath.ts by defining constants (e.g.,
OPTIC = 'optic', NEIGHBORHOOD = 'neighborhood', TRAVERSAL = 'traversal', READ =
'read') and replace the inline literals in the calls to
invokeObject(this.worldline, 'optic'), invokeObject(optic, 'neighborhood', ...),
invokeObject(optic, 'traversal', ...) and invokePromiseObject(..., 'read', ...)
(also used at line ~60) to use these constants.

Source: Coding guidelines

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

Inline comments:
In `@src/domain/services/optic/CheckpointBasisFact.ts`:
- Around line 12-423: File groups too many peer concepts in one module: split
the transports, base class, concrete fact classes, and validators/helpers into
focused files. Create e.g. CheckpointBasisFact.types.ts
(CheckpointBasisFactTransport, CheckpointFactEventTransport and related
transport unions), CheckpointBasisFact.base.ts (abstract CheckpointBasisFact and
shard-family type), one file per concrete class (CheckpointNodeLivenessFact.ts,
CheckpointNodePropertyFact.ts, CheckpointAdjacencyFact.ts,
CheckpointEdgeFact.ts, CheckpointProvenanceFact.ts,
CheckpointContentAnchorFact.ts) and a helpers file (eventTransport,
eventSortKey, validateDirection, validatePropValue, validateEventId,
validateText, validatePositiveInteger, throwFactError, computeShardKey if
referenced elsewhere); move the constructors/logic into those class files and
export/import the types/helpers as needed, update all import sites to the new
module layout, ensure each file exports only its responsibility, run the
TypeScript compiler and tests to fix any import/export name issues and adjust
exports to preserve the public API (names like CheckpointNodeLivenessFact,
eventTransport, validateEventId, etc.).

In `@src/domain/services/optic/CheckpointBasisManifest.ts`:
- Around line 72-73: The frontier and appliedVersionVector Map fields on
CheckpointBasisManifest remain mutable after construction; make defensive
immutable copies in the constructor (e.g., create new Map(...) instances from
the inputs) and store them as private readonly fields, then expose them only as
ReadonlyMap via getters (or return new Map copies on access) so external callers
cannot mutate internal Map state; apply the same defensive-copying/readonly
exposure pattern for other assignments of frontier and appliedVersionVector in
this class (the other constructor/assignment sites referenced).

In `@src/domain/services/optic/CheckpointPatchFactStream.ts`:
- Around line 133-145: Move creation of the EventId into the try block inside
lowerOperation so EventId construction failures are handled by the stream's
obstruction contract; specifically, inside lowerOperation wrap both new
EventId(...) and the normalizeRawOp/raw op handling in the same try. In the
catch, preserve explicit "unsupported-operation" errors instead of converting
them to a generic malformed-patch: if the caught error is an Error whose message
or name equals "unsupported-operation" (or a known UnsupportedOperationError
class), rethrow it unchanged so callers see the original obstruction reason;
otherwise extract the error message and return malformedOperationFacts(cause) as
before. Ensure callers of normalizeRawOp and factsForOperation still surface
"unsupported-operation" when thrown.

In `@src/domain/services/optic/CheckpointShardFactReader.ts`:
- Around line 154-170: The neighborhoodShardOidMap currently adds all liveness
shards up front (via addShardRoots) which couples neighborhood reads to global
liveness health; change it to a two-phase approach: first only add adjacency and
edge fact roots needed for the requested node (use computeShardKey and
addOptionalShardRoot to add fwd_/rev_ and labels.cbor roots and return early if
none), then inspect the adjacency results to collect the specific node IDs
(source + neighbor IDs) and only then add liveness shard OIDs for those specific
shard keys (use addOptionalShardRoot or an equivalent that adds individual
liveness roots rather than addShardRoots). Apply the same two-phase pattern to
the analogous logic at lines 262-280 so neighborhood reads only load liveness
shards for nodes actually present in the adjacency set.

In `@src/domain/services/optic/CheckpointTailReadIdentityBuilder.ts`:
- Around line 84-89: labelsAspect currently produces non-unique encodings (e.g.,
[] vs ['all-labels'] and labels containing commas), so change labelsAspect to a
collision-safe, deterministic encoder: sort the labels, then encode each label
with an unambiguous escaping or length-prefix (for example prefix each label
with its byte/char length or percent-encode/escape delimiters) and join with a
delimiter that cannot appear unescaped; ensure the empty-array case is distinct
(e.g., explicit marker like "EMPTY" or an empty-length prefix sequence). Update
the function labelsAspect to implement this injective encoding so different
label arrays always produce different strings.

In `@src/domain/services/optic/CheckpointTailTraversalReader.ts`:
- Around line 119-142: The bug is that maybeOpenForNodeLimit re-queues the same
TraversalOpticFrontierEntry (current) when maxNodes is reached, causing resumed
reads to reprocess the same neighborhood slice and livelock; instead, when the
node limit is hit you should advance the frontier past the neighbor that
triggered the limit (do not re-add the identical current). Modify
maybeOpenForNodeLimit so it pushes a new/updated TraversalOpticFrontierEntry
representing continuation after the current neighbor (e.g., with the
neighborhood cursor/position advanced) into state.frontier (or omit re-queuing
current and let maybeOpenForNeighborhoodCursor handle opening the next cursor),
then call openTraversalResult(state); reference functions/types:
maybeOpenForNodeLimit, openTraversalResult, TraversalOpticFrontierEntry,
state.frontier, current, neighborhood.cursor. Ensure the re-queued entry
advances the cursor/index so resumed reads do not revisit the same slice.

In `@src/domain/services/optic/TraversalOptic.ts`:
- Around line 25-31: Add constructor invariants to TraversalOptic: validate that
options.startNodeId is a non-empty string and that options.locator is a valid
CheckpointTailWitnessLocator (e.g., instanceof CheckpointTailWitnessLocator or
has required properties), and throw a descriptive TypeError if validation fails;
perform these checks before assigning to this._startNodeId / this._locator and
before Object.freeze(this) to ensure the object cannot be constructed with
invalid inputs.

In `@test/unit/domain/services/optic/CheckpointPatchFactStream.test.ts`:
- Around line 79-126: Add a new test in CheckpointPatchFactStream.test.ts that
mirrors the existing malformed/coverage cases but injects an operation that
triggers the unsupported-operation path: create a TestPatchFactStreamSource,
setChain with a patchEntry whose ops include an operation type the stream does
not support (e.g., a custom/unknown Node* subclass or a clearly unsupported op
instance), instantiate CheckpointPatchFactStream with that source, call
collectFacts(stream.stream({...})) with the same
previousCheckpoint/targetFrontier setup used in the other tests, and assert the
rejection matches code 'E_CHECKPOINT_PATCH_FACT_STREAM' and context { field:
'patch.ops', reason: 'unsupported-operation' }; reuse helpers like patchEntry,
TestPatchFactStreamSource, collectFacts and the stream() call to keep the test
consistent with the existing ones.

---

Outside diff comments:
In `@src/domain/services/optic/CheckpointBasisManifest.ts`:
- Around line 1-545: The file is too large and mixes multiple domain VOs and
validation/orchestration; split it into smaller modules: extract
CheckpointBasisManifest (with constructor, rootMaps, validateManifestState call)
into its own file, extract each value object class (CheckpointBasisShardRootMap,
CheckpointBasisShardGeometry, CheckpointBasisChunking,
CheckpointBasisCompleteness, CheckpointBasisSupportPosture) into separate files
(one per class), and move related validators/helpers (validateManifestOptions,
manifestRootMaps, nullableManifestRefs, validateShardGeometryObjects,
validateReadingIdentitySeparation, initialByteIdentityValues,
add*IdentityValues, throwManifestError, freezeStringList, copy* helpers,
compareMapEntries, validation primitives like
validateNonEmptyString/validatePositiveInteger/validateNonNegativeInteger/validateSupportedSchema/validateRootFamily/validateCompletenessKind/validatePostureKind/validateFrontier/validateAppliedVersionVector/validateRoots/validateSupportPosture/validateCompleteness/validateShardGeometry/validatePostureShape/validationPostureOrDefault/verificationPostureOrDefault)
into a validators/utilities module; update imports/exports so
CheckpointBasisManifest imports the VO classes and validator functions by name
(e.g., CheckpointBasisShardRootMap, CheckpointBasisShardGeometry,
CheckpointBasisChunking, CheckpointBasisCompleteness,
CheckpointBasisSupportPosture, validateManifestOptions, manifestRootMaps,
nullableManifestRefs, validateManifestState, throwManifestError), preserve
exported CHECKPOINT_BASIS_MANIFEST_SCHEMA and types, and run tests to ensure no
API changes.

---

Nitpick comments:
In `@test/conformance/fixtures/V17PublicOpticReadPath.ts`:
- Around line 24-34: The code in readNeighborhood and readTraversal uses
repeated string-literal reflective method names ("optic", "neighborhood",
"traversal", "read") which should be centralized into named constants to reduce
typos and improve maintainability; update V17PublicOpticReadPath.ts by defining
constants (e.g., OPTIC = 'optic', NEIGHBORHOOD = 'neighborhood', TRAVERSAL =
'traversal', READ = 'read') and replace the inline literals in the calls to
invokeObject(this.worldline, 'optic'), invokeObject(optic, 'neighborhood', ...),
invokeObject(optic, 'traversal', ...) and invokePromiseObject(..., 'read', ...)
(also used at line ~60) to use these constants.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5db830e0-9247-4774-a30d-fb1c120504aa

📥 Commits

Reviewing files that changed from the base of the PR and between 530d9cb and cf9868e.

📒 Files selected for processing (33)
  • AGENTS.md
  • bin/cli/commands/optic.ts
  • bin/cli/commands/registry.ts
  • bin/cli/infrastructure.ts
  • bin/cli/schemas.ts
  • src/domain/services/optic/CheckpointBasisFact.ts
  • src/domain/services/optic/CheckpointBasisManifest.ts
  • src/domain/services/optic/CheckpointPatchFactStream.ts
  • src/domain/services/optic/CheckpointShardFactReader.ts
  • src/domain/services/optic/CheckpointTailBasisLoader.ts
  • src/domain/services/optic/CheckpointTailFactReducer.ts
  • src/domain/services/optic/CheckpointTailReadFailure.ts
  • src/domain/services/optic/CheckpointTailReadIdentityBuilder.ts
  • src/domain/services/optic/CheckpointTailTraversalReader.ts
  • src/domain/services/optic/CheckpointTailWitnessLocator.ts
  • src/domain/services/optic/NeighborhoodOptic.ts
  • src/domain/services/optic/NeighborhoodOpticReadResult.ts
  • src/domain/services/optic/NodeOptic.ts
  • src/domain/services/optic/OpticReadFailureCause.ts
  • src/domain/services/optic/OpticReadTarget.ts
  • src/domain/services/optic/StreamingCheckpointBasisBuilder.ts
  • src/domain/services/optic/TraversalOptic.ts
  • src/domain/services/optic/TraversalOpticReadResult.ts
  • src/domain/services/optic/WorldlineOptic.ts
  • test/conformance/fixtures/V17OpticFailureExpectations.ts
  • test/conformance/fixtures/V17PublicOpticReadPath.ts
  • test/conformance/v18NeighborhoodOpticReadBasis.test.ts
  • test/conformance/v18TraversalOpticReadBasis.test.ts
  • test/unit/cli/optic.test.ts
  • test/unit/domain/services/optic/CheckpointBasisManifest.test.ts
  • test/unit/domain/services/optic/CheckpointPatchFactStream.test.ts
  • test/unit/domain/services/optic/CheckpointShardFactReader.manifest.test.ts
  • test/unit/domain/services/optic/StreamingCheckpointBasisBuilder.test.ts

Comment thread src/domain/services/optic/CheckpointBasisFact.ts Outdated
Comment thread src/domain/services/optic/CheckpointBasisManifest.ts Outdated
Comment thread src/domain/services/optic/CheckpointPatchFactStream.ts
Comment thread src/domain/services/optic/CheckpointShardFactReader.ts
Comment thread src/domain/services/optic/CheckpointTailReadIdentityBuilder.ts
Comment thread src/domain/services/optic/CheckpointTailTraversalReader.ts Outdated
Comment thread src/domain/services/optic/TraversalOptic.ts
Comment thread test/unit/domain/services/optic/CheckpointPatchFactStream.test.ts
@flyingrobots

Copy link
Copy Markdown
Member Author

@codex Code Lawyer activity summary for PR #643.

# Source Severity File Commit Outcome
1 Self-review P1 High src/domain/services/optic/CheckpointTailTraversalReader.ts; test/conformance/v18TraversalOpticReadBasis.test.ts 617405b1 Added deterministic RED regression for node-budget frontier resume and fixed the traversal cursor to resume at the blocked edge instead of replaying emitted edges.
2 CI P1 High package.json; .github/workflows/ci.yml; scripts/release-preflight.sh c52fa635 Fixed coverage-threshold by including V18 optic conformance witness tests in the coverage command without lowering the 92.1% threshold; updated gate wording to match the broadened witness scope.

Verification run locally after fixes:

  • npx vitest run test/conformance/v18TraversalOpticReadBasis.test.ts
  • npm run lint
  • npm run typecheck:src
  • npm run typecheck:test
  • npx vitest run test/conformance/v18NeighborhoodOpticReadBasis.test.ts test/conformance/v18TraversalOpticReadBasis.test.ts test/unit/cli/optic.test.ts test/unit/cli/parseArgs.test.ts test/unit/domain/services/optic/CheckpointBasisManifest.test.ts test/unit/domain/services/optic/StreamingCheckpointBasisBuilder.test.ts test/unit/domain/services/optic/CheckpointPatchFactStream.test.ts
  • npm run test:local
  • npm run test:coverage:ci (92.75% lines against 92.1% threshold)

Current status: pushed to c52fa635; GitHub checks and CodeRabbit are rerunning.

@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown

Release Preflight

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

If you tag this commit as v18.0.0, release workflow will publish.

@flyingrobots

Copy link
Copy Markdown
Member Author

@codex Code Lawyer activity summary after CodeRabbit review threads.

Severity Source File Commit Outcome Evidence
P2 CodeRabbit src/domain/services/optic/CheckpointBasisFact.ts d96437df Split checkpoint fact contracts into concept-focused files with barrel compatibility. npm run lint; npm run typecheck:src; focused optic tests.
P1 CodeRabbit src/domain/services/optic/CheckpointBasisManifest.ts 1ec2619a Manifest frontier/version-vector maps now expose defensive copies. CheckpointBasisManifest.test.ts; focused regression passed.
P1 CodeRabbit src/domain/services/optic/CheckpointPatchFactStream.ts c2a7af9b EventId construction is inside obstruction handling and unsupported operations preserve their reason. CheckpointPatchFactStream.test.ts; focused regression passed.
P1 CodeRabbit src/domain/services/optic/CheckpointShardFactReader.ts 78413d43 Neighborhood reads load source/adjacency first and only relevant liveness shards afterward. CheckpointShardFactReader.manifest.test.ts; focused regression passed.
P1 CodeRabbit src/domain/services/optic/CheckpointTailReadIdentityBuilder.ts b396537f Neighborhood label identity encoding is deterministic and collision-safe. CheckpointTailReadIdentityBuilder.test.ts; focused regression passed.
P2 CodeRabbit src/domain/services/optic/TraversalOptic.ts 880c05d9 Traversal optic constructor now validates start node and locator invariants with typed domain errors. TraversalOptic.test.ts; focused regression passed.
P3 CodeRabbit test/unit/domain/services/optic/CheckpointPatchFactStream.test.ts c2a7af9b Added explicit unsupported-operation obstruction coverage. CheckpointPatchFactStream.test.ts; focused regression passed.

Local validation after fixes:

  • npm run lint
  • npm run typecheck:src
  • npm run typecheck:test
  • npm run test:local ✅ 544 files / 7151 tests
  • npm run test:coverage:ci ✅ 548 files / 7169 tests, 92.82% lines

All seven review threads have been resolved via GraphQL after the fix commits were pushed.

@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown

Release Preflight

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

If you tag this commit as v18.0.0, release workflow will publish.

@flyingrobots flyingrobots merged commit d52cbea into main Jun 6, 2026
17 checks passed
@flyingrobots flyingrobots deleted the checkpoint-basis-streamed-optics branch June 6, 2026 12:29
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