Repository navigation
FIX: keep the newest converter input when an older file read finishes late - #3895
Rashi Chauhan (RashiChauhan67) wants to merge 1 commit into
Conversation
… 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>
There was a problem hiding this comment.
🟢 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
|
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 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. |
Description
Fixes #3872.
browse()inCreateConverterDialog.tsxonly checked that the dialog opening was unchanged before applying aFileReaderresult. 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.tsxunder "overlapping file reads":Run from
frontend/afternpm ci: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 passedin 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.