Skip to content

Commit 90827dc

Browse files
committed
fix: keep session export and TUI layout tests aligned
Omit reconstructable notify state from session zips, record the file-history REST routes in the API snapshot, and count the notify and survey dock children in the TUI layout tests.
1 parent a31080b commit 90827dc

5 files changed

Lines changed: 35 additions & 7 deletions

File tree

‎apps/pythinker-code/test/tui/pythinker-tui-message-flow.test.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4632,9 +4632,12 @@ command = "vim"
46324632
const transcript = stripSgr(renderTranscript(driver));
46334633
const panel = stripSgr(renderBtwPanel(driver));
46344634
const rootChildren = driver.state.ui.children;
4635-
expect(rootChildren.indexOf(driver.state.btwPanelContainer)).toBe(
4635+
expect(rootChildren.indexOf(driver.state.surveyContainer)).toBe(
46364636
rootChildren.indexOf(driver.state.editorContainer) - 1,
46374637
);
4638+
expect(rootChildren.indexOf(driver.state.btwPanelContainer)).toBe(
4639+
rootChildren.indexOf(driver.state.surveyContainer) - 1,
4640+
);
46384641
expect(transcript).toContain('main answer after btw');
46394642
expect(transcript).not.toContain('side answer');
46404643
expect(panel).toContain('BTW');

‎apps/pythinker-code/test/tui/pythinker-tui-startup.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,8 @@ describe('PythinkerTUI startup', () => {
335335
await expect(driver.init()).resolves.toBe(false);
336336
(driver as unknown as { mountFooter(): void }).mountFooter();
337337

338-
// Dock = 5 chrome containers + footer wrap, below the transcript viewport.
339-
expect(driver.state.dockContainer?.children).toHaveLength(6);
338+
// Dock = activity, todo, notify, queue, btw, survey, editor, footer wrap.
339+
expect(driver.state.dockContainer?.children).toHaveLength(8);
340340
});
341341

342342
it('shows a session-less notice on v2 startup', async () => {

‎packages/agent-core-v2/src/app/sessionExport/sessionExportService.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,11 @@ export async function exportSessionDirectory(input: {
203203

204204
const sessionScan = await scanSessionWire(sessionDir, input.signal);
205205
const stableSessionLog = sessionLogSource;
206-
const selectedSessionFiles: SessionZipEntry[] = sessionFiles.filter(
207-
(file) =>
208-
file !== sessionLogPath && !file.split(/[\\/]/).includes(FILE_HISTORY_BLOB_PREFIX),
209-
);
206+
const selectedSessionFiles: SessionZipEntry[] = sessionFiles.filter((file) => {
207+
if (file === sessionLogPath) return false;
208+
const parts = file.split(/[\\/]/);
209+
return !parts.includes(FILE_HISTORY_BLOB_PREFIX) && !parts.includes('notify');
210+
});
210211
if (stableSessionLog !== undefined) {
211212
selectedSessionFiles.push({ path: sessionLogPath, source: stableSessionLog });
212213
selectedSessionFiles.sort((left, right) =>

‎packages/agent-core-v2/test/app/sessionExport/sessionExport.test.ts‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,22 @@ describe('sessionExport', () => {
143143
});
144144
});
145145

146+
it('omits derived notify state from the archive', async () => {
147+
const tmp = await mkdtemp(join(tmpdir(), 'session-export-notify-'));
148+
const sessionDir = join(tmp, 'sessions', 'ws_demo', 'ses_notify');
149+
await mkdir(join(sessionDir, 'notify'), { recursive: true });
150+
await writeFile(join(sessionDir, 'state.json'), '{}\n', 'utf-8');
151+
await writeFile(join(sessionDir, 'notify', 'state.json'), '{"enabled":true}\n', 'utf-8');
152+
153+
const result = await exportSessionDirectory({
154+
request: { sessionId: 'ses_notify', outputPath: join(tmp, 'export.zip'), version: '1.0.0-test' },
155+
summary: { id: 'ses_notify', sessionDir },
156+
});
157+
158+
expect(result.entries).toEqual(['manifest.json', 'state.json']);
159+
expect(result.entries.some((entry) => entry.includes('notify'))).toBe(false);
160+
});
161+
146162
it('uses a timestamped default output path when outputPath is omitted', async () => {
147163
const tmp = await mkdtemp(join(tmpdir(), 'session-export-test-'));
148164
const sessionDir = join(tmp, 'sessions', 'ws_demo', 'ses_default_output');

‎packages/agent-gateway/test/__snapshots__/apiSurface.snapshot.test.ts.snap‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,14 @@ exports[`API surface snapshot > matches the documented v2 route table and meta e
204204
"GET",
205205
"/api/v1/sessions/{session_id}/expert-talk/runs/{run_id}",
206206
],
207+
[
208+
"GET",
209+
"/api/v1/sessions/{session_id}/file-history/changes",
210+
],
211+
[
212+
"GET",
213+
"/api/v1/sessions/{session_id}/file-history/content",
214+
],
207215
[
208216
"GET",
209217
"/api/v1/sessions/{session_id}/fs/{*}",

0 commit comments

Comments
 (0)