Skip to content

Add job_ids filter param to GET /api/assets#13848

Closed
mattmillerai wants to merge 5 commits into
masterfrom
cursor/add-job-ids-filter-to-get-assets-4731
Closed

Add job_ids filter param to GET /api/assets#13848
mattmillerai wants to merge 5 commits into
masterfrom
cursor/add-job-ids-filter-to-get-assets-4731

Conversation

@mattmillerai
Copy link
Copy Markdown
Contributor

@mattmillerai mattmillerai commented May 12, 2026

Summary

Adds job_ids filter support to GET /api/assets on the Python local server, matching the existing behavior in the Go cloud ingest service. This enables frontend consumers to drill down into assets associated with specific jobs.

Changes

openapi.yaml

  • Removed [cloud-only] marker and x-runtime: [cloud] from the job_ids parameter, making it available on the local server.

app/assets/api/schemas_in.py

  • Added job_ids: list[str] field to ListAssetsQuery with a _split_csv_job_ids validator that accepts both comma-separated strings and repeated query params (matching the include_tags/exclude_tags pattern).

app/assets/api/routes.py

  • Passes q.job_ids through from the route handler to list_assets_page.

app/assets/services/asset_management.py

  • Added job_ids parameter to list_assets_page and forwards it to list_references_page.

app/assets/database/queries/asset_reference.py

  • Added job_ids parameter to list_references_page.
  • Applies WHERE asset_references.job_id IN (...) filter on both the data query and the count query when job_ids is non-empty.

tests-unit/assets_test/queries/test_asset_info.py

  • Added 6 unit tests covering: single job_id, multiple job_ids, empty list (returns all), no match, and combination with tag filters.
Open in Web Open in Cursor 

cursoragent and others added 5 commits May 12, 2026 03:39
- Remove [cloud-only] marker from job_ids param in openapi.yaml
- Add job_ids field to ListAssetsQuery schema with CSV/list parsing
- Pass job_ids through route -> service -> query layer
- Filter AssetReference by job_id IN (...) on both data and count queries

Co-authored-by: Matt Miller <MillerMedia@users.noreply.github.com>
Tests cover:
- Single job_id filter
- Multiple job_ids filter (IN clause)
- Empty job_ids returns all results
- Non-matching job_ids returns empty
- job_ids combined with tag filters

Co-authored-by: Matt Miller <MillerMedia@users.noreply.github.com>
- Validate each token is a valid UUID (normalizes case); invalid input returns 422
- Raise on non-string list items instead of silently dropping
- Raise on unexpected input types instead of forwarding raw value
- Deduplicate tokens to avoid redundant IN clause bind params
- Cap list at max_length=100 to prevent oversized IN clauses
mattmillerai added a commit that referenced this pull request May 20, 2026
Aligns with the parallel hardening from draft PR #13848 (now closed as
a duplicate). The validator now:

- Raises ValueError on non-string list items (was: silently dropped).
- Raises ValueError on non-string / non-list top-level values like dict
  or int (was: silently passed through to Pydantic's downstream coercion).

Adds tests-unit/assets_test/queries/test_list_assets_query.py covering
the validator end-to-end: CSV canonicalization, dedup order, default
empty, invalid UUID, non-string list item, non-string non-list value,
and the max_length=500 boundary.
@mattmillerai
Copy link
Copy Markdown
Contributor Author

Closing as duplicate of #13998, which has shipped the same scope with the strict validator hardening from this draft ported over (commit 51487d7). Deleting the branch too.

@mattmillerai mattmillerai deleted the cursor/add-job-ids-filter-to-get-assets-4731 branch May 20, 2026 03:00
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.

2 participants