Skip to content

Fix link-outcome redirect query key mismatch with users-web - #69

Merged
paulyhedral merged 1 commit into
developfrom
fix/link-outcome-query-key
Oct 5, 2026
Merged

paulyhedral merged 1 commit into
developfrom
fix/link-outcome-query-key

Conversation

@paulyhedral

Copy link
Copy Markdown
Contributor

Summary

linkErrorRedirect sent ?link_error=<reason> on failure, and the success path redirected
bare with no outcome param at all. users-web's SettingsController only ever reads
req.query[String.self, at: "link"], and settings.leaf only recognizes linkOutcome == "conflict"/"error"/"success" - so neither path ever produced a banner on the settings
page.

Confirmed on dev: a real conflicting-account link attempt correctly failed server-side
(?link_error=conflict in the URL) but showed nothing to the user at all - no error message,
no indication anything happened.

Fix

  • Failure redirects now use ?link=<outcome>, mapping every LinkErrorReason except
    .conflict to the generic "error" outcome - users-web never surfaces the specific
    denied/expired/unavailable distinction, only "conflict" has its own banner copy.
  • Success now redirects with ?link=success.

No existing test exercised linkCallback's redirect at all, which is how this shipped
unnoticed. Added a regression test for the earliest error branch (Auth0 returning ?error=),
reproducible without mocking Auth0's HTTPS token endpoint - the existing linkComplete
fake-server tests deliberately avoid that for the same reason (see their own comment).

Part of closing out sweetrpg/platform#70.

Test plan

  • swift build - clean
  • swift test (full suite, 26/26) - pass
  • swift format lint --recursive --strict Sources Tests - clean
  • Verify on dev after merge: a real conflict attempt shows the conflict banner; a
    successful link shows the success banner

…contract

linkErrorRedirect sent ?link_error=<reason> on failure and a bare redirect
with no outcome param at all on success. users-web's SettingsController
only ever reads req.query[String.self, at: "link"] and settings.leaf only
recognizes linkOutcome == "conflict"/"error"/"success" - so neither path
ever produced a banner. Confirmed on dev: a real conflicting-account link
attempt correctly failed server-side (?link_error=conflict in the URL) but
showed no error to the user at all.

Maps every LinkErrorReason except .conflict to the generic "error" outcome
- users-web never surfaces the denied/expired/unavailable distinction
itself, only "conflict" has its own banner copy. Success now redirects
with ?link=success.

No existing test exercised linkCallback's redirect at all, which is how
this shipped unnoticed. Added a regression test for the earliest error
branch (Auth0 returning ?error=) - reproducible without mocking Auth0's
HTTPS token endpoint, which the existing linkComplete fake-server tests
deliberately avoid for the same reason (see their own comment).
@paulyhedral paulyhedral added the bug Something isn't working label Oct 5, 2026
@paulyhedral paulyhedral self-assigned this Oct 5, 2026
@paulyhedral paulyhedral added the bug Something isn't working label Oct 5, 2026
@paulyhedral
paulyhedral merged commit 26b2b25 into develop Oct 5, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant