Commit graph

753 commits

Author SHA1 Message Date
Gergő Törcsvári
8a3fc914e5
collab: paste-collision sync-delete fix — lenient sibling restage, forced removals for deleted dirty roots, eeschema child-blob lifting
Field bug (2026-08-31): copy-pasting a symbol whose pins kept their source
uuids corrupted the sheet's ydoc on delete (pcbjam-shared: cross-parent
re-key fix, bumped here); the pcbnew tab's sibling mirror then silently
froze on the dangling refs, so "Update PCB from Schematic" with delete
enabled never removed the deleted symbols' footprints — until any later
edit resynced the sheet.

- standalone sibling-restage: render tolerantly past dangling item refs
  (docToFile onMissingItem) and console.warn on drops/failures instead of
  only the gated debug log — a frozen mirror is no longer silent.
- pcbnew_embind flushDiff: dirty roots that are already STRUCT_DELETED emit
  forced removals on both wires instead of being P-5-skipped (observed: 8
  footprints deleted on the board stayed in the board room forever); they
  are erased from the next baseline so a redo re-adds them.
- eeschema_embind blobFor: lift an unlifted child (field/pin/sheet-pin) to
  its screen root before serializing — the selection writer emits nothing
  for such a child standalone, so the entry used to reach JS as an empty
  envelope and be skipped, silently dropping the edit; residual empty blobs
  now warn instead of shipping hollow envelopes. SCH_MARKER_T (ERC
  artifacts, never file content) stays out of the snapshot and seed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MLPKYptXFrxHj5Gu7rhToz
2026-08-31 12:50:12 +02:00
Gergő Törcsvári
f3119e690f
feat(standalone): floating sheet navigator panel backed by a C++ hierarchy export (sheet-panel)
Canvas-only eeschema sessions (read-only viewers, hide-UI editors) could not
reach the wx hierarchy pane, so a viewer of a hierarchical design was stuck
on the entry sheet. Adds the React stand-in (SheetPanel) + the bridge:

- eeschema_embind: kicadSheetsGetTree() (SCHEMATIC::Hierarchy(), page-number
  ordered: instance KIID path / parent / Sheetname / file / page / depth) and
  kicadSheetsEnter(path) (validated synchronously, applied on the coroutine
  via SCH_ACTIONS::changeSheet — same route as the wx pane, history intact).
  OnSchSheetChanged pushes window.kicadCollab.onSheetsState after EVERY
  navigation, wx-driven included, so the panel is event-driven.
- kicad → 9ab93b838e: navigate actions allowlisted for read-only viewers.
- SheetPanel.tsx: LayerPanel shell conventions; rendered + menu row only when
  the hierarchy has >1 sheet instance; viewers boot it collapsed.
- tests: fixtures/demo/hier (root → Power, IO → Sub) + web/sheet-panel.spec
  (list/order/depth, navigate + collab rebind, menu toggle/close, flat
  schematic has no panel, bridge-driven navigation updates the panel);
  SheetPanel.test.ts for the wire parser.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CtN6ASBvMGNbjPqY5boycg
2026-08-29 16:24:57 +02:00
Gergő Törcsvári
fab6108cbb
fix(standalone): never let the boot-time default-lib create blank the lib tables
Anonymous open of a public project (read-only viewer): boot saw no writable
lib, POSTed createLib("My Symbols"), the session gate 401'd, and the throw
escaped the listLibs try/catch — both sym/fp lib tables were seeded EMPTY for
the session (staging: /tg44/projects/arduino/... Arduino Leonardo.kicad_sch).

- ensureWritableLib(): skipped for readOnly sessions; a failed create is
  logged and swallowed, never propagated (the listed libs stay seeded).
- WasmTool passes readOnly through to boot.
- unit tests for the skip / create / already-writable / rejected-create paths.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CtN6ASBvMGNbjPqY5boycg
2026-08-29 15:18:53 +02:00
Gergő Törcsvári
aa26125f61
tests: findings-p1 keyboard rotate — explicit canvas focus, retried hotkey, skip (not fail) when the hotkey cannot reach the tool on the runner
CI web legs (both engines, run 33212413159) selected the footprint but 'r'
never rotated it; the keyboard chain is gated on the kicad harness variant
(green on CI), so an unexercisable precondition here is a skip with a PROBE
line, not a P-1 failure.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LvvARNMxQrq17vogn3REMU
2026-08-28 23:46:13 +02:00
Gergő Törcsvári
c666a37f51
tests: dark-mode spec diffs against a per-engine light-mode reference
CI firefox read 0.228 header diff against the Chromium reference while its own
dark and light renders were pixel-identical — pure Firefox-vs-Chromium AA, not
a theme leak. Add the firefox light render as wizard-04-finish-headless-firefox.png
and pick the reference by browserName.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LvvARNMxQrq17vogn3REMU
2026-08-28 23:24:20 +02:00
Gergő Törcsvári
ac0a42ef00
tests: findings-p1 keyboard-rotate spec falls back to kicadCollabTestSelectByUuid when the click misses
On a saturated runner the canvas lags the viewport past the click budget
(local full web sweep: 'click-select of the first footprint' timed out); the
spec gates the rotate → flushDiff → fit chain, not hit-testing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LvvARNMxQrq17vogn3REMU
2026-08-28 22:31:33 +02:00
Gergő Törcsvári
c4bdaad7a0
staging CI green-up: P-1 apply-slot wedge under JSPI, popup P-4 regression, ysync double-seed header, spec fixes
- P-1 (findings-p.spec P-1c red on CI + locally): a JS exception thrown from a
  window.kicadCollab wire callback does NOT reach the C++ catch(...) — under
  JSPI it REJECTS the promising coroutine entry, slot.done never flips and the
  apply slot is busy for the page's life. Three layers: libcontext flags the
  rejected record dead (kicad → d0afbc4bd3),
  drainApplies() reaps a !done && !CanResume() body, and every EM_ASM
  window.kicadCollab.onX(...) call is try/catch-guarded (collab_common.h,
  kicad_editor/eeschema/pl_editor embind).
