Skip to content

test(managed-oauth): give device login completion a load-tolerant budget - #2233

Merged
eric8810 merged 1 commit into
mainfrom
dim/2232-managed-oauth-wait
Nov 26, 2026
Merged

eric8810 merged 1 commit into
mainfrom
dim/2232-managed-oauth-wait

Conversation

@eric8810

Copy link
Copy Markdown
Collaborator

Summary

Three managed_oauth_flow tests waited for the device attempt to leave Pending with a 3 s guard:

tokio::time::timeout(Duration::from_secs(3), async {
    while grok.attempt_status(begin.attempt_id).await.unwrap() == AttemptStatus::Pending {
        tokio::time::sleep(Duration::from_millis(10)).await;
    }
})

The completion deadline is not what these tests assert; they assert the completed login and the requests that follow. Under whole-suite load the exchange can take longer than 3 s, and this produced repeated unrelated failures in PR #2229's verify.

The three copies now call one wait_for_login helper with a 30 s test budget and the existing message. No product code or assertion changes.

Fixes #2232. Part of #2217.

Design rule checklist

  • Scope: n/a — test-only change; no part, state or lifecycle.
  • Commands and results: n/a — no module state changes.
  • Handover: n/a — no handover points.
  • Timeline before callbacks: n/a — no Timeline writes.
  • Infrastructure: n/a — Timeline, Dispatcher, assembly and facades unchanged.
  • Core mechanisms: n/a — no plugin-specific handling.
  • Batch: n/a — no facts are written.
  • Context: n/a — no context inputs.
  • No reading another plugin's internal state: n/a.
  • Cross-language faces: n/a — no service or face changes.
  • Business configuration: n/a — no loader rows.
  • Missing mechanism capabilities: n/a.
  • Timeline facts: n/a.

Documentation

  • No accepted ADR is modified or deleted.
  • No other module's design is changed.
  • No delivery status is added to an ADR, index or roadmap.

Verification

  • managed_oauth_flow::managed_provider_selection_http_recovery_and_restart_flow — passed twice.
  • managed_oauth_flow::the_managed_grok_route_takes_only_the_native_xai_image_formats — passed twice.
  • cargo clippy --locked -p dim-app-server --test app_server_flow -- -D warnings — passed.
  • cargo fmt --all -- --check — passed.

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

Approved at 1c305c3. No findings.

The net diff against origin/main a8d84e9 is one test file, crates/dim-app-server/tests/managed_oauth_flow.rs (+15/-21). A wait_for_login helper replaces the three copies of the 3 s guard that waited for a device attempt to leave Pending after the token response. The helper keeps the same poll loop and the same failure message and bounds the wait at 30 s; the tests still assert the completed login and the requests that follow. No product, fixture or assertion change.

Checks:

  • The three old guards are gone; wait_for_login (crates/dim-app-server/tests/managed_oauth_flow.rs:316-324) is the only completion wait. The remaining 3 s guards in the file are unrelated waits on started.notified() and disposal (:567, :578, :798).
  • A genuine stall still fails: the helper times out at 30 s with the existing message, and a non-Pending failure leaves the loop for the existing Completed or authenticated assertion to catch.
  • The 10 s token-response guards at :1021, :1401 and :1771 are unchanged. They wait for the fixture's token response, a different step from the completion wait this PR targets, so the narrower scope is right.
  • Merge-tree with origin/main a8d84e9 is clean (tree 299c911e695576226d69c43d2afbc04dd493db8b); the head's parent is a8d84e9, so the PR is based on current main.
  • cargo fmt --all -- --check passes.

Verification: targeted runs with the pinned 1.100.0 toolchain, an isolated home, TMPDIR, XDG and CARGO_TARGET_DIR under the review data directory, LC_ALL=en_US.UTF-8, and CARGO_NET_OFFLINE=true. Both affected tests pass at this head with --test-threads=1: managed_oauth_flow::managed_provider_selection_http_recovery_and_restart_flow (1 passed, 3.76 s) and managed_oauth_flow::the_managed_grok_route_takes_only_the_native_xai_image_formats (1 passed, 1.13 s).

CI at 1c305c3 (run 45805846631): changes and macos-native pass; verify (linux) is in progress; the other jobs skip on the path filter.

Verdict: APPROVE. This is a test-only flake fix: the wait is a guard, not the behaviour under test, and 30 s still fails a real stall well inside the job budget.

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

Approved at 1c305c3af633a94103cbf88089056bfdcd354a4c.

The test-only delta replaces three completion guards across two OAuth tests, without changing product behavior, the separate device-flow deadline checks, or the downstream assertions. The two affected tests and the dedicated device-flow test passed in exact Linux CI. That job separately failed two storage/startup tests outside the edited path; their underlying cause is unverified. ci-ok is red and still gates merge.

@eric8810
eric8810 merged commit 5591e80 into main Nov 26, 2026
@eric8810
eric8810 deleted the dim/2232-managed-oauth-wait branch November 26, 2026 11:31
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.

test(managed-oauth): give device login completion a load-tolerant budget

3 participants