Skip to content

Self-terminate after closed AIO scope refusal - #39

Draft
soulomoon wants to merge 2 commits into
codex/pr-5027-scope-ownershipfrom
codex/aio-self-terminate-closed-scope
Draft

Self-terminate after closed AIO scope refusal#39
soulomoon wants to merge 2 commits into
codex/pr-5027-scope-ownershipfrom
codex/aio-self-terminate-closed-scope

Conversation

@soulomoon

Copy link
Copy Markdown
Owner

Stacked on #38.

Summary

  • raise AsyncCancelled when a registered parent observes that a child was refused by a closed AIO scope
  • raise immediately when batch registration itself observes the closed scope
  • remove the interruptible sleep loop that waited for external cancellation
  • cover the nested refresh path that actually reaches closed-scope admission after PR Guard against leaking threads while restarting Shake #38's later inline-refresh changes

Why

PR #38 prevents refused children from starting their rule bodies, but the parent currently parks in waitForScopeCancellation until another thread cancels it. Once the parent has observed that its captured scope is closed, it can terminate itself immediately. Throwing AsyncCancelled also runs that parent's normal AIO exception cleanup, which cancels any admitted sibling work it still owns.

Regression

The new test first records two dependencies for a parent key, then publishes a lazy refresh tied to one build's AIO scope. A second build selects that refresh before the first scope closes and forces it afterward. The nested multi-spawn observes the closed scope, and the test requires the second build to finish by raising AsyncCancelled without external cancellation.

Validation

  • cabal test hls-graph:test:tests -fpedantic --test-show-details=direct --test-option=-p --test-option='/self-terminates when nested work/'
  • cabal test hls-graph:test:tests -fpedantic --test-show-details=direct
  • all 12 hls-graph tests passed
  • stylish-haskell pre-commit hook passed
  • git diff --check

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant