Skip to content

test(maestro): fix resumes and size lifecycle waits to case tests - #726

Closed
Sarath1018 wants to merge 6 commits into
mainfrom
sarath/fix-lost-resume-race
Closed

test(maestro): fix resumes and size lifecycle waits to case tests#726
Sarath1018 wants to merge 6 commits into
mainfrom
sarath/fix-lost-resume-race

Conversation

@Sarath1018

@Sarath1018 Sarath1018 commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Re-lands the pause/resume fix from #693 (closed unmerged) and hardens the maestro suites against fixture death and tenant instance growth.

  • Lost-resume race (the expected 'Paused' to be 'Running' flake): a resume issued while the pause is still settling is accepted but can be lost — the test now re-issues the resume when the status settles on Paused.
  • Fixture health-check: the seeded Running.Case instance can fault on its own (observed live); resolveRunningInstance re-verifies its status on every use and seeds a replacement when it is no longer Running.
  • Reuse before seeding, all fixtures: Running.Case scavenges an existing Running instance (interrupted runs leave them Running indefinitely), the timer case reuses a Completed leftover (also zero reopen wait), matching the pattern the faulted retry fixture already uses. Terminal instances cannot be deleted via API, so creation is the only growth lever — steady-state creation drops to one instance per consuming test.
  • Wait sizing: cancel 120s (its poll alone spans ~40–60s), reopen completion 180s (matches the retry fault wait), per CI-observed tails.

Verified green in both init modes.

🤖 Generated with Claude Code

Sarath1018 and others added 2 commits September 9, 2026 16:42
The pause/resume test asserts resume was accepted, then waits for the instance
to report Running again. That Paused->Running propagation typically lands in
~5s but has been observed to exceed the previous 20s window under tenant load,
failing the test on a transition that was already in flight. Widen the wait to
60s (poll exits as soon as Running is reached, so healthy runs are unaffected).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- pause/resume: a resume issued while the pause is still settling (Pausing) is
  accepted but can be lost — the pause completes afterwards and wins, leaving
  the instance Paused (observed live). Re-issue the resume when the status
  settles on Paused without running again; idempotent and race-free from Paused.
- cancel: the wait-for-Running poll alone spans up to 60s, equal to the old
  test timeout — CI timed it out at exactly 60s. Ceiling raised to 120s.
- reopen: the timer fixture completes in ~45s idle but CI-load stalls exceed
  120s; the completion wait now uses the same 180s ceiling as the retry test's
  equivalent fault wait.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Sarath1018
Sarath1018 requested a review from a team September 9, 2026 11:14
@claude

claude Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

✅ No issues found. Checked for bugs and CLAUDE.md compliance.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@claude

claude Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

✅ No issues found. Checked for bugs and CLAUDE.md compliance.

@Sarath1018 Sarath1018 changed the title test(maestro): re-issue lost resumes and size lifecycle waits to observed tails test(maestro): fix resumes and size lifecycle waits to case tests Sep 9, 2026
The seeded Running.Case instance can die on its own between tests (observed
live: a transient platform fault moved it Running->Faulted, making the next
pause fail with "Faulted->Pausing is not a valid state transition").
resolveRunningInstance now re-checks the fixture's status on every use and
seeds a replacement when it is no longer Running; sendMessage and close get
120s ceilings to cover the potential re-seed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@claude

claude Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

✅ No issues found. Checked for bugs and CLAUDE.md compliance.

Extends the reuse-before-seed pattern (already used for the faulted retry
fixture) to the remaining two fixtures, since terminal instances cannot be
deleted via API and creation is the only growth lever:

- Running.Case: scavenge an existing Running instance before starting one —
  interrupted runs leave them Running indefinitely (the human task never
  completes), so they otherwise stack as open cases in the tenant.
- Timer case: reuse a Completed instance from an interrupted run before
  starting one; an existing Completed instance also gives the reopen test a
  zero-second wait.

Steady-state creation drops to one instance per consuming test (close,
reopen, retry) — tests that terminate their subject by definition — and
interrupted-run leftovers become the next run's fixtures instead of debris.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@claude

claude Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

✅ No issues found. Checked for bugs and CLAUDE.md compliance.

@sonarqubecloud

Copy link
Copy Markdown

…he entity-methods block

The Entity-level methods block re-fetched the entity via getById inside
every test, so each write test's 30s budget covered two round-trips —
doubling its exposure to alpha's gateway stalls — and its write tests
were left at the default 30s when the suite's other DF write paths were
sized to 90s. Fetch the entity once in beforeAll (still exercising the
getById→bound-methods path) and give the four write tests 90s budgets;
reads keep the default.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@claude

claude Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

✅ No issues found. Checked for bugs and CLAUDE.md compliance.

@Sarath1018

Copy link
Copy Markdown
Collaborator Author

Consolidated into #729. All six commits from this branch were cherry-picked there unchanged (verified file-by-file identical), alongside the join/valueList fix that this branch needed in order to pass — its join tests failed deterministically without it once the shared fixture grew past one page. Closing in favour of the single PR; branch kept in case anything needs to be recovered.

@Sarath1018 Sarath1018 closed this Sep 11, 2026
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.

2 participants