Skip to content

fix(auth): no sign-in error toast on storage-blocking browsers; App Store 1.0 metadata & screenshots - #163

Merged
WilliamAGH merged 8 commits into
mainfrom
dev
Aug 3, 2026
Merged

fix(auth): no sign-in error toast on storage-blocking browsers; App Store 1.0 metadata & screenshots#163
WilliamAGH merged 8 commits into
mainfrom
dev

Conversation

@WilliamAGH

@WilliamAGH WilliamAGH commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

Browsers that deny site storage (kiosk/e-ink display frames like TRMNL, or Chrome with "block all cookies") showed a persistent "Sign-in is unavailable: Clerk failed to load" error toast on every page load, even though the chat works fine unauthenticated there. The app now detects storage denial up front and quietly disables auth in those environments, exactly like a build without a publishable key. The PR also carries the complete App Store Connect 1.0 submission assets (metadata, screenshots, asc workflow).

Changes

Bug Fixes

  • Error toast on storage-denied browsers: In such browsers the window.localStorage property getter itself throws a SecurityError; @clerk/clerk-js 6.25.10 reads it unguarded during Clerk.load(), so the load rejected and the catch pushed the user-facing toast. A storage-access probe now runs before the SDK is loaded, and a denied environment returns quietly — no toast, auth controls stay hidden, and a console.info records the browser's actual SecurityError for diagnostics (clerkAuthentication.svelte.tsprobeSiteStorageAccess, loadClerkAuthentication)
  • Genuine failures still surface: bad keys or network failures during Clerk.load() keep the existing toast + rethrow path; only the cannot-ever-work environment is gated

Performance

  • No SDK download on storage-denied devices: the probe runs before the dynamic imports, so the ~700 kB Clerk chunks are never fetched on devices where sign-in is impossible (loadClerkAuthentication)

Tests

  • Regression coverage for both quiet-disable gates: storage-denied (asserts resolved promise, no toast, isLoaded stays false, SecurityError logged) and missing publishable key; the restore helper re-exposes an inherited localStorage accessor after the denial override so later suites see normal storage (clerkAuthentication.svelte.test.ts)

Documentation

  • Accurate @throws contract: loadClerkAuthentication documents only the path that actually throws — Clerk.load() rejections — since missing-key and storage-denied environments return quietly by design (clerkAuthentication.svelte.ts)

App Store release assets (chore)

  • App Store Connect 1.0 metadata: canonical app info, version metadata, release notes, and release-readiness checklist under metadata/ for the App Store submission
  • Validated screenshots + captions: final iPhone/iPad/Mac screenshot sets with per-locale captions under screenshots/ (.asc/screenshots.json, .asc/shots.settings.json configure capture/framing)
  • asc workflow: repo-local App Store Connect CLI workflow definition (.asc/workflow.json); transient asc run state and stray debug captures are now gitignored (.gitignore)

Breaking Changes

None

Related Issues

None

…rage

Kiosk and e-ink browsers that block site data make the
window.localStorage getter throw, so Clerk.load() rejected and pushed
an error toast on devices where sign-in can never work. Probe storage
access before loading and treat denial as the same deliberate disabled
state as a missing publishable key.

- probe site-storage access in clerkAuthentication before importing the SDK
- add regression tests for the storage-denied and missing-key gates
Copilot AI review requested due to automatic review settings August 3, 2026 00:47
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved authentication startup in browsers that block local storage.
    • Prevented unnecessary authentication SDK loading when browser storage is unavailable or configuration is missing.
    • Authentication failures during SDK loading continue to provide an error notification.

Walkthrough

The Clerk authentication loader now checks browser storage access before loading Clerk. It keeps authentication disabled when storage is unavailable or no publishable key exists. Tests cover both paths and verify logging, toast, state, and promise behavior.

Changes

Clerk authentication loading

Layer / File(s) Summary
Storage probe and loader guard
frontend/src/lib/composables/clerkAuthentication.svelte.ts
The loader probes localStorage, logs denied access, and returns before dynamically importing Clerk. Its documentation distinguishes deliberate disabled states from failures.
Authentication gate coverage
frontend/src/lib/composables/clerkAuthentication.svelte.test.ts
Tests cover denied storage access and missing publishable keys. They verify unchanged authentication state, no toast, informational logging, successful resolution, and isolated test state.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: copilot

Poem

Storage bars the Clerk’s bright door,
So no SDK arrives ashore.
Logs stay calm, toasts remain still,
Tests guard each quiet gate with skill.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Out of Scope Changes check ❓ Inconclusive The authentication changes match the stated objectives, but the referenced App Store assets are not shown in the raw change summary. Confirm that the App Store assets and workflow are intentionally included in this pull request's scope.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly identifies the storage-blocking browser authentication fix and related App Store submission assets.
Description check ✅ Passed The description directly explains the storage-denial fix, preserved failure behavior, tests, and release assets.
Linked Issues check ✅ Passed The description explicitly states that no related issues exist, so no issue linkage requirement is indicated.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR prevents a persistent “Clerk failed to load” sign-in error toast on browsers that deny site storage (e.g., hardened/kiosk environments) by probing storage access before loading the Clerk SDK, and treating “cannot ever work here” as a deliberate auth-disabled state (similar to builds without a publishable key).

Changes:

  • Add a site-storage access probe and gate loadClerkAuthentication() early to skip loading Clerk (and its chunks) when storage is denied.
  • Preserve existing “toast + rethrow” behavior for genuine Clerk load failures.
  • Add Vitest regression tests for the storage-denied and missing-publishable-key quiet-disable paths.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
frontend/src/lib/composables/clerkAuthentication.svelte.ts Adds a storage-access probe and early-return gate to disable auth quietly (and avoid Clerk chunk downloads) when storage is denied.
frontend/src/lib/composables/clerkAuthentication.svelte.test.ts Adds regression tests covering the new environment gates (storage denied / missing publishable key).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread frontend/src/lib/composables/clerkAuthentication.svelte.ts Outdated
Comment thread frontend/src/lib/composables/clerkAuthentication.svelte.test.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
frontend/src/lib/composables/clerkAuthentication.svelte.test.ts (1)

53-85: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert that both gates avoid Clerk module imports.

These tests verify the quiet disabled state, but they do not prove that @clerk/clerk-js, @clerk/ui, and @clerk/ui/themes were not imported. Add module mocks or import spies that fail when any Clerk module evaluates. This protects the no-SDK-download objective. Vitest supports mocking modules loaded through import(). (vitest.dev)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/lib/composables/clerkAuthentication.svelte.test.ts` around lines
53 - 85, Update both tests around loadClerkAuthentication to mock or spy on
`@clerk/clerk-js`, `@clerk/ui`, and `@clerk/ui/themes` before dynamically importing
the authentication module, with mocks that fail if any Clerk module evaluates.
Verify the storage-access-denied and missing-VITE_CLERK_PUBLISHABLE_KEY paths
complete without importing those modules while preserving their existing
quiet-state assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/src/lib/composables/clerkAuthentication.svelte.test.ts`:
- Around line 28-32: Update restoreSiteStorageAccess() to handle an undefined
originalLocalStorageDescriptor by removing the own localStorage override
installed by denySiteStorageAccess(). Keep the existing descriptor restoration
path unchanged when a descriptor was originally saved, so inherited storage is
also restored for later tests.

---

Nitpick comments:
In `@frontend/src/lib/composables/clerkAuthentication.svelte.test.ts`:
- Around line 53-85: Update both tests around loadClerkAuthentication to mock or
spy on `@clerk/clerk-js`, `@clerk/ui`, and `@clerk/ui/themes` before dynamically
importing the authentication module, with mocks that fail if any Clerk module
evaluates. Verify the storage-access-denied and
missing-VITE_CLERK_PUBLISHABLE_KEY paths complete without importing those
modules while preserving their existing quiet-state assertions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 45a62c58-4d21-48c8-b868-1678278882cb

📥 Commits

Reviewing files that changed from the base of the PR and between 896e18f and 6045c42.

📒 Files selected for processing (2)
  • frontend/src/lib/composables/clerkAuthentication.svelte.test.ts
  • frontend/src/lib/composables/clerkAuthentication.svelte.ts

Comment thread frontend/src/lib/composables/clerkAuthentication.svelte.test.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6045c4293e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread frontend/src/lib/composables/clerkAuthentication.svelte.ts
…ifacts

The App Store Connect CLI writes run-state, reports, and release
checkpoints under .asc/, and the screenshot pipeline produces raw
captures, rejected candidates, and review sheets under screenshots/.
These are reproducible working artifacts, not source.

- Ignore .asc/runs/, .asc/reports/, .asc/release/checkpoints/
- Ignore screenshots/raw/, framed-test/, rejected/, review/, asc-review/
- Keep .asc/*.json config and screenshots/final|captions tracked
Release preflight and screenshot capture were run from local, untracked
configuration, making the release process non-reproducible across
machines. asc treats .asc/workflow.json as repo-local config that
belongs in version control.

- Add .asc/workflow.json with release-assets and iOS/Mac preflight workflows
- Add .asc/screenshots.json capture plan for the iPhone welcome shot
- Add .asc/shots.settings.json pipeline settings (raw -> final framing)
The App Store listing copy for the 1.0 release existed only on App
Store Connect and in local working files, with no version-controlled
source of truth. The asc metadata workflow treats ./metadata as the
canonical local copy for validate/push/pull.

- Add app-info/en-US.json with name, subtitle, and privacy policy URL
- Add version/1.0/en-US.json with description, keywords, and URLs
- Add release-notes/1.0/en-US.md What's New copy
- Add RELEASE_READINESS.md summarizing 1.0 submission state
The final framed screenshot sets referenced by .asc/workflow.json were
untracked, so the release-assets validation workflow had no
reproducible inputs in version control.

- Add five iPhone screenshots (IPHONE_69) under screenshots/final/en-US
- Add five iPad screenshots (IPAD_PRO_3GEN_129)
- Add three Mac screenshots (DESKTOP)
- Add captions/en-US.json framing caption source
Browser-automation dogfood runs write annotated element-capture PNGs
(normal-load.png, signin-modal.png) directly into screenshots/, next to
the App Store asset directories. They are ephemeral debug evidence, on
par with the ignored tmp/ and dogfood-output/ captures.

- Ignore /screenshots/*.png (root level only; subdirectories unaffected)
…avior

A missing publishable key returns quietly (deliberate disabled state) and
never threw; only Clerk.load() rejections propagate. Document only the
real thrown path.
…ests

restoreSiteStorageAccess re-defined the saved own descriptor but left the
throwing getter installed when window.localStorage came from the prototype
chain, leaking the denial into later suites. Delete the override when no
own descriptor existed so the inherited accessor is re-exposed.
@WilliamAGH WilliamAGH changed the title fix(auth): sign-in error toast no longer appears on browsers that block site storage fix(auth): no sign-in error toast on storage-blocking browsers; App Store 1.0 metadata & screenshots Aug 3, 2026
@WilliamAGH
WilliamAGH merged commit b715f7d into main Aug 3, 2026
7 checks passed
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