feat: trigger DRS prompt generation during LLMO onboarding#1781
Merged
feat: trigger DRS prompt generation during LLMO onboarding#1781
Conversation
…O-2655, LLMO-2656) - Add DRS webhook receiver endpoint (/hooks/drs/:hookSecret/prompt-generation) - Validates JOB_COMPLETED events from DRS - Queues llmo-prompt-import messages for async processing - Returns 202 Accepted on success - Add DRS client for submitting prompt generation jobs - Integrates with LLMO onboarding flow - Submits jobs with webhook callback URL for completion notifications - Non-blocking - onboarding continues if DRS submission fails - Add OpenAPI specs and comprehensive tests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add DRS webhook route to route test expectations - Add processDrsPromptGenerationHook to mock hooks controller - Add createMockDrsClient helper function - Add mockDrsClient option to createCommonEsmockDependencies - Add test for DRS client not configured scenario - Add test for DRS job submission failure scenario - Update existing onboarding test to include DRS mock This improves test coverage for the DRS integration code in llmo-onboarding.js (lines 1054-1074). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
This PR will trigger a minor release when merged. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Change DRS webhook authentication from path-based secret to API key header authentication for better security and consistency with DRS APIs. Changes: - Replace hookAuth with apiKeyAuth for DRS webhook endpoint - Route changed from /hooks/drs/:hookSecret/... to /hooks/drs/... - DRS client now sends webhook_api_key in payload for DRS to use - Update tests for new authentication pattern Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update DRS client tests to use DRS_CALLBACK_API_KEY instead of DRS_WEBHOOK_SECRET - Update webhook URL expectation to static path (no :hookSecret param) - Add assertion for webhook_api_key in request body - Update routes test to reflect static route change Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add test case to cover the fallback branch when context.pathInfo.headers is undefined, achieving 100% branch coverage. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Move DRS prompt generation job submission to after all critical onboarding steps (site.save, audit triggers) so webhook callbacks won't arrive for a partially configured site - Fix OpenAPI docs to match implementation: DRS webhook uses x-api-key header auth, not hookSecret in URL path Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolve conflict in test/routes/index.test.js by keeping both new routes (DRS webhook hook and trial-users email preferences). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Reuse existing USER_API_KEY instead of introducing a separate DRS_CALLBACK_API_KEY secret. No new env vars needed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove custom apiKeyAuth wrapper from the DRS webhook endpoint. Authentication is now handled by the standard authWrapper middleware (JWT, IMS, API Keys) like all other endpoints. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
740a18d to
bf46ebb
Compare
Fetch target_audience from the site's brand profile when submitting DRS prompt generation jobs. Falls back to a default audience string if the brand profile is not yet available. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add getBrandProfile mock to onboarding test to cover both branches: brand profile available (uses target_audience) and brand profile unavailable (uses default audience fallback). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
alinarublea
approved these changes
Feb 20, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove llmo-customer-analysis from immediate audit triggering during onboarding. It will now be triggered after the DRS prompt generation job completes via SNS notification. Add source: 'onboarding' to DRS job submission and move metadata into parameters for notification flow. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
alinarublea
approved these changes
Feb 26, 2026
dzehnder
added a commit
that referenced
this pull request
Feb 27, 2026
… deploy-dev label The squash merge of #1781 removed llmo-customer-analysis from triggerAudits (now handled by DRS), but the existing test still asserted it was triggered via SQS. This caused a cascading failure of 69 tests because the failed assertion prevented restoreSetTimeout() from executing. Also reverts the deploy-dev label from 'dzehnder' back to 'latest'. Made-with: Cursor
1 task
dzehnder
added a commit
that referenced
this pull request
Feb 27, 2026
… deploy-dev label (#1876) ## Summary - Removes the stale test assertion that expected `llmo-customer-analysis` to be triggered via SQS `sendMessage`. PR #1781 moved this trigger to DRS, but the existing test (added by another PR while #1781 was in development) was preserved during the squash merge, causing the first test failure. That failure prevented `restoreSetTimeout()` from running, which cascaded into **69 total test failures**. - Reverts the `deploy-dev` script label from `-l dzehnder` back to `-l latest` (accidentally merged from development). ## Test plan - [x] Full test suite passes locally (3575 passing, 0 failing, 100% coverage) Made with [Cursor](https://cursor.com)
solaris007
pushed a commit
that referenced
this pull request
Feb 27, 2026
# [1.325.0](v1.324.2...v1.325.0) (2026-02-27) ### Bug Fixes * remove stale llmo-customer-analysis trigger assertion and revert deploy-dev label ([#1876](#1876)) ([2921e30](2921e30)), closes [#1781](#1781) [#1781](#1781) ### Features * trigger DRS prompt generation during LLMO onboarding ([#1781](#1781)) ([7ebc38f](7ebc38f))
Member
|
🎉 This PR is included in version 1.325.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Summary
Adds a DRS client to trigger prompt generation jobs during LLMO onboarding (LLMO-2656) and defers
llmo-customer-analysisto DRS completion (LLMO-1819).DRS Client (
src/support/drs-client.js): HTTP client for submitting prompt generation jobs to DRSprompt_generation_base_urlsource: 'onboarding'Onboarding Integration (
src/controllers/llmo/llmo-onboarding.js): Calls DRS after all critical onboarding steps complete (org/site creation, entitlement, SharePoint, audits). No longer triggersllmo-customer-analysisdirectly — that is now triggered by the audit-worker when DRS completes.Full flow
Environment Variables Required
Related PRs
sourcefield + presigned URL in notificationsTest plan
🤖 Generated with Claude Code