chore(weave): new APIs for annotation queue management
New APIs for Annotation Queue Management
Summary
Implements backend APIs for annotation queue management, enabling creation of queues, add calls, and query existing queues. This is foundational work for the queue-based call annotation system.
API Endpoints Added
1. Create Queue
Creates a new annotation queue with metadata and scorer references.
annotation_queue_create(req: AnnotationQueueCreateReq) -> AnnotationQueueCreateRes
2. Stream Query Queues
Streams annotation queues with optional name filtering (case-insensitive partial match).
annotation_queues_query_stream(req: AnnotationQueuesQueryReq) -> Iterator[AnnotationQueueSchema]
3. Read Queue
Retrieves a specific queue by ID.
annotation_queue_read(req: AnnotationQueueReadReq) -> AnnotationQueueReadRes
4. Add Calls to Queue
Batch adds calls to a queue with duplicate prevention and progress tracking.
annotation_queue_add_calls(req: AnnotationQueueAddCallsReq) -> AnnotationQueueAddCallsRes
Tests
tests/trace/test_client_annotations.py (+380 lines, NEW FILE)**
- Comprehensive test suite for annotation queue APIs
- Test coverage:
- Queue creation with validation
- Name filtering (case-insensitive partial match)
- Reading queues by ID
- Adding calls with duplicate detection
- Authentication enforcement
- Error handling
Key Implementation Details
Case-Insensitive Partial Name Search
name_pattern = f"%{name}%"
where_clauses.append(
f"lowerUTF8(name) LIKE lowerUTF8({{{name_param}: String}})"
)
Duplicate Prevention
# Check existing before insert
existing_call_ids = {row[0] for row in dup_result.result_rows}
new_call_ids = [cid for cid in call_ids if cid not in existing_call_ids]
Testing
Test Coverage (test_client_annotations.py)
- ✅ Create queue with valid data
- ✅ Query queues with name filter
- ✅ Read queue by ID
- ✅ Add calls with duplicate detection
- ✅ Stream query returns iterator
- ✅ Authentication checks
- ✅ Error handling (invalid IDs, etc.)
Dependencies
This commit builds on:
- Database migration
022_add_annotation_queues.up.sql(separate commit) - Existing infrastructure:
ParamBuilder,generate_id(), auth layers
Backwards Compatibility
✅ Fully backwards compatible
- No breaking changes to existing APIs
- New methods added to protocol interface
- Existing code unaffected
[!WARNING] This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite. Learn more
- #5781

- #5777
👈 (View in Graphite) - #5772

master
This stack of pull requests is managed by Graphite. Learn more about stacking.
Codecov Report
:x: Patch coverage is 88.83495% with 23 lines in your changes missing coverage. Please review.
:loudspeaker: Thoughts on this report? Let us know!
Preview this PR with FeatureBee: https://beta.wandb.ai/?betaVersion=6271e76943d7f56baddd2fd7eecd8f71756914d0
❌ Documentation Reference Check Failed
No documentation reference found in the PR description. Please add either:
- A link to a docs PR (format: wandb/docs#XXX or https://github.com/wandb/docs/pull/XXX)
- A Jira ticket reference (format: DOCS-XXX or https://wandb.atlassian.net/browse/DOCS-XXX)
This check is required for all PRs except those that start with "chore(weave)" or explicitly state "docs are not required". Please update your PR description and this check will run again automatically.