mirror of
https://github.com/garrytan/gstack.git
synced 2026-10-04 10:26:52 +02:00
test(ceo-mode-routing): submit a mode review that scrolled past the viewport
Run 36606688266 bundled routing, learnings and the mode choice into one
native call. Its review panel was taller than the terminal, so the tab
bar scrolled off, ceoModeSubmissionInput returned null for 240 s and HOLD
SCOPE was never submitted ('no posture match'). With no bar on screen the
viewport must still end at the focused Submit prompt, and the accumulated
screen text supplies the one complete panel, authenticated exactly as
before. Replay controls reject another mode, an unoffered answer, an
altered question, a quoted panel, trailing output, a moved cursor and an
answered or changed call.
This commit is contained in:
1 parent
69cb4c8e9d
commit
49761c97d6
4 files changed
+148
-11
No files matched your search
@@ -10,6 +10,7 @@ import captured_ceo_hold_commitment_ar from './fixtures/ceo-hold-commitment-ar.j
|
||||
import captured_ceo_hold_posture_ag from './fixtures/ceo-hold-posture-ag.json';
|
||||
import retainedPreservationCaptures_ceo_hold_posture_ag from './fixtures/ceo-hold-preservation-f359.json';
|
||||
import captured_ceo_mode_colon_at from './fixtures/ceo-mode-colon-at.json';
|
||||
import scrolledReview from './fixtures/ceo-mode-scrolled-review-36606688266.json';
|
||||
import fs_ceo_mode_full_ad from 'node:fs';
|
||||
import os_ceo_mode_full_ad from 'node:os';
|
||||
import path_ceo_mode_full_ad from 'node:path';
|
||||
@@ -1840,3 +1841,55 @@ test('AD v2 prerequisite requires the active native packet identity',()=>{
|
||||
for(const delta of [{answered:true},{failed:true},{sessionId:''},{toolUseId:''}]){const call={...pending(),...delta};const x=frame(call,2);expect(planCountPrerequisitePick(x.routing,x.active)).toBeNull();}
|
||||
});
|
||||
});
|
||||
|
||||
describe('mode submission when the review panel scrolls past the viewport', () => {
|
||||
// Run 36606688266 bundled routing, learnings and the mode choice into one
|
||||
// native call. Its review panel was taller than the terminal, so the tab bar
|
||||
// scrolled away and the harness never submitted HOLD SCOPE.
|
||||
const scrolledTranscript = scrolledReview.transcript as unknown as PlanCountTranscript;
|
||||
const scrolledCall = scrolledTranscript.calls[0] as NativePlanQuestionCall;
|
||||
const scrolledSubmit = (screen: string, screenText: string, mode: 'HOLD SCOPE' | 'SCOPE EXPANSION' = 'HOLD SCOPE',
|
||||
selected: NativePlanQuestionCall = scrolledCall, native: PlanCountTranscript = scrolledTranscript) =>
|
||||
ceoModeSubmissionInput(screen, selected, mode, native, new Set(), screenText);
|
||||
|
||||
test('the captured viewport has no tab bar and ends at the focused Submit prompt', () => {
|
||||
expect(scrolledReview.screen).not.toMatch(/←[^\r\n]+✔\s*Submit\s*→/);
|
||||
expect(scrolledReview.screen.trimEnd()).toMatch(/❯ 1\. Submit answers\s+2\. Cancel$/);
|
||||
expect(scrolledCall.questions.map(q => q.header)).toEqual(['Routing', 'Learnings', 'Review mode']);
|
||||
});
|
||||
|
||||
test('the complete scrolled review submits the selected mode once', () => {
|
||||
expect(scrolledSubmit(scrolledReview.screen, scrolledReview.screenText)).toBe('\r');
|
||||
const seen = new Set<string>();
|
||||
expect(ceoModeSubmissionInput(scrolledReview.screen, scrolledCall, 'HOLD SCOPE', scrolledTranscript, seen, scrolledReview.screenText)).toBe('\r');
|
||||
expect(ceoModeSubmissionInput(scrolledReview.screen, scrolledCall, 'HOLD SCOPE', scrolledTranscript, seen, scrolledReview.screenText)).toBeNull();
|
||||
});
|
||||
|
||||
test('without the accumulated screen text a barless viewport cannot submit', () => {
|
||||
expect(scrolledSubmit(scrolledReview.screen, '')).toBeNull();
|
||||
});
|
||||
|
||||
test('a review showing another mode is not an acknowledgement of the target mode', () => {
|
||||
expect(scrolledSubmit(scrolledReview.screen, scrolledReview.screenText, 'SCOPE EXPANSION')).toBeNull();
|
||||
});
|
||||
|
||||
for (const [name, change] of [
|
||||
['an answer no option offers', (text: string) => text.replace(/→ Enable cross-project \(recommended\)(?![\s\S]*→ Enable cross-project)/, '→ Upload learnings')],
|
||||
['an altered question', (text: string) => text.replace(/D2 — Let gstack(?![\s\S]*D2 — Let gstack)/, 'D2 — Never let gstack')],
|
||||
['a quoted review', (text: string) => text.replace(/Review your answers(?![\s\S]*Review your answers)/, 'Quoted example:\nReview your answers')],
|
||||
['output after the prompt', (text: string) => `${text}\nMore text`],
|
||||
] as const) test(`the scrolled route rejects ${name}`, () => {
|
||||
expect(scrolledSubmit(scrolledReview.screen, change(scrolledReview.screenText))).toBeNull();
|
||||
});
|
||||
|
||||
test('the viewport must still end at the focused Submit prompt', () => {
|
||||
expect(scrolledSubmit(scrolledReview.screen.replace('❯ 1. Submit answers', ' 1. Submit answers\n❯ 2. Cancel'), scrolledReview.screenText)).toBeNull();
|
||||
});
|
||||
|
||||
test('an answered or changed native call cannot be submitted again', () => {
|
||||
expect(scrolledSubmit(scrolledReview.screen, scrolledReview.screenText, 'HOLD SCOPE', { ...scrolledCall, answered: true })).toBeNull();
|
||||
const other = structuredClone(scrolledCall);
|
||||
other.questions[1]!.question += ' (changed)';
|
||||
expect(scrolledSubmit(scrolledReview.screen, scrolledReview.screenText, 'HOLD SCOPE', other)).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user