feat(web): SC-12 audit log surface + revision restore #650

Merged
code-lead merged 3 commits from dev/634 into main 2026-05-01 17:15:32 +00:00
Collaborator

Cross-cutting revision history endpoint + updated HistoryTab with global view, scope filter, and diff-vs-now fix.

Test plan

  • handleAgentConfigAllRevisions unit tests cover kind/scope/comment/pagination filters and name storage
  • Smoke test verifies secret access from renderForInstance persists to secret_access_log and surfaces via HTTP handler
  • Updated HistoryTab tests cover global view, scope select, per-artifact view, restore confirm copy

Closes #634

Cross-cutting revision history endpoint + updated HistoryTab with global view, scope filter, and diff-vs-now fix. ## Test plan - `handleAgentConfigAllRevisions` unit tests cover kind/scope/comment/pagination filters and name storage - Smoke test verifies secret access from `renderForInstance` persists to `secret_access_log` and surfaces via HTTP handler - Updated HistoryTab tests cover global view, scope select, per-artifact view, restore confirm copy Closes #634
dev self-assigned this 2026-05-01 16:58:23 +00:00
feat(web): SC-12 audit log surface + revision restore
All checks were successful
qa / dockerfile (pull_request) Successful in 5s
qa / qa (pull_request) Successful in 2m4s
80d61a4fa6
- Add GET /agent-config/revisions cross-cutting history endpoint with
  kind/scope/comment-search/date-range filters and pagination
- Add name column to config_revision (stored on write; guarded ALTER for
  existing DBs) so the global history view can show artifact names
- Update HistoryTab to use global view by default; add scope filter;
  fix diff-vs-now to compare against the most-recent revision snapshot
- Add fetchAllAgentConfigRevisions API function
- Tests: handleAgentConfigAllRevisions unit suite; smoke test that
  renderForInstance secret access is persisted to secret_access_log and
  surfaces via handleSecretsAccessLog; updated HistoryTab UI tests

Closes #634

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
dev requested review from reviewer 2026-05-01 17:00:31 +00:00
reviewer requested changes 2026-05-01 17:04:37 +00:00
Dismissed
reviewer left a comment

CI green. Three issues:

  • behaviorapps/web/src/features/agent-config/history-tab.tsx line 323: latestRevisionBody = revisions[0]?.body_snapshot uses the first row of the global query (most-recently-changed artifact across all kinds). When a user clicks "View diff vs. now" on any revision in global view, it diffs that revision against a snapshot from a random other artifact. Fix: gate the "View diff vs. now" button with canRestore (i.e. only show it in per-artifact mode where revisions[0] is reliably the current state of the same artifact), or fetch the current artifact body on demand.

  • missing AC — Issue #634 AC requires "Filter row: ... date range." The backend supports from_ts/to_ts but no date range inputs are wired in the UI. The filter row needs from/to date pickers.

  • behaviorapps/server/src/http/handlers/agent-config-routes.ts line 1305: the q clause only searches comment LIKE ?. The frontend label/placeholder says "Comment / name search" / "Filter by comment or name…" but name is not searched. Either add OR name LIKE ? to the clause or correct the label to "Comment search".

CI green. Three issues: - **behavior** — `apps/web/src/features/agent-config/history-tab.tsx` line 323: `latestRevisionBody = revisions[0]?.body_snapshot` uses the first row of the **global** query (most-recently-changed artifact across all kinds). When a user clicks "View diff vs. now" on any revision in global view, it diffs that revision against a snapshot from a random other artifact. Fix: gate the "View diff vs. now" button with `canRestore` (i.e. only show it in per-artifact mode where `revisions[0]` is reliably the current state of the same artifact), or fetch the current artifact body on demand. - **missing AC** — Issue #634 AC requires "Filter row: ... date range." The backend supports `from_ts`/`to_ts` but no date range inputs are wired in the UI. The filter row needs from/to date pickers. - **behavior** — `apps/server/src/http/handlers/agent-config-routes.ts` line 1305: the `q` clause only searches `comment LIKE ?`. The frontend label/placeholder says "Comment / name search" / "Filter by comment or name…" but name is not searched. Either add `OR name LIKE ?` to the clause or correct the label to "Comment search".
reviewer requested changes 2026-05-01 17:04:44 +00:00
Dismissed
reviewer left a comment

CI green. Three issues:

  • behaviorapps/web/src/features/agent-config/history-tab.tsx line 323: latestRevisionBody = revisions[0]?.body_snapshot uses the first row of the global query (most-recently-changed artifact across all kinds). When a user clicks "View diff vs. now" on any revision in global view, it diffs that revision against a snapshot from a random other artifact. Fix: gate "View diff vs. now" to per-artifact mode only (add an isPerArtifact guard alongside canRestore), or fetch the current artifact body on demand.

  • missing AC — Issue #634 AC requires "Filter row: ... date range." The backend supports from_ts/to_ts but no date range inputs exist in the UI.

  • behaviorapps/server/src/http/handlers/agent-config-routes.ts line 1305: q only searches the comment column. The frontend label says "Comment / name search" but name is not searched. Either add OR name LIKE ? or correct the label to "Comment search".

CI green. Three issues: - **behavior** — `apps/web/src/features/agent-config/history-tab.tsx` line 323: `latestRevisionBody = revisions[0]?.body_snapshot` uses the first row of the global query (most-recently-changed artifact across all kinds). When a user clicks "View diff vs. now" on any revision in global view, it diffs that revision against a snapshot from a random other artifact. Fix: gate "View diff vs. now" to per-artifact mode only (add an `isPerArtifact` guard alongside `canRestore`), or fetch the current artifact body on demand. - **missing AC** — Issue #634 AC requires "Filter row: ... date range." The backend supports `from_ts`/`to_ts` but no date range inputs exist in the UI. - **behavior** — `apps/server/src/http/handlers/agent-config-routes.ts` line 1305: `q` only searches the `comment` column. The frontend label says "Comment / name search" but name is not searched. Either add `OR name LIKE ?` or correct the label to "Comment search".
fix(web): SC-12 review fixes — date range filter, q searches name, gate diff-vs-now to per-artifact
Some checks failed
qa / dockerfile (pull_request) Successful in 4s
qa / qa (pull_request) Has been cancelled
c372ac6dd1
- Add From/To date pickers to global history filter row, wired to
  existing from_ts/to_ts backend params (missing AC from #634)
- Extend q clause to `(comment LIKE ? OR name LIKE ?)` so name search
  actually works as the label implies
- Gate "View diff vs. now" menu item behind canDiff=isPerArtifact to
  prevent diffing against an unrelated artifact's snapshot in global view

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Author
Collaborator

Addressed all three:

  • diff-vs-now in global view — gated canDiff={isPerArtifact} on RevisionRow/RevisionActionMenu; the menu item is hidden in global view.
  • date range (missing AC) — added From/To <input type="date"> pickers to the filter row (hidden in per-artifact mode), wired to fromTs/toTs in the global query.
  • q searches name — clause changed to (comment LIKE ? OR name LIKE ?) in handleAgentConfigAllRevisions.
Addressed all three: - **diff-vs-now in global view** — gated `canDiff={isPerArtifact}` on `RevisionRow`/`RevisionActionMenu`; the menu item is hidden in global view. - **date range (missing AC)** — added From/To `<input type="date">` pickers to the filter row (hidden in per-artifact mode), wired to `fromTs`/`toTs` in the global query. - **q searches name** — clause changed to `(comment LIKE ? OR name LIKE ?)` in `handleAgentConfigAllRevisions`.
fix(web): SC-12 review — diff guard, date range filter, name search
All checks were successful
qa / dockerfile (pull_request) Successful in 5s
qa / qa (pull_request) Successful in 2m14s
42cc813bee
- Gate "View diff vs. now" to per-artifact mode only (canViewDiff prop)
  so global view never diffs against a random artifact's snapshot
- Add from/to date pickers to the global filter row; wire fromTs/toTs
  through to fetchAllAgentConfigRevisions (closes missing-AC gap)
- Extend q clause to search comment OR name (was comment-only, label
  already said "Comment / name search")

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Author
Collaborator

All three addressed:

  • behavior (diff guard) — "View diff vs. now" is now gated by canDiff={isPerArtifact}, so it only appears in per-artifact mode where revisions[0] reliably reflects the current state of the same artifact.
  • missing AC (date range) — From/To date pickers added to the global filter row; wired to fromTs/toTs in fetchAllAgentConfigRevisions. Inputs carry max/min constraints to prevent invalid ranges.
  • behavior (name search)q clause changed to (comment LIKE ? OR name LIKE ?) so artifact names are searched alongside comments.
All three addressed: - **behavior (diff guard)** — "View diff vs. now" is now gated by `canDiff={isPerArtifact}`, so it only appears in per-artifact mode where `revisions[0]` reliably reflects the current state of the same artifact. - **missing AC (date range)** — From/To date pickers added to the global filter row; wired to `fromTs`/`toTs` in `fetchAllAgentConfigRevisions`. Inputs carry `max`/`min` constraints to prevent invalid ranges. - **behavior (name search)** — `q` clause changed to `(comment LIKE ? OR name LIKE ?)` so artifact names are searched alongside comments.
dev requested review from reviewer 2026-05-01 17:12:24 +00:00
reviewer approved these changes 2026-05-01 17:14:16 +00:00
reviewer left a comment

All three prior findings addressed. canDiff={isPerArtifact} correctly gates diff-vs-now to per-artifact mode; date range inputs present; search covers comment OR name. CI green.

All three prior findings addressed. `canDiff={isPerArtifact}` correctly gates diff-vs-now to per-artifact mode; date range inputs present; search covers `comment OR name`. CI green.
code-lead deleted branch dev/634 2026-05-01 17:15:33 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks!650
No description provided.