Files
pad/web
xarmian ff44e917ae fix(web): count the 401 drop; a truncated page is not an answer (TASK-2877)
Codex review round 7. Two taken, one answered in the code.

P1 — `resetGenerationFor` counted `reset()` and missed the OTHER drop.
`bootstrap()`'s unauthorized/forbidden branch clears `state.items`, resets
the MiniSearch index and wipes the persisted cache without going through
`reset()`, so the fence added in round 6 did not see the revocation case
it exists for. Both droppers now call one `markWorkspaceDropped(ws)`
helper. Two call sites, because deleting the state entry and clearing rows
in place are genuinely different operations; the helper is what makes the
pairing greppable, and a test fails if a third site starts clearing rows
without it.

That test is STRUCTURAL, and deliberately so. Reaching the 401 branch
through the front door needs a warm cache plus a pending resync plus a 401
from /items-changes — a fixture larger than the invariant it would check,
and I tried it first. The invariant that actually has to hold is "clearing
rows and counting the drop travel together". The site-count assertion is
what keeps it honest: a NEW clear site fails loudly rather than going
silently unexamined, which is how this kind of instrument usually rots.
Its own mutant (the 401 branch stops counting) dies.

P2 — a TRUNCATED cold page is not an answer to "does this exact title
exist"; the row may be on a page nobody fetched. `SearchResponse` carries
`total`, so `coldAnswered` now requires a complete page. Same defect as
trusting the local ranker's window, arriving from the server side — the
third variant of one mistake, which is why the rule is now stated once and
asked everywhere: offer only where something authoritative has answered.

P2 (query change mid-create) was raised for the second time, having been
declined in round 3 with reasons that lived only in a commit message —
which a reviewer reading the diff never sees. The reasoning is now a
comment beside the fences: the three that exist each stand for an act
meaning "not this one" (escaping out, choosing another row, landing on a
different item or workspace); typing is mid-thought, the user did ask for
the item being created, and cancelling would orphan that row with the
field still empty. A decision worth keeping is worth putting where the
next reader is looking.

Matrix: 29 mutants, all killed; baseline and restore both 93/93.
2026-09-03 22:54:38 +00:00
..
2026-03-26 01:52:36 +00:00
2026-03-26 01:52:36 +00:00
2026-03-26 01:52:36 +00:00
2026-03-26 01:52:36 +00:00

Pad Web UI

SvelteKit 2 + Svelte 5 frontend for Pad, compiled to static files and embedded into the Go binary.

Development

npm install
npm run dev          # Dev server at localhost:5173 (proxies API to localhost:7777)
npm run build        # Production build to build/
npm run check        # Type checking with svelte-check

When developing, run the Go backend separately with make dev from the project root.

Building for Production

Do not build in isolation. Always use make build from the project root — this builds the web frontend, then compiles the Go binary with the build output embedded via //go:embed.

Stack

  • Svelte 5 with runes ($state, $derived, $effect)
  • SvelteKit 2 with adapter-static (SPA mode)
  • Tiptap block editor with markdown round-trip
  • svelte-dnd-action for drag-and-drop in board/list views
  • SSE for real-time updates
  • TypeScript throughout

Structure

src/
  routes/                    SvelteKit pages
    +layout.svelte           App shell (sidebar + main)
    +page.svelte             Landing/redirect
    [workspace]/
      +page.svelte           Dashboard (collections, phases, activity)
      +layout.svelte         SSE connection per workspace
      [collection]/
        +page.svelte         Collection view (board/list)
      [collection]/[item]/
        +page.svelte         Item detail + editor
      conventions/            Purpose-built conventions page
      playbooks/              Purpose-built playbooks page
      settings/               Workspace settings
  lib/
    api/client.ts            HTTP API client
    components/
      layout/                Sidebar, navigation
      editor/                Tiptap editor, raw markdown editor
      fields/                FieldEditor, relation picker
      items/                 ItemCard, ItemDetail
      collections/           BoardView, ListView
      common/                StatusBadge, badges, modals
      search/                CommandPalette
    stores/                  Svelte 5 reactive stores
      workspace.svelte.ts    Workspace state
      collections.svelte.ts  Collection + item state
      ui.svelte.ts           Sidebar, mobile state
    types/index.ts           TypeScript types and constants
  app.css                    Global styles and design tokens