[DT-4232] Break latest-DAR submission-date ties by DAR id - #3123
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The deterministic ordering is consistently implemented and covered by focused regression tests.
Review effort: Balanced
Findings: None
What changed in this PR
Adds deterministic DAR selection by using the highest DAR ID when submission dates tie.
Changes:
- Adds ID-based tie-breakers to dashboard and collection-summary queries.
- Aligns
DarCollection.getMostRecentDar()with database behavior. - Adds regression tests covering all affected paths.
| File | Description |
|---|---|
src/main/java/org/broadinstitute/consent/http/models/DarCollection.java |
Adds the model-level ID tie-breaker. |
src/main/java/org/broadinstitute/consent/http/db/ResearcherDashboardDAO.java |
Stabilizes latest-DAR selection. |
src/main/java/org/broadinstitute/consent/http/db/DacDashboardDAO.java |
Stabilizes latest-DAR selection. |
src/main/java/org/broadinstitute/consent/http/db/DarCollectionSummaryDAO.java |
Updates all six summary queries. |
src/test/java/org/broadinstitute/consent/http/models/DarCollectionTest.java |
Tests model tie-breaking in both map arrangements. |
src/test/java/org/broadinstitute/consent/http/db/ResearcherDashboardDAOTest.java |
Tests researcher dashboard tie-breaking. |
src/test/java/org/broadinstitute/consent/http/db/DacDashboardDAOTest.java |
Tests DAC dashboard tie-breaking. |
src/test/java/org/broadinstitute/consent/http/db/DarCollectionSummaryDAOTest.java |
Tests all six summary query variants. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
kevinmarete
marked this pull request as ready for review
October 3, 2026 01:07
kevinmarete
requested review from
fboulnois,
otchet-broad and
rushtong
and removed request for
a team
October 3, 2026 01:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Addresses
https://broadworkbench.atlassian.net/browse/DT-4232
Security risk: no — query sort order only; no API, auth or data changes.
Summary
The Researcher and DAC dashboard counts and the six
DarCollectionSummaryDAOcollection-list queries pick each collection's latest DAR withDISTINCT ON (collection_id) ... ORDER BY collection_id, submission_date DESC. When two DARs in a collection share a submission date, Postgres can return either one, so a count or a list row can change between requests and the dashboards can disagree with the collection lists. This adds the DAR id as the final sort key, as #3116 did for the admin and Signing Official dashboards.DarCollection.getMostRecentDar(), whichDarCollectionServiceuses, gets the same tie-breaker so service code acts on the DAR the queries show.Each DAO test gets a case with two same-date DARs in one collection that asserts the later DAR is used; the
DarCollectionSummaryDAOcase runs against all six queries. A newDarCollectionTestcoversgetMostRecentDar()in both map orders. All of them fail with the tie-breaker removed.Have you read CONTRIBUTING.md lately? If not, do that first.
🤖 Generated with Claude Code