Files
pad/web
xarmian 7d89e352c8 test(web): pin the two mechanisms that keep a settings reload from vouching for the previous identity's invitations (BUG-3237) (#1588)
* test(web): pin the two mechanisms that keep a settings reload from vouching for the previous identity's invitations (BUG-3237)

BUG-3237 does not reproduce in production. The filed state (load() stamps
the page epoch at entry, so pageIdentityHeld() vouches for the previous
session's invitations mid-reload) needs the epoch to move WITHOUT the user
id. Only the existing settingsIdentityFence harness does that, deliberately.
A real identity change moves both, and two mechanisms each close the window:
the (user, workspace)-keyed load effect clears the lists before load(), and
loading = true swaps the page for the spinner.

New settingsLoadIdentityOrder.svelte.test.ts drives a coupled mock (user
and epoch move together, both reactive and probed). It has a no-flip
control, a settled flip, an identity change mid-load with the old answer
landing late, and a workspace switch mid-load. It passes on main. The
mutants: clear removed, 5 pass; loading swap removed, 5 pass; both
removed, the settled leg fails; loadGen check removed, 2 legs fail; user
dropped from the key, 2 legs fail. It is the only test in the tree that
fails with both removed, which makes it the pin for that pair.

A comment on load() names both mechanisms, so neither is removed on the
theory that the other covers it. It is comment-only, and the TASK-3097
identity gate is unchanged.

A reactive $app/state double (src/test/mocks/reactivePage.svelte.ts) is
added, because the default alias is a plain object: reassigning
page.params never re-ran the route's $derived, so the first run of the
workspace-switch leg issued no second load at all.

Claude-Session: https://claude.ai/code/session_016PXRzXhokr61CLbbu3Txj9

* test(web): the BUG-3237 pin clicks the copy link during the pending reload, so the both-removed mutant fails on the copy itself (codex round 1)

Claude-Session: https://claude.ai/code/session_016PXRzXhokr61CLbbu3Txj9
2026-09-26 20:03:08 -04: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