feat: add markOpportunitiesReviewed endpoint to LlmoController | LLMO-3058#1828
Open
feat: add markOpportunitiesReviewed endpoint to LlmoController | LLMO-3058#1828
Conversation
- Implemented a new endpoint to mark opportunities as reviewed, which adds a specific tag to the site configuration. - Updated the LlmoController to include the new method and handle potential errors, including access restrictions and database issues. - Added unit tests to verify the functionality of the new endpoint, ensuring it correctly handles tagging and error scenarios.
- Introduced a new endpoint to mark LLMO opportunities as reviewed, which adds an `opportunitiesReviewed` tag to the site's configuration. - Updated the OpenAPI specifications in both `api.yaml` and `llmo-api.yaml` to include the new endpoint and its details. - Ensured the endpoint is idempotent, allowing multiple calls without creating duplicate tags.
|
This PR will trigger a minor release when merged. |
ekremney
added a commit
that referenced
this pull request
Feb 18, 2026
Re-apply the v2/v3 data access runtime switch (reverted in #1828) with fixes for the cross-package instanceof failures that caused the production outage. Changes: - Upgrade spacecat-shared-data-access to v3, keep v2 as npm alias - Add runtime switch middleware (DATA_SERVICE_PROVIDER env var) - Replace instanceof ValidationError with error.name check - Replace instanceof Site/Organization/Project with entityName check - Update all affected tests to use entityName mock pattern Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5 tasks
ekremney
added a commit
that referenced
this pull request
Feb 19, 2026
## Summary - Re-applies the v2/v3 data access runtime switch (reverted in #1828) with fixes for the cross-package `instanceof` failures that caused the production outage - Replaces `instanceof ValidationError` with `error.name === 'ValidationError'` checks in controllers (fixes, opportunities, suggestions) - Replaces `instanceof Site/Organization/Project` with `entity.entityName` checks in access-control-util - Updates all affected tests to use `entityName` mock pattern instead of `Object.setPrototypeOf` ## Root Cause When v3 is installed as the main package and v2 as an npm alias, `instanceof` checks against v3 classes fail for v2-created instances (different constructors from different packages). The fix uses duck-typing via `entityName` property and `error.name` string checks, both of which are stable across v2/v3. ## Test plan - [x] All 3547 unit tests passing - [x] 100% code coverage maintained - [x] ESLint passes - [ ] Deploy to stage and verify with non-admin user - [ ] Verify `DATA_SERVICE_PROVIDER=postgres` switches to v3 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
- Added a stub for `addLlmoTag` in the mock configuration. - Modified the test case for marking opportunities reviewed to return an empty array when no tags are present. - Updated the test to ensure that the `addLlmoTag` method is called correctly when marking opportunities as reviewed. - Enhanced the test to return existing tags after marking reviewed, ensuring no duplication of the 'opportunitiesReviewed' tag.
- Introduced a new route handler for the PUT request to `/sites/:siteId/llmo/opportunities-reviewed`. - Updated the mock controller to include the `markOpportunitiesReviewed` method. - Enhanced tests to validate the new route and ensure correct handler assignment and parameter extraction.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Please ensure your pull request adheres to the following guidelines:
describe here the problem you're solving.
If the PR is changing the API specification:
yet. Ideally, return a 501 status code with a message explaining the feature is not implemented yet.
If the PR is changing the API implementation or an entity exposed through the API:
If the PR is introducing a new audit type:
Related Issues
LLMO-3058