Skip to content

Commit 4edef75

Browse files
committed
devlog: record the as-landed WP2 design and its test split
1 parent eae9fb4 commit 4edef75

1 file changed

Lines changed: 32 additions & 23 deletions

File tree

‎devlog/_plan/260825_oauth_login_ux/010_wp2_shared_login_hint.md‎

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ gates its browser-open on that exact field:
123123
if (authUrl && !deviceCode) { openUrl(authUrl); }
124124
```
125125

126-
Today Kimi sets no `deviceCode`, so the proxy auto-opens
127-
`device.verificationUriComplete` — a **provider-supplied** URL. Setting
128-
`deviceCode` means Kimi stops being auto-opened, exactly like Nous and
129-
Copilot already are.
126+
Before this change Kimi set no `deviceCode`, so the proxy auto-opened
127+
`device.verificationUriComplete` — a **provider-supplied** URL. Setting the
128+
field means Kimi stops being auto-opened, exactly like Nous and Copilot
129+
already are.
130130

131131
That is the correct direction on both counts. It ends an inconsistency where
132132
two device providers are treated as device flows and the third is not, and it
@@ -164,28 +164,37 @@ no hint at all. That is WP3's whole subject (`020`), not an omission here.
164164

165165
## i18n
166166

167-
`prov.deviceCode` exists. New keys, added to **all** locale files under
168-
`gui/src/i18n/` (en, ko, ja, zh, zh-TW, de, fr, ru, tr):
169-
170-
- `prov.deviceCodeHint` — "Enter this code after opening the link."
171-
172-
English is the source; a locale that has no translation yet falls back through
173-
the existing mechanism rather than shipping an English string in a translated
174-
file.
167+
**No new keys were needed.** `prov.deviceCode`, `prov.copyCode`,
168+
`prov.codeCopied`, `prov.pasteRedirect`, `prov.pasteRedirectHint`,
169+
`prov.pasteSubmit`, and `prov.pasteSubmitting` already exist in all nine
170+
locale files, because both halves of this component already shipped — just on
171+
different surfaces. Unifying them is a wiring change, not a copy change, so no
172+
locale is left with an untranslated English string.
175173

176174
## Test
177175

178-
`tests/oauth-login-hint.test.ts` (new):
179-
180-
1. `loginKimi` calls `onAuth` with `deviceCode` equal to the user code —
181-
fake the device-authorization fetch, assert the field. This is the one
182-
assertion that would have caught the original gap.
183-
2. Re-assert the same for `loginNous` and `loginGithubCopilot` so the
184-
contract is enforced for every device provider, not just the one being
185-
fixed.
186-
3. Route-level: with `deviceCode` present, `POST /api/oauth/login` does not
187-
call the opener; with a browser flow it does. This locks the consequence
188-
described above so it can never regress silently in either direction.
176+
Two new files, split by what they lock:
177+
178+
`tests/oauth-device-code-contract.test.ts` — `loginKimi` calls `onAuth`
179+
with `deviceCode` equal to the user code, against a faked
180+
device-authorization response. This is the assertion that would have caught
181+
the original gap. It was driven red against the pre-fix `kimi.ts` before
182+
being accepted, so it is not vacuous. `loginNous` and
183+
`loginGithubCopilot` already have equivalent `onAuth` assertions in
184+
`tests/nous-oauth.test.ts` and `tests/github-copilot-oauth.test.ts`, so
185+
re-asserting them here would duplicate rather than protect.
186+
187+
`tests/oauth-login-open-browser.test.ts` — the route consequence, both
188+
directions: with `deviceCode` present, `POST /api/oauth/login` does not call
189+
the opener and still returns the URL and code; with a plain browser flow it
190+
opens exactly as before. The second case is the compatibility guard.
191+
192+
Two existing seam tests were **updated, not relaxed**:
193+
`tests/provider-workspace-auth.test.ts` still demands a device-code widget,
194+
now pointed at its new owner, and gains an assertion that the workspace can
195+
reach `/api/oauth/login/code`; `tests/codex-auth-modal-status.test.ts` still
196+
locks the same four-part submit guard and the distinct submitting copy, now as
197+
props rather than a JSX string.
189198

190199
GUI rendering is verified by screenshot in the PR; this repo has no component
191200
test harness and this phase is not the place to introduce one.

0 commit comments

Comments
 (0)