Skip to content

Navigation Menu

Sign in
Sign up

test(relay): make mesh demo test use production's directory lease - #7402

Open
rebekz wants to merge 1 commit into
block:main from
kafi-labs:upstream-fix/mesh-demo-production-lease
Open

test(relay): make mesh demo test use production's directory lease #7402
rebekz wants to merge 1 commit into
block:main from
kafi-labs:upstream-fix/mesh-demo-production-lease

Conversation

@rebekz

@rebekz rebekz commented Sep 6, 2026

Copy link
Copy Markdown

Problem

mesh_demo::demo_join_forwarded_arm_round_trips_echo fails with a 504 under load and passes in isolation — a timing race, not a logic bug.

The test helper builds its SessionDirectory with a test-only 5-second lease override, while run_demo_join's echo timeout is 10 seconds and the demo join intentionally does not renew. The lease therefore expires mid-wait and the echo can never arrive in time. The detached owner task hides the fence expiry, so it surfaces as an opaque 504.

Adding tracing changed the scheduling enough for the same test to pass in 0.01s, which confirms the race.

Fix

Drop the test-only override and construct the directory exactly as production does:

mesh_boot.rs:720 SessionDirectory::new(pool) <- production
mesh_demo.rs:176 SessionDirectory::new(pool) <- now the test

SessionDirectory::new delegates to with_lease_ttl(pool, DEFAULT_LEASE_TTL) where DEFAULT_LEASE_TTL = 30s (tunnel/directory.rs:15,191).

Note this deliberately makes the test faithful rather than merely tolerant — inflating the TTL to some larger number would have widened the race window instead of removing the premise. The test was exercising a lease configuration production never uses.

Verification

Isolated test passes, exit 0. No production code changed — the diff is confined to #[cfg(test)] mod tests.

🤖 Generated with Claude Code

Stabilize the upstream test from ccb021d/block#1670 by using the same 30-second SessionDirectory default as production instead of a 5-second lease shorter than the 10-second echo timeout.
Signed-off-by: Fitra Kacamarga <fitra.19@gmail.com>
rebekz requested a review from a team as a code owner September 6, 2026 01:16

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

🔐 Codex Security Review

Status: review required for the current range.

The current range is 3c7f288c60d67df78577b237e27c3dfc8831aaa1...54fd3ba988a441b46ae74bfd98aa33ae45d982df.
A new review must complete for this exact range. When manual authorization
is required, a Block organization member must comment exactly
@buzz-security-review 54fd3ba988a441b46ae74bfd98aa33ae45d982df to authorize a new review.
Any previous review applies only to its recorded range.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /