Skip to content

Implement centralized TSO phase D#1114

Merged
bootjp merged 7 commits into
design/dedicated-tso-fsmfrom
design/dedicated-tso-m7
Jul 23, 2026
Merged

Implement centralized TSO phase D#1114
bootjp merged 7 commits into
design/dedicated-tso-fsmfrom
design/dedicated-tso-m7

Conversation

@bootjp

@bootjp bootjp commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Author: bootjp

Summary

  • persist a one-way Phase D marker and floor after the production cutover marker
  • stop data-group HLC renewal and legacy/shadow timestamp issuance once Phase D is durable
  • validate caller-supplied cross-shard SSI timestamps at the current group-0 leader before allocating a commit timestamp or proposing writes
  • migrate adapter read-modify-write snapshots to dedicated TSO allocations while preserving single-shard and pre-Phase-D compatibility
  • retain the parent branch's same-term allocation fences and RawLatestCommitTS group_id/leader_fenced schema

Safety

  • activation commits cutover, Phase D, and the first post-Phase-D allocation in order
  • validation accepts only timestamps in the durable post-marker allocation interval and fails closed on inactive state, stale leadership, unsupported routing, or out-of-range values
  • leader term is revalidated after floor/marker work and after the allocation-floor commit
  • proto output was regenerated from the combined schema

Tests

  • make gen BREAKING_AGAINST='../.git#subdir=proto,branch=design/dedicated-tso-leader-routing'
  • go test ./kv ./adapter . -run 'TSO|PhaseD|RenewHLC|CrossShard|ValidateTimestamp|RawLatestCommitTS' -count=1
  • go test ./kv -run 'TestRaftTSOAllocator(RejectsTermChange|DropsCommittedWindow|CommitsPhaseD)' -count=1
  • go test ./adapter -run '^Test_consistency_satisfy_write_after_read_sequence$' -count=1 -timeout=10m
  • go test ./adapter -run '^TestRedis_StreamXReadLatencyIsConstant$' -count=1 -timeout=10m
  • golangci-lint run ./... --timeout=5m --allow-parallel-runners

The full parallel go test ./... run completed all packages except two long adapter stress tests after their test HLC ceilings expired under concurrent local load; both tests passed when rerun independently.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0de27fe4-61a9-4d4c-89c8-76e4aeecad04

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@bootjp

bootjp commented Jul 18, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@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 (3a7b865):

  • distribution/catalog.go
  • distribution/catalog_test.go
  • kv/coordinator.go
  • kv/sharded_coordinator.go

What to check, by subsystem:

  • kv/hlc*.goNext() must respect the HLC-4 preconditions (i)/(ii)/(iii) from the design doc: bounded skew, logical-counter handoff on leader change (strategy (c) Observe(MaxAppliedHLC)), and the commit-time ceiling fence (fail-closed when wall_now >= physicalCeiling). Any change to the bit layout (48/16), the CAS loop, or the ceiling getter/setter is in scope.
  • kv/coordinator.go, kv/sharded_coordinator.goRunHLCLeaseRenewal, hlcRenewalInterval, hlcPhysicalWindowMs constants, and the new-term detection that calls Observe(fsm.MaxAppliedHLC()) (strategy (c)). 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. (M2 spec will land OCC-1..OCC-5; until then the spec doc §5.2 is the contract.)
  • kv/fsm.go — FSM apply of HLC lease entries (SetPhysicalCeiling), and any future MaxAppliedHLC() accessor that strategy (c) needs.
  • store/mvcc_store.go — version visibility, snapshot install, and the MVCC-1..MVCC-4 invariants (M3 scope).
  • 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request implements Phase D (M7) of the Centralized Timestamp Oracle (TSO) design, which closes the legacy compatibility window and retires legacy per-shard HLC issuance. Key changes include adding a ValidateTimestamp RPC to the Distribution service, updating GetTimestamp to support Phase-D activation, and modifying various adapter read-modify-write paths (DynamoDB, Redis, S3, SQS) to allocate and validate read timestamps via BeginReadTimestampThrough. There are no review comments to address, and I have no additional feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@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: 3a7b865474

ℹ️ 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 thread kv/tso.go Outdated
Comment thread kv/tso_fsm.go Outdated
Comment thread kv/sharded_coordinator.go Outdated
Comment thread kv/tso.go
@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 (c7955d3):

  • distribution/catalog.go
  • distribution/catalog_test.go
  • kv/coordinator.go
  • kv/sharded_coordinator.go

What to check, by subsystem:

  • kv/hlc*.goNext() must respect the HLC-4 preconditions (i)/(ii)/(iii) from the design doc: bounded skew, logical-counter handoff on leader change (strategy (c) Observe(MaxAppliedHLC)), and the commit-time ceiling fence (fail-closed when wall_now >= physicalCeiling). Any change to the bit layout (48/16), the CAS loop, or the ceiling getter/setter is in scope.
  • kv/coordinator.go, kv/sharded_coordinator.goRunHLCLeaseRenewal, hlcRenewalInterval, hlcPhysicalWindowMs constants, and the new-term detection that calls Observe(fsm.MaxAppliedHLC()) (strategy (c)). 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. (M2 spec will land OCC-1..OCC-5; until then the spec doc §5.2 is the contract.)
  • kv/fsm.go — FSM apply of HLC lease entries (SetPhysicalCeiling), and any future MaxAppliedHLC() accessor that strategy (c) needs.
  • store/mvcc_store.go — version visibility, snapshot install, and the MVCC-1..MVCC-4 invariants (M3 scope).
  • 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@bootjp

bootjp commented Jul 19, 2026

Copy link
Copy Markdown
Owner Author

Evidence for current HEAD c7955d3947029bf3408de7255400cb65b9eec3a4:

  • Preserves and validates applied read watermarks in Phase D; no fresh unapplied read snapshot is allocated.
  • Emits V3 TSO snapshots before the durable Phase-D marker and V4 afterward.
  • Validates caller-supplied cross-shard StartTS from allocator PhaseDRequired during activation.
  • Invalidates pre-Phase-D batch windows and discards claims that cross activation.
  • Caller audit: all 9 production BeginReadTimestampThrough call sites were traced to store/catalog applied watermarks, including sentinel fail-closed handling; no direct NextTimestamp, NextFenced, or Clock().Next input remains.
  • The centralized TSO design remains Partial until the dependency stack safety findings and latest-head reviews are clear.

Local verification:

  • go test ./kv ./distribution -count=1
  • go test ./adapter -run "Test(S3BeginTxnReadTimestampPhaseD|DistributionServerSplitRange_PhaseD)" -count=1
  • go test -race ./kv -run "Test(BeginReadTimestampThrough|BatchAllocatorDropsPrePhaseDWindowAfterActivation|TSOStateMachineSnapshot|ShardedCoordinatorDispatchTxn_PhaseD|ShardedCoordinatorDispatchTxn_PrePhaseD)" -count=1
  • golangci-lint run ./... --timeout=5m --allow-parallel-runners (0 issues)
  • make tla-check
  • buf generate

The broad go test ./adapter -count=1 run compiled the package but exceeded its 10-minute integration timeout; focused changed-path tests passed and current-head CI is running.

@codex review

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

ℹ️ 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 thread kv/tso.go Outdated
Comment thread adapter/s3_upload_part.go Outdated
Comment thread kv/tso_raft.go Outdated
@bootjp
bootjp force-pushed the design/dedicated-tso-leader-routing branch from 93b8633 to 295b851 Compare July 19, 2026 12:32
@bootjp
bootjp force-pushed the design/dedicated-tso-m7 branch from c7955d3 to 1fbb3e9 Compare July 19, 2026 13:07
@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 (1fbb3e9):

  • distribution/catalog.go
  • distribution/catalog_test.go
  • kv/coordinator.go
  • kv/sharded_coordinator.go

What to check, by subsystem:

  • kv/hlc*.goNext() must respect the HLC-4 preconditions (i)/(ii)/(iii) from the design doc: bounded skew, logical-counter handoff on leader change (strategy (c) Observe(MaxAppliedHLC)), and the commit-time ceiling fence (fail-closed when wall_now >= physicalCeiling). Any change to the bit layout (48/16), the CAS loop, or the ceiling getter/setter is in scope.
  • kv/coordinator.go, kv/sharded_coordinator.goRunHLCLeaseRenewal, hlcRenewalInterval, hlcPhysicalWindowMs constants, and the new-term detection that calls Observe(fsm.MaxAppliedHLC()) (strategy (c)). 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. (M2 spec will land OCC-1..OCC-5; until then the spec doc §5.2 is the contract.)
  • kv/fsm.go — FSM apply of HLC lease entries (SetPhysicalCeiling), and any future MaxAppliedHLC() accessor that strategy (c) needs.
  • store/mvcc_store.go — version visibility, snapshot install, and the MVCC-1..MVCC-4 invariants (M3 scope).
  • 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

bootjp commented Jul 19, 2026

Copy link
Copy Markdown
Owner Author

Evidence for current HEAD 1fbb3e94816b131555e7fe8f8d310c0e553b8b67:

  • Rebased onto tso: route durable timestamps through group leader #1108 HEAD 295b85152fdd88a9765e1eafae2e7c142e9397e8 and rebuilt as one PR-visible commit.
  • Phase-D read boundaries force activation by reserving and discarding a post-marker timestamp, but preserve the exact applied store/catalog watermark for reads. Audited pre-floor watermarks use a bounded one-use process-local voucher; unvouched external StartTS values remain fail-closed at group 0.
  • Pre-activation snapshots remain V3; V4 is emitted only after the durable marker. Allocation-floor, cutover, and Phase-D control entries use distinct exact versioned envelopes retaining the old fail-closed prefix.
  • S3 UploadPart performs its final metadata check at the latest applied watermark and includes uploadMetaKey in ReadKeys, closing abort/complete races.
  • Routed local timestamp validation retries and re-resolves transient leadership loss within the configured budget.
  • Caller audit covered every production BeginReadTimestampThrough site, direct NextTimestamp/NextFenced/Clock.Next issuance, voucher forwarding through coordinator decorators, all floor/cutover/Phase-D encoders, and the S3 upload metadata read set.
  • PR-visible author and committer are bootjp <contact@bootjp.me>; GitHub signature verification is verified: true. Final tree: 40aadeb91c21d7cc97a528c2f81c7da55b2af0e1.
  • The design remains Partial until the runtime-operations PR and dependency-stack latest-head reviews are clear.

Validation:

  • go test ./kv ./distribution -count=1 -timeout=10m
  • go test . -count=1 -timeout=10m
  • focused S3/Distribution adapter tests
  • compile-only go test ./... -run '^$' -count=1
  • focused race tests for Phase-D activation, vouchers, routed validation, snapshots, S3, and decorated coordinators
  • golangci-lint run ./... --timeout=5m --allow-parallel-runners (0 issues)
  • make gen (no generated diff)
  • make tla-check (all safe models pass; every gap model fails only at its expected invariant)
  • git diff --check

All three current review threads were replied to and resolved. Requesting a fresh latest-head review.

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 1fbb3e9481

ℹ️ 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 force-pushed the design/dedicated-tso-leader-routing branch from 295b851 to 9182f37 Compare July 19, 2026 13:59
@bootjp
bootjp force-pushed the design/dedicated-tso-m7 branch from 1fbb3e9 to c801865 Compare July 19, 2026 14:04
@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 (c801865):

  • distribution/catalog.go
  • distribution/catalog_test.go
  • kv/coordinator.go
  • kv/sharded_coordinator.go

What to check, by subsystem:

  • kv/hlc*.goNext() must respect the HLC-4 preconditions (i)/(ii)/(iii) from the design doc: bounded skew, logical-counter handoff on leader change (strategy (c) Observe(MaxAppliedHLC)), and the commit-time ceiling fence (fail-closed when wall_now >= physicalCeiling). Any change to the bit layout (48/16), the CAS loop, or the ceiling getter/setter is in scope.
  • kv/coordinator.go, kv/sharded_coordinator.goRunHLCLeaseRenewal, hlcRenewalInterval, hlcPhysicalWindowMs constants, and the new-term detection that calls Observe(fsm.MaxAppliedHLC()) (strategy (c)). 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. (M2 spec will land OCC-1..OCC-5; until then the spec doc §5.2 is the contract.)
  • kv/fsm.go — FSM apply of HLC lease entries (SetPhysicalCeiling), and any future MaxAppliedHLC() accessor that strategy (c) needs.
  • store/mvcc_store.go — version visibility, snapshot install, and the MVCC-1..MVCC-4 invariants (M3 scope).
  • 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

bootjp commented Jul 19, 2026

Copy link
Copy Markdown
Owner Author

Evidence for rebased current HEAD c8018656811d1a9511f0495b4c14a85678452bce:

  • Parent is the verified tso: route durable timestamps through group leader #1108 startup-gate fix 9182f378f75401617f38cfae9d80b92305c10c1b; this PR remains one verified bootjp contact@bootjp.me commit.
  • Phase-D read activation still reserves and discards the first post-marker timestamp while preserving the exact applied store/catalog watermark, with bounded one-use vouchers for audited pre-floor applied reads.
  • V3 snapshots remain compatible before Phase D and V4 is emitted only after the one-way marker. Cached pre-D windows are invalidated across activation.
  • S3 UploadPart uses a fresh final watermark and includes upload metadata in the read set. Local validation leadership loss uses bounded re-resolution.
  • The inherited startup-gate fix ensures follower-forwarded raw writes are stamped by group 0 rather than a data-group HLC.
  • Semantic caller audit covered all production begin-read paths, direct timestamp helpers, startup coordinator decorators, Internal.Forward, and TSO validation/routing call sites.

Current-head local verification:

  • focused root/kv tests for startup-gate wiring, Phase-D begin-read activation/vouchers, batch invalidation, routed validation, and follower deferral
  • focused race tests for the same shared paths
  • no conflict markers or diff-check errors
  • the previous HEAD passed full required CI and received a no-major review; fresh CI and review are required for this rebased HEAD

@codex review

Base automatically changed from design/dedicated-tso-leader-routing to design/dedicated-tso-fsm July 19, 2026 14:18

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

