Skip to content

Project Tracker

Pummelchen edited this page Sep 16, 2026 · 24 revisions

Project Tracker

The single place that answers "what is being worked on, what is done, and what is known to be wrong". Keep it short and true: an item moves to Done only when it is committed to main and the suite is green, and a new discovery gets a row here in the same session it is found.

Gate: ./tests/run.sh — the whole suite, or --fast to skip the four long fuzz files. CI runs the full suite on every push and pull request. A change is done when that is green, not when it "should work".

Versions: the visible release is roomcad/web/version.js. A user-facing fix bumps it; there are no tags and no releases yet.


Status at a glance

Visible version 10.7
Gate ./tests/run.sh (full suite, ~12–15 min) + CI on push/PR
Production https://roomcad.91.99.176.243.nip.io/ — deployed from main by roomcad/server/deploy.sh
Open bugs 0 — B5 (a bus driving off the grid) was found and fixed during this pass
Open tasks 1 — the narrowed T2 below; T1 and T3–T11 are done

Production note: the code is ready; the deployment is not done. Production serves 10.4 while main is 10.7, and the deploy is the first one to run the hardened unit (it creates the roomcadapp account and chowns the database and its WAL sidecars). See Waiting on a human at the end.


Done — audit of 2026-09-16

A full pass from deployment to rendering, fixing every defect that could be verified. Grouped by area; the commit history has the reasoning for each.

Correctness and security (server)

Item Outcome
POST /api/login crashed with TypeError on a non-ASCII password — no response, dropped connection, and because the failure was never counted it escaped the login throttle entirely password_matches() compares UTF-8 bytes; a non-ASCII password now also works
_read_json() returns a list or scalar for [], 5, "x"; callers reached for .get(...) — an unhandled AttributeError on /api/live-check/ all bodies go through _read_json_object() → 400
get_conn() was an unlocked check-then-act: a leaked connection and a double init_db/migration double-checked under a lock
migrate() unlinked each legacy file before committing its row — a crash lost the room from both places commits the row before removing the file
delete_room() left the room's LIVE_SEQ entry behind — one entry per name ever seen pruned with the draft
rooms.db.sql published two real saved rooms in a public repository structure only; restores into an empty file
The API ran as root with no sandbox User=roomcadapp + 10 sandbox directives; systemd-analyze security 9.4 UNSAFE → 5.3 MEDIUM
encode gzip sat at site level, wrapping the SSE stream moved onto the static handle
.gitignore left __pycache__, the downloaded Caddy and rooms.db stageable all ignored

Correctness (2D editor, mode switching, live sync)

Item Outcome
A drag torn down by blur/pinch left dragTransactionActive stuck — the client silently stopped accepting teammates' edits one abortDrag() path for every non-committing teardown
Undo during a drag destroyed the user's most recent real history entry one owner for the drag snapshot; undo/redo cancel the drag
liveSeq was never reset per room, so the first edit in every newly-opened room was refused as stale and discarded reset when the watched room changes
A failed live push left liveUnpublished set, permanently disabling the drift check cleared on failure
Walking in 3D also fired the 2D tool shortcuts (W→wall, D→door, Delete→delete selection) 2D-only keys gated on mode
⌘Z inside a text field undid the drawing instead of the text text-editing chords left to the browser
New Room / Open in 3D left the 3D view — and its render loop — running behind a 2D plan the change handler follows the mode
A plain click with the measure tool committed a "0 cm" measurement a real drag is required
#version-modal had no CSS rule at all shares #open-modal's overlay
drawFixture built an invalid colour ("rgb(...)" + "30") and silently painted the wrong colour real rgba()
dimensionBoxes was cleared after being filled; m² captions compared device px against CSS px both fixed
A load naming an unknown furniture kind threw, so the defensive loader could not load the very documents it exists for unknown kinds are dropped, as other unrepairable objects already were
A hand-edited diagonal wall survived the whole load path — detectRooms then reported the wrong room count silently, and the 3D collider built a Z-aligned box for it such walls are dropped on load
splitWallsAtJunctions let two junctions 4 cm apart produce a 4 cm piece that sanitize then dropped on reload, so a boundary became a hole cuts keep MIN_WALL_LENGTH apart
The width/length clamp claimed a 2–20 m range that syncExtent() overwrote on the next line extent is derived; the clamp that remains is the plate's real one

Correctness (3D)

Item Outcome
The 3D loop never stopped — after one visit to 3D, WebGPU, Rapier and the 680-car traffic model ran at 60 fps behind the 2D editor pause()/resume(), wired to the mode switch
The room was built twice on first 3D entry, the first build discarded unrendered and unlit build() refuses to run before an environment exists
The sky dome (200 m) was smaller than the walkable city (≈272 m) — you could stand outside it sized from the city's reach and follows the viewer
Physics read the traffic one frame behind what was drawn city advances before the physics that consumes it
Lights and their shadow maps were dropped on every rebuild, never disposed disposed in disposeScene

Process and documentation

Item Outcome
The suite had no runner: no timeout, no totals, and a hang produced no usable exit code tests/run.sh, proven to fail on an assertion and on a timeout
Nothing ran the suite automatically; deploy.sh shipped without a gate CI on push and pull request
city-physics was genuinely flaky — it failed on a machine that was merely busy the traffic's runtime randomness is now swappable and the test seeds it; output is byte-identical across runs and passes under six-way parallel load
THIRD_PARTY_NOTICES.md did not exist, though RELEASE.md §1.6 requires it — Rapier (Apache-2.0) is redistributed with no licence header notices + both licence texts
AGENTS.md was wrong about the repository in four places corrected, along with the server README, root README and roomcad/README.md
The GitHub description ("Shophouse room planner for macOS"), homepage and topics corrected through the API
Opening-width limits existed in four places that could drift apart; isTyping() existed twice with different rules both single-sourced
122 new checks across eight test files, each verified to fail against the previous code the fixes cannot silently regress

The last four bugs

Fixed on a second pass, after the tasks above, with the same rule: a fix is not done until a test that fails without it is in place.

Item Outcome
B1 Ceiling lights were dealt out in plan order — the 17th was dead wherever you stood, and still drawn glowing The pool follows the viewer (nearest-first, the way the street lamps already worked) and over-budget plans are reported in the inspector. tests/room-lights.test.mjs drives the real pool methods and proves the assignment is nearest-first, follows a moving camera, and is not redone once settled
B2 The shadow-casting street lamp used bias = -0.004, the class of value the room's own comments call pure light leak Zero, with a normal bias derived from its texel size as the sun does. The new guard resolves every shadow.bias in the file — literal or behind a constant — and refuses a negative one; verified against both a negative literal and a negative constant
B3 detectRooms() gave up above 60 000 cells and returned nothing, so the m² captions vanished, the floor area silently became the bounding box, and every wall became draggable A real memory budget (1 000 000 cells) plus roomDetectionSkipped(), surfaced as an inspector warning. tests/plan-editing.test.mjs proves a plan that the old cap rejected now measures, and that a plan past the new cap reports the skip instead of answering wrongly
B4 The endpoint drag allowed 15 cm walls while drawing required 30 cm — the file-repair threshold used as the editor's rule Two named thresholds, the drag on the editor's, and a legacy short wall can be turned or lengthened but not shortened. tests/wall-lengths.test.mjs covers all four cases

Open — bugs

None. Every bug found in the 2026-09-16 audit is fixed, tested and pushed. The four below were the last, and each is recorded in Done with what it actually did:

# Was Now
B1 The 17th ceiling light in a plan was dead for the life of the room — the pool was dealt out in plan order — and it was still drawn glowing, so it read as a broken lamp. Nothing said so The pool goes to the fixtures nearest the viewer and follows you, so no particular lamp is the dead one. Over-budget plans are reported in the inspector, in plain words
B2 The one shadow-casting street lamp held bias = -0.004, the exact class of value the room's own comments warn lets light through walls Zero, with a normal bias derived from its texel size as the sun does. tests/plan-seal.test.mjs now resolves every shadow.bias in the file — literal or named — and refuses a negative one
B3 detectRooms() gave up above 60 000 grid cells and returned no rooms, silently: every m² caption vanished, the floor area became the bounding box, and every wall became draggable The cap is now a real memory budget (1 000 000 cells, ~4 MB) and roomDetectionSkipped() reports a skip, which the inspector shows as a warning next to the number it affects
B4 The endpoint drag accepted a 15 cm wall while drawing required 30 cm — the file-repair threshold used as if it were the editor's rule, so 20 cm was legal to hold and impossible to make The two thresholds are named and separate (MIN_WALL_LENGTH, MIN_WALL_LENGTH_KEPT), the drag uses the editor's, and a legacy short wall can still be turned or lengthened instead of freezing in place

Done — production-readiness pass

The eleven tasks left open by the audit. Ten of them are closed; each entry says what actually changed and how it is held in place.

Security and supply chain

# Was Now
T4 Nothing limited how many live SSE streams a client could hold, and request_queue_size was socketserver's default of 5 — smaller than one browser opening a stream per tab MAX_WATCHERS_TOTAL = 256 protects the process, MAX_WATCHERS_PER_SESSION = 16 stops one client starving the rest; both are enforced before the SSE headers are written, so a refusal is a clean 503 with the JSON envelope that registers nothing. The backlog is 128. Registration and the session map are guarded by the existing lock, and the finally's pop stays idempotent
T5 The only CSRF defence was the SameSite=Lax cookie attribute — no token, no Origin check. POST /api/logout is deliberately unauthenticated, so cross-site it could still clear a cookie _require_same_origin() refuses a POST/DELETE whose Origin (or Referer) does not name the host the request was made to, with the host taken from the request's own Host header rather than a hard-coded name. A request with no Origin is still allowed — curl, the suite and same-origin form posts send none — and /api/login is covered deliberately, because a cross-site login can force a session and burn the throttle
T6 serve.sh and install-caddy.sh downloaded Caddy and executed it with no verification at all Both check the archive against the SHA-512 Caddy publishes for the resolved release before extracting or running it. A mismatch, a missing entry, or a machine with no hash tool aborts without executing anything — the check never degrades into a skip. Verified against a real release: the genuine tarball verifies, a corrupted copy is rejected, and the logic was re-run under macOS's bash 3.2
T7 install-caddy.sh's default target list included /var/xaios_updater, another project's directory The default is RoomCAD's own path only; an explicit list is still honoured. The usage example no longer names a neighbour either

Correctness and code health

# Was Now
T3 tests/editor-fuzz.test.mjs compared CSS-pixel coordinates against canvas.width — device pixels. It passed because installDOM() defaults to dpr = 1 The helper uses the CSS box, and the block now runs against a deliberately high-DPI backing store and asserts that it is not vacuous. Against the old helper it fails with 939,861 on 1200x800 — a label off the right-hand side of the canvas being called on-screen
T10 walk3d.js's cityReach() recomputed city.js's reach formula from four of its constants — a copy that had already drifted once City.reachFor(bounds) is the single source; walk3d asks for it, and the four constants it no longer needs are out of its import line
T11 Per-vehicle-per-frame string keys for the turn control, and a fresh object from _nextJunction for every vehicle every frame The turn-control keys are interned in a table built once per city, with the strings identical to the hand-built ones so the existing maps and test agree. _nextJunction takes an optional object to fill; the two per-frame callers reuse a per-vehicle scratch, while the two-second turn review and the fuzz test still get a fresh object — they hold the result across a later call, which is why a shared one would have broken them

The bug this pass found, while making the gate trustworthy

Closing T11 and T9 meant running the suite properly, and the full run failed where the same file had passed on its own: city-fuzz reported one teleport, one vehicle 13.1 m past the outermost road, and one rescued by the safety net. That is not a flake to be re-run — it was a real invariant violation, and all that was non-deterministic was the drive.

  • The gate was non-deterministic. city.js drives the traffic with real Math.random() in production, on purpose, and city-fuzz drove twenty cities without seeding it. The same fix as city-physics — setTransportRandom() with a seeded generator — makes one drive repeatable, so a failure is a fact about the code rather than about the machine. Hunting that drive across seeds then found B5; the seed that reproduces it is hunt-42.

  • B5 — a bus drove off the edge of the city. Two defects, either of which could produce it on its own:

    1. A recorded junction decision stored only the road index, and an index is not a junction. Ten roads and two axes means index 0 names four different junctions, so a decision to carry straight on through index 0 one way still counted as "already decided" when the vehicle came back to index 0 the other way — where carrying on is not a road. The record is now _junctionId(axis, dir, index), which includes the direction.
    2. The stop-for-a-space path overrode turn/mustTurn without clearing the record. A bus that had decided a compulsory turn at the outermost junction could pull in somewhere, keep the stale record, and then be told "already decided" at that junction, where the stale decision was the straight-on one. It now clears turnDecidedAt — and _decideTurn refuses to act on a "carry on" record at a junction with no road ahead, which is the reader's own guard, so the invariant holds whatever a future writer forgets.

    With the fixes reverted the escape reproduces on the seed; with them it is clean. tests/city-turns.test.mjs pins all of it: junction identity, the clearing, the compulsory turn for every way of arriving at the edge, and 20 000 frames of the real drive asserting the escaping precondition never holds.

Tests that did not exist

# Was Now
T1 login.js — the password gate — had zero tests. It has no exports and runs its session probe at import tests/login.test.mjs, 23 checks: the probe shows or hides the form and fails closed when the server is unreachable; the 401 hook app.js calls is the same routine; a correct password reloads, a wrong one does not and says so; a network error is reported separately; the field is emptied before the request goes out. Each scenario loads its own copy of the file, because a distinct query string does not re-evaluate an already-imported module — see the trap below. Proven to bite by three injected regressions
T9 Nothing checked that the page can boot: the import map, the module graph, the element ids tests/boot.test.mjs, a boot contract with no browser and no dependencies (the repository has no package.json, and a headless browser would change that). It walks the real import graph from both entry modules, resolves every specifier through the import map, refuses an element id the code looks up but the page does not have, and refuses a module nothing loads. All four of those failures were injected and caught. It proves the graph and the DOM contract, not that anything renders — that still needs a browser
T2 app.js coverage was a few lifted fragments Narrowed, not closed. tests/app-internals.test.mjs now covers the escaping boundary (esc() against the five characters, and a source contract that every user-controlled value interpolated into an HTML template goes through it — it is the only thing between a room name and the innerHTML it lands in), roomDigest() cross-checked against Node's own SHA-256 including non-ASCII, exportBaseName() including a hostile ../../etc/passwd, and the footer's latency thresholds. What remains untested is app.js's DOM event wiring and inspector rendering

Open — tasks

# Task Why it matters
T2 The rest of app.js: its DOM event wiring and the inspector's rendering. The pure logic and the escaping boundary are covered now, and tests/boot.test.mjs holds the ids it looks up It is still the largest untested surface. This is quality debt, not a production blocker — nothing here is known to be wrong

Traps found while doing this

  • A distinct query string does not re-evaluate an already-imported ES module. import("./x.js?a=1") and import("./x.js?a=2") are the same module if the first one already ran — the second resolves to the cached instance and its body never executes again. The first version of login.test.mjs was built on the opposite assumption and was silently inert: every scenario after the first shared the first one's result, and the checks "passed" against a module that had not run. It loads a fresh copy at a fresh path per scenario instead. (live-multi.test.mjs builds five stores from five query strings and asserts they are distinct objects — which is a different thing from five evaluations, because a module that runs once can still hand out five objects.)
  • A test that configures its own preconditions can hide the bug it is for. T3 passed for months because installDOM() defaulted dpr to 1, making CSS pixels and device pixels the same number. The fix is not just the right comparison, it is asserting that the two spaces differ, so the check cannot quietly become vacuous again.

Known and deliberate

Not bugs; recorded so they are not "fixed" by accident.

  • furnitureFootprint() and furnitureCenter() stay strict about an unknown furniture kind. sanitize() guarantees the invariant on load and the three call sites that could be reached with an un-repaired item now guard, so a fallback here would only hide a broken invariant rather than handle one.
  • walk3d.js's non-axis collider branch is now unreachable. sanitize() drops diagonal walls on load, so the branch that builds an axis-aligned box for a slanted wall is defensive only. It is left in place rather than deleted: it is the collider's own guard against a wall it cannot represent, and it should not depend on a different module's filter for correctness.
  • walk3d.dispose() has no caller. The walkthrough lives for the page's lifetime, so the teardown path is defensive only.
  • GET /api/session/last answers null with a 200 on an empty database. Odd for REST, but a pinned contract (tests/server-live.test.py).
  • POST /api/logout needs no valid session — an already-invalid session must still be able to clear its cookie.
  • sanitize() repairs and drops silently — walls under 0.15 m, doors on too-short walls, labels with no centre, furniture of an unknown kind, diagonal walls. It is the loader's defensive pass, and it is meant to be quiet.
  • The traffic is deliberately not reproducible in production. The city's layout is seeded; what the cars then do is real Math.random, so no two reloads drive identically. setTransportRandom() exists so a gate can make one drive repeatable, and nothing in the app calls it.
  • The vendored Rapier build carries no version string, so it cannot be identified from the repository. Recorded in THIRD_PARTY_NOTICES.md; the next upgrade should pin it.

Waiting on a human

Two things cannot be finished from inside the repository, and neither is a reason to hold the code back.

  • The deploy. main is 10.7; production still serves 10.4. Deploying is a change to a live site, and this is the first deploy to run the hardened unit — deploy.sh creates the roomcadapp account and chowns rooms.db, its -wal/-shm sidecars and the legacy .rcad directory, because the API no longer runs as root. deploy.sh validates the candidate Caddyfile with the VPS's own Caddy and refuses to report success until the site answers, but the decision to run it is not one to take unattended.
  • Eyes on the 3D. The light-pool and shadow-bias fixes were verified by lifting the real methods and driving them with fakes, and by resolving every shadow.bias in walk3d.js. Nothing in this repository renders the scene — Walk3D needs WebGPU and cannot be instantiated headlessly, and tests/boot.test.mjs deliberately stops at the module graph. So the rendered result of B1 and B2 is unverified: in particular, if the normal bias derived for the street lamp's 512² map is wrong for its reach, the symptom would be shadow acne on lit street surfaces at night. That needs a WebGPU browser.

Clone this wiki locally