Skip to content

feat(portal): the portal at / and the patch card at /patches/<name> #255

Closed

Description

@allisonmahmood

Part of #247. Implements spec §9's routes, index, card, inline acts and versions page and §5's stale-action rule; decisions the list mocks, the page mocks (the on-card half) and the prototype. PR #246 (never merged) is the reference for copy and layout, not for code.

What to build

  • packages/portal is born: the Portal context (packages/portal/CONTEXT.md exists already), PortalPages mounting GET / and GET /patches/:name[?all=1] behind RequireSession.withViewer, over Patches' read query, Companies and Auth. The server registers / and Serving's catch-all in one place so registration order never decides the root; Serving's renderHome becomes the signed-out door at /.
  • The index: name and the description's first clause (cut at the first ., ; or – and 80 characters), grouped Yours and Company (live only) and Retired and deleted (every off patch) behind the toggle (all=1 kept on links while on), retired, deleted · gone in N days (from purgeAt) and owner deactivated marks, sorted by name, the card position: sticky; the empty company's single card only when no row exists in any state; a company whose patches are all off shows the empty live index with the toggle. / selects the first of Yours, else the first live, else the empty state.
  • The card: address line, name as h1, the title as one secondary line only when present and not restating the name, description or muted "No description" with the actor line, Open and the address to copy, the facts (Owner with "(deactivated)", Current version with date and publisher, Who can open it in the spec's words, Used by other patches: three plus a count or "Nothing else reads this patch"). Member: facts and Open. Owner or admin: Manage with the inline forms and copy of spec §9: Description, Who can open it, Versions (current plus three, Show this version at the address, "All N versions" → GET /patches/:name/versions), Restore as one button when the sources are live, the Stop serving block with Retire… and Delete… as links to the pages ticket 8 builds, the admin's Owner line, Reassign… link and "You can do everything an owner can from here, except publish.", the deactivated-owner notice. Retired card: state fact, the "Off the shelf" note, and for the owner or an admin Restore, Delete…, the description form only, plus Reassign… for an admin. Deleted card: the "Gone for good in N days" note, Restore, and Reassign… for an admin. A member's off card: the state fact and the note, no Open, no acts.
  • Inline acts: POST /patches/:name/description, /scope, /rollback, /restore, each carrying its own precondition as a hidden field (expected descriptionUpdatedAt, scope, current version, state) and answering 409 with the card re-rendered, a fresh field and the notice "This patch changed while you had this page open: retired by Sam 2 minutes ago. Nothing was done." (always the person and the act, from last_changed_by/at: retired, deleted, restored, rolled back to v7, sharing changed, description changed, reassigned). 422 redisplays the form with the submitted text; a member's POST is 403 with the card and "Only the owner or an admin can do that. Nothing was done." /restore posts directly only when the current version's sources are live; otherwise the button is a link to ticket 9's page, and an inline restore that meets sources_off answers 409 with that page. Rollback and scope on an off card are wrong_state; the forms are not drawn there.
  • An unknown, foreign or reclaimed name is the app-shell 404; an overlong name is 414.

Admitted at merge

/ is the portal for every signed-in member; the destructive acts still lead to pages that ticket 9 adds, so the Retire…, Delete…, Reassign… and off-source Restore… links render but answer 404 until then (say so in the PR).

Done when

  • NodeHttpServer.layerTest with the seeded session covers: the three views of one card (member, owner, admin), the retired and deleted cards, the empty company, the index groups and marks, each inline act succeeding and each refusing on a stale field with the 409 notice and nothing done, a member's 403, the title line's presence rule, and the index line's cut; pnpm dev screenshots of / and a card on the app shell.

Surfaces

Served pages (ui-consistency), CONTEXT-MAP.md (Portal's package exists), the Portal glossary (Portal, Index, Card, Manage, Stale action from decided to built), the Serving glossary if renderHome moves, docs/product.md § Sharing and finding (the portal) from decided to built, README.md's layout list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions