Skip to content

feat: config sync worker endpoint | LLMO-3918#2048

Merged
calvarezg merged 23 commits intomainfrom
feat/LLMO-3918-config-sync
Mar 31, 2026
Merged

feat: config sync worker endpoint | LLMO-3918#2048
calvarezg merged 23 commits intomainfrom
feat/LLMO-3918-config-sync

Conversation

@calvarezg
Copy link
Copy Markdown
Contributor

Description

Adds SQS-based triggering of the S3-to-Postgres config sync after every config save, plus an on-demand HTTP endpoint to manually trigger it.

SQS trigger on config save

After a successful updateLlmoConfig S3 write, an llmo-config-db-sync SQS message is dispatched to the audit jobs queue — gated by a hardcoded ALLOWED_SITE_IDS constant (placeholder UUIDs — must be replaced before deploy).

On-demand sync endpoint

POST /v2/orgs/:spaceCatId/sync-config?siteId=<uuid> — validates the organization, site ownership, user access, and site gating before enqueuing the same SQS message.

Changes

  • Modified: src/controllers/llmo/llmo.js — added ALLOWED_SITE_IDS constant, isSyncEnabledForSite helper, and SQS dispatch after S3 write in updateLlmoConfig
  • Modified: src/controllers/brands.js — added ALLOWED_SITE_IDS constant, isSyncEnabledForSite helper, and triggerConfigSync handler
  • Modified: src/routes/index.js — registered POST /v2/orgs/:spaceCatId/sync-config
  • Modified: test/controllers/llmo/llmo.test.js — tests for SQS dispatch gating
  • Modified: test/controllers/brands.test.js — tests for triggerConfigSync endpoint (13 scenarios)

Related Issues

LLMO-3918

  • 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

@calvarezg calvarezg changed the title config sync worker process feat: config sync worker endpoint | LLMO-3918 Mar 26, 2026
@calvarezg calvarezg marked this pull request as draft March 26, 2026 22:37
@calvarezg calvarezg self-assigned this Mar 26, 2026
@calvarezg calvarezg added the enhancement New feature or request label Mar 26, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 26, 2026

This PR will trigger a patch release when merged.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@calvarezg calvarezg marked this pull request as ready for review March 30, 2026 18:23
Comment thread src/controllers/brands.js Outdated

// Temporary: hardcoded site IDs for which the S3-to-DB config sync is enabled.
// TODO: replace with actual site UUIDs per environment.
const ALLOWED_SITE_IDS = [
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should we keep both allowed sites at a single place and can be imported here.

Comment thread src/controllers/brands.js Outdated

const isDryRun = dryRun === 'true';
await context.sqs.sendMessage(context.env.AUDIT_JOBS_QUEUE_URL, {
type: 'llmo-config-db-sync',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should we create a const for the topic name to be used everywhere from a single place?

Comment thread src/routes/required-capabilities.js Outdated
'PATCH /v2/orgs/:spaceCatId/brands/:brandId/prompts/:promptId': 'organization:write',
'DELETE /v2/orgs/:spaceCatId/brands/:brandId/prompts/:promptId': 'organization:write',
'POST /v2/orgs/:spaceCatId/brands/:brandId/prompts/delete': 'organization:write',
'POST /v2/orgs/:spaceCatId/sync-config': 'organization:write',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since these configs are site scoped I think we need to include siteId in the api path something like:
/v2/orgs/:spaceCatId/sites/:siteId/sync-config

- Changed the endpoint for triggering config sync to include siteId in the URL.
- Removed hardcoded site IDs and moved the sync check logic to a new constants file.
- Updated logging to use a constant for the sync type.
- Adjusted tests to reflect the new parameter structure and ensure proper validation for siteId.
@calvarezg calvarezg merged commit 32d5a5e into main Mar 31, 2026
20 checks passed
@calvarezg calvarezg deleted the feat/LLMO-3918-config-sync branch March 31, 2026 19:08
solaris007 pushed a commit that referenced this pull request Mar 31, 2026
# [1.391.0](v1.390.2...v1.391.0) (2026-03-31)

### Features

* config sync worker endpoint | LLMO-3918 ([#2048](#2048)) ([32d5a5e](32d5a5e))
@solaris007
Copy link
Copy Markdown
Member

🎉 This PR is included in version 1.391.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

ravverma pushed a commit that referenced this pull request Apr 6, 2026
## Description

Adds SQS-based triggering of the S3-to-Postgres config sync after every
config save, plus an on-demand HTTP endpoint to manually trigger it.

### SQS trigger on config save
After a successful `updateLlmoConfig` S3 write, an `llmo-config-db-sync`
SQS message is dispatched to the audit jobs queue — gated by a hardcoded
`ALLOWED_SITE_IDS` constant (placeholder UUIDs — must be replaced before
deploy).

### On-demand sync endpoint
`POST /v2/orgs/:spaceCatId/sync-config?siteId=<uuid>` — validates the
organization, site ownership, user access, and site gating before
enqueuing the same SQS message.

### Changes

- **Modified**: `src/controllers/llmo/llmo.js` — added
`ALLOWED_SITE_IDS` constant, `isSyncEnabledForSite` helper, and SQS
dispatch after S3 write in `updateLlmoConfig`
- **Modified**: `src/controllers/brands.js` — added `ALLOWED_SITE_IDS`
constant, `isSyncEnabledForSite` helper, and `triggerConfigSync` handler
- **Modified**: `src/routes/index.js` — registered `POST
/v2/orgs/:spaceCatId/sync-config`
- **Modified**: `test/controllers/llmo/llmo.test.js` — tests for SQS
dispatch gating
- **Modified**: `test/controllers/brands.test.js` — tests for
`triggerConfigSync` endpoint (13 scenarios)

## Related Issues

[LLMO-3918](https://jira.corp.adobe.com/browse/LLMO-3918)

- [ ] 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
ravverma pushed a commit that referenced this pull request Apr 6, 2026
# [1.391.0](v1.390.2...v1.391.0) (2026-03-31)

### Features

* config sync worker endpoint | LLMO-3918 ([#2048](#2048)) ([32d5a5e](32d5a5e))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants