Skip to content

test(stovepipe): add build-slow marker to the fake build runner - #464

Open
behinddwalls wants to merge 1 commit into
mainfrom
preetam/stovepipe-fake-slow-build
Open

test(stovepipe): add build-slow marker to the fake build runner#464
behinddwalls wants to merge 1 commit into
mainfrom
preetam/stovepipe-fake-slow-build

Conversation

@behinddwalls

@behinddwalls behinddwalls commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

Why?

The fake build runner never reports a non-terminal status — Status decides purely from the build id and always returns succeeded, failed, or an error. That means no integration or e2e stack can reach buildsignal's reschedule branch, so the entire poll loop is exercised only by unit tests with mocked publishers. A defect in the reschedule path is invisible above the unit layer.

What?

Adds a build-slow marker. Trigger encodes a ready-at wall-clock instant into the build id (fake-build-slow-<readyAtMs>-<suffix>) and Status reports running until that instant passes, then succeeded. Encoding the deadline in the id preserves the fake's stateless, decide-purely-from-the-id property, so Trigger and Status can still live in different processes. SlowBuildDurationMs is a package var so tests can tune it.

Also widens marker() to end a token at / as well as & and #. The fake SourceControl builds head URIs as git://<queue>/HEAD, so a marker injected through a queue name sits mid-URI and would otherwise be read as build-slow/HEAD. Existing markers sit at the end of a URI and are unaffected.

No pipeline behaviour changes; this only makes a previously unreachable path reachable in tests.

Test Plan

bazel test //stovepipe/... — covers build-slow reporting running then succeeded, the no-deadline fallback, and marker() against trailing path segments, query separators, and end-of-URI.

Stack

  1. @ test(stovepipe): add build-slow marker to the fake build runner #464
  2. fix(stovepipe): mint a distinct message id for each buildsignal re-poll #465
  3. refactor(stovepipe): replace recorded greenness states with build outcomes #466
  4. feat(stovepipe): record the build outcome on the request and free its slot #467
  5. feat(stovepipe)!: key the record stage on the request id #468
  6. fix(stovepipe): stop wrapping the buildsignal re-poll publish as retryable #469

## Summary

### Why?

The fake build runner never reports a non-terminal status — `Status` decides purely from the build id and always returns succeeded, failed, or an error. That means no integration or e2e stack can reach `buildsignal`'s reschedule branch, so the entire poll loop is exercised only by unit tests with mocked publishers. A defect in the reschedule path is invisible above the unit layer.

### What?

Adds a `build-slow` marker. `Trigger` encodes a ready-at wall-clock instant into the build id (`fake-build-slow-<readyAtMs>-<suffix>`) and `Status` reports `running` until that instant passes, then `succeeded`. Encoding the deadline in the id preserves the fake's stateless, decide-purely-from-the-id property, so `Trigger` and `Status` can still live in different processes. `SlowBuildDurationMs` is a package var so tests can tune it.

Also widens `marker()` to end a token at `/` as well as `&` and `#`. The fake SourceControl builds head URIs as `git://<queue>/HEAD`, so a marker injected through a queue name sits mid-URI and would otherwise be read as `build-slow/HEAD`. Existing markers sit at the end of a URI and are unaffected.

No pipeline behaviour changes; this only makes a previously unreachable path reachable in tests.

## Test Plan

✅ `bazel test //stovepipe/...` — covers `build-slow` reporting running then succeeded, the no-deadline fallback, and `marker()` against trailing path segments, query separators, and end-of-URI.
@behinddwalls
behinddwalls force-pushed the preetam/stovepipe-fake-slow-build branch from cdcb128 to 48e5f92 Compare July 30, 2026 07:51
// before succeeding. A var (not a const) so tests can shorten it; the local stack
// always uses the default. It must be long enough for the caller's poll loop to
// observe at least one non-terminal status.
var SlowBuildDurationMs int64 = 3000

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An exported var just to be overridden by tests is a bit of an anti-pattern. We control the runner implementation below, so why not just set a default value New() and let tests set the struct field manually when needed.

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.

2 participants