mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-01 06:24:41 +01:00
test(plan-seed): wait for the fixture CLI's slash event instead of a fixed 50 ms
Run 14 (b2f729b) needed the flaky-retry for 'startup-placeholder': the
events log had paste/enter/end_turn but not yet the slash 50 ms after it
was sent. The check now polls (bounded 5 s); the deadline assertion
measures when submission settled, which is what it bounds. One test
typecheck diagnostic goes away with the typed reader.
This commit is contained in:
1 parent
b2f729b316
commit
efca3fa75d
2 files changed
+8
-4
No files matched your search
@@ -412,7 +412,7 @@
|
||||
"test/plan-scope-selection.test.ts\tTS2339\tProperty 'args' does not exist on type '{ skill: string; } | { skill: string; args: string; }'. Property 'args' does not exist on type '{ skill: string; }'.": 4,
|
||||
"test/plan-seed-submission.test.ts\tTS2322\tType '{ GSTACK_PLAN_MODE?: undefined; CLAUDE_CONFIG_DIR: string; SEED_CASE: string; } | { GSTACK_PLAN_MODE: string; CLAUDE_CONFIG_DIR: string; SEED_CASE: string; } | { GSTACK_PLAN_MODE?: undefined; CLAUDE_CONFIG_DIR: string; SEED_CASE: string; } | { ...; }' is not assignable to type 'Record<string, string> | undefined'. Type '{ GSTACK_PLAN_MODE?: undefined; CLAUDE_CONFIG_DIR: string; SEED_CASE: string; }' is not assignable to type 'Record<string, string>'. Property 'GSTACK_PLAN_MODE' is incompatible with index signature. Type 'undefined' is not assignable to type 'string'.": 1,
|
||||
"test/plan-seed-submission.test.ts\tTS2322\tType '{ TERM: string; CLAUDE_CONFIG_DIR: string; SEED_CASE: string; } | { CI: string; TERM?: undefined; COLORTERM?: undefined; FORCE_COLOR?: undefined; NO_COLOR?: undefined; CLAUDE_CONFIG_DIR: string; SEED_CASE: string; } | { ...; } | { ...; } | { ...; }' is not assignable to type 'Record<string, string> | undefined'. Type '{ CI: string; TERM?: undefined; COLORTERM?: undefined; FORCE_COLOR?: undefined; NO_COLOR?: undefined; CLAUDE_CONFIG_DIR: string; SEED_CASE: string; }' is not assignable to type 'Record<string, string>'. Property 'TERM' is incompatible with index signature. Type 'undefined' is not assignable to type 'string'.": 1,
|
||||
"test/plan-seed-submission.test.ts\tTS2345\tArgument of type '(text: string, reviver?: ((this: any, key: string, value: any) => any) | undefined) => any' is not assignable to parameter of type '(value: string, index: number, array: string[]) => any'. Types of parameters 'reviver' and 'index' are incompatible. Type 'number' is not assignable to type '(this: any, key: string, value: any) => any'.": 4,
|
||||
"test/plan-seed-submission.test.ts\tTS2345\tArgument of type '(text: string, reviver?: ((this: any, key: string, value: any) => any) | undefined) => any' is not assignable to parameter of type '(value: string, index: number, array: string[]) => any'. Types of parameters 'reviver' and 'index' are incompatible. Type 'number' is not assignable to type '(this: any, key: string, value: any) => any'.": 3,
|
||||
"test/plan-seed-submission.test.ts\tTS2345\tArgument of type '{ pid: () => number; exited: () => boolean; hermeticConfigDir: string; send(s: string): void; sendKey(key: string): void; mark: () => number; currentScreen: () => Promise<{ text: string; rawEnd: number; styledText?: { ...; }[] | undefined; }>; }' is not assignable to parameter of type 'SeedSession'. Type '{ pid: () => number; exited: () => boolean; hermeticConfigDir: string; send(s: string): void; sendKey(key: string): void; mark: () => number; currentScreen: () => Promise<{ text: string; rawEnd: number; styledText?: { ...; }[] | undefined; }>; }' is not assignable to type '{ currentScreen: (deadlineAt?: number | undefined) => Promise<{ text: string; rawEnd: number; styledText: { row: number; start: number; text: string; dim: boolean; inverse: boolean; }[]; }>; }'. The types returned by 'currentScreen(...)' are incompatible between these types. Type 'Promise<{ text: string; rawEnd: number; styledText?: { row: number; start: number; text: string; dim: boolean; inverse: boolean; }[] | undefined; }>' is not assignable to type 'Promise<{ text: string; rawEnd: number; styledText: { row: number; start: number; text: string; dim: boolean; inverse: boolean; }[]; }>'. Type '{ text: string; rawEnd: number; styledText?: { row: number; start: number; text: string; dim: boolean; inverse: boolean; }[] | undefined; }' is not assignable to type '{ text: string; rawEnd: number; styledText: { row: number; start: number; text: string; dim: boolean; inverse: boolean; }[]; }'. Types of property 'styledText' are incompatible. Type '{ row: number; start: number; text: string; dim: boolean; inverse: boolean; }[] | undefined' is not assignable to type '{ row: number; start: number; text: string; dim: boolean; inverse: boolean; }[]'. Type 'undefined' is not assignable to type '{ row: number; start: number; text: string; dim: boolean; inverse: boolean; }[]'.": 1,
|
||||
"test/plan-seed-submission.test.ts\tTS7053\tElement implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ TERM: string; } | { CI: string; TERM?: undefined; COLORTERM?: undefined; FORCE_COLOR?: undefined; NO_COLOR?: undefined; } | { CI: string; FORCE_COLOR: string; TERM?: undefined; COLORTERM?: undefined; NO_COLOR?: undefined; } | { ...; } | { ...; }'. No index signature with a parameter of type 'string' was found on type '{ TERM: string; } | { CI: string; TERM?: undefined; COLORTERM?: undefined; FORCE_COLOR?: undefined; NO_COLOR?: undefined; } | { CI: string; FORCE_COLOR: string; TERM?: undefined; COLORTERM?: undefined; NO_COLOR?: undefined; } | { ...; } | { ...; }'.": 1,
|
||||
"test/plan-skill-question-events.test.ts\tTS2769\tNo overload matches this call. The last overload gave the following error. Argument of type '{ id: string; toolName: string; input: { questions: { question: string; header: string; multiSelect: boolean; options: { label: string; description: string; }[]; }[]; }; cwd: string; }[]' is not assignable to parameter of type 'QuestionEventCall[]'. Type '{ id: string; toolName: string; input: { questions: { question: string; header: string; multiSelect: boolean; options: { label: string; description: string; }[]; }[]; }; cwd: string; }' is not assignable to type 'QuestionEventCall'. Types of property 'toolName' are incompatible. Type 'string' is not assignable to type '\"AskUserQuestion\"'.": 3,
|
||||
|
||||
@@ -57,11 +57,15 @@ for (const scenario of ['success', 'completed-tool', 'status-updating', 'history
|
||||
try { await submitPlanSeed(session, seed, { cwd: dir, launchedAt, deadlineAt,
|
||||
isQuestionOrPermission: text => isProseAUQVisible(text) || isNumberedOptionListVisible(text) || isPermissionDialogVisible(text) }); }
|
||||
catch (error) { failure = error; }
|
||||
const settledAt = Date.now();
|
||||
if (['success', 'completed-tool', 'status-updating', 'history-empty-box', 'native-paste', 'native-paste-block', 'startup-placeholder', 'startup-placeholder-cursor', 'startup-placeholder-unicode'].includes(scenario)) {
|
||||
expect(failure).toBeUndefined();
|
||||
session.send('/plan-eng-review\r');
|
||||
await Bun.sleep(50);
|
||||
const events = fs.readFileSync(path.join(config, 'events.jsonl'), 'utf8').trim().split('\n').map(JSON.parse);
|
||||
// The fixture CLI logs the slash after it reads the bytes; under load that takes longer than a fixed 50 ms.
|
||||
const eventsFile = path.join(config, 'events.jsonl');
|
||||
const readEvents = () => fs.readFileSync(eventsFile, 'utf8').trim().split('\n').map(line => JSON.parse(line));
|
||||
for (const until = Date.now() + 5000; readEvents().length < 4 && Date.now() < until;) await Bun.sleep(10);
|
||||
const events = readEvents();
|
||||
expect(events.map(e => e.kind)).toEqual(['paste', 'enter', 'end_turn', 'slash']);
|
||||
expect(events.slice(0, 3).every(e => e.value === seed)).toBe(true);
|
||||
expect(sent).toEqual([`\x1b[200~${seed}\x1b[201~`, '\r', '/plan-eng-review\r']);
|
||||
@@ -77,7 +81,7 @@ for (const scenario of ['success', 'completed-tool', 'status-updating', 'history
|
||||
expect(sent.filter(s => s === '\r').length).toBeLessThanOrEqual(1);
|
||||
if (scenario.startsWith('startup-')) expect(sent).toEqual([]);
|
||||
}
|
||||
expect(Date.now() - deadlineAt).toBeLessThan(500);
|
||||
expect(settledAt - deadlineAt).toBeLessThan(500);
|
||||
} finally {
|
||||
if (!exited) proc.kill();
|
||||
await proc.exited;
|
||||
|
||||
Reference in new issue
Block a user