- popup.spec 'dismisses on outside click': wx P-4 SetFocus delegation excluded
  for wxPopupWindow (wxwidgets → a7436d1052).
- ysync-two-tab concurrent seed: repairLayoutY + seedNonce retraction deleted
  both headers (pcbjam-shared → 8dabf2e).
- dark-mode.spec: stale light-mode reference (pre wx fa46f1822c DOM
  re-projection) replaced with the CI chromium render.
- items-wire-batch-loss.spec: precondition obsolete after P-5 — poisoned entry
  is now synthetic, plus a P-5 contract assertion (field blob == '').
- presence-ghost-peer.spec: skip early when no /parties/ socket (CI web e2e
  runs the BroadcastChannel provider); findings-p1.spec: polled click-select
  precondition.

Local: kicad-chromium findings/presence/ysync/collab 59/59, popup 7/7,
dark-mode 1/1, pcbjam-shared vitest 249/249.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LvvARNMxQrq17vogn3REMU
2026-08-28 22:25:21 +02:00
Gergő Törcsvári
f409294c77
tests: annotate documented dwells in group-Y presence specs (determinism lint)
lint:determinism failed the staging deploy (run 33200086355) on 5 lines in
the presence specs committed 8/28: overlay-repaint dwells before settledShot,
the best-effort #canvas focus, and the sampling cadences of the two explicit
presence-eviction poll loops. All are intentional; annotate them the way
3d-viewer-*.spec.ts does so the guard accepts them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LvvARNMxQrq17vogn3REMU
2026-08-28 21:30:49 +02:00
Gergő Törcsvári
f6b0aaf122
findings X-1: pin every dependency tarball fetch to a SHA256 and enforce it
security-audit-v3 #15. download_file already had a verify branch; no caller
used it and every *_SHA256 in versions.sh was a commented placeholder, so a
tampered mirror tarball flowed straight into configure/make and the shipped
WASM.

- versions.sh: 13 pins (cross-checked against Homebrew/Buildroot/nixpkgs/
  FreeBSD/vcpkg/boost.org/curl PGP; glm .zip is TOFU), boost/curl/libgit2
  versions moved beside their pins.
- all 13 download_file call sites pass "${NAME_SHA256}".
- download_file refuses an empty or malformed pin (PCBJAM_ALLOW_UNPINNED=1
  to bootstrap a new dep); file_sha256 prefers sha256sum, falls back to shasum.
- scripts/deps/check-pins.sh: static 3-arg check + offline file:// enforcement
  test; runs in wasm-build.yml before the deps cache, on cache hits too.

Expect one cold --build-deps run: the deps-cache key hashes versions.sh.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GcsgJZ77bhZatLAVU8R84H
2026-08-28 20:34:16 +02:00
Gergő Törcsvári
5ce919daa6
findings group W: pins/presence bridge never receives non-finite coords (W-1/W-4)
- comments.ts pushPins: finite filter; presence-kicad: finiteCursor() drops non-finite peer cursors.
- collab_presence_core.h: numOr() — a present JSON null no longer throws type_error.302
  across embind in setPins/setRemote/setRemoteCursors (takes effect on next wasm build).
- comments-nonfinite.test.ts: sink repro (boot + throttled live push).
- pcbjam-shared → ff8835c (finite wire schemas, resolveAnchor guard, encoded route segments).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CwF7w1pkSTh5Z8jQyiXmHm
2026-08-28 19:42:31 +02:00
Gergő Törcsvári
af07a413ee
ysync bug 07 UP side: superseded sheet switch never adopts onto the new screen + apply envelope sheet tag/guard (subsheet self-reference fix)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013MnySXALJiYsRQ5mCrxgwX
2026-08-28 18:19:29 +02:00
Gergő Törcsvári
602f5c6fed
collab: passive pull facade, sibling mirror without BoardRoom wake (load-path-rework 0004)
- GatewayDocFacade: passiveSync (Step1 on subscribe + on touched, answered by
  the gateway from at-rest state), onReset; activate() after a passive fill
  still sends act + a participant Step1.
- sibling-restage subscribes passive+passiveSync; reset drops the watch (no
  flush) and re-dials while a peer still has the sheet open.
- files-watch: upload/job hints on room-backed paths restage + announce
  onRoomBackedChanged; sheet-manager.invalidate() drops a parked room.
- kicad-binding: normalize server-serialized bodies on the editorMatchesDoc
  path (runner-seeded ydocs carry kicad-cli's serialization).
- pcbjam-shared -> 0f4d3a1 (reset control, kicadDocToYdocUpdate).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UQsdqaX57xzcCWUjqP7ctV
2026-08-28 17:55:59 +02:00
Gergő Törcsvári
7a9aeb5181
presence: fix stale peer selections after delete, select-all lag, ghost-peer removal (findings group Y)
- wasm core: CORE::onDocChanged() from both collab listeners (local commit AND
  remote apply) repaints peers' shapes from the live document + re-checks the
  local selection post-settle; PresenceStart registers the bridge listener
- wasm core: cursors on their own overlay trio; shapes repaint only when the
  non-cursor snapshot changes; new kicadCollabSetRemoteCursors (cursor-only
  update, PEER.id) in both TUs + merged editor + JSPI mutator allowlist
- presence.ts: size-aware trailing throttle for cursor/viewport publishes
  (128 KB/s budget) + parsed-peers memo; presence-kicad.ts: cursor-only push
  when the shape signature is unchanged
- gateway.ts: honor the `gone` control (removeAwarenessStates)
- specs: kicad stale-after-delete gate, web ghost-peer timing (+diag), unit
  select-all budget (pcbjam-shared → 4573a7c)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AScTR39aqyrY5i3ZFHmnMn
2026-08-28 16:14:44 +02:00
Gergő Törcsvári
d069b7be80
findings Q-2: a non-target sibling fetch failure no longer aborts the open
syncProjectToMemfs rethrew the first rejected fetchBytes whatever file it
was, so one missing/unreadable sibling (a .kicad_sch body gone, a Q-1
phantom row, a transient 5xx) took the whole board open down behind
"download failed (404)". Now only the TARGET's failure rejects; siblings
are logged, counted and reported through onStatus, and KiCad reports a
missing sheet itself. kicad-runner.test.ts pinned the old contract with a
non-target file — corrected to a target; new kicad-runner.findings-q.test
gates both branches.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D9KFksoViNPYYs1ygkcAoQ
2026-08-28 15:15:08 +02:00
Gergő Törcsvári
9e757c5396
findings R: coverage for the demo-ledger fixes (R-2, R-3, R-4, R-9) — tests only
- R-9: tests/kicad/project-sync.spec.ts gains an effect-asserting test —
  stages a self-contained footprint lib (ecc83 R_Axial as SyncFixture.pretty
  + absolute-uri fp-lib-table via a new stageAndOpen beforeOpen hook), presses
  Update PCB, and asserts the board's footprint references through
  kicadCollabSnapshot/kicadCollabTestItemBlob (R777, then R888 after a
  schematic rewrite + re-sync). Red-first: the dialog report said "Add R777"
  while the board stayed empty when the button click never landed.
- R-2: tests/kicad/via-snapshot-assert.spec.ts — two-via board, exact widths
  + no PCB_VIA::GetWidth wx assert line in the console.
- R-4: tests/web/console-copy.spec.ts — Ctrl/Cmd+C over a console selection
  fires `copy` (guard stops the keydown before wx); canvas pointerdown
  collapses the selection. ControlOrMeta: headless engines use the HOST copy
  accelerator regardless of the device UA.
- R-3: workers/cdn gets a vitest harness (package.json + lockfile) and
  test/index.test.ts with a workerd-like stub bucket (always-defined range):
  plain GET is 200/no Content-Range, Range → 206, HEAD/304/404/405/OPTIONS.
  Mutation-verified (pre-1ea35f7 gating → 2 reds). CI step added after the
  corpus lint; node_modules gitignored.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015j8uFzSjwRrAeJ85QWVLQa
2026-08-28 13:56:53 +02:00
Gergő Törcsvári
3d19117d88
findings group P: liftBlob field gap (P-5), apply-slot hardening (P-1), chooser-held rotate (P-4)
- P-5: blobForItem returns "" for PCB_FIELD_T (the file writer cannot format a
  field standalone → hollow (kicad_pcb …) envelope); liftBlob skips empty blobs
  and STRUCT_DELETED roots with a console breadcrumb; the scalar added path and
  the seed never attach an empty blob.
- P-1 (not reproduced, structural): the runOnCoroutine apply body runs in
  try/catch(...) so an unwinding body still marks the slot done instead of
  wedging fit/pan/flushDiff/remote applies forever; new probe
  kicadCollabTestApplyQueueState() → {busy, queued}.
- P-4: wxwidgets 9666a743bc (TLW SetFocus delegates to a child,
  menubar never takes focus); probe kicadTestFocusWindow() (wx FindFocus).
- Specs: tests/kicad/findings-p.spec.ts (P-1 ×3, P-2 probes as fixme, P-3 ×2,
  P-4, P-5), tests/web/findings-p1.spec.ts (P-1 on the real standalone).
  P-2 verdict: stock KiCad candidate priority, text scales normally; P-3 not
  reproducible — see docs/features/findings/groups/P-editor-tools-embind-interaction.md.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmnMPkjugyGqe4LvUsBB14
2026-08-28 12:57:51 +02:00
Gergő Törcsvári
931935c70a
findings group O: chooser Enter + infobar close fixes (wx → 15e5315244) with repro specs and uipolish guards
- tests/kicad/footprint-chooser-confirm.spec.ts (O-2): typed filter + Enter
  confirms the chooser and a footprint is placed.
- tests/kicad/infobar-dismiss.spec.ts (O-3): real click on the older-version
  infobar close glyph dismisses it; GAL rect shift logged.
- uipolish app/spec: rounded-neg-radius (O-1 guard), enable-propagation (O-3),
  dom-nav-keys Enter/ArrowDown → CHAR_HOOK with TEXT_ENTER once (O-2).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01At3cyLvFWbfNdCNW7x7C2A
2026-08-28 11:31:32 +02:00
Gergő Törcsvári
97d4f9657e
read-only-viewer 0003: no lib catalog for viewers; 3D viewer from the session menu
- kicadShow3DViewer embind (pcbnew-only name, registered in the unguarded
  section so the merged kicad_editor image carries it): runOnCoroutine →
  ACTIONS::show3DViewer.
- Session menu: "3D viewer" row (pcbnew) — the only 3D entry once the wx
  chrome is hidden. Runs the deferred model prescan first.
- Read-only sessions: skip the boot-time enableRealtime scope-room socket
  (would 401 for non-members) and defer the board's 3D-model prescan until
  the viewer is opened (deferBoardModelPrescan / runDeferredModelPrescan).
- kicad submodule → read-only allowlist for the 3D viewer actions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PXCntRWNn89M72EkrqMkvc
2026-08-27 15:26:30 +02:00
Gergő Törcsvári
c80622a860
wx wasm: grid cell editors typeable (wxwidgets → d32535fefb) + gating e2e
tests/kicad/grid-editors-typing.spec.ts: Symbol Properties fields grid —
types into the canvas-drawn STC Value editor and the wxComboCtrl-based
Footprint editor, commits via OK, saves and reads both values back.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MKyjp6N4BeYb1qZVJemPFN
2026-08-27 14:42:37 +02:00
Gergő Törcsvári
9575498c9e
cvpcb: footprint filter box drawn too high and dead to clicks (wx fa46f1822c)
wx submodule bump: DOM controls re-projected when a frame's client origin
moves (menubar attached after toolbars). Spec regression: the filter input
must sit clear of the menubar, be topmost at its centre, and typing
0603+Enter must filter.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ws9hayc7nLHHMdZhwcjUGX
2026-08-27 13:47:07 +02:00
Gergő Törcsvári
c981e3dc75
collab: repair duplicated layout header groups after seed and on remote layout merges (ysync 0011 follow-up; shared → f14401b)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0189z2siCsezE39ugcDKNBMs
2026-08-27 10:17:23 +02:00
Gergő Törcsvári
8fa6bae084
fix: hollow sheet rooms wiped subsheets on entry (ysync 0011) + hierarchy pane icon sizing/selection colours
Collab: a save-all's layout-only sync into a never-entered sheet room left a
doc with layout but zero items; the first entry adopted it and removed every
item on screen. seed() now file-seeds a hollow doc, syncLayoutFromSave skips
never-seeded empty rooms, and the ydoc-boot / sibling-restage paths fall back
to the file. Tree: new tree-hier standalone app + e2e spec covering the
wxwidgets bundle-size and unfocused-selection fixes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0189z2siCsezE39ugcDKNBMs
2026-08-27 08:59:01 +02:00
Gergő Törcsvári
767f2abfc0
libs 0019: remote lib edit — invalidate, don't auto-reload; editor copy counted + re-read
- kicadLibsInvalidate: a peer's edit only drops the lib's plugin entry + pcbnew's
  PreloadedFootprints (the cache the old reload never cleared — tree/preview/
  LoadFootprint/update-from-library kept serving the old body); the fat re-load
  now runs lazily or from Update-from-library (kicadLibsReload, which also
  clears the preloaded cache)
- usage bridges count the Footprint/Symbol Editor's open copy; update re-opens
  an unmodified copy, reports a modified one
- embind TU gets eeschema/symbol_editor on its include path; smoke probes
- kicad → 27051b46e2

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012Wd1r3ewftpV1DBSEArpRa
2026-08-26 14:10:25 +02:00
Istvan Matejcsok
d7cb570f07 fix(wasm): 3D-viewer toolbar clicks hijacked by hidden main-frame DOM controls — input barrier + canvas anchoring
wxwidgets bump: main-window DOM controls join the input barrier when a
secondary window overlaps them; secondary windows/GL canvases anchored to the
.window.toplevel border→outline.

Tests (TDD, red on the old wx.js): standalone secondary-frame app (main-frame
wxChoice under a secondary wxFrame's AUI toolbar) + e2e/secondary-frame-input
spec (fall-through hit-testing, click delivery, barrier follows drags), and
kicad/3d-viewer-toolbar-hijack spec (viewer at top-left over pcbnew's combos —
the user-reported repro). modal.spec border assertion updated to the outline
ring.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-26 13:19:34 +02:00
Istvan Matejcsok
4b92175c4e tests: eeschema-copy-paste — satisfy the determinism guard
CI's lint:determinism rejects blind waitForTimeout. Convert the chromium
clipboard-content read to expect.poll (the write lands after a JSPI
suspension) and annotate the remaining waits as documented interaction
dwells — select-all/paste/commit resolve inside the wx tool framework with
no page-observable, and the test's real gate is the FS-save poll.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-26 12:16:57 +02:00
Istvan Matejcsok
6034a0550d eeschema copy/paste fix: wx UTF-8 text dataobj (c1f1477) + regression specs
Cmd+C/Cmd+V in the wasm eeschema pasted a stray "(" SCH_TEXT — the stroke
font renders it as a small blue arc — instead of the copied symbol, and any
copy reached navigator.clipboard as a single character. Root cause and fix
live in wxwidgets (90bbad29822: UTF-8 wxDF_UNICODETEXT + the port's missing
GetAllFormats key function; c1f14775ba3: empty-read cache fallback + no
browser pre-clear on copy). This bump carries them plus the guards:

- tests/kicad/eeschema-copy-paste.spec.ts: chromium asserts the full
  multi-form (lib_symbols …)(symbol …) blob reaches navigator.clipboard;
  both engines assert copy → paste → save yields a second symbol and no
  stray (text …) item (firefox exercises the m_textCache fallback path).
  The kicad-chromium project now grants clipboard-read/write. NB the kicad
  projects' device UAs claim Windows, so specs must send plain Control+…
  — ControlOrMeta resolves to Meta on a mac host, which the "Windows" app
  ignores, and the bare key fires eeschema hotkeys instead.
- tests/e2e/textdataobj.spec.ts + Makefile.wasm target `textdataobj`:
  drives the wx-repo harness app (wxwidgets/tests/wasm/textdataobj_test.cpp)
  and asserts the SUITE-DONE failure counters plus the full-string browser
  round-trip, sentinel-seeded so a failed write cannot read as stale success.
- tests/e2e/clipboard.spec.ts: the Copy test now asserts the full input
  text reaches the clipboard (previously truncated to "S").

Verified locally: all specs red on the old wx, green after; wx-chromium
320/320, kicad-chromium 121/121 (collab specs env-gated).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-26 11:21:00 +02:00
Gergő Törcsvári
fcad12d251
tests: fpedit-cmd-save — drop the from-pcbnew variant (CI timeouts), keep the standalone frame
Same FOOTPRINT_EDIT_FRAME and the same wx-layer focus rule; opening a second
editor from a board session never became ready on CI (Chromium 180 s, Firefox
footprint load >60 s).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012Wd1r3ewftpV1DBSEArpRa
2026-08-26 09:05:37 +02:00
Gergő Törcsvári
079522d1e7
standalone: split the WasmTool component body
useLibNotices hook (toast/stale-lib/load-badge state + window listeners +
auto-dismiss timers) and presentational children — NoticeStack, SessionMenu
(+ StaleLibsRow, FollowBanner), BootOverlay, LibLoadingOverlay, FatalOverlay,
ConsolePanel. Behavior and data-testids unchanged; WasmTool.tsx 2378 → 1680
lines. The boot effect + collab wiring stay in place.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012Wd1r3ewftpV1DBSEArpRa
2026-08-25 19:52:11 +02:00
Gergő Törcsvári
866db5888c
libs 0017: sync overrides indexed + stale-lib session menu + Cmd+S DOM-focus fix + WasmTool split
- kicadLibsFootprintUsage + kicadUpdateFromLibrary embinds (result via
  pcbjam:lib-update-done — runOnCoroutine is deferred)
- standalone: stale-lib FAB triangle + session-menu Update-from-library row,
  save busy notice names the item, footprint placed-usage in the toast
- WasmTool.tsx split: module helpers → components/wasm-tool/
- specs: save-cmd-key (Meta+S, mac UA), fpedit-cmd-save (DOM-focus repro)
- wxwidgets → cdd5a5c (wxDomBlurActive)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012Wd1r3ewftpV1DBSEArpRa
2026-08-25 17:58:54 +02:00
Gergő Törcsvári
9a19b96b6c
standalone: file-change hints — ~files watch, sibling restage, target notice (project-sync 0002)
GatewayDocFacade.onFiles + hint-only channel; files-watch router (Tier 0
echo/observed bookkeeping, Tier 1 debounced sibling restage, Tier 2 open-
target notice); WasmTool/ToolPage wiring with observed-revision seams.
Bumps pcbjam-shared (4fd6af2).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012Wd1r3ewftpV1DBSEArpRa
2026-08-25 13:55:01 +02:00
Gergő Törcsvári
5650e6193f
standalone: room-backed files skip the save upload (save-flow uploadPolicy)
In ydoc mode the collab room owns a document's state — items reach it at
commit time, layout heads at save time (syncLayoutFromSave). The raw CAS
PUT on Ctrl+S was only ever the file-list registration + fallback copy,
but for a file the listing already marks hasYdoc/isLive it bumps the
revision for nothing, can 409 the target into the durable save-blocked
banner, and leaves a shadow row the ydoc supersedes on every read.

registerSaveHook gains `uploadPolicy(relPath) → "upload" | "room"`;
WasmTool marks the boot listing's ydoc/live files "room" (ydoc mode only).
Files with no row yet (created sheets, the synthesized .kicad_pro) still
upload; onSavedText still runs for room-backed saves.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012Wd1r3ewftpV1DBSEArpRa
2026-08-25 13:23:03 +02:00
Gergő Törcsvári
473e1eb935
3D models from the registry: --models-source flag, staging + prod editor builds
The staging editor was built with neither --models-tag (no models on the
staging CDN) nor VITE_MODELS_SOURCE, so modelsSourceConfig() returned null,
no model3d handler was installed and every 3D ensure answered "(unserved)"
despite the chunked packages3D ingest being complete on the staging registry.

- build-editor.mjs: --models-source <cdn|registry> → VITE_MODELS_SOURCE
- deploy-staging.yml: editor builds with --models-source registry
- release.yml: prod editor builds with --models-source registry (libs/0016 §6
  step 4); MODELS_TAG now only feeds the demo build, which has no closed API.

Prod rollout order: split-lib-kinds + packages3D ingest on prod BEFORE the
next release tag — prod's registry currently has 0 model3d libs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H1iwtBFvQ8CFg966bqSZh2
2026-08-25 13:23:03 +02:00
Istvan Matejcsok
c3bb5d2cb1 bump kicad: unbind GL_ARRAY_BUFFER after raytracer-blit setup (ab62afa4732)
The blit's one-time setup leaked its quad-VBO GL_ARRAY_BUFFER binding
(not VAO state); the raytracing->OpenGL switch-back reload then captured
client-memory gl*Pointer addresses as offsets into that 48-byte buffer and
baked them into the recorded display lists — every frame INVALID_OPERATION,
viewer blank until canvas recreation. Found via a bounded routed-draw
diagnostic on the live repro; verified by driving two full real-Chrome
round-trips (back-to-OpenGL frame hashes byte-identical to pre-toggle).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-25 12:36:43 +02:00
Istvan Matejcsok
daaff1f973 fix(3d): blank viewer after raytracing round-trip — owner-context FFP routing + VAO isolation (gl1)
Switching OpenGL → raytracing → OpenGL could leave the viewer showing only the
background gradient, with mid-session "[gl1] WebGL context changed" thrash and
INVALID_OPERATION storms on BOTH WebGL contexts. Traced mechanism: the shim's
FFP draw routing keyed on one process-global client-array flag; an interrupted
fixed-function window (MODEL_3D::BeginDrawMulti loops, or the switch-back
reload re-recording display lists with the GL context lock released across
JSPI suspensions) left it set, after which the raytracer blit's and the 2D
GAL's glDrawArrays were routed through the FFP pipeline — and one misrouted
draw permanently repointed the VICTIM's own VAO attributes at shim buffers
(the blit's attribute 0 collides with ATTR_POSITION), so both stayed
broken/blank even after the flag cleared.

Shim fixes (wasm/gl1):
- Owner-context routing gate: __wrap_glDrawArrays/Elements route into the FFP
  pipeline only under the shim's owner context (adopted at the first FFP
  client-state mutation or programSync in a context); foreign-context draws
  always pass through — the 2D GAL can never be misrouted and the context
  guard can never thrash.
- VAO isolation (ScopedDefaultVAO): draw executors do their attribute setup on
  VAO 0 and restore the caller's binding — a misrouted draw can no longer
  corrupt the caller.
- contextSync() resets the whole client-array mirror on a context change
  (enables/pointers/VBO names all described the dead context).

kicad pointer bump (d6e3dc1a87a): blit preamble disables the four client
arrays (same-context firewall) + DoRePaint hidden-parent early return now
clears m_is_currently_painting like its six siblings (a standalone
sufficient cause of a permanently blank viewer).

TDD (each observed red before its fix, green after; harness = authoritative):
- T1 VAO corruption, T2 foreign-context routing + guard thrash, T3 stale
  client-state surviving context recreation — tests/e2e/3d-webgl.spec.ts over
  new harness choreography (appQuad/ffpMakeStale/createSecondContext/
  quadDrawFresh). Parity stays 47/47 with zero drift.
- tests/kicad/3d-viewer-engine-toggle.spec.ts (new, CI-skipped like the
  deadlock spec): real round-trip happy-path gate — board re-renders, zero
  [gl1] lines, zero INVALID_OPERATION. (The raytraced image itself never
  displays on the wasm build — the pre-existing inert-toggle KNOWN ISSUE in
  3d-viewer-deadlock.spec.ts, out of scope here; the engine switch and the
  poisoning reload path run regardless.)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-25 11:25:34 +02:00
Gergő Törcsvári
b824eb007a
standalone: record CAS base revision for sync-bundle-staged files
Files staged from the project sync namespace bundle (stageViaProjectSync)
never passed through fetchFileBytes, the only place baseRevisions was set,
so their first save PUT carried expected revision 0 and 409'd against any
row ever re-saved — e.g. assigning a footprint (CvPcb → eeschema root save
also writes .kicad_pro) failed with "Save conflict … (local base 0,
server 1)".

Add ProjectSource.rememberBaseRevision + api.rememberFileBaseRevision,
DriveOptions.onStagedRevision reported by stageViaProjectSync with the
listing revision, and wire it through WasmTool from ToolPage.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012Wd1r3ewftpV1DBSEArpRa
2026-08-24 19:36:51 +02:00
Gergő Törcsvári
cf28e3be82
tests(trio): settleConverged names the diverging tab + first differing line
A bare expect(false).toBe(true) after the 90s poll hid WHAT diverged in the
drift-trio S4 same-item races (CI 2026-08-24 ×2, local under 15-worker
contention 2/21). The failure now reports each tab that differs from A and
the first differing model line, so the next divergence self-documents
(memory: s4-value-race-divergence — never re-quarantine without the diff).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AH2iPekUGsEAYnMUD5BmAi
2026-08-24 19:35:52 +02:00
Istvan Matejcsok
7a88399a60 fix(dialogs): centre unpositioned dialogs — repair the origin-placement regression from the display-index fix
The display-index fix (wxDisplay::GetFromWindow returning 0) disabled
DIALOG_SHIM::Show's accidental always-Centre() fallback, so every
unpositioned dialog opened at the port's literal (0,0) wxDefaultPosition.
CI caught it: the eeschema text-properties dialog opened under the
just-clicked canvas-centre point, its OK/Cancel corner swallowed the
trailing mouse event and the dialog insta-closed (run 32739091966 — the
dialog exists in exactly one trace snapshot; passes locally where the
dialog finishes opening after the click sequence).

wxwidgets bump: wasm wxDialog::Show now centres any dialog still at (0,0)
on first show — the native default-placement parity native ports get from
the window manager. Restores the exact pre-regression on-screen placement
(and thereby every dialog screenshot baseline).

New red->green test: eeschema-ui.spec.ts "text properties dialog opens
centred, not at the top-left origin" — clicks away from the dialog's
centred footprint (so no engine can reproduce the swallow), asserts the
dialog window div is viewport-centred; was at (0,0) pre-fix, (332,171)
post-fix.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-24 17:50:21 +02:00
Istvan Matejcsok
3722891d48 fix(3d): blank render + lost position after 3D viewer close/reopen (gl1 context guard)
Closing the viewer destroys its wxGLCanvas's WebGL context; reopening mints a
new one. The gl1 shim cached GL names (FFP program, stream/scratch VBOs) in
never-reset statics behind `if (!handle)` guards — in the new context every
draw died with INVALID_OPERATION and the viewer showed only the clear color
("Reload time 0.031 s" is benign: warm model caches make the rebuild fast).

contextSync() (gl1_state.cpp) now detects the context change in programSync()
— the one choke point every shim draw crosses, and a path the 2D GAL never
reaches (a first attempt checking in the glBindTexture wrap saw the GAL's
context and thrash-rebuilt the program 23x per run) — and drops the cached
names for lazy rebuild in the new context. Context identity is a monotonic id
stamped on Emscripten's per-context record: the numeric
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE is recycled, so a destroy-then-create can
return the same number and a handle comparison detects nothing.

The lost-position half is a wxwidgets wasm fix (pointer bump: GetFromWindow
reports display 0; saved geometry used to carry display=(unsigned)-1, which
LoadWindowState treats as "display not found" and re-centres the frame).

TDD (red observed before each fix, green after):
- tests/kicad/3d-viewer-reopen.spec.ts (new, own worker like the deadlock
  spec): load board, open viewer, render-gate, drag by the titlebar, close
  via the x, reopen; asserts the board re-renders (was: 1 distinct colour for
  90 s) and the window position is restored (was: re-centred to 0,0 after
  closing at 40,90). Green run logs exactly one [gl1] context-change line.
- 3d-regression harness: recreateContext() destroys the context AND swaps in
  a fresh canvas element (a browser canvas keeps its context for life, so
  same-element recreation hands back the live old context and hides the bug);
  the new 3d-webgl spec test renders redraw-mini-board-navigator before and
  after recreation and requires pixel-identical output. Parity: 47/47, zero
  drift.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-24 16:18:22 +02:00
Gergő Törcsvári
90bc4e0222
batched upload resave: --resave-batch CLI + one staging pass per bulk upload (tasks-runner 0004)
kicad_tools --resave-batch <outdir> <file>...: N resaves in one process
(one WASM init — marginal resave is ~50ms vs ~0.3s/process). Outputs in
<outdir>/<index>/, per-file "RESAVE-BATCH <index> <exit-code>" stderr
verdicts with the single-file 0/4/5 contract; exit 0 = loop completed, so
an invalid file mid-batch can't mask its neighbors.

loadSchematicHeadless now binds each schematic to ITS project via
SETTINGS_MANAGER::GetProject, never Prj(): with aSetActive=false projects
accumulate across batch entries and Prj() keeps returning the first one —
the writer then stamped a wrong/empty project name into saved
symbol-instance data. (UnloadProject is no fix: unloading the active
project immediately reloads a null "" project.)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AH2iPekUGsEAYnMUD5BmAi
2026-08-24 14:46:43 +02:00
Gergő Törcsvári
864ddb00a4
bump wxwidgets: negative-radius DrawRoundedRectangle fix
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gsotr7TSq2SQ3bQMrBVb61
2026-08-24 11:06:36 +02:00
Viktor Vaczi
f419a1fedd build+perf: wasm-opt the shipped wasm, and measure real frames in CI
emcc only runs Binaryen at link -O2+ (link.py: should_run_binaryen_optimizer
returns OPT_LEVEL >= 2) and we link at -O1, so the shipped module had never seen
wasm-opt at all — it kept its entire 19.56 MB name section, ~20% of the editor
(-sJSPI sets ASYNCIFY=2, which suppresses wasm-ld's --strip-debug, leaving
wasm-opt as the only thing that would drop it). Step 8.2 runs it post-link and
in-container, so CI's cached compile phase covers it and the host post-process
stays pure-host.

Default -O2, picked by measuring every level on the same module: -O0 already
captures 27% of the raw win (it is mostly the name section), -O2 costs 23 s and
gives the best frame rate, and -O3/-O4/-Os/-Oz cost 48-132 s for at most 1.5%
more brotli — -O4 is not even smaller than -O3. Targets that already link -O2/-Oz
(occ_service, kicad_tools) are skipped by testing for the target_features
section, which emcc strips whenever it ran the optimizer itself, so there is no
hard-coded target list to drift. Feature flags come from the module's own
target_features section and so cannot diverge from the link.

The perf specs reported requestAnimationFrame ticks as "FPS". That is not a frame
rate: rAF fires on the compositor's schedule whether or not the GAL redrew, and
it read 120/s on a board where the renderer completed zero frames in six seconds.
measureInteractionFps now counts completed GAL frames — runs of draws to the
default framebuffer, exactly one per frame in every AA mode — and drives a pure
middle-drag pan after a zoom-to-fit. Mixing wheel zoom into the drive made the
result depend on where the wheel left the view: +-20% across identical repeats,
against +-2% for pan alone. The report gains a GAL fps column with a regression
flag on the 1x number; rAF is kept so historical runs stay comparable.

CI has no GPU, so its number is a software-rasteriser redraw rate — a regression
signal, not a user-facing frame rate. Method and measurements in the bench report.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016X9eh1s5sTx1o9Em9KBuwR
2026-08-22 12:53:00 +02:00
Gergő Törcsvári
745b8f413a
version badge: display commit hashes GitHub-style (7 chars)
Staging tags are "staging-<full 40-char sha>" — shorten any embedded
full hash for display only; the corresponding-source link keeps the
full sha, release tags pass through untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011gJ3M1RpeZLeNUUj8jKC4h
2026-08-20 11:49:56 +02:00
Gergő Törcsvári
3df3468d36
viewer-panels: read-only boots panels open-collapsed; kicad-style layer rows
- Read-only sessions boot BOTH panels open as collapsed headers (a stored
  per-browser choice wins); inspector's default anchor moves to the
  top-left, layers keep the top-right stack under the FAB.
- Layer rows follow KiCad's Appearance-pane order: color swatch, eye
  toggle, layer name (name click = set active).
- read-only spec: boot-default assertions (open + collapsed + top-left
  anchor) in the lock test, chevron expansion in the panels test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011gJ3M1RpeZLeNUUj8jKC4h
2026-08-20 11:49:55 +02:00
Gergő Törcsvári
acc76f65ec
feat: viewer panels — layer selector + selection inspector (viewer-panels)
Canvas-only sessions (read-only viewers, hide-UI editors) get two
floating, draggable, closable panels standing in for the chrome-hidden
wx panes, opened from the overlay menu's View section:

- wasm/bindings: layer bridge — kicadLayersGetState/SetVisible/SetActive
  (bodies mirror the compiled-in-but-unreachable IPC handlers, applies
  on the coroutine lane, fresh state pushed to
  window.kicadCollab.onLayersState); setters join the jspi-scheduler
  mutator lane.
- standalone: LayerPanel + SelectionInspector on the comments-panel
  shell conventions (useDraggablePanel, collapse, persisted state);
  local-selection store fed from presence's onSelection in edit
  sessions and bindLocalSelectionFeed for read-only viewers (with a
  bounded post-gesture pull burst — clarify-menu selections produce no
  canvas event); pure item-summary extraction + unit tests.
- kicad submodule: read-only selection unlock (selection live for
  inspection; point editors + RMB context menus stay locked).
- tests/web: read-only spec updated — viewer click selects (or pops the
  clarify list), RMB context menu suppressed with writer positive
  control, Delete still swallowed; new viewer-panels test (eye toggle
  round-trip, active layer, panel drag, inspector rows from a real
  canvas click).

Record: docs/features/read-only-viewer/0002-viewer-panels.md (root).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011gJ3M1RpeZLeNUUj8jKC4h
2026-08-20 11:29:46 +02:00
Gergő Törcsvári
47bd6d1a3e
feat: lib kind identity + chunked packages3D ingest + registry model serving
Standalone side of the collision fixes + registry 3D serving:
- remote list + boot preload map the backend's collision-safe mount
  nickname into LibInfo.name — one string everywhere KiCad-facing, so
  lib tables never mount duplicate names (first-match-wins shadowing)
- registryModelsSource beside cdnModelsSource: model3d origin libs as
  sparse sync layers (boot-preloaded index/stacks, IDB per version);
  VITE_MODELS_SOURCE=registry opts in, CDN stays default
- bumps web/pcbjam-shared (libSchema.nickname)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K3C6837qtdFU84xWhFekxd
2026-08-20 09:35:17 +02:00
Istvan Matejcsok
75bb0d7661 fix(tests): restore the dark-mode spec's light-mode reference PNG
tests/wizard-04-finish-headless.png is a spec-owned reference image the
dark-mode spec diffs against in-process (toolbar must ignore the
browser's dark theme) — it was never a promotable baseline, but the
baselines-to-R2 migration (6dfa6eb) swept it out of git with the rest of
the PNGs, and every e2e run since fails with ENOENT at
screenshot-compare.ts:56. Restored verbatim from 6dfa6eb^ and documented
as deliberately committed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 15:11:39 +02:00
Istvan Matejcsok
471e078a9d ci: forward the R2 write pair to staging builds — runs become reviewable in morelli
Staging deploy builds now upload their renders to runs/pcbjam/<run-id>/
like ci-ubicloud does (secrets: inherit there), so render changes on the
staging branch can be reviewed and promoted in morelli without a manual
ci-ubicloud dispatch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 15:07:26 +02:00
Istvan Matejcsok
91291fde37 screenshots: sweep remaining committed-manifest wording
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 14:35:08 +02:00
Istvan Matejcsok
ec7a1b0787 screenshots: R2-hosted manifest becomes the baseline source of truth (morelli cutover)
The committed tests/screenshot-manifest.json is retired. CI now downloads
baselines/pcbjam/manifest.json (manifest v3, written only by the morelli
review app + its seed script) to the gitignored .baseline-manifest.json,
and everything downstream (pull, verify, compare) reads that copy:

- config.ts: MANIFEST_VERSION 3, MANIFEST_PATH .baseline-manifest.json,
  R2_BASELINES_MANIFEST_KEY; ManifestEntry grows opaque provenance
- r2-sync.ts: new --manifest mode (atomic fetch; no-creds skip DELETES a
  stale copy so the gate skips rather than using old baselines); --push
  gone (bytes enter the CAS only via morelli's promote)
- compare.ts: hard-skips when no manifest was fetched — a stale warm
  cache can never gate
- wasm-build.yml: fetch-manifest step before the baselines cache; cache
  key now hashes the fetched manifest; the gen-manifest --check lint gate
  goes with the committed manifest
- deleted: screenshot-manifest.json, promote.ts, changelog.ts,
  gen-manifest.ts, screenshot-changelog.yml, promote-screenshots skill
- docs (CLAUDE/README/TESTING/WHATWORKS/tools README): promote flow is
  now https://pcbjam-morelli-staging.pcbjam-staging.workers.dev

Validated locally against the real bucket: fetch-manifest (492), cold
pull 492 / warm pull cached=492, no-creds skip chain, compare gate skip.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 14:35:08 +02:00
Istvan Matejcsok
4196958c10 ci: upload each run's screenshots + meta.json to R2 (runs/pcbjam/<run-id>/)
Durable per-run screenshot store for the morelli review app
(github.com/PCBJam/morelli): after the report step, CI uploads the renders
and a meta.json index (identity, branch/commit, per-shot sha256+dims,
embedded compare summary) to runs/pcbjam/<GITHUB_RUN_ID>/ — 30-day R2
lifecycle; GH artifacts remain the debugging archive. meta.json is written
last as the upload-complete marker. Uses a new optional WRITE keypair
(CI_SCREENSHOTS_S3_WRITE_*); without it the step no-ops, so secretless
callers stay green. R2Store gains putKey() for the non-CAS run keys.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 14:35:08 +02:00