feat: add live re-audit workflow with pricing change detection - #1
Open
eshwarrao123 wants to merge 7 commits into
Open
feat: add live re-audit workflow with pricing change detection#1eshwarrao123 wants to merge 7 commits into
eshwarrao123 wants to merge 7 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
This PR adds a complete live re-audit workflow to StackAudit. Audits are now persisted with pricing snapshots, monitored for pricing drift, and automatically re-evaluated when tool pricing changes. Affected users receive a consolidated email notification with a one-click re-audit link that opens a visual diff between the old and updated audit.
The feature turns StackAudit from a one-time calculator into a continuously updated audit system.
Why
AI tooling pricing changes frequently, especially across products like Cursor, Claude, ChatGPT, and Copilot. A static audit becomes stale quickly and can produce outdated recommendations or inaccurate savings estimates.
This feature assumes users care less about a snapshot score and more about staying continuously optimized as the tooling market evolves.
How it works
Persistent Storage
Each generated audit now stores:
These are persisted in Supabase and linked to the public report URL.
Pricing Change Detection
A deterministic backend engine compares historic pricing snapshots against the current pricing source of truth.
When pricing changes:
Notification Flow
Affected audits are grouped by user email.
One consolidated email per user is sent through Resend containing:
Re-Audit Diff View
The
/re-audit/[id]route dynamically compares:The UI highlights:
What I cut
/api/detect-changes) because it was faster to verify end-to-end reliably during development.How to test it manually
lib/pricing/current-pricing.tsPOST /api/detect-changesWhat's tested
Automated tests included:
All tests pass successfully along with:
npm run lintnpm testnpx tsc --noEmitOpen questions / risks