Skip to content

test(e2e): prove a dependent batch is woken by the merge ahead of it - #576

Merged
behinddwalls merged 1 commit into
mainfrom
preetam/messagequeue-e2e-dependent-wake
Aug 13, 2026
Merged

test(e2e): prove a dependent batch is woken by the merge ahead of it#576
behinddwalls merged 1 commit into
mainfrom
preetam/messagequeue-e2e-dependent-wake

Conversation

@behinddwalls

@behinddwalls behinddwalls commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

Why?

The parent change fixes a dropped wake-up: a merged batch fans out to speculate so its dependents can re-plan, and that message used to reuse the bare batch ID the batch controller had already published to the same topic and partition at creation. The queue deduplicates against rows it has not collected yet, consumed ones included, so the fan-out was reported as a success, stored nothing, and never arrived.

That fix shipped with unit coverage on the message ID and integration coverage on the queue semantics, but nothing exercised the path the bug actually broke. It is also a path that hides easily: any other event re-plans the queue and moves the dependent along, so a naive two-request test passes with or without the fix.

What?

A new e2e case isolates the fan-out as the only possible wake-up, following the stop → observe → start shape TestCancel_CaughtPreBatch_NeverLands already uses:

  1. Close the runway-merge gate for the queue before landing, so the lead batch cannot complete its merge.
  2. Land the lead; wait for its merge to park, keyed by the lead's batch ID.
  3. Land the dependent. Its batch serializes behind the lead's, which is in-flight (Merging is a dependency state).
  4. Wait for the dependent to reach speculated — its speculative build has already passed, so its own build signals are finished and nothing else will wake it.
  5. Open the gate. The lead merges and fans out.

The dependent reaching landed is then attributable to the fan-out alone.

Supporting changes: e2e-chain-queue is registered in queues.yaml. It is deliberately absent from the orchestrator's per-queue profiles so it falls through to the baseline profile and its all conflict analyzer, which serializes every new batch behind every in-flight one — that is what builds the chain. A new awaitBatchID harness helper resolves a request's batch ID from the operating store, since merge messages are keyed by batch rather than by the sqid a test holds.

Test Plan

  • bazel test //test/e2e/... — 3 suites, including the new case (~33s)
  • make lint-license, make lint-message-id, make lint-queue-shard
  • Confirmed the test fails against the unfixed code. Reverting the parent's mergesignal message ID to the bare batch ID leaves the dependent stuck at speculated and the suite runs to Bazel's timeout (TIMEOUT in 240.3s with --test_timeout=240); with the fix it passes in 33s.

A stalled pipeline surfaces as a test timeout rather than an assertion failure, which is how this harness reports non-convergence — pollUntil has no deadline of its own by design, so Bazel's timeout is the only one.

Stack

  1. fix(messagequeue): intent-scoped message IDs so wake-ups stop vanishing #574
  2. @ test(e2e): prove a dependent batch is woken by the merge ahead of it #576

@behinddwalls
behinddwalls force-pushed the preetam/messagequeue-e2e-dependent-wake branch from dc085b9 to bcb260d Compare August 12, 2026 18:44
Base automatically changed from messagequeue to main August 12, 2026 19:00
## Summary

### Why?

The parent change fixes a dropped wake-up: a merged batch fans out to speculate so its dependents can re-plan, and that message used to reuse the bare batch ID the batch controller had already published to the same topic and partition at creation. The queue deduplicates against rows it has not collected yet, consumed ones included, so the fan-out was reported as a success, stored nothing, and never arrived.

That fix shipped with unit coverage on the message ID and integration coverage on the queue semantics, but nothing exercised the path the bug actually broke. It is also a path that hides easily: any other event re-plans the queue and moves the dependent along, so a naive two-request test passes with or without the fix.

### What?

A new e2e case isolates the fan-out as the only possible wake-up, following the stop → observe → start shape `TestCancel_CaughtPreBatch_NeverLands` already uses:

1. Close the `runway-merge` gate for the queue before landing, so the lead batch cannot complete its merge.
2. Land the lead; wait for its merge to park, keyed by the lead's batch ID.
3. Land the dependent. Its batch serializes behind the lead's, which is in-flight (`Merging` is a dependency state).
4. Wait for the dependent to reach `speculated` — its speculative build has already passed, so its own build signals are finished and nothing else will wake it.
5. Open the gate. The lead merges and fans out.

The dependent reaching `landed` is then attributable to the fan-out alone.

Supporting changes: `e2e-chain-queue` is registered in `queues.yaml`. It is deliberately absent from the orchestrator's per-queue profiles so it falls through to the baseline profile and its `all` conflict analyzer, which serializes every new batch behind every in-flight one — that is what builds the chain. A new `awaitBatchID` harness helper resolves a request's batch ID from the operating store, since merge messages are keyed by batch rather than by the sqid a test holds.

## Test Plan

- ✅ `bazel test //test/e2e/...` — 3 suites, including the new case (~33s)
- ✅ `make lint-license`, `make lint-message-id`, `make lint-queue-shard`
- **Confirmed the test fails against the unfixed code.** Reverting the parent's `mergesignal` message ID to the bare batch ID leaves the dependent stuck at `speculated` and the suite runs to Bazel's timeout (`TIMEOUT in 240.3s` with `--test_timeout=240`); with the fix it passes in 33s.

A stalled pipeline surfaces as a test timeout rather than an assertion failure, which is how this harness reports non-convergence — `pollUntil` has no deadline of its own by design, so Bazel's timeout is the only one.
@behinddwalls
behinddwalls force-pushed the preetam/messagequeue-e2e-dependent-wake branch from bcb260d to 20e0c3d Compare August 12, 2026 19:00
@behinddwalls
behinddwalls added this pull request to the merge queue Aug 12, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 12, 2026
@behinddwalls
behinddwalls added this pull request to the merge queue Aug 13, 2026
Merged via the queue into main with commit 28e952b Aug 13, 2026
15 checks passed
@behinddwalls
behinddwalls deployed to stack-rebase August 13, 2026 17:04 — with GitHub Actions Active
@behinddwalls
behinddwalls deleted the preetam/messagequeue-e2e-dependent-wake branch August 13, 2026 17:04
behinddwalls added a commit that referenced this pull request Aug 13, 2026
## Summary

### Why?

`TestDependentBatch_IsWokenByTheMergeAhead` parks the lead batch's merge behind a closed gate, waits for the dependent to reach `speculated`, and only then opens the gate. That ordering encodes the old meaning of `speculated` — a build passed on a path still consistent with how its dependencies are resolving — which a batch could reach while its dependency was still outstanding.

Holding `speculating` until the batch can be sent to merge removes that resting point. A dependent blocked on the parked lead now stays `speculating`, and `speculated` arrives only once the lead has merged and the dependent is itself cleared to merge. So the test waits for a status that cannot arrive until it opens the gate, and it does not open the gate until that status arrives. The suite runs to Bazel's timeout.

The two changes had not met before: #576 landed on main after this branch was cut, so CI had never run them together.

### What?

The observation step waits for the `waiting` event instead of the `speculated` status. It is the same fact the test was reaching for — the dependent has passed its own build and only the lead is outstanding — expressed as the signal that now carries it, and reachable while the lead is still parked.

Nothing else moves. The gate still opens next, and the lead and the dependent are still asserted to land, so the dependent's wake-up remains attributable to the fan-out alone.

## Test Plan

✅ `bazel test //test/e2e/submitqueue:go_default_test` — passes in 120s, against a 300s timeout before
✅ `bazel test //submitqueue/... //platform/...` — 69 tests pass
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