Repository navigation
fix(fields): after a same-edit currency change, a pick's amounts stay and their notes follow the new currency - #37284
Draft
objectstack-fleet[bot] wants to merge 2 commits into
Draft
objectstack-fleet[bot] wants to merge 2 commits into
objectstack-fleet[bot] wants to merge 2 commits into
Conversation
Claude-Session: https://claude.ai/code/session_01QSeKYnagJvGbCtNg2PhvgW Co-authored-by: Claude <noreply@anthropic.com>
…shes the notes Claude-Session: https://claude.ai/code/session_01QSeKYnagJvGbCtNg2PhvgW Co-authored-by: Claude <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #36412
repo:objectstack#4 · os-justin · session_01QSeKYnagJvGbCtNg2PhvgW
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
The ruling item on this card (comment 7118795825, 「保留金额并提示」) and its branch B (comment 7158109013), on both hosts: the line-item grid (
GridFieldWidget) and the record form (LookupFieldwith the declared pairs). Scope is bounded by ADR-0144 D2: new records, records with no saved lines, lines staged in the same edit, and declared pairs on the record's own amounts. Items 1–4 landed in #36918. With this PR the card's last open item is done.main(057cedfa9b6): nothing writes an amount when the code changes. The new pins were run against main's source files, and every amount assertion passed there; the only failures were the note lines that come after them (see Tests). Pinned either way, on both hosts. This PR adds no write.judgePickWritesnow records each amount it copies asCopiedAutofill(target,source,value,under: the code the target was in at the write). The plan gainscopied. Each host keeps these beside the withheld values of the same pick. When drawing, it shows "Unit Price was copied as $100.00, but the record is now in EUR. Enter Unit Price in EUR if it should change." only when all of these hold (copiedAutofillNow): the field still holds that pick, the target still holds the copied value, and the code the target is in now is known and differs fromunder. A currency change back ends the note.withheldAutofillNowjudges each shown withheld item again withcrossCurrencyRefusal, using the picked amount's own currency (itsfrom) against the target's currency as it is now. The note follows the new code, and its reason too: a code cleared reads "no currency is chosen".nowSameCurrency, the note stays and the cell stays empty: "Unit Price was not filled when it was picked. The record is now in USD: pick again to fill $100.00." A pick again fills it (pinned as the control on the record form).gridAutofillCurrencyon the current line, withcolumnCurrencies(a header-following line) orcolumnFields(the line's own code). On the record form it iscurrencyForon the live record, followed parent included. So a code written later in the edit is read exactly as a pick would read it.lookup.autofillNowSameCurrencyandlookup.autofillCopiedUnder, in all 11 packs (zh-Hant generated bygen:zh-hant) and inFIELD_DEFAULTS..changeset/36412-currency-change-notes.md:@object-ui/fieldsand@object-ui/i18n, bothpatch. The fix(fields): a pick says why it kept a filled amount, the opening fill stops waiting on an unreadable parent, and a code-plus-amount pick copies both #36918 changeset is left untouched.@object-ui/plugin-formchanges in its test file only, which is not published.Tests
Tests on head
482148532, all underos-verify-lock:pnpm --dir ui exec vitest run --maxWorkers=2 packages/fields/ packages/plugin-form/ packages/i18n/gives Test Files 686 passed, 1 skipped (687), and Tests 9840 passed, 21 skipped (9861),VERDICT command-exit 0.type-checkof@object-ui/fields,@object-ui/plugin-formand@object-ui/i18nexits 0, after the closure build. Both pin files are in thetsconfig.test.jsonprogram (--listFiles: 1 hit each).New pins, the point 1 measurement, and ablations
ObjectForm.lookupAutofill-28245.test.tsx, new describe "a same-edit currency change keeps amounts and says so", 4 tests throughObjectForm. (1) A USD quote picks a $100 product. Changed to EUR, it keeps 100 and shows the copied note with its exact text. Control: before the change there is no note, and changing back to USD ends it. (2) A JPY quote's withheld note names GBP and no longer JPY after the code becomes GBP, and the price stays empty. (3) Branch B: a EUR quote's withheld note reads exactly "Unit Price was not filled when it was picked. The record is now in USD: pick again to fill $100.00." once the code becomes USD, and the price stays empty. Control: the pick again fills 100 and no note remains. (4) A typed 55 gets no note through a currency change, and neither does 55 typed over a copied 100.GridField.lookupAutofill-28245.test.tsx, new describe of the same name, 5 tests. The same four cases throughGridField, with the header currency handed in ascolumnCurrenciesand changed by a rerender, for a product priced in EUR. One more is pure:withheldAutofillNowfollows the currency now,nowSameCurrencyapplies when it matches, and with no currency known the item is returned unchanged;copiedAutofillNownames a differing code only while the target holds the copied value. The Cross-currency pick follow-ups: no note on a re-pick over a filled cell, an unbounded opening wait, record forms outside the gate, and a code-plus-amount pick #36412 declared-pairs pin now also assertscopied(the price is recorded under the code the same pick wrote).057cedfa9b6in the tree only, the-t rulingpins were run, and the files were restored withgit checkout HEAD(git diff HEADempty afterwards). Result: 7 failed, 2 passed. The two hand-typed pins passed. Both copied-amount pins failed on the note line after their amount assertion (ObjectForm line 745, GridField line 641): the amount kept its value through the currency change on main. The refresh and branch B pins failed on their note text, and the pure pin failed on the missing export. Point 1 has no implementing line to ablate: nothing writes an amount on a currency change, before or after this PR.scripts/ablation-replace.mjs(lookupAutofill.ts; vitest aliases@object-ui/*tosrc, so nodistsits between mutation and run),-t ruling, each restored to the HEAD blob18535d11faef:if (!now) return item;becomesreturn item;(no refresh): Tests 5 failed, 4 passed. Refresh and branch B on both hosts, plus the pure pin.return to && to !== item.under ? to : undefined;becomesreturn undefined;(no copied note): Tests 3 failed, 6 passed. Copied note on both hosts, plus the pure pin.if (!sameValue(current, item.value) || !now) return undefined;becomesif (!now) return undefined;(a typed-over amount keeps the note): Tests 3 failed, 6 passed. Hand-typed on both hosts, plus the pure pin.Acceptance notes
no: the diff touches nopackages/spec/**and no metadata. On the published@object-ui/fieldssurface it adds exports and widens one union (WithheldAutofill.reason), andLookupAutofillPlangains a requiredcopied.git grepat482148532findsLookupAutofillPlanbuilt or read only insideui/packages/fields(6 hits, 2 files), so no consumer anywhere builds one.held, keeps the kept sentence after the branch B sentence. For a declared pair withoutoverwrite, a pick again of the same record does not replace that earlier value (the spec's overwrite rule: it was not filled by this record), so "pick again" is then true only after the cell is cleared. The ruling describes the empty-cell case, which is what is pinned. Noted, not filed.Verification
Gates
dispatch-gates --commands(no paths, change set from the merge base) derived 41 commands at482148532. All 41 ran with exit 0.pnpm --dir ui exec vitest run scripts/ran under the lock with--maxWorkers=2: Test Files 172 passed, 2 skipped, and Tests 5130 passed, 2 skipped.dispatch-gates --ranwith exit codes recorded: 41 derived, 41 run, 0 NOT-MEASURED, 0 UNRUN, exit 0.check:i18n-keys,check:i18n-drift,check:i18n-dead-keysandcheck:new-line-citations: exit 0, with 0 new citations.overlap-checkbefore each push: VERDICT clean, exit 0. Re-read aftergit fetchagainstorigin/main622f3985feand 5 PR heads that share files (fix(console): a partly failed bulk approve names each failed row with its reason #37282, fix(app-shell)!: Home no longer offers Build with AI or Build an app #37249, feat(studio): open Studio's dashboards and reports in the app's edit state; × returns to the list #37226, feat(ai): get_record_context joins the service-ai platform tool group, with its chat label (ADR-0160 row 9) #37210, feat(studio): remove the Studio home; /studio opens the last package or Setup > Packages #37166): clean.--pr=37264named explicitly: merges cleanly.Read first, by risk: (1)
judgeCopy,withheldAutofillNowandcopiedAutofillNowinlookupAutofill.ts; (2) the note block at the end ofLookupField.tsx(pickStands,currencyNow); (3) the per-row note block inGridFieldWidget.tsx(lineCurrencyNow).Two-minute check:
pnpm --dir ui exec vitest run packages/plugin-form/src/ObjectForm.lookupAutofill-28245.test.tsx -t rulingpasses 4 tests. In them, a USD quote picks a $100 product, changes its currency to EUR, keeps 100, and shows "Unit Price was copied as $100.00, but the record is now in EUR."https://claude.ai/code/session_01QSeKYnagJvGbCtNg2PhvgW
🤖 Generated with Claude Code
Generated by Claude Code