fix(playtest): stop promising a password the portal cannot set #248

Merged
sionzee merged 1 commit from fix/playtest-disconnect-guard into main 2026-08-21 22:45:27 +02:00
Owner

Disconnecting your last connected provider was refused with "This is your only way to sign in - set an account password or email first". Neither half of that advice is actionable:

  • the portal has no email/password login and no way to set a password, so that branch of the guard can only ever be satisfied by a legacy account carried over from the main site;
  • an email on its own was never a sign-in method here (the guard wants password && email), so a player who already has one is told to add the thing they already have.

What changed

signInMethods() is now one function, read by both the account payload and the disconnect guard, so what the screen offers and what the server allows cannot drift apart.

  • playtest.account.get returns canDisconnect per connection. The portal greys the button out with the reason instead of letting the player find the rule by hitting an error.
  • The error message now says the only thing that actually works: connect another account first.
  • No change to who may disconnect what - same rule, one implementation.

Tests

New src/contract/playtest/account.spec.ts covers the last-method refusal, the flag the screen reads, a disconnect while another provider remains, and email+password counting as a way back in (with email alone not counting). bun test src/contract/playtest/account.spec.ts -> 4 pass, bunx tsgo --noEmit clean.

Portal side is a companion PR on playtest.evobug.com (fix/account-connections-and-signed-in-state): it consumes canDisconnect and adds a "Switch" action for relinking a connection to a different provider account.

🤖 Generated with Claude Code

https://claude.ai/code/session_01E5AqBX91uuBcqPk325zsMM

Disconnecting your last connected provider was refused with **"This is your only way to sign in - set an account password or email first"**. Neither half of that advice is actionable: - the portal has no email/password login and no way to set a password, so that branch of the guard can only ever be satisfied by a legacy account carried over from the main site; - an email on its own was never a sign-in method here (the guard wants `password && email`), so a player who already has one is told to add the thing they already have. ## What changed `signInMethods()` is now one function, read by both the account payload and the disconnect guard, so what the screen offers and what the server allows cannot drift apart. - `playtest.account.get` returns `canDisconnect` per connection. The portal greys the button out with the reason instead of letting the player find the rule by hitting an error. - The error message now says the only thing that actually works: connect another account first. - No change to who may disconnect what - same rule, one implementation. ## Tests New `src/contract/playtest/account.spec.ts` covers the last-method refusal, the flag the screen reads, a disconnect while another provider remains, and email+password counting as a way back in (with email alone not counting). `bun test src/contract/playtest/account.spec.ts` -> 4 pass, `bunx tsgo --noEmit` clean. Portal side is a companion PR on `playtest.evobug.com` (`fix/account-connections-and-signed-in-state`): it consumes `canDisconnect` and adds a "Switch" action for relinking a connection to a different provider account. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01E5AqBX91uuBcqPk325zsMM
fix(playtest): stop promising a password the portal cannot set
Some checks failed
OpenCodeReview / review (deepseek) (pull_request) Failing after 5s
Tests / test (pull_request) Successful in 1m47s
OpenCodeReview / review (luna) (pull_request) Failing after 10m4s
2e142d8309
Disconnecting your last provider was refused with "set an account password
or email first". Neither is possible: the portal has no password login and
no way to set one, and an email on its own has never been a sign-in method
(the password is looked up by it). A player who signed in with the wrong
Discord account was told to do something that does not exist.

The rule is now one function, read both by the account payload and by the
guard, so the screen can grey the button out with the reason instead of
letting the player discover it by hitting an error.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01E5AqBX91uuBcqPk325zsMM
sionzee deleted branch fix/playtest-disconnect-guard 2026-08-21 22:45:27 +02:00
Sign in to join this conversation.
No description provided.