Skip to content

feat: add markOpportunitiesReviewed endpoint to LlmoController | LLMO-3058#1828

Open
calvarezg wants to merge 11 commits intomainfrom
feat-LLMO-3058-toggle-tag
Open

feat: add markOpportunitiesReviewed endpoint to LlmoController | LLMO-3058#1828
calvarezg wants to merge 11 commits intomainfrom
feat-LLMO-3058-toggle-tag

Conversation

@calvarezg
Copy link
Contributor

@calvarezg calvarezg commented Feb 18, 2026

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

Please ensure your pull request adheres to the following guidelines:

  • 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

Related Issues

LLMO-3058

- 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.
@calvarezg calvarezg self-assigned this Feb 18, 2026
@calvarezg calvarezg marked this pull request as draft February 18, 2026 16:33
@calvarezg calvarezg changed the title feat: add markOpportunitiesReviewed endpoint to LlmoController feat: add markOpportunitiesReviewed endpoint to LlmoController | LLMO-3058 Feb 18, 2026
- 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.
@github-actions
Copy link

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>
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>
solaris007 pushed a commit that referenced this pull request Feb 19, 2026
## [1.320.4](v1.320.3...v1.320.4) (2026-02-19)

### Bug Fixes

* v2/v3 data access runtime switch with instanceof fixes ([#1831](#1831)) ([5181b92](5181b92)), closes [#1828](#1828)
- 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.
@calvarezg calvarezg marked this pull request as ready for review February 25, 2026 12:34
@codecov
Copy link

codecov bot commented Feb 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant