发布

  • [OPIK-7247] [BE] Fix duplicate experiment items in test suite detail view (#7388)

    frostbyte_neo 发布于 2026-07-08 16:01:39 +00:00

    • [OPIK-7247] [BE] Fix duplicate experiment items in test suite detail view

    Add LIMIT 1 BY dedup to aggregated-branch lookup JOINs that resolve
    dataset_item_id to stable IDs via dataset_item_versions.

    The LEFT JOIN dataset_item_versions FINAL matches multiple rows per
    experiment item when the same physical id appears across multiple
    dataset versions (which happens whenever items are edited, since each
    version row keeps id == dataset_item_id). Without dedup, the
    groupArray that builds experiment_items_array captures N identical
    copies per item (N = number of dataset versions), causing the UI to
    render the same trial result multiple times.

    The raw branch was already protected by LIMIT 1 BY ei.id; this commit
    adds the same protection to the 3 aggregated-branch locations in
    DatasetItemVersionDAO and ExperimentAggregatesDAO.

    Includes a regression test that edits dataset items across multiple
    versions and verifies experiment items are not duplicated after
    aggregation.

    • Revision: Add parameterized regression test for OPIK-7247

    Parameterized test covering the full matrix of dataset vs test suite
    and single-trial vs multi-trial (runsPerItem=3) on multi-version
    datasets. Verifies experiment item count is preserved exactly after
    aggregation — no duplication from the lookup JOIN, and multi-trial
    experiments retain the correct number of trials per item.

    • Revision 2: Address review feedback
    • Add SQL comment above each LIMIT 1 BY eia.id explaining why arbitrary
      pick is safe (all dupes resolve to the same stable_dataset_item_id)
    • Replace .collect(Collectors.toList()) with .toList() in test
    • Revision 3: Split tests into branch-free parameterized methods

    Replace single parameterized test with if-branching into two clean
    parameterized tests (dataset vs test suite), each parameterized by
    runsPerItem only. No conditional logic, no unused variables.

    下载附件