发布

  • [OPIK-6983] [BE][FE] Surface queue-scoped feedback scores in general views (#7209)

    frostbyte_neo 发布于 2026-06-29 08:31:27 +00:00

    • [OPIK-6983] [BE][FE] Add sourceQueueId to ValueEntry and update feedback score utilities

    Add sourceQueueId field to ValueEntry and FeedbackScoreMapper parsing
    (tuple index 7) so the backend can surface which annotation queue a
    score originated from.

    On the frontend, extend FeedbackScoreValueByAuthorMap with
    source_queue_id, update findValueByAuthor to accept an optional
    sourceQueueId for queue-scoped lookups, and thread sourceQueueId
    through generateUpdateMutation / generateDeleteMutation so optimistic
    cache updates use composite keys (author_queueId).

    • [OPIK-6983] [BE][FE] Surface queue-scoped scores in trace detail panel

    TraceDAO SELECT_BY_IDS: add source_queue_id to UNION ALL selects,
    LIMIT 1 BY, entries tuple, and value_by_author map key/value for both
    trace and span feedback score CTEs.

    Add author field to ValueEntry and value tuple (index 8) so the
    frontend reads entry.author directly instead of parsing composite keys.

    FeedbackScoreTable (v2): replace extractAuthorName with getAuthorName
    using entry.author, propagate source_queue_id and per-entry reason/source
    to child rows, render SourceCell as ResourceLink to the annotation queue
    (plain text fallback for SDK/deleted queue).

    • [OPIK-6983] [BE][FE] Update remaining TraceDAO CTEs, score cells, hover cards, and delete scoping

    Backend:

    • Add source_queue_id to all 8 remaining TraceDAO LIMIT 1 BY, UNION ALL,
      entries tuples, and map key/value constructions.
    • Scope authored_feedback_scores DELETE by source_queue_id to prevent
      deleting queue-scoped scores when removing a direct score.

    Frontend:

    • FeedbackScoreCellValue: multi-value display (categorical count format,
      numeric avg), showTooltip prop for experiment context vs hover card
      for logs context.
    • MultiValueFeedbackScoreHoverCard: AuthorLabel with queue name resolution
      via useAnnotationQueueById, source label right-aligned in lighter color,
      show card for single entries, Average row only for multi-entry.
    • findValueByAuthor: default to exact match (safe), prefixMatch opt-in
      via hasAnyValueByAuthor helper. Prevents direct scoring from picking
      up queue-scoped entries.
    • getCategoricFeedbackScoreValuesMap: return UserEntry with mapKey+entry
      so AuthorLabel can resolve source in categorical hover cards.
    • [OPIK-6983] [BE] Add source_queue_id to ThreadDAO CTEs

    Same mechanical pattern: add source_queue_id to UNION ALL selects,
    LIMIT 1 BY, entries tuples, and map key/value constructions in
    ThreadDAO (4 instances). SpanDAO intentionally skipped — annotation
    queues never target spans.

    • [OPIK-6983] [BE] Add source_queue_id to ProjectMetricsDAO and KpiCardDAO CTEs

    Same mechanical pattern: add source_queue_id to UNION ALL selects
    and LIMIT 1 BY in ProjectMetricsDAO (3 instances) and KpiCardDAO
    (3 instances) so dashboard widgets and KPI cards include all
    queue-scoped scores in their aggregations.

    • [OPIK-6983] [BE][FE] Scope queue export by source_queue_id

    Backend: add source_queue_id to comments CTE inner SELECTs and
    tuple in TraceDAO and ThreadDAO. Update CommentResultMapper to
    parse source_queue_id from tuple index 6.

    Frontend: add source_queue_id to CommentItem type. Update
    getCommentsByUser to filter by sourceQueueId when provided.
    Pass annotationQueue.id to both getFeedbackScoresByUser and
    getCommentsByUser in ExportAnnotatedDataButton so export only
    includes scores and comments from that specific queue.

    • [OPIK-6983] [BE][FE] Fix experiment compare grid queue-scoped scores

    Backend: add source_queue_id to LIMIT 1 BY, UNION ALL, entries tuples,
    and map key/value in ExperimentItemDAO, DatasetItemDAO,
    DatasetItemVersionDAO, and ExperimentAggregatesDAO. Fix count(*)
    in ExperimentAggregatesDAO to count all entries (not just distinct
    authors) so avg is used instead of any_value for multi-queue scores.

    Frontend: replace showTooltip with footer prop on FeedbackScoreCellValue.
    Always use rich hover card; experiment compare cell passes trial info
    as footer. Re-add footer rendering to MultiValueFeedbackScoreHoverCard.

    • [OPIK-6983] [BE] Add source_queue_id to OptimizationDAO CTE

    Aggregate-only: add source_queue_id to UNION ALL selects and
    LIMIT 1 BY so optimization views include all queue-scoped scores
    in their aggregations.

    • [OPIK-6983] [BE] Add E2E test for same-author multi-queue score averaging

    Verify that scoring the same trace+name as the same author from two
    different annotation queues produces the correct average and two
    distinct composite-key entries in value_by_author.

    • Revision: Fix assertion_results LIMIT 1 BY, delete scoping, tuple cast, and PR review fixes
    • Revert source_queue_id from assertion_results LIMIT 1 BY in ExperimentDAO
    • Pass sourceQueueId through delete handlers in FeedbackScoreTable,
      DeleteFeedbackScoreValueDialog, TraceDataViewer, AnnotatePanel,
      ThreadAnnotations, ThreadAnnotatePanel, ExperimentFeedbackScoresViewer
    • Add FeedbackScoreTypeManufacturer to exclude sourceQueueId from PODAM
      for FeedbackScore, FeedbackScoreBatchItem, FeedbackScoreBatchItemThread
    • Fix DatasetItemVersionDAO feedback_scores_array tuple cast to include
      all 9 ValueEntry fields (spanType, spanId, sourceQueueId, author)
    • Extract buildValueByAuthorKey helper for composite key construction
    • Add annotationQueue.id to useCallback deps in ExportAnnotatedDataButton
      and SMEFlowContext
    • Fix comment typo in FeedbackScoreMapper (index 8 is author)
    • Fix prettier formatting in annotation-queues.ts
    • [OPIK-6983] [BE] Address PR review comments

    Addresses andrescrz's and baz-reviewer's comments on PR #7209:

    • ValueEntry: drop the dead overloaded constructors (the builder is used everywhere; no call sites).
    • CommentResultMapper / FeedbackScoreMapper: use StringUtils.isNotBlank for source_queue_id checks (more resilient than isNotEmpty).
    • TraceDAO: convert the SELECT_BY_IDS value_by_author note from a plain comment to a javadoc.
    • SpanDAO: carry the author field in the value_by_author tuples for parity with traces/threads, so the frontend reads entry.author instead of parsing it from the map key. Queues never target spans, so source_queue_id stays empty.
    • SpanDAO: fix span comments returning the span's own id as source_queue_id. Both comment subqueries (SELECT_BY_IDS and comments_final) now carry source_queue_id at slot 6, matching the CommentResultMapper contract; the SELECT_BY_IDS comment tuple is explicit instead of tuple(c.*) to avoid slot drift.
    • FeedbackScoreMapper: in parseValueByAuthorFromJson, default ValueEntry.author to the value_by_author map key so legacy snapshots without an explicit author element don't return null authors (the explicit element still overrides for current data).
    • MultiValueFeedbackScoresE2ETest: assert full ValueEntry entities via recursive comparison instead of field-by-field; extract the repeated feedback-score ignored-fields list to a local constant; assert ValueEntry.sourceQueueId explicitly in the queue-scoped delete tests; rename the added test to drop the forbidden test* prefix (sameAuthorTwoQueuesProducesAverage).
    • [OPIK-6983] [FE] Address PR review comments from andriidudar and baz
    • FeedbackScoreTable utils: lift source_queue_id from the entry in the single-value branch so a single-reviewer queue score shows the queue link in the Source column (and builds the author_queueId delete key), matching multi-reviewer rows.
    • Extract a shared useFeedbackScoreSourceLabel hook (used by SourceCell and the hover card AuthorLabel) resolving the source display in one place: a spinner while the queue loads, the queue link/name when resolved, "" on 404, and "" on other errors (403/500/network) so transient failures are not mislabeled as deletion.
    下载附件