Skip to content

feat(replication): LOCAL_ONLY record-metadata flag for non-replicating writes - #1239

Merged
kriszyp merged 1 commit into
mainfrom
kris/local-only-replication-flag-core
Jun 11, 2026
Merged

feat(replication): LOCAL_ONLY record-metadata flag for non-replicating writes#1239
kriszyp merged 1 commit into
mainfrom
kris/local-only-replication-flag-core

Conversation

@kriszyp

@kriszyp kriszyp commented Jun 10, 2026

Copy link
Copy Markdown
Member

Summary

Adds a generic record-metadata bit — LOCAL_ONLY = 0x8000 (resources/auditStore.ts) — that marks a write as node-local: persisted here, never forwarded to replication peers. Internal primitive (no public put/patch surface yet — see Notes); used by harper-pro to fix the v4→v5 bridge leak (harper-pro#246).

How it works

  • RecordEncoder.recordUpdater: on the internal localOnly write option, sets the bit on both the persisted record metadata header (metadataInNextEncoding) and the audit entry's extendedType.
  • Table.ts: threads localOnly from the write options into recordUpdater.
  • The replication send path skips LOCAL_ONLY records via a pure bitmask test on the already-available metadataFlags / extendedType integer — no record value decode is added to the throughput-critical send path (the harper-pro side does the skipping; this PR just defines + sets the bit).

What to check

  • Bit choice 0x8000 (bit 15): confirmed unused in the record-metadata bitmap and the audit extendedType space (tops out at 0x4000; framing is 0xc0000000), sits below the action byte, and round-trips through the always-32-bit metadata encode/decode. Verified by review against auditStore.ts + RecordEncoder.ts.
  • Both bits are set together unconditionally — no path sets only one (which would leak via the unset channel).
  • Deep-reviewed (data-integrity + concurrency): the bit persists and round-trips; no decode added.

Notes

LOCAL_ONLY is intentionally internal-only for now. A public API (per-write option and/or table-level config) is deferred to a planned residency-scoped metadata visibility feature, where this becomes the residency = {self} case. Tracked in the harper-pro follow-up issue.

🤖 Generated with Claude Opus 4.7 (implementation by Claude Sonnet 4.6).

…ating writes

Adds a generic record-metadata bit (LOCAL_ONLY = 0x8000, bit 15, confirmed
unused in the metadata bitmap and audit extendedType space) that marks a write
as local-only: persisted on this node but never forwarded to replication peers.
The flag rides the record metadata header AND the audit entry's extendedType so
the replication send path can skip it via a pure bitmask test on the already-
available metadataFlags/extendedType integer — no record value decode is added
to the throughput-critical send path.

Threaded from a per-write `localOnly` option through recordUpdater into the
encoder. Supports the v4->v5 bridge fix in harper-pro #246.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@claude

claude Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Reviewed; no blockers found.

@kriszyp
kriszyp merged commit c74ba26 into main Jun 11, 2026
46 of 47 checks passed
@kriszyp
kriszyp deleted the kris/local-only-replication-flag-core branch June 11, 2026 15:10
@kriszyp

kriszyp commented Jun 11, 2026

Copy link
Copy Markdown
Member Author

(there was a harper-pro approval)

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