Isolate detached broker goroutines in cmd/ward tests #1630

Closed
opened 2026-07-31 08:57:55 +00:00 by coilyco-ops · 1 comment
Member

Problem

Repeated local go test ./cmd/ward -failfast runs fail in different pre-existing tests after detached dispatch-broker goroutines continue past test cleanup and observe process-global hooks or environment from later tests.

Observed while validating #1626:

  • TestStartHostDispatchBrokerRequestDecisionArtifactShape reached a fake Forgejo 503 instead of its launch stub.
  • A subsequent clean process passed that point and TestAgentListMarksPartialLaunchWhenReservationMarkerIsMissing observed running instead of partial-launch.
  • The focused generic-agent suite, build, lint, and repository pre-commit gates remain stable.

Acceptance

  • Broker tests wait for every detached worker they start before restoring globals.
  • Test-owned Forgejo endpoints, Docker hooks, stdio hooks, and launch hooks cannot escape test lifetime.
  • The full cmd/ward package passes repeatedly without order-dependent failures.

Follow-up from #1626. This is test isolation work, not a generic-agent transport change.

Headless execution boundary

Use repository tests and synthetic Forgejo, Docker, stdio, and launch hooks only. Do not connect to live Forgejo, launch real containers, or mutate live broker state for acceptance.

## Problem Repeated local `go test ./cmd/ward -failfast` runs fail in different pre-existing tests after detached dispatch-broker goroutines continue past test cleanup and observe process-global hooks or environment from later tests. Observed while validating #1626: * `TestStartHostDispatchBrokerRequestDecisionArtifactShape` reached a fake Forgejo 503 instead of its launch stub. * A subsequent clean process passed that point and `TestAgentListMarksPartialLaunchWhenReservationMarkerIsMissing` observed `running` instead of `partial-launch`. * The focused generic-agent suite, build, lint, and repository pre-commit gates remain stable. ## Acceptance * Broker tests wait for every detached worker they start before restoring globals. * Test-owned Forgejo endpoints, Docker hooks, stdio hooks, and launch hooks cannot escape test lifetime. * The full `cmd/ward` package passes repeatedly without order-dependent failures. Follow-up from #1626. This is test isolation work, not a generic-agent transport change. ## Headless execution boundary Use repository tests and synthetic Forgejo, Docker, stdio, and launch hooks only. Do not connect to live Forgejo, launch real containers, or mutate live broker state for acceptance.
Author
Member

Scope clarification approved by Kai on 2026-08-05.

#1634 is absorbed here as another symptom of the same command-package isolation problem. Its preserved evidence is one fully fresh-cache cmd/ward suite failure after 46.329 seconds during PR #1633 verification, followed without code changes by a fully uncached JSON run that passed. The failing test name was not retained, so no narrower root cause should be invented.

Extend acceptance for this issue with:

  • Run repeated cmd/ward package suites with a fresh Go cache each time.
  • Enable JSON output and retain failure-only records from the beginning of every repetition.
  • Prove no detached broker worker, process-global hook, environment mutation, temporary Git fixture, or first-build timing escapes its test lifetime.
  • If a post-fix fresh-cache run captures a distinct failing test, file that exact failure separately rather than reopening the evidence-only #1634.
Scope clarification approved by Kai on 2026-08-05. #1634 is absorbed here as another symptom of the same command-package isolation problem. Its preserved evidence is one fully fresh-cache cmd/ward suite failure after 46.329 seconds during PR #1633 verification, followed without code changes by a fully uncached JSON run that passed. The failing test name was not retained, so no narrower root cause should be invented. Extend acceptance for this issue with: * Run repeated cmd/ward package suites with a fresh Go cache each time. * Enable JSON output and retain failure-only records from the beginning of every repetition. * Prove no detached broker worker, process-global hook, environment mutation, temporary Git fixture, or first-build timing escapes its test lifetime. * If a post-fix fresh-cache run captures a distinct failing test, file that exact failure separately rather than reopening the evidence-only #1634.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
coilyco-flight-deck/ward#1630
No description provided.