Skip to content

Worksheet ORCIDs, track keywords, abstract limit and Remove poster - #83

Merged
JacobiClark merged 2 commits into
stagingfrom
sheet-review-fixes
Dec 1, 2026
Merged

JacobiClark merged 2 commits into
stagingfrom
sheet-review-fixes

Conversation

@jimnoneill

@jimnoneill jimnoneill commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Fixes from testing the Curious sheet on staging.

Changes

  • ORCIDs with a worksheet. Worksheet authors replace the extracted ones, and extracted ORCIDs only carried over when one extracted person matched. Worksheet authors still without an ORCID now go through the extraction API's ORCID lookup (new POST /api/bulk-poster-submissions/[jobId]/sheet-orcid-lookup, forwarding to POST /orcid/lookup) in the background after the sheet is applied. Found iDs fill empty ORCID cells as unsaved changes, with a toast. Cells the organizer fills meanwhile are left alone.
  • Name match for carried ORCIDs. carryIdentifiers also matches the same full name split differently (Wendy Jansen | Holleboom and Wendy | Jansen Holleboom). On 19 test posters with real extraction output, carried ORCIDs go from 73 to 75 of 85 sheet authors.
  • Track keywords. keywords_added (Curious track, EasyChair topics) is added to the poster's keywords instead of replacing what extraction found. Re-applying the sheet does not repeat them.
  • Submission abstract limit. 10,000 characters, four times ARVO's 2,500. The grid flags a longer one before saving, and the strict form refuses it.
  • Remove poster in the review grid. Each poster gets a Remove poster button under its name, with a confirm dialog. It deletes the draft and its file from the batch through staged-poster DELETE, which now also takes a posterId and refuses one this batch did not create. The poster's rows leave the grid without a reload, so unsaved edits to other posters stay.

Notes

  • Needs the extraction API with /orcid/lookup (posters-science-extraction-api PR to main). Without it the lookup fails quietly and the cell's Find ORCID still works.
  • nuxi typecheck: no new errors compared with staging.
  • Test set rebuilt: the Curious sheet is now the organizer's Curious template filled in (.xlsx), with whole abstracts.

Summary by Sourcery

Improve worksheet-based batch review with more reliable author identifiers, keyword merging, abstract validation, and poster removal.

New Features:

  • Find ORCID iDs for worksheet-listed authors in the background and fill matching empty ORCID cells as unsaved edits.
  • Remove a poster and its draft file from the batch directly in the review grid, with confirmation.

Bug Fixes:

  • Preserve extracted keywords when adding worksheet track or topic keywords, without duplicating them when the sheet is reapplied.
  • Carry extracted ORCIDs across when a person's full name matches despite being split differently between given and family names.
  • Reject submission abstracts longer than 10,000 characters in the review grid, workbook import, and strict submission form.
  • Keep batch review saves consistent when a poster is removed during a save, and prevent removing posters that were not created by that batch.

…oval in the grid

- Worksheet authors replace the extracted ones, so those without an ORCID go
  through the extraction API's ORCID lookup (POST /orcid/lookup, same strict
  rules as extraction) and fill as unsaved changes. Extracted ORCIDs also carry
  over when the same name is split differently (Wendy Jansen | Holleboom).
- A Curious track or EasyChair topic (keywords_added) is added to the poster's
  keywords instead of replacing them.
- Submission abstracts are limited to 10,000 characters, four times ARVO's
  2,500, in the grid check and the strict form.
- Remove poster in the review grid deletes that draft and its file from the
  batch; staged-poster DELETE takes a posterId from this batch.
@fairdataihub-bot

Copy link
Copy Markdown

Thank you for submitting this pull request! We appreciate your contribution to the project. Before we can merge it, we need to review the changes you've made to ensure they align with our code standards and meet the requirements of the project. We'll get back to you as soon as we can with feedback. Thanks again!

@sourcery-ai

sourcery-ai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

API

Define the 10,000-character submission-abstract limit in the strict form schema so submissions exceeding it are rejected.

  • app/utils/poster_schema.ts L9, L865-870

Add an authenticated endpoint that forwards worksheet-author ORCID lookups to the extraction API and returns results in input order.

  • server/api/bulk-poster-submissions/[jobId]/sheet-orcid-lookup.post.ts L1-103

Extend staged-poster DELETE to remove only batch-created drafts by poster ID while retaining its file-path removal behavior.

  • server/api/bulk-poster-submissions/[jobId]/staged-poster.delete.ts L1-12, L24-68, L74

Implementation

Merge worksheet track and topic keywords into existing keywords without duplicating them, and improve matching of creator names with differently split given and family names.

  • shared/utils/posterSheetToGrid.ts L54-67, L76-87, L204-214 (+2 small edits)

Centralize the abstract-length limit and user-facing validation message used by grid and workbook checks.

  • shared/utils/submissionAbstract.ts L1-6

Make batch poster removal update the job for successfully completed deletion steps even when a later cleanup step fails.

  • server/utils/bulkImportRemovePoster.ts L187-212, L252-253

Validate abstract length in workbook and grid imports, and skip posters removed during a concurrent grid save rather than failing the save.

  • server/utils/bulkReviewWorkbookImport.ts L109-131, L466-472, L1322-1341 (+6 small edits)

UI

Check abstract length before any grid save, including draft saves, and display the resulting validation issue.

  • app/components/conferences/BulkImportMetadataGrid.vue L30-33, L592-618, L910-916 (+1 small edits)

Look up missing worksheet-author ORCIDs in the background and apply results only when the poster and author identity still match and the cell remains empty.

  • app/components/conferences/BulkImportMetadataGrid.vue L356, L1577-1665

Add a confirmed Remove poster action that deletes the batch-created draft and file, removes its rows without reloading, and coordinates removal with saves.

  • app/components/conferences/BulkImportMetadataGrid.vue L1503-1576, L2442-2476 (+5 small edits)
  • app/components/conferences/BulkImportMetadataGridRow.vue L59, L110-119
  • app/components/conferences/BulkImportSpreadsheetStep.vue L3, L17, L75
  • app/components/conferences/ConferenceBulkImport.vue L1490-1496, L3185

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@fairdataihub-bot

Copy link
Copy Markdown

Thanks for making updates to your pull request. Our team will take a look and provide feedback as soon as possible. Please wait for any GitHub Actions to complete before editing your pull request. If you have any additional questions or concerns, feel free to let us know. Thank you for your contributions!

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 8 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="shared/utils/posterSheetToGrid.ts" line_range="57" />
<code_context>
+function fullName(row: BulkReviewGridRow): string {
+  return norm(`${row.given_name ?? ""} ${row.family_name ?? ""}`).replace(
+    / /g,
+    "",
+  );
+}
</code_context>
<issue_to_address>
**Wrong identifiers copied between authors**

When distinct names have given/family boundaries that produce the same space-stripped normalized name and only one extracted row matches, `fullName` removes every space, so `samePerson` treats the distinct authors as the same person and `carryIdentifiers` copies the extracted row’s identifiers to the worksheet author. The worksheet then shows identifiers belonging to someone else.

Preserve name-token boundaries when comparing names so distinct given/family splits are not treated as the same person.

Also at `shared/utils/posterSheetToGrid.ts:64-65`.
</issue_to_address>

### Comment 2
<location path="app/components/conferences/BulkImportMetadataGrid.vue" line_range="1623" />
<code_context>
+      orcidLookedUp.add(personKey(row));
+      const orcid = orcids[index];
+      // Leave a cell the organizer filled while the lookup ran.
+      if (!orcid || (row.name_identifier ?? "").trim()) return;
+      onCellInput(row, "name_identifier", orcid);
+      found += 1;
</code_context>
<issue_to_address>
**Old ORCID attached to edited author**

When an organizer changes a worksheet author’s name or affiliations while the ORCID lookup is in flight, `lookupSheetCreatorOrcids` checks only that the row is still present and its ORCID cell is empty, then `onCellInput` writes the result for the submitted identity onto the edited row. The grid shows an ORCID for a different person.

Before applying the lookup result, verify that the row’s name and affiliations still match the values submitted for that lookup.

Also at `app/components/conferences/BulkImportMetadataGrid.vue:1624`.
</issue_to_address>

### Comment 3
<location path="server/api/bulk-poster-submissions/[jobId]/staged-poster.delete.ts" line_range="47" />
<code_context>
+        statusMessage: "Poster not found in this import",
+      });
+    }
+    const result = await removePostersFromBulkImportJob(
+      session.user.id,
+      jobId,
</code_context>
<issue_to_address>
**Failed removal leaves stale batch state**

When draft deletion succeeds but a subsequent Bunny or file cleanup, or job update, fails, `removePostersFromBulkImportJob` has already deleted the draft when the later step fails, leaving the batch’s poster or staged-file records unchanged. The request fails while the batch still references the deleted poster.

Make draft deletion and batch/file cleanup atomic, or reconcile the batch state when a later removal step fails.
</issue_to_address>

### Comment 4
<location path="app/components/conferences/BulkImportMetadataGrid.vue" line_range="575-585" />
<code_context>
       const posterName = posterDisplayName(row.poster_id ?? "");

+      const abstractLength = (row.submission_abstract ?? "").length;
+      if (abstractLength > MAX_SUBMISSION_ABSTRACT_CHARS) {
+        issues.push({
+          code: "submission_abstract_too_long",
+          message: `${posterName}: ${submissionAbstractTooLongMessage(abstractLength)}`,
+          severity: "error",
+          sheet: sheet.name,
+          rowNumber: rowIndex + 1,
+          field: "submission_abstract",
+          posterId: row.poster_id,
+        });
+      }
+
       for (const column of editable) {
</code_context>
<issue_to_address>
**Grid API saves overlong abstracts**

When a metadata-grid API caller submits a `submission_abstract` longer than 10,000 characters, a caller that bypasses the browser check can POST an abstract longer than 10,000 characters to the metadata-grid endpoint: its request schema allows cells up to 100,000 characters, and the importer persists the value without enforcing the abstract limit. The saved poster then fails strict validation.

Enforce the abstract limit in the server-side metadata-grid import path as well as in the browser.
</issue_to_address>

### Comment 5
<location path="app/components/conferences/BulkImportMetadataGridRow.vue" line_range="118" />
<code_context>
+          label="Remove poster"
+          class="mt-1 -ml-2 flex opacity-60 group-hover:opacity-100 focus-visible:opacity-100"
+          :aria-label="`Remove ${posterName} from this batch`"
+          @click="emit('removePoster', row.poster_id ?? '')"
+        />
       </span>
</code_context>
<issue_to_address>
**Concurrent save partially applies edits**

When the organizer confirms removal while a metadata save covering that poster is in flight, the metadata save can read the poster before `removePostersFromBulkImportJob` deletes it, then fail when `applyPatchToPoster` updates that deleted poster. Since the save applies patches to posters concurrently, updates for other posters can already commit while the request reports failure, leaving the grid’s save result inconsistent with persisted metadata.

Serialize poster removal with metadata saves, or make the save handle posters deleted during the request without rejecting after applying only some patches.
</issue_to_address>

### Comment 6
<location path="app/components/conferences/BulkImportMetadataGrid.vue" line_range="1619" />
<code_context>
+    // A reload replaced the rows: the next load looks up the new ones.
+    const current = new Set(sheetRows.value[CREATORS_SHEET] ?? []);
+    batch.forEach((row, index) => {
+      if (!current.has(row)) return;
+      orcidLookedUp.add(personKey(row));
+      const orcid = orcids[index];
</code_context>
<issue_to_address>
**Lookup result lost during save**

When a poster is saved before its worksheet-author ORCID lookup returns, a save can reload the grid and replace the row objects while the lookup is in flight. This check then discards the result; because `onGridSaved` also removes the successfully saved poster from `posterSheetUnsaved`, the worksheet author is not looked up again and the found ORCID is lost.

Keep or retry outstanding lookup results across saves, or defer clearing the pending worksheet entry until its lookup has completed.
</issue_to_address>

### Comment 7
<location path="server/api/bulk-poster-submissions/[jobId]/staged-poster.delete.ts" line_range="41-45" />
<code_context>
+      (job?.submissionSummary as BulkImportSubmissionSummary | null)
+        ?.createdPosters ?? [];
+    // Only a draft this batch created; never another of the user's drafts.
+    if (!job || !created.some((entry) => entry.posterId === posterId)) {
+      throw createError({
+        statusCode: 404,
+        statusMessage: "Poster not found in this import",
+      });
+    }
+    const result = await removePostersFromBulkImportJob(
</code_context>
<issue_to_address>
**Retried removal reports failure**

When the server completes removal but the response is lost and the client retries the DELETE, after a successful removal, the helper removes the poster from `createdPosters`; a retried DELETE then fails this membership check with 404 instead of returning the already-removed state. If the first response was lost, the caller sees an error even though the poster was removed.

Treat a poster previously removed from this batch as an idempotent success, or return an explicit already-removed result on retry.
</issue_to_address>

### Comment 8
<location path="app/components/conferences/BulkImportMetadataGrid.vue" line_range="575" />
<code_context>
       const posterName = posterDisplayName(row.poster_id ?? "");

+      const abstractLength = (row.submission_abstract ?? "").length;
+      if (abstractLength > MAX_SUBMISSION_ABSTRACT_CHARS) {
+        issues.push({
+          code: "submission_abstract_too_long",
</code_context>
<issue_to_address>
**Draft save skips abstract limit**

When a poster has an abstract longer than 10,000 characters and the organizer uses Save draft, `save()` calls `collectAllValidationIssues` with `validate: false`, and that option skips `collectGridRequiredIssues`; an over-limit abstract is therefore saved without the new grid error or warning, despite the stated pre-save limit.

Run the abstract-length check on draft saves too, separately from required-field validation, or reject over-limit abstracts in the grid-save handler.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 7 findings to address first, and the new DELETE path removes a batch-created poster and its file after checking that it belongs to the user’s batch. If the wrong poster is removed, reverting the code will not restore its draft or metadata; it would need to be uploaded and recreated.

Blocking findings: shared/utils/posterSheetToGrid.ts:57, app/components/conferences/BulkImportMetadataGrid.vue:1623, server/api/bulk-poster-submissions/[jobId]/staged-poster.delete.ts:47, app/components/conferences/BulkImportMetadataGrid.vue:585, app/components/conferences/BulkImportMetadataGridRow.vue:118, and 2 more


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread shared/utils/posterSheetToGrid.ts Resolved
statusMessage: "Poster not found in this import",
});
}
const result = await removePostersFromBulkImportJob(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Failed removal leaves stale batch state

When draft deletion succeeds but a subsequent Bunny or file cleanup, or job update, fails, removePostersFromBulkImportJob has already deleted the draft when the later step fails, leaving the batch’s poster or staged-file records unchanged. The request fails while the batch still references the deleted poster.

Make draft deletion and batch/file cleanup atomic, or reconcile the batch state when a later removal step fails.

Prompt for AI agents
In `server/api/bulk-poster-submissions/[jobId]/staged-poster.delete.ts` at line 47:

**Failed removal leaves stale batch state**

When draft deletion succeeds but a subsequent Bunny or file cleanup, or job update, fails, `removePostersFromBulkImportJob` has already deleted the draft when the later step fails, leaving the batch’s poster or staged-file records unchanged. The request fails while the batch still references the deleted poster.

Make draft deletion and batch/file cleanup atomic, or reconcile the batch state when a later removal step fails.

// A reload replaced the rows: the next load looks up the new ones.
const current = new Set(sheetRows.value[CREATORS_SHEET] ?? []);
batch.forEach((row, index) => {
if (!current.has(row)) return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Lookup result lost during save

When a poster is saved before its worksheet-author ORCID lookup returns, a save can reload the grid and replace the row objects while the lookup is in flight. This check then discards the result; because onGridSaved also removes the successfully saved poster from posterSheetUnsaved, the worksheet author is not looked up again and the found ORCID is lost.

Keep or retry outstanding lookup results across saves, or defer clearing the pending worksheet entry until its lookup has completed.

Prompt for AI agents
In `app/components/conferences/BulkImportMetadataGrid.vue` at line 1619:

**Lookup result lost during save**

When a poster is saved before its worksheet-author ORCID lookup returns, a save can reload the grid and replace the row objects while the lookup is in flight. This check then discards the result; because `onGridSaved` also removes the successfully saved poster from `posterSheetUnsaved`, the worksheet author is not looked up again and the found ORCID is lost.

Keep or retry outstanding lookup results across saves, or defer clearing the pending worksheet entry until its lookup has completed.

…poster removal

- Keep word breaks when matching worksheet authors to extracted ones, so
  run-together names no longer pick up someone else's identifiers.
- Apply background ORCID lookups by poster and the identity sent, not the
  row object: results survive a save's reload and are dropped when the
  name or affiliations changed meanwhile.
- Check the submission abstract limit before every save (Save draft too)
  and enforce it on the server for grid saves and workbook uploads.
- Skip posters removed during a grid save instead of failing part way;
  don't remove a poster while a save runs, or save while a removal runs.
- Update the batch for whatever a removal already deleted when a later
  step fails, and treat a retried DELETE of a removed poster as success.
@JacobiClark
JacobiClark merged commit 16fb321 into staging Dec 1, 2026
1 check passed
@JacobiClark
JacobiClark deleted the sheet-review-fixes branch December 1, 2026 20:18
@fairdataihub-bot

Copy link
Copy Markdown

Thank you for getting this pull request merged. We appreciate your contribution and look forward to your next one!

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.

2 participants