Skip to content

feat(backend, website): rename get-data-to-edit endpoint and surface version comment via it#6412

Draft
theosanderson-agent wants to merge 1 commit into
mainfrom
feat/website-display-version-comment-via-renamed-endpoint
Draft

feat(backend, website): rename get-data-to-edit endpoint and surface version comment via it#6412
theosanderson-agent wants to merge 1 commit into
mainfrom
feat/website-display-version-comment-via-renamed-endpoint

Conversation

@theosanderson-agent
Copy link
Copy Markdown
Collaborator

@theosanderson-agent theosanderson-agent commented May 12, 2026

Summary

Alternative to #6395 implementing @theosanderson's suggestion: rename /get-data-to-edit/{accession}/{version} to /get-original-data-for-entry/{accession}/{version}, make it not error for revocations, and use it to display the revocation versionComment on the review card instead of adding a new field to the list response.

Backend

  • Rename endpoint path and the Kotlin function/description constant (getSequenceEntryVersionToEdit -> getOriginalDataForEntry, GET_DATA_TO_EDIT_SEQUENCE_VERSION_DESCRIPTION -> GET_ORIGINAL_DATA_FOR_ENTRY_DESCRIPTION).
  • Drop the \"is a revocation\" 422 short-circuit. Revocations have no processed data (they don't run through preprocessing), so SequenceEntryVersionToEdit.processedData is now nullable and the response is null for them.
  • Add isRevocation: Boolean to the response so the website can branch on it directly.
  • Rename GetDataToEditEndpointTest -> GetOriginalDataForEntryEndpointTest and flip the revocation test from "throws 422" to "returns the original data with versionComment in originalData.metadata and null processedData".

Website

  • Rename the alias/endpoint definition in backendApi.ts (getDataToEdit -> getOriginalDataForEntry), update BackendClient, the edit page, and the vitest mock.
  • useGetMetadataAndAnnotations no longer disables the query for revocations - it uses useGetOriginalDataForEntry for them too.
  • In ReviewCard, read data.originalData.metadata.versionComment (a Record<string, string> on the wire) and render it via KeyValueComponent next to the existing Revocation entry marker.
  • sequenceEntryToEdit zod schema gains isRevocation: boolean and processedData: ... | null. The metadata list, sequences dialog, files dialog, and EditableSequences defend against null processedData (or skip rendering, since you can't edit / view sequences for a revocation).
  • New review-page spec covers the revocation-with-comment render path.

Other consumers

Test plan

  • CI=1 npm run test (60 files, 653 tests passing) and npm run check-types clean.
  • Backend ./gradlew test --tests GetOriginalDataForEntryEndpointTest and SubmitProcessedDataEndpointTest green locally.
  • ./gradlew ktlintFormat clean.
  • Visual verification on a preview deployment: review-page card for a revocation with versionComment shows the new "Version comment" row and revocations without a comment behave as before.
  • Verify the existing edit flow on a normal (non-revocation) entry still loads its data from the renamed endpoint.

🤖 Generated with Claude Code

🚀 Preview: Add preview label to enable

…for-entry and support revocations

Rename the `/get-data-to-edit/{accession}/{version}` endpoint to
`/get-original-data-for-entry/{accession}/{version}` to reflect its
broader role: it now also serves the per-entry data needed to render
revocations on the review page, not just the data needed to populate the
edit form.

Behaviour changes:
- The endpoint no longer throws `422 Unprocessable Entity` for revocation
  versions. Revocations have no processed data (they never run through
  preprocessing), so `SequenceEntryVersionToEdit.processedData` is now
  nullable and returns `null` for them. `isRevocation` is added to the
  response so the website can branch on it without re-checking the list.
- The website's review card uses the same endpoint for revocations and
  pulls `versionComment` out of `originalData.metadata`, rendering it as
  a `Version comment` `KeyValueComponent` next to the `Revocation entry`
  marker. No extra field is added to the `/get-sequences` list response.

Other updates:
- Rename Kotlin function `getSequenceEntryVersionToEdit` -> `getOriginalDataForEntry`,
  description constant `GET_DATA_TO_EDIT_SEQUENCE_VERSION_DESCRIPTION`
  -> `GET_ORIGINAL_DATA_FOR_ENTRY_DESCRIPTION`, test class
  `GetDataToEditEndpointTest` -> `GetOriginalDataForEntryEndpointTest`,
  and the corresponding test helpers in `SubmissionControllerClient` and
  `SubmissionConvenienceClient`.
- Add a backend test asserting that a revocation entry returns its
  `versionComment` in `originalData.metadata` and `null` processedData.
- The CLI's `get_sequence_details` and the integration auth-rejection
  test point at the new path.
- The website's zod schema for `sequenceEntryToEdit` makes
  `processedData` nullable and adds `isRevocation`. `SequencesDialog`,
  `FilesDialog`, and `EditableSequences` defend against null
  `processedData`, and the review card no longer renders the metadata
  list, sequences viewer, or files viewer when `processedData` is
  absent.
- Add a website spec verifying the version comment renders on the
  review card for a revocation entry.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@claude claude Bot added backend related to the loculus backend component website Tasks related to the web application labels May 12, 2026
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 12, 2026

This PR may be related to: #4522 ("For revocation entries there is no way to review the version comment I added before approving the entry") — the PR directly addresses this by surfacing versionComment on the review card for revocation entries. Also tangentially related: #3135 ("Refactor and test version comments").

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

Labels

backend related to the loculus backend component website Tasks related to the web application

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants