Skip to content

feat: bf config compatibility#1945

Open
igor-grubic wants to merge 7 commits intomainfrom
bf-config-swap
Open

feat: bf config compatibility#1945
igor-grubic wants to merge 7 commits intomainfrom
bf-config-swap

Conversation

@igor-grubic
Copy link
Contributor

@igor-grubic igor-grubic commented Mar 11, 2026

Changes Made

Adds brand-level LLMO config endpoints that bridge v2 customer configs with per-site v1 LLMO configs, enabling reading and writing v1 configs scoped to a brand.

  • Add GET /v2/orgs/:spaceCatId/brands/:brandId/llmo/config endpoint that resolves brand URLs to SpaceCat sites and fetches each site's v1 LLMO config from S3
  • Add PATCH /v2/orgs/:spaceCatId/brands/:brandId/llmo/config endpoint that validates site ownership against the brand, then delegates per-site config writes to the existing v1 updateLlmoConfig pipeline
  • Extend stripMetadata in customer-config-v2-metadata.js to also strip enrichment/computed fields (brandId, brandName, category, topic, totalCategories, totalTopics, totalPrompts) so PATCH diff comparisons ignore GET-only fields
  • Add OpenAPI spec for both new endpoints in customer-config-api.yaml
  • Register routes and required capabilities (organization:read / organization:write)
  • Add comprehensive unit tests for the new controller methods and the updated stripMetadata helper

Related Issues

Relates to

Testing the PR changes

  1. Deploy to a dev environment or run locally with npm start.
  2. Ensure a v2 customer config exists for a test organization with at least one brand containing URLs that map to SpaceCat sites.
  3. Send GET /v2/orgs/{spaceCatId}/brands/{brandId}/llmo/config with valid IMS/API key credentials — verify it returns an array of { siteId, baseURL, config } objects.
  4. Confirm that brand URLs which don't resolve to a site are silently skipped and logged as warnings.
  5. Send PATCH /v2/orgs/{spaceCatId}/brands/{brandId}/llmo/config with a body like [{ "siteId": "<id>", "config": { ... } }] — verify per-site results with status: "success" and a version field.
  6. Verify PATCH rejects sites that don't belong to the organization or brand (expect status: "error" in the results array).
  7. Verify both endpoints return 403 for non-LLMO-administrator users.
  8. Run unit tests: npm test — confirm all new tests in test/controllers/brands.test.js and test/support/customer-config-v2-metadata.test.js pass.

Screenshots/Videos

No screenshots available.

Additional Notes

N/A

@codecov
Copy link

codecov bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@igor-grubic igor-grubic changed the title Bf config swap feat: bf config compatibility Mar 11, 2026
@github-actions
Copy link

This PR will trigger no release when merged.

@igor-grubic igor-grubic marked this pull request as ready for review March 12, 2026 12:03
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