Files
pad/web
xarmian 4ebad409a2 fix(web): gate the composer's item identity during A→B navigation (IDEA-2843)
Codex round 6.

1. [P1] During an A→B navigation `item` still holds A while loadData
   fetches B, so ItemTimeline received A's itemId/collectionId beside B's
   itemSlug — and an attachment dropped in the composer inside that window
   is associated with the WRONG item.

   The wiring is PRE-EXISTING and identical on main. What changed is the
   exposure: the composer used to sit behind the Activity tab, and tabs
   reset to Details on an item switch, so reaching it inside the load window
   took a deliberate tab click. It is now on the tab you land on. Widening a
   latent hole is the same as opening one, so it is fixed here.

   Fixed by feeding honest inputs rather than adding a gate: the host passes
   itemId/collectionId only while `itemMatchesRef`, and ItemTimeline's
   canEdit already derives false without them, so the composer hides until
   the identities agree.

2. [P2] A load failure's banner outlived it — `loadMore` set `error` and
   never cleared it, so a successful retry left the failure sitting beside
   the entries it claimed had not loaded. Newly visible because the error is
   mirrored to the tabs now.

Test boundary, stated: the new test covers ItemTimeline's half of the gate
(no identity ⇒ no composer), verified by a control that flips its default to
permissive. The host's half — the `itemMatchesRef ? … : undefined` — is not
unit-testable here, since ItemDetail cannot be mounted in jsdom.

Gates: 119 files / 2005 unit tests, svelte-check 0 errors. E2E: 37 passed
across the five affected specs. An earlier run of that same set had one
failure — capstone's "stale back-settle" nav test — which did not reproduce
alone or in an identical re-run, and sits outside this diff's surface
(history back-settle and drill targeting; nothing here touches either).
Recorded rather than dropped.

Claude-Session: https://claude.ai/code/session_011Q4b1iHtJtSyMs7BA2ySxo
2026-09-02 19:42:50 +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