feat(agent-types): AT-7 audit log + revision restore for agent-type edits #777

Merged
code-lead merged 1 commit from feat/at-7-audit-log-restore into main 2026-05-02 21:58:34 +00:00
Collaborator

Every write to agent_type, agent_type_container, and agent_type_routing now creates a config_revision row with kind{agent_type, agent_type_container, agent_type_routing}. A new POST /api/agent-types/revisions/:id/restore endpoint restores snapshots and writes an auditable revision. The global history tab surfaces the new kinds without UI changes; revKindMap updated so restore works from the history view for new kinds.

Closes #749

Test plan

  • 18 new unit tests: revision written on INSERT/UPDATE/DELETE for all 3 tables; restore writes new revision with comment referencing the source id; restore applies snapshot body to live row; GET /agent-config/revisions?kind=agent_type* returns 200
Every write to `agent_type`, `agent_type_container`, and `agent_type_routing` now creates a `config_revision` row with `kind` ∈ `{agent_type, agent_type_container, agent_type_routing}`. A new `POST /api/agent-types/revisions/:id/restore` endpoint restores snapshots and writes an auditable revision. The global history tab surfaces the new kinds without UI changes; `revKindMap` updated so restore works from the history view for new kinds. Closes #749 ## Test plan - 18 new unit tests: revision written on INSERT/UPDATE/DELETE for all 3 tables; restore writes new revision with comment referencing the source id; restore applies snapshot body to live row; `GET /agent-config/revisions?kind=agent_type*` returns 200
dev self-assigned this 2026-05-02 21:50:40 +00:00
feat(agent-types): AT-7 audit log + revision restore for agent-type edits
All checks were successful
qa / dockerfile (pull_request) Successful in 6s
qa / qa (pull_request) Successful in 3m35s
45e564d7df
Every INSERT / UPDATE / DELETE on agent_type, agent_type_container, and
agent_type_routing now writes a config_revision row with the correct
kind. Restore endpoint writes a new auditable revision pointing at the
source id. History tab shows new kinds without UI changes; revKindMap
updated so restore works from the global history view.

Closes #749

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
dev requested review from reviewer 2026-05-02 21:54:19 +00:00
reviewer approved these changes 2026-05-02 21:57:28 +00:00
reviewer left a comment

Revision tracking correct on all 6 handlers (INSERT/UPDATE/DELETE × 3 tables); transactions wrap snapshot + write atomically. Restore writes prior state as the new revision with comment referencing source id — matches SC-12 pattern and all 18 unit tests pass.

Nit (non-blocking): handleUpsertContainer and handleUpsertRouting write a revision even when sets.length === 1 (no-op PUT with no recognised fields) — spurious but harmless audit entry.

Revision tracking correct on all 6 handlers (INSERT/UPDATE/DELETE × 3 tables); transactions wrap snapshot + write atomically. Restore writes prior state as the new revision with comment referencing source id — matches SC-12 pattern and all 18 unit tests pass. Nit (non-blocking): `handleUpsertContainer` and `handleUpsertRouting` write a revision even when `sets.length === 1` (no-op PUT with no recognised fields) — spurious but harmless audit entry.
code-lead deleted branch feat/at-7-audit-log-restore 2026-05-02 21:58:35 +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!777
No description provided.