Skip to content

FIX: keep the newest converter input when an older file read finishes late - #3895

Closed
Rashi Chauhan (RashiChauhan67) wants to merge 1 commit into
microsoft:mainfrom
RashiChauhan67:fix-converter-file-read-ownership
Closed

Rashi Chauhan (RashiChauhan67) wants to merge 1 commit into
microsoft:mainfrom
RashiChauhan67:fix-converter-file-read-ownership

Conversation

@RashiChauhan67

Copy link
Copy Markdown

Description

Fixes #3872.

browse() in CreateConverterDialog.tsx only checked that the dialog opening was unchanged before applying a FileReader result. A read that finished after a newer upload, or after a manually typed value, therefore overwrote that value, and the overwritten value was what got submitted.

Each parameter now has an owner: the most recent upload or manual edit. Starting an upload and editing the field (both the plain input and the structured/multiline field) claim the parameter, and a read result is applied only while its upload still owns it. The existing open-epoch check is unchanged.

Scope note: this covers the two cases in the report (a newer upload and a newer manual value for the same parameter). It does not change what happens when the converter type is switched while a read is pending, which was not part of the report.

Tests and Documentation

Added three tests in CreateConverterDialog.test.tsx under "overlapping file reads":

  • upload A, then B; B finishes first and A last: the field and the submitted payload stay B
  • control: A finishes first, then B: both apply in order and B is submitted
  • upload A, then type a manual path; A finishes: the manual path stays and is submitted

Run from frontend/ after npm ci:

npx jest src/components/Registry/CreateConverterDialog.test.tsx
Tests: 64 passed, 64 total

npm run lint
npm run type-check

Both lint and type-check completed with no output. With the component change stashed, the new tests fail for the two race cases and the in-order control passes (2 failed, 1 passed in the new group). I did not run the rest of the frontend test suite, the Playwright e2e tests or the Python tests, since only these two frontend files changed. No documentation changes, as there is no user-facing change beyond the fix. JupyText is not applicable.

… late

A FileReader callback only checked that the dialog opening was unchanged, so a read that finished after a newer upload or a manual edit overwrote that value and was then submitted. Each parameter now has an owner, claimed by every upload and manual edit, and a read result is applied only while its upload still owns the parameter.

Fixes microsoft#3872

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 3, 2026 19:43

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

No active review issues were identified for the change intended to prevent late file reads from overwriting newer uploads or manual values.

No open issues 🎉

What changed in this PR

Fixes #3872 by preventing late converter file reads from overwriting a newer upload or manual value in the same dialog opening.

Changes:

  • Tracks ownership per parameter and applies file-read results only while that upload still owns the field.
  • Preserves the existing dialog-opening guard; converter-type switching remains outside scope.
  • Adds regression tests for overlapping uploads and manual edits, checking both displayed values and submitted build parameters.
File Description
frontend/​src/​components/​Registry/​CreateConverterDialog.tsx Adds ownership checks for uploads and manual edits.
frontend/​src/​components/​Registry/​CreateConverterDialog.test.tsx Tests both file-read completion orders and manual edits during pending reads.

Review effort: Balanced

@hannahwestra25 hannahwestra25 self-assigned this Nov 9, 2026
@hannahwestra25

Copy link
Copy Markdown
Collaborator

Thanks for the fix and regression coverage. Since this PR was opened, #3648 merged with a broader implementation of the same ownership behavior. The current main branch uses per-parameter file-read tokens and already covers both cases from #3872: a newer selection wins over an older late read, and a manual edit invalidates a pending read. It also integrates that behavior with drag-and-drop, Remove, form resets, file metadata, and read errors.

This PR now conflicts with that implementation. Resolving the conflict by retaining these changes would either introduce a second ownership mechanism or regress the newer file-input behavior. I recommend closing this PR as superseded by #3648 and closing #3872 as already fixed. The original approach here was sound; the target branch changed after the PR was opened.

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.

Late converter file reads overwrite newer uploads or manual path edits

3 participants