Repository navigation
feat(portal): show a patch's log to its owner and admins - #451
Conversation
Opus reviewTwo findings, both about read cost on a large log. I checked authorization, escaping and outcome labels and found nothing blocking there (details at the end). 1. The 50-step cap only trims the output: every step is still read, and the card reads trees it never shows
The registry lets this get big. The card makes this worse. Fix:
2. Filtered pages scan the patch's whole history when matches are rare
When a filter matches fewer than 26 rows, the scan runs to the start of the patch's log on every request. Three things make this the ordinary case, not an edge case:
The PR caps Fix, simplest first:
Checked and fine
|
Astra reviewReviewed StandardsNo merge-blocking method or YAGNI findings. Spec
Verification: reproduced both cases through the real Summary: Standards 0 blockers; Spec 2 blockers. Worst Spec issue: the log loses which connection an operation accessed. |
Review responsesI fixed all four findings in e86af75 (docs follow-up in the next commit). Nothing was kept as is. Opus 1: tree reads were unbounded, and the card read trees it never showed. Fixed.
Opus 2: filtered pages scanned the whole history. Fixed.
Astra 1: the connection a call went to was lost. Fixed, with no migration:
Astra 2: a cut could keep a child and drop its parent. Fixed by the level-wise read above. A step is read only after its parent has been kept, so every kept step's parent is kept regardless of timestamp ties. The tree is cut outermost first, and each parent's own steps stay in time order. Verification
CI on the previous head: |
50057a1 to
1f8b40e
Compare
A per-patch log page at /patches/<name>/log (L-2): newest-first entries paged by cursor, filtered by outcome, person and handler, each row expanding into its calls and nested handlers in sentence form with the patch's ctx.log lines. The card gains Recent activity (W-2) for the owner and admins. InvocationLog gains bounded page and choices readers; the shell set gains pill-failed, list-tree and an expandable table row. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Tables used overflow-wrap: anywhere, which let auto layout squeeze
columns until headers split mid-word ("Versio / n"). break-word keeps
words whole in column widths, so a narrow table scrolls inside its
wrapper; only a token wider than the table still breaks. The log page's
own cell rule is no longer needed.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
622cfd8 changed the shared .table wrapping, which made the card's versions table scroll sideways on phones. Restore the shared rule and keep words whole only in the log table, which scrolls in portal-table. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review follow-ups for #412: - The card's Recent activity reads only top-level rows, not trees. - Entry trees are read a level at a time, each kept parent reading at most the room left plus one step through the parent and invocation indexes, so a cut never keeps a step without its parent. - Filters apply within the newest 1,000 entries after the cursor; the page says so and Older entries continues past the window's edge. - Connection calls name the connection by handle from the stored connection_id (no migration), falling back to the id. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
edfda35 to
bbd4a9c
Compare
Tier 2 records every invocation, the calls it makes and its
ctx.loglines, but nobody could read that record outside the database. Owners and admins had no way to see who ran what, as whom, or why an action failed.This adds the per-patch log to the portal, as picked on #385 (L-2 and W-2):
/patches/<name>/log, for the patch's current owner and every admin. Everyone else gets a 403, and reassignment moves the owner's access. Rows are top-level invocations, newest first: time, person, version, handler, kind, outcome and duration. A row expands into the calls and nested handlers inside it, in sentence form ("leads.create (mutation) · as the patch"), followed by the patch'sctx.loglines. Failed rows open by default. A reply the page never received shows the real settled outcome plus "reply not delivered". Pages hold 25 entries, paged by cursor. Filters cover outcome, person and handler and search 1,000 entries at a time; the page says when older entries lie beyond that window. Connection calls name the connection by handle. Each entry reads and shows at most 50 steps, outermost first, and says when it made more. The nothing-logged and filtered-empty states follow the mock. The page says the log is an attribution record, not an access audit, and that log lines are written by the patch itself.InvocationLoggains two bounded readers over the existingruntime_invocationsandruntime_callscolumns:page(the card skips its trees) andchoices, which lists the filter options from the newest 1,000 entries. No migration. The per-connection recent-calls list is unchanged.pill-failed,list-treeand an expandabletable-expandrow. The log table keeps words whole and scrolls insideportal-tableon phones; other tables are unchanged.ui-consistencyspec, the Portal glossary (Log),CONTEXT-MAP.md(Portal → Runtime) anddocs/product.md(who reads the log).Stacked on
tier2/411-csv-download(#450); this PR contains only the #412 commits. Implements #412, part of #384.Verification
pnpm lintandpnpm typecheckpass.packages/portal,packages/runtime,packages/core,apps/server,packages/patches/src/Subscriptions.test.tsandpackages/patchy/src/devExecution.test.ts. New cases:InvocationLog.pagebounds each entry's tree, reads overdue entries as unknown and scopes cursors to the patch.Built with Claude Opus 5.5 via Claude Code.