fix(llmo-customer-analysis): create brand-presence schedule via shared drs-client helper | LLMO-5605#2737
Open
igor-grubic wants to merge 1 commit into
Conversation
…d drs-client helper | LLMO-5605 Migrate the onboarding cascade's brand-presence schedule creation from an inline fetch payload to the shared `createBrandPresenceSchedule` drs-client helper. This is the single definition of the brand-presence schedule, shared with the self-serve activate-brand endpoint (spacecat-api-service), so the two paths can't drift — DRS dedups on the provider-set, so two hand-synced payloads would silently produce duplicate schedules. Behaviour-preserving: same weekly cadence, provider set, enable_brand_presence, and immediate trigger. The legacy no-op fields (camelCase siteId, platforms array) are dropped (verified unread by DRS). Tests reworked to assert the helper call; full suite green, 100% coverage. Bumps @adobe/spacecat-shared-drs-client 1.12.1 -> 1.13.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
MysticatBot
approved these changes
Jun 26, 2026
There was a problem hiding this comment.
Hey @igor-grubic,
Verdict: Approve - clean behaviour-preserving migration to the shared drs-client helper.
Complexity: HIGH - large patch (mostly deletions); dependency bump.
Changes: Migrates brand-presence schedule creation from inline fetch logic to the shared createBrandPresenceSchedule drs-client helper, eliminating drift risk between the audit-worker and api-service paths (4 files).
Non-blocking (2): minor issues and suggestions
- suggestion: Tighten the error-message assertion in "should handle brand presence schedule creation failure" to include the DRS error text suffix (e.g.
sinon.match(/Failed to create\/trigger.*DRS API error/)) so loss of error context propagation would be caught -test/audits/llmo-customer-analysis.test.js - suggestion: Add
calledWithMatch({ siteId: 'site-123', triggerImmediately: true })to the "already existed" test for parity with other brand-presence-schedule tests -test/audits/llmo-customer-analysis.test.js
Skill: pr-review | Model: us.anthropic.claude-opus-4-6-v1[1m] | Duration: 1m 27s | Cost: $4.68 | Commit: 41c481f310102e7906ed5bee0fb3689637061be6
If this code review was useful, please react with 👍. Otherwise, react with 👎.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. Abstract
Migrates the
llmo-customer-analysisonboarding cascade's brand-presence schedule creation from an inlinefetchpayload to the sharedcreateBrandPresenceScheduledrs-client helper. Behaviour-preserving.2. Reasoning
Anti-drift. This makes the cascade use the single definition of the brand-presence schedule, shared with the self-serve activate-brand endpoint (spacecat-api-service, LLMO-5605). DRS dedups schedules on the provider-set
(site_id, brand_id, cadence, provider-set), so two hand-synced payloads in two repos would eventually drift and silently produce duplicate schedules. One helper both paths call removes that class of bug.3. High-level overview of the changes
src/llmo-customer-analysis/handler.js: brand-presence schedule creation now routes through@adobe/spacecat-shared-drs-client'screateBrandPresenceSchedule(POST + tolerate 409) instead of an inline/schedules+/triggerfetch.brightdata/google_ai_overviews/openai_web_search),enable_brand_presence, and immediate trigger.siteIdand aplatformsarray inprovider_parameters) — verified unread by DRS (the scheduler copiesprovider_parametersverbatim into the job, but brightdata consumes onlydataset_id+metadata.site).@adobe/spacecat-shared-drs-client1.12.1 → 1.13.0 (the release that adds the helper).4. Required information
5. Affected / used mysticat-workspace projects
createBrandPresenceSchedulefrom 1.13.0 — feat(drs-client): add listJobs + createBrandPresenceSchedule | LLMO-5605 spacecat-shared#1721.7. Test plan
(a) Local — tests reworked to assert the
createBrandPresenceSchedulehelper call (args + returnedscheduleId) instead of the raw/schedules+/triggerfetches.(b) Per-env (dev): run the
llmo-customer-analysisonboarding for a site → confirm exactly one weekly brand-presence schedule is created in DRS (same cadence / provider-set as before) with the immediate trigger firing; re-run → confirm idempotency (DRS 409 tolerated, no duplicate schedule).8. Deployment & merge order
Part of the LLMO-5605 Piece 2 chain. Anti-drift migration, parallel with the api-service endpoint.
Ordered sequence: drs-client 1.13.0 released (done) → this PR and the api-service endpoint each merge; both must stay on the shared helper to preserve dedup.
🤖 Generated with Claude Code