ℹ️ 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 thread adapter/sqs_reaper.go
Comment thread adapter/sqs_messages.go
Comment thread adapter/redis_delta_compactor.go
Comment thread adapter/redis_txn.go
@bootjp
bootjp force-pushed the design/dedicated-tso-m7 branch from c801865 to 07460ec Compare July 19, 2026 15:28
@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 (07460ec):

  • distribution/catalog.go
  • distribution/catalog_test.go
  • kv/coordinator.go
  • kv/sharded_coordinator.go

What to check, by subsystem:

  • kv/hlc*.goNext() must respect the HLC-4 preconditions (i)/(ii)/(iii) from the design doc: bounded skew, logical-counter handoff on leader change (strategy (c) Observe(MaxAppliedHLC)), and the commit-time ceiling fence (fail-closed when wall_now >= physicalCeiling). Any change to the bit layout (48/16), the CAS loop, or the ceiling getter/setter is in scope.
  • kv/coordinator.go, kv/sharded_coordinator.goRunHLCLeaseRenewal, hlcRenewalInterval, hlcPhysicalWindowMs constants, and the new-term detection that calls Observe(fsm.MaxAppliedHLC()) (strategy (c)). 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. (M2 spec will land OCC-1..OCC-5; until then the spec doc §5.2 is the contract.)
  • kv/fsm.go — FSM apply of HLC lease entries (SetPhysicalCeiling), and any future MaxAppliedHLC() accessor that strategy (c) needs.
  • store/mvcc_store.go — version visibility, snapshot install, and the MVCC-1..MVCC-4 invariants (M3 scope).
  • 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@bootjp

bootjp commented Jul 19, 2026

Copy link
Copy Markdown
Owner Author

Evidence for current HEAD 07460ec:\n\n- Rebased onto current dependency tip aa94f4e and rebuilt as one PR-visible commit.\n- Author and committer are bootjp contact@bootjp.me; the local GPG signature is good.\n- Applied pre-Phase-D read watermarks now carry a private timestamp-bound capability. Every reused OCC dispatch reserves exactly one one-use coordinator voucher immediately before dispatch; another timestamp is rejected and a current binding shadows any parent capability.\n- SQS live/tombstone reaping covers record, orphan-index, and dedup dispatches. Receive covers expiry, rotation, and DLQ redrive. Redis urgent/background compaction covers every collection and TTL-inline batch. EXEC retry state retains and re-vouches the exact first-attempt snapshot.\n- The design records per-dispatch voucher semantics and keeps arbitrary unvouched caller timestamps fail-closed at group 0.\n- Caller audit enumerated every production BeginReadTimestampThrough/beginTxnReadTimestamp caller and every NextTimestampThrough, NextTimestampAfterThrough, and TimestampAllocatorThrough caller. Other fanout paths either use one StartTS-bearing dispatch per snapshot or nontransactional batches; no additional shared applied-snapshot dispatch was found.\n- All four current review roots were replied to and resolved.\n- The centralized TSO design remains Partial in this dependency PR; implemented promotion stays in the runtime-operations PR only after the dependency stack is clear.\n\nValidation:\n- focused kv Phase-D/voucher tests: pass\n- focused adapter SQS/Redis compactor/EXEC tests: pass\n- focused kv and adapter race tests: pass\n- go test ./... -run ^$ -count=1: pass\n- golangci-lint run ./... --timeout=5m --allow-parallel-runners: 0 issues\n- make gen: pass, no generated diff\n- make tla-check: all safe models pass and every gap model fails only at its expected invariant\n- git diff --check: pass\n- Full local package reruns were additionally attempted; concurrent worktree tests exhausted the host filesystem and prolonged the existing Test_grpc_transaction HLC fixture. Changed-path tests remain green and current-head CI is the authoritative broad run.\n\n@codex review

@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: 07460ec650

ℹ️ 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 thread adapter/s3.go
Comment thread kv/sharded_coordinator.go Outdated
if !callerSupplied {
return nil
}
if c.consumeAppliedReadTimestampVoucher(startTS) || singleShard {

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 Bind vouchers to the dispatch capability

Under Phase D, this accepts a pre-floor StartTS by consuming a process-wide counter keyed only by timestamp. When two requests read the same applied watermark (common while LastCommitTS is pinned at the Phase-D floor), an unbound direct Dispatch with that StartTS can consume the voucher registered by another ReadTimestamp and bypass group-0 validation, or make the legitimate dispatch fail/retry. The voucher should be tied to the ReadTimestamp/ctx capability, not just the numeric timestamp.

Useful? React with 👍 / 👎.

Comment thread adapter/redis_stream_cmds.go Outdated
}

func (r *RedisServer) xaddReadTimestamp(ctx context.Context, key []byte) (uint64, error) {
readTS, err := r.beginTxnStartTS(ctx, "redis xadd: begin read timestamp")

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 Preserve XADD vouchers for dedup retries

In Phase D, beginTxnStartTS can reserve the only voucher that admits an applied pre-floor watermark, but this path collapses it to a uint64. The first XADD dispatch consumes that voucher; if it returns a retryable/ambiguous error, reusableXAdd keeps only startTS and dispatchXAddReuse calls plain Dispatch, so stream writes whose meta/entry keys span shards fail on the retry with ErrTSOTimestampPrePhaseD instead of probing PrevCommitTS. Keep the ReadTimestamp and bind/re-vouch the reuse dispatch.

Useful? React with 👍 / 👎.

Comment thread adapter/dynamodb_item_write.go
@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 (360418a):

  • distribution/catalog.go
  • distribution/catalog_test.go
  • kv/coordinator.go
  • kv/sharded_coordinator.go

What to check, by subsystem:

  • kv/hlc*.goNext() must respect the HLC-4 preconditions (i)/(ii)/(iii) from the design doc: bounded skew, logical-counter handoff on leader change (strategy (c) Observe(MaxAppliedHLC)), and the commit-time ceiling fence (fail-closed when wall_now >= physicalCeiling). Any change to the bit layout (48/16), the CAS loop, or the ceiling getter/setter is in scope.
  • kv/coordinator.go, kv/sharded_coordinator.goRunHLCLeaseRenewal, hlcRenewalInterval, hlcPhysicalWindowMs constants, and the new-term detection that calls Observe(fsm.MaxAppliedHLC()) (strategy (c)). 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. (M2 spec will land OCC-1..OCC-5; until then the spec doc §5.2 is the contract.)
  • kv/fsm.go — FSM apply of HLC lease entries (SetPhysicalCeiling), and any future MaxAppliedHLC() accessor that strategy (c) needs.
  • store/mvcc_store.go — version visibility, snapshot install, and the MVCC-1..MVCC-4 invariants (M3 scope).
  • 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@bootjp

bootjp commented Jul 23, 2026

Copy link
Copy Markdown
Owner Author

Evidence for current HEAD 360418a:

  • Bound applied-read vouchers to the ReadTimestamp dispatch capability instead of the numeric StartTS alone; an unbound direct Dispatch can no longer consume another request's voucher.
  • XADD and DynamoDB item-write dedup retry state now retains the ReadTimestamp and rebinds it for each reused dispatch.
  • S3 empty-store snapshots are normalized to startTS=1 before Phase-D validation, matching the existing safe empty-snapshot convention.
  • Caller audit covered VouchAppliedReadTimestamp implementers/forwarders, DispatchWithReadTimestamp, Redis XADD retry, DynamoDB item-write retry, S3 begin-read, and the startup coordinator decorator.

Validation:

  • go test ./kv -run "TestShardedCoordinatorDispatchTxn_PhaseDAcceptsBoundAppliedWatermark|TestDispatchWithReadTimestampVouchesEveryBoundDispatch|TestReadTimestampVoucherBindingShadowsParentCapability" -count=1
  • go test ./adapter -run "TestS3BeginTxnReadTimestampPhaseD|TestRedisXAdd(DedupPhaseDVouchesReuse|DedupsLandedWireWriteConflict|RetriesWireWriteConflict)|TestItemWriteDedup_(PhaseDVouchesReuse|PriorAttemptDidNotLand_Applies|LandedPriorAttempt_NoDuplicate)" -count=1
  • go test . ./adapter -run '^$' -count=1
  • golangci-lint --config=.golangci.yaml run ./... --timeout=5m --allow-parallel-runners
  • git diff --check

Full go test ./kv ./adapter was attempted; ./kv passed, while ./adapter hit its 10-minute integration-test timeout, consistent with prior broad adapter runs. Focused changed-path tests and compile/lint are green; current-head CI is running.

@codex review

@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 (f641453):

  • distribution/catalog.go
  • distribution/catalog_test.go
  • kv/coordinator.go
  • kv/sharded_coordinator.go

What to check, by subsystem:

  • kv/hlc*.goNext() must respect the HLC-4 preconditions (i)/(ii)/(iii) from the design doc: bounded skew, logical-counter handoff on leader change (strategy (c) Observe(MaxAppliedHLC)), and the commit-time ceiling fence (fail-closed when wall_now >= physicalCeiling). Any change to the bit layout (48/16), the CAS loop, or the ceiling getter/setter is in scope.
  • kv/coordinator.go, kv/sharded_coordinator.goRunHLCLeaseRenewal, hlcRenewalInterval, hlcPhysicalWindowMs constants, and the new-term detection that calls Observe(fsm.MaxAppliedHLC()) (strategy (c)). 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. (M2 spec will land OCC-1..OCC-5; until then the spec doc §5.2 is the contract.)
  • kv/fsm.go — FSM apply of HLC lease entries (SetPhysicalCeiling), and any future MaxAppliedHLC() accessor that strategy (c) needs.
  • store/mvcc_store.go — version visibility, snapshot install, and the MVCC-1..MVCC-4 invariants (M3 scope).
  • 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@bootjp

bootjp commented Jul 23, 2026

Copy link
Copy Markdown
Owner Author

Evidence for current HEAD f641453:

  • Reserved retired RaftAdminStatusResponse field numbers 12 and 13 so buf breaking accepts the deleted configuration_index and pending_conf_change fields.
  • Regenerated proto/service.pb.go to keep descriptors consistent with the reserved field declaration.
  • This is a wire-compatibility declaration only; no runtime semantics changed.

Validation:

  • buf breaking --against ../.git#subdir=proto,branch=buf-breaking-base
  • buf generate
  • go build ./...
  • go test ./cmd/raftadmin ./internal/raftadmin -count=1
  • git diff --check
  • commit signature verified locally for bootjp contact@bootjp.me

reviewThreads currently has no unresolved non-outdated findings. Current-head CI is running after the push.

@codex review

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

ℹ️ 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 thread adapter/redis_strings.go Outdated
elems := []*kv.Elem[kv.OP]{}
nextRemoved := 0
readTS := r.readTS()
readTS, err := r.beginTxnStartTS(ctx, "redis del: begin read timestamp")

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 Preserve Phase-D read vouchers for multi-key DEL

When Phase D is enabled and BeginReadTimestampThrough has to preserve a pre-Phase-D applied watermark, the usable authority is carried by the returned ReadTimestamp voucher, but this path keeps only the bare uint64 and later dispatches the accumulated deletes without DispatchWithReadTimestamp. For a single DEL containing two keys whose routes are both led by this process but belong to different shard groups, ShardedCoordinator takes the multi-shard path and rejects the bare pre-D StartTS as ErrTSOTimestampPrePhaseD instead of consuming a voucher; keep the ReadTimestamp bound through dispatch or restrict this helper to provably single-shard mutations.

Useful? React with 👍 / 👎.

Comment thread kv/tso.go
Comment thread adapter/s3_put_object.go
Comment thread kv/tso_raft.go
@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 (c8e3ada):

  • distribution/catalog.go
  • distribution/catalog_test.go
  • kv/coordinator.go
  • kv/sharded_coordinator.go

What to check, by subsystem:

  • kv/hlc*.goNext() must respect the HLC-4 preconditions (i)/(ii)/(iii) from the design doc: bounded skew, logical-counter handoff on leader change (strategy (c) Observe(MaxAppliedHLC)), and the commit-time ceiling fence (fail-closed when wall_now >= physicalCeiling). Any change to the bit layout (48/16), the CAS loop, or the ceiling getter/setter is in scope.
  • kv/coordinator.go, kv/sharded_coordinator.goRunHLCLeaseRenewal, hlcRenewalInterval, hlcPhysicalWindowMs constants, and the new-term detection that calls Observe(fsm.MaxAppliedHLC()) (strategy (c)). 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. (M2 spec will land OCC-1..OCC-5; until then the spec doc §5.2 is the contract.)
  • kv/fsm.go — FSM apply of HLC lease entries (SetPhysicalCeiling), and any future MaxAppliedHLC() accessor that strategy (c) needs.
  • store/mvcc_store.go — version visibility, snapshot install, and the MVCC-1..MVCC-4 invariants (M3 scope).
  • 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@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 (580c5b5):

  • distribution/catalog.go
  • distribution/catalog_test.go
  • kv/coordinator.go
  • kv/sharded_coordinator.go

What to check, by subsystem:

  • kv/hlc*.goNext() must respect the HLC-4 preconditions (i)/(ii)/(iii) from the design doc: bounded skew, logical-counter handoff on leader change (strategy (c) Observe(MaxAppliedHLC)), and the commit-time ceiling fence (fail-closed when wall_now >= physicalCeiling). Any change to the bit layout (48/16), the CAS loop, or the ceiling getter/setter is in scope.
  • kv/coordinator.go, kv/sharded_coordinator.goRunHLCLeaseRenewal, hlcRenewalInterval, hlcPhysicalWindowMs constants, and the new-term detection that calls Observe(fsm.MaxAppliedHLC()) (strategy (c)). 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. (M2 spec will land OCC-1..OCC-5; until then the spec doc §5.2 is the contract.)
  • kv/fsm.go — FSM apply of HLC lease entries (SetPhysicalCeiling), and any future MaxAppliedHLC() accessor that strategy (c) needs.
  • store/mvcc_store.go — version visibility, snapshot install, and the MVCC-1..MVCC-4 invariants (M3 scope).
  • 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@bootjp

bootjp commented Jul 23, 2026

Copy link
Copy Markdown
Owner Author

Evidence for current HEAD 580c5b5:

Addressed the latest Phase-D review findings:

  • Redis multi-key DEL now preserves the kv.ReadTimestamp voucher through dispatch instead of dropping it to a bare uint64 StartTS.
  • S3 PutObject keeps the prepared ReadTimestamp in the put state and commits through DispatchWithReadTimestamp for bucket/object cross-route mutations.
  • Prepared applied-read vouchers are revoked after dispatch, so startup/keyviz coordinator decorators cannot leak inner ShardedCoordinator voucher entries when an outer gate rejects before consumption.
  • Phase-D activation now forces a fresh data-group commit-floor read even when the TSO leader term was already initialized by an earlier reservation.

Caller audit:

  • beginTxnStartTS / beginTxnReadTimestamp callers were enumerated. The two current cross-route findings, Redis DEL and S3 PutObject, now keep voucher-bearing ReadTimestamp through dispatch.
  • VouchAppliedReadTimestamp forwarding was audited across ShardedCoordinator, Coordinate, keyviz labels, startup gate, and test stubs. Revocation now forwards through production decorators.
  • termCommitFloor callers were audited; the only caller now forces a fresh sample only for first Phase-D activation while keeping same-term caching for normal reservations.

Validation:

  • go test ./kv -run 'Test(DispatchWithReadTimestamp|ShardedCoordinatorDispatchTxn_PhaseD|RaftTSOAllocator(CommitsPhaseD|ResamplesCommitFloor|FencesAboveRestoredPhaseDFloor|InitializesEveryLeaderTerm))' -count=1\n- go test ./adapter -run 'Test(S3BeginTxnReadTimestampPhaseD|S3Server_PutObject|RedisDelRetriesWriteConflict|Redis_StreamMultiExecDel)' -count=1\n- go test ./... -run '^$' -count=1\n- golangci-lint --config=.golangci.yaml run ./... --timeout=5m --allow-parallel-runners\n- go test ./kv -count=1\n- git diff --check\n- commit signature verified locally for bootjp contact@bootjp.me\n\nResolved the current review threads for voucher rollback, S3 PutObject voucher dispatch, and Phase-D floor resampling. The Redis DEL thread became outdated after the fix. Current-head CI is running.\n\n@codex review

@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: 580c5b58f0

ℹ️ 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 thread adapter/s3.go
Comment thread adapter/s3_multipart_complete.go
Comment thread adapter/dynamodb_transact.go
Comment thread adapter/sqs_messages_batch.go
Comment thread adapter/sqs_messages.go
Comment thread adapter/sqs_messages.go
Comment thread adapter/redis_lua_context.go Outdated
Comment thread adapter/distribution_server.go
@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 (874a14f):

  • distribution/catalog.go
  • distribution/catalog_test.go
  • kv/coordinator.go
  • kv/sharded_coordinator.go

What to check, by subsystem:

  • kv/hlc*.goNext() must respect the HLC-4 preconditions (i)/(ii)/(iii) from the design doc: bounded skew, logical-counter handoff on leader change (strategy (c) Observe(MaxAppliedHLC)), and the commit-time ceiling fence (fail-closed when wall_now >= physicalCeiling). Any change to the bit layout (48/16), the CAS loop, or the ceiling getter/setter is in scope.
  • kv/coordinator.go, kv/sharded_coordinator.goRunHLCLeaseRenewal, hlcRenewalInterval, hlcPhysicalWindowMs constants, and the new-term detection that calls Observe(fsm.MaxAppliedHLC()) (strategy (c)). 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. (M2 spec will land OCC-1..OCC-5; until then the spec doc §5.2 is the contract.)
  • kv/fsm.go — FSM apply of HLC lease entries (SetPhysicalCeiling), and any future MaxAppliedHLC() accessor that strategy (c) needs.
  • store/mvcc_store.go — version visibility, snapshot install, and the MVCC-1..MVCC-4 invariants (M3 scope).
  • 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@bootjp

bootjp commented Jul 23, 2026

Copy link
Copy Markdown
Owner Author

Evidence for current HEAD 874a14f:

Addressed the latest voucher-preservation findings:

  • CreateMultipartUpload binds the voucher-bearing ReadTimestamp before the bucket/object transaction dispatch.
  • CompleteMultipartUpload carries the completion ReadTimestamp through DispatchWithReadTimestamp.
  • TransactWriteItems stores the ReadTimestamp with the prepared request and uses it for commit dispatch.
  • FIFO SendMessage, DeleteMessage, and ChangeMessageVisibility keep the ReadTimestamp through the OCC dispatch paths.
  • Redis Lua keeps the script ReadTimestamp on luaScriptContext until commit.
  • SplitRange forwards the catalog ReadTimestamp into the coordinator save path.

Caller audit:

  • Audited saveSplitResultViaCoordinator, buildTransactWriteItemsRequest/runTransactWriteAttempt, sendFifoMessage, loadMessageForDelete, loadAndVerifyMessage, newLuaScriptContext/commit, createMultipartUpload, and commitS3MultipartCompletionAttempt callers.
  • Audited BeginReadTimestampThrough / beginTxnReadTimestamp dispatch paths touched by the latest findings. Remaining raw Dispatch calls in the searched files are separate write paths, not the reported voucher-dropping paths.

Validation:

  • go test ./adapter -run '^TestDistributionServerSplitRange_PhaseDReadsAtValidatedAppliedWatermark$' -count=1
  • go test ./adapter -run 'Test(S3Server_.Multipart|DynamoDB_TransactWriteItems|Redis.Lua|Lua.|SQSServer_.(DeleteMessage|ChangeMessageVisibility|Fifo|FIFO|SendMessage)|DistributionServerSplitRange)' -count=1
  • go test ./... -run '^$' -count=1 -timeout=10m
  • golangci-lint --config=.golangci.yaml run ./adapter ./kv --timeout=5m --allow-parallel-runners
  • git diff --check
  • commit signature verified locally for bootjp contact@bootjp.me

@codex review

@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: 874a14f389

ℹ️ 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 thread adapter/s3.go
Comment thread adapter/s3_admin.go
Comment thread adapter/s3_admin_objects.go
Comment thread adapter/redis_lua_context.go Outdated
@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 (5587fd5):

  • distribution/catalog.go
  • distribution/catalog_test.go
  • kv/coordinator.go
  • kv/sharded_coordinator.go

What to check, by subsystem:

  • kv/hlc*.goNext() must respect the HLC-4 preconditions (i)/(ii)/(iii) from the design doc: bounded skew, logical-counter handoff on leader change (strategy (c) Observe(MaxAppliedHLC)), and the commit-time ceiling fence (fail-closed when wall_now >= physicalCeiling). Any change to the bit layout (48/16), the CAS loop, or the ceiling getter/setter is in scope.
  • kv/coordinator.go, kv/sharded_coordinator.goRunHLCLeaseRenewal, hlcRenewalInterval, hlcPhysicalWindowMs constants, and the new-term detection that calls Observe(fsm.MaxAppliedHLC()) (strategy (c)). 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. (M2 spec will land OCC-1..OCC-5; until then the spec doc §5.2 is the contract.)
  • kv/fsm.go — FSM apply of HLC lease entries (SetPhysicalCeiling), and any future MaxAppliedHLC() accessor that strategy (c) needs.
  • store/mvcc_store.go — version visibility, snapshot install, and the MVCC-1..MVCC-4 invariants (M3 scope).
  • 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@bootjp

bootjp commented Jul 23, 2026

Copy link
Copy Markdown
Owner Author

Evidence for current HEAD 5587fd53c162ff9f168ba88e274155a66bdc6cca:

Addressed the latest Phase-D read-voucher findings:

  • Public CreateBucket carries the voucher-bearing ReadTimestamp into DispatchWithReadTimestamp for the bucket meta/generation transaction.
  • AdminCreateBucket carries the same voucher into its bucket meta/generation transaction.
  • AdminPutObject keeps the read voucher until the final bucket/object manifest transaction dispatch.
  • Redis Lua now begins through the normal Redis transaction timestamp helper, so an empty snapshot is normalized to startTS=1 before Phase-D validation.

Caller audit:

  • Traced createBucket, AdminCreateBucket/adminCreateBucketTxn, AdminPutObject/adminPutObjectStream, newLuaScriptContext callers, and existing DispatchWithReadTimestamp patterns in S3, Redis Lua, multipart, and distribution paths.
  • The remaining raw Dispatch calls in the searched S3/Lua files are separate paths from the four latest findings.

Validation:

  • go test ./adapter -run 'Test(S3(CreateBucket|AdminCreateBucket|AdminPutObject)PhaseDBindsReadVoucher|RedisLuaBeginReadTimestampPhaseDNormalizesEmptySnapshotSentinel)' -count=1 -timeout=10m
  • go test ./adapter -run 'Test(S3Server_(CreateBucket|AdminCreateBucket|AdminPutObject)|Redis_Lua|Lua_)' -count=1 -timeout=10m
  • go test ./adapter -run '^$' -count=1 -timeout=10m
  • go test ./kv -count=1 -timeout=10m
  • go test ./... -run '^$' -count=1 -timeout=10m
  • golangci-lint --config=.golangci.yaml run ./adapter ./kv --timeout=5m --allow-parallel-runners
  • git diff --cached --check
  • commit signature verified locally for bootjp <contact@bootjp.me>

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 5587fd53c1

ℹ️ 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 merged commit ca1a812 into design/dedicated-tso-fsm Jul 23, 2026
8 checks passed
@bootjp
bootjp deleted the design/dedicated-tso-m7 branch July 23, 2026 15:15
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