Skip to content

V18 Continuum slices 16-20#96

Merged
flyingrobots merged 6 commits into
mainfrom
v18-continuum-slices-16-20
May 23, 2026
Merged

V18 Continuum slices 16-20#96
flyingrobots merged 6 commits into
mainfrom
v18-continuum-slices-16-20

Conversation

@flyingrobots
Copy link
Copy Markdown
Member

@flyingrobots flyingrobots commented May 23, 2026

Summary

  • Reopens the v18 graph-model runway after PR V18 Continuum slices 11-15 #95 and records slices 17 through 20 in BEARING.
  • Adds runtime-backed node, edge, and attachment record nouns plus deterministic WarpState record projections.
  • Adds a runtime-backed graph-op algebra and deterministic projection over current node, edge, and attachment records.
  • Promotes the completed v18 graph-substrate backlog notes and updates workload counts.

Design Docs

  • docs/design/0164-v18-post-15-graph-model-runway/v18-post-15-graph-model-runway.md
  • docs/design/0165-v18-node-record-identity/v18-node-record-identity.md
  • docs/design/0166-v18-edge-record-identity/v18-edge-record-identity.md
  • docs/design/0167-v18-attachment-plane-substrate/v18-attachment-plane-substrate.md
  • docs/design/0168-v18-graph-op-algebra-convergence/v18-graph-op-algebra-convergence.md

Verification

  • npx vitest run test/unit/domain/graph/GraphOpAlgebra.test.ts test/unit/domain/services/GraphOpAlgebraProjection.test.ts test/unit/domain/index.exports.test.ts --reporter=verbose
  • npm run typecheck
  • npm run lint
  • npm run lint:sludge
  • npm run lint:quarantine-graduate
  • npm run test:local
  • git diff --check origin/main...HEAD
  • Pre-push IRONCLAD M9 gate passed.

Summary by CodeRabbit

  • New Features

    • Deterministic graph record types and read APIs for nodes, edges, and attachments
    • Graph-operation algebra and a projection to materialize explicit record-based graph operations
    • Expanded public exports to surface the new graph substrate primitives
  • Bug Fixes

    • Fixed node identity/equality behavior and attachment projection edge cases to improve correctness and stability
  • Documentation

    • Updated V18 roadmap, planning slices 16–20, and added multiple design docs for graph-model convergence

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c9e5ef50-1456-4c8f-9e18-ed5d5d3e74e1

📥 Commits

Reviewing files that changed from the base of the PR and between e315590 and ddef0d0.

📒 Files selected for processing (9)
  • CHANGELOG.md
  • index.ts
  • src/domain/graph/NodeId.ts
  • src/domain/graph/publicGraphSubstrate.ts
  • src/domain/services/state/WarpState.ts
  • test/unit/domain/graph/AttachmentRecord.test.ts
  • test/unit/domain/graph/EdgeRecord.test.ts
  • test/unit/domain/graph/GraphOpAlgebra.test.ts
  • test/unit/domain/graph/NodeRecord.test.ts
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md

📝 Walkthrough

Walkthrough

This PR implements the V18 graph-model substrate layer (slices 17–20), introducing runtime-backed node, edge, and attachment record types; immutable graph operation classes and algebra; deterministic WarpState read surface for record materialization; and a projection service. Comprehensive tests and documentation accompany the implementation.

Changes

V18 Graph-Model Substrate Convergence

Layer / File(s) Summary
Graph substrate identity types: NodeId, EdgeId, AttachmentKey and type identifiers
src/domain/graph/NodeId.ts, src/domain/graph/NodeTypeId.ts, src/domain/graph/EdgeId.ts, src/domain/graph/EdgeTypeId.ts, src/domain/graph/AttachmentKey.ts, src/domain/graph/AttachmentSchemaVersion.ts, test/unit/domain/graph/NodeRecord.test.ts, test/unit/domain/graph/EdgeRecord.test.ts, test/unit/domain/graph/AttachmentRecord.test.ts
Immutable value objects for graph entity identifiers with runtime validation, freezing, and value-based equality. Each type validates non-empty strings without NUL bytes; AttachmentSchemaVersion additionally enforces positive integer values.
Graph substrate records: NodeRecord, EdgeRecord, AttachmentRecord
src/domain/graph/NodeRecord.ts, src/domain/graph/EdgeRecord.ts, src/domain/graph/AttachmentRecord.ts, test/unit/domain/graph/NodeRecord.test.ts, test/unit/domain/graph/EdgeRecord.test.ts, test/unit/domain/graph/AttachmentRecord.test.ts
Immutable record envelopes that compose identity types into complete substrate entities. NodeRecord wraps id and typeId with legacy factory; EdgeRecord includes endpoint nodes and deterministic legacy id generation; AttachmentRecord encapsulates owner, key, value, schema version with ownership predicates.
Graph operation types and union
src/domain/graph/GraphNodeRecordSetOp.ts, src/domain/graph/GraphEdgeRecordSetOp.ts, src/domain/graph/GraphAttachmentSetOp.ts, src/domain/graph/GraphOperation.ts, test/unit/domain/graph/GraphOpAlgebra.test.ts
Operation classes wrap validated substrate records with operation type constants. GraphNodeRecordSetOp, GraphEdgeRecordSetOp, and GraphAttachmentSetOp each validate record types and freeze instances; GraphOperation provides union type of all three.
GraphOpAlgebra: immutable wrapper for operation sequences
src/domain/graph/GraphOpAlgebra.ts, test/unit/domain/graph/GraphOpAlgebra.test.ts
GraphOpAlgebra wraps an ordered sequence of graph operations with validation enforcing array type and supported operation kinds, freezing both operations array and instance.
WarpState record read APIs
src/domain/services/state/WarpState.ts, test/unit/domain/services/state/WarpState.nodeRecords.test.ts, test/unit/domain/services/state/WarpState.edgeRecords.test.ts, test/unit/domain/services/state/WarpState.attachmentRecords.test.ts
New public methods materialize node, edge, and attachment records with visibility filtering and deterministic ordering. Node records iterate nodeAlive OR-Set; edge records additionally filter for endpoint presence; attachment records decode prop map with staleness filtering for edge properties by event-id comparison.
GraphOpAlgebraProjection service
src/domain/services/GraphOpAlgebraProjection.ts, test/unit/domain/services/GraphOpAlgebraProjection.test.ts
Service that validates WarpState input and builds an operation algebra by iterating node, edge, and attachment records in order, wrapping each in corresponding record-set operation, and returning frozen GraphOpAlgebra.
Package exports
index.ts, src/domain/graph/publicGraphSubstrate.ts, test/unit/domain/index.exports.test.ts
Barrel and index updates export the new graph substrate nouns, operation/algebra types, and the GraphOpAlgebraProjection service from the package entrypoint; tests assert the presence of these exports.
Design documentation and planning
CHANGELOG.md, docs/BEARING.md, docs/design/0164-v18-post-15-graph-model-runway/v18-post-15-graph-model-runway.md, docs/design/0165-v18-node-record-identity/v18-node-record-identity.md, docs/design/0166-v18-edge-record-identity/v18-edge-record-identity.md, docs/design/0167-v18-attachment-plane-substrate/v18-attachment-plane-substrate.md, docs/design/0168-v18-graph-op-algebra-convergence/v18-graph-op-algebra-convergence.md, docs/method/backlog/WORKLOADS.md, docs/method/backlog/v18.0.0/README.md, deleted: docs/method/backlog/v18.0.0/PROTO_attachment-plane-substrate.md, PROTO_echo-shaped-node-records.md, PROTO_echo-shaped-edge-records.md, PROTO_graph-op-algebra-convergence.md
BEARING roadmap advances to v18-continuum-slices-16-20; design slices 0164–0168 document post-PR-95 runway, node/edge record identity, attachment-plane substrate, and graph-op algebra convergence with verification and scorecard guidance; backlog and WORKLOADS updated to reflect completed shape-cut work and in-progress algebra convergence.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐇 Frolic, little records, frozen in line,

Nodes, edges, attachments — deterministic, fine.
From WarpState we project an algebra neat,
Hops of validation make the substrate complete.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'V18 Continuum slices 16-20' is directly related to the main change: reopening the v18 graph-model runway and implementing slices 16-20 with node/edge/attachment records and graph-op algebra.
Description check ✅ Passed The PR description provides a clear summary of changes (runtime-backed records, projections, algebra) with design doc references and comprehensive verification steps, though it omits the optional ADR checks section from the template.
Docstring Coverage ✅ Passed Docstring coverage is 93.02% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch v18-continuum-slices-16-20

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

❤️ Share

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

@github-actions
Copy link
Copy Markdown

Release Preflight

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

If you tag this commit as v17.0.1, release workflow will publish.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 7

🧹 Nitpick comments (1)
test/unit/domain/graph/GraphOpAlgebra.test.ts (1)

7-9: ⚡ Quick win

Replace literal op-name assertions with exported constants.

These string literals make the test brittle and violate the no-magic-strings rule; assert against the exported constants instead.

Proposed patch
 import GraphAttachmentSetOp from '../../../../src/domain/graph/GraphAttachmentSetOp.ts';
 import GraphEdgeRecordSetOp from '../../../../src/domain/graph/GraphEdgeRecordSetOp.ts';
 import GraphNodeRecordSetOp from '../../../../src/domain/graph/GraphNodeRecordSetOp.ts';
+import { GRAPH_ATTACHMENT_SET_OP } from '../../../../src/domain/graph/GraphAttachmentSetOp.ts';
+import { GRAPH_EDGE_RECORD_SET_OP } from '../../../../src/domain/graph/GraphEdgeRecordSetOp.ts';
+import { GRAPH_NODE_RECORD_SET_OP } from '../../../../src/domain/graph/GraphNodeRecordSetOp.ts';
 import GraphOpAlgebra from '../../../../src/domain/graph/GraphOpAlgebra.ts';
@@
     expect(algebra.operations.map((operation) => operation.type)).toEqual([
-      'GraphNodeRecordSet',
-      'GraphEdgeRecordSet',
-      'GraphAttachmentSet',
+      GRAPH_NODE_RECORD_SET_OP,
+      GRAPH_EDGE_RECORD_SET_OP,
+      GRAPH_ATTACHMENT_SET_OP,
     ]);

As per coding guidelines: **/*.{ts,tsx}: Avoid magic strings and numbers; use named constants instead.

Also applies to: 29-33

🤖 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/graph/GraphOpAlgebra.test.ts` around lines 7 - 9, The tests
currently assert against literal op-name strings — update the assertions to use
the exported op name constants from the corresponding modules instead: import
and use the exported constant(s) from GraphAttachmentSetOp,
GraphEdgeRecordSetOp, and GraphNodeRecordSetOp (e.g., the exported OP_NAME or
similar constant defined in each file) wherever the test checks op names
(including the other occurrences around lines 29-33) so the tests reference the
module constants rather than hard-coded strings.
🤖 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 `@index.ts`:
- Around line 308-321: index.ts has grown past the 500 LOC limit due to a large
flat export list (e.g., AttachmentKey, AttachmentRecord,
AttachmentSchemaVersion, EdgeId, EdgeRecord, EdgeTypeId, GraphAttachmentSetOp,
GraphEdgeRecordSetOp, GraphNodeRecordSetOp, GraphOpAlgebra,
GraphOpAlgebraProjection, NodeId, NodeRecord, NodeTypeId). Split the surface by
moving related export groups into narrower barrel modules (for example create a
new graph-types.ts or attachments.ts that export Attachment*, Edge*, Node* and
Graph* symbols), update index.ts to re-export those barrels (export * from
'./graph-types') instead of listing every symbol, and remove the expanded list
from index.ts so it falls back under the 500 LOC policy; ensure all original
symbol names (AttachmentKey, EdgeRecord, GraphOpAlgebraProjection, NodeTypeId,
etc.) are re-exported from the new barrels so existing imports keep working.

In `@src/domain/graph/NodeId.ts`:
- Around line 21-22: The equals method in NodeId (equals(other: NodeId):
boolean) must be made total by returning false for null/undefined or non-NodeId
inputs; update the function to first check that other is an instance of NodeId
(or at least truthy and has a compatible value shape) and return false if not,
then compare this.value === other.value; mirror the same guard pattern used by
the sibling identifier/value classes to keep behavior consistent.

In `@src/domain/services/state/WarpState.ts`:
- Around line 100-107: getEdgeRecord currently calls edgeRecords() each time
which rebuilds/sorts the full projection and causes N^2 behavior during
attachmentRecords materialization; fix by creating a single lookup map from
EdgeId to EdgeRecord (e.g. build a Map once from this.edgeRecords()) and use
that map instead of repeatedly calling edgeRecords() — either (a) change
attachmentRecords to build the map once and call a new helper/getEdgeRecord
overload that accepts the map, or (b) add a short-lived cachedEdgeMap property
computed before materialization and have getEdgeRecord consult it; update
references to getEdgeRecord/attachmentRecords/WarpState to use the map-based
lookup so the full projection is not rebuilt per edge property.

In `@test/unit/domain/graph/AttachmentRecord.test.ts`:
- Around line 33-65: Add tests that exercise the constructor guard branches of
AttachmentRecord by asserting it throws on invalid inputs: create cases that
pass a null/undefined owner, a non-AttachmentKey key, missing value, and an
invalid schema version to the AttachmentRecord constructor and expect errors;
reference the AttachmentRecord constructor (and helpers
NodeRecord.fromLegacyNodeId, EdgeRecord.fromLegacyEdge, AttachmentKey,
AttachmentSchemaVersion) to locate where to instantiate invalid payloads and use
expect(...).toThrow() (or the async equivalent) for each failure mode so the
negative paths are covered.

In `@test/unit/domain/graph/EdgeRecord.test.ts`:
- Around line 33-49: Add negative-path unit tests that exercise EdgeRecord's
validation branches: call EdgeRecord.fromLegacyEdge and the EdgeRecord
constructor with missing/invalid inputs to trigger requireFields, requireEdgeId,
requireNodeId, and requireEdgeTypeId, asserting they throw the expected errors;
specifically include cases like missing "from"/"to"/"label", invalid edge id
strings passed to requireEdgeId, and invalid node/type ids for
requireNodeId/requireEdgeTypeId, and verify the factory still returns a frozen
instance on success (EdgeRecord.fromLegacyEdge, EdgeRecord constructor,
requireFields, requireEdgeId, requireNodeId, requireEdgeTypeId).

In `@test/unit/domain/graph/GraphOpAlgebra.test.ts`:
- Around line 41-58: Add tests that validate boundary cases for the touched
constructors: assert that GraphNodeRecordSetOp, GraphEdgeRecordSetOp, and
GraphAttachmentSetOp throw when passed null or undefined as their
record/envelope, and assert that GraphOpAlgebra throws when constructed with
null/undefined or with an operations field that is not an array (e.g., a string
or object). Reference the constructors GraphNodeRecordSetOp,
GraphEdgeRecordSetOp, GraphAttachmentSetOp, and GraphOpAlgebra in the new test
cases and use the same toThrow checks (matching error messages like
/NodeRecord/, /EdgeRecord/, /AttachmentRecord/, /graph operation/) to ensure the
null/undefined and non-array paths are covered.

In `@test/unit/domain/graph/NodeRecord.test.ts`:
- Line 5: Replace the hardcoded default type string in the NodeRecord tests with
the exported constant from NodeTypeId: import and use the exported default-type
constant from NodeTypeId (instead of the literal) in the assertions in
NodeRecord.test.ts where the default type is currently asserted (both
occurrences), so the tests reference NodeTypeId's exported default constant
rather than a magic string.

---

Nitpick comments:
In `@test/unit/domain/graph/GraphOpAlgebra.test.ts`:
- Around line 7-9: The tests currently assert against literal op-name strings —
update the assertions to use the exported op name constants from the
corresponding modules instead: import and use the exported constant(s) from
GraphAttachmentSetOp, GraphEdgeRecordSetOp, and GraphNodeRecordSetOp (e.g., the
exported OP_NAME or similar constant defined in each file) wherever the test
checks op names (including the other occurrences around lines 29-33) so the
tests reference the module constants rather than hard-coded strings.
🪄 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: 362dc157-604c-4b1a-98c0-4a8fd9fb2989

📥 Commits

Reviewing files that changed from the base of the PR and between c848f5d and e315590.

📒 Files selected for processing (39)
  • CHANGELOG.md
  • docs/BEARING.md
  • docs/design/0164-v18-post-15-graph-model-runway/v18-post-15-graph-model-runway.md
  • docs/design/0165-v18-node-record-identity/v18-node-record-identity.md
  • docs/design/0166-v18-edge-record-identity/v18-edge-record-identity.md
  • docs/design/0167-v18-attachment-plane-substrate/v18-attachment-plane-substrate.md
  • docs/design/0168-v18-graph-op-algebra-convergence/v18-graph-op-algebra-convergence.md
  • docs/method/backlog/WORKLOADS.md
  • docs/method/backlog/v18.0.0/PROTO_attachment-plane-substrate.md
  • docs/method/backlog/v18.0.0/PROTO_echo-shaped-edge-records.md
  • docs/method/backlog/v18.0.0/PROTO_echo-shaped-node-records.md
  • docs/method/backlog/v18.0.0/PROTO_graph-op-algebra-convergence.md
  • docs/method/backlog/v18.0.0/README.md
  • index.ts
  • src/domain/graph/AttachmentKey.ts
  • src/domain/graph/AttachmentRecord.ts
  • src/domain/graph/AttachmentSchemaVersion.ts
  • src/domain/graph/EdgeId.ts
  • src/domain/graph/EdgeRecord.ts
  • src/domain/graph/EdgeTypeId.ts
  • src/domain/graph/GraphAttachmentSetOp.ts
  • src/domain/graph/GraphEdgeRecordSetOp.ts
  • src/domain/graph/GraphNodeRecordSetOp.ts
  • src/domain/graph/GraphOpAlgebra.ts
  • src/domain/graph/GraphOperation.ts
  • src/domain/graph/NodeId.ts
  • src/domain/graph/NodeRecord.ts
  • src/domain/graph/NodeTypeId.ts
  • src/domain/services/GraphOpAlgebraProjection.ts
  • src/domain/services/state/WarpState.ts
  • test/unit/domain/graph/AttachmentRecord.test.ts
  • test/unit/domain/graph/EdgeRecord.test.ts
  • test/unit/domain/graph/GraphOpAlgebra.test.ts
  • test/unit/domain/graph/NodeRecord.test.ts
  • test/unit/domain/index.exports.test.ts
  • test/unit/domain/services/GraphOpAlgebraProjection.test.ts
  • test/unit/domain/services/state/WarpState.attachmentRecords.test.ts
  • test/unit/domain/services/state/WarpState.edgeRecords.test.ts
  • test/unit/domain/services/state/WarpState.nodeRecords.test.ts
💤 Files with no reviewable changes (4)
  • docs/method/backlog/v18.0.0/PROTO_echo-shaped-node-records.md
  • docs/method/backlog/v18.0.0/PROTO_echo-shaped-edge-records.md
  • docs/method/backlog/v18.0.0/PROTO_graph-op-algebra-convergence.md
  • docs/method/backlog/v18.0.0/PROTO_attachment-plane-substrate.md

Comment thread index.ts Outdated
Comment thread src/domain/graph/NodeId.ts Outdated
Comment thread src/domain/services/state/WarpState.ts
Comment thread test/unit/domain/graph/AttachmentRecord.test.ts
Comment thread test/unit/domain/graph/EdgeRecord.test.ts
Comment thread test/unit/domain/graph/GraphOpAlgebra.test.ts
Comment thread test/unit/domain/graph/NodeRecord.test.ts Outdated
@github-actions
Copy link
Copy Markdown

Release Preflight

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

If you tag this commit as v17.0.1, release workflow will publish.

@flyingrobots flyingrobots merged commit 080a60e into main May 23, 2026
9 checks passed
@flyingrobots flyingrobots deleted the v18-continuum-slices-16-20 branch May 23, 2026 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant