Repository navigation
feat(security): show which platforms feed the audit log and how to connect more - #2724
Confidence 10/10 · No issues found
🟢 Confidence 10/10 · safe to merge. State derivation, the route and the panel are pinned by tests, and the org filter is on the new query; only two cosmetic UI defects were found.
2 notes · tests covered · risk medium · 3/3 new units observable
Adds a Sources panel to the audit log that lists each feeding platform with its state and one action, plus a new admin-only GET /internal/audit-trail/sources endpoint that joins 30-day per-platform event counts against the integration inventory. Safe to merge; the findings are copy and accessible-name polish.
auditTrailSourcesderives each platform's state from event counts and the inventoryGET /audit-trail/sourcescounts events per provider over 30 days- The audit log page reads sources alongside the first page and shows the panel
- Events and event details render the platform's logo
Before merge
- Manual · Confirm
INGEST_AUDIT_TRAIL_ENABLEDis on in prd, or Vercel and Google Cloud rows read "No events yet"
Findings
🔵 Note · F1 · Sources failure line points at a retry the page does not show
correctness · apps/web/src/page/security/audit-log/view-sources.ts:172
"Try again from the list below" only exists when the list itself failed: the sole control sending Message.ClickedRetry renders inside the first page's failure state (view.ts:446). When the events load and only providerStats fails, the reader is sent to a retry that is not on the page.
"Couldn't load which platforms feed the audit log.",
🔵 Note · F2 · Turn on and Open integration links repeat one accessible name across rows
correctness · apps/web/src/page/security/audit-log/view-sources.ts:120-123
With both connectable platforms off — the state a new org opens on — two rows carry links whose accessible name is only "Turn on" (and two "Open integration" when both fail), each going to a different platform's setup. Connect ${name} and the View events AriaLabel show the intended pattern.
if (source.state === "off" || source.state === "failing")
return linkButton(
h,
{
variant: "outline",
size: "sm",
href: setupHref(source.provider),
attributes: [h.AriaLabel(`${source.state === "off" ? "Turn on" : "Open"} ${name}'s audit feed`)],
},
[source.state === "off" ? "Turn on" : "Open integration"],
)
Production impact
Production traffic of the changed files (last 7 days)
| File | Calls/day | Busiest operations |
|---|---|---|
apps/web/src/page/security/audit-log/view-sources.ts |
3.6k | maple 3.6k/day, 1.9% err |
packages/backend/src/services/audit-trail/audit-trail-sources.ts |
3.6k | maple 3.6k/day, 1.9% err |
What was checked
auditTrailSourcesQueryfiltersOrgIdand prunes on the(OrgId, OccurredAt, Id)sorting key- The Vercel matcher (
kind === "drain" && name === "audit log") matches integration-inventory.ts:551 - The
IntegrationInventoryUnavailableErrortag caught at the route matches the class definition
Observability coverage: 3 of 3 changes observable
| Change | Kind | Observable | Evidence |
|---|---|---|---|
| GET /internal/audit-trail/sources | inbound HTTP endpoint | yes | Handler sits in the auditTrail HttpApi group covered by the HttpMiddleware.tracer layer in apps/api/src/http/api-observability.ts |
| Per-platform audit event aggregation | warehouse query | yes | compiledQuery(..., { profile: "aggregation", context: "auditTrailSources" }) inside Effect.fn("AuditTrailService.providerStats") |
| Integration inventory read | database read | yes | Effect.fn("IntegrationInventoryService.list"); the degraded path logs a structured warning with the cause |
4f3270f · Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.
Annotations
Check notice on line 172 in apps/web/src/page/security/audit-log/view-sources.ts
maple-review-bot / Maple / review
correctness: Sources failure line points at a retry the page does not show
"Try again from the list below" only exists when the list itself failed: the sole control sending `Message.ClickedRetry` renders inside the first page's failure state (`view.ts:446`). When the events load and only `providerStats` fails, the reader is sent to a retry that is not on the page.
Check notice on line 123 in apps/web/src/page/security/audit-log/view-sources.ts
maple-review-bot / Maple / review
correctness: `Turn on` and `Open integration` links repeat one accessible name across rows
With both connectable platforms off — the state a new org opens on — two rows carry links whose accessible name is only "Turn on" (and two "Open integration" when both fail), each going to a different platform's setup. `Connect ${name}` and the `View events` `AriaLabel` show the intended pattern.