Repository navigation
feat(Checkbox): forward testID to the interactive element - #17
Merged
Merged
Conversation
The onboarding legal checkboxes need stable e2e selectors, and the documented ids (tests/TEST_IDS.md) had no way to reach the Pressable that carries accessibilityRole="checkbox" and the checked state. Co-Authored-By: Claude Fable 5 <[email protected]>
thinkclay
added a commit
to Scaffald/SaaS
that referenced
this pull request
Aug 5, 2026
This branch pinned packages/sdk and packages/ui at the tips of Scaffald/sdk#12 and Scaffald/ui#17. Both were squash-merged, which creates a new commit and leaves the branch tips unreachable from their mains — so the pointers here referenced commits that no longer exist on any branch. Merging in that state would have pinned SaaS main to orphaned submodule commits. packages/sdk f96f4180 -> e4a47e5 (sdk main, #12 squashed) packages/ui 39f950d1 -> fdaa0d4 (ui main, #17 squashed) Verified the squashed commits carry what this branch needs — sdk has resources/legal.ts and prerequisites' needsLegalAcceptance, ui's Checkbox forwards testID — and that scf-core typechecks clean against them.
thinkclay
added a commit
to Scaffald/SaaS
that referenced
this pull request
Aug 5, 2026
…ce, web PKCE (#519) * fix(auth): keep the auth Stack mounted during the session check so OAuth callback tokens survive The (auth)/auth layout returned a Loading view *instead of* its <Stack> while useProtectedRoute was pending — which is always the case on first render. With the navigator unmounted during hydration, react-navigation resolved the focused route back to the group's initial route and expo-router's history sync rewrote the URL to /auth, destroying the #access_token fragment on /auth/callback ~5ms before supabase-js initialized and read the URL. Result: every web OAuth login (Google/ Apple) on prod silently bounced back to the login screen. Render the Stack unconditionally and overlay the loading state instead. Verified end-to-end against a local dev server: minted a real GoTrue session, loaded /auth/callback#access_token=... — supabase-js now issues the /auth/v1/user validation call, stores the session, and lands on /dashboard signed in. Before the fix the same URL produced zero auth requests and a silent bounce (reproduced on prod with an instrumented iframe probe). Also add the apex + www domains to the local config.toml redirect allow-list and fix its stale production comment (prod's hosted uri_allow_list already had them). Co-Authored-By: Claude Fable 5 <[email protected]> * feat(auth): versioned legal acceptance, passive login notice, layout hydration fix, web PKCE Four related auth changes. 1. Versioned legal acceptance (migration 342) core.legal_documents holds one is_current row per document type and is the single source of truth for which version users must accept. It replaces five drifting hardcoded version constants (login screen, cookie provider x2, both prerequisites routers, the document page subtitles). Publishing new terms is now an UPDATE+INSERT documented in the migration header — no code deploy. GET /v1/prerequisites/check reads it and reports which gate, if any, is unresolved: needsOnboarding (profile fields missing -> full onboarding form) or needsLegalAcceptance (profile complete, legal stale -> the new lightweight /legal-update screen). Acceptance now only counts at the current version, so a version bump forces re-acceptance; the seeded current version is 'v1.0', which every existing preferences row already carries, so nobody is re-prompted at cutover and no data migration is needed. POST /v1/prerequisites/accept-legal backs the re-acceptance screen. Both it and /complete stamp versions read from the table and write consent_records audit rows server-side, with first-class 'terms_of_service'/'privacy_policy' consent_type values (CHECK extended) instead of the previous metadata.type shoehorn. 2. Login screen: passive notice replaces the consent checkbox The checkbox was theater: a SIGNED_IN listener wrote two consent_records rows unconditionally, without consulting it, on web and native alike. That client-side write is deleted. The notice is browsewrap; the real versioned, audited clickwrap now happens in onboarding and /legal-update. Adds i18n keys in en/es/fr (the old copy was hardcoded English). 3. (protected) and (admin) layouts: same hydration bug as the OAuth callback Both rendered <Slot /> only once ready, so during web hydration the navigator was unmounted and expo-router rewrote the URL to the group's initial route — the mechanism that ate the OAuth callback hash in the previous commit, here eating deep-link paths. Both now keep the navigator mounted behind an opaque overlay, which also closes a one-frame flash of protected content before a redirect. Redirect refs became target-aware so a user can move between gates without getting stuck. 4. Web OAuth switched to PKCE flowType is pkce on web (native keeps implicit; it signs in via signInWithIdToken and never parses URLs). A pkce client rejects implicit-style #access_token callbacks AND calls _removeSession on the way out, which is what GoTrue's {{ .ConfirmationURL }} email links produce — so the email templates now link to a new flow-agnostic /auth/confirm route that verifies a token_hash. See the deploy-order constraint in client.ts: hosted templates must be updated and old links allowed to expire before a build with this flag ships. Also removes dead code: PrerequisiteWidget (rendered nowhere, validated legal fields it never rendered) and the SDK's six phantom prerequisites endpoints; fixes extensionless edge-function imports that broke `supabase functions serve` for the whole stack; and reconciles the three-way testID drift between the onboarding form, the Playwright helpers, and tests/TEST_IDS.md. Verified against a live local stack: 8 new Deno route tests cover the check/complete/accept-legal contract including the stale-version round trip and its audit rows. Manually exercised a real version publish — an onboarded user flipped to needsLegalAcceptance with needsOnboarding still false, then accept-legal restored isComplete with the new version stamped. Unit suites (scf-core 304, SDK 764, root-route 23, schemas 53) and the SDK/route contract test pass; typecheck clean. Co-Authored-By: Claude Fable 5 <[email protected]> * chore(auth): hold the web PKCE flag for a follow-up deploy The flowType flip and the /auth/confirm route were in one commit, which made every web deploy of this branch order-dependent: shipping the flag before the hosted email templates are updated (and before links issued under the old templates expire) breaks magic-link sign-in AND signs the clicking user out, because a pkce client rejects the implicit-style #access_token callback and _initialize() then calls _removeSession(). Dropping just the flag makes this branch safe to deploy in any order. The /auth/confirm token_hash lander and the template changes still ship here — they are flow-agnostic and are the prerequisite for the flag. The flip follows once templates are live and old links have expired. Co-Authored-By: Claude Fable 5 <[email protected]> * fix(legal): format effective dates in UTC effective_at is stored as midnight UTC, so formatting it in the viewer's local timezone shifted it a day backwards for anyone west of UTC: the terms page rendered "Last updated: February 2025" for a document that took effect 2025-03-01. Caught on the dev deploy. Adds a shared formatEffectiveDate() so the document pages and the re-acceptance screen cannot drift on this again. The effective date is a legal fact, not a local timestamp. Co-Authored-By: Claude Fable 5 <[email protected]> * chore(submodules): repoint at the squashed sdk/ui mains This branch pinned packages/sdk and packages/ui at the tips of Scaffald/sdk#12 and Scaffald/ui#17. Both were squash-merged, which creates a new commit and leaves the branch tips unreachable from their mains — so the pointers here referenced commits that no longer exist on any branch. Merging in that state would have pinned SaaS main to orphaned submodule commits. packages/sdk f96f4180 -> e4a47e5 (sdk main, #12 squashed) packages/ui 39f950d1 -> fdaa0d4 (ui main, #17 squashed) Verified the squashed commits carry what this branch needs — sdk has resources/legal.ts and prerequisites' needsLegalAcceptance, ui's Checkbox forwards testID — and that scf-core typechecks clean against them. * fix(work-logs): select team_id, which WorkLogRow requires `pnpm build` failed on this branch with TS2741 at work-logs.router.ts:900 — fetchWorkLog declares Promise<WorkLogRow> but WORK_LOG_SELECT never asked for team_id, so the returned row was missing a field the regenerated DB types make required. Pre-existed the submodule repoint in the previous commit; verified by checking out HEAD~1 and reproducing the same error. Blocking the push, so fixed here. * style(api): satisfy `deno fmt --check` on the prerequisites/legal routes The "Lint REST API Code" job runs `deno fmt --check`, which this branch's three new/changed files did not satisfy: routes/prerequisites.ts and the legal and prerequisites route tests. Mechanical; no behavioural change. --------- Co-authored-by: Claude Fable 5 <[email protected]>
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.
Supports Scaffald/SaaS#519.
CheckboxPropshad notestID, so there was no way to select thePressablethat carriesaccessibilityRole="checkbox"and the checked state. The onboarding legal checkboxes need stable e2e selectors — the ids documented intests/TEST_IDS.md(prereq-privacy-checkbox,prereq-terms-checkbox) previously matched nothing in any source file, which is how the Playwright specs and the docs drifted apart in three directions.Two-line change: add the optional prop, forward it to the
Pressable.🤖 Generated with Claude Code