refactor(server): move the install audit trail from core to the server (P1.2, UF-040)

Core keeps only shared infrastructure, so InstallAuditStore leaves it and
lives in packages/server/src/local/install-audit.ts. The trail itself stays:
the Audit and Activity tabs, the extend and export routes, and the threat
model entry keep working on the same waggle.db table.

- @waggle/shared gets RecordAuditInput and the narrow InstallAuditRecorder
  (record only), which the agent's skill tools now depend on.
- The server creates the audit table before the one-time legacy copy, which
  no longer constructs it in core.
- UF-040: GET /api/debug/logs called prepare() on the store's private db
  wrapper, which has none, so the support bundle never carried recent
  installs. It now reads them through getRecentSummary().
This commit is contained in:
shumeiko.it
2026-10-25 21:32:38 +01:00
parent 3befcd8e9b
commit 2e08f2ae96
22 changed files with 118 additions and 79 deletions

View File

@@ -68,6 +68,7 @@ Baseline: commit `b20b138` of `git.os-dev.tech/oleg.m/waggle-os`.
| UF-037 | Restore overwrites database files the running sidecar holds open | Open | Sidecar, backup |
| UF-038 | Marketplace installs never notify the running sidecar | Open | Marketplace, sidecar |
| UF-039 | A memory saved to an unknown workspace lands in personal memory | Fixed | Sidecar, memory, privacy |
| UF-040 | The support bundle never includes recent installs | Fixed | Sidecar, support |
## Entries
@@ -395,3 +396,12 @@ Entries UF-010 to UF-019 come from the UI audit `anti-slop/audit-001-2026-10-14.
- Cause: the routes treat an unknown workspace the same as no workspace.
- What we did: the three write routes save to personal memory only when no workspace is named and answer 404 `workspace_not_found` for a workspace that does not exist (`writeScopeForWorkspace` in `memory-records.ts`).
- Recommendation: refuse writes for unknown workspaces in the main project as well.
### UF-040. The support bundle never includes recent installs
- Status: Fixed
- Found: 2026-10-25
- Where: at commit `b20b138`, `packages/server/src/local/index.ts:2752-2760` (`GET /api/debug/logs`)
- Symptom: the support log download in Settings (`waggle-logs-*.json`) has no `auditRecent` field, although the route promises recent install events.
- Cause: the route reads the private `db` field of the audit store and calls `prepare` on it. That field is the database wrapper (`MindDB`), which has no `prepare` method, so the call throws and the empty `catch` drops the error.
- What we did: the server's `InstallAuditStore` got `getRecentSummary()`, which returns only the timestamp, action and capability type of the latest 50 events, and the route calls it. A test checks the field and its columns.
- Recommendation: read the trail through the store's own API in the main project as well, and log errors in this route instead of dropping them.