refactor(sse): retag the Adobe Firefly IMS token-check union - #8638
Merged
diegosouzapw merged 1 commit intoJul 27, 2026
Merged
diegosouzapw merged 1 commit into
diegosouzapw merged 1 commit into
Conversation
This was referenced Jul 26, 2026
All 6 diagnostics in adobeFireflyClient.ts are one cause — the `strictNullChecks: false` limitation this campaign has hit repeatedly (diegosouzapw#8483, diegosouzapw#8499, diegosouzapw#8531): a boolean-literal discriminant narrows the positive branch but leaves the negative one as the full union, so the `else` after `if (authed.ok)` could not see `status` or `error`. imsCheckToken(): { ok: true; token; data } | { ok: false; status; error } -> { state: "ok"; … } | { state: "failed"; … } Retagged rather than fixed with a predicate: `imsCheckToken` is module-private (no export, no test reference), which is the rule recorded on diegosouzapw#8499 — predicates exist to avoid churning an exported shape, and there is none here. 208 -> 202, zero new, on a line-number-agnostic diff of the full tsc error set. Kept the union inline in the return position instead of extracting a named type: adobeFireflyClient.ts is frozen at 2317 lines with no headroom, and extracting it (plus a doc comment) pushed the file to 2325 and failed check:file-size. The diff is 7 lines changed, 0 added; the reasoning lives here. No test added, and no gap to fill. "cookie exchange rejects guest IMS tokens" already drives both arms in one flow: `guest_allowed=false` returns HTTP 400, taking the failed arm and reading `status`/`error` (its assertion depends on the "All session cookies are empty" text), then `guest_allowed=true` returns 200 and takes the ok arm. 50/50 across the three Adobe Firefly suites; the same suites pass on the parent commit, confirming the retag changes nothing observable.
backryun
force-pushed
the
chore/ts7-types-adobe-firefly-token
branch
from
July 26, 2026 20:53
f30bebf to
5d3abfa
Compare
Owner
|
Validated in local merge-train /tmp/train1d-20260727-090022-suite.log on .113 @ 029cdf4215cf465f0e1716ac9f84a84692b1e881 (full unit suite green on CI-equivalent host) |
Merged
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.
Part of #8484. Type-only. 7 lines changed, 0 added. Clears
adobeFireflyClient.ts— all 6 of its diagnostics, one cause.Same root cause, fourth time
open-ssecompiles withstrictNullChecks: false, where a boolean-literal discriminant narrows the positive branch but leaves the negative one as the full union. So this:cannot see
status/errorin theelse. Same shape as #8483, #8499 and #8531.Retag, per the recorded rule
imsCheckTokenis module-private — noexport, no test reference — so this retags the discriminant rather than adding a type predicate. That is the rule written down on #8499: a predicate exists to avoid churning an exported shape and the assertions that depend on it, and there is no exported shape here.plus the three
returns and the twoifs. Seven lines, all replacements.Kept inline on purpose
My first pass extracted a named
ImsTokenChecktype with a doc comment explaining the narrowing. That took the file from 2317 to 2325 and failedcheck:file-size— this file is frozen with zero headroom.So the union stays inline in the return position, which is line-for-line identical to what was there. Same lesson as #8557 on
stream.ts: on a frozen file the explanation belongs in the commit message, not in the source.Verification
208 → 202, zero new errors, on a line-number-agnostic diff of the full
tscerror set.npm run typecheck:core— cleaneslint— cleancheck:file-size— OK (file unchanged in length)No test added — the arms were already covered
Checking each arm of the retagged union is now standard for these slices, and here it comes back clean.
cookie exchange rejects guest IMS tokensdrives both arms in a single flow:guest_allowed=false"All session cookies are empty"state: "failed"— readsstatusanderrorguest_allowed=truestate: "ok"— readstoken,dataThat test's assertion depends on the
errortext matching/session cookies are empty/i, which is one of the four reads that failed to typecheck — so the failed arm is not merely reachable, it is load-bearing in an existing assertion.The same three suites pass on the parent commit, which is the evidence that the retag changes nothing observable.
Scope note
open-sse/serviceshas 27 diagnostics left after this, but they do not share a cause — 13 files, at most 6 apiece, and the other 6-error file (browserBackedChat.ts) is six unrelated problems rather than one. Those slice individually. Tracked in #8484.