Skip to content

Conversation

@chance-wnb
Copy link
Contributor

@chance-wnb chance-wnb commented Dec 30, 2025

Add Annotation Queue Items Query API

This PR adds backend and frontend support for querying annotation queue items with pagination and sorting capabilities.

Backend Changes

New API Endpoint: annotation_queue_items_query

Type Definitions

  • Added AnnotationQueueItemsQueryReq and AnnotationQueueItemsQueryRes to trace server interface
  • Updated AnnotationQueueItemSchema to include all necessary fields for displaying queue items

Query Builder (annotation_queues_query_builder.py)

  • Added make_queue_items_query function with support for:
    • Filtering by project and queue ID
    • Pagination (limit/offset)
    • Sorting by multiple fields: call_started_at, call_op_name, created_at, updated_at
    • Deterministic ordering: Uses ORDER BY created_at ASC, id ASC as default to ensure stable pagination when multiple items have identical timestamps

Implementation Across Trace Server Layers

  • clickhouse_trace_server_batched.py - Main ClickHouse implementation
  • external_to_internal_trace_server_adapter.py - ID conversion adapter layer
  • caching_middleware_trace_server.py - Passthrough caching middleware
  • remote_http_trace_server.py - HTTP client implementation

Schema Cleanup

  • Removed added_at field: Eliminated redundant timestamp field, using created_at instead

Testing

New Test Coverage

  • test_annotation_queue_items_query_basic - Basic query functionality
  • test_annotation_queue_items_query_with_pagination - Pagination with limit/offset
  • test_annotation_queue_items_query_with_sorting - Custom sort orders
  • test_annotation_queue_items_query_empty_queue - Empty queue edge case
  • test_annotation_queue_items_query_with_multiple_sort_fields - Multi-field sorting

Related Work

This PR builds on the annotation queues feature introduced in earlier commits and prepares the foundation for the upcoming annotation review interface where users will interact with queued calls to provide feedback and annotations.

Copy link
Contributor Author

chance-wnb commented Dec 30, 2025

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

This stack of pull requests is managed by Graphite. Learn more about stacking.

@chance-wnb chance-wnb marked this pull request as ready for review December 30, 2025 03:32
@chance-wnb chance-wnb requested a review from a team as a code owner December 30, 2025 03:32
@chance-wnb chance-wnb force-pushed the chance/queue_items_fetch_api branch from 725b081 to f302043 Compare December 30, 2025 03:34
@wandbot-3000
Copy link

wandbot-3000 bot commented Dec 30, 2025

@codecov
Copy link

codecov bot commented Dec 30, 2025

Codecov Report

❌ Patch coverage is 94.80519% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ve/trace_server/annotation_queues_query_builder.py 95.34% 1 Missing and 1 partial ⚠️
weave/trace_server/sqlite_trace_server.py 50.00% 1 Missing ⚠️
.../trace_server_bindings/remote_http_trace_server.py 50.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@chance-wnb chance-wnb force-pushed the chance/queue_stats_api branch from a2cb043 to 275496b Compare December 31, 2025 02:12
@chance-wnb chance-wnb force-pushed the chance/queue_items_fetch_api branch from f302043 to c19fe59 Compare December 31, 2025 02:12
@chance-wnb chance-wnb force-pushed the chance/queue_items_fetch_api branch from c19fe59 to 89686a9 Compare December 31, 2025 04:49
@neutralino1 neutralino1 added the merge-post-freeze-12-25 PRs to merge after December '25 freeze ends. label Jan 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-post-freeze-12-25 PRs to merge after December '25 freeze ends.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants