fix(canvas): repair 100 failing tests + 4 implementation bugs #344

Closed
fullstack-engineer wants to merge 1 commits from fix/canvas-test-fixes-20260510 into staging

1 Commits

Author SHA1 Message Date
a1f38782fa fix(canvas): repair 100 failing tests + 4 implementation bugs
Some checks failed
sop-tier-check / tier-check (pull_request) Failing after 3s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 3s
audit-force-merge / audit (pull_request) Has been skipped
Tests:
- Fix vi.mock TDZ: ContextMenu, TestConnectionButton, SearchDialog — use
  vi.hoisted() for mock factories referencing module-level variables
- Fix jsdom accessibility: StatusDot, Spinner, KeyValueField — use
  container.querySelector('[role="img"]') and getByLabelText for
  type="password" instead of getByRole("textbox")
- Fix DOM pollution: ApprovalBanner, BundleDropZone, StatusBadge,
  ValidationHint, TopBar, RevealToggle, SearchDialog — add
  afterEach(cleanup) to all test files
- Fix TestConnectionButton: vi.mock factory hoisting, getAttribute("disabled")
  returns "" not boolean
- Fix Legend: panel div query selector specificity for left offset tests
- Fix OnboardingWizard: real Zustand store via useCanvasStore.setState()
  for auto-advance test (direct mutation bypasses subscriptions)
- Fix PurchaseSuccessModal: relative URLs to avoid cross-origin
  SecurityError; fake timer flush with vi.advanceTimersByTime; correct
  auto-dismiss headroom (4900ms vs 4000ms)
- Fix Tooltip: React import for Children.map; vi.useFakeTimers in
  "render" block; btn.focus() for activeElement check; aria-describedby
  test rewritten to check portal render; body innerHTML cleanup in afterEach

Implementation bugs:
- ConversationTraceModal.extractMessageText: was joining ALL result.parts[].text
  with "\n"; now returns only the first direct text field
- tree.getIcon: extension was case-sensitive; added .toLowerCase()
- chat/types.createMessage: omitted Object.freeze(msg) and attachments
  key in object literal
- canvas-topology.sortParentsBeforeChildren: orphans were processed
  intermixed with roots, breaking stable input order; now separate roots
  from orphans before visiting
2026-05-10 22:20:04 +00:00