Skip to content

fix: llmo mysticat apis allow passing multiple topicIds#1982

Merged
vivesing merged 2 commits intomainfrom
feat/llmo-postgres-apis-v2-part4
Mar 18, 2026
Merged

fix: llmo mysticat apis allow passing multiple topicIds#1982
vivesing merged 2 commits intomainfrom
feat/llmo-postgres-apis-v2-part4

Conversation

@vivesing
Copy link
Contributor

PR Summary: Brand Presence Filter Dimensions – Topic Parameter and Tests

Changes

API

  • Parameter rename: topic_idstopicIds in the filter-dimensions API
  • Topic filter still supports single UUID, comma-separated UUIDs, or array
  • Non-UUID values are ignored; filtering uses topic_id IN (...) in PostgREST

Documentation

  • Updated docs/llmo-brandalf-apis/filter-dimensions-api.md for the new parameter name and sample URLs

Tests

  • Switched all filter-dimensions tests from topic_ids to topicIds
  • Corrected snake_case params test to expect .in() instead of .eq() for topic filter
  • New: Topic label fallback when topics is null → uses topic_id as label
  • New: No topic filter when topicIds is a non-string, non-array value that fails UUID validation (e.g. number)

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

Thanks for contributing!

@codecov
Copy link

codecov bot commented Mar 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@JayKid
Copy link
Contributor

JayKid commented Mar 18, 2026

Major (3)

1. Breaking API change: old parameter aliases silently removed (High confidence)

topicId, topic_id, topic, topics are no longer accepted — only topicIds. Existing consumers will silently lose topic filtering.
File: src/controllers/llmo/llmo-brand-presence.js (parseFilterDimensionsParams)
Fix: Support old params during a transition period, or document as breaking change.

2. NULL topic_id rows excluded (High confidence)

Filter changed from .eq('topics', value) to .in('topic_id', uuids). Rows with NULL topic_id will be missed.
File: src/controllers/llmo/llmo-brand-presence.js (buildExecutionsQuery)
Fix: Confirm topic_id is backfilled before deploying.

3. Missing test for mixed valid/invalid UUIDs (High confidence)

Only all-valid and all-invalid inputs are tested. No test for 'valid-uuid,invalid,valid-uuid'.
File: test/controllers/llmo/llmo-brand-presence.test.js
Fix: Add mixed-input test asserting only valid UUIDs reach .in().

Minor (4)

  • No upper limit/chunking for topicIds (risk of large IN clauses)
  • Test name "accepts snake_case params" is misleading after topic param rename
  • Empty/whitespace topicIds input not tested
  • No logging when all topicIds values are filtered out

Question

  • Is topic_id fully backfilled in production? The correctness of the new filter depends on it.

✅ What's working well

  • parseTopicIds handles array, CSV, and single UUID cleanly
  • Strict UUID validation prevents non-UUID input from reaching DB
  • Good test coverage: 6 topic-related test cases
  • Docs, code, and tests are consistent

Recommendation: Approve with reservations (0 Critical, 3 Major)

@vivesing vivesing merged commit dcbc2f1 into main Mar 18, 2026
18 checks passed
@vivesing vivesing deleted the feat/llmo-postgres-apis-v2-part4 branch March 18, 2026 13:10
solaris007 pushed a commit that referenced this pull request Mar 18, 2026
## [1.353.1](v1.353.0...v1.353.1) (2026-03-18)

### Bug Fixes

* llmo mysticat apis allow passing multiple topicIds ([#1982](#1982)) ([dcbc2f1](dcbc2f1))
@solaris007
Copy link
Member

🎉 This PR is included in version 1.353.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants