Skip to content

Add immutable edge table (index-only, append + scan) - #434

Merged
em3s merged 9 commits into
mainfrom
feat/issue-433-immutable-edge
Jul 20, 2026
Merged

em3s merged 9 commits into
mainfrom
feat/issue-433-immutable-edge

Conversation

@em3s

@em3s em3s commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add a new immutable edge table kind — index-only, no edge State. Append-oriented, read-via-scan. Maps to the existing LabelType.IMMUTABLE_INDEXED. First cut supports Index + Group only (no Count, no Cache); scan-and-delete is deferred to a follow-up. Needed as the storage primitive for queue/v1 (#428).

Builds on the KeyBased strategy refactor (#435) and pairs with the bulk-encoder fix (#436).

Closes #433

Changes

  • Thread ImmutableEdge through the v3 sealed hierarchies (ModelSchema, TableDescriptor, V3TableDescriptor, EdgeMutationStrategy as a KeyBased object), placed right after Edge.
  • Mutation emits index (+group) records only: skip the state Put, short-circuit read to initial (append-only), reject gets and the total scan feature.
  • Append-only enforcement: non-INSERT mutations (UPDATE/DELETE) fail fast with a clear error instead of being silently ignored.
  • Materialize IMMUTABLE_INDEXED through the existing INDEXED HBase label path; all immutable behavior lives in v3.
  • Accept ImmutableEdge in the append event path and the create/update API + V3MetadataConverter round-trip.

How to Test

  • ./gradlew build — full build incl. unit + HBase mini-cluster tests.
  • ./gradlew :engine:test --tests "*ImmutableEdgeSpec" — append → scan reads edges from index rows only, point get / non-INSERT rejected, count suppressed (HBase mini-cluster).
  • ./gradlew :server:test --tests "*ImmutableEdgeE2ETest" — full HTTP surface: create → append → scan; point get and non-INSERT return 400 (in-memory datastore backend).
  • ./gradlew :core:test --tests "*EdgeMutationBuilderTest" --tests "*EdgeSchemaSerializationTest" — builder emits index+group only; schema round-trips under the immutableEdge discriminator.

AI Assistance

  • This PR was written largely with AI assistance.
    • Tool / model: Claude Code

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. enhancement New feature or request labels Jul 20, 2026
@em3s
em3s marked this pull request as draft July 20, 2026 07:41
@em3s em3s assigned em3s and unassigned em3s Jul 20, 2026
@em3s
em3s marked this pull request as ready for review July 20, 2026 10:29
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Jul 20, 2026
@em3s
em3s force-pushed the feat/issue-433-immutable-edge branch from 18e87a0 to c4faf71 Compare July 20, 2026 10:42
em3s and others added 8 commits July 20, 2026 19:44
Empty commit to open the PR for #433.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…ilder (#433)

ImmutableEdge is structurally an Edge minus caches; the builder emits index
(+group) records only and suppresses count records.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
… and API (#433)

- V3TableDescriptor.create + LabelEntity materialize route IMMUTABLE_INDEXED
  through the INDEXED HBase label path (v3-only behavior).
- V2BackedTableBinding: skip state Put, short-circuit read to initial, reject
  gets, and implement scanAndDelete deriving deletes from scanned index rows.
- TableBinding gains a default-rejecting scanAndDelete.
- Create/update API + V3MetadataConverter round-trip ImmutableEdge.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…ests

- Descope scan-and-delete out of #433 (removed the binding op + interface default).
- Reject the `total` scan feature on immutable tables (no count records → would report 0).
- Accept ImmutableEdge in the append event path (EdgeBulkMutationRequest.createEvent).
- Place ImmutableEdge right after Edge across the parallel hierarchies (similar code adjacent).
- Trim comments to one-liners.
- Add ImmutableEdgeSpec on the HBase mini-cluster: append -> scan (index-only, no State),
  point get rejected, count suppressed.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Immutable edges are append-only; a DELETE/UPDATE mutation now fails fast with a
clear error instead of being silently ignored. Covered by ImmutableEdgeSpec.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…on-INSERT rejected)

Runs against the in-memory datastore backend; DatastoreIndexedLabel reuses the
same V2BackedTableBinding as HBase, so the full HTTP surface is exercised.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…both rejected

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@em3s
em3s force-pushed the feat/issue-433-immutable-edge branch from c4faf71 to 9dfc424 Compare July 20, 2026 10:45
@em3s
em3s force-pushed the feat/issue-433-immutable-edge branch from 9dfc424 to 8fda6a1 Compare July 20, 2026 10:51
@em3s em3s changed the title Add immutable edge table (index-only, scan / scan-delete) Add immutable edge table (index-only, append + scan) Jul 20, 2026
Run spotlessApply to reorder imports and satisfy spotlessKotlinCheck.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@em3s

em3s commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Known limitation for future reference (not a blocker):

Immutable edge tables lose group-count idempotency. Because read() returns State.initial unconditionally, there's no state-transition dedup, so a retried/duplicated INSERT increments COUNT groups every time. Index rows stay idempotent; only group counts drift. Low impact today (append-only tables rarely use COUNT groups), and every fix is a trade-off — leaving it documented here.

@em3s
em3s merged commit ab476f0 into main Jul 20, 2026
2 checks passed
@em3s
em3s deleted the feat/issue-433-immutable-edge branch July 20, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add immutable edge table (index-only, scan / scan-delete)

1 participant