Skip to content

Add single-key compare-and-swap by MVCC version - #1535

Draft
bootjp wants to merge 65 commits into
mainfrom
design/single-key-mvcc-cas
Draft

bootjp wants to merge 65 commits into
mainfrom
design/single-key-mvcc-cas

Conversation

@bootjp

@bootjp bootjp commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Design: docs/design/2026_11_20_proposed_single_key_mvcc_cas.md

Current Decision

Performance adoption remains deferred. Version CAS is disabled by default.
Current source/review/CI target: f82cbac3eb82e47f7965dcc1aa32ffdb1835082e.
Do not merge or enable on review, CI, diagnostics or partial windows alone.

The original R10 adoption trial FAILED both cells: its first Fresh measurement
had 2,309 UNKNOWNs at primary 217/s and 684 at hot 105/s. Neither reached a CAS
comparison. R11 was a retained-process diagnostic, not an adoption retry:
25,957 successes and 83 UNKNOWNs at primary 217/s. Backlog preceded the first
UNKNOWN. Sync accounting was complete on the leader and one follower but
incomplete on the other. These observations do not prove every hot outcome's cause.

R12 never ran calibration or measurement: its whole-suite prerequisite exposed
test-fixture issues. It was collected as setup-only, and all four VMs, disks
across eight hosts, watchdog and ephemeral SSH/TLS keys were deleted and verified.
R13 was also SETUP ONLY: its initial natural n2 leader did not match its fixed
n1 endpoint, so launch admission stopped before calibration. No serving reset
or forced transfer was attempted. All four VMs, disks, watchdog and ephemeral
keys were collected/deleted and verified. R14 is registered before allocation
and independently reviewed: bind the first ready natural leader, pin it for
both cells, and reject any later identity change. Check the bound identity
before/after each cell; no cross-hardware absolute-rate equivalence is claimed.
R14 retains the original independent primary/hot calibration,
ten alternating pairs, 30s warmup, 120s measurement, eight workers, 1 KiB values,
four attempts and 1s scheduled-arrival deadline. Zero UNKNOWNs, original paired
p99/goodput thresholds, final heads and history checks remain mandatory.
R14 FAILED primary at the fourth pair's Fresh measurement: 22,362 successes,
1,397 UNKNOWNs, 1,401 deadline misses, zero unsent, and p99 925.591152 ms
at the frozen 198/s rate. The following 30s all-voter drain timed out, stopping
the campaign; hot was NOT RUN. The preceding three complete pairs and fourth
CAS window do not establish adoption. Original evidence was frozen before
profiling. One explicitly ineligible, intrusively profiled diagnostic at 198/s
completed one pair without UNKNOWNs; it is neither a reproduction nor a pass.
All R14 VMs, disks across eight hosts, watchdog and ephemeral keys were deleted
and independently verified after collection. Earlier failures remain failures.

An additional separately committed design bounds synchronous Raft catch-up
refill to max(8 MiB, effective message target) without changing per-operation
session/native admission, WAL sync, apply or ACK order. The candidate is pushed
with faithful recovery regression checks. This candidate does
not claim a total heap/dispatch-queue bound or resolution of every hot UNKNOWN.
It requires fresh final-HEAD review, CI and the unchanged full performance gate.
R15 is prepared before allocation with the same original criteria and the
accepted natural-leader binding protocol. No R15 performance verdict exists.

Changes

  • Bound synchronous per-peer inflight refill with upstream byte flow control,
    retaining async's independent 128 MiB window, all message-count/queue limits,
    individual admission, failure feedback and durable ACK order. Custom targets
    retain opening semantics and legal oversize entries retain progress.
  • Add protected three-node real-worker Save-held/response-held/no-fault tests,
    per-member committed-catalog recovery and exact selected-ACK attribution.
    Corrupt equal-version/missing catalogs and revoked selected ACKs fail closed.
    Test callers cancel, unblock and join before fixture resources close.
  • Add opt-in versioned point reads and single-key MVCC CAS, preserving UNKNOWN
    outcomes and final replicated FSM validation.
  • Replicate logical retirement before physical cleanup; preserve timestamps,
    TTL, tombstones, adoption identity, ownership return and snapshot recovery.
  • Add adaptive mismatch confirmation and bounded protected proposal/read/follower
    turns with per-operation admission and unchanged WAL sync, apply and ACK.
  • Pin immutable owned Pebble views on synchronous file-backed Raft and materialize
    them on the snapshot worker. Preserve ordinary Snapshot, TSO and async paths,
    source-index fences, durable publication ordering and WAL retention.
  • Use stable lifecycle locks and join outstanding ownership on restore/shutdown.
    Omit only private owned-export scratch SST sync, retaining final snapshot
    file/directory sync, source fence and durable Raft publication.
  • Suppress obsolete data-Append failure feedback only when current same-term
    acknowledged Match covers the entire validated original range. Actual failure
    counters, invalid/empty/partial/old-term/snapshot fallback and queued data remain.
  • Share bounded follower WAL Saves for already-waiting read-dependent Fresh1PC
    PUTs as well as existing CAS. Pin cutover and retain message/entry/byte, FIFO,
    priority, control, commit, term, configuration and generation boundaries.
    Classification adds no authority, re-encoding or shared FSM/Pebble commit.
  • Integrate current main's learner snapshot pacing/cancellation with owned
    snapshot retirement. Close the original capture exactly once. Retry catch-up
    payload write failures, but keep final fsync/rename/directory durability and
    joined source-Close failures fatal before Raft publication or WAL release.
  • Preserve an isolated typed/marked data-group ReadIndex transfer rejection
    through the floor boundary without exposing other causes or changing
    watermark RPC status. Project it to floor-only at TSO term initialization
    so it cannot enable a new reservation retry. The real Redis target/proxy
    returns one terminal EXEC error rather than fabricating per-command slots.
  • Keep pending EXEC/list/XADD reuse allocation failures UNKNOWN, with original
    attempt timestamps/write sets unchanged and no new mutation dispatch.
  • Repair learner tests to wait for the returned configuration index in Status.
    Permit only bounded preflight-fixture recovery from an unchanged checkpoint,
    requiring an identical page replay and next-tick progress. Production guards,
    timeouts and unsupported-member assertions remain unchanged.

Authority and Operations

No positive authority cache, early ACK, skipped per-message session admission,
or UNKNOWN-to-mismatch conversion is introduced. Protected ACKs need the actual
current receipt and native generation before advancing Match. Local transport
feedback does not grant peer authority.

Store locks live at <DB-parent>/.elastickv-store-locks/<DB-basename>, including
when CAS is disabled. Parent-directory write permission or an appropriately
pre-provisioned lock directory is required. Never unlink active anchors. Use
matching builds throughout experimental membership; do not overlap older feature
builds against the same store.

Verification

  • Final-push review request for f82cbac:
    Add single-key compare-and-swap by MVCC version #1535 (comment)
    Current review/CI and 300s CAS/ZSet stress are pending:
    https://github.com/bootjp/elastickv/actions/runs/47216735678
    The old e934 review/CI/stress links below are historical evidence only, not
    approval or CI coverage of the new HEAD.
  • The first a799 candidate passed normal/security review and CAS/ZSet stress,
    but its Go CI FAILED the raw read sequence and new maximum-value case. Those
    failures are retained. The read test now retries only the exact lost-read-fence
    status, without changing mutation replay. A real RawGet server-to-TCP-client
    control went RED first; terminal status/detail and cancellation controls passed.
    Both original 9999-iteration raw/transaction sequences passed twice under race.
    The new unchanged 64 MiB test is now in the existing isolated native step,
    with explicit verbose success required. No payload, deadline or assertion was
    reduced; the normal shard script is unchanged. All 71 packages, five shards,
    both native steps and aggregate still require fresh final-HEAD success.
  • Final parent-side targeted race passed 70 distinct tests twice across the
    engine/server packages, zero skips/failures/race reports. Full-repository
    lint and production import-direction checks passed. The hook also passed.
    Independent source review resolved catalog/ACK-observation blockers; a final
    teardown control reproduced the remaining early-return join gap, now fixed.
  • The controlled old zero-window overlay (identical observation wiring) emitted
    12,593,047 payload bytes in 13 messages before the healthy ACK. The candidate
    emitted 8,854,413 in 9, below 8 MiB plus its largest message (9,372,438 total).
    Every selected live healthy ACK advanced Match and commit 132 -> 133; a real
    revoked receipt left both at 132. A legal exact 64 MiB protected wire envelope
    and its following entry replicated, as did the 16 MiB custom message target.
    Async's 128 MiB boundary and explicit unlimited sync opening remain.
    These are work-bound/safety controls, not original performance acceptance.
  • The earlier 384 x 32 KiB fixture missed its five-second follower drain in
    four race schedules. The maintained 128 x 96 KiB fixture preserves the same
    12 MiB suffix and five-second waits while reducing individual applies.
    The earlier failures remain adverse throughput evidence, not erased passes.

Historical e934 Verification

  • Latest pushed-HEAD review request:
    Add single-key compare-and-swap by MVCC version #1535 (comment)
  • Latest 300s CAS/ZSet stress:
    https://github.com/bootjp/elastickv/actions/runs/47176275031
    Both jobs passed. CAS: 1014 successes, 1013 chained successes, 974 reads after
    ACK, 988 rejected reuses, no errors, linearizable/valid. Its 27 indeterminate
    operations under fault stress are not a normal-operation performance pass.
    ZSet: 539 reads, 918 mutations, zero errors, linearizable/valid.
  • Exact-HEAD normal review passed:
    Add single-key compare-and-swap by MVCC version #1535 (comment)
    Security review passed:
    Add single-key compare-and-swap by MVCC version #1535 (comment)
    Latest four-channel check found no current-HEAD findings, no failed/pending
    checks and a clean merge state. Performance adoption remains a separate gate.
  • Whole-Go coverage was verified from the exact-HEAD Linux CI race suite:
    all five shards, their aggregate, both additional native large-value steps,
    and actual successful summaries for all 71 test-bearing packages. This is
    explicitly CI-shard provenance, not a claimed local single-command pass:
    https://github.com/bootjp/elastickv/actions/runs/47176140137
    The earlier 9a local run failed its snapshot expectation with 70 packages
    passing; add58 CI failures remain recorded, not waived or counted as passes.
  • Full-repository lint reports zero issues. Local snapshot/learner/Append
    integration: all 62 selected tests passed three times normally and with race,
    zero skips, including the two real TCP cases. Additional dispatch/helper
    extraction coverage passed race three times. GC disk fixtures passed 8/8
    normally and with race, with original numerical comparisons retained.
  • The original term-changing catch-up fixture bypassed revocation; its old
    four-versus-one count was invalid production-equivalent evidence. The corrected
    positive holds a same-term independent-key Save, queues four original frames,
    consumes the prefix ACK, and observes four subsequent Saves versus one.
    Every append has its own native check and ACK. A separate real-revocation
    negative denies the old receipt during and after the term-changing Save.
  • Proposal IDs differ from indexes through transport, exact WAL reopen and
    pending-result correlation. Ordered OCC, visible values and durable applied
    indexes remain. Pre-/post-write failures suppress ACKs. Reordered protobuf
    fields preserve decoded equivalence and original bytes; suffix bounds and
    classifier CPU/allocation benchmarks are covered.
  • Self-removal tests now wait on the existing transition-completion barrier,
    retaining both index assertions, peer removal, close/join and zero-budget
    checks. V1/V2 passed 30 normal and 30 race repetitions before integration.
  • Merge regression controls reproduced duplicate Close, retryable-write shutdown
    poisoning and swallowed final rename errors. Owned cancellation/retirement and
    fatal joined-close/rename failures now pass. Real pipe-induced fsync failure
    is tested for both regular and catch-up snapshots without publication/release.
  • The rest-CI OPTIONS-file race was a live-directory measurement fixture. Every
    physical measurement now requires a closed DB and released lifecycle lock.
    A deterministic precondition RED exposed all three old open-store call orders.
    No ENOENT/file is ignored; survivor, version, progress, compaction, SST equality
    and numeric reclamation comparisons remain.
  • The new floor tests went RED on lost transfer identity and, with only the
    producer fix, on an extra TSO retry. The final allocator observed one floor
    attempt and zero reservations. Real TCP EXEC target/proxy tests preserve
    terminal and genuine mixed-array shapes; landed-write/lost-response controls
    preserve UNKNOWN and one dispatch. Full KV race, focused ten-fold race,
    surrounding Redis race repetitions, and independent scoped source review
    passed. A test-only lint import repair was followed by fresh race and lint.
  • Held membership publication reproduced the CI index mismatch. The fixed
    catch-up test retains its unreachable minimum and typed rejection. An expired
    real transfer probe reproduced the split fixture failure; a second persistent
    timeout still fails, and all original migration/capability guards remain.
  • Lean retains explicit filesystem/replay assumptions. Its model is not a proof
    of every Go path, the OS or the transport feedback rule.

Five Review Lenses

  1. Data loss: preserved WAL persistence before individual apply/ACK and final
    snapshot durability before publication/release. Exact reopen, held-Save,
    cancellation, fsync, rename and joined-close fault checks pass. Reuse-allocation
    failure preserves the landed prior attempt and issues no new mutation.
    Byte flow control retains real post-Save ACKs and legal oversize progress.
  2. Concurrency / distributed failures: retained each receipt/native check,
    term/config invalidation, cutover and FIFO/priority boundaries. Worker cancel
    precedes join; original owned handles retire once. Transfer error identity
    adds no authority or TSO retry. Race repetitions pass. Recovery reloads each
    local committed catalog; exact selected-ACK observation happens outside both
    scopes. Caller cancellation/unblocking/join precedes test resource cleanup.
  3. Performance: classifier cost and queued follower Save amplification are
    measured independently. Contribution to hot UNKNOWNs and full adoption are
    still unproven, so the original performance gate remains open. One refill is
    now bounded and measured; total dispatch ownership and full adoption are not.
  4. Data consistency: original frames, route proofs, per-entry OCC/results and
    definitive-versus-UNKNOWN semantics remain. Disk-size fixtures measure stopped
    stores after logical/value/version assertions without changing GC algorithms.
    Corrupt/missing catalog and exact revoked-ACK controls fail closed.
  5. Test coverage: faithful catch-up/revocation, distinct IDs, reordered-wire
    immutability, suffix bounds, publication completion and learner/owned-snapshot
    failure integration are covered. Latest whole-suite, CI and stress evidence
    is finalized separately from performance adoption. New tests connect the
    floor producer to the real Redis proxy and retain negative ambiguity/status
    controls. The additional error-boundary and byte-window designs each preceded
    their implementation. Original R14 remains failed, hot not run; R15 pending.

Related follow-up designs are under docs/design/2026_12_03_proposed_*.md.
The original batching commit combined design and implementation; the corrective
validation design was committed separately before its test changes. Published
history was not rewritten.

Signed-off-by: bootjp <contact@bootjp.me>
Signed-off-by: bootjp <contact@bootjp.me>
Signed-off-by: bootjp <contact@bootjp.me>
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions

Copy link
Copy Markdown
Contributor

TLA+ spec divergence review (auto-triggered)

This PR touches files that the TLA+ safety spec has an anchor on (per
docs/design/2026_05_28_implemented_tla_safety_spec.md §3),
so an AI review is requested below to verify the implementation has not drifted
from the model.

Anchored files changed in this PR head (193bbb6):

  • distribution/engine.go
  • kv/coordinator.go
  • kv/fsm.go
  • kv/fsm_migration_serving.go
  • kv/sharded_coordinator.go
  • kv/transaction.go
  • store/lsm_store.go
  • store/mvcc_store.go

What to check, by subsystem:

  • kv/hlc*.go — Next() must respect the HLC-4 preconditions (i)/(ii)/(iii) from the design doc: bounded skew, logical-counter handoff on leader change (the TSO allocation floor; legacy modes have none and are pinned as known gaps), and the NextFenced ceiling fence (fail-closed when wall_now >= physicalCeiling or when the next value's physical half exceeds it). Any change to the bit layout (48/16), the CAS loop, or the ceiling getter/setter is in scope.
  • kv/tso*.go — RaftTSOAllocator must Observe the committed allocation floor before reserving and commit the new floor before handing a window out (HLC.tla IssuanceMode = "tso").
  • kv/coordinator.go, kv/sharded_coordinator.go — RunHLCLeaseRenewal, hlcRenewalInterval, hlcPhysicalWindowMs constants, and which node stamps StartTS / CommitTS (HLC-3; legacy ShardedCoordinator stamping is the known gap G10). Any change to renewal cadence, group selection, or fail-closed behaviour is in scope.
  • kv/transaction.go, kv/lock_resolver.go — OCC commit-ts assignment, lock-map encoding (key, lock_ts) -> start_ts, and the LockResolver action OCC-3 depends on (OCC.tla; G0 / G1 are pinned as known gaps).
  • kv/fsm.go, kv/fsm_migration_serving.go — FSM apply of HLC lease entries (SetPhysicalCeiling), the one-phase / PREPARE / COMMIT validation OCC.tla models, verifyComposed1, and the migration serving guard Composed.tla relies on for unpinned writes.
  • store/mvcc_store.go, store/lsm_store.go — version visibility, resumable compaction, the commit-ts apply fence, and the MVCC-1 / MVCC-4 / MVCC-5 invariants.
  • adapter/ts.go — the snapshot start timestamp OCC.tla assumes (applied watermark; MaxUint64 on an empty store).
  • distribution/** — route catalog versioning, SplitRange atomicity, and CatalogWatcher async fan-out (M4 scope).

If the change is correct but requires a spec update, edit tla/hlc/HLC.tla (or the corresponding M2..M5 module once landed) and the design doc in the same PR. The tla-check workflow runs the TLC model check on the same paths.


@claude review please verify TLA+ spec divergence per the checklist above.

@codex review please verify TLA+ spec divergence per the checklist above.

@bootjp

bootjp commented Nov 21, 2026

Copy link
Copy Markdown
Owner Author

@claude review
@codex review

Please review the full draft at 193bbb601f71dea59aa7efa44d6a1bffe76fa97d. The PR body records a known covered-range cleanup failure. Please distinguish that blocker from any additional findings, with particular attention to replica agreement after compaction, the public Jepsen checker, and the bounds of the Lean and TLA+ claims. Please post review findings only.

@claude

claude Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Codex Review Summary: 🔄 Running

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-12-03T22:23:02.907764Z f82cbac Manual request
🔒 Security Review 🔄 Running since 2026-12-03T22:23:03.018219Z f82cbac Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 193bbb601f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +112 to +116
exported, err := s.exportVersionsFromLocked(ctx, sc.batch, exportOpts, true)
if err != nil {
return CleanupVersionsResult{}, err
}
if err := stageCleanupVersionDeletes(sc.batch, exported.Versions); err != nil {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve visible-head agreement during covered-range cleanup

This is the documented blocker, not an additional defect: replicas with different local compaction histories select cleanup rows from different physical histories. With versions 10 and 20 initially present, one replica can compact away 10 before both apply a cleanup with ceiling 20 and a one-row budget. Deleting version 20 then exposes version 10 on one replica and leaves the key missing on the other, despite identical applied indices. Permanent coverage excludes CAS but does not make divergent ordinary reads safe. TestCoveredCleanupAgreesAcrossReplicaRetention captures this scenario. The positive Lean and TLC agreement results exclude independent compaction; the separate retention counterexample documents the failure rather than establishing its safety. Cleanup must preserve logical visibility independently of retained historical rows.

Useful? React with 👍 / 👎.

Comment on lines +27 to +29
(cond-> (-> s (observe [:floor key] version) (assoc-in [:values [key version]] value))
(< version bound) (violation :version-regressed call op)
(and (some? known) (not= known value)) (violation :version-value-changed call op)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject observations that cannot originate from any write

Beyond the known cleanup blocker, the public checker can certify fabricated register contents because a previously unseen version/value pair is accepted without checking its provenance. For example, append a completed read returning version 40 and value 999 to the test's healthy history, after all operations have completed and with no additional write invocation: check-history still returns :valid? true. That observation is impossible for this fresh, non-expiring key, whose last successful replacement was version 30 with value 3. The same gap permits corruption on the first read after seeding. Track possible producing writes, including overlapping and indeterminate operations, and reject reads that cannot correspond to any of them instead of treating every new version as authoritative.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 193bbb601f

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Signed-off-by: bootjp <contact@bootjp.me>
Signed-off-by: bootjp <contact@bootjp.me>
@bootjp

bootjp commented Dec 1, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 7e7cf4c463

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 7e7cf4c463

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Signed-off-by: bootjp <contact@bootjp.me>
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

TLA+ spec divergence review (auto-triggered)

This PR touches files that the TLA+ safety spec has an anchor on (per
docs/design/2026_05_28_implemented_tla_safety_spec.md §3),
so an AI review is requested below to verify the implementation has not drifted
from the model.

Anchored files changed in this PR head (44a53e3):

  • distribution/engine.go
  • kv/coordinator.go
  • kv/fsm.go
  • kv/fsm_migration_serving.go
  • kv/sharded_coordinator.go
  • kv/transaction.go
  • store/lsm_store.go
  • store/mvcc_store.go

What to check, by subsystem:

  • kv/hlc*.go — Next() must respect the HLC-4 preconditions (i)/(ii)/(iii) from the design doc: bounded skew, logical-counter handoff on leader change (the TSO allocation floor; legacy modes have none and are pinned as known gaps), and the NextFenced ceiling fence (fail-closed when wall_now >= physicalCeiling or when the next value's physical half exceeds it). Any change to the bit layout (48/16), the CAS loop, or the ceiling getter/setter is in scope.
  • kv/tso*.go — RaftTSOAllocator must Observe the committed allocation floor before reserving and commit the new floor before handing a window out (HLC.tla IssuanceMode = "tso").
  • kv/coordinator.go, kv/sharded_coordinator.go — RunHLCLeaseRenewal, hlcRenewalInterval, hlcPhysicalWindowMs constants, and which node stamps StartTS / CommitTS (HLC-3; legacy ShardedCoordinator stamping is the known gap G10). Any change to renewal cadence, group selection, or fail-closed behaviour is in scope.
  • kv/transaction.go, kv/lock_resolver.go — OCC commit-ts assignment, lock-map encoding (key, lock_ts) -> start_ts, and the LockResolver action OCC-3 depends on (OCC.tla; G0 / G1 are pinned as known gaps).
  • kv/fsm.go, kv/fsm_migration_serving.go — FSM apply of HLC lease entries (SetPhysicalCeiling), the one-phase / PREPARE / COMMIT validation OCC.tla models, verifyComposed1, and the migration serving guard Composed.tla relies on for unpinned writes.
  • store/mvcc_store.go, store/lsm_store.go — version visibility, resumable compaction, the commit-ts apply fence, and the MVCC-1 / MVCC-4 / MVCC-5 invariants.
  • adapter/ts.go — the snapshot start timestamp OCC.tla assumes (applied watermark; MaxUint64 on an empty store).
  • distribution/** — route catalog versioning, SplitRange atomicity, and CatalogWatcher async fan-out (M4 scope).

If the change is correct but requires a spec update, edit tla/hlc/HLC.tla (or the corresponding M2..M5 module once landed) and the design doc in the same PR. The tla-check workflow runs the TLC model check on the same paths.


@claude review please verify TLA+ spec divergence per the checklist above.

@codex review please verify TLA+ spec divergence per the checklist above.

@bootjp

bootjp commented Dec 1, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 44a53e305c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@bootjp

bootjp commented Dec 1, 2026

Copy link
Copy Markdown
Owner Author

Main conflicts are resolved at 44a53e3. CAS/Forward/timestamp/TTL/read handoff integration tests pass with the race detector, and the new CAS history witness rejects fabricated versions and spurious mismatches. This remains Draft: TestCoveredCleanupAgreesAcrossReplicaRetention still reproduces predecessor resurrection after physical-only cleanup. The approved replicated logical retirement and bounded physical reclamation protocol is not implemented yet; the current review receipt must not be treated as resolving that known blocker.

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 44a53e305c

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Signed-off-by: bootjp <contact@bootjp.me>
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

TLA+ spec divergence review (auto-triggered)

This PR touches files that the TLA+ safety spec has an anchor on (per
docs/design/2026_05_28_implemented_tla_safety_spec.md §3),
so an AI review is requested below to verify the implementation has not drifted
from the model.

Anchored files changed in this PR head (f204ddf):

  • distribution/engine.go
  • kv/coordinator.go
  • kv/fsm.go
  • kv/fsm_migration_serving.go
  • kv/sharded_coordinator.go
  • kv/transaction.go
  • store/lsm_store.go
  • store/mvcc_store.go

What to check, by subsystem:

  • kv/hlc*.go — Next() must respect the HLC-4 preconditions (i)/(ii)/(iii) from the design doc: bounded skew, logical-counter handoff on leader change (the TSO allocation floor; legacy modes have none and are pinned as known gaps), and the NextFenced ceiling fence (fail-closed when wall_now >= physicalCeiling or when the next value's physical half exceeds it). Any change to the bit layout (48/16), the CAS loop, or the ceiling getter/setter is in scope.
  • kv/tso*.go — RaftTSOAllocator must Observe the committed allocation floor before reserving and commit the new floor before handing a window out (HLC.tla IssuanceMode = "tso").
  • kv/coordinator.go, kv/sharded_coordinator.go — RunHLCLeaseRenewal, hlcRenewalInterval, hlcPhysicalWindowMs constants, and which node stamps StartTS / CommitTS (HLC-3; legacy ShardedCoordinator stamping is the known gap G10). Any change to renewal cadence, group selection, or fail-closed behaviour is in scope.
  • kv/transaction.go, kv/lock_resolver.go — OCC commit-ts assignment, lock-map encoding (key, lock_ts) -> start_ts, and the LockResolver action OCC-3 depends on (OCC.tla; G0 / G1 are pinned as known gaps).
  • kv/fsm.go, kv/fsm_migration_serving.go — FSM apply of HLC lease entries (SetPhysicalCeiling), the one-phase / PREPARE / COMMIT validation OCC.tla models, verifyComposed1, and the migration serving guard Composed.tla relies on for unpinned writes.
  • store/mvcc_store.go, store/lsm_store.go — version visibility, resumable compaction, the commit-ts apply fence, and the MVCC-1 / MVCC-4 / MVCC-5 invariants.
  • adapter/ts.go — the snapshot start timestamp OCC.tla assumes (applied watermark; MaxUint64 on an empty store).
  • distribution/** — route catalog versioning, SplitRange atomicity, and CatalogWatcher async fan-out (M4 scope).

If the change is correct but requires a spec update, edit tla/hlc/HLC.tla (or the corresponding M2..M5 module once landed) and the design doc in the same PR. The tla-check workflow runs the TLC model check on the same paths.


@claude review please verify TLA+ spec divergence per the checklist above.

@codex review please verify TLA+ spec divergence per the checklist above.

@bootjp

bootjp commented Dec 1, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: f204ddf040

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: f204ddf040

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Signed-off-by: bootjp <contact@bootjp.me>
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

TLA+ spec divergence review (auto-triggered)

This PR touches files that the TLA+ safety spec has an anchor on (per
docs/design/2026_05_28_implemented_tla_safety_spec.md §3),
so an AI review is requested below to verify the implementation has not drifted
from the model.

Anchored files changed in this PR head (81e2ba7):

  • distribution/engine.go
  • kv/coordinator.go
  • kv/fsm.go
  • kv/fsm_migration_serving.go
  • kv/sharded_coordinator.go
  • kv/transaction.go
  • store/lsm_store.go
  • store/mvcc_store.go

What to check, by subsystem:

  • kv/hlc*.go — Next() must respect the HLC-4 preconditions (i)/(ii)/(iii) from the design doc: bounded skew, logical-counter handoff on leader change (the TSO allocation floor; legacy modes have none and are pinned as known gaps), and the NextFenced ceiling fence (fail-closed when wall_now >= physicalCeiling or when the next value's physical half exceeds it). Any change to the bit layout (48/16), the CAS loop, or the ceiling getter/setter is in scope.
  • kv/tso*.go — RaftTSOAllocator must Observe the committed allocation floor before reserving and commit the new floor before handing a window out (HLC.tla IssuanceMode = "tso").
  • kv/coordinator.go, kv/sharded_coordinator.go — RunHLCLeaseRenewal, hlcRenewalInterval, hlcPhysicalWindowMs constants, and which node stamps StartTS / CommitTS (HLC-3; legacy ShardedCoordinator stamping is the known gap G10). Any change to renewal cadence, group selection, or fail-closed behaviour is in scope.
  • kv/transaction.go, kv/lock_resolver.go — OCC commit-ts assignment, lock-map encoding (key, lock_ts) -> start_ts, and the LockResolver action OCC-3 depends on (OCC.tla; G0 / G1 are pinned as known gaps).
  • kv/fsm.go, kv/fsm_migration_serving.go — FSM apply of HLC lease entries (SetPhysicalCeiling), the one-phase / PREPARE / COMMIT validation OCC.tla models, verifyComposed1, and the migration serving guard Composed.tla relies on for unpinned writes.
  • store/mvcc_store.go, store/lsm_store.go — version visibility, resumable compaction, the commit-ts apply fence, and the MVCC-1 / MVCC-4 / MVCC-5 invariants.
  • adapter/ts.go — the snapshot start timestamp OCC.tla assumes (applied watermark; MaxUint64 on an empty store).
  • distribution/** — route catalog versioning, SplitRange atomicity, and CatalogWatcher async fan-out (M4 scope).

If the change is correct but requires a spec update, edit tla/hlc/HLC.tla (or the corresponding M2..M5 module once landed) and the design doc in the same PR. The tla-check workflow runs the TLC model check on the same paths.


@claude review please verify TLA+ spec divergence per the checklist above.

@codex review please verify TLA+ spec divergence per the checklist above.

@bootjp

bootjp commented Dec 1, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 81e2ba7530

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@bootjp

bootjp commented Dec 3, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Review the latest pushed HEAD c386826. The only change after the previously reviewed HEAD is a self-removal test observation fix. Configuration and applied indexes are separate publications; the test now witnesses configurationTransition=true during held SaveSnap, waits for its existing completion barrier to clear, then retains both index assertions, peer removal, close/join and budget checks. No production code, timeout, skip, revocation, WAL ordering or outcome semantics changed. V1/V2 passed 30 normal and 30 race repetitions; full lint is clean. A full-suite failure exposed the old sampling assumption and is preserved. Performance adoption remains pending and no trial has passed.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: c3868267f2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: c3868267f2

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Keep learner snapshot cancellation and pacing without losing original capture retirement or fatal export cleanup errors. Quiesce disk-usage fixtures before measuring physical files.

Signed-off-by: bootjp <contact@bootjp.me>
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

TLA+ spec divergence review (auto-triggered)

This PR touches files that the TLA+ safety spec has an anchor on (per
docs/design/2026_05_28_implemented_tla_safety_spec.md §3),
so an AI review is requested below to verify the implementation has not drifted
from the model.

Anchored files changed in this PR head (9a5db83):

  • distribution/engine.go
  • kv/coordinator.go
  • kv/fsm.go
  • kv/fsm_migration_serving.go
  • kv/sharded_coordinator.go
  • kv/transaction.go
  • store/lsm_store.go
  • store/mvcc_store.go

What to check, by subsystem:

  • kv/hlc*.go — Next() must respect the HLC-4 preconditions (i)/(ii)/(iii) from the design doc: bounded skew, logical-counter handoff on leader change (the TSO allocation floor; legacy modes have none and are pinned as known gaps), and the NextFenced ceiling fence (fail-closed when wall_now >= physicalCeiling or when the next value's physical half exceeds it). Any change to the bit layout (48/16), the CAS loop, or the ceiling getter/setter is in scope.
  • kv/tso*.go — RaftTSOAllocator must Observe the committed allocation floor before reserving and commit the new floor before handing a window out (HLC.tla IssuanceMode = "tso").
  • kv/coordinator.go, kv/sharded_coordinator.go — RunHLCLeaseRenewal, hlcRenewalInterval, hlcPhysicalWindowMs constants, and which node stamps StartTS / CommitTS (HLC-3; legacy ShardedCoordinator stamping is the known gap G10). Any change to renewal cadence, group selection, or fail-closed behaviour is in scope.
  • kv/transaction.go, kv/lock_resolver.go — OCC commit-ts assignment, lock-map encoding (key, lock_ts) -> start_ts, and the LockResolver action OCC-3 depends on (OCC.tla; G0 / G1 are pinned as known gaps).
  • kv/fsm.go, kv/fsm_migration_serving.go — FSM apply of HLC lease entries (SetPhysicalCeiling), the one-phase / PREPARE / COMMIT validation OCC.tla models, verifyComposed1, and the migration serving guard Composed.tla relies on for unpinned writes.
  • store/mvcc_store.go, store/lsm_store.go — version visibility, resumable compaction, the commit-ts apply fence, and the MVCC-1 / MVCC-4 / MVCC-5 invariants.
  • adapter/ts.go — the snapshot start timestamp OCC.tla assumes (applied watermark; MaxUint64 on an empty store).
  • distribution/** — route catalog versioning, SplitRange atomicity, and CatalogWatcher async fan-out (M4 scope).

If the change is correct but requires a spec update, edit tla/hlc/HLC.tla (or the corresponding M2..M5 module once landed) and the design doc in the same PR. The tla-check workflow runs the TLC model check on the same paths.


@claude review please verify TLA+ spec divergence per the checklist above.

@codex review please verify TLA+ spec divergence per the checklist above.

@bootjp

bootjp commented Dec 3, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Please review latest pushed HEAD 9a5db83. Main conflicts are resolved while retaining learner snapshot cancellation/pacing and owned-export retirement. The original capture is closed exactly once; only catch-up payload write failures are retryable, while final file fsync/rename/directory durability and joined source-close errors remain fatal before Raft publication. Snapshot/learner/Append tests passed all 62 cases three times normally and with race, including TCP-enabled cases and real fsync faults for regular and catch-up snapshots. The rest-CI OPTIONS-file race is fixed by measuring only closed stores; all physical/numeric comparisons remain unchanged. Full lint reports zero issues. Per-operation revocation, WAL sync -> apply -> ACK, and UNKNOWN semantics are unchanged. Full latest-HEAD CI, whole-Go tests and the original performance adoption trial are still required; no performance pass is claimed.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 9a5db83a80

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 9a5db83a80

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Signed-off-by: bootjp <contact@bootjp.me>
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

TLA+ spec divergence review (auto-triggered)

This PR touches files that the TLA+ safety spec has an anchor on (per
docs/design/2026_05_28_implemented_tla_safety_spec.md §3),
so an AI review is requested below to verify the implementation has not drifted
from the model.

Anchored files changed in this PR head (add58a6):

  • distribution/engine.go
  • kv/coordinator.go
  • kv/fsm.go
  • kv/fsm_migration_serving.go
  • kv/sharded_coordinator.go
  • kv/transaction.go
  • store/lsm_store.go
  • store/mvcc_store.go

What to check, by subsystem:

  • kv/hlc*.go — Next() must respect the HLC-4 preconditions (i)/(ii)/(iii) from the design doc: bounded skew, logical-counter handoff on leader change (the TSO allocation floor; legacy modes have none and are pinned as known gaps), and the NextFenced ceiling fence (fail-closed when wall_now >= physicalCeiling or when the next value's physical half exceeds it). Any change to the bit layout (48/16), the CAS loop, or the ceiling getter/setter is in scope.
  • kv/tso*.go — RaftTSOAllocator must Observe the committed allocation floor before reserving and commit the new floor before handing a window out (HLC.tla IssuanceMode = "tso").
  • kv/coordinator.go, kv/sharded_coordinator.go — RunHLCLeaseRenewal, hlcRenewalInterval, hlcPhysicalWindowMs constants, and which node stamps StartTS / CommitTS (HLC-3; legacy ShardedCoordinator stamping is the known gap G10). Any change to renewal cadence, group selection, or fail-closed behaviour is in scope.
  • kv/transaction.go, kv/lock_resolver.go — OCC commit-ts assignment, lock-map encoding (key, lock_ts) -> start_ts, and the LockResolver action OCC-3 depends on (OCC.tla; G0 / G1 are pinned as known gaps).
  • kv/fsm.go, kv/fsm_migration_serving.go — FSM apply of HLC lease entries (SetPhysicalCeiling), the one-phase / PREPARE / COMMIT validation OCC.tla models, verifyComposed1, and the migration serving guard Composed.tla relies on for unpinned writes.
  • store/mvcc_store.go, store/lsm_store.go — version visibility, resumable compaction, the commit-ts apply fence, and the MVCC-1 / MVCC-4 / MVCC-5 invariants.
  • adapter/ts.go — the snapshot start timestamp OCC.tla assumes (applied watermark; MaxUint64 on an empty store).
  • distribution/** — route catalog versioning, SplitRange atomicity, and CatalogWatcher async fan-out (M4 scope).

If the change is correct but requires a spec update, edit tla/hlc/HLC.tla (or the corresponding M2..M5 module once landed) and the design doc in the same PR. The tla-check workflow runs the TLC model check on the same paths.


@claude review please verify TLA+ spec divergence per the checklist above.

@codex review please verify TLA+ spec divergence per the checklist above.

@bootjp

bootjp commented Dec 3, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Please review exact HEAD add58a6, including revocation boundaries, individual WAL-sync/apply/ACK ordering, and snapshot export ownership after the main integration. The latest commit only restores the full expected snapshot retry metadata in the ingress feedback test. Performance adoption is still pending; current CI failures are under investigation and are not being waived.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: add58a6481

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: add58a6481

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Signed-off-by: bootjp <contact@bootjp.me>
Signed-off-by: bootjp <contact@bootjp.me>
Signed-off-by: bootjp <contact@bootjp.me>
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

TLA+ spec divergence review (auto-triggered)

This PR touches files that the TLA+ safety spec has an anchor on (per
docs/design/2026_05_28_implemented_tla_safety_spec.md §3),
so an AI review is requested below to verify the implementation has not drifted
from the model.

Anchored files changed in this PR head (e934e1a):

  • distribution/engine.go
  • kv/coordinator.go
  • kv/fsm.go
  • kv/fsm_migration_serving.go
  • kv/sharded_coordinator.go
  • kv/transaction.go
  • kv/tso_raft.go
  • store/lsm_store.go
  • store/mvcc_store.go

What to check, by subsystem:

  • kv/hlc*.go — Next() must respect the HLC-4 preconditions (i)/(ii)/(iii) from the design doc: bounded skew, logical-counter handoff on leader change (the TSO allocation floor; legacy modes have none and are pinned as known gaps), and the NextFenced ceiling fence (fail-closed when wall_now >= physicalCeiling or when the next value's physical half exceeds it). Any change to the bit layout (48/16), the CAS loop, or the ceiling getter/setter is in scope.
  • kv/tso*.go — RaftTSOAllocator must Observe the committed allocation floor before reserving and commit the new floor before handing a window out (HLC.tla IssuanceMode = "tso").
  • kv/coordinator.go, kv/sharded_coordinator.go — RunHLCLeaseRenewal, hlcRenewalInterval, hlcPhysicalWindowMs constants, and which node stamps StartTS / CommitTS (HLC-3; legacy ShardedCoordinator stamping is the known gap G10). Any change to renewal cadence, group selection, or fail-closed behaviour is in scope.
  • kv/transaction.go, kv/lock_resolver.go — OCC commit-ts assignment, lock-map encoding (key, lock_ts) -> start_ts, and the LockResolver action OCC-3 depends on (OCC.tla; G0 / G1 are pinned as known gaps).
  • kv/fsm.go, kv/fsm_migration_serving.go — FSM apply of HLC lease entries (SetPhysicalCeiling), the one-phase / PREPARE / COMMIT validation OCC.tla models, verifyComposed1, and the migration serving guard Composed.tla relies on for unpinned writes.
  • store/mvcc_store.go, store/lsm_store.go — version visibility, resumable compaction, the commit-ts apply fence, and the MVCC-1 / MVCC-4 / MVCC-5 invariants.
  • adapter/ts.go — the snapshot start timestamp OCC.tla assumes (applied watermark; MaxUint64 on an empty store).
  • distribution/** — route catalog versioning, SplitRange atomicity, and CatalogWatcher async fan-out (M4 scope).

If the change is correct but requires a spec update, edit tla/hlc/HLC.tla (or the corresponding M2..M5 module once landed) and the design doc in the same PR. The tla-check workflow runs the TLC model check on the same paths.


@claude review please verify TLA+ spec divergence per the checklist above.

@codex review please verify TLA+ spec divergence per the checklist above.

@bootjp

bootjp commented Dec 3, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Please review exact HEAD e934e1a after the final push. The separately committed fenced-floor design narrows transfer classification, prevents a new TSO reservation retry, and preserves UNKNOWN for pending EXEC/list/XADD allocation failures without replay. Please audit caller/error precedence, revocation, original attempt identity, snapshot ownership, and individual WAL-sync/apply/ACK ordering. The CI fixture repairs retain the catch-up and all-member admission assertions. Focused race tests and full KV race passed; all latest-HEAD CI and the original performance adoption remain mandatory and are not waived.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: e934e1a7d2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: e934e1a7d2

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Signed-off-by: bootjp <contact@bootjp.me>
Signed-off-by: bootjp <contact@bootjp.me>
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

TLA+ spec divergence review (auto-triggered)

This PR touches files that the TLA+ safety spec has an anchor on (per
docs/design/2026_05_28_implemented_tla_safety_spec.md §3),
so an AI review is requested below to verify the implementation has not drifted
from the model.

Anchored files changed in this PR head (a7993de):

  • distribution/engine.go
  • kv/coordinator.go
  • kv/fsm.go
  • kv/fsm_migration_serving.go
  • kv/sharded_coordinator.go
  • kv/transaction.go
  • kv/tso_raft.go
  • store/lsm_store.go
  • store/mvcc_store.go

What to check, by subsystem:

  • kv/hlc*.go — Next() must respect the HLC-4 preconditions (i)/(ii)/(iii) from the design doc: bounded skew, logical-counter handoff on leader change (the TSO allocation floor; legacy modes have none and are pinned as known gaps), and the NextFenced ceiling fence (fail-closed when wall_now >= physicalCeiling or when the next value's physical half exceeds it). Any change to the bit layout (48/16), the CAS loop, or the ceiling getter/setter is in scope.
  • kv/tso*.go — RaftTSOAllocator must Observe the committed allocation floor before reserving and commit the new floor before handing a window out (HLC.tla IssuanceMode = "tso").
  • kv/coordinator.go, kv/sharded_coordinator.go — RunHLCLeaseRenewal, hlcRenewalInterval, hlcPhysicalWindowMs constants, and which node stamps StartTS / CommitTS (HLC-3; legacy ShardedCoordinator stamping is the known gap G10). Any change to renewal cadence, group selection, or fail-closed behaviour is in scope.
  • kv/transaction.go, kv/lock_resolver.go — OCC commit-ts assignment, lock-map encoding (key, lock_ts) -> start_ts, and the LockResolver action OCC-3 depends on (OCC.tla; G0 / G1 are pinned as known gaps).
  • kv/fsm.go, kv/fsm_migration_serving.go — FSM apply of HLC lease entries (SetPhysicalCeiling), the one-phase / PREPARE / COMMIT validation OCC.tla models, verifyComposed1, and the migration serving guard Composed.tla relies on for unpinned writes.
  • store/mvcc_store.go, store/lsm_store.go — version visibility, resumable compaction, the commit-ts apply fence, and the MVCC-1 / MVCC-4 / MVCC-5 invariants.
  • adapter/ts.go — the snapshot start timestamp OCC.tla assumes (applied watermark; MaxUint64 on an empty store).
  • distribution/** — route catalog versioning, SplitRange atomicity, and CatalogWatcher async fan-out (M4 scope).

If the change is correct but requires a spec update, edit tla/hlc/HLC.tla (or the corresponding M2..M5 module once landed) and the design doc in the same PR. The tla-check workflow runs the TLC model check on the same paths.


@claude review please verify TLA+ spec divergence per the checklist above.

@codex review please verify TLA+ spec divergence per the checklist above.

@bootjp

bootjp commented Dec 3, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Please review exact final-push HEAD a7993de. A separately accepted design configures only synchronous Raft MaxInflightBytes=max(8 MiB,effective message target); async stays 128 MiB. Preserve every receipt/native generation, full-member per-caller capability check and WAL-sync -> individual apply -> ACK order. Please audit custom/unlimited targets, legal 64 MiB wire entries and following-entry progress, owner-turn bounds versus total queue/heap claims, and nil production observers. Faithful three-node worker tests now reload each committed local catalog on every recovery and prove the selected real healthy ACK advances Match/commit, with revoked-ACK and corrupted-catalog negative controls. Parent targeted race, full lint and dependency checks passed. R14 original performance remains FAILED, hot NOT RUN; no partial or profiled result is acceptance. Full CI, 300s CAS/ZSet stress and unchanged primary/hot adoption must still pass on this HEAD.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: a7993de149

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: a7993de149

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Signed-off-by: bootjp <contact@bootjp.me>
Signed-off-by: bootjp <contact@bootjp.me>
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

TLA+ spec divergence review (auto-triggered)

This PR touches files that the TLA+ safety spec has an anchor on (per
docs/design/2026_05_28_implemented_tla_safety_spec.md §3),
so an AI review is requested below to verify the implementation has not drifted
from the model.

Anchored files changed in this PR head (f82cbac):

  • distribution/engine.go
  • kv/coordinator.go
  • kv/fsm.go
  • kv/fsm_migration_serving.go
  • kv/sharded_coordinator.go
  • kv/transaction.go
  • kv/tso_raft.go
  • store/lsm_store.go
  • store/mvcc_store.go

What to check, by subsystem:

  • kv/hlc*.go — Next() must respect the HLC-4 preconditions (i)/(ii)/(iii) from the design doc: bounded skew, logical-counter handoff on leader change (the TSO allocation floor; legacy modes have none and are pinned as known gaps), and the NextFenced ceiling fence (fail-closed when wall_now >= physicalCeiling or when the next value's physical half exceeds it). Any change to the bit layout (48/16), the CAS loop, or the ceiling getter/setter is in scope.
  • kv/tso*.go — RaftTSOAllocator must Observe the committed allocation floor before reserving and commit the new floor before handing a window out (HLC.tla IssuanceMode = "tso").
  • kv/coordinator.go, kv/sharded_coordinator.go — RunHLCLeaseRenewal, hlcRenewalInterval, hlcPhysicalWindowMs constants, and which node stamps StartTS / CommitTS (HLC-3; legacy ShardedCoordinator stamping is the known gap G10). Any change to renewal cadence, group selection, or fail-closed behaviour is in scope.
  • kv/transaction.go, kv/lock_resolver.go — OCC commit-ts assignment, lock-map encoding (key, lock_ts) -> start_ts, and the LockResolver action OCC-3 depends on (OCC.tla; G0 / G1 are pinned as known gaps).
  • kv/fsm.go, kv/fsm_migration_serving.go — FSM apply of HLC lease entries (SetPhysicalCeiling), the one-phase / PREPARE / COMMIT validation OCC.tla models, verifyComposed1, and the migration serving guard Composed.tla relies on for unpinned writes.
  • store/mvcc_store.go, store/lsm_store.go — version visibility, resumable compaction, the commit-ts apply fence, and the MVCC-1 / MVCC-4 / MVCC-5 invariants.
  • adapter/ts.go — the snapshot start timestamp OCC.tla assumes (applied watermark; MaxUint64 on an empty store).
  • distribution/** — route catalog versioning, SplitRange atomicity, and CatalogWatcher async fan-out (M4 scope).

If the change is correct but requires a spec update, edit tla/hlc/HLC.tla (or the corresponding M2..M5 module once landed) and the design doc in the same PR. The tla-check workflow runs the TLC model check on the same paths.


@claude review please verify TLA+ spec divergence per the checklist above.

@codex review please verify TLA+ spec divergence per the checklist above.

@bootjp

bootjp commented Dec 3, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Please review exact final-push HEAD f82cbac. The last two commits are test/CI only: a narrowly typed RawGet retry for the exact lost-read-fence error (global mutation replay classification unchanged), and moving the new unchanged 64 MiB compatibility test into the existing isolated native CI step with explicit verbose evidence. The full 9999-iteration raw/transaction sequences passed twice under race. The max-value test retained its original values, five-second waits, elections, ACK, following-entry and three-store equality checks; two-core runs passed twice after the concurrent owned WAL-heavy test ended. Earlier competing-load failures remain recorded, not called passes. Please audit UNKNOWN semantics, exact error/detail handling, test caller cleanup and complete CI coverage. The synchronous byte-window policy, genuine receipt/native revocation, WAL-sync -> individual apply -> ACK and original performance gates are unchanged. R14 remains failed and hot unrun; R15 is not allocated. All final-HEAD reviews, actual CI, 300s CAS/ZSet stress and unchanged adoption remain mandatory.

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