Skip to content

test(delegation): per-test sandbox for the budget registry via instance injection #1162

Open

Description

@jflowers

From PR #1157 review (uf-divisor, review 5918987253, comment 4584957936) — LOW severity, deferred from the feedback run by severity scope.

Finding

.opencode/test/delegation-budget.test.ts:42 (and the per-task suites in unleash-delegate.test.ts / uf-workflow.test.ts) register and clear delegation budgets on the module-global globalThis registry (registerDeadline / unregisterDeadline). Tests mutate shared singleton state and rely on afterEach cleanup for isolation, so ordering or interruption can leak registry entries across tests — a parallel or interrupted run can observe a stale budget.

Suggestion

Inject a per-test registry instance (dependency injection of the registry — the same seam pattern the capture readers already use) so each test owns its registry and no cross-test ordering dependence exists.

Context

  • The current afterEach(() => unregisterDeadline(...)) cleanup guards the leak in practice; this is hardening of the test isolation pattern, not a correctness bug in production code.
  • Severity LOW per the review; not changed in the feedback run (code scope reserved for CRITICAL/HIGH).

Filed from /uf.address-feedback 1157 triage (Item 3, decision: file).

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

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions