Skip to content

feat: auto-detect unreachable base URL at onboarding and persist working variant as overrideBaseURL#2580

Open
tkotthakota-adobe wants to merge 3 commits into
mainfrom
SITES-46284
Open

feat: auto-detect unreachable base URL at onboarding and persist working variant as overrideBaseURL#2580
tkotthakota-adobe wants to merge 3 commits into
mainfrom
SITES-46284

Conversation

@tkotthakota-adobe

Copy link
Copy Markdown
Contributor

https://jira.corp.adobe.com/browse/SITES-46284

Problem and Fix:

When a site like dupont.com is onboarded with an unreachable base URL, the platform had no way to detect this at registration time. Every subsequent audit would silently fail trying to reach an unreachable domain. The fix adds a reachability probe at site creation — if the registered base URL fails but the www-toggled variant responds, it automatically saves the working URL as overrideBaseURL in the site config so all future audits use the correct domain from
the start.

@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.94737% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/support/base-url-detection.js 98.88% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@MysticatBot MysticatBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @tkotthakota-adobe,

Verdict: Request changes - concurrent fire-and-forget saves create a race condition that can silently drop config mutations.
Changes: adds a reachability probe at site creation to auto-detect and persist a working www-toggled overrideBaseURL when the registered base URL is unreachable (3 files).

Must fix before merge

  1. [Important] Race condition between concurrent fire-and-forget saves - src/controllers/sites.js:406 (details inline)
Non-blocking (3): minor issues and suggestions
  • nit: isUrlReachable returns true for any HTTP response including 4xx/5xx - the intent is to detect "no listener", so this is arguably correct, but checking response.ok would avoid setting overrideBaseURL on domains that respond with parking pages or blanket 403s - src/support/rum-config-service.js:82
  • suggestion: Extract protocol from original baseURL instead of hardcoding https:// when constructing toggledURL, so the probe works correctly for sites registered with http:// - src/support/rum-config-service.js:118
  • suggestion: autoDetectOverrideBaseURL has no relationship to RUM configuration - consider moving to its own module (e.g., src/support/base-url-detection.js) for discoverability - src/support/rum-config-service.js:92

Skill: pr-review | Model: us.anthropic.claude-opus-4-6-v1[1m] | Duration: 1m 24s | Cost: $3.88 | Commit: fb8f043a3ee3af29f38c6d9982f43a21be1b28fa
If this code review was useful, please react with 👍. Otherwise, react with 👎.

Comment thread src/controllers/sites.js Outdated
@MysticatBot MysticatBot added the ai-reviewed Reviewed by AI label Jun 10, 2026
@github-actions

Copy link
Copy Markdown

This PR will trigger no release when merged.

@MysticatBot MysticatBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @tkotthakota-adobe,

Verdict: Comment - all prior findings addressed, no blocking issues remain.
Changes: adds a reachability probe at site creation to auto-detect and persist a working www-toggled overrideBaseURL when the registered base URL is unreachable (4 files).

Non-blocking (3): minor issues and suggestions
  • nit: Missing test for malformed baseURL path (the 1 line codecov flags) - a test passing e.g. 'not-a-url' as baseURL would cover the catch at line 61 trivially - src/support/base-url-detection.js:61
  • nit: Test "no-ops when baseURL returns non-ok response" asserts calledTwice but does not assert site.save was NOT called - worth adding for parity with the other no-op tests - test/support/base-url-detection.test.js:223
  • suggestion: toggledURL is constructed as ${protocol}//${toggledHostname}, dropping any path from the original baseURL - if a site is registered with a path (e.g. https://www.example.com/site), the probe tests bare domain instead - likely intentional given the domain-level nature of the check, but worth a one-line comment confirming the design choice - src/support/base-url-detection.js:76

Previously flagged, now resolved

  • Race condition between concurrent fire-and-forget saves - now chained sequentially via .then()
  • isUrlReachable accepted any HTTP response as reachable - now gates on response.ok
  • Hardcoded https:// when constructing toggled URL - now extracts protocol from original baseURL
  • Auto-detect logic co-located in rum-config-service - extracted to dedicated base-url-detection.js module

Skill: pr-review | Model: us.anthropic.claude-opus-4-6-v1[1m] | Duration: 0m 53s | Cost: $2.63 | Commit: 6ee2c66b3ec0e7b6e7d3ba62a49fbc5b69a7cc4c
If this code review was useful, please react with 👍. Otherwise, react with 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-reviewed Reviewed by AI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants