Skip to content

Phase 7: 24h retention TTL + platform-admin panel for creating orgs - #21

Closed
ArneeMe wants to merge 1 commit into
claude/phase-6-public-uxfrom
claude/phase-7-retention-admin
Closed

Phase 7: 24h retention TTL + platform-admin panel for creating orgs#21
ArneeMe wants to merge 1 commit into
claude/phase-6-public-uxfrom
claude/phase-7-retention-admin

Conversation

@ArneeMe

@ArneeMe ArneeMe commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Stacked on #20 (chain: #16#17#20 → this). Retarget bases downward as parents merge.

Retention: submissions expire after 24 hours

  • A lazy sweep deletes any submission older than the TTL whenever the submissions API is touched (admin dashboard load, new public submission). No cron/scheduler needed on the edge runtime — and if nothing ever triggers the sweep, nothing is reading the data either.
  • Surfaced everywhere it matters: dashboard cards show "Slettes automatisk om X t", the volunteer confirmation screen explains that an unprocessed submission is deleted and must be resubmitted, and CLAUDE.md documents the guarantee as load-bearing.
  • TTL is one constant (SUBMISSION_TTL_HOURS in src/util/retention.ts) — change it there if 24h proves too aggressive for weekend-paced orgs. Phase 4: ops polish — optional admin notifications, robots.txt #18's email notification is what makes a short TTL comfortable in practice.

Platform-admin panel: create orgs without SQL

  • /admin lists all organizations and creates a new one with its first member attached — org row + membership in one Hasura transaction (client-generated uuid ties the two inserts).
  • Access is an env allowlist: PLATFORM_ADMIN_EMAILS (comma-separated account emails; unset = the whole surface is disabled). The check reads the caller's email from auth.users server-side — never from client input — and it's deliberately not a database role, so it can't be self-granted through any app surface.
  • Flow for a new org: person registers at /registrer → you create the org at /admin with their email → they invite colleagues via Medlemmer. Zero SQL. scripts/create-org.ts remains for CLI use.

Deploy notes

Verification

  • Typecheck, lint, 108 tests (4 new for cutoff/countdown math), production build pass; /admin smoke-rendered on the dev server.
  • Needs a live pass: create an org via /admin, confirm an old submission disappears after the sweep triggers.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BFHkXUuHJME4cF9AJWbavB


Generated by Claude Code

Retention: unprocessed submissions now expire 24 hours after creation.
A lazy sweep (delete where created_at < now - TTL) runs whenever the
submissions API is touched — no scheduler needed on the edge runtime,
and if nothing triggers it, nothing is reading the data either. The
dashboard shows 'Slettes automatisk om X t' per card, the volunteer
confirmation screen explains the expiry, and CLAUDE.md documents the
guarantee. TTL is a single constant in src/util/retention.ts.

Platform admin: /admin lets allowlisted accounts (PLATFORM_ADMIN_EMAILS
env, comma-separated — unset disables the surface) list orgs and create
a new org with its first member in one Hasura transaction (client-
generated uuid ties the two inserts together). The email check reads
auth.users server-side, never client input. scripts/create-org.ts
remains for CLI use.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BFHkXUuHJME4cF9AJWbavB
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying inf319-certificate with  Cloudflare Pages  Cloudflare Pages

Latest commit: 905f86e
Status: ✅  Deploy successful!
Preview URL: https://75dcc133.inf319-certificate.pages.dev
Branch Preview URL: https://claude-phase-7-retention-adm.inf319-certificate.pages.dev

View logs

ArneeMe commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

Superseded by the review-ordered stack #25#29 (retention TTL wiring + /admin panel landed in #29; the pure TTL math with tests in #25). Closing.


Generated by Claude Code

@ArneeMe ArneeMe closed this Jul 12, 2026
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