Skip to content

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
mainfrom
LLMO-5605-api-self-serve-activate-brand-endpoint-piece-2-activate-optional-prompts-schedul
Open

fix(llmo-customer-analysis): create brand-presence schedule via shared drs-client helper | LLMO-5605#2737
igor-grubic wants to merge 1 commit into
mainfrom
LLMO-5605-api-self-serve-activate-brand-endpoint-piece-2-activate-optional-prompts-schedul

Conversation

@igor-grubic

@igor-grubic igor-grubic commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

1. Abstract

Migrates the llmo-customer-analysis onboarding cascade's brand-presence schedule creation from an inline fetch payload to the shared createBrandPresenceSchedule drs-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's createBrandPresenceSchedule (POST + tolerate 409) instead of an inline /schedules + /trigger fetch.
  • Behaviour-preserving: same weekly cadence, provider set (brightdata / google_ai_overviews / openai_web_search), enable_brand_presence, and immediate trigger.
  • Legacy no-op fields dropped (a camelCase siteId and a platforms array in provider_parameters) — verified unread by DRS (the scheduler copies provider_parameters verbatim into the job, but brightdata consumes only dataset_id + metadata.site).
  • Bumps @adobe/spacecat-shared-drs-client 1.12.1 → 1.13.0 (the release that adds the helper).

4. Required information

5. Affected / used mysticat-workspace projects

7. Test plan

(a) Local — tests reworked to assert the createBrandPresenceSchedule helper call (args + returned scheduleId) instead of the raw /schedules + /trigger fetches.

(b) Per-env (dev): run the llmo-customer-analysis onboarding 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

…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

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@MysticatBot MysticatBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 👎.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants