Skip to content

feat: LLMO-2805 Stage config addition api changes#1847

Open
jindaliiita wants to merge 11 commits intomainfrom
stage-changes
Open

feat: LLMO-2805 Stage config addition api changes#1847
jindaliiita wants to merge 11 commits intomainfrom
stage-changes

Conversation

@jindaliiita
Copy link
Contributor

@jindaliiita jindaliiita commented Feb 23, 2026

Summary

Adds support for staging domains in the LLMO edge optimizer. Customers can register staging environments (e.g. staging.lovesac.com) for production sites so edge optimization and prerender can run on stage before production.

What's Changed

New Endpoint: POST /sites/{siteId}/llmo/edge-optimize-config/stage
Registers one or more staging domains for a production LLMO site. For each domain:

  1. Apex validation - Ensures the staging domain’s apex matches the production site’s base URL (e.g. staging.lovesac.com and www.lovesac.com must share lovesac.com)
  2. Stage site management - Creates or reuses a Spacecat site for the staging domain in the same organization
  3. Tokowaka metaconfig - Creates or updates Tokowaka S3 metaconfig with prerender enabled for the whole domain (allowList: ['/*'])
  4. Config storage - Stores the staging domain → site ID mapping in the production site’s edgeOptimizeConfig (Spacecat only; Tokowaka S3 is separate)

Response: Returns stageConfigs, an array of full S3 metaconfig objects per stage site (domain, id, apiKeys, tokowakaEnabled, prerender, etc.).

Request Format:

{
  "stagingDomains": ["staging.lovesac.com", "stage1.lovesac.com"]
}

Retrieving Staging Domains
Staging domains can be read via GET /sites/{siteId} under config.edgeOptimizeConfig.stagingDomains.

Implementation Details

  • Apex validation via tldts (getDomain) so staging domains match the production base domain
  • Merge semantics — Adding new staging domains merges with existing ones; duplicates are updated
  • Existing stage sites — Reuses existing stage sites by base URL when present; only updates prerender config if metaconfig already exists

Please ensure your pull request adheres to the following guidelines:

  • make sure to link the related issues in this description. Or if there's no issue created, make sure you
    describe here the problem you're solving.
  • when merging / squashing, make sure the fixed issue references are visible in the commits, for easy compilation of release notes

If the PR is changing the API specification:

  • make sure you add a "Not implemented yet" note the endpoint description, if the implementation is not ready
    yet. Ideally, return a 501 status code with a message explaining the feature is not implemented yet.
  • make sure you add at least one example of the request and response.

If the PR is changing the API implementation or an entity exposed through the API:

  • make sure you update the API specification and the examples to reflect the changes.

If the PR is introducing a new audit type:

  • make sure you update the API specification with the type, schema of the audit result and an example

Related Issues

Thanks for contributing!

@jindaliiita
Copy link
Contributor Author

Dependent on adobe/spacecat-shared#1370

@github-actions
Copy link

This PR will trigger a minor release when merged.

@jindaliiita jindaliiita changed the title Stage changes feat: Stage config addition api changes Feb 23, 2026
@jindaliiita jindaliiita changed the title feat: Stage config addition api changes feat: LLMO-2805 Stage config addition api changes Feb 23, 2026
jindaliiita and others added 2 commits February 26, 2026 01:02
- Update createOrUpdateStageEdgeConfig to pass isStageDomain: true in metadata
- Remove prerender from options, now handled by Tokowaka client layer
- Update tests to expect isStageDomain in metadata parameter

This aligns with the spacecat-shared changes to keep staging domain logic
in the Tokowaka client layer instead of the servlet/API service layer.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@jindaliiita jindaliiita marked this pull request as ready for review February 26, 2026 15:16
@codecov
Copy link

codecov bot commented Feb 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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