Skip to content

feat: add test-scoped cleanup and context - #35

Merged
jeffatgametime merged 2 commits into
masterfrom
test-lifecycle
Sep 14, 2026
Merged

jeffatgametime merged 2 commits into
masterfrom
test-lifecycle

Conversation

@jeffatgametime

Copy link
Copy Markdown
Contributor

The following code makes an impact.

Purpose of Change

Make test-owned resource cleanup safe and reusable without introducing another test framework. First dependency in the approved api-tests authoring stack.

Ticket Link

N/A — approved acceptance-authoring architecture work.

Change Overview

  • Add optional testy.Cleanup and testy.Context capabilities without expanding TestingT or breaking existing custom implementations.
  • Run LIFO cleanup on return, fatal assertion, panic, and nested subtests; cancel the test context before cleanup and continue earlier callbacks after cleanup failures.
  • Keep native/hosted cleanup before AfterTest; document legacy hooks, custom-runner requirements, parallel behavior, and process-termination limits.

Affected Functionality

Native RunAsTest, hosted package execution, and callers adopting lifecycle helpers. Legacy Before/After hooks cannot acquire lifecycle-owned resources. No Temporal dependency or result-schema change.

Testing

  • go test -race ./... passed.
  • Both runners tested for normal/fatal/panic bodies, fatal/panic cleanup, nested registration, LIFO order and cancellation.
  • Actual RunAsTest/runPackage hook-order integration; native parallel child lifetime; parent cancellation and deadline inheritance.
  • Independent local review found an AfterTest ordering mismatch; fixed and re-reviewed.
  • git diff --check passed.

Observability

Cleanup errors contribute to existing test failure results and diagnostics rather than disappearing as successful tests.

Rollout

Review/merge this library PR before adopting/releasing the capability. The api-tests companion will pin this immutable branch commit during review and document the release dependency. User requested PR creation only; no merge or deployment is performed.

jeffatgametime and others added 2 commits September 9, 2026 09:52
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
@jeffatgametime

Copy link
Copy Markdown
Contributor Author

Final verification at 54d1dc03a8a9535cbb22846b8bac3e6b1889a330: Go checks and lint are green. Local race/lifecycle tests passed, including failure and native/hosted hook parity. The api-tests companion pins this exact immutable commit and passed the Temporal local-stack smoke plus latest staging acceptance on both foundation and migration PRs: https://github.com/gametimesf/api-tests/pull/212 and https://github.com/gametimesf/api-tests/pull/213 . No outstanding findings or review threads. Ready for required human review; GitHub still reports REVIEW_REQUIRED. Nothing merged or released.

@jeffatgametime
jeffatgametime merged commit d1ef37c into master Sep 14, 2026
2 checks passed
@jeffatgametime
jeffatgametime deleted the test-lifecycle branch September 14, 2026 13:28
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