Skip to content

Commit 48ace49

Browse files
RomneyDavincentkoc
authored andcommitted
fix(qa): exercise a real config restart boundary
1 parent eb0118b commit 48ace49

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

‎extensions/qa-lab/src/scenario-catalog.config-restart.test.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,31 @@ describe("QA config-restart scenario catalog", () => {
66
it("waits for the restart wake before using restored capabilities", () => {
77
const flow = JSON.stringify(readQaScenarioById("config-restart-capability-flip"));
88
const restartPatchIndex = flow.indexOf('"note":{"ref":"wakeMarker"}');
9+
const restartOwnedPathIndex = flow.indexOf('"gateway.terminal.enabled"');
910
const wakeWaitIndex = flow.indexOf("candidate.text.includes(wakeMarker)");
1011
const capabilityPollIndex = flow.indexOf('"saveAs":"afterTools"');
1112

1213
expect(restartPatchIndex).toBeGreaterThanOrEqual(0);
14+
expect(restartOwnedPathIndex).toBeGreaterThanOrEqual(0);
15+
expect(restartOwnedPathIndex).toBeLessThan(wakeWaitIndex);
1316
expect(wakeWaitIndex).toBeGreaterThan(restartPatchIndex);
1417
expect(capabilityPollIndex).toBeGreaterThan(wakeWaitIndex);
1518
expect(flow.indexOf('"call":"runAgentPrompt"')).toBeGreaterThan(capabilityPollIndex);
1619
});
20+
21+
it("restores the complete terminal subtree, including its absence", () => {
22+
const flow = JSON.stringify(readQaScenarioById("config-restart-capability-flip"));
23+
24+
expect(flow).toContain(
25+
'"expr":"original.config.gateway && Object.prototype.hasOwnProperty.call(original.config.gateway, \'terminal\') ? structuredClone(original.config.gateway.terminal) : undefined"',
26+
);
27+
expect(flow).toContain('"expr":"originalTerminal?.enabled === false ? true : false"');
28+
expect(flow).toContain(
29+
'"expr":"originalTerminal !== undefined && Object.prototype.hasOwnProperty.call(originalTerminal, \'enabled\')"',
30+
);
31+
expect(flow).toContain(
32+
'"terminal":{"expr":"originalTerminal === undefined ? null : (originalTerminalEnabledPresent ? originalTerminal : { ...originalTerminal, enabled: null })"}',
33+
);
34+
expect(flow.match(/"gateway\.terminal\.enabled"/g)).toHaveLength(1);
35+
});
1736
});

‎qa/scenarios/config/config-restart-capability-flip.yaml‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@ flow:
5353
- set: originalImageGenerationModelPrimary
5454
value:
5555
expr: "original.config.agents?.defaults?.mediaModels?.image?.primary ?? null"
56+
- set: originalTerminal
57+
value:
58+
expr: "original.config.gateway && Object.prototype.hasOwnProperty.call(original.config.gateway, 'terminal') ? structuredClone(original.config.gateway.terminal) : undefined"
59+
- set: restartTerminalEnabled
60+
value:
61+
# Terminal is enabled unless explicitly false. This expression flips both effective states.
62+
expr: "originalTerminal?.enabled === false ? true : false"
63+
- set: originalTerminalEnabledPresent
64+
value:
65+
expr: "originalTerminal !== undefined && Object.prototype.hasOwnProperty.call(originalTerminal, 'enabled')"
5666
- set: denied
5767
value:
5868
expr: "Array.isArray(originalToolsDeny) ? originalToolsDeny.map((entry) => String(entry)) : []"
@@ -109,6 +119,10 @@ flow:
109119
image:
110120
primary:
111121
ref: originalImageGenerationModelPrimary
122+
gateway:
123+
terminal:
124+
enabled:
125+
ref: restartTerminalEnabled
112126
sessionKey:
113127
ref: sessionKey
114128
deliveryContext:
@@ -118,6 +132,7 @@ flow:
118132
ref: wakeMarker
119133
replacePaths:
120134
- tools.deny
135+
- gateway.terminal.enabled
121136
- call: waitForGatewayHealthy
122137
args:
123138
- ref: env
@@ -236,6 +251,9 @@ flow:
236251
tools:
237252
deny:
238253
expr: "originalToolsDeny === undefined ? null : originalToolsDeny"
254+
gateway:
255+
terminal:
256+
expr: "originalTerminal === undefined ? null : (originalTerminalEnabledPresent ? originalTerminal : { ...originalTerminal, enabled: null })"
239257
replacePaths:
240258
- tools.deny
241259
- call: waitForGatewayHealthy

0 commit comments

Comments
 (0)