Skip to content

fix: audit trail invalid-date and abort-on-navigation errors#1712

Merged
OneStepAt4time merged 5 commits intodevelopfrom
fix/audit-invalid-date-abort
Apr 12, 2026
Merged

fix: audit trail invalid-date and abort-on-navigation errors#1712
OneStepAt4time merged 5 commits intodevelopfrom
fix/audit-invalid-date-abort

Conversation

@OneStepAt4time
Copy link
Copy Markdown
Owner

Summary

Two bugs found during FE UAT on develop (v0.5.1-alpha).

Bug 1 - Invalid Date in Audit Trail timestamps

Backend AuditRecord emits ts but the FE type declared timestamp. Every timestamp cell rendered as Invalid Date because record.timestamp was always undefined.

Fix: Rename AuditRecord.timestamp to ts in dashboard/src/types/index.ts and update the call site in AuditPage.tsx.

Bug 2 - Audit Trail shows error state on first navigation

When the Audit Trail page mounted, React cleanup of the previous render called AbortController.abort(), which caused fetch to throw a DOMException with name AbortError. The catch block had no guard, so it called setError('signal is aborted without reason') and showed the failure panel.

Fix: Add AbortError guard at the top of the catch block in fetchData.

Files changed

  • dashboard/src/types/index.ts - AuditRecord type fix (timestamp -> ts)
  • dashboard/src/pages/AuditPage.tsx - record.ts usage + AbortError guard
  • dashboard/src/tests/AuditPage.test.tsx - update mock records to use ts

Quality Gate

  • npm run typecheck (dashboard): PASS 0 errors
  • npx vitest run AuditPage.test.tsx: PASS 10/10
  • npx tsc --noEmit (backend): PASS 0 errors
  • npm test (backend): PASS 2802/2831 (29 skipped, pre-existing)

Aegis version

Developed with: v0.5.1-alpha

- Rename AuditRecord.timestamp -> ts to match backend field name
  (backend emits 'ts', not 'timestamp', causing 'Invalid Date' in table)
- Guard AbortError in AuditPage catch block so navigating away
  no longer shows the 'Failed to load audit logs' error state
- Update AuditPage.test.tsx mock records to use 'ts' field
- Accept empty hook bodies by normalizing undefined/null to {}
- Strip unknown top-level hook fields instead of rejecting them
- Add regression tests for empty Stop payload and unknown fields
- Update hook coverage expectations to the new strip behavior
Use a deterministic fallback key from timestamp, actor, and index so
Audit Trail rows render without duplicate-key warnings when backend
records do not include an id field.
- Add fallback key for audit rows when record.id is absent
- Normalize global SSE events with missing sessionId/data to avoid
  noisy validation warnings and keep activity stream resilient
Move the keyboard-shortcuts useEffect above conditional early returns
so SessionDetailPage always calls hooks in a stable order across
loading/notFound/loaded renders.
Copy link
Copy Markdown
Contributor

@aegis-gh-agent aegis-gh-agent bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Audit trail error fixes. CI green. Approved by Argus.

@OneStepAt4time OneStepAt4time merged commit ce348aa into develop Apr 12, 2026
10 checks passed
@OneStepAt4time OneStepAt4time deleted the fix/audit-invalid-date-abort branch April 12, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant