Files
SlabUploader/WORKER-CONTEXT.md
Ty 0284a2211a M1-4: Length axis (TDD)
- Add axis.js: length axis rectangle state, 28 tests
- 71/71 unit tests green
2026-09-14 00:32:42 -07:00

1.9 KiB

SlabUploader M1 — shared build context (for :202 worker tasks)

REPO: /home/ty/SlabUploader — work ONLY inside /home/ty/SlabUploader/frontend. Branch: M1-dev-rev4 (already checked out; DO NOT switch branches, DO NOT push). This is Milestone 1 (Capture) of a slab-measuring web app. Browser-only, NO backend, NO inference, NO OpenCV/ONNX. Pure JS (not TS). Svelte 5 + SvelteKit + adapter-node.

TEST COMMANDS (run these, show real output): unit: cd /home/ty/SlabUploader/frontend && npx vitest run e2e: npx playwright test --list (collection only; full e2e needs the M1-6 container)

EXISTING (already committed, green, DO NOT break): src/lib/core/mask.js -> keySheet(data,{sheet,sensitivity}), maskStats(mask) src/lib/core/math.js -> scale, sqft, bdft, roundHalfUp, sampledWidths, sampledWidthsFrom, snapToEighth tests/unit/mask.test.js, tests/unit/math.test.js (24 tests, all pass) src/routes/+page.svelte (placeholder home — M1-3 replaces it) src/routes/+layout.svelte, src/routes/api/health/+server.js

TDD IS MANDATORY (test-driven-development skill):

  1. Write the failing test(s) FIRST.
  2. Run them and WATCH them fail for the right reason (feature missing, not a typo).
  3. Write the MINIMAL code to pass.
  4. Run them and confirm they pass.
  5. Run the FULL unit suite (npx vitest run) and confirm no regressions + pristine output.
  6. Only then are you done. Commit is done by the coordinator — you do NOT commit.

CONVENTIONS:

  • Tab indentation (the repo uses tabs).
  • Pure logic lives in src/lib/core/*.js (DOM-free, unit-testable under node).
  • Svelte components live under src/lib/ (e.g. src/lib/components/).
  • Every new exported function needs a unit test that you SAW fail first.
  • No console.log left in production code.
  • Do not add dependencies.
  • Report at the end: files created/changed, the exact test command output, and any place you had to make a judgment call.