Commit graph

393 commits

Author SHA1 Message Date
Gergő Törcsvári
8131bf9bac
feat: standalone save/load routing + VITE_DOC_SOURCE ydoc mode
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 14:05:40 +02:00
Gergő Törcsvári
07863da416
feat: ysync 0008 Stage D — wire the v2 items collab into the app + verify
- WasmTool: hard cutover to startKicadCollab (gates on
  kicadCollabSnapshotItems; scalar reconciler no longer runs in the app)
- file-seed (ysync 0005 tie-in): empty rooms are seeded from the opened
  file via fileToDoc/docToY (meta+layout+items — file recoverable from the
  Y.Doc alone); populated rooms still adopt (seed-once unchanged)
- binding: gate UP applies until seed() — the provider's initial state
  sync otherwise streams the full doc into an editor that already holds
  the file (trapped eeschema's paste path in the real app)
- pcbnew blobForItem: footprints Format a uuid-corrected copy directly —
  SaveSelection's copy regenerated mandatory-field uuids (FOOTPRINT copy
  ctor assigns into fresh fields), breaking wire identity (rebuild)
- roundtrip.spec on the v2 items wire; new passing pcbnew
  footprint-containment round trip (the 0004 containment win); full
  fixture stays fixme on the tracked envelope-parse limit
- real-app two-tab emit verified for eeschema + pcbnew (see 0008 doc)

Full kicad suite: 45 passed, 3 skipped (known), 0 failed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 14:05:40 +02:00
Gergő Törcsvári
3a06a267b0
feat: v2 per-item s-expr collab bridge in all three tools (ysync 0008 Stage C)
Add kicadCollabSnapshotItems / kicadCollabApplyItems / window.kicadCollab.onItems
to pl_editor, eeschema, pcbnew — per-item native-blob payloads
({added/changed:[{sexpr,parent}], removed:[uuid]}) alongside the untouched scalar
wire (legacy collab specs stay green).

- pl_editor: itemBlob per item; apply = SetPageLayout(append) + replace-by-uuid
  (pointer-snapshot safe); bare payloads get the kicad_wks envelope. Snapshot +
  apply + emit verified headless.
- eeschema: clipboard Format per item (symbols carry their lib_symbols); apply
  mirrors the native paste — LoadContent into a throwaway sheet → detach →
  replace-by-uuid → symbol lib relink (blob's lib_symbols first, live screen's
  second) → SCH_COMMIT, in the CallAfter+COROUTINE context. Snapshot + apply
  verified headless (a "lost" lone junction turned out to be correct connection
  cleanup — test uses text).
- pcbnew: blobForItem per ROOT item with child→footprint lifting in flushDiff;
  apply = makeFromBlob + commit replace-by-uuid on the fiber; bare non-footprint
  payloads get wrapInBoardEnvelope (live board layer table). Snapshot + footprint
  replace/add WITH children (the 0004 containment gap, closed) + removal verified
  headless. Track/via/zone/text blob-apply hits the documented asyncify-fragile
  envelope parse (reconfirmed empirically — a verbatim SaveSelection segment
  envelope dies silently in the commit) and stays on the legacy scalar apply;
  tracked in ysync 0008 status.
- eeschema/pcbnew scheduleFlush now runs flushDiff inside a COROUTINE: the
  per-item Format in the v2 emit needs the fiber stack (0007 lesson). Their emit
  remains unverifiable headless (both legacy two-tab tests are test.skip:
  "open=false → SCH_COMMIT no-ops" / "harness can't PAINT") — verify in the real
  app at Stage D; pl_editor's emit IS verified.
- tests/kicad/items-bridge.spec.ts: per-tool suite (snapshot uuids → local-edit
  emit (where drivable) → apply changed/added/removed via save-readback → no
  apply echo). 3/3 pass; roundtrip + collab suites unaffected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 14:05:40 +02:00
Gergő Törcsvári
0665b30762
chore(skills): include pcbjam-shared in the git-feature workflow
The pcbjam repo's own git-feature skills + scripts/git-workflow predated the
web/pcbjam-shared submodule and only covered root+kicad+wxwidgets. Add the MIT
contract repo as a fourth member everywhere:

- repos.sh: pcbjam_shared key (path web/pcbjam-shared, main `main`) + layout doc.
- assert-clean.sh / for-each-repo.sh: count-agnostic wording.
- git-feature-start/commit/sync/finish SKILL.md: pcbjam-shared in the branch /
  commit (kicad, wxwidgets, pcbjam-shared, then root) / rebase (root first) /
  finish orders; root pointer-bump staging + diff now include web/pcbjam-shared,
  and the root stage step excludes it like the other submodule trees.

Mirrors the root pcbjam-private skills, which already covered shared.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 14:05:40 +02:00
Gergő Törcsvári
8bbab863da
feat(standalone): Slot-model collab binding runtime (ysync 0008 Stage B)
The thin runtime over @pcbjam/shared's transport-unaware blocks — this module
owns exactly what shared must not: the observeDeep subscription, local-origin
echo policy, and seed-once authority.

- wasm/collab/kicad-binding.ts: KicadItemsBridge (the v2 per-item s-expr bridge
  contract: snapshotItems/applyItems/onItems), bindKicadCollab (DOWN: onItems →
  itemsWireToDelta → applyDeltaToY origin-tagged; UP: observeDeep → skip own
  origin → deltaFromYEvents → deltaToItemsWire → applyItems; seed-once with doc
  authority on join, mirroring the scalar reconciler §2), moduleItemsBridge
  adapter over the future Stage C Module exports.
- index.ts: startKicadCollab — the Slot-model counterpart of startCollab (same
  provider + whenSynced + seed flow); legacy scalar path untouched.
- debug.ts: clog/cwarn quiet + crash-free outside a DOM context (vitest node).
- kicad-binding.test.ts: fake editor bridge + two relayed Y.Docs — seed → adopt
  → edits propagate both ways → footprint removal cascades; no self-echo;
  divergent local root dropped on adopt (doc authority); destroy() detaches.

Verified: 19 standalone unit tests, collab bundle rebuilds, pl_editor two-tab
spec still green (legacy path unchanged).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 14:05:40 +02:00
Gergő Törcsvári
b69ba09ebd
feat: adopt shared wasm wire schemas; resurrect collab e2e bundle (ysync 0008 A)
- standalone wasm/collab/types.ts: the CollabItem/CollabDelta data shapes now
  come from MIT @pcbjam/shared (collab-wire zod schemas) via re-export; the
  RUNTIME adapter interface (CollabBridge) stays here. emptyDelta/isEmptyDelta
  alias the shared helpers — reconciler untouched.
- tests/collab/browser-entry.ts: fix the import path stale since the repo
  restructure (web/apps/frontend → web/standalone) — the collab bundle had been
  silently unbuildable; its opts type now tracks startCollab's real signature.
- tests/kicad/*-collab.spec.ts: update KicadCollab.start calls from the
  pre-ysync-0004 { channel, settleMs } API to { provider: { kind:
  "broadcastchannel", settleMs }, room } — the drift the broken bundle hid.

Verified: pl_editor 2/2, eeschema 2 passed, pcbnew 7 passed (skips pre-existing);
shared 47 unit tests; both typechecks clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 14:05:40 +02:00
Gergő Törcsvári
c98e88c33b
feat: bump pcbjam-shared for typed slot content (ysync 0007)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 14:05:39 +02:00
Gergő Törcsvári
f9a2bf7283
feat: bump pcbjam-shared for nested-item flattening (ysync 0007)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 14:05:39 +02:00
Gergő Törcsvári
f1cd813722
feat: bump pcbjam-shared for KiCad file⇄Y.Doc converter (ysync 0007)
Pointer bump for the MIT sexpr/kicad-doc converter + schema + round-trip suite;
record the vitest devDep in the web workspace lockfile.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 14:05:39 +02:00
Gergő Törcsvári
2163c36f28
feat: per-tool save exports + file⇄yjs round-trip tests (0004 §A, phases 2–4)
Block A save embind exports + the round-trip integration harness.

Save exports (wasm/bindings, GPL):
- pcbnew: kicadSaveBoard(path) via PCB_IO_KICAD_SEXPR::SaveBoard(GetBoard()).
- eeschema: kicadSaveSchematic(path) via SCH_IO_KICAD_SEXPR::SaveSchematicFile.
  Saves GetCurrentSheet().Last() (NOT Schematic().Root()): the wasm open-flow
  nests the opened doc under an auto-created project root, so Root()'s screen
  holds only a child-sheet symbol, not the loaded items.
  (pl_editor already had kicadSaveDrawingSheet.)

Round-trip harness (tests/kicad/roundtrip.spec.ts):
- load fixture → save (ORIG) → kicadCollabSnapshot → reload (fresh wasm) →
  open empty → kicadCollabApply → save (REGEN) → assert sexprDiff(ORIG,REGEN).equal.
- Two separate pages (extract closed before rebuild opens) so the process-global
  wasm heap frees between boots (pcbnew ~190MB). Open both sides from the same
  filename (eeschema embeds it as the root Sheetfile property). pcbnew boots the
  seeded pcbnew-collab.html (plain pcbnew.html's first-run wizard blocks boot).
- pl_editor + eeschema round trips PASS (lossless). pcbnew is test.fixme with
  tracked apply-coverage findings (footprints/zones not reconstructed; segment
  width + via size lost; fp_text→gr_text) — bridge gaps for follow-up, not test bugs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 14:05:39 +02:00
Gergő Törcsvári
f29ceb4964
feat(standalone): sexprDiff structural comparator + vitest (0003/0004 §B)
Add the shared, uuid-keyed structural s-expr comparator (README §B) used by both
the live drift check (0003) and the round-trip tests (0004), plus a vitest setup.

- wasm/collab/sexpr-diff.ts: zero-dependency module (importable from standalone
  app code and the Playwright specs). Tokenizes s-expr text into nested lists,
  indexes item nodes by their direct (uuid "X") child, compares item sets order-
  insensitively as multisets of normalized children, emitting
  { equal, added, removed, changed } with per-property a/b. ignoreTokens drops
  volatile tokens. False-positive-free only for same-serializer inputs.
- wasm/collab/sexpr-diff.test.ts: 15 cases (parse, equality, changes, ignoreTokens).
- vitest config + test scripts (node env, isolated from the app build).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 14:05:39 +02:00
Gergő Törcsvári
0773acefaa
feat(standalone): "open in a new tab" escape hatch on OOM dialog (0002)
The automatic recovery uses an in-place location.replace reload, which does NOT
reliably release the OOM'd wasm heap in every browser (notably Firefox), so the
respawn can land right back in an out-of-memory state.

Add a user-gesture escape hatch to the terminal MemoryExhaustedDialog: an "Open
in a new tab" button that opens the editor in a fresh top-level browsing context
(clean retry chain) and closes the current tab. Because it runs from a real
click, window.open is not popup-blocked; window.close() may still be refused on
the original user-opened tab, which is fine — the new tab is the survivor. Copy
tells the user this sometimes helps where the in-place reload didn't.

- oom-watch.ts: export respawnInNewTab(win) — fresh-tab respawn with ?oomRetry
  cleared.
- MemoryExhaustedDialog: "Open in a new tab" (primary) + "Reload this tab"
  (secondary), with honest copy about Firefox + unsaved edits.
- WasmTool: wire onOpenNewTab to respawnInNewTab.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 14:05:39 +02:00
Gergő Törcsvári
0d2f88b437
feat(standalone): OOM tab recovery (0002)
Automatically recover from an out-of-memory by respawning a fresh browsing
context (fresh wasm heap) and discarding the dead one — the manual "duplicate
tab, close the OOM'd one" fix, automated and capped at 2 retries so a too-small
machine stops instead of looping.

- recovery/oom-watch.ts: the recover() state machine with the retry counter in
  the URL (?oomRetry=N, cap 2). Mode A soft detection — Module.onAbort plus
  window error/unhandledrejection matched against an OOM signature, behind an
  idempotent latch. Mode B hard-kill detection — a per-tab localStorage
  heartbeat sentinel; a stale sentinel on the next load continues the retry
  chain (heartbeat keys avoid mistaking a second live tab for a crash). Healthy
  session (alive HEALTHY_RESET_MS) resets the chain. Default strategy is
  location.replace; window.open+close is behind ?oomStrategy=newtab. Platform
  access goes through injectable win/storage seams for testability.
- recovery/MemoryExhaustedDialog.tsx: terminal "out of memory" UI, reusing
  0001's BlockingDialog; copy is honest about lost unsaved edits.
- wasm/boot.ts: forward emscripten Module.onAbort to the watcher (optional
  BootOptions.onAbort).
- WasmTool: install the watcher, gate boot on its proceed flag (skip when the
  chain is already exhausted), and render the terminal dialog.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 14:05:39 +02:00
Gergő Törcsvári
ae20d49241
feat(standalone): device-capability preflight check (0001)
Add a pre-boot "potato check" for the standalone editor: probe the device
against what the KiCad WASM tools actually require and warn (or block, with an
override) before the expensive WASM asset fetch.

- preflight/capabilities.ts: pure, unit-testable probe → CapabilityReport with
  stable codes. Fatal: no SharedArrayBuffer/cross-origin-isolation, no
  WebAssembly, no Workers+Atomics, no WebGL2. Warn: low deviceMemory, low JS
  heap limit (Chromium), few cores, mobile, small screen. Thresholds in one
  tunable const block.
- preflight/BlockingDialog.tsx: reusable modal blocking overlay (no dismiss
  except via explicit action) — also for feature 0002's terminal dialog.
- preflight/PreflightGate.tsx: runs the probe once on mount; fatal → blocking
  dialog with "Try anyway" (short-circuits the asset fetch); warnings →
  dismissible advisory banner with localStorage "don't show again" keyed to the
  exact warning codes.
- ToolPage: wrap WasmTool in PreflightGate so the gate runs before boot.

Optional micro-bench (phase 3) deferred per the spec.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 14:05:35 +02:00
Istvan Matejcsok
8bf3bd372f fix: 🐛 dark color theme 2026-06-12 12:54:26 +02:00
Istvan Matejcsok
e932530afb ci: Ubicloud is the main CI — retire the Hetzner VM workflows
ci-ubicloud.yml (cherry-picked from the ubicloud-ci experiment branch, green
on run 27375556034: 291 wx + 38 kicad tests in 1h52m) now triggers on main
pushes and replaces ci-full-build.yml and ci.yml. The Hetzner flow needed
create/delete-VM jobs, a PAT + hcloud token, and a shared one-slot
concurrency lock; the Ubicloud runner is a plain runs-on label and finished
faster end-to-end. wasm-opt-bench.yml stays (dispatch-only Hetzner bench
harness, unrelated to CI).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 12:43:15 +02:00
Istvan Matejcsok
c7e507ced6 ci(ubicloud): copy sysroot headers out of the docker volume for the GAL build
build-gal-webgl-test.sh compiles kicad headers that need boost from
build-wasm/sysroot/include — a host dir on dev machines but inside the
kicad-build-cache docker volume on CI (run 27370316200: ptr_vector.hpp not
found). The Makefile uses only $(SYSROOT)/include, so headers suffice.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 12:42:32 +02:00
Istvan Matejcsok
94e88a15d9 ci(ubicloud): build the GAL WebGL test app — 29 gal-webgl scenarios 404'd
First wx-suite run (27359020746): 262/262 non-GL tests passed; all 29
gal-webgl failures were galTest.isReady() timeouts because
gal_webgl_test.{js,wasm} are gitignored artifacts built by their own script
(build-gal-webgl-test.sh), which the workflow never ran — the page loaded
but the wasm 404'd. The script self-sources the local emsdk like
build-wasm-test.sh. Those 29 timeouts x3 attempts were also ~1.4h of the
1.7h e2e wall-clock.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 12:42:32 +02:00
Istvan Matejcsok
282994e2f2 ci(ubicloud): add the wxWidgets e2e suite to the run
Host-side wxUniversal build + wx test apps (build-wxuniversal-wasm.sh /
build-wasm-test.sh, mirroring the dispatch-only ci.yml) followed by
`npm run test` before the KiCad e2e. The wx suite runs on bundled headless
Chromium; several specs use WebGL (gal-webgl.spec.ts), so the chromium
project gains a CI-gated --enable-unsafe-swiftshader launch arg — without
it newer headless Chromium refuses software WebGL on the GPU-less runner.
First time this suite runs on a working CI runner; treat as experimental.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 12:42:32 +02:00
Istvan Matejcsok
3ce2684da8 ci(ubicloud): e2e step uses test:kicad:ci (firefox + chromium-ci projects)
Mirrors the main workflows for e913beb's pcbnew-on-Chromium routing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 12:42:32 +02:00
Istvan Matejcsok
c6a002bf2b ci(ubicloud): run kicad e2e under xvfb — headed firefox for software WebGL
Same rationale as the Hetzner workflow change in 3168eff: headless Firefox
cannot create any GL context on the GPU-less runner.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 12:42:32 +02:00
Istvan Matejcsok
775b657b89 fix(ci): ubicloud docker rejects cpus limit == host CPUs — cap at nproc-1
Run 27330725978 died at container create: "range of CPUs is from 0.01 to
30.00, as there are only 30 CPUs available" with KICAD_DOCKER_CPUS=30 on the
30-vcpu standard-30. The Hetzner box (fresh docker-ce) accepts cpus == nproc;
Ubicloud's preinstalled daemon doesn't. A 29/30 CFS quota is noise.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 12:42:32 +02:00
Istvan Matejcsok
2e1b261b98 ci: Ubicloud full build + e2e experiment — triggers only on ubicloud-ci
Same recipe as ci-full-build.yml (all 6 tools, Binaryen 130 from source,
pipelined wasm-opt, KiCad e2e) but on ubicloud-standard-30: a plain runs-on
label, so no create/delete-Hetzner-VM jobs and no shared one-slot concurrency
lock. Push-triggered ONLY on this branch (plus workflow_dispatch) so it never
competes with the Hetzner main CI.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 12:42:32 +02:00
Istvan Matejcsok
e913bebdeb fix(e2e): route pcbnew-family specs to bundled Chromium on CI
The xvfb/WebGL fix (f37ddc4) took CI from 22 to 11 failures (identical on
Hetzner 27343415331 and Ubicloud 27343416511) — everything left is the
pcbnew family, still dying at wasm compile: pcbnew's ~190M debug module
exceeds SpiderMonkey's per-process code budget on x86-64 even with the
baseline-only JIT (the same module compiles on arm64, whose denser code
fits — which is why the local arm64 repro passed). No pref raises that
limit; V8 handles the module fine.

New CI-only 'chromium-ci' project (bundled Chromium, headless, SwiftShader
via --enable-unsafe-swiftshader) carries pcbnew/pcbnew-collab/load-pcb/
load-pcb-probe; the firefox project ignores them on CI. Workflows call the
new test:kicad:ci script which runs both projects. Local test:kicad is
unchanged (firefox everywhere, system Chrome for headed runs).

Validated under x86 emulation (linux/amd64 playwright image on Rosetta):
the pcbnew wizard test passes on chromium-ci in 23s against the fresh
v130-postprocessed 192M module.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 16:12:01 +02:00
Istvan Matejcsok
380206dcfc fix(build): host postprocess silently no-ops when emsdk tools are stubbed
build-kicad-target.sh swaps emsdk's wasm-opt/wasm-emscripten-finalize for
no-op stubs (real binaries preserved as *.real) so emcc skips in-link
asyncify — intended for the CONTAINER emsdk, but a host-mode run left the
host tools/emsdk stubbed (since Jun 9). The stub fakes --version and exits 0,
so every local build's host-side finalize/asyncify/-O2 "succeeded" while
doing nothing: output wasm shipped non-asyncified and aborts at boot with
"asyncify_stop_unwind is not a function" (and stayed 122M vs the correct
187M). get-wasm-opt.sh and apply-finalize.sh now prefer the *.real binary
whenever it exists, making the resolution immune to a stubbed emsdk.

Found while validating the CI e2e fix: pcbnew.wasm built this morning could
not boot in any browser. Local artifacts built since Jun 9 may need their
postprocess re-run (apply-finalize.sh + apply-asyncify.sh).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 13:25:02 +02:00
Istvan Matejcsok
f37ddc454d fix(e2e): make the firefox kicad suite pass on GPU-less CI runners
CI runs (Hetzner 27329612719, Ubicloud 27330989479) failed 22/41 identically,
in two buckets, both firefox-environment issues (the suite is firefox-only:
test:kicad -> --project=firefox):

1. No WebGL: headless Firefox can't create ANY GL context on a GPU-less VM
   (blocklist bypass still dies with FEATURE_FAILURE_WEBGL_EXHAUSTED_DRIVERS),
   so the GAL canvas failed and an error dialog blocked every UI flow. Fix:
   run headed under xvfb (GLX + Mesa llvmpipe software GL) with
   webgl.force-enabled — workflows now wrap the e2e step in xvfb-run.

2. pcbnew wasm OOM: the ~190M module OOMs Firefox's optimizing wasm JIT at
   compile ("InternalError: out of memory") and the app never boots. Fix:
   javascript.options.wasm_optimizingjit=false (baseline-only compile).

Both prefs are CI-gated in playwright-kicad.config.ts; local runs keep stock
behavior. Boot got slower (baseline JIT), so the wizard helpers now wait for
the registry to have actual UI ENTRIES (the registry OBJECT exists pre-boot)
instead of clicking into a fixed 10x500ms window.

Validated in a local docker repro of the CI env (playwright:v1.57.0 image,
no GPU): pl_editor canvas, gerbview wizard+canvas, and pcbnew wizard (on a
properly asyncified 187M module) all pass; before the fix they reproduced the
exact CI signatures.

Known-fail left on CI: zoom-cursor — the zoom-in anchors at ~ -P in headed
Firefox (screen-vs-client coordinate mix-up in the wheel->GAL path, headed
mode only); marked test.fixme(CI) pending a wx-wasm-layer investigation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 13:25:02 +02:00
VV-EE
8ddd9252e6
Add GNU General Public License v3 2026-06-11 12:54:52 +02:00
Istvan Matejcsok
ee451c9de2 pcb-schema switch
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 12:26:45 +02:00
Istvan Matejcsok
f936eb17b0 fix(build): generate lexer headers before embind compile — fresh-build CI failed
pcbnew_embind.cpp pulls kicad_clipboard.h -> pcb_io_kicad_sexpr_parser.h ->
pcb_lexer.h, a header GENERATED during make (make_lexer custom command on the
pcbcommon target). The embind compile runs right after CMake configure, so on
a fresh build dir the header doesn't exist yet — the ephemeral Hetzner main CI
(run 27327303032) died on it in minutes. Local/incremental dirs already had the
header, which is why 9dbfddc's -I${KICAD_BUILD}/common alone seemed sufficient.

Pre-build pcbcommon before compiling the bindings: make resolves the real
dependency graph (no duplicated lexer-generator args), the app target needs
pcbcommon anyway so total build time is unchanged, and incrementally it's a
no-op. Verified by deleting pcb_lexer.h/pcb_keywords.cpp/pcbnew_embind.o inside
the docker build-cache volume and rebuilding: pre-build regenerates the header
before the embind compile succeeds.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 08:57:23 +02:00
Istvan Matejcsok
08796e1c5e docs: library management feature design notes
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 07:50:57 +02:00
Istvan Matejcsok
ce9e569fd9 docs: CI build perf findings + parked wasm-exceptions experiment
- ci-build-slowness-findings.md: the full investigation log — measured
  phase breakdowns of the 4h05m baseline, the v121 lock convoy, the
  badly-built official Binaryen Linux tarballs (4-13x slow asyncify),
  allocator/THP/arm64 dead ends, and the validated 1h14m41s result.
- wasm-exceptions-experiment.md: -fwasm-exceptions would shrink the
  asyncify set at the root (pcbnew 338 MB -> 92 MB raw) but is blocked
  by an LLVM br_table codegen bug in emscripten 4.0.2; full resume
  recipe + plumbing patch included.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 07:50:57 +02:00
Istvan Matejcsok
6953fbd894 ci: ephemeral Hetzner CI — full build + e2e on main push, all else dispatch-only
Per run, a fresh ccx53 VM is created (Cyclenerd/hcloud-github-runner),
builds + tests run on it, and it is always torn down — no persistent
infra, no lingering cost. Secrets: HCLOUD_TOKEN, HETZNER_RUNNER_PAT.

- ci-full-build.yml: the main-branch CI and the only push-triggered
  workflow. Full build of all 6 tools (pipelined wasm-opt, self-built
  Binaryen 130, ~1h15m) + KiCad e2e; docs-only pushes excluded via
  paths-ignore.
- ci.yml (eeschema-only smoke) and wasm-opt-bench.yml (config sweeps):
  workflow_dispatch-only, since every push-run costs a paid VM.
- Shared one-Hetzner-slot concurrency group across the workflows.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 07:50:47 +02:00
Istvan Matejcsok
df25275843 bench: wasm-opt benchmark harness — Hetzner config sweeps + local QEMU VM
Tooling that produced the perf findings (committed for rerunnability):
- scripts/bench/wasm-opt-bench.sh + o2-config-sweep.sh + sweep.conf:
  replay asyncify/-O2 over a cached fixture under allocator/THP/core
  matrices on the Hetzner runner.
- scripts/bench/setup-vm.sh + cloud-init/ + vm-build.sh: local QEMU
  (HVF) Ubuntu guest with Docker CE to verify Linux builds without
  burning paid runners.
- .gitignore: bench fixtures/results and the VM image stay local.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 07:48:46 +02:00
Istvan Matejcsok
680eb9dc15 perf(build): 4h05m -> 1h15m full CI build — docker caps, pipelined wasm-opt, Binaryen 130
Three orchestration fixes, validated end-to-end on the Hetzner ccx53
(run 27280051992, 1h14m41s vs 4h05m baseline, e2e identical):

- docker-compose CPU/memory caps were hardcoded to dev-Mac defaults
  (10 CPUs / 32G); now env-tunable via KICAD_DOCKER_CPUS/KICAD_DOCKER_MEM
  (CI exports nproc/110G — the 32-core runner was compiling on 10 cores).
- docker/build.sh: split build_app into compile_app (container) +
  postprocess_app (host-side dyncall shims + finalize + asyncify + -O2)
  and added KICAD_PIPELINE=1 mode that overlaps each tool's host-side
  wasm-opt with the next tool's container compile (max 2 concurrent
  postprocesses — pcbnew -O2 peaks ~34G RSS). Also: comma-separated app
  lists for cheap pipeline repros.
- get-wasm-opt.sh: Binaryen default 121 -> 130 (fixes the v121 -O2 lock
  convoy, ~9x) and BINARYEN_BUILD_FROM_SOURCE=1 support: the official
  x86_64-linux release tarballs (Alpine/musl, no LTO, assertions on) run
  asyncify 4x slower than a stock gcc -O3+LTO build with sha256-identical
  output; self-build takes ~5 min and is instantly repaid.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 07:48:46 +02:00
Istvan Matejcsok
e6ff74a11e fix: restore gl_immediate_shim.js
Restores the immediate-mode GL shim that the WASM runtime loads; it had
been dropped from the tree while the CI work was in flight.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 07:48:46 +02:00
Viktor Vaczi
d7159b42c0 "fixed" kicad tests, added baseline screenshots. 2026-06-10 17:37:58 +02:00
Viktor Vaczi
3978bf5ff1 feat(site): add favicon.ico + apple-touch-icon so the tab icon renders
Chrome also fires an implicit request for /favicon.ico; with only an SVG
link declared and no .ico at the site root, that 404 left the tab without
an icon. Add a square multi-res .ico (48/32/16) and a 180x180
apple-touch-icon — both derived from the jar art already embedded in
favicon.svg — and declare the full icon set (ico + svg + apple-touch) in
BaseLayout.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 17:24:31 +02:00
Gergő Törcsvári
285efe7a06
feat(standalone): env-selected Yjs provider abstraction (ysync 0004)
Generalize the collab transport into a provider registry (none |
broadcastchannel | partykit | hocuspocus), one active per env. startCollab
takes { provider, room } and awaits provider.whenSynced() before seed/adopt.
Network libs lazily imported; room id from @pcbjam/shared collabRoomId.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 14:37:30 +02:00
Gergő Törcsvári
cf18efcf66
chore: bump pcbjam-shared — collab schemas (ysync 0003) 2026-06-10 14:37:29 +02:00
Viktor Vaczi
2206266755 docs(site): tighten Cookie Policy wording — analytics consent reasoning, date bump 2026-06-10 14:14:02 +02:00
Viktor Vaczi
0b45d7ea54 feat(site): publish Privacy Policy at /privacy — waitlist coverage, conditional GPC
Replace the /privacy placeholder with the full GDPR-first policy (dated
10 Jun 2026). Beyond the reviewed draft: cover the waitlist end-to-end
(data row, consent basis, marketing section, retention), add a staged-
rollout clause so future-product processing is described honestly, make
the CCPA/GPC commitment conditional (no voluntary promise while nothing
is sold/shared), and fix the CCPA look-back wording.

Point of collection follows suit: the waitlist form microcopy links the
policy, and the confirmation email now offers reply-to-remove, promises
an unsubscribe link in every update, and links /privacy.
2026-06-10 14:13:56 +02:00
Viktor Vaczi
7629ab978d test(e2e): fix wx suite — header deps, port pinning, drop legacy-GL tests, wx+pthread worker fix
Suite went 64 failed → 291 passed / 0 failed:
- Makefile.wasm: compile with -MMD -MP and include .d files — stale objects
  relinked against a newer wx lib crashed apps at startup with "function
  signature mismatch" after any header/vtable change
- playwright(.coroutine).config.ts: pin the server port for the whole run
  (resolvePort from playwright-kicad.config.ts); the 60s freshness window made
  workers restarted after a failure rotate to a dead port (ERR_CONNECTION_REFUSED
  cascade across ~50 tests)
- drop legacy-GL testing: KiCad renders via WebGL GAL (gal-webgl.spec.ts);
  remove minimal_test's OpenGL tab/GLTestCanvas, opengl.spec.ts, GL z-order
  describes, -sLEGACY_GL_EMULATION + gl_immediate_shim.js from the test build,
  and the orphaned GL baselines
- coroutine-pthread repro apps join the `all` target (make clean used to delete
  them while all never rebuilt them); clean no longer eats checked-in JS like
  worker_dom_stub.js
- bump wxwidgets: guard module-eval document access so wx+pthread apps
  (threadpool tests) survive Web Worker eval

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 13:40:00 +02:00
Viktor Vaczi
107fc7513f feat(site): publish Terms of Service at /terms
- replace the placeholder terms page with the real ToS (EU/Hungarian
  consumer law, Paddle Merchant-of-Record billing, GPLv3 corresponding-
  source offer), dated 10 June 2026
- serve legal pages from a markdown content collection rendered by
  src/pages/[legal].astro; drop the per-page placeholder .astro files
  (privacy/cookies keep placeholder content, now as markdown)
- add prose/table styles for legal pages
- footer link text: "Terms & Conditions" -> "Terms of Service"

Canonical working copy + clause-by-clause legal sourcing live in
features/ (untracked research).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 12:52:05 +02:00
Viktor Vaczi
ba3ba37c4d fix: use HTTPS submodule URLs so the repo clones anonymously
The Terms of Service's GPLv3 corresponding-source offer points at this
repo; with SSH submodule URLs, `git clone --recursive` fails for anyone
without a GitHub account. HTTPS URLs work for everyone (pushes still go
over SSH via insteadOf, if configured).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 12:51:55 +02:00
Gergő Törcsvári
eababd7ef9
chore: bump pcbjam-shared pointer (gitignore housekeeping)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 16:52:15 +02:00
Gergő Törcsvári
b6a77ee93c
refactor(web): split into GPL standalone editor + thin reference backend
Reduce web/ to a single generic editor app plus a minimal example backend,
moving all project-specific/app code out to the closed root repo:

- apps/frontend -> standalone (@pcbjam/standalone): the GPL editor. Strips the
  project-management UI (ProjectsPage/ProjectDetailPage/UploadDropzone and the
  write half of lib/api.ts). WasmTool now takes fetchBytes + assetBaseUrl as
  injected props (decoupled from the API client) so it can be driven by either
  a backend or a local folder. New HomePage (local-folder loader + backend
  project list) and read-only ProjectView. BroadcastChannel collab unchanged.
- backend (@pcbjam/backend-example): thin Fastify+ts-rest reference impl of the
  @pcbjam/shared contract — serves a single project off the local filesystem
  (PROJECT_DIR), no DB/auth/uploads.
- packages/contract -> web/pcbjam-shared (git submodule, MIT @pcbjam/shared).
- Remove apps/server, packages/storage, packages/contract, docker-compose
  (server + storage move to the closed root repo; preserved via subtree
  branches). Rewrite pnpm-workspace/turbo/.env for the frontend-only layout.
- Add tests/fixtures/demo so the editor + example backend run out of the box.

Standalone typechecks + builds; backend serves the contract end-to-end.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 12:35:46 +02:00
Gergő Törcsvári
b672c54189
fix(pcbnew): collab syncs real item layer — devirtualize Get/SetLayer; collab on by default 2026-06-09 06:04:00 +02:00
Gergő Törcsvári
1bfa562a61
test(pcbnew): assert collab add preserves each item's layer
Adds a layer-preservation check to the footprint/via/zone/text round-trip add tests,
documenting + verifying that an item's own serialized layer is applied by makeItem and
the peer editor's active layer is never consulted. 4 add tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 06:03:59 +02:00
Gergő Törcsvári
2ee87889fa
feat(pcbnew): collab adds board text natively (PCB_TEXT) incl. justification
A board-level graphic text (Place→Text) lands in Drawings() and would otherwise hit the
same asyncify-fragile (kicad_pcb …) envelope-blob wall as via/zone on add. So PCB_TEXT
reconstructs NATIVELY: itemToJson emits size/thickness/angle plus horizontal & vertical
justification, mirror, and bold/italic (the text string was already emitted for any
EDA_TEXT); makeItem builds a fresh PCB_TEXT and restores all of them. flushDiff skips the
blob for PCB_TEXT_T. Footprint child text is unaffected — it syncs by move, and its add
is carried by the footprint blob.

Justification matters: it anchors the glyphs relative to the text POSITION, so without it
a left-justified text reconstructed centered on the peer and rendered visibly offset even
though GetPosition() matched (which is why the anchor-only headless check missed it).

Verified two-tab in the real app: a left/bottom-justified bold text added in tab A
reconstructs in tab B at the exact position with matching justification + string. Headless:
a board-text round-trip add test (sample text is left/bottom-justified) asserts the
position AND that hjust/vjust/text round-trip. 7 passed, 1 skipped, 0 aborts.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 06:03:59 +02:00
Gergő Törcsvári
9dbfddc527
feat(pcbnew): collab adds footprints (s-expr blob) + vias/zones (native)
Footprint add reconstructs from the bare `(footprint …)` s-expr clipboard blob via
CLIPBOARD_IO (SetWriter/SetReader redirect it to a string for headless/wasm). The
non-footprint `(kicad_pcb …)` envelope parse (parseBOARD) is asyncify-fragile in wasm
— commit.Add of an envelope-parsed item silently stages nothing and subsequent virtual
dispatch traps ("index out of bounds"), the same wall that deferred the eeschema symbol
blob — so vias and zones reconstruct NATIVELY instead: itemToJson emits drill/layer-pair
for a PCB_VIA and the outline polygon for a ZONE, and makeItem builds a fresh PCB_VIA /
ZONE. flushDiff attaches the blob only to types that need it (footprints/board graphics);
tracks/vias/zones skip it. Includes the dangling-parent fix for the envelope path
(SetParent before delete) which footprints don't hit.

Build: kicad_clipboard.h pulls in the generated pcb_lexer.h (emitted into the common
build subdir by make_lexer) — added -I${KICAD_BUILD}/common to the embind include path.

Tests: sample board gains a via + zone; snapshot asserts their native fields are emitted,
and three round-trip add tests (footprint via blob, via/zone native) delete then re-add
each by uuid and confirm it returns at the same position. 6 passed, 1 skipped, 0 aborts.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 06:03:59 +02:00