refactor: drop the --optimized-assets-url debug arg - #9923
Conversation
decentraland-bot
left a comment
There was a problem hiding this comment.
Review — refactor: drop the --optimized-assets-url debug arg (top commit only)
Reviewing commit
762de69as requested by the PR description ("review only the top commit").
STEP 2 — Root-cause check: ✅ PASS
The --optimized-assets-url CLI/deeplink argument was a debug escape hatch for pointing the AB/LOD/registry endpoints at an arbitrary server. With the embedded abgen sidecar now being the sole source of optimized-assets URL overrides, this external arg has no remaining consumers. The diff removes the dead code path entirely — this is the correct action, not a symptom workaround.
STEP 3 — Design & integration: ✅ PASS
No new long-lived units are introduced. This is pure removal + rename.
Gate condition simplification verified: MainSceneLoader.InitializeFlowAsync previously checked string.IsNullOrEmpty(cliOptimizedAssetsUrl) as part of the sidecar-start gate. That variable came from applicationParametersParser.TryGetValue(AppArgsFlags.OPTIMIZED_ASSETS_URL, ...), so an external CLI arg could prevent the sidecar from starting. Now localAbBaseUrl is initialized to null on line 328 and only set by abgenSidecar.BaseUrl on line 340 — the IsNullOrEmpty check is structurally unnecessary because nothing else can seed it before the gate runs. Correct removal.
Resolution precedence unchanged: ResolveOptimizedAssetsUrl still follows override → feature-flag variant → dedicated host. Only the field name feeding the override slot changed (optimizedAssetsBaseOverride → localAbBaseOverride).
Rename completeness verified: rg over the full tree confirms zero remaining references to OPTIMIZED_ASSETS_URL, optimized-assets-url, cliOptimizedAssetsUrl, or optimizedAssetsBaseOverride in any .cs or .md file. The rename is complete.
STEP 4 — Member audit: ✅ PASS
No new public properties or accessors. The parameter rename propagates consistently through:
MainSceneLoader.InitializeFlowAsync→ local variablelocalAbBaseUrlGatewayUrlsSourceconstructor → parameterlocalAbBaseUrl→ forwarded to baseDecentralandUrlsSourceconstructor → parameterlocalAbBaseUrl→ stored as fieldlocalAbBaseOverrideDecentralandUrlsSource.ResolveOptimizedAssetsUrl→ readslocalAbBaseOverride
All consumers consistent. No orphaned references.
STEP 5 — Line-level review: ✅ No issues
All changes are mechanical rename + removal. No bugs, no missing error handling, no resource leaks, no performance regressions, no security vulnerabilities introduced.
Security review: ✅ PASS — Security improvement
This commit is a net security improvement. The --optimized-assets-url deeplink parameter (SEC-052 class) could redirect AB/LOD/registry endpoints at attacker-controlled infrastructure for the entire session. The attack surface is now eliminated entirely rather than merely defended by the allowlist. The only remaining path to override the optimized-assets URL is:
- The embedded abgen sidecar (internal, gated on LSD +
--local-ab, setslocalAbBaseUrlprogrammatically) - The
optimized-assetsfeature flag (server-controlled, not user-injectable)
Neither is reachable via deeplink or CLI injection.
STEP 8 — Non-blocking warnings: None
Main.unity is not in the changed files.
REVIEW_RESULT: PASS ✅
COMPLEXITY: SIMPLE
COMPLEXITY_REASON: Removes one CLI flag constant and renames the shared plumbing across URL resolution and MainSceneLoader; no logic, ECS, or async changes.
QA_REQUIRED: YES
Reviewed by Jarvis 🤖 · Requested by decentraland-bot via GitHub
|
PR #9923, run #33425569114 Overall: ✅ no significant changes Builds: Windows change, Windows baseline, macOS change, macOS baseline How to read this table
Intel Core i5
Exception breakdown
Apple M1
|
The abgen sidecar's base URL is now the only optimized-assets override, so the CLI/deeplink escape hatch is gone: the flag, its deeplink description, its never-permitted assertion and the allowlist doc mentions are removed, and the plumbing it shared with the sidecar (cliOptimizedAssetsUrl / optimizedAssetsBaseOverride) is renamed to localAbBaseUrl / localAbBaseOverride to match its single remaining source. Resolution precedence is unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…source Names RealmUrls.StartingRealmAsync and the branches being mirrored so drift is checkable, per the review note on #9831. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
94615c0 to
007781b
Compare
decentraland-bot
left a comment
There was a problem hiding this comment.
PR Review: refactor: drop the --optimized-assets-url debug arg
STEP 2 — Root-cause check: ✅ PASS
The problem is dead code: the --optimized-assets-url CLI/deeplink argument is no longer used now that the embedded abgen sidecar seeds the override itself. This PR removes the dead code at its root — the flag constant, its CLI read, its deeplink description, its test assertion, and all doc references — rather than leaving orphaned code behind.
STEP 3 — Design & integration: ✅ PASS
No new long-lived units are introduced. This is a pure removal and rename. The existing lifecycle is unchanged:
MainSceneLoaderstill owns the sidecar bootstrap lifecycle (construct →StartAsync→ set override URL → pass toGatewayUrlsSource).DecentralandUrlsSourcestill resolves the optimized-assets URL via the same precedence chain (override → feature-flag variant → dedicated host).GatewayUrlsSourcestill passes the parameter through to its base class.
Behavioral change analysis: Removing the string.IsNullOrEmpty(cliOptimizedAssetsUrl) guard from MainSceneLoader.cs:330 is correct. Before, the sidecar would not start if a CLI URL was provided. Now, since the CLI flag constant (OPTIMIZED_ASSETS_URL) is deleted, the parser can never produce a value for it — the guard would always pass. Removing the dead branch is the right call.
Constructor parameter chain: The rename cliOptimizedAssetsUrl → localAbBaseUrl is consistent across all three layers (MainSceneLoader → GatewayUrlsSource → DecentralandUrlsSource). The field name localAbBaseOverride follows the existing convention (gatekeeperBaseOverride).
Teardown / consumption trace: No new subscriptions, callbacks, connections, or disposables introduced.
STEP 4 — Member audit: ✅ PASS
No new public properties or accessors added. The only changes are parameter renames, which are consistent across the full call chain.
STEP 5 — Line-level review: ✅ No blocking issues
All 13 changed files reviewed. No remaining references to the old names (OPTIMIZED_ASSETS_URL, optimized-assets-url, cliOptimizedAssetsUrl, optimizedAssetsBaseOverride) found anywhere in the codebase via ripgrep.
[P2] ResolveOptimizedAssetsUrl method name (DecentralandUrlsSource.cs:212): The method name still says "OptimizedAssetsUrl", which echoes the removed CLI argument's name. However, this is the concept (the URL for optimized assets — AB CDN, LOD CDN, registry), not the CLI arg. The xmldoc (line 209) was already updated to reference the sidecar. The name remains semantically accurate. Optional follow-up rename to e.g. ResolveAssetBundleBaseUrl would improve clarity but is not required by this PR.
[P2] CacheBehaviour.FeatureFlagsDependent for local override (DecentralandUrlsSource.cs:215): When localAbBaseOverride is set, the method returns FeatureFlagsDependent, meaning the URL is re-resolved on every call until feature flags load. For a static localhost URL this is semantically wrong (it won't change when flags load), but functionally harmless — and it serves a secondary purpose: GatewayUrlsSource (line ~148) uses this cache behavior to skip gateway rewriting, which is correct for a localhost sidecar. This is a pre-existing design issue, unchanged by this PR.
Security review: ✅ No issues found
- The SEC-052-class attack surface (arbitrary infrastructure pointing via deeplink) is eliminated, not just defended.
- The
DeepLinkAllowlistdeny-by-default mechanism already drops any unknown parameter, so the removed test assertion foroptimized-assets-urlis redundant with the flag's removal — there is nothing left to test. - The override URL (
localAbBaseOverride) can now only originate fromabgenSidecar.BaseUrlinside theMainSceneLoadersidecar bootstrap path, guarded byLaunchMode.LocalSceneDevelopment && useLocalAssetBundles. No CLI/deeplink injection path remains. - The feature-flag string
"optimized-assets"inFeatureFlagsStrings.csis a server-side feature flag (controls the AB pipeline fleet-wide), not the removed CLI argument — correctly retained.
STEP 6 — Complexity: SIMPLE
Pure removal/rename across 13 files. No ECS systems, components, async patterns, or complex logic changed.
STEP 7 — QA assessment: YES
Changes runtime code (MainSceneLoader.cs, DecentralandUrlsSource.cs) that affects asset bundle URL resolution in local scene development mode.
STEP 8 — Non-blocking warnings
None. No Main scene modified.
STEP 9 — Verdict
REVIEW_RESULT: PASS ✅
COMPLEXITY: SIMPLE
COMPLEXITY_REASON: Pure removal of a dead CLI argument and consistent rename of internal plumbing — no systems, components, or async flows changed.
QA_REQUIRED: YES
Reviewed by Jarvis 🤖 · Requested by Juan Ignacio Molteni [Dalkia] (<@U03JSUQ5Z7U>) via Slack
Pull Request Description
What does this PR change?
Removes the
--optimized-assets-urlCLI/deeplink argument. It was a debug utility for pointing the AB/LOD/registry endpoints at an arbitrary server; with the embedded abgen sidecar (base PR) seeding that override itself, the escape hatch has no remaining use.MainSceneLoaderread, its deeplink description, its never-permitted deeplink-test assertion and the allowlist doc mentions are gone — the SEC-052-class attack surface no longer exists rather than being defended.cliOptimizedAssetsUrl→localAbBaseUrl,optimizedAssetsBaseOverride→localAbBaseOverride.ResolveOptimizedAssetsUrl's precedence (override → feature-flag variant → dedicated host) is unchanged.MainSceneLoaderloses itsIsNullOrEmpty(cliOptimizedAssetsUrl)clause — the sidecar no longer yields to anything.abgen-sidecar.md,how-to-connect-to-a-local-scene.md) and stale comments/tooltips updated.Stacked on #9831 (the serial-sidecar refactor) — review only the top commit.
Test Instructions
Steps (standard run):
metaforge explorer run XXXX # ← replace with this PR numberExpected result:
Client boots and loads scenes normally; asset bundles resolve from the production CDN (no behavior change outside LSD).
Prerequisites
npm run start(or Creator Hub)Test Steps
--optimized-assets-url=https://example.com— the arg is ignored (unknown parameter); AB endpoints are unaffected.AppArgsTestsandDecentralandUrlsSourceShouldpass (the sidecar-override test now useslocalAbBaseUrl).Additional Testing Notes
optimized-assets-urlas an unknown param now that it is not a known flag; the never-permitted regression assertion was removed with the flag.Quality Checklist
🤖 Generated with Claude Code