From cb1810c530a1e6efec2a7e58f53bdbcd9c26fecb Mon Sep 17 00:00:00 2001 From: Amr Elsayed Date: Sun, 28 Jun 2026 15:52:26 +1000 Subject: [PATCH 1/7] chore(porch): bugfix-1110 init bugfix --- .../status.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 codev/projects/bugfix-1110-bugfix-artifact-canvas-test-su/status.yaml diff --git a/codev/projects/bugfix-1110-bugfix-artifact-canvas-test-su/status.yaml b/codev/projects/bugfix-1110-bugfix-artifact-canvas-test-su/status.yaml new file mode 100644 index 000000000..1cc3835cd --- /dev/null +++ b/codev/projects/bugfix-1110-bugfix-artifact-canvas-test-su/status.yaml @@ -0,0 +1,14 @@ +id: bugfix-1110 +title: bugfix-artifact-canvas-test-su +protocol: bugfix +phase: investigate +plan_phases: [] +current_plan_phase: null +gates: + pr: + status: pending +iteration: 1 +build_complete: false +history: [] +started_at: '2026-06-28T05:52:25.996Z' +updated_at: '2026-06-28T05:52:25.997Z' From 8ca04a29bd1351c9e7579549ec00f9984dcbbcef Mon Sep 17 00:00:00 2001 From: Amr Elsayed Date: Sun, 28 Jun 2026 15:52:58 +1000 Subject: [PATCH 2/7] chore(porch): bugfix-1110 fix phase-transition --- .../bugfix-1110-bugfix-artifact-canvas-test-su/status.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codev/projects/bugfix-1110-bugfix-artifact-canvas-test-su/status.yaml b/codev/projects/bugfix-1110-bugfix-artifact-canvas-test-su/status.yaml index 1cc3835cd..d2b830da6 100644 --- a/codev/projects/bugfix-1110-bugfix-artifact-canvas-test-su/status.yaml +++ b/codev/projects/bugfix-1110-bugfix-artifact-canvas-test-su/status.yaml @@ -1,7 +1,7 @@ id: bugfix-1110 title: bugfix-artifact-canvas-test-su protocol: bugfix -phase: investigate +phase: fix plan_phases: [] current_plan_phase: null gates: @@ -11,4 +11,4 @@ iteration: 1 build_complete: false history: [] started_at: '2026-06-28T05:52:25.996Z' -updated_at: '2026-06-28T05:52:25.997Z' +updated_at: '2026-06-28T05:52:58.629Z' From 5246ffa6f618d64b1a7fe02027152cca85f3fba3 Mon Sep 17 00:00:00 2001 From: Amr Elsayed Date: Sun, 28 Jun 2026 15:54:41 +1000 Subject: [PATCH 3/7] [Bugfix #1110] Fix: wrap D2 watch-failure DOM assertion in waitFor The test 'surfaces a synchronous FileAdapter.watch() failure via onError without throwing (D2)' asserted document.querySelector('p[data-line]') synchronously right after awaiting onError. The async read() render can resolve after onError fires; under CI load the DOM read landed before the paragraph was in the tree, flaking the test. Wrap the assertion in waitFor to match the sibling idempotent-dispose test's pattern. Semantics unchanged; only timing tolerance widens. Fixes #1110 --- codev/state/bugfix-1110_thread.md | 18 ++++++++++++++++++ .../__tests__/artifact-canvas.test.tsx | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 codev/state/bugfix-1110_thread.md diff --git a/codev/state/bugfix-1110_thread.md b/codev/state/bugfix-1110_thread.md new file mode 100644 index 000000000..0f61d3eb4 --- /dev/null +++ b/codev/state/bugfix-1110_thread.md @@ -0,0 +1,18 @@ +# bugfix-1110 thread + +## Investigate + +Issue #1110: flaky test `surfaces a synchronous FileAdapter.watch() failure via onError without throwing (D2)` +in `packages/artifact-canvas/src/components/__tests__/artifact-canvas.test.tsx`. + +Verified root cause against source (lines 157-166): +- Line 163: `await waitFor(() => expect(onError).toHaveBeenCalled());` +- Line 164: bare synchronous `expect(document.querySelector('p[data-line]')).not.toBeNull();` + +The async `read()` render can resolve after `onError` fires; under CI load the DOM query at +line 164 lands before the paragraph is in the tree. Race → intermittent failure. + +Sibling test (line 171) uses the correct pattern: `await waitFor(() => expect(...).not.toBeNull())`. + +Fix: wrap line 164's assertion in `waitFor`. One-line semantic-preserving change. Confirmed +BUGFIX scope (trivial, mechanical, no production code change). diff --git a/packages/artifact-canvas/src/components/__tests__/artifact-canvas.test.tsx b/packages/artifact-canvas/src/components/__tests__/artifact-canvas.test.tsx index 0daf00464..a6f184491 100644 --- a/packages/artifact-canvas/src/components/__tests__/artifact-canvas.test.tsx +++ b/packages/artifact-canvas/src/components/__tests__/artifact-canvas.test.tsx @@ -161,7 +161,7 @@ describe('ArtifactCanvas (Phase 3)', () => { const err = vi.spyOn(console, 'error').mockImplementation(() => {}); expect(() => render()).not.toThrow(); await waitFor(() => expect(onError).toHaveBeenCalled()); - expect(document.querySelector('p[data-line]')).not.toBeNull(); // read succeeded → content still renders + await waitFor(() => expect(document.querySelector('p[data-line]')).not.toBeNull()); // read succeeded → content still renders err.mockRestore(); }); From 4289271eb327a1ef8f46c45028a08bc3fe43d271 Mon Sep 17 00:00:00 2001 From: Amr Elsayed Date: Sun, 28 Jun 2026 15:55:57 +1000 Subject: [PATCH 4/7] chore(porch): bugfix-1110 pr phase-transition --- .../bugfix-1110-bugfix-artifact-canvas-test-su/status.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codev/projects/bugfix-1110-bugfix-artifact-canvas-test-su/status.yaml b/codev/projects/bugfix-1110-bugfix-artifact-canvas-test-su/status.yaml index d2b830da6..e1e907f55 100644 --- a/codev/projects/bugfix-1110-bugfix-artifact-canvas-test-su/status.yaml +++ b/codev/projects/bugfix-1110-bugfix-artifact-canvas-test-su/status.yaml @@ -1,7 +1,7 @@ id: bugfix-1110 title: bugfix-artifact-canvas-test-su protocol: bugfix -phase: fix +phase: pr plan_phases: [] current_plan_phase: null gates: @@ -11,4 +11,4 @@ iteration: 1 build_complete: false history: [] started_at: '2026-06-28T05:52:25.996Z' -updated_at: '2026-06-28T05:52:58.629Z' +updated_at: '2026-06-28T05:55:57.904Z' From 846b53dc7811739f4cfcd9eb04be72b21318cf37 Mon Sep 17 00:00:00 2001 From: Amr Elsayed Date: Sun, 28 Jun 2026 15:59:43 +1000 Subject: [PATCH 5/7] [Bugfix #1110] Fix: wrap sibling D2 adapter-error DOM assertion in waitFor CMAP (claude) flagged the identical bare-assertion-after-waitFor race in the sibling test 'surfaces adapter errors via onError and does not throw; failed list keeps prior markers (D2)'. Same root cause: onError can fire before the async read() render flushes. The issue invited fixing such patterns as a ride-along since the file is small. One-line, semantics unchanged. --- .../src/components/__tests__/artifact-canvas.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/artifact-canvas/src/components/__tests__/artifact-canvas.test.tsx b/packages/artifact-canvas/src/components/__tests__/artifact-canvas.test.tsx index a6f184491..6ebfc453a 100644 --- a/packages/artifact-canvas/src/components/__tests__/artifact-canvas.test.tsx +++ b/packages/artifact-canvas/src/components/__tests__/artifact-canvas.test.tsx @@ -130,7 +130,7 @@ describe('ArtifactCanvas (Phase 3)', () => { const err = vi.spyOn(console, 'error').mockImplementation(() => {}); render(); await waitFor(() => expect(onError).toHaveBeenCalled()); - expect(document.querySelector('p[data-line]')).not.toBeNull(); // still rendered, no throw + await waitFor(() => expect(document.querySelector('p[data-line]')).not.toBeNull()); // still rendered, no throw err.mockRestore(); }); From a06c865baabff79b6112ca3e690f22aa6b9dc146 Mon Sep 17 00:00:00 2001 From: Amr Elsayed Date: Sun, 28 Jun 2026 16:00:05 +1000 Subject: [PATCH 6/7] chore(porch): bugfix-1110 pr gate-requested --- .../bugfix-1110-bugfix-artifact-canvas-test-su/status.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/codev/projects/bugfix-1110-bugfix-artifact-canvas-test-su/status.yaml b/codev/projects/bugfix-1110-bugfix-artifact-canvas-test-su/status.yaml index e1e907f55..3e7350c55 100644 --- a/codev/projects/bugfix-1110-bugfix-artifact-canvas-test-su/status.yaml +++ b/codev/projects/bugfix-1110-bugfix-artifact-canvas-test-su/status.yaml @@ -7,8 +7,10 @@ current_plan_phase: null gates: pr: status: pending + requested_at: '2026-06-28T06:00:05.286Z' iteration: 1 build_complete: false history: [] started_at: '2026-06-28T05:52:25.996Z' -updated_at: '2026-06-28T05:55:57.904Z' +updated_at: '2026-06-28T06:00:05.287Z' +pr_ready_for_human: true From da2fda69d0c96bf80ed3ffabb5d22b2a7837ac49 Mon Sep 17 00:00:00 2001 From: Amr Elsayed Date: Sun, 28 Jun 2026 16:00:33 +1000 Subject: [PATCH 7/7] [Bugfix #1110] Update thread: PR phase, CMAP results, pr gate requested --- codev/state/bugfix-1110_thread.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/codev/state/bugfix-1110_thread.md b/codev/state/bugfix-1110_thread.md index 0f61d3eb4..16ff68d0a 100644 --- a/codev/state/bugfix-1110_thread.md +++ b/codev/state/bugfix-1110_thread.md @@ -16,3 +16,25 @@ Sibling test (line 171) uses the correct pattern: `await waitFor(() => expect(.. Fix: wrap line 164's assertion in `waitFor`. One-line semantic-preserving change. Confirmed BUGFIX scope (trivial, mechanical, no production code change). + +## Fix + +Applied the one-line change (line 164 wrapped in `waitFor`). Verified: +- `pnpm --filter @cluesmith/codev-artifact-canvas test` → 56/56 pass +- D2 test stress-run 5× in isolation → 5/5 pass +- porch checks: build ✓ (5.2s), tests ✓ (20.7s) +Committed `[Bugfix #1110]`, advanced to PR phase. + +## PR + +PR #1111 opened (https://github.com/cluesmith/codev/pull/1111). +Running CMAP (gemini/codex/claude) — consult needs `--issue 1110` to disambiguate +the many projects visible in this worktree's `codev/projects/`. + +CMAP verdicts: gemini=APPROVE, codex=APPROVE, claude=APPROVE. +Claude flagged the identical bare-assertion race in the sibling D2 adapter-error +test (line 133) — the issue invited this ride-along, so applied the same waitFor +wrap (commit 846b53dc). 56/56 pass. Posted CMAP results as PR comment. + +`pr` gate requested via `porch done`. Notified architect. **Waiting for human +approval** — will merge only after `porch approve bugfix-1110 pr`.