Skip to content

test(platform-wallet): pin sync coordinator lifecycle behaviour - #6162

Merged
llbartekll merged 3 commits into
v5.2-devfrom
test/platform-wallet-sync-coordinator-lifecycle
Nov 25, 2026
Merged

llbartekll merged 3 commits into
v5.2-devfrom
test/platform-wallet-sync-coordinator-lifecycle

Conversation

@llbartekll

@llbartekll llbartekll commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Issue being fixed or feature implemented

The five periodic sync coordinators in packages/rs-platform-wallet/src/manager/ (identity, DashPay, DPNS, platform-address, shielded) each carry their own copy of the loop thread, the is_syncing slot, the admission preamble and the quiesce* family. A follow-up PR moves that shared lifecycle into one SyncLoop. This PR goes first and pins the current behaviour with tests, so the refactor can be shown to change nothing.

Coverage was uneven: dpns_sync.rs had no tests at all, and most lifecycle cases were tested on only one or two of the five copies.

What was done?

Tests only. The one change outside test modules is three #[cfg(test)] hooks per coordinator.

  • Uniform test hooks on all five coordinators: wedge_sync_slot_for_test, release_sync_slot_for_test, sync_admission_closed. Existing tests now go through them instead of the private is_syncing / quiescing fields, so they keep working when those fields move.
  • DPNS gets the full lifecycle set (it had none).
  • Every coordinator now pins: interval clamp and round trip; quiesce waiting for the slot; the timeout latch; refusal behind a busy slot (which stays with its owner) and behind a shut gate, with no timestamp and no event; held, overlapping and sealed drains; a start behind a latched gate resuming once the wedged pass drains; sync_now reopening a drained latch; stop then quick start; the first pass running at start; a second start being a no-op.
  • Completion events (platform-address, DPNS, shielded): fired once per pass, and dispatched before the slot is released.
  • sync_wallet: platform-address keeps two distinct refusal messages (slot busy, gate shut); shielded reports None for both, reads the coordinator before admission, and a pass cancelled before it produced anything is neither stamped nor reported.
  • The manager shutdown test also starts and joins the DPNS and shielded loops.

How Has This Been Tested?

On unchanged production code:

  • RUST_MIN_STACK=4194304 cargo test -p platform-wallet --features shielded manager:: — 255 passed, 0 failed (195 before this PR), repeated four times to check the time-based tests are stable.
  • cargo check -p platform-wallet --all-targets (without shielded)
  • cargo clippy -p platform-wallet --features shielded --tests -- -D warnings
  • cargo check -p platform-wallet-ffi --features shielded

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • My Rust, FFI, WASM, Swift or Kotlin changes follow the coding conventions
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed
  • If I added or changed GroveDB structure, I described it in the area's structure.rs, regenerated grovedb-structure.json, and checked the structure viewer link posted on this pull request
  • If I added or changed a system contract's document schemas, I checked the contract viewer link posted on this pull request

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

PR Hygiene · 1a6365b

  • Bots — thepastaclaw ✓
  • Self-review — posted; again after any push
  • Build green
  • Approvals — you own every area touched; none needed

When every merge requirement is met, the PR Hygiene check passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.

Characterization tests for the five periodic sync coordinators
(identity, DashPay, DPNS, platform-address, shielded), ahead of
sharing their loop, admission and drain code. No production change.

- All five coordinators get the same test hooks
  (`wedge_sync_slot_for_test`, `release_sync_slot_for_test`,
  `sync_admission_closed`); the existing tests go through them instead
  of the private `is_syncing` / `quiescing` fields, so they survive the
  fields moving.
- DPNS had no tests; it now has the full lifecycle set.
- Every coordinator now pins: interval clamp, quiesce waiting on the
  slot, the timeout latch, refusal behind a busy slot (which stays with
  its owner) and behind a shut gate, held / overlapping / sealed drains,
  start behind a latch, the drained latch reopening, stop then quick
  start, the first pass running at start, and a second start being a
  no-op.
- Completion events: fired once per pass and before the slot is
  released (platform-address, DPNS, shielded).
- `sync_wallet`: platform-address keeps two distinct refusal messages;
  shielded reports `None`, reads the coordinator before admission, and
  a pass cancelled before it produced anything is neither stamped nor
  reported.
- The manager shutdown test also starts and joins DPNS and shielded.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

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

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
  • 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

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Nov 23, 2026
@thepastaclaw

thepastaclaw commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Final review complete — no blockers (commit 1a6365b) · triage: normal

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Final validation — Phase 1 + Phase 2

This test-only PR expands lifecycle coverage for all five wallet sync coordinators, adds DPNS’s first coordinator tests, and extends the manager shutdown test to join the DPNS and shielded workers. Linux Rust wallet tests passed; Kotlin SDK CI failed on an unchanged generated parity summary, Swift SDK CI failed on a SQLite write lock in an unchanged migration test, and PR Hygiene is pending.

🟡 7 suggestion(s) | 💬 1 nitpick(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); reviewer 7: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 8: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 9: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 10: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — The diff adds substantial concurrency-sensitive lifecycle coverage across five coordinators, but changes only tests and test-only hooks, not production behavior.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity below 15% reserve: models 0% left), glm-5.3-flash (not used above high effort; tier asks max)
  • Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — security-auditor (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `packages/rs-platform-wallet/src/manager/dpns_sync.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/manager/dpns_sync.rs:548-578: The DPNS drain test can hang if it misses the slot’s 200 ms hold
  Impact: On a loaded runner, the wallet test job can stall or report a false failure even when `quiesce()` works correctly.
  The test can hang before reaching its two-second timeout. The spawned task releases the slot after 200 ms whether or not the test has observed it, so the unbounded readiness loop can miss the entire hold. Observing only the tail end can also let a correct drain finish during the 50 ms check. Claim the slot in the test, poll `quiesce()` once to verify that it is pending with admission closed, then explicitly release the slot and await the same future under a timeout. The inherited identity, DashPay, and platform-address tests use the same timer pattern.
- [SUGGESTION] packages/rs-platform-wallet/src/manager/dpns_sync.rs:722-742: The latch-retry test can pass without retrying or fail on an unchanged loop
  Impact: Depending on when the worker is scheduled, maintainers can miss a full-interval retry regression or see a false failure on the current code.
  The fixed 100 ms wait does not establish that the worker attempted a pass or chose its next interval: `is_running()` only checks for a registered cancellation token. A worker first scheduled after release can succeed on its first pass even if short retries are removed. If it loses the slot CAS but is paused until after release, its post-pass `reopen_if_drained()` can clear the latch and select the normal 60-second interval, exceeding the test’s five-second deadline. Use a bounded handshake after a refused pass and after the worker has selected its delay, then release the wedge before letting it continue. The identity, DashPay, platform-address, and shielded retry tests make the same scheduling assumption.

In `packages/rs-platform-wallet/src/manager/shielded_sync.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/manager/shielded_sync.rs:1147-1159: The shielded cancellation test hangs if the coordinator read moves before slot acquisition
  Impact: A maintainer who changes shielded admission order gets a stalled test instead of an assertion identifying the change.
  The five-second timeout cannot catch this ordering regression. The test holds the coordinator write lock while waiting for `is_syncing()`, so a pass that reads the coordinator before claiming the slot would wait for the very lock that the test releases only after seeing the flag. Poll the pinned pass directly while holding the write lock and assert that it is pending and already owns the sync slot before calling `stop()`.
- [SUGGESTION] packages/rs-platform-wallet/src/manager/shielded_sync.rs:1201-1215: The shielded refusal tests can pass even when `sync_wallet` enters the coordinator
  Impact: A refactor could admit a manual shielded sync during a drain or another pass without these tests detecting it.
  The closed-gate test stays green if `sync_wallet` skips its gate check. With no bound accounts, `coordinator.sync()` yields no wallet outcome, normal slot cleanup leaves `is_syncing()` false, and the live drain guard keeps admission closed. Those are the same observations the test makes on refusal. The busy-slot sibling likewise cannot detect coordinator work that bypasses admission without touching the owner’s flag. Add an offline coordinator-entry probe and verify that an admitted control reaches it but neither refused call does.
- [SUGGESTION] packages/rs-platform-wallet/src/manager/shielded_sync.rs:957-970: The shielded timestamp test passes when the manager overwrites the coordinator’s stamp
  Impact: A refactor can switch shielded completion timestamps to the manager’s clock without failing the test meant to preserve the coordinator’s timestamp.
  An unconditional overwrite still satisfies the test: the returned summary and stored timestamp both come from the manager after it has processed the coordinator result, and the completion count does not depend on the timestamp source. Feed the completion path a known nonzero coordinator stamp distinct from the fallback clock and assert that exact value in both outputs. Using two real-clock readings would still let the stamps coincide at one-second resolution.
- [SUGGESTION] packages/rs-platform-wallet/src/manager/shielded_sync.rs:1107-1120: The shielded shutdown tests miss a seal that becomes temporary after a drain timeout
  Impact: A refactor could let a fresh shielded pass start after a timed-out shutdown drain and still pass the lifecycle suite.
  The sealed test drains an idle coordinator, and the wedged test uses a non-sealing drain. A change that calls `seal()` only after a successful drain would pass both, leaving only a temporary latch on the timeout path. Mirror the other four coordinators: hold the slot through a sealed-drain timeout, assert that it reports failure, then release the slot and verify that a direct pass cannot reopen admission, stamp, or dispatch a completion.

In `packages/rs-platform-wallet/src/manager/identity_sync.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/manager/identity_sync.rs:1428-1438: The duplicate-start tests can pass when the second call replaces the worker
  Impact: A refactor can make redundant `start()` calls interrupt and restart a running sync loop without failing the tests meant to pin idempotence.
  The identity and DashPay tests cannot distinguish preserving the worker from cancelling and replacing it. The new worker satisfies `is_running()`, one stop cancels it, and the registry can reap the old worker without leaving a detached thread. DPNS, platform-address, and shielded also check for an extra completion, but a replacement can miss the 150 ms observation window or lose admission while the prior pass still holds the slot. Compare the registered worker generation or identity across the two calls rather than inferring it from teardown or callback timing.
- [NITPICK] packages/rs-platform-wallet/src/manager/identity_sync.rs:1279-1280: The identity retry comment describes a 15-second default instead of 60 seconds
  Impact: Readers comparing the identity test’s retry timing with the normal polling cadence are given the wrong default.
  The comment understates the normal identity interval by 45 seconds. `IdentitySyncManager` initializes the interval from `DEFAULT_SYNC_INTERVAL_SECS`, which is 60; 15 seconds is the default in the DashPay and platform-address siblings. Update the comment to match the identity default.

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Nov 23, 2026
@llbartekll

Copy link
Copy Markdown
Contributor Author

/self-reviewed

@github-actions github-actions Bot removed the waiting-self-review Waiting for the author to post /self-reviewed label Nov 24, 2026
llbartekll and others added 2 commits November 24, 2026 10:48
…istic

Review follow-up on the lifecycle characterization tests.

- The four "quiesce blocks until the in-flight pass drains" tests held
  the slot from a background task for a fixed 200 ms and waited for it
  with an unbounded loop, so a loaded runner could miss the window and
  hang. The test now holds the slot itself, polls `quiesce()` once to
  see it pending with admission shut, releases the slot and awaits the
  drain under a timeout.
- The shielded cancelled-pass test polls the pass by hand, so a pass
  that read the coordinator before claiming the slot fails an assertion
  instead of waiting on the lock the test holds.
- Shielded gets the sealed-drain-that-times-out test its four siblings
  already had.
- The shielded stamp test is renamed to what it can prove: both sides
  read the wall clock, so it cannot tell whose stamp was kept.
- The identity retry comment named a 15 s default; it is 60 s.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Nov 24, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-review — Final validation — Phase 1 + Phase 2

New on this head: The follow-up makes four wallet sync drain tests control slot release directly, makes shielded cancellation ordering observable, and adds a shielded test for sealing after a drain timeout. Production behavior is unchanged. The Linux Rust wallet tests and Swift and Kotlin SDK build/test checks passed on this head; PastaClaw review and PR Hygiene were pending.

🟡 5 suggestion(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

Still open from earlier rounds (3)

  • 🟡 Suggestion: The latch-retry test can pass without retrying or fail on an unchanged loop — packages/rs-platform-wallet/src/manager/dpns_sync.rs:718-738 (thread)
  • 🟡 Suggestion: The shielded refusal tests can pass even when sync_wallet enters the coordinator — packages/rs-platform-wallet/src/manager/shielded_sync.rs:1230-1244 (thread)
  • 🟡 Suggestion: The duplicate-start tests can pass when the second call replaces the worker — packages/rs-platform-wallet/src/manager/identity_sync.rs:1673-1689 (thread)
Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — The diff adds a substantial set of concurrency tests and test-only hooks across five coordinators without changing production behavior or any critical surface.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (lane failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `packages/rs-platform-wallet/src/manager/dpns_sync.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/manager/dpns_sync.rs:558-569: The rewritten drain tests can pass when `quiesce()` waits only one poll interval
  Impact: A maintainer can accidentally shorten the public drain budget to one poll interval without failing the test meant to verify that it waits for an in-flight pass.
  The rewrite removes the observation period while the slot is still occupied. If the public `quiesce()` wrapper passed a 20 ms budget instead of 10 seconds, the first poll could still suspend and the next poll would see the released slot before checking the deadline, returning success. The explicit-budget tests call `quiesce_within()` directly and would not catch that wrapper regression. Keep the test-owned slot, but use a paused Tokio clock and a short timeout on the pinned drain to verify it stays pending past the first 20 ms sleep before releasing the slot. The identity, DashPay, and platform-address rewrites use the same single-poll pattern.
- [SUGGESTION] packages/rs-platform-wallet/src/manager/dpns_sync.rs:718-738: The latch-retry test can pass without retrying or fail on an unchanged loop
  (carried; thread: https://github.com/dashpay/platform/pull/6162#discussion_r4671246457)

In `packages/rs-platform-wallet/src/manager/shielded_sync.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/manager/shielded_sync.rs:1132: The new shielded seal test hangs if the drain ignores its deadline
  Impact: If a refactor drops the sealed drain's deadline, the wallet test job can stall instead of reporting a failed assertion.
  The test owns the wedged slot and releases it only after `quiesce_sealed_within()` returns. The 50 ms argument is enforced by the code under test, so if that deadline is ignored, nothing in the test ends the wait. Add an independent outer timeout, as the neighboring non-sealed drain test does.
- [SUGGESTION] packages/rs-platform-wallet/src/manager/shielded_sync.rs:1230-1244: The shielded refusal tests can pass even when `sync_wallet` enters the coordinator
  (carried; thread: https://github.com/dashpay/platform/pull/6162#discussion_r4671246463)

In `packages/rs-platform-wallet/src/manager/identity_sync.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/manager/identity_sync.rs:1673-1689: The duplicate-start tests can pass when the second call replaces the worker
  (carried; thread: https://github.com/dashpay/platform/pull/6162#discussion_r4671246469)

@github-actions

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Nov 24, 2026
@llbartekll

Copy link
Copy Markdown
Contributor Author

/self-reviewed

@github-actions

Copy link
Copy Markdown
Contributor

Policy satisfied — this can merge.
Full checklist in the description.

@github-actions github-actions Bot removed the waiting-self-review Waiting for the author to post /self-reviewed label Nov 25, 2026

@romchornyi romchornyi 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.

✅ no blockers · no majors · 2 weak pins (agreeing with open bot threads) · 3 non-blocking recommendations — reviewed at 1a6365b779

Level Verdict
1 · Idea ✅ valid pinning the five coordinators' lifecycle before the SyncLoop refactor is the right order
2 · Architecture ✅ n/a production code is unchanged; the only non-test lines are three #[cfg(test)] hooks per coordinator
3 · Completeness ✅ complete all five coordinators now carry the lifecycle set, including DPNS, which had no tests
4 · Code ✅ clean no defects; two pins are weaker than they claim, and a few test-hygiene points

Two pins that would not catch the regression they name (both checked against the code; +1 to the open thepastaclaw threads, non-blocking)

  1. Duplicate start() in DashPay and identity —
    async fn should_ignore_start_when_loop_is_running() {
    and
    async fn should_ignore_start_when_loop_is_running() {
    — The tests would pass if the second start() cancelled and replaced the worker: the new one is running, one stop() cancels it, and the old one is reaped cleanly. DPNS, platform-address and shielded do tell the cases apart by checking that no second first pass ran. Since the point of this PR is to prove the refactor changes nothing, the hold_clearing approach the bot proposed looks worth taking here rather than relying on ThreadRegistry alone.
  2. Shielded refusal behind a shut gate —
    async fn should_return_none_when_admission_is_shut() {
    — With no bound wallet, an admitted pass also returns Ok(None), releases its slot and leaves the held guard's gate closed (exactly what asserts for the admitted case). Removing the quiescing.is_closed() bail from sync_wallet would leave this test green.
3 non-blocking recommendations
  1. Identity refusals do not check the returned summary —
    async fn should_skip_sync_now_while_slot_is_held() {
    — The identity refusal tests assert only last_sync_unix_seconds(); the other four coordinators also assert the returned summary's sync_unix_seconds == 0. A shared bail path that stamps the summary without storing it would pass here.
  2. Stale comment on the gate tests —
    // Raise the gate as an in-flight `quiesce()` would (a drain holds
    (same at
    // Raise the gate as an in-flight `quiesce()` would (a drain holds
    and
    // Raise the gate as an in-flight `quiesce()` would (a drain holds
    ) — It says the gate is raised "as an in-flight quiesce() would", but quiesce_held_within has already finished the drain when it returns. Either reword it or keep one test that closes the gate while the drain is still polling.
  3. Test hygiene (not verified):
    • Several loop tests (should_run_first_pass_immediately_after_start and the resume/reopen tests) end with stop()/quiesce() but never join the registry thread, so it can outlive the test's runtime. Ending with registry.shutdown().await + all_clean() would close that.
    • The stop-then-quick-start tests call start() from inside an async test, which can spin a runtime worker for up to 1 s while the old thread is reaped.
    • In the shielded tests built on empty_coordinator, the TempDir is dropped before the coordinator that holds tree.sqlite open.
    • In the shielded cancellation test, the stand-in pass releases its slot manually after cancelled().await instead of through a drop guard, so a panic leaves the slot held.
Review details

Triaged as test-only. I checked that every non-test hunk is a #[cfg(test)] hook. Levels 1–3 were done inline, and level 4 ran the general lane (/code-review high); no specialist lanes were needed. The weak-pin findings and recommendations 1–2 were checked against the code at the reviewed head.

🤖 Reviewed with Claude Code

@llbartekll
llbartekll merged commit 4bf2ca1 into v5.2-dev Nov 25, 2026
38 checks passed
@llbartekll
llbartekll deleted the test/platform-wallet-sync-coordinator-lifecycle branch November 25, 2026 10:58
@QuantumExplorer QuantumExplorer mentioned this pull request Nov 25, 2026
13 of 29 tasks
thephez pushed a commit to thephez/platform that referenced this pull request Nov 25, 2026
v5.2-dev gained dashpay#6162 (sync coordinator lifecycle tests) while v5.1-dev was
being merged. Two test modules conflicted with tests v5.1-dev added beside
them: both sets are kept, and the shielded sync test fixture v5.1-dev built
gets the two fields dashpay#6162 added to it.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
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.

3 participants