Repository navigation
fix(first-run-tour): fail a run the queue never accepted #15091
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5d94272
fix(first-run-tour): fail a run the queue never accepted
christian-byrne b69793b
fix(first-run-tour): deadline acceptance, not execution start
petros-double-test1 8ee79b8
Merge branch 'main' into fix/14619-tour-unaccepted-run
DrJKL 9dfd953
fix(first-run-tour): disarm the acceptance deadline on any reported s…
2e0ba75
test(first-run-tour): stop leaking queued jobs between tests
70704d9
fix(first-run-tour): stop promising a result once acceptance is lost …
christian-byrne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BLOCKER — this write leaks into every later test; the deadline test only passes by that leak.
beforeEachresets every mock exceptmocks.queuedJobs, andTOUR_WORKFLOWis module-level, so after the firstacceptRun()every subsequent test runs withtourRunAccepted === trueandstartAcceptDeadline()early-returns — the deadline is suppressed, not disarmed. On a clean export of this head:while the full file passes 54/54. So the suite is order-dependent (
.only, sharding, or a reorder breaks CI), and that test's own requirement — "a job that answered must never be cut short" — is not currently verified at all.Note from trialing the obvious fix: resetting
mocks.queuedJobs.value = {}inbeforeEachplus restoring the status disarm makes the full file pass, but the isolated-trun still failed — the status watcher never saw thefinishRunwrite in isolation, which points at an additional wiring subtlety betweenvi.resetModules()infreshControllerand the hoisted mock refs. Please validate whatever fix lands with the isolated run, not just the file run.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow-up — I chased the "wiring subtlety" to ground. Three distinct things, each demonstrated by a run on a clean export of this head, no speculation:
1. The order-dependence is wider than one test. Adding only
mocks.queuedJobs.value = {}tobeforeEach(controller untouched) fails four tests in the full file:leaves an accepted run past the acceptance deadline alonekeeps waiting when the socket comes backleaves a run that is still reporting alonelets a recovered socket cancel every retry that preceded itAll four assert that a run with a
'running'status survives past 15s; today they pass only because thisacceptRunwrite leaks a matchingqueuedJobsentry into them.2. The isolated-run failure has a second, pre-existing cause. The store-mock factories run on the first dynamic import — which is mid-test for whichever test runs first — and each factory replaces the hoisted holder, discarding whatever the test already wrote to it. A probe inside the workflowStore factory during an isolated run:
After that,
beginTourreadsnull,tourWorkflowstaysnull, and everygetWorkflowStatus(tourWorkflow.value)lookup key-misses. That's why the pre-PR testsays so when the run produced nothingalso fails in isolation (expected 'idle' to be 'failed') — this trap predates your PR and hits the whole file under-t/.only. (The engine mock is immune for exactly the right reason:reactive(mocks.engine)wraps the same object.)3. A combination validated green both ways (54/54 full file, plus isolated runs of the deadline test, the D2 test, and the socket-return test):
if (status !== undefined) stopAcceptDeadline()alongside the acceptance watchbeforeEach: addmocks.queuedJobs.value = {}mocks.activeWorkflow = shallowRef(mocks.activeWorkflow.value),mocks.queuedJobs = shallowRef(mocks.queuedJobs.value),mocks.workflowStatus = shallowRef(new Map(mocks.workflowStatus.value)),mocks.linearMode = shallowRef(mocks.linearMode.value),mocks.executionErrors = reactive({ ...mocks.executionErrors })Item 2 is pre-existing, so splitting it into its own PR is reasonable — the blockers here hang on item 1 plus the controller line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarification — my last comment buried a dependency and it's causing confusion. Plain version.
There are three fixes. They do different jobs:
if (status !== undefined) stopAcceptDeadline()next to the acceptance watch. This fixes the behavior bug.mocks.queuedJobs.value = {}tobeforeEach. This makes the four leak-shielded tests honest.mocks.activeWorkflow = shallowRef(mocks.activeWorkflow.value)— same pattern forworkflowStatus,queuedJobs,linearMode,executionErrors. This — and only this — fixes isolated runs.What each step gets you (every row verified by running it):
vitest run <file>vitest run <file> -t '<one test>'The sentence I should have written the first time: fixes 1+2 alone will never make an isolated run pass. Only fix 3 does that. The isolated failure without fix 3 is not caused by anything in this PR. The mock factories run in the middle of whichever test executes first, and they throw away values that test already wrote (probe output: the factory discarded
activeWorkflow = { path: 'tour.json' }mid-test). In a full run the "first test" is a starting-section test that doesn't care. In an isolated run, your test is the first test, so it always gets hit.So pick one of two paths and validate accordingly:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in 2e0ba75, all three fixes including the factory seeding, so this validates both ways.
reproduced your control first: adding only the
queuedJobsreset failed precisely the four tests you named, nothing else.after the full fix, full file is 54/54 and the isolated runs pass, including the deadline test,
says so when the run produced nothing,keeps waiting when the socket comes back,leaves a run that is still reporting alone,lets a recovered socket cancel every retry that preceded it,lets the offline grace outlive the acceptance deadline, and both acceptance tests.also checked the tests are honest now rather than passing some other way: reverting only the controller line re-fails exactly those four.
thanks for chasing the factory behavior to ground, the mid-test holder replacement is not something I would have found from the failure alone.