Skip to content

test: add explicit owned deadlines for cooperative Effect tests - #617

Merged
agenteinstinct1-max merged 2 commits into
dev-vibecodedfrom
fix/owned-test-deadline
Oct 25, 2026
Merged

agenteinstinct1-max merged 2 commits into
dev-vibecodedfrom
fix/owned-test-deadline

Conversation

@agenteinstinct1-max

Copy link
Copy Markdown
Collaborator

Issue for this PR

Refs #609. Partial opt-in test harness prevention only. Keep the issue open for remaining hook, Promise and cleanup ownership gaps.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Add an explicit owned-deadline test API for cooperative, already-provided Effect work. Opt-in live tests bind the same validated, immutable deadline/host-timeout/cleanup-headroom snapshot to Bun registration and execution. The deadline wraps the complete isolated provided/scoped execution, including layer acquisition and finalization. Existing callers and the shared runner are unchanged.

A wall-clock AbortController triggers interruption independently of TestClock. runPromiseExit joins asynchronous finalizers before settling. The deadline is a cancellation trigger, not a finalizer settlement guarantee. Slow, hanging or uninterruptible cleanup can still overrun the host budget. Bun hooks and underlying signal-less Promises are outside this ownership contract. CLI bootstrap tests are deliberately not migrated without cooperation evidence. This does not close #609 or establish the cause of any historical failure.

Own the simple child fixtures used by regression tests with an explicit timer, kill and join in finally. This is not a general process-tree supervisor or a guarantee for SIGTERM-resistant descendants. No existing CI budget is raised; only the new parent regression test declares its own timeout/headroom.

How did you verify your code works?

10 tests / 45 assertions pass locally. Matched child tests prove owner-triggered interruption rather than Bun timeout, followed by named next-test assertions that layer/body or layer-acquisition finalizers completed. Tests also cover TestClock independence, fast success/failure identity, cleared timers, invalid budgets, immutable budget snapshots, slow finalizers, signal-less Promise late work, and timed-out child kill/join.

The baseline private reproduction times out at Bun's host boundary while the next test still sees active global state. No environment-reset substitute is used. Independent prepublication review covered the complete seven-file candidate and its bounded claims. Fresh exact-head CI and independent review are required, including Windows child-process behavior.

Screenshots / recordings

No UI claim. Test harness changes only.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@kilo-code-bot

kilo-code-bot Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 file)
  • packages/opencode/test/lib/owned-deadline-runner.test.ts - Added test for collection failure cleanup; existing implementation already handles it correctly
Previous Review Summary (commit 2c6eefc)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 2c6eefc)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (7 files)
  • packages/opencode/test/lib/effect.ts
  • packages/opencode/test/lib/fixtures/owned-acquisition.ts
  • packages/opencode/test/lib/fixtures/owned-cooperative.ts
  • packages/opencode/test/lib/owned-deadline-child.ts
  • packages/opencode/test/lib/owned-deadline-runner.test.ts
  • packages/opencode/test/lib/owned-deadline.test.ts
  • packages/opencode/test/lib/owned-deadline.ts

Reviewed by free · Input: 46.9K · Output: 2.6K · Cached: 304.2K

@agenteinstinct1-max
agenteinstinct1-max merged commit be6c5bd into dev-vibecoded Oct 25, 2026
6 checks passed
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