Skip to content

Commit dc6e6df

Browse files
mchwangclaude
andcommitted
Test the older-job poll guard, the poll speed on a list-step change and the list surviving the timer (#194 review round 18)
Also log the step bar's placement in DESIGN.md and name the F6b queue test in the handoff doc's test list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 3d975e7 commit dc6e6df

3 files changed

Lines changed: 27 additions & 5 deletions

File tree

‎DESIGN.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,3 +262,4 @@ There are no shadows and no glows. Depth comes from the surface brightness steps
262262
| 2026-10-21 | Two progress marks for the merge step list: ○ "Waiting" in `neutral-status` and ● "Running" in `text` | Steps that have not started or are under way are not outcomes, so they take no outcome color. Approved by the user (PR #194) |
263263
| 2026-10-21 | The not-applicable mark also reads "Skipped" for a merge step that was not needed | Same meaning as N/A, worded for a step. Part of the step list the user approved (PR #194) |
264264
| 2026-10-21 | The warning mark also reads "Stopped" (a cancelled merge step) and "Unknown" (GitHub's merge outcome not known) | Both mean "look at this, it did not finish normally". Approved by the user (PR #194) |
265+
| 2026-10-21 | While a merge job runs, a step bar sits between the review strip and the panes | It shows the merge step list and Cancel merge without replacing the review strip's merge control. Approved by the user (PR #194) |

‎docs/implementation/merge-handoff.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ Schema v19 adds `task_pull_requests.check_id` (the pre-PR check each opening fol
120120

121121
`test/merge-job.test.ts` runs the job against the real Store and guarded merge with a faked GitHub and preparation. It covers the three wait cases the design names (zero required checks, one check pending then passing, a timeout), a failing check, GitHub still computing mergeability, preparation ending for review or failing, another blocker while waiting, a failed GitHub read while waiting (also one that settles after the wait limit), GitHub's refusal, an unknown merge outcome, a merge queue (`queued`), cancel while waiting (told or not) and during the guarded merge's validation, shutdown while waiting and during the guarded merge, startup settlement, resends, a second click, a stale token, a busy runner, which blockers keep Merge PR available (including Retry merge after `blocked`), the job-mode wording of a moved base and of preparation, and each ended reason's next step (wait after a timeout, fix after a failing check or refusal, nothing repeated in a failed reason). `test/pre-merge.test.ts` runs the #22 acceptance cases through the job with real preparation: a base move that leaves approvals valid merges; a rebase that makes an approval stale stops for review; a breaking command after a rebase fails the job; a collaborator push stops for review; a cancel during a command check ends the job `cancelled`. Further regressions cover a cancel, then shutdown, before the job's own review load rejects (the job ends `cancelled`), a plan import while the job's first review load is pending (the job ends `failed` and prepares nothing), a queue poll that records `removed` or `failed` while GitHub is asked to merge (the guarded merge rejects and the job ends `blocked`; with a plan import after the poll, the job ends `failed` and the task stays in review), and an inspection that finds the checks passing, or one failing, but finishes after the wait limit before its timer runs (a timeout, or the failing check). Server tests cover the merge route (including a second tab's refused click, which carries the running job), its trust admission (an untrusted click refused and replayed, a failed read saving nothing), `GET /api/merge`, the `prepare-merge` and `publish` refusals, the `start` refusal after a plan import and approval during the preparation, the `start` and `resume` refusals after the same during the check wait (the import then ends the job `failed`, with nothing run, pushed, published or merged), cancel closing the pull requests, and shutdown; a production test covers startup settlement; a browser test follows a job to merged, and others show that once a job ends (polled, answered to the click, or kept over an older full response) the control reads its outcome; after a job that reached the merge it drops the blockers the server names in `settledBeforeJobMerge`, and after a failed one it keeps a conflict and a check blocker. Others show that a job the poll sees end `queued` is followed through GitHub's queue to merged without a refresh, from a review with no queue, that a resent click whose answer replays its ended job follows the later running job the reloaded review carries, that a click refused because another tab's job runs follows that job, that a blocked banner states its reason's next step once, and that the running job's dialog names the step as the control does.
122122

123-
The step list and **Cancel merge** (D16) are covered by: `test/merge-job.test.ts` (the seven steps and their times, skipped and failed steps, a failed step write, a merge cancel during preparation, the checks wait, the guarded merge's validation and the first review load, refusals once GitHub was asked, while the task is being cancelled and for an ended or unknown job, a task cancel winning, cancel then shutdown, an inspection answering after a cancel, and restart settlement); `test/pre-merge.test.ts` (the steps preparation reports, a throwing progress callback, and a merge cancel during a rebase, a push and a command check, each leaving the task in review); `test/runner-publishing.test.ts` (the `cancel-merge` route); and the browser tests tagged D16 in `test/browser/review.spec.ts` (the list and its accessible text, Cancel and its refusals, answers in every order against the poll, the queue poll keeping the list, and focus).
123+
The step list and **Cancel merge** (D16) are covered by: `test/merge-job.test.ts` (the seven steps and their times, skipped and failed steps, a failed step write, a merge cancel during preparation, the checks wait, the guarded merge's validation and the first review load, refusals once GitHub was asked, while the task is being cancelled and for an ended or unknown job, a task cancel winning, cancel then shutdown, an inspection answering after a cancel, and restart settlement); `test/pre-merge.test.ts` (the steps preparation reports, a throwing progress callback, and a merge cancel during a rebase, a push and a command check, each leaving the task in review); `test/runner-publishing.test.ts` (the `cancel-merge` route); and the browser tests tagged D16 in `test/browser/review.spec.ts` (the list and its accessible text, Cancel and its refusals, answers in every order against the poll, the poll's speed when the list's step changes, and focus), plus the F6b test that follows a job ended in the merge queue (the queue poll keeping the list).
124124

125125
## Check this document with a reader
126126

‎test/browser/review.spec.ts‎

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,10 @@ test('shows the merge step list while a job runs, and cancels the merge alone fr
856856
await expect(steps.getByRole('listitem').first()).toHaveText('✓ Fetch Done, 1 s',{timeout:10_000});
857857
await expect(steps.getByRole('listitem').nth(1)).toHaveText(/^● Rebase Running, \d+ (s|min \d\d s)$/);
858858
await expect(steps.getByRole('listitem').nth(2)).toHaveText('○ Push Waiting');
859+
// The 1 s timer rewrites only the times: the list items themselves stay, so a screen reader keeps its place.
860+
const first=await steps.getByRole('listitem').first().elementHandle();
861+
await page.waitForTimeout(1_300);
862+
expect(await first!.evaluate(node=>node.isConnected)).toBe(true);
859863
const cancel=page.getByRole('button',{name:'Cancel merge',exact:true});
860864
await expect(cancel).toBeVisible();
861865
await expect(cancel).not.toHaveAttribute('aria-disabled','true');
@@ -1001,9 +1005,17 @@ for (const answer of ['ended','newer'] as const) test(`polls again within second
10011005
else await expect(page.locator('#banner')).toHaveText('Preparing the merge: refresh, rebase, push and command checks.');
10021006
const released=Date.now();release();
10031007
// The next poll comes 2 s after the held one, not after its backed-off delay of 16 s or more.
1004-
if(answer==='ended') await expect(page.locator('#merge')).toHaveText('Merged',{timeout:6_000});
1005-
else await expect(page.getByRole('list',{name:'Merge steps'}).getByRole('listitem').first()).toHaveText(/^● Fetch Running/,{timeout:6_000});
1006-
expect(Date.now()-released).toBeLessThan(5_000);
1008+
if(answer==='ended'){
1009+
await expect(page.locator('#merge')).toHaveText('Merged',{timeout:6_000});
1010+
expect(Date.now()-released).toBeLessThan(5_000);
1011+
} else {
1012+
// The held poll, read before the newer job, now answers the older job's running record: it must be discarded.
1013+
const pollsAtRelease=polls.length;
1014+
await expect.poll(()=>polls.length,{timeout:6_000}).toBeGreaterThan(pollsAtRelease);
1015+
await page.waitForTimeout(200);
1016+
await expect(page.getByRole('list',{name:'Merge steps'}).getByRole('listitem').first()).toHaveText(/^● Fetch Running/);
1017+
await expect(page.locator('#banner')).toHaveText('Preparing the merge: refresh, rebase, push and command checks.');
1018+
}
10071019
});
10081020
for (const reload of ['unavailable','failed','ended'] as const) test(`moves focus off Cancel when a reload ${{failed:'fails',unavailable:'hides the merge control',ended:'shows the job ended'}[reload]} (D16)`,async({page})=>{
10091021
const config={...app.service.config,demo:false};await app.close();removeDemoOutOfScope(config);
@@ -1077,7 +1089,8 @@ for (const refusal of ['ended','older','newer'] as const) test(`keeps what the p
10771089
release();await refused;
10781090
await page.waitForTimeout(300);
10791091
if(refusal==='newer'){
1080-
// The newer job is followed: its step list and step show.
1092+
// The newer job is followed: its step list and step show, also after the next poll (which answers it).
1093+
await page.waitForTimeout(2_500);
10811094
await expect(page.locator('#merge')).toHaveText('Preparing…');
10821095
await expect(page.getByRole('list',{name:'Merge steps'}).getByRole('listitem').first()).toHaveText(/^● Fetch Running/);
10831096
await expect(page.locator('#banner')).toHaveText('Preparing the merge: refresh, rebase, push and command checks.');
@@ -1245,6 +1258,14 @@ test('does not back off the merge-job poll when only the waiting checks change w
12451258
expect(delays).toEqual([2000,4000,4000]);
12461259
});
12471260

1261+
test('polls soon again when only the running step of the list changes within a job step (D16)',async({page})=>{
1262+
// As production saves them: preparation reports Fetch, then Rebase, while the job's own step stays `preparing`.
1263+
const fetching=mergeJobRecord({state:'running',step:'preparing',revision:2,steps:mergeSteps(['running'])});
1264+
const rebasing=mergeJobRecord({state:'running',step:'preparing',revision:3,steps:mergeSteps(['done','running'])});
1265+
const delays=await mergeJobPollDelays(page,[fetching,fetching,rebasing,rebasing,mergeJobRecord({state:'merged',step:null,revision:6})]);
1266+
// 2 s, doubled to 4 s after the unchanged poll, back to 2 s once the running list step changed, then doubled again.
1267+
expect(delays).toEqual([2000,4000,2000,4000]);
1268+
});
12481269
test('starts a new action for Retry merge once the job its retained key started has ended (F6b)',async({page})=>{
12491270
const config={...app.service.config,demo:false};await app.close();removeDemoOutOfScope(config);
12501271
const gateway:MergeGateway={inspect:async()=>{const snapshot=(await app.service.load()).snapshot;return {base:snapshot.base,head:snapshot.head,pullRequestState:'OPEN',mergeable:'MERGEABLE',rulesKnown:true,atomicBaseGuard:true,mergeQueue:false,requiredChecks:[],alreadyFixed:'clear',pullRequest:7,draft:false};},merge:async()=>{throw new Error('The browser test answers every merge request itself.');}};

0 commit comments

Comments
 (0)