-
[OPIK-6525] [BE][FE] Annotation queue single-pass mode (#6792)
发布于
2026-05-27 12:54:21 +00:00 - [OPIK-6525] [BE][FE] Annotation queue single-pass mode
- Add annotators_per_item field to annotation queues (BE migration + model + DAO)
- Return comment ID in create comment response for proper update/delete lifecycle
- Redesign SME annotation view with sidebar, auto-save, and Figma-aligned layout
- Sidebar shows queue items with state indicators (default/scored/completed)
- Auto-save comments and scores with 1s debounce, flush on navigation
- Single "Next" button navigates to next unreviewed item, "Finish annotating" when done
- 30s polling keeps sidebar states in sync across annotators
- Add "Number of annotators per item" field to queue creation form
- Revision: Address PR review feedback and add tests
- Memoize sidebar preview text computation to avoid re-running prettifyMessage on every render
- Fix Finish annotating button not flushing pending saves before navigating to completion
- Fix comment create error not resetting lastSaved text, preventing retry
- Fix stale CREATE response corrupting next item's state after navigation (ignoreNextCreateResponseRef)
- Add @Min(1) validation to annotatorsPerItem on AnnotationQueue and AnnotationQueueUpdate
- Add trailing newline to migration file
- Add 17 unit tests for useAnnotationPersistence covering comment CRUD, score operations, debounce, flush, reset, stale response handling, and error recovery
- Move item state logic (ITEM_STATE, getItemState, getDistinctAnnotatorCount, isItemProcessedByUser) from SMEFlowContext to lib/annotation-queues for reuse and testability
- Add 13 unit tests for item state computation covering all three states, annotator counting, deduplication, and score name filtering
- Unify Next button and Cmd+Enter hotkey into single handleNext callback
- Disable annotation panel (comments + feedback scores) for completed items
- Expand Opik logo text in SME page header
- Fix queue creation form number input to allow clearing (z.coerce.number)
- Revision 2: BE integration tests, @Max(1000), fix circular dep
- Add 4 BE integration tests for annotatorsPerItem: explicit value round-trip, null defaults to 1, reject 0, reject 1001
- Add @Max(1000) validation to AnnotationQueue and AnnotationQueueUpdate
- Add newAnnotationQueue() test helper to ensure valid annotatorsPerItem across all 32 test sites
- Move AnnotationState type to lib/annotation-queues to break circular dependency (SMEFlowContext ↔ useAnnotationPersistence)
- Rename handleClick to handleItemClick in ItemsSidebar
-
Revision 3: Inline handleItemClick, remove unnecessary useCallback
-
Revision 4: Align welcome/completion page paddings with annotation view
-
Revision 5: Show locked message only for completed items where user hasn't annotated
- Completed + user not an annotator: hide comments/scores, show check icon + message
- Completed + user is an annotator: show editable comments/scores
- Not completed: normal editable UI
- Revision 6: Thread support, detail panels, sidebar redesign
- Split ThreadDataViewer into Header/Content matching TraceDataViewer pattern
- Thread header shows thread icon (correct colors), date range in bold + Opik thread ID
- Add Thread button in header that opens ThreadDetailsPanel
- Sidebar handles both traces and threads: traces show input/output, threads show first_message/last_message
- Fix last_message preview using prettifyMessage with type "output"
- Show date range (start → end) for thread items in sidebar instead of ID
- Extract formatThreadDateRange to lib/annotation-queues to avoid duplication
- Add remaining item count to Queue items header, green "All scored" when done
- Hide Annotate and Add To buttons in trace/thread detail panels from annotation queue (hideAnnotateActions)
- Redesign sidebar items: state tag with colored dot (blue=Reviewed, green=Completed, outlined=To review) + name, input as main content, output with CornerDownRight icon
- Non-default items displayed with reduced opacity
- Selected item uses bg-primary-foreground, theme-aware border on tags
- Revision 7: Fix sidebar selected item bg and opacity handling
- Selected item uses bg-muted for better visibility
- Opacity applies to content only, not background
- [OPIK-6525] [BE] Address PR review feedback
- Replace Map.of("id", commentId) with CreateCommentResponse DTO in
trace, thread, and span comment endpoints - Rename template flag to has_annotators_per_item for clarity
- Add MIN_ANNOTATORS_PER_ITEM constant with best-effort comment
- Replace factory.manufacturePojo(AnnotationQueueUpdate.class) with
newAnnotationQueueUpdate() helper to avoid Podam generating
out-of-range values - Add tests for updating and preserving annotatorsPerItem
- Parameterize invalid annotatorsPerItem validation tests (0, -1, 1001)
- Fix applyUpdate to include annotatorsPerItem field
- [OPIK-6525] [BE] Add tests verifying CreateCommentResponse body
Add createCommentReturnsIdInResponseBody test for trace, thread,
and span comment endpoints to confirm the response body contains
the created comment ID.下载附件