Repository navigation
fix(secrets): audit log reads the fields the API sends (#20173) - #21262
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 12 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Code review (code-reviewer pass) at 4af569bVerdict: CHANGES NEEDED — one backend finding can turn a working audit query into a 500; the rest is sound.
Checks
|
✅ SSOT Configuration Compliance: Passing🎉 No new hardcoded values of either class — Known backlog in |
Code review follow-up at 71319bb
Local runs: pytest |
|
Code review (code-reviewer pass) follow-up at 71319bb Verdict: APPROVE.
api.ts regenerated (diff limited to |
|
Verdict: APPROVE @ e124a68 Read-only review; CI is paused so nothing was run. No blocking defects found.
Checks:
|
Thinking Path
auditTimestampToDateintypes/audit.ts,details.nameinSecretAuditLog.vue), but the row was still a hand-written interface, because the backend response model typedentriesasList[dict]and the generated schema had no row type to read.api.tswith the CI recipe, and make the frontend row type the generated schema.What Changed
autobot-backend/api/schemas_audit.py(new):AuditEntryResponse(every fieldAuditEntry.to_response_dictsends) andAuditQueryResponsewithentries: List[AuditEntryResponse]. Moved out ofschemas_system.py(a grandfathered file that may not grow);api/audit.pyimports it from there. All four routes using it (/logs,/session,/user,/failures) now serialize typed rows.autobot-frontend/src/types/generated/api.ts: regenerated with theverify-generated-typesrecipe (dump OpenAPI, thenopenapi-typescript --additional-properties); +47/-3 lines.autobot-frontend/src/types/audit.ts:AuditEntry = components['schemas']['AuditEntryResponse']replaces the hand-written interface. Every consumer (secret audit log, audit dashboard table and timeline, plugin capability log) type-checks against it.SecretAuditLog.test.ts: the fixture is typed from the generated row, and a field-presence test ties the fixture's keys to the schema's fields.Instances of the mismatch in the secret audit UI (the same set as the issue):
timestampseconds read as ms,metadata.secret_nameread instead ofdetails.name, username read instead ofuser_id(all fixed earlier on main, now typed), plus the hand-written row type itself (fixed here).Not in this PR: the issue's second criterion (one declaration each for
AuditLogEntry/AuditQueryResponseand removing the ratchet exceptions) needs the shared kit and the SLM app, held by another open PR; the host criterion needs a finished update. So this isRefs.Verification
vue-tsc --noEmit -p tsconfig.app.json: exit 0.src/components/secrets src/components/audit src/i18n: 11 files, 77 tests passed.types/audit.tsand the test: clean. Backend audit tests are skipped locally (19 skipped); CI runs them.Refs #20173
Model Used
Claude Sonnet 5.5
🤖 Generated with Claude Code