Audit log panel answers "404 not found" — feature-detect, and decide whether the dogfood enables audit #173

Closed
opened 2026-08-10 00:48:58 +00:00 by Cordy · 1 comment
Owner

Dogfood note (Nikola): opening the audit log window immediately shows "404 not found" before any user/path filter, and every query 404s too.

Probable root cause (to verify): /api/v1/admin/audit is only registered when audit.enabled is true in the config — and the cairn-enc-config secret likely doesn't enable it, so the route falls through to 404. The UI shows the Audit button to every admin regardless of whether the feature is on: a feature-detection bug, same class as the trash view (which 404-detects properly).

Fix: the admin UI feature-detects audit (probe once, hide the button or show "Audit logging is not enabled on this server — set audit.enabled in the configuration" instead of a raw 404). /api/v1/admin/info could carry auditEnabled explicitly.

Follow-up question for Nikola: do you want audit logging ON for the dogfood/beta? It writes JSONL month files under /data/.cairn/audit (local scratch, PVC-backed). For the beta with Manuel it would exercise #63/#61 surfaces for real — recommended. If yes, that's one line in the cairn-enc-config secret (your edit — I don't touch the secret) plus a pod restart.

Dogfood note (Nikola): opening the audit log window immediately shows "404 not found" before any user/path filter, and every query 404s too. **Probable root cause (to verify):** `/api/v1/admin/audit` is only registered when `audit.enabled` is true in the config — and the `cairn-enc-config` secret likely doesn't enable it, so the route falls through to 404. The UI shows the Audit button to every admin regardless of whether the feature is on: a feature-detection bug, same class as the trash view (which 404-detects properly). **Fix:** the admin UI feature-detects audit (probe once, hide the button or show "Audit logging is not enabled on this server — set `audit.enabled` in the configuration" instead of a raw 404). `/api/v1/admin/info` could carry `auditEnabled` explicitly. **Follow-up question for Nikola:** do you want audit logging ON for the dogfood/beta? It writes JSONL month files under `/data/.cairn/audit` (local scratch, PVC-backed). For the beta with Manuel it would exercise #63/#61 surfaces for real — recommended. If yes, that's one line in the `cairn-enc-config` secret (your edit — I don't touch the secret) plus a pod restart.
Author
Owner

Already implemented in current code (v0.6.8) — verified by reading web/static/index.html.

loadAudit feature-detects the 404 and shows a friendly message instead of the raw error:

li.textContent = /404|not found/i.test(e.message) ? t("auditDisabled") : e.message;

When audit is disabled the /api/v1/admin/audit route is never registered (registerAudit runs only when h.Audit != nil && h.Admin != nil, api.go), so the panel gets a 404 → adminFetch surfaces "404 Not Found" → the regex matches → the panel shows auditDisabled ("Audit logging is not enabled on this server — set audit.enabled…").

Closing as implemented. Reopen if the panel still shows a bare 404 on the dogfood (that would only happen if the server returned a JSON error body without "404"/"not found" text — in which case the fix is to switch the detection to the HTTP status instead of the message string).

Already implemented in current code (v0.6.8) — verified by reading `web/static/index.html`. `loadAudit` feature-detects the 404 and shows a friendly message instead of the raw error: ```js li.textContent = /404|not found/i.test(e.message) ? t("auditDisabled") : e.message; ``` When audit is disabled the `/api/v1/admin/audit` route is never registered (`registerAudit` runs only when `h.Audit != nil && h.Admin != nil`, api.go), so the panel gets a 404 → `adminFetch` surfaces `"404 Not Found"` → the regex matches → the panel shows `auditDisabled` ("Audit logging is not enabled on this server — set audit.enabled…"). Closing as implemented. Reopen if the panel still shows a bare 404 on the dogfood (that would only happen if the server returned a JSON error body without "404"/"not found" text — in which case the fix is to switch the detection to the HTTP status instead of the message string).
Cordy closed this issue 2026-08-11 16:53:12 +00:00
Sign in to join this conversation.
No labels
No project
No assignees
1 participant
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: Cordy/Cairn#173
No description provided.