Skip to content

[OPIK-8023] Add page-boundary coverage for dataset-item JSON-key sorting - #7939

Open
thiagohora wants to merge 1 commit into
mainfrom
thiagoh/OPIK-8023-datasetitem-sort-pagination
Open

[OPIK-8023] Add page-boundary coverage for dataset-item JSON-key sorting#7939
thiagohora wants to merge 1 commit into
mainfrom
thiagoh/OPIK-8023-datasetitem-sort-pagination

Conversation

@thiagohora

@thiagohora thiagohora commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Details

Follow-up to #7935. Extends DatasetVersionResourceTest#sortByJsonKeyThroughPushTopLimit with a page=2, size=2 request per namespace/direction, asserting the single trailing item on the boundary page and that total stays at the full matching count. This exercises the push-top-limit OFFSET :top_offset + outer LIMIT path, which was previously covered only at page=1, size=10.

Change checklist

  • User facing
  • Documentation update

Issues

  • OPIK-8023

AI-WATERMARK

AI-WATERMARK: yes

  • Tools: Claude Code
  • Model(s): Claude Opus
  • Scope: Added the page-boundary assertions to the existing parameterized test
  • Human verification: ran the test locally (6 namespace/direction cases green)

Testing

  • mvn -o test -Dtest='DatasetVersionResourceTest$ExperimentDatasetVersionLinking#sortByJsonKeyThroughPushTopLimit' — 6/6 pass (output/input/metadata x ASC/DESC), each now also asserting page 2 (size 2) returns the single boundary item with total=3
  • mvn -o spotless:check — clean
  • Environment: local Maven, Testcontainers (ClickHouse / MySQL / Redis)

Documentation

N/A — test-only change.

Follow-up to #7935 (already merged to main).

🤖 Generated with Claude Code

Follow-up to #7935. Extend the parameterized version-DAO sort test with a page=2,size=2
request per namespace/direction, asserting the single trailing item on the boundary page
and that total stays at the full matching count. This exercises the push-top-limit
OFFSET :top_offset + outer LIMIT path, previously covered only at page=1,size=10.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@thiagohora
thiagohora requested a review from a team as a code owner August 20, 2026 17:57
@github-actions github-actions Bot added java Pull requests that update Java code Backend tests Including test files, or tests related like configuration. labels Aug 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⏱️ pre-commit per-hook timing

Hook Description Result Duration
☕ spotless — java backend Format Java code 4.72s
Total (1 ran) 4.72s
⏭️ 42 skipped (no matching files changed)
Hook Description Result
🐍 trim trailing whitespace — python sdk Strip trailing whitespace ⏭️
🐍 fix end of files — python sdk Ensure files end in a newline ⏭️
🐍 ruff — python sdk Lint + autofix Python (ruff) ⏭️
🐍 ruff-format — python sdk Format Python code (ruff) ⏭️
🐍 mypy — python sdk Static type check ⏭️
🤖 trim trailing whitespace — optimizer Strip trailing whitespace ⏭️
🤖 fix end of files — optimizer Ensure files end in a newline ⏭️
🤖 check yaml — optimizer Validate YAML syntax ⏭️
🤖 check json — optimizer Validate JSON syntax ⏭️
🤖 check toml — optimizer Validate TOML syntax ⏭️
🤖 check for added large files — optimizer Block large files (>1MB) ⏭️
🔐 detect private key — optimizer Block committed private keys ⏭️
🤖 check for merge conflicts — optimizer Block merge-conflict markers ⏭️
🤖 check for case conflicts — optimizer Block case-only name clashes ⏭️
🤖 pyupgrade — optimizer Modernize Python syntax ⏭️
🤖 ruff — optimizer Lint + autofix Python (ruff) ⏭️
🤖 ruff-format — optimizer Format Python code (ruff) ⏭️
🤖 mypy — optimizer Static type check ⏭️
📓 nbstripout — optimizer notebooks Strip notebook output ⏭️
📝 markdownlint — optimizer Lint Markdown ⏭️
🔤 codespell — optimizer Fix common misspellings ⏭️
📊 radon cc — optimizer Cyclomatic-complexity gate ⏭️
📊 radon raw — optimizer Raw size metrics gate ⏭️
📊 xenon — optimizer Fail on complexity thresholds ⏭️
📊 lizard — optimizer Cyclomatic-complexity gate ⏭️
🧹 vulture — optimizer Find dead code ⏭️
🛡️ trim trailing whitespace — guardrails Strip trailing whitespace ⏭️
🛡️ fix end of files — guardrails Ensure files end in a newline ⏭️
🛡️ ruff — guardrails Lint + autofix Python (ruff) ⏭️
🛡️ ruff-format — guardrails Format Python code (ruff) ⏭️
🛡️ mypy — guardrails Static type check ⏭️
⚓ helm-docs Regenerate Helm chart README ⏭️
block non-public FE plugins Block non-public FE plugins ⏭️
🧪 pre-commit wrapper smoke tests Self-test the wrapper scripts ⏭️
🧪 rebaseline script tests Self-test the changelog re-baseline script ⏭️
🌐 eslint — frontend Lint + autofix JS/TS ⏭️
🌐 typecheck — frontend Whole-project tsc type check ⏭️
📘 eslint — typescript sdk Lint + autofix JS/TS ⏭️
📘 typecheck — typescript sdk Whole-project tsc type check ⏭️
⚙️ actionlint — github workflows Lint GitHub Actions workflows ⏭️
🐳 hadolint — dockerfiles Lint Dockerfiles ⏭️
🌈 zizmor — github workflows security Security-scan GitHub Actions workflows ⏭️

