Skip to content

Conversation

@anna-parker
Copy link
Contributor

@anna-parker anna-parker commented Feb 6, 2026

resolves #5944, #5943

Screenshot

PR Checklist

  • All necessary documentation has been adapted.
  • The implemented feature is covered by appropriate, automated tests.
  • Any manual testing that has been done is documented (i.e. what exactly was tested?)

🚀 Preview: https://displayname.loculus.org

@anna-parker anna-parker added the preview Triggers a deployment to argocd label Feb 6, 2026
@claude claude bot added website Tasks related to the web application deployment Code changes targetting the deployment infrastructure labels Feb 6, 2026
@anna-parker anna-parker changed the title use a custom displayName for segments and references feat(website): use a custom displayName for segments and references and remove segmentName prefix for nucleotide mutation/insertion/deletion search Feb 10, 2026
suborganismSegmentAndGeneInfo: SegmentAndGeneInfo,
): MutationSearchParams => {
const mutationFilter = parseMutationsString(mutation ?? '', suborganismSegmentAndGeneInfo);
const mutationParamName = getReferenceIdentifier(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is kinda ugly and caused a bug... probably would be good to revisit if there is a tidier way to do this

@anna-parker anna-parker force-pushed the search_ui_demo branch 2 times, most recently from 7679605 to 30fb152 Compare February 12, 2026 19:47
@anna-parker anna-parker marked this pull request as ready for review February 12, 2026 20:08
@anna-parker anna-parker merged commit 4344b80 into search_ui_demo Feb 12, 2026
36 of 40 checks passed
@anna-parker anna-parker deleted the displayName branch February 12, 2026 20:08
@claude
Copy link
Contributor

claude bot commented Feb 12, 2026

Claude finished @anna-parker's task in 2m 49s —— View job


Code Review Complete

I've performed a comprehensive review of PR #5953. This PR successfully introduces custom display names for segments and references while removing segment name prefixes from nucleotide mutation/insertion/deletion searches.


Summary

Strengths:

  • ✅ Well-tested with comprehensive coverage across multiple scenarios (single-segmented, multi-segmented, multi-reference)
  • ✅ Clear separation between internal LAPIS names and user-facing display names
  • ✅ Consistent handling of the displayName pattern throughout the codebase
  • ✅ Good backward compatibility - displayName is optional with sensible fallbacks

Detailed Findings

1. Error Handling in Mutation Parsing

Location: website/src/utils/mutation.ts (lines 133, 166, 208, 243)

Issue: Multiple empty catch blocks silently swallow all errors during mutation parsing. This makes debugging difficult when parsing failures occur.

Current code:

try {
    // parsing logic
} catch (_) {
    return INVALID;
}

Recommendation: Log errors in development mode:

} catch (error) {
    if (process.env.NODE_ENV === 'development') {
        console.warn('Failed to parse mutation query:', text, error);
    }
    return INVALID;
}

Relates to: The author's comment "this is kinda ugly and caused a bug..." - error logging would help catch similar issues in the future.


2. Empty String Edge Case

Location: website/src/components/SequenceDetailsPage/MutationBadge.tsx:82

Issue: The segment value can be an empty string for single-segmented organisms (set in getTableData.ts:244), rendering an empty <h2> header.

Recommendation:

{segment && <h2 className='py-1 my-1 font-semibold border-b'>{segment}</h2>}

3. Technical Debt - Type Safety

Location: website/src/components/SearchPage/DownloadDialog/SequenceFilters.tsx:6

Issue: ESLint disable comments for any types with reference to TODO #3451. Using any defeats TypeScript's type safety, which is particularly important for display name transformations.

Recommendation: Prioritize issue #3451 to add proper typing to this file.


4. Missing Documentation for Display Name Convention

Location: website/src/utils/sequenceTypeHelpers.ts:189

Issue: The lapisNameToDisplayName() function returns undefined for single-segmented organisms but the segment name for multi-segmented organisms. This convention is important but not documented.

Recommendation: Add JSDoc:

/**
 * @param referenceGenomesInfo - The reference genome lightweight schema
 * @returns Map from LAPIS names to display names (segment or gene names).
 * For single-segmented genomes, the segment displayName is `undefined` since 
 * there's no ambiguity. Genes always have their name as the displayName.
 */

5. Documentation Checklist Incomplete

The PR checklist shows:

  • All necessary documentation has been adapted
  • Manual testing documentation

Recommendation: Update user-facing documentation for the mutation search feature, particularly since this PR removes segment name prefixes from the search syntax.


Testing Assessment

Excellent test coverage:

  • Comprehensive tests in mutation.spec.ts covering all organism types
  • Tests in getTableData.spec.ts verify proper display name mapping
  • Tests in ReferenceSelector.spec.tsx verify UI behavior
  • Edge cases are well covered

Security & Performance

✅ No security vulnerabilities identified
✅ No performance concerns
✅ Changes maintain existing patterns without introducing inefficiencies


Author's Concerns Addressed

1. "not sure I can actually use this..." (config.ts)

  • ✅ The optional displayName field is properly implemented
  • ✅ The fallback pattern to sentenceCase(name) is consistently applied throughout the codebase
  • ✅ This is a solid implementation

2. "this is kinda ugly and caused a bug..." (mutation.ts)

  • ⚠️ The mutation parsing logic is complex but necessarily so
  • ⚠️ Empty catch blocks could hide bugs (see recommendation #1 above)
  • Consider refactoring if this becomes a maintenance burden

Overall Assessment

This is a well-executed PR that achieves its goals with:

  • Solid implementation
  • Good test coverage
  • Backward compatibility
  • Consistent patterns

Main recommendations:

  1. Add error logging to mutation parsing
  2. Handle empty segment names in UI
  3. Complete documentation checklist items
  4. Address the type safety technical debt when possible

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

Labels

deployment Code changes targetting the deployment infrastructure preview Triggers a deployment to argocd website Tasks related to the web application

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant