IGVF-3459 Add file download to pseudobulk-set pages#1046
Merged
Conversation
Collaborator
Author
Code Review: IGVF-3459 Add file download to pseudobulk-set pages
FindingsLow
Not a Finding (Intent Clarified)
Testing Notes
Conclusion
|
There was a problem hiding this comment.
Pull request overview
This PR adds/updates pseudobulk-set detail functionality (including file download actions) while converting the pseudobulk-set page to TypeScript and introducing shared request/type-guard utilities across the lib layer to reduce casting and improve safety.
Changes:
- Replaces the pseudobulk set detail page (
pages/pseudobulk-sets/[id]) with a TypeScript implementation and server-side data fetching for associated objects (files, samples, donors, publications, etc.). - Adds shared helpers for file-set–related requests and strengthens several shared request utilities/type guards.
- Updates global typings and expands Jest coverage for the new helpers/guards.
Reviewed changes
Copilot reviewed 26 out of 27 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| pages/pseudobulk-sets/[id].tsx | New TS pseudobulk-set detail page with server-side data loading and download UI integration |
| pages/pseudobulk-sets/[id].js | Removes the prior JS implementation of the pseudobulk-set page |
| pages/users/[uuid].tsx | Tightens SSR typing and adds a params not-found guard |
| pages/computational-tools.tsx | Uses isSearchResults guard and updates SSR error handling path |
| pages/assays.tsx | Adds a matrix-response guard and tweaks table header sizing |
| components/add.tsx | Adds void for unhandled promises; adjusts types |
| components/file-graph/file-set-modal.tsx | Strengthens guards for mixed embedded/link fields; improves grid typing |
| components/institutional-certificate-table.tsx | Types the sortable grid configuration and simplifies render signatures |
| components/search/list-renderer/index.tsx | Adds explicit accumulator typings to reduce calls |
| lib/file-sets.ts | New helper module for requesting associated file-set linked objects |
| lib/files.ts | Adds helpers for file-set retrieval and for requesting reference/quality-metric objects |
| lib/common-requests.ts | Strengthens return types and generics for requests (files, quality metrics, supersedes, etc.) |
| lib/database-object.ts | Enhances DB object guards and adds pathsFromDatabaseObjects |
| lib/errors.ts | Makes errorObjectToProps generic for SSR typing |
| lib/facets.ts | Uses isSearchResults instead of casting for facet retrieval |
| lib/search-results.ts | Adds isSearchResults type guard |
| lib/types.ts | Adjusts isEmbeddedArray behavior to require non-empty arrays |
| lib/ontology-terms.ts | Allows profiles to be null in preferred assay title mapping |
| lib/next-js.ts | New shared PageProps shape for SSR-returned page props |
| lib/data-grid.ts | Makes CellContentProps.id and .source required in typings |
| globals.d.ts | Refactors LinkTo<T> usage, strengthens DatabaseObject, and adjusts SearchResults definition |
| lib/tests/search-results.test.ts | Adds tests for isSearchResults |
| lib/tests/files.test.ts | Adds tests for new file helpers and updates fixtures |
| lib/tests/file-sets.test.ts | New tests for lib/file-sets request helpers |
| lib/tests/facets.test.ts | Updates facet tests to satisfy the new isSearchResults guard |
| lib/tests/database-objects.test.ts | New tests for database-object guards and pathsFromDatabaseObjects |
| lib/tests/common-requests.test.ts | Updates fixtures/expectations for typed request changes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
* Convert pseudobulk sets page to Typescript. * Move the new functions to retrieve objects related to file sets to a new `lib/file-sets.ts` file. This will have to be merged with the same file in another branch. * Allow database-object helpers and file-set request utilities to accept arrays of paths as well as embedded objects, including embedded arrays without @type values. This updates pseudobulk set data loading to use the shared path extraction logic and adds donor links to the file-set type definition. * Add Jest coverage for file set association helpers, including associated file sets, donors, publications, and samples. The tests verify successful bulk fetches, deduped related objects, empty relationship handling, and non-database object inputs. * Update the Jest tests for lib/common-requests.ts. * Add tests for database object type guards, array validation, type-specific checks, and path extraction behavior. Update the donor object type so documents can be omitted when absent from donor responses. * Get full Jest coverage for lib/files.ts. * Fix build errors from the latest Typescript changes. Update Jest tests with these new changes. * Relax the search-results guard to accept any @type array and simplify file graph child-file handling now that native file paths are already validated. Also clean up assay comments and remove a stale commented assignment. * Correct a comment.
904521c to
2d55ba3
Compare
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.
Code Review —
IGVF-3459-pseudobulk-dpwnloadReviewed by GitHub Copilot (Claude Sonnet 4.6)
Summary of Changes
This branch converts
pages/pseudobulk-sets/[id].jsfrom JavaScript to TypeScript and adds a full pseudobulk set detail page. It also introduces several type-safety and refactoring improvements across the lib layer that benefit multiple pages.Files Reviewed
pages/pseudobulk-sets/[id].tsxlib/file-sets.tslib/next-js.tsPagePropsinterfacelib/database-object.tspathsFromDatabaseObjectslib/common-requests.tsrequestSupersedes<T>lib/files.tsgetFilesFileSets,requestFilesQualityMetrics, removed ad-hoc type guardslib/errors.tserrorObjectToProps<T>lib/search-results.tsisSearchResultstype guardlib/facets.tsisSearchResultsinstead of castlib/types.tsisEmbeddedArrayfix,LinkTo<T>typeglobals.d.tsLinkTo<T>on union fields,SearchResultsdecoupled fromDatabaseObject,statusrequired,submitter_commentmoved toDatabaseObjectlib/data-grid.tsCellContentPropsfields made requiredlib/ontology-terms.tsprofilesacceptsnullcomponents/add.tsxvoidon unhandled promisescomponents/file-graph/file-set-modal.tsxinput_file_forguardcomponents/institutional-certificate-table.tsxcomponents/search/list-renderer/index.tsxreduceaccumulatorspages/assays.tsxisMatrixResultsObjectguard, cleaner variable namingpages/computational-tools.tsxisSearchResults, remove castpages/users/[uuid].tsxlib/__tests__/…Observations
lib/file-sets.tsis a clean extraction that eliminates copy-pasted patterns across page files.pathsFromDatabaseObjectshandles both the embedded-object and path-string cases uniformly, which simplifies all call sites.errorObjectToProps<T>being generic removesas unknown ascasts that were scattered acrossgetServerSidePropsimplementations.isDatabaseObjectArrayreturningfalsefor empty arrays is consistent withisDatabaseObjectArrayOfTypeandisEmbeddedArray, but callers should be aware this is a deliberate convention.isSearchResultschecking@type.length === 1is stricter than other type guards in the codebase (which use.includes()). This is fine as long as the backend never adds extra entries to@typeon search responses.statusrequired onDatabaseObjectis correct for well-formed objects but may require attention in test fixtures that omit it — the updated tests handle this.Conclusion
The branch is in good shape. The overall direction — replacing ad-hoc casts and inline type guards with shared, well-tested utilities — makes the codebase meaningfully safer and easier to maintain. Ready to merge.