Skip to content

fix(audit): re-audit forces a fresh scan (noCache)#432

Merged
NiveditJain merged 8 commits into
mainfrom
luv-431
Jun 11, 2026
Merged

fix(audit): re-audit forces a fresh scan (noCache)#432
NiveditJain merged 8 commits into
mainfrom
luv-431

Conversation

@NiveditJain

@NiveditJain NiveditJain commented Jun 11, 2026

Copy link
Copy Markdown
Member

What

Makes /audit re-audit force a genuinely fresh scan instead of silently returning the cached result — the requested "delete the cache, trigger a fresh audit" behavior.

The explicit re-audit handler (startRerun, behind the bottom [ re-audit now ] button) now sends noCache: true through triggerRunparamsToBody → the /api/audit/run route (which already honored noCache). Re-audit bypasses the per-transcript cache (src/audit/cache.ts) and re-scans every transcript from scratch, rather than returning the identical cached result when nothing changed on disk.

  • The fresh result overwrites the dashboard cache on success; a failed re-audit leaves the prior cache + report intact (cache-bypass, not file deletion).
  • The empty-state first-run CTA stays on the fast cached path — it's a first scan, not a re-audit.
  • ScanParams / paramsToBody gain an optional noCache; paramsToBody is exported and covered by a new __tests__/audit/rerun-button.test.ts.

History note

This branch originally also redesigned the top-of-page re-audit bar (a "decay gauge"). While it was in review, #431 merged to main and removed that bar entirely (same "reads as broken" motivation). Per that decision, the bar redesign has been dropped from this PR — it's now scoped to just the cache-busting behavior, which is independent of the bar and applies to the surviving [ re-audit now ] button.

Verification

  • bun run test:run — full suite green, incl. the new paramsToBody noCache coverage.
  • tsc --noEmit clean, eslint 0 errors, bun run build succeeds.

Docs

  • docs/dashboard.mdx + docs/cli/audit.mdx note the noCache fresh-scan semantics. Translated mirrors flow through the existing translation job.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Improvements

    • Simplified re-audit interface by removing the top-of-page re-audit bar; re-audit option remains available via empty-state prompt and bottom button.
  • Bug Fixes

    • Re-audit now forces a fresh scan by clearing cached transcript data and re-scanning all transcripts.
    • Failed re-audits preserve the previous report instead of replacing it.
  • Documentation

    • Updated documentation to reflect new re-audit UI and clarified cache expiration behavior (7-day TTL).

NiveditJain and others added 2 commits June 10, 2026 22:52
…audit

- top-audit-bar: 24-segment freshness decay gauge (green->amber->pink across
  the 7-day TTL); removes the redundant "last audit audited 12h ago" copy and
  the separate "expires in 14h" chip
- failed state folds inline on the bar; AuditProgressStrip becomes a fixed
  scroll-echo gated to the bar's visibility (no stacked double-band, no
  run-start layout shift); ERROR_COPY shared between bar and strip
- re-audit sends noCache:true -> a genuine fresh scan instead of a silent
  cache hit; the prior report survives a failed re-audit
- button surfaces "clears cache - fresh scan"
- updated + extended top-audit-bar tests; CHANGELOG entry under 0.0.11-beta.7 (#431)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Update docs/dashboard.mdx and docs/cli/audit.mdx for the decay-gauge bar,
inline scanning/failed states, fixed scroll-echo strip, and noCache re-audit.
CHANGELOG Docs entry under 0.0.11-beta.7 (#431).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@NiveditJain, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 17 minutes and 13 seconds. Learn how PR review limits work.

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3e879a40-1ae9-4560-9cf6-8fffc3294fbb

📥 Commits

Reviewing files that changed from the base of the PR and between 60291ba and 9065ef3.

📒 Files selected for processing (3)
  • app/audit/_components/audit-dashboard.tsx
  • docs/cli/audit.mdx
  • docs/dashboard.mdx
📝 Walkthrough

Walkthrough

This PR removes the top-of-page re-audit bar from the audit dashboard, centralizes re-audit UI in the empty state, introduces a noCache flag to force cache-bypassing scans, refactors component wiring, and updates documentation and tests to reflect the new behavior.

Changes

Audit Re-Audit Simplification

Layer / File(s) Summary
Cache-bypass noCache API contract
app/audit/_components/rerun-button.tsx, __tests__/audit/rerun-button.test.ts
ScanParams gains an optional noCache boolean to signal fresh scan bypass. paramsToBody is exported and now conditionally includes noCache in the POST body when truthy. Test suite covers default omission, explicit true behavior, and interaction with cli/since parameters.
TopAuditBar removal and ShellEmpty refactoring
app/audit/_components/audit-dashboard.tsx
TopAuditBar import is removed and no longer rendered in MainReport. RerunSource type is narrowed by removing the "top_bar" variant. ShellEmptyProps and ShellEmpty are refactored to accept rerunStatus and lifecycle handlers (onDismissRerun, onStarted, onCompleted) directly, removing the previous topBar prop contract and allowing the empty state to manage its own re-audit UI.
Dashboard rerun integration with noCache
app/audit/_components/audit-dashboard.tsx
startRerun now calls triggerRun with noCache: true to force fresh scans, with added comments on cache behavior. All three empty-state render paths (first-run, empty+running, zero sessions) are updated to call the refactored ShellEmpty without topBar configuration, passing rerun handlers directly.
Documentation updates
CHANGELOG.md, docs/cli/audit.mdx, docs/dashboard.mdx
Changelog entry for 0.0.11-beta.7 documents TopAuditBar removal and noCache re-audit behavior. CLI and dashboard docs are updated to describe cache expiry fallthrough, noCache: true re-scans, and clarify failure handling and progress indicators.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Out with the bar at the top of the page,
Fresh scans via noCache—a cache-busting stage!
The empty state rises, rerun by its hand,
Simplified, tested, and carefully planned.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.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
Title check ✅ Passed The title accurately summarizes the main change: re-audit now forces a fresh scan by sending noCache, which is the core objective of this PR.
Description check ✅ Passed The description comprehensively covers what the PR does, why it was needed, and includes verification steps, though the Type of Change checklist is not explicitly marked.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@mintlify

mintlify Bot commented Jun 11, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
failproofai 🟢 Ready View Preview Jun 11, 2026, 5:54 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…sign

main merged #431, which removed the top-of-page re-audit bar entirely, so
this PR is reduced to just the cache-busting behaviour the bar redesign also
carried: the explicit re-audit handler (startRerun) now sends noCache:true
through triggerRun -> paramsToBody -> /api/audit/run, so re-audit re-scans
every transcript from scratch instead of returning the identical cached
result. The earlier decay-gauge bar redesign on this branch is dropped to
match main's removal; the empty-state first run stays on the fast cached
path. ScanParams/paramsToBody gain an optional noCache (paramsToBody exported
+ unit-tested in __tests__/audit/rerun-button.test.ts). Docs + CHANGELOG
updated (#432).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@NiveditJain NiveditJain changed the title [audit] redesign re-audit bar (decay gauge) + force fresh scan on re-audit fix(audit): re-audit forces a fresh scan (noCache) Jun 11, 2026
# Conflicts:
#	CHANGELOG.md
#	docs/cli/audit.mdx
#	docs/dashboard.mdx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/dashboard.mdx`:
- Line 71: Update the copy in docs/dashboard.mdx to hyphenate the compound
adjective: change the phrase "no full page reload" to "no full-page reload" in
the paragraph that describes the re-audit behavior (the sentence mentioning "the
fresh result swaps in place on success (no full page reload; a failed re-audit
leaves the prior report intact)").
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7898f46e-6774-41f2-8400-57ee72c471e8

📥 Commits

Reviewing files that changed from the base of the PR and between 0dd5a59 and 7c4b8cb.

📒 Files selected for processing (9)
  • CHANGELOG.md
  • __tests__/audit/rerun-button.test.ts
  • __tests__/audit/top-audit-bar.test.tsx
  • app/audit/_components/audit-dashboard.tsx
  • app/audit/_components/rerun-button.tsx
  • app/audit/_components/top-audit-bar.tsx
  • app/audit/audit-styles.css
  • docs/cli/audit.mdx
  • docs/dashboard.mdx
💤 Files with no reviewable changes (3)
  • app/audit/_components/top-audit-bar.tsx
  • tests/audit/top-audit-bar.test.tsx
  • app/audit/audit-styles.css

Comment thread docs/dashboard.mdx Outdated
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/dashboard.mdx`:
- Line 71: Update the wording that currently says the re-audit "clears the
per-transcript cache" to reflect actual behavior: change the phrase around the
`/api/audit/run` POST with `noCache: true` to say it "bypasses the
per-transcript cache" (or "bypasses cached transcript reads/writes") and
"re-scans every transcript from scratch without deleting existing cache entries"
so it accurately references the `noCache` path and its semantics.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 95156c42-b0a4-4f61-a669-2b2d86c62f32

📥 Commits

Reviewing files that changed from the base of the PR and between 7c4b8cb and 60291ba.

📒 Files selected for processing (1)
  • docs/dashboard.mdx

Comment thread docs/dashboard.mdx Outdated
NiveditJain and others added 2 commits June 10, 2026 23:52
…bbit)

noCache bypasses cached transcript reads/writes rather than deleting cache
entries — align the docs wording to the actual semantics.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@NiveditJain NiveditJain merged commit 6a410a4 into main Jun 11, 2026
13 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.

1 participant