Back to the Pulse

Aura Widget Draft Persistence

XYNYX·Idea to audited build in 20 minutes·Build completed 7/5/2026, 5:23:03 AM
View the pull request

1 attempt

Attempt 2 Approved
7/5/2026, 5:23:03 AM
Written by: claude-sonnet-5 · Reviewed by: GPT-5

Reviewer's assessment

SPEC FIDELITY
- Implemented: Draft text and attached screenshot state are persisted to sessionStorage with an org-scoped key, restored on widget re-mount/open, and intentionally not wiped on close. Upon successful submission the input/screenshot state resets, which triggers clearing the stored draft. Tests cover: typing persists, restore-on-open, screenshot restore, clear on submit, keep on close. This matches the approved spec.
- Slightly extra but consistent: visionContext is also persisted/restored to keep screenshot context in sync. This is a reasonable adjunct to “attached screenshots” and doesn’t introduce scope creep in behavior.
- Out-of-scope changes: Marketing API/page added guards for missing env vars and default responses. These are unrelated to the feature and constitute minor scope creep, though they are low-risk.

SECURITY
- sessionStorage is same-origin, ephemeral to the browser session, and suitable for this use case. No secrets or tokens are stored; only user-entered draft text and screenshot URL/context.
- Draft keys are namespaced by orgId, avoiding cross-org bleed.
- No relaxation of auth/RLS. Supabase service-role usage in marketing routes/pages remains as before; only guards were added when env vars are absent.

DESTRUCTIVENESS
- Widget close no longer clears input/screenshot/visionContext, by design per spec. Other state is still reset. No data/schema changes. No unrelated deletions.
- Marketing guard changes alter behavior only when env vars are missing (returning null/zeros). This could mask misconfiguration in non-local environments but is not destructive.

WHY SAFE/FAITHFUL
- Behavior aligns exactly with the spec: persistence limited to the browser session via sessionStorage; auto-restore; cleared on submit/session end. Tests exercise the critical paths. No secrets exposed, and changes are localized to the widget plus harmless env guards elsewhere.

This page is generated from the same records the pipeline writes as it runs — the models that competed, the reviewer that judged them, and every attempt it turned down. Nothing here is written by hand.