Skip to content

[DT-4232] Break latest-DAR submission-date ties by DAR id - #3123

Merged
kevinmarete merged 2 commits into
developfrom
km-dt-4232-dashboard-tie-breaker
Oct 5, 2026
Merged

kevinmarete merged 2 commits into
developfrom
km-dt-4232-dashboard-tie-breaker

Conversation

@kevinmarete

@kevinmarete kevinmarete commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

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 DarCollectionSummaryDAO collection-list queries pick each collection's latest DAR with DISTINCT 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(), which DarCollectionService uses, 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 DarCollectionSummaryDAO case runs against all six queries. A new DarCollectionTest covers getMostRecentDar() in both map orders. All of them fail with the tie-breaker removed.


Have you read CONTRIBUTING.md lately? If not, do that first.

  • Label PR with a Jira ticket number and include a link to the ticket
  • Label PR with a security risk modifier [no, low, medium, high]
  • PR describes scope of changes
  • Get a minimum of one thumbs worth of review, preferably two if enough team members are available
  • Get PO sign-off for all non-trivial UI or workflow changes
  • Verify all tests go green
  • Test this change deployed correctly and works on dev environment after deployment

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kevinmarete kevinmarete self-assigned this Oct 3, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

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.

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.

@sonarqubecloud

sonarqubecloud Bot commented Oct 3, 2026

Copy link
Copy Markdown

@kevinmarete
kevinmarete marked this pull request as ready for review October 3, 2026 01:07
@kevinmarete
kevinmarete requested a review from a team as a code owner October 3, 2026 01:07
@kevinmarete
kevinmarete requested review from fboulnois, otchet-broad and rushtong and removed request for a team October 3, 2026 01:07

@rushtong rushtong left a comment

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.

Looks good to me 👍🏽

@fboulnois fboulnois left a comment

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.

👍

@kevinmarete
kevinmarete removed the request for review from otchet-broad October 5, 2026 14:36
@kevinmarete
kevinmarete merged commit b18611f into develop Oct 5, 2026
12 checks passed
@kevinmarete
kevinmarete deleted the km-dt-4232-dashboard-tie-breaker branch October 5, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants