Skip to content

Commit 1f27d1a

Browse files
Finish P0.2e cluster forcedotcom#6 (part 2): photo test fix + OpenID baseline
Two test-only resolutions plus a baseline decision, all triaged against the pre-migration oracle (unmigrated ObjC at merge-base 6ed0ab4). - SFUserAccountPhotoTests.testPhotoWithoutCompletionBlock: the migration changed the assertion from the ObjC original's XCTAssertNotNil(user.photo) to XCTAssertTrue over a reference-equality poll (user.photo == testPhoto). The `photo` getter re-decodes from disk into a NEW UIImage when _photo is nil (byte-faithful to ObjC SFUserAccount.m:170-185), so ref-equality never converges and the poll times out. Restored the ObjC assertion semantics (wait for the async setPhoto to settle, then assert final state). Both photo tests pass. Test-only; production unchanged. - SalesforceOAuthUnitTests/testCredentialsCoding: already green (resolved by the cluster forcedotcom#1 init?(coder:) decode fix, deae6b0); confirmed by run. No change. - SFSDKAuthUtilTests.testOpenIDToken: baselined as pre-existing/old-refresh-flow, NOT a migration regression. A 3-way oracle comparison proved it: the same intermittent setUp auth-refresh hang (listener status stuck 'waiting' -> 30s timeout, callback never fires) reproduces in the UNMIGRATED ObjC at our merge-base 6ed0ab4, while current dev -- which carries upstream's new token refresh coordinator (PR forcedotcom#4087 / 8f597c9) ~155 commits ahead -- runs 9/9 green. So it is an old-refresh-flow defect upstream already fixed, independent of the ObjC->Swift migration. Likely refresh-token rotation. Will be superseded when the refresh-coordinator work is pulled via the port queue. Baseline entries added with rationale (anti-laundering: not migration-caused).
1 parent 280f13d commit 1f27d1a

3 files changed

Lines changed: 47 additions & 4 deletions

File tree

.claude/test-baseline-ids.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ SFSmartStoreAlterTests/testAlterSoupWithFullTextIndexesToGetIndexesOnCreatedAndL
77
SFMultipleSmartStoresTests/testGetGlobalStoreNames
88
SFSmartSqlTests/testCleanupRegexpFaster
99
SalesforceRestAPITests/testRedirect
10+
SFSDKAuthUtilTests/testOpenIDToken

.claude/test-baseline.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,22 @@ outcome depends on the org's photo-endpoint behavior/data. 61 other SalesforceRe
6363
the live org. Baselined by operator decision (investigate-deeper concluded env/org-dependent).
6464
Candidate for a CI-org-specific fixture or removal.
6565

66+
### `pre-existing/old-refresh-flow` — SFSDKAuthUtilTests.testOpenIDToken (operator-approved 2026-07-16)
67+
68+
`SFSDKAuthUtilTests.testOpenIDToken` does a live-org refresh and asserts a non-nil OpenID `id_token`
69+
(line 93). It fails intermittently (nil id_token), and the class `setUp` auth-refresh also HANGS
70+
intermittently (`SFSDKTestRequestListener` status stuck `waiting` → 30s `maxWaitTime` timeout; the
71+
refresh callback never fires — NOT a 429/`invalid_grant`, which would fire the failure callback →
72+
`didFail`). **Proven PRE-EXISTING, not a migration regression, via a 3-way oracle comparison (2026-07-16):**
73+
the identical hang reproduces in the **unmigrated ObjC at our merge-base `6ed0ab40`** (`git worktree`, same
74+
creds/org) — the exact pre-migration source our branch was converted from — while the **current-dev**
75+
oracle (which carries upstream's new *token refresh coordinator*, ~155 commits ahead: 997c4e09a / PR #4087
76+
/ 8f597c962 "Improve error handling at token refresh") runs 9/9 green in the same window. So this is an
77+
old-refresh-flow defect upstream already fixed, independent of the ObjC→Swift migration. Likely
78+
refresh-token rotation (first run w/ a fresh token succeeded; later runs hang on the stale-token response).
79+
Baselined by operator decision. Will be superseded when the refresh-coordinator work is pulled in via the
80+
upstream port queue. See memory [[premigration-oracle-clone]] for the merge-base-oracle method.
81+
6682
---
6783

6884
## ✅ RESOLVED 2026-07-14 (tracker finding P0.2b) — SmartStore setUp crash cluster
@@ -218,6 +234,29 @@ migration regressions vs. test-isolation). SDKCore gate remains **provisional**
218234
kill the 2 remaining crashes) → #1 (identity/credentials — 12, but ESCALATION-GATED, needs approval) →
219235
#3#4#6. Cluster #1 requires operator escalation approval before any credentials/OAuth code change.
220236

237+
### Cluster #6 resolution (2026-07-16) — part 1 committed, part 2 via the pre-migration oracle
238+
Part 1 (commit 280f13d39): SFPreferences global-pref, URLRequest doubled-path, SFOAuthInfo IDP casing,
239+
testCoordinator, URLRequestRestRequestTests. Part 2:
240+
- **SalesforceOAuthUnitTests/testCredentialsCoding** — already GREEN (resolved by cluster #1 decode fix
241+
deae6b04b). Confirmed by run.
242+
- **SFUserAccountPhotoTests.testPhotoWithoutCompletionBlock** — FIXED (test-only). Migration changed the
243+
assertion from ObjC `XCTAssertNotNil(user.photo)` to `XCTAssertTrue(<ref-equality poll>)`; the `photo`
244+
getter re-decodes from disk into a new UIImage (byte-faithful to ObjC .m:170-185), so ref-equality never
245+
converges. Restored ObjC assertion. Both photo tests pass. (Uncommitted at time of writing.)
246+
- **SFSDKAuthUtilTests.testOpenIDToken** + a **setUp auth-refresh HANG** — determined PRE-EXISTING, NOT a
247+
migration regression, via a 3-way oracle comparison (documented for the ratchet):
248+
* Current-dev oracle (has upstream's NEW token refresh coordinator, ~155 commits ahead): 9/9 green.
249+
* **Merge-base `6ed0ab40` UNMIGRATED ObjC** (the exact pre-migration source our branch was converted
250+
from, via `git worktree`): setUp **HANGS** identically (`'didLoad'``'waiting'`, 30s timeout,
251+
Executed 0 tests). Same failure as our migrated branch.
252+
* Our migrated Swift branch: setUp hangs identically.
253+
Since the hang reproduces in the pre-migration ObjC, it is an **old-refresh-flow defect that upstream
254+
fixed via the token refresh coordinator** (997c4e09a / PR #4087 / 8f597c962 "Improve error handling at
255+
token refresh"), NOT introduced by the migration. Likely refresh-token rotation: first run w/ a fresh
256+
token succeeded, subsequent runs hang on the stale-token response (old flow never times out cleanly).
257+
**Candidates to baseline** (env/pre-existing, like `testRedirect`) pending operator decision; must NOT
258+
be laundered as migration-caused. See [[premigration-oracle-clone]] for the merge-base-oracle method.
259+
221260
## (historical) P0.2d root-cause analysis — three independent migration artifacts
222261

223262
Distinct from the (now-fixed) credentials cluster. Root-caused 2026-07-14: **three independent

libs/SalesforceSDKCore/SalesforceSDKCoreTests/SFUserAccountPhotoTests.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,17 @@ class SFUserAccountPhotoTests: XCTestCase {
4444
func testPhotoWithoutCompletionBlock() {
4545
let user = createNewUser()
4646
user.setPhoto(nil, completion: nil)
47-
let nilCondition = waitForBlockCondition({ user.photo == nil }, timeout: 2.0)
48-
XCTAssertTrue(nilCondition)
47+
// Wait for the async setPhoto to settle, then assert final state (matches the
48+
// ObjC original, SFUserAccountPhotoTests.m). Do NOT assert the poll's bool result:
49+
// the `photo` getter re-decodes from disk into a NEW UIImage when `_photo` is nil,
50+
// so a reference-equality poll (`== testPhoto`) can never converge — a test-only
51+
// migration artifact, not a production regression (getter is faithful to .m:170-185).
52+
_ = waitForBlockCondition({ user.photo == nil }, timeout: 2.0)
4953
XCTAssertNil(user.photo)
5054

5155
let testPhoto = SFSDKResourceUtils.imageNamed("salesforce-logo")
5256
user.setPhoto(testPhoto, completion: nil)
53-
let photoCondition = waitForBlockCondition({ user.photo == testPhoto }, timeout: 2.0)
54-
XCTAssertTrue(photoCondition)
57+
_ = waitForBlockCondition({ user.photo != nil }, timeout: 2.0)
5558
XCTAssertNotNil(user.photo)
5659
}
5760

0 commit comments

Comments
 (0)