Repository navigation
Guest demo: sample data, purge cron, guest UI and docs (3/3) - #16
Merged
Merged
Conversation
DELETE /api/account's S3-then-DB erasure moves to src/lib/erase-team.ts unchanged (it now also deletes the guest_sessions row) so the guest purge cannot drift from it. The cron (Bearer CRON_SECRET, 20 per call) erases expired guest sessions and guest_ teams over 24 h old without a live session, skips teams with a run in flight, never touches non-guest ids, and keeps bedrock_usage so the all-guests daily AI cap stays correct.
POST /api/sample-data creates a pipeline on a fixed demo template (seeded idempotently in 003, not public) and writes the bundled CSV to the raw bucket server-side, so the normal profiler path runs and suggest-transforms takes the template branch: $0 Bedrock. It counts as an upload and a pipeline for guests (capped inserts) and removes the empty pipeline when over the cap. Only s3:PutObject is needed, which uploads already require. The integration test runs it through the real profiler and executor to a pinned clean file, then purges the expired guest.
Landing and sign-in pages get a "Try as guest" button that renders only when guest access is on, with a Turnstile widget when the site key is set (CSP then allows challenges.cloudflare.com in script-src and frame-src). The Nav shows a banner with the time left, "Sign up to keep your work" and "End session", and hides Templates; the chat builder tab, auto-clean and training export are hidden for guests. The dashboard gets "Try with sample data" and explains a blocked-feature redirect. GET /api/guest no longer reports a stale guest cookie for a signed-in user. Upload form and landing page show the real per-file limit.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Oct 2, 2026
This branch was successfully deployed
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.
Stack: 3 of 3. This PR's base is
feature/guest-limits(#15), which is stacked on #14. Merge #14, then #15, then this one, retargeting each tomainas the one below it merges.What
src/lib/erase-team.ts. The S3-then-DB erasure fromDELETE /api/accountmoved here unchanged; it now also deletes theguest_sessionsrow. The account route is now a thin wrapper.GET /api/cron/purge-guests(BearerCRON_SECRET):guest_teams older than 24 h with no live session.bedrock_usageso the all-guests daily AI cap stays correct.ON CONFLICT DO NOTHING, no semicolons inside statements).POST /api/sample-datacreates a pipeline on that template and does a server-sidePutObjectof the bundled CSV, so the profiler runs normally and suggest-transforms takes the template path. Bedrock cost is $0.https://challenges.cloudflare.comto script-src and frame-src only whenNEXT_PUBLIC_TURNSTILE_SITE_KEYis set at build time.vercel.jsonis unchanged) and the S3 lifecycle backstop. CONTRIBUTING covers the erasure rule.Verified (locally)
tsc, lint (0 errors), vitest: 235 passed.guest-demo.test.tsruns sample data → real profiler → template rules with 0bedrock_usagerows → approve → real executor → a pinned clean file. The purge then erases every S3 version and the rows, keepsbedrock_usage, and leaves a live guest and a user untouched./dashboardredirects to sign-in.