Skip to content

feat(dashboard): show audit log retention - #561

Merged
SantiagoDePolonia merged 1 commit into
mainfrom
feat/audit-log-retention-info
Jul 20, 2026
Merged

feat(dashboard): show audit log retention#561
SantiagoDePolonia merged 1 commit into
mainfrom
feat/audit-log-retention-info

Conversation

@SantiagoDePolonia

@SantiagoDePolonia SantiagoDePolonia commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • expose the configured audit-log retention period through the dashboard runtime config
  • show a discreet retention note beneath the Audit Logs heading
  • describe 0 days as indefinite retention and hide invalid or unavailable values

Tests

  • make test
  • make test-dashboard
  • commit hooks: race tests, formatting, lint, and fix checks

Summary by CodeRabbit

  • New Features

    • Added a retention notice to the Audit Logs page.
    • Displays whether logs are retained indefinitely, for one day, or for multiple days.
    • Retention information now reflects the configured logging policy.
  • Bug Fixes

    • Invalid or unavailable retention settings no longer display misleading information.
  • Tests

    • Added coverage for finite, indefinite, missing, and invalid retention settings.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 46db122b-b36f-4f56-8676-c1afd6fe091b

📥 Commits

Reviewing files that changed from the base of the PR and between 503cdae and 2a39d8b.

📒 Files selected for processing (11)
  • internal/admin/dashboard/static/css/dashboard.css
  • internal/admin/dashboard/static/js/modules/audit-list.js
  • internal/admin/dashboard/static/js/modules/audit-list.test.cjs
  • internal/admin/dashboard/static/js/modules/dashboard-layout.test.cjs
  • internal/admin/dashboard/static/js/modules/workflows.js
  • internal/admin/dashboard/static/js/modules/workflows.test.cjs
  • internal/admin/dashboard/templates/page-audit-logs.html
  • internal/admin/handler.go
  • internal/admin/handler_test.go
  • internal/app/app.go
  • internal/app/app_test.go

📝 Walkthrough

Walkthrough

The dashboard runtime configuration now exposes logging retention days from application settings. The audit logs page formats valid retention values and conditionally displays a styled retention notice, with backend and frontend tests covering configured, indefinite, and invalid values.

Changes

Audit retention visibility

Layer / File(s) Summary
Runtime retention contract
internal/app/app.go, internal/app/app_test.go, internal/admin/handler.go, internal/admin/handler_test.go
Application logging retention is added to the dashboard response, normalized by the admin handler, and covered by configured and indefinite-retention tests.
Frontend runtime parsing and formatting
internal/admin/dashboard/static/js/modules/workflows.js, internal/admin/dashboard/static/js/modules/workflows.test.cjs, internal/admin/dashboard/static/js/modules/audit-list.js, internal/admin/dashboard/static/js/modules/audit-list.test.cjs
The runtime config allowlist accepts LOGGING_RETENTION_DAYS, and auditRetentionText() formats valid values while returning an empty string for invalid values.
Audit page retention notice
internal/admin/dashboard/templates/page-audit-logs.html, internal/admin/dashboard/static/css/dashboard.css, internal/admin/dashboard/static/js/modules/dashboard-layout.test.cjs
The audit logs header renders the retention notice with dedicated styling, and layout tests verify its content and CSS.
Estimated code review effort: 3 (Moderate) ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AppConfig
  participant AdminRuntimeConfig
  participant WorkflowRuntimeConfig
  participant AuditList
  participant AuditPage
  AppConfig->>AdminRuntimeConfig: expose LOGGING_RETENTION_DAYS
  AdminRuntimeConfig-->>WorkflowRuntimeConfig: return normalized value
  WorkflowRuntimeConfig->>AuditList: provide retention configuration
  AuditList->>AuditPage: render auditRetentionText()
  AuditPage-->>AuditPage: show retention note when text is non-empty
Loading

Possibly related PRs

Poem

A bunny reads the audit trail,
“Thirty days!” it hops with glee.
One day, many days, or none—
The note now tells what logs can be.
Soft gray words beneath the title,
Clear as carrots in the sun.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the main change: showing audit log retention in the dashboard.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/audit-log-retention-info

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/app/app.go 60.00% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@greptile-apps

greptile-apps Bot commented Jul 20, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

Safe to merge with minimal risk.

The change is small and keeps the backend and frontend runtime-config contract in sync. Tests cover finite, invalid, and indefinite retention display behavior. No correctness or security issues were found in the changed paths.

No files require special attention.

T-Rex T-Rex Logs

What T-Rex did

  • Checked the Audit Logs UI before retention was enabled to confirm the heading area did not display the retention note.
  • Executed the dashboard audit retention tests and confirmed all tests passed (138 tests, exit code 0).
  • Checked the Audit Logs UI after retention was enabled to confirm the retention note is visible and the configured-value states are exercised.

View all artifacts

T-Rex Ran code and verified through T-Rex

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant App as app.dashboardRuntimeConfig
participant Admin as /admin/runtime/config
participant UI as Dashboard runtime config loader
participant Audit as Audit Logs page

App->>Admin: Populate LOGGING_RETENTION_DAYS from cfg.Logging.RetentionDays
UI->>Admin: GET /admin/runtime/config
Admin-->>UI: Allowlisted runtime config
UI->>UI: Copy LOGGING_RETENTION_DAYS into workflowRuntimeConfig
Audit->>UI: auditRetentionText()
UI-->>Audit: Formatted retention note or empty string
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant App as app.dashboardRuntimeConfig
participant Admin as /admin/runtime/config
participant UI as Dashboard runtime config loader
participant Audit as Audit Logs page

App->>Admin: Populate LOGGING_RETENTION_DAYS from cfg.Logging.RetentionDays
UI->>Admin: GET /admin/runtime/config
Admin-->>UI: Allowlisted runtime config
UI->>UI: Copy LOGGING_RETENTION_DAYS into workflowRuntimeConfig
Audit->>UI: auditRetentionText()
UI-->>Audit: Formatted retention note or empty string
Loading

Reviews (1): Last reviewed commit: "feat(dashboard): show audit log retentio..." | Re-trigger Greptile

@SantiagoDePolonia
SantiagoDePolonia merged commit bfdeef8 into main Jul 20, 2026
21 checks passed
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.

2 participants