Skip to content

Give each TestBuilder row one cleanup owner instead of hand-threaded event ownership #7379

Closed

Description

@thomhurst

Summary

TestBuilder still passes class-row cleanup ownership between fetches, temporary instances and executable tests by hand. Introduce an explicit cleanup owner so each row has one clear hand-off and cleanup happens once, including rows that never become executable tests.

The prerequisites have shipped: #7381 delivers per-row builder-context events, #7327 removes the unused streaming builder, #7373 isolates discarded method-row lifecycle subscriptions, and #7383 preserves session ownership of scopes lent to temporary instances. Preserve those behaviors while replacing the remaining manual cleanup hand-offs in UnclaimedClassRow.

Proposal

Use a small row-cleanup owner with one claim and idempotent asynchronous release. Pass it with the row and release unclaimed owners in finally. Keep method and class rows' cleanup separate so discarded method subscriptions cannot become constructor subscriptions. Cleanup for a rejected method row must use that row's state. Keep temporary-instance constructor scopes alive until session end when later method rows still borrow them.

Acceptance criteria

  • An explicit owner replaces manual event take/return/lend hand-offs, with exactly-once cleanup on success, incompatible rows and discovery failures.
  • Class-row subscriptions survive reuse; discarded method-row subscriptions do not reach subsequent tests' lifecycle events.
  • Release cleanup when an empty method source produces no test and does not request a skipped placeholder.
  • Preserve per-test retry lifetimes and the session lifetime of scopes lent to temporary instances.
  • Validate relevant _7205 and _7210 regressions in source-generated and reflection modes; add focused cleanup ownership tests.

Activity

  1. added
    enhancementNew feature or request
    P3Low: cleanup, minor enhancement, or rare edge case
    on Nov 2, 2026
  2. thomhurst commented on Nov 2, 2026

    @thomhurst
    OwnerAuthor

    Triage: replaced the broad #7205 dependency with #7381, keeping #7327. Updated the proposal to match replacement PR #7384 rather than the abandoned #7328 helpers and tests. Session-lifetime behavior remains a coordination requirement with #7383, not a reason to block on the entire parent.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low: cleanup, minor enhancement, or rare edge caseenhancementNew feature or requestin-progressWork is in progress

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions