Skip to content

feat(fleet-queue): define database-leg routing and replica interface - #12638

Merged
dezren39 merged 4 commits into
mainfrom
xaltha/fleet-queue-db-routing
Nov 22, 2026
Merged

dezren39 merged 4 commits into
mainfrom
xaltha/fleet-queue-db-routing

Conversation

@dezren39

@dezren39 dezren39 commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Summary

Pure routing contract for the database leg, closing the gap PR #12601
left open: it defines the route order and the replica interface the
#8583 Turso replica must satisfy, so the replica can be built against
a settled boundary instead of an invented one.

  • work::routing::DbRoute + ROUTE_ORDER: cloud →
    local-replica → github-markers, with stable route labels shared
    with the feat(fleet-queue): define degraded mode contract #12601 ModeLine.
  • route_for(LegAvailability) -> (Mode, DbRoute): pure selection.
    Database up keeps the cloud route and names the constraining GitHub
    leg; database down selects the replica, then the markers.
  • mode_line(verb, legs): the machine-readable mode line naming the
    route actually used (Fleet unification slice 3: fleet verb contract v2 — routes and degraded modes in the tool #8581 acceptance).
  • CoordinationReplica trait: claim / heartbeat / checkpoint /
    sync_up with ReconcileReport (synced_claims, lost_claims,
    double_claims). A claim honored locally is honored globally;
    partition double-claims are reported, never silently merged.
  • MemoryReplica: in-memory reference implementation + drill stand-in,
    with a caller-supplied clock so lease expiry is deterministic.

Decision recorded (FDR-0013; #12601 left multi-leg precedence open):
for coordination verbs the database leg dominates the GitHub legs — a
verb routed through the replica reports db-degraded even when a
GitHub leg is also down — and among GitHub legs, writes dominate reads.

No adapters are wired and no Turso code is added here; the next slice
implements CoordinationReplica for the embedded replica and routes
the claim/lease/heartbeat verbs through route_for.

Refs #8581 #8583. Task 21043 (combined #8581/#8583/#8584) is parked;
no competing PR covers this slice.

Evidence

  • New module pkgs/fleet/crates/fleet-queue/src/work/routing.rs
    (16,837 bytes, sha256
    18c07fefa9c59686178c46800e3233f453725b2b979216cbc8ccb84d71df5296)
    plus one pub mod routing; line in work/mod.rs. 10 tests in
    work::routing::tests: route-order matrix, precedence, mode-line
    JSON, replica claim/heartbeat/checkpoint/sync, second-claim
    conflict, expired-lease reclaim, double-claim surfacing.
  • Not run on the laptop yet: the fleet-shell leg was down at PR
    time (broker tunnel to the laptop 100.99.113.103:4799 returned
    HTTP 502, ~17:40Z), so this relies on CI for the first
    compile/test run. The command the next lane runs on the laptop is:
    cargo test --manifest-path pkgs/fleet/Cargo.toml -p fleet-queue --lib --features client,queue-broker work::routing::tests
    (same shape as feat(fleet-queue): define degraded mode contract #12601's verification), plus cargo fmt --manifest-path pkgs/fleet/Cargo.toml --package fleet-queue --check
    and git diff --check.

Merge Danger

Pure additive module plus one module-registration line; nothing calls
it yet, so no behavior changes. Revert-safe.


Get evidence
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 22, 2026 17:25
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 26 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fbac7889-7160-400a-9f6e-9d1373585f88
Commits

Reviewing files that changed from the base of the PR and between 9b88acf and e172b13.

Files selected for processing: 2

  • pkgs/fleet/crates/fleet-queue/src/work/mod.rs
  • pkgs/fleet/crates/fleet-queue/src/work/routing.rs
  • 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

@chatgpt-codex-connector

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

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T19:15:40.109203Z e172b13 New commits
ℹ️ 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: a5325e3a64

ℹ️ 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".

…plica leases, model-based replica coverage

- Preserve caller lane identity in replica lease operations: heartbeat
  and checkpoint now take the caller's lane alongside the worker, and
  require_held enforces (worker, lane) jointly, so a foreign lane
  sharing repo-worker-code can no longer extend the owning lane's lease
  or overwrite its checkpoint. Mirrors the cloud boundary enforced via
  claimed_by / foreign_lane_claim in turso_queue/lifecycle.rs.
  Covered by memory_replica_heartbeat_and_checkpoint_require_the_owning_lane.
- Cover replica invariants with generated operation sequences: a
  ModelReplica oracle steps in lockstep with MemoryReplica over
  generated claim/heartbeat/checkpoint/sync_up/cloud-inject/clock-move
  sequences, comparing every outcome plus a final reconciliation, so
  single-writer, lease-expiry, lane-isolation, and reconciliation
  invariants are checked against an explicit model. proptest 1.12 is
  already a fleet-queue dev-dependency.

Verified in this seat by rustfmt parse (no new formatting diffs beyond
the file's pre-existing ones); no local rustc here, so CI is the first
compile/test run.
@dezren39

Copy link
Copy Markdown
Member Author

Codex review round answered (2026-11-22 ~12:50 CST): both open threads are fixed in 7d3cb42 and resolved.

  • Replica invariants with generated operation sequences: new ModelReplica oracle + proptest over generated claim/heartbeat/checkpoint/sync/cloud-inject/clock sequences, comparing every outcome and a final reconciliation.
  • Caller lane identity in replica leases: heartbeat/checkpoint now take lane and require_held enforces (worker, lane) jointly; covered by a dedicated lane-isolation test plus the model test.

Remaining merge blockers: none from review threads (0 unresolved). CI is the first compile/test run for the new Rust code (no local rustc in this seat); checks pending on the new head.

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

ℹ️ 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".

@dezren39
dezren39 merged commit 039ffe3 into main Nov 22, 2026
2 checks passed
@dezren39
dezren39 deleted the xaltha/fleet-queue-db-routing branch November 22, 2026 21:08
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