Chore/expose requestid for cross tests#8862
Conversation
Cross-stack tests in explorer-automation need the auth URL the client opens in the system browser to drive the Playwright side of the device-pairing flow. The URL is otherwise never logged, never surfaced in the Unity scene, and only readable from the system browser via osascript (CI-hostile). This patch writes the opened URL to a known file at the same moment Application.OpenURL is called, so the Playwright orchestrator can detect the auth flow has begun and navigate its own browser to the same URL. Compile-time gated to #if ALTTESTER so shipping builds have ZERO information-leak surface. Same pattern as data-testid annotations in DCL dapp tests: an explicit test affordance owned by production code, only active in instrumented builds.
Cross-stack Playwright tests navigate to the auth URL themselves (they read auth-url.txt and drive their own Chromium). Letting Application.OpenURL also fire just pops a stale system-browser tab the test ignores — and confuses anyone watching the test run. ALTTESTER builds now only write the URL to disk; production builds retain the full system-browser open path. Compile-time gated, zero behaviour change in shipped binaries.
…l write - switch hardcoded mac-only Library/Application Support path to Application.persistentDataPath - route I/O failures through ReportHub.LogException(ReportCategory.AUTHENTICATION) instead of Debug.LogWarning - trim verbose comment block
|
Windows and Mac build successful in Unity Cloud! You can find a link to the downloadable artifact below. |
|
@claude review |
This comment has been minimized.
This comment has been minimized.
| // so cross-stack Playwright tests can drive their own browser to the same target. | ||
| try |
There was a problem hiding this comment.
Per CLAUDE.md: "Never write multi-line comment blocks — one short line max." This 2-line comment should be compressed to one line.
| // so cross-stack Playwright tests can drive their own browser to the same target. | |
| try | |
| // ALTTESTER builds write auth URL to disk and suppress the system browser so Playwright tests can drive their own browser to it. |
…re/expose-requestid-for-cross-tests
|
@claude review |
|
Claude finished @cyaiox's task in 1m 12s —— View job Code Review
Root-Cause AssessmentProblem: Cross-stack Playwright tests need the auth URL that Unity sends to the system browser to drive their own Chromium instance. Without this, the URL is unreachable from CI without fragile OS-level browser scraping. Fix: Adds a Previous Blocking Issue — Resolved ✅The multi-line comment flagged in the prior review was collapsed to a single line in commit Blocking IssuesNone. No new issues found. Notes
REVIEW_RESULT: PASS ✅ |
|
PR #8862, run #26298583791 Builds: Windows change, Windows baseline, macOS change, macOS baseline Framework 13 i7
|
Pull Request Description
What does this PR change?
Adds a small, compile-time-gated test affordance to
UnityAppWebBrowser.OpenUrl(string)so cross-stack Playwright tests inexplorer-automationcan intercept the auth-funnel URL the client would otherwise hand off to the system browser.Problem
Cross-stack tests for the device-pairing / auth flow need the URL the client opens in the system browser to drive the web side. Today:
osascript(CI-hostile, mac-only, fragile).Application.OpenURLfire under test also pops a stale tab the Playwright runner ignores, confusing anyone watching the run.Solution
Under
#if ALTTESTERonly:Path.Combine(Application.persistentDataPath, "auth-url.txt")— Playwright polls and reads it.Application.OpenURLentirely.Production builds are untouched — the entire block is stripped at compile time when
ALTTESTERisn't defined.Implementation notes
#if ALTTESTERpattern used inSceneFacade.cs,AlttesterSceneReadinessProbe.cs, andMainSceneLoader.cs.Application.persistentDataPathso the affordance works on macOS, Windows, and Linux without a hardcoded per-OS path. Matches the convention used byDCLPlayerPrefs,ChatHistoryStorage, andThirdWebLoginService.ReportHub.LogException(e, ReportCategory.AUTHENTICATION)so they participate in the project's diagnostics / Sentry pipeline (perCLAUDE.md—ReportHuboverDebug.Log*).Coordination required
The Playwright consumer (
explorer-automation/web/tests/auth/specs/client-to-web-handoff.spec.ts) must read from Unity'spersistentDataPath, which is platform-specific:~/Library/Application Support/Decentraland/Decentraland Unity Explorer/auth-url.txt%USERPROFILE%\AppData\LocalLow\Decentraland\Decentraland Unity Explorer\auth-url.txt~/.config/unity3d/Decentraland/Decentraland Unity Explorer/auth-url.txtExact folder names come from
companyName/productNameinProjectSettings.asset.Files changed
Explorer/Assets/DCL/NetworkDefinitions/Browser/UnityAppWebBrowser.cs(+21 / -1)Test Instructions
Prerequisites
ALTTESTER).explorer-automationcheckout updated to readauth-url.txtfromApplication.persistentDataPath(see Coordination required above).Test Steps
Smoke — production build (no
ALTTESTER)ALTTESTERdefine.ALTTESTER build (cross-stack test path)
ALTTESTERdefined.auth-url.txtis written underApplication.persistentDataPathcontaining the escaped URL.client-to-web-handoff.spec.tsshould pick up the URL and complete the handoff.Failure-path smoke
ALTTESTERdefined, pointApplication.persistentDataPathat a read-only location (or temporarily mark the file read-only after creation).ReportCategory.AUTHENTICATIONexception is logged viaReportHub; auth flow continues without throwing.Additional Testing Notes
#if ALTTESTERblock (includingusing System.IO;andusing DCL.Diagnostics;) is stripped from a non-ALTTESTER build — quick check viailspy/dotPeekon the produced assembly.chore/expose-requestid-for-cross-tests) is from an earlier scope; this PR does not expose a request ID. Worth renaming the PR title to match: "chore(browser): expose auth URL to disk for cross-stack tests (ALTTESTER)".Quality Checklist
Code Review Reference
Please review our Branch & PR Standards before submitting. It explains the automated review flow, QA/DEV approval requirements, and what each label does — especially useful for first-time contributors.