@CometActions

Copy link
Copy Markdown
Collaborator

No test needed here.

This PR is test-only: the whole diff is 9 added lines in DatasetVersionResourceTest.java asserting page 2 of a size-2 page over JSON-key sorting. No production code changes, so there is no new behaviour for an e2e test to cover — the assertion you added is itself the coverage for the top_offset/LIMIT path.

Run

Advisory, from the QA test radar. Nothing here blocks this PR, and anything it proposes is a draft for review.

@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Backend Tests - Integration Group 12

224 tests   223 ✅  4m 1s ⏱️
 32 suites    0 💤
 32 files      1 ❌

For more details on these failures, see this check.

Results for commit 50cd9f9.

♻️ This comment has been updated with latest results.

Comment on lines +3595 to +3602
// Page boundary: with size=2, page 2 returns only the trailing item in sort order, exercising the
// push-top-limit OFFSET :top_offset + outer LIMIT path; total stays at the full matching count.
var pageTwo = datasetResourceClient.getDatasetItemsWithExperimentItems(
datasetId, List.of(experimentId), null, null, sorting, 2, 2, API_KEY, TEST_WORKSPACE);
assertThat(pageTwo.total()).isEqualTo(count);
assertThat(pageTwo.content())
.usingRecursiveFieldByFieldElementComparatorIgnoringFields(IGNORED_FIELDS_DATA_ITEM)
.containsExactly(expected.get(count - 1));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Page test does not cover push-top-limit

sortByJsonKeyThroughPushTopLimit never finishes the experiment into COMPLETED/CANCELLED nor awaits experiment_item_aggregates, so getAggregationBranchCounts sees hasAggregated=false, hasRaw=true and applyPushTopLimit binds ordinary offset instead of top_dataset_items ... LIMIT :top_limit OFFSET :top_offset — the test never actually exercises the push-top-limit path it targets. Should we finish the experiment and await aggregate materialization, or assert the branch state before issuing the page-two request?

Severity

Want Baz to fix this for you? Activate Fixer

Other fix methods

Fix in Cursor

Prompt for AI Agents
Before applying, verify this suggestion against the current code. In
`apps/opik-backend/src/test/java/com/comet/opik/api/resources/v1/priv/DatasetVersionResourceTest.java`
around lines 3595-3602, update `sortByJsonKeyThroughPushTopLimit` so the fixture
deterministically selects the push-top-limit path. Finish the experiment with the
appropriate completed or cancelled status, then wait for aggregate materialization (or
explicitly assert the aggregate branch state) before issuing the page-two request,
ensuring the test actually exercises `top_dataset_items ... LIMIT :top_limit OFFSET
:top_offset`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend java Pull requests that update Java code 🔵 size/XS tests Including test files, or tests related like configuration.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants