Skip to content

Commit 5bb3b8c

Browse files
committed
test(agent-workspace): deepen pane lifecycle evidence for m7.2
1 parent c4769c7 commit 5bb3b8c

4 files changed

Lines changed: 138 additions & 0 deletions

File tree

docs/brainstorms/2026-04-16-mainline-ci-stabilization-and-m7-direction-requirements.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,19 @@ Deliverables:
155155
- expanded behavior/runtime tests for focus-path coexistence + fullscreen promote/restore lifecycle.
156156
- explicit assertions around `requestBridgeWindowVisibility` transitions.
157157

158+
#### M7.2 Progress Note (2026-04-16)
159+
160+
- [Done] expanded source-level runtime behavior coverage in:
161+
- `src/agent_workspace.runtime.behavior.test.ts`
162+
- [Done] added coexistence lifecycle assertions:
163+
- focus action remains available while path dock is visible,
164+
- path dock fullscreen enter/exit preserves reversible state transitions.
165+
- [Done] added deterministic bridge visibility transition assertions:
166+
- close-button hide path -> `requestBridgeWindowVisibility(false, reason=agent-workspace-hide-path-dock)`,
167+
- `nc:pathmode:exited` hide path -> same reasoned bridge-hide request.
168+
- [Done] verification evidence:
169+
- `npm test -- src/agent_workspace.runtime.behavior.test.ts --runInBand`
170+
158171
### M7.3 (Then): Foundation Re-entry Readiness Checklist (No Overclaim)
159172

160173
Deliverables:

docs/diataxis/en/explanation/development-progress-dashboard.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,17 @@ Execution anchor:
258258
- failing references: `24405317254`, `24404975285`,
259259
- recovered run: `24502592419` (`Migration Gates` all green, including runtime/browser/tauri agent-workspace suites).
260260

261+
## Latest Mainline Increment (2026-04-16 M7.2 Runtime Evidence Deepening Lane)
262+
263+
- Expanded runtime behavior coverage in `src/agent_workspace.runtime.behavior.test.ts` for pane lifecycle evidence:
264+
- focus-mode action and path-dock visibility coexistence,
265+
- path fullscreen enter/exit reversible transitions while dock remains active.
266+
- Added deterministic bridge visibility assertions for hide transitions:
267+
- close-button hide path requests bridge visibility off with `reason=agent-workspace-hide-path-dock`,
268+
- `nc:pathmode:exited` event path hide follows the same bridge-hide reason contract.
269+
- Verification evidence:
270+
- `npm test -- src/agent_workspace.runtime.behavior.test.ts --runInBand`
271+
261272
## Mainline vs Working-Branch Snapshot (2026-04-14)
262273

263274
| Capability Slice | Working Branch (`feat/learning-multi-tutor-adapter`) | Mainline (`origin/main`) | Integration Status |

docs/diataxis/zh/explanation/development-progress-dashboard.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,17 @@
258258
- 历史失败参考:`24405317254``24404975285`
259259
- 修复后运行:`24502592419``Migration Gates` 全绿,含 runtime/browser/tauri 三个 agent-workspace 套件)。
260260

261+
## 主线最新增量(2026-04-16 M7.2 运行时证据加深链路)
262+
263+
- 已在 `src/agent_workspace.runtime.behavior.test.ts` 扩展 pane 生命周期证据覆盖:
264+
- focus 动作与 path dock 可并存,
265+
- path fullscreen 进入/退出保持可逆状态变更。
266+
- 已增加 bridge 可见性收敛断言:
267+
- close 按钮隐藏 path 时触发 `requestBridgeWindowVisibility(false, reason=agent-workspace-hide-path-dock)`
268+
- `nc:pathmode:exited` 事件触发隐藏时复用同一 reason 合同。
269+
- 验证证据:
270+
- `npm test -- src/agent_workspace.runtime.behavior.test.ts --runInBand`
271+
261272
## 主线 vs 工作分支快照(2026-04-14)
262273

263274
| 能力切片 | 工作分支(`feat/learning-multi-tutor-adapter`| 主线(`origin/main`| 集成状态 |

src/agent_workspace.runtime.behavior.test.ts

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,109 @@ describe('agent workspace runtime behavior', () => {
325325
);
326326
});
327327

328+
test('keeps focus mode and path dock coexistence during fullscreen lifecycle', async () => {
329+
const fetchMock = jest.fn().mockResolvedValue({
330+
ok: true,
331+
status: 200,
332+
json: async () => ({
333+
success: true,
334+
result: {
335+
userId: 'agent_user_default',
336+
message: 'Found 1 local knowledge point(s).',
337+
knowledgePoints: [
338+
{
339+
atomId: 'atom-coexist-1',
340+
title: 'Coexist Candidate',
341+
snippet: 'Focus then path dock.',
342+
score: 0.73,
343+
capabilities: [
344+
{
345+
actionId: 'open_focus_mode',
346+
label: 'Focus',
347+
request: { userId: 'agent_user_default', atomId: 'atom-coexist-1' },
348+
execution: { kind: 'frontend_only' },
349+
},
350+
],
351+
},
352+
],
353+
},
354+
}),
355+
});
356+
(global as unknown as Record<string, unknown>).fetch = fetchMock;
357+
358+
const runtime = runtimeModule.createAgentWorkspaceRuntime({ defaultUserId: 'agent_user_default' });
359+
runtime.init();
360+
361+
const input = document.getElementById('agent-workspace-input') as HTMLTextAreaElement;
362+
const form = document.getElementById('agent-workspace-form') as HTMLFormElement;
363+
input.value = 'focus then open path';
364+
form.dispatchEvent(new dom!.window.Event('submit', { bubbles: true, cancelable: true }));
365+
await flushAsync();
366+
367+
const pointCard = document.querySelector('.agent-workspace-point-card') as HTMLElement;
368+
expect(pointCard).not.toBeNull();
369+
pointCard.click();
370+
371+
runtime.openLearningPathDock('atom-coexist-1');
372+
await flushAsync();
373+
374+
expect(document.body.classList.contains('agent-workspace-enabled')).toBe(true);
375+
expect(document.body.classList.contains('agent-workspace-path-visible')).toBe(true);
376+
expect(document.body.classList.contains('agent-workspace-path-fullscreen')).toBe(false);
377+
const graphWrapper = document.getElementById('graph-wrapper') as HTMLElement;
378+
expect(graphWrapper.style.display).toBe('block');
379+
380+
runtime.togglePathFullscreen();
381+
expect(document.body.classList.contains('agent-workspace-path-fullscreen')).toBe(true);
382+
runtime.togglePathFullscreen();
383+
expect(document.body.classList.contains('agent-workspace-path-fullscreen')).toBe(false);
384+
385+
const pathApp = (global as unknown as Record<string, unknown>).pathApp as Record<string, jest.Mock>;
386+
expect(pathApp.requestBridgeWindowVisibility).toHaveBeenCalledWith(
387+
true,
388+
expect.objectContaining({ reason: 'agent-workspace-open-path-dock' })
389+
);
390+
const focusOnNode = (global as unknown as Record<string, unknown>).focusOnNode as jest.Mock;
391+
expect(focusOnNode).toHaveBeenCalledWith('atom-coexist-1');
392+
});
393+
394+
test('sends deterministic bridge-hide transitions for close button and path exit event', async () => {
395+
const runtime = runtimeModule.createAgentWorkspaceRuntime({ defaultUserId: 'agent_user_default' });
396+
runtime.init();
397+
398+
runtime.openLearningPathDock('atom-close-1');
399+
await flushAsync();
400+
401+
const pathApp = (global as unknown as Record<string, unknown>).pathApp as Record<string, jest.Mock>;
402+
pathApp.requestBridgeWindowVisibility.mockClear();
403+
404+
const closeButton = document.getElementById('agent-workspace-close-learning-path') as HTMLButtonElement;
405+
closeButton.click();
406+
await flushAsync();
407+
408+
expect(document.body.classList.contains('agent-workspace-path-visible')).toBe(false);
409+
expect(document.body.classList.contains('agent-workspace-path-fullscreen')).toBe(false);
410+
const pathContainer = document.getElementById('path-container') as HTMLElement;
411+
expect(pathContainer.style.display).toBe('none');
412+
expect(pathApp.requestBridgeWindowVisibility).toHaveBeenCalledWith(
413+
false,
414+
expect.objectContaining({ reason: 'agent-workspace-hide-path-dock' })
415+
);
416+
417+
runtime.openLearningPathDock('atom-close-2');
418+
await flushAsync();
419+
pathApp.requestBridgeWindowVisibility.mockClear();
420+
421+
dom!.window.dispatchEvent(new dom!.window.CustomEvent('nc:pathmode:exited'));
422+
await flushAsync();
423+
424+
expect(document.body.classList.contains('agent-workspace-path-visible')).toBe(false);
425+
expect(pathApp.requestBridgeWindowVisibility).toHaveBeenCalledWith(
426+
false,
427+
expect.objectContaining({ reason: 'agent-workspace-hide-path-dock' })
428+
);
429+
});
430+
328431
test('executes study session capability and renders summary message', async () => {
329432
const fetchMock = jest
330433
.fn()

0 commit comments

Comments
 (0)