Skip to content

[DT-3313] [6/6] Replace the Datasets Cited filters with a column on both grids - #3937

Merged
kevinmarete merged 8 commits into
developfrom
km-dt-3313-citation-column
Sep 17, 2026
Merged

kevinmarete merged 8 commits into
developfrom
km-dt-3313-citation-column

Conversation

@kevinmarete

@kevinmarete kevinmarete commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Addresses

DT-3313 — 6 of 6, splitting #3926 per review. Stacked on #3939. Security risk: no.

Summary

This is the one that needs a product call, which is why it's isolated and last — it removes a filter users have today. Nothing else in the series depends on it, so a hold here blocks nothing.

Presentations and Publications each offered a Yes/No "Datasets Cited" filter. A per-row fact reads better as a column: the Elasticsearch clause matches whole studies, so selecting "Yes" kept every presentation of any study that had at least one citing presentation, including the non-citing ones. The row-level pass then hid them, which meant the filter's answer depended on which other presentations happened to share the study.

Both grids now carry a Datasets Cited column. A row indexed without the field reads as "No", matching how both transforms already default it (citation ?? false), and the citation text goes in the tooltip where the index carries it. Because this lands after #3939, both tabs keep a filter panel throughout — they just trade this one boolean for Event/Format/Access/date or Journal/Access/date.

Retired URL params (datasetsCited, presentationsDatasetsCited, publicationsDatasetsCited) are now deleted on write. I moved that delete from serializeFiltersToUrl into updateState: serialization only runs when an update carries filters, so an old link's param survived indefinitely for anyone who never touched the filter panel — the case the cleanup exists for. A test covers it via a query-only update.

Mutation-checked: forcing the column to always read "Yes" fails 7 tests, and dropping the retired-param delete fails its own.

@github-actions

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Report for DUOS Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 90.38% 12127 / 13418
🔵 Statements 89.88% 12946 / 14404
🔵 Functions 87.48% 3597 / 4112
🔵 Branches 82.88% 7627 / 9203
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/components/data_library/filterRegistry.ts 87.86% 85.6% 98.61% 87.24% 219, 295, 525-532, 695-699, 719-733, 749-758, 774-783, 792-806, 861, 897
src/components/data_library/assets/presentationAsset.ts 100% 90% 100% 100%
src/components/data_library/assets/publicationAsset.ts 100% 91.17% 100% 100%
src/components/data_library/columns/presentationColumns.tsx 100% 95.83% 100% 100%
src/components/data_library/columns/publicationColumns.tsx 100% 88.46% 100% 100%
src/components/data_library/columns/sharedColumns.tsx 95.45% 100% 88.88% 95.45% 22
src/hooks/useLibraryPageState.ts 88.07% 78.33% 82.45% 87.37% 241, 244, 256-260, 266, 295, 310, 330-334
src/hooks/useLibraryUrlState.ts 94.44% 90.42% 97.22% 94.81% 209, 220-222, 254, 266, 272, 348
src/libs/dataLibraryFilterConfig.ts 100% 100% 100% 100%
src/types/library.ts 100% 100% 100% 100%
Generated in workflow #7263 for commit 8cf6743 by the Vitest Coverage Report Action

@kevinmarete
kevinmarete force-pushed the km-dt-3313-citation-column branch from 902dd9a to af1014f Compare September 15, 2026 23:20
@kevinmarete
kevinmarete changed the base branch from km-dt-3313-shared-columns to km-dt-3313-presentation-publication-filters September 15, 2026 23:20
@kevinmarete kevinmarete changed the title [DT-3313] Replace the Datasets Cited filters with a column on both grids [DT-3313] [6/6] Replace the Datasets Cited filters with a column on both grids Sep 15, 2026
@kevinmarete

kevinmarete commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor Author

@fboulnois this bundles two separable changes: adding the Datasets Cited column (additive), and removing the Yes/No filter (a user-visible removal).

@jlaw-codes — the removal needs your nod. Today's filter can't be a clean per-row filter: the Elasticsearch clause matches whole studies, so "Yes" returns every presentation of any study with at least one citing presentation, and the client-side pass then hides the rest. The answer depends on which siblings share the study.

If that isn't a quick yes, I'll split the column out so it can merge and the removal waits.

Asking before #3939 merges, since this is based on it.

@kevinmarete
kevinmarete force-pushed the km-dt-3313-presentation-publication-filters branch from d9eced6 to 5c2b161 Compare September 15, 2026 23:45
@kevinmarete
kevinmarete force-pushed the km-dt-3313-citation-column branch from af1014f to 3bbe9fe Compare September 15, 2026 23:47
@kevinmarete
kevinmarete requested a lite review from Copilot September 15, 2026 23:47

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.

🟡 Changes recommended

Add citation tooltip coverage and remove stale filter entries; clean up the noted test issues.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Replaces the Presentations and Publications “Datasets Cited” filters with per-row columns and retires their URL parameters.

Changes:

  • Adds reusable citation columns with Yes/No values and tooltips.
  • Removes citation filters from state, UI, queries, and row filtering.
  • Updates URL cleanup and related tests.
File summaries
File Summary
test/pages/DataLibrary.spec.tsx Verifies citation column values.
test/hooks/useLibraryUrlState.spec.tsx Tests retired URL parameter cleanup.
test/components/data_library/LibraryFilters.spec.tsx Updates filter visibility expectations.
test/components/data_library/filterRegistry.spec.ts Updates filter registry tests.
test/components/data_library/columns/publicationColumns.spec.tsx Tests publication columns.
test/components/data_library/columns/presentationColumns.spec.tsx Tests presentation columns.
src/types/library.ts Removes retired filter types.
src/libs/dataLibraryFilterConfig.ts Removes retired filter configuration.
src/hooks/useLibraryUrlState.ts Removes and cleans retired URL parameters.
src/components/data_library/LibraryFilters.tsx Removes citation filter controls.
src/components/data_library/filterRegistry.ts Removes citation definitions and clauses.
src/components/data_library/columns/sharedColumns.tsx Adds the shared citation column.
src/components/data_library/columns/publicationColumns.tsx Adds the citation column to Publications.
src/components/data_library/columns/presentationColumns.tsx Adds the citation column to Presentations.
src/components/data_library/assets/publicationAsset.ts Removes publication citation filtering.
src/components/data_library/assets/presentationAsset.ts Removes presentation citation filtering.
Review details

Suppressed comments (3)

src/hooks/useLibraryUrlState.ts:85

  • The retirement is incomplete: useLibraryPageState still constructs availableFilters.datasetsCited and availableFilters.publicationsDatasetsCited at lines 255–262. Since that object is returned through useMemo, structural typing does not flag the extra properties, so dead options remain in every page state. Remove those producer entries as well.
const RETIRED_PARAMS = ['datasetsCited', 'presentationsDatasetsCited', 'publicationsDatasetsCited']

test/components/data_library/columns/presentationColumns.spec.tsx:134

  • This adds a second Access-column test block; the same two assertions already exist later in this file at lines 200–209. Keeping both duplicates test maintenance and can make future changes appear covered twice. Remove one of the blocks.
describe('makePresentationColumns — Access column', () => {

test/components/data_library/columns/publicationColumns.spec.tsx:140

  • This adds a second Access-column test block; the same two assertions already exist later in this file at lines 218–227. Keeping both duplicates test maintenance and can make future changes appear covered twice. Remove one of the blocks.
describe('makePublicationColumns — Access column', () => {
  • Files reviewed: 16/16 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/components/data_library/columns/sharedColumns.tsx Outdated
Comment thread src/types/library.ts
Comment thread test/components/data_library/LibraryFilters.spec.tsx Outdated
@kevinmarete
kevinmarete force-pushed the km-dt-3313-presentation-publication-filters branch from 5c2b161 to 476fc70 Compare September 15, 2026 23:56
@kevinmarete
kevinmarete force-pushed the km-dt-3313-citation-column branch 2 times, most recently from fdff878 to 9d9e1e2 Compare September 16, 2026 00:14
@kevinmarete
kevinmarete requested a lite review from Copilot September 16, 2026 00:14

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.

🟡 Changes recommended

The citation tooltip must be made keyboard- and screen-reader-accessible.

Get a fresh assessment by requesting another Copilot review.

Review details
  • Files reviewed: 17/17 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread src/components/data_library/columns/sharedColumns.tsx Outdated
@kevinmarete
kevinmarete force-pushed the km-dt-3313-presentation-publication-filters branch from 261ecf1 to 28f1cb2 Compare September 16, 2026 00:30
@kevinmarete
kevinmarete force-pushed the km-dt-3313-citation-column branch from 9d9e1e2 to e0ff34a Compare September 16, 2026 00:33
@kevinmarete
kevinmarete requested a lite review from Copilot September 16, 2026 00:40

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.

🟢 Approval recommended

Reviewed changes have no unresolved blocking issues.

Review details
  • Files reviewed: 16/16 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@kevinmarete kevinmarete self-assigned this Sep 16, 2026
@kevinmarete
kevinmarete force-pushed the km-dt-3313-presentation-publication-filters branch from 4070755 to 795828a Compare September 16, 2026 01:15
@kevinmarete
kevinmarete force-pushed the km-dt-3313-citation-column branch 2 times, most recently from bace108 to fc9522c Compare September 16, 2026 01:22
@kevinmarete
kevinmarete requested a lite review from Copilot September 16, 2026 01:36

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.

🟢 Approval recommended

The reviewed changes have test coverage and no unresolved blocking issues.

Review details
  • Files reviewed: 19/19 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@kevinmarete
kevinmarete force-pushed the km-dt-3313-ip-funding-filters branch from d5b7a5a to a92aedd Compare September 16, 2026 16:22
@kevinmarete
kevinmarete force-pushed the km-dt-3313-citation-column branch from 9fdb992 to b85f04b Compare September 16, 2026 16:22
@kevinmarete
kevinmarete force-pushed the km-dt-3313-ip-funding-filters branch from a92aedd to 364c713 Compare September 16, 2026 17:19
@kevinmarete
kevinmarete force-pushed the km-dt-3313-citation-column branch from b85f04b to 05394dc Compare September 16, 2026 17:19
@kevinmarete
kevinmarete force-pushed the km-dt-3313-ip-funding-filters branch from 364c713 to 50608d5 Compare September 16, 2026 17:38
@kevinmarete
kevinmarete force-pushed the km-dt-3313-citation-column branch 2 times, most recently from 0c55403 to 20d1f56 Compare September 16, 2026 17:52

@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.

1. Citation tooltip shows on rows labelled "No": src/components/data_library/columns/sharedColumns.tsx:78

The tooltip shows a dataset citation on rows labelled "No". datasetCitation is required on the publication form (src/utils/darFormUtils.ts:396) regardless of the citation answer, so uncited publications routinely carry text; the cell reads "No" while its tooltip/accessible description names a citation.

The new spec only covers citation: false with empty text, so this combination is untested.

Fix: guard the tooltip on params.row.citation.

2. Hardcoded tabIndex={0} breaks the DataGrid roving tabindex: src/components/data_library/columns/sharedColumns.tsx:85

The hardcoded tabIndex={0} bypasses the DataGrid's roving tabindex: every visible row adds a page-level tab stop (50 extra Tab presses at pageSize 50), and Tab from outside enters the first citation cell rather than the grid's focused cell — with no focus ring, since LibraryDataGrid sets :focus-within { outline: none }.

The repo's own pattern at src/components/manage_users_table/ManageUsersTable.tsx:70-72 uses tabIndex={params.tabIndex} for exactly this reason.

Fix: use tabIndex={params.tabIndex}.

@kevinmarete

Copy link
Copy Markdown
Contributor Author

Both fixed in fdfc33ad, thanks — checked each premise and they hold.

  1. datasetCitation is required independently of the citation answer (darFormUtils.ts:396 is its own check), so uncited publications do carry text, and describeChild was handing it to a cell reading "No" as its accessible description. Tooltip now guarded on params.row.citation.

  2. Confirmed the full chain — ManageUsersTable.tsx:70-72 uses tabIndex={params.tabIndex} for exactly this, and LibraryDataGrid.tsx:155 does set :focus-within { outline: none }, so the stolen focus would have been invisible too. Now takes the grid's roving value.

Worth flagging on the test side: the existing tabindex assertion passed against either implementation, because the spec harness never passed tabIndex at all and the hardcoded 0 matched by accident. It now drives both 0 and -1, plus a case for the uncited-row-with-text combination from your first point.

@kevinmarete
kevinmarete force-pushed the km-dt-3313-ip-funding-filters branch from 19170c5 to ea019e8 Compare September 17, 2026 17:50
@kevinmarete
kevinmarete force-pushed the km-dt-3313-citation-column branch from fdfc33a to 40f85b3 Compare September 17, 2026 17:50

@otchet-broad otchet-broad 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 force-pushed the km-dt-3313-ip-funding-filters branch from ea019e8 to 2a353c6 Compare September 17, 2026 17:59
@kevinmarete
kevinmarete force-pushed the km-dt-3313-citation-column branch from 40f85b3 to 32a4043 Compare September 17, 2026 17:59
@kevinmarete
kevinmarete force-pushed the km-dt-3313-ip-funding-filters branch from 2a353c6 to 73b7c77 Compare September 17, 2026 18:08
@kevinmarete
kevinmarete force-pushed the km-dt-3313-citation-column branch from 32a4043 to fbdcb3c Compare September 17, 2026 18:08
@sonarqubecloud

Copy link
Copy Markdown

@otchet-broad otchet-broad 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.

👍

Base automatically changed from km-dt-3313-ip-funding-filters to develop September 17, 2026 19:15
kevinmarete and others added 8 commits September 17, 2026 15:16
Presentations and Publications each offered a Yes/No "Datasets Cited"
filter. A per-row fact reads better as a column than as a whole-study filter:
the Elasticsearch clause matches studies, so filtering by it hid the
non-citing presentations of a study that had any citing one.

Both grids now carry a Datasets Cited column alongside Access. A row indexed
without the field reads as "No", matching how both transforms default it, and
the citation text goes in the tooltip where the index carries it.

The retired params are deleted on every URL write rather than only when a
filter changes, so an old link's `datasetsCited` does not survive in the URL
for a user who never touches the filter panel.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Use the shared renderWithRouter helper rather than wrapping MemoryRouter
inline, and assert the column's per-row values by scoping to the row's
accessible role instead of filtering cells on a data-field attribute.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`useLibraryPageState` still built `datasetsCited` and
`publicationsDatasetsCited` option arrays after the keys left
`AvailableFilters`. The annotated `useMemo` result is not a fresh literal, so
no excess-property check caught them and the dead data survived at runtime.

The citation text is now the only place a citation itself is surfaced, so the
tooltip carrying it is worth a test — both grids assert it appears on hover
and that a row without one renders none.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The citation text was reachable only by pointer hover. The cell is now
focusable, and `describeChild` makes the citation the accessible description
rather than replacing Yes/No as the accessible name — the pattern
datasetColumns already uses.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The cited/uncited transform cases were added upstream to protect the predicate
while the filter was still configured. The filter is gone here, so they go too.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The Presentations and Publications specs each carried the same 58 lines
covering citationColumn, which is a single shared helper — Sonar flagged the
duplication and it was redundant on its own terms. Its behaviour moves to
sharedColumns.spec; each grid keeps a wiring assertion.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
datasetCitation is required on the publication form whatever the citation
answer, so uncited publications routinely carry text — a cell reading "No"
described itself with a citation. Guard the tooltip on the answer.

The hardcoded tabIndex also bypassed the DataGrid's roving tabindex, putting
every visible row in the page tab order and taking focus from the grid's own
focused cell, with no focus ring to show it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@kevinmarete
kevinmarete force-pushed the km-dt-3313-citation-column branch from fbdcb3c to 8cf6743 Compare September 17, 2026 19:16
@kevinmarete
kevinmarete merged commit 55972c3 into develop Sep 17, 2026
14 checks passed
@kevinmarete
kevinmarete deleted the km-dt-3313-citation-column branch September 17, 2026 19:21
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