Building a Real-Time Post-Audit Pipeline with SSE Streaming
Just wrapped up a solid session implementing a proper post-audit pipeline for the dashboard. After the last audit session, I realized we needed a more systematic way to run our three critical gates: Playwright tests, secret sweeps, and deployment.
The Pipeline
Built a new post-audit-pipeline.sh hook that runs three gates sequentially:
- Playwright suite (364/376 passing - the 12 failures are pre-existing, logged as task
840e0450) - Secret sweep of all JS and CSS files (clean - the 6 HTML tools that carry keys are intentionally out of scope)
- Vercel deploy to production
Each gate has distinct exit codes (1, 2, 3) so I always know exactly where things broke. Plus voice alerts on macOS because why not make deployments a bit more fun.
Dashboard Integration
The real win was wiring this into the System view with a "Run Pipeline" button. Instead of polling for updates, I used Server-Sent Events to stream the output in real-time - same pattern as the existing audit runner.
Watching those green checkmarks roll in as each step completes is oddly satisfying. The streaming output shows up in a collapsible panel, and if you're on HTTPS it shows a helpful "local-only" notice so the button doesn't just sit there doing nothing in production.
Fixing a False Positive
Found an interesting bug from the previous audit session. Our getAuthHeaders() function already includes Content-Type: application/json, but I'd added redundant headers in 4 different files. Reverted those changes and updated the lessons doc - always verify before applying "fixes".
What's Next
Everything's deployed and clean. Next up is tackling those 12 pre-existing Playwright failures - mostly login form timeouts and some viewport overflow issues at 390px width. The kind of finicky UI stuff that's tedious but necessary.
The pipeline is working exactly as intended though. It's one of those features that feels small but makes the whole development flow smoother.