Skip to content

Spike/base site approach a - #21853

Draft
sp94sap wants to merge 3 commits into
developfrom
spike/base-site-approach-a
Draft

Spike/base site approach a#21853
sp94sap wants to merge 3 commits into
developfrom
spike/base-site-approach-a

Conversation

@sp94sap

@sp94sap sp94sap commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

No description provided.

sp94sap added 2 commits August 6, 2026 15:52
Resolve SSR baseSiteId in plain Node, no Angular. Cacheless by design:
every resolve() fetches OCC base sites fresh and matches the request URL
against each site's urlPatterns, falling back to the app-configured
default (context.baseSite[0]) on no match. No cache because SSR runs as
multiple instances that die/restart independently, so a per-process cache
would drift between nodes and yield inconsistent results across the fleet;
the OCC call is cheap, so consistency beats the saved call.

Reliability (spec factor #1 - never hang/DoS the SSR process):
- concurrency cap (default 10) sheds load fast, throwing
  ConcurrencyLimitError before touching OCC;
- AbortController timeout (default 3000ms) throws OccUnavailableError.

Framework provides createBaseSiteRequestHandler(): it resolves the
baseSiteId from a trust-proxy-aware request URL and maps both typed
errors to 503 + Retry-After. The app wires only the route and a render
callback; the framework carries no HTTP or site knowledge.
- use protected instead of private for resolver fields and methods
- rename misleading _config constructor param to config
- apply contentType to the 503 error response in the request handler
- drop stale "switch approaches" note from the resolver contract
@sp94sap
sp94sap requested a review from a team as a code owner August 7, 2026 11:53
@github-actions
github-actions Bot marked this pull request as draft August 7, 2026 11:54
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🚨 PR Title Validation Failed 🚨

Your pull request title does not follow the required format. Please update it to match the expected pattern:

Expected format:
<type>: <subject>

Allowed Types

  • docs: Changes to documentation only
  • feat: New feature work
  • fix: Bug fixes
  • perf: Code improvements for performance
  • refactor: Code changes that are not bug fixes or features
  • style: Code style changes (e.g., whitespace, formatting)
  • test: Adding or updating tests
  • chore: Build, CI, scripts, configs, etc.

Example of a valid PR title

feat: Add user authentication
fix: Resolve checkout bug
docs: Update API documentation

Merge is blocked until the PR title is corrected.

CX_BASE_URL is not a Node runtime env var on CCv2; read OCC base URL
from build-time environment.occBaseUrl first, then occ-backend-base-url
meta tag in browser/index.csr.html (substituted by the deploy script).

Missing URL degrades gracefully — warning logged, AI-SEO handlers
disabled, core SSR unaffected (previously crashed on startup).

Resolver gains 60 s TTL cache with initPromise dedup to avoid
thundering-herd on cache miss; concurrency cap guards the miss path.
@github-actions

Copy link
Copy Markdown
Contributor

🚨 PR Title Validation Failed 🚨

Your pull request title does not follow the required format. Please update it to match the expected pattern:

Expected format:
<type>: <subject>

Allowed Types

  • docs: Changes to documentation only
  • feat: New feature work
  • fix: Bug fixes
  • perf: Code improvements for performance
  • refactor: Code changes that are not bug fixes or features
  • style: Code style changes (e.g., whitespace, formatting)
  • test: Adding or updating tests
  • chore: Build, CI, scripts, configs, etc.

Example of a valid PR title

feat: Add user authentication
fix: Resolve checkout bug
docs: Update API documentation

Merge is blocked until the PR title is corrected.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

for all these files, since the concern is base-site and not site-context at large, I recommend the next directory to be renamed to base-site instead of site-context

Comment on lines +67 to +68
err instanceof ConcurrencyLimitError ||
err instanceof OccUnavailableError

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

minor comment: since this is a spike

We are defaulting to 5 second retry for both concurrency limit error and occ unavailable.
I don't they they should share the retry value.

for ConcurrencyLimitError, I would suggest 2-3 seconds
for OccUnavailableError, I would suggest 20-30 seconds

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants