Skip to content

webapi-test 0.5.0.0: a cut case is recorded, and a run's allocation budgets (zenbridge #2730) - #53

Merged
mageshb merged 1 commit into
masterfrom
feature/2730-cut-case
Nov 17, 2026
Merged

mageshb merged 1 commit into
masterfrom
feature/2730-cut-case

Conversation

@mageshb

@mageshb mageshb commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

webapi-test 0.5.0.0, for zenbridge #2730 (a Preflight run inside the platform): a run stopped part-way still says where, and a run's allocation can be budgeted.

A cut case is recorded (breaking: CaseOutcome gains Cut, RunTrace gains cut).

  • The problem: a run stopped while a case is open, by its time or allocation limit or its thread cancelled, never reaches QuickCheck's end-of-case callback, so the case vanished from the trace.
  • The fix: closeCut rec why, called once the run has stopped, closes the case from the steps already pushed. It's recorded as cut, at its last step (the move it reached), its moves ending with the one it was in, and its steps kept in RunTrace.cut.

Allocation budgets, a case's and a move's (Test.WebApi.Budget).

  • How: withCaseBudget AllocBudget {perCase, perMove}, around the runner that plays a case, arms GHC's allocation limit on the case's thread. Each move, as it begins (MoveBegin's perform), gets its own budget or what the case has left, whichever is less.
  • What happens over budget: the case or move gets AllocationLimitExceeded, which nothing on the way catches.
  • What it counts: only the case's own thread. A host that runs an application in process puts that work on a thread of its own.

Tests: moves 23/23, adding:

  • a run cut by its time limit while a move waits, where the cancel gets through and the case is cut at its last step in the move it was in;
  • a move over its budget;
  • a case over its budget at a later move;
  • light moves within both.

🤖 Generated with Claude Code

https://claude.ai/code/session_011wn1pGkP2oCTsWbhEafdF2

…udgets (zenbridge #2730)

- CaseOutcome gains Cut and RunTrace gains cut: closeCut closes the case a
  run was stopped in (time or allocation limit, thread cancelled) from the
  steps already pushed, at its last step, its moves ending with the one it
  was in. QuickCheck's end-of-case callback never fires for such a case, so
  it used to vanish from the trace.
- Test.WebApi.Budget: withCaseBudget arms GHC's allocation limit on the
  case's thread; each move, as it begins (MoveBegin's perform), gets its own
  budget or the case's remainder, whichever is less.
- moves: a run cut by its time limit while a move waits (the cancel gets
  through, the case is cut at its last step in the move it was in); a move
  over its budget, a case over its budget at a later move, light moves
  within both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011wn1pGkP2oCTsWbhEafdF2
@mageshb
mageshb merged commit aa98aa8 into master Nov 17, 2026
0 of 5 checks passed
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