Skip to content

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

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-36412-cross-currency-pick-followups
Nov 24, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-36412-cross-currency-pick-followups

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Yibo Wang · project thread

repo:objectstack#3 · os-support-ai · session_01WGufzhoBbwh8URjwQHde8v

Refs #36412
Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户可见变化:选产品时,若价格栏已有数值且币种不同,原值保留并在下方说明;新建明细时上级币种读不到也不再一直卡住,描述照常带出、单价留空并说明;产品自带币种和价格一起带出时,两者都会填上。
  • 为什么做:这是「选产品不跨币种抄价格」那张卡留下的四个后续问题,替多币种发票的使用者补齐提示和漏填。
  • 出错会怎样:只影响选取关联记录时自动带出的金额和提示文字,已填的数值不会被改动;可以直接撤回这一个合并。
  • 要你做什么:无(「改币种后保留金额并提示」那一项未在本次实现,交席位安排后续)。

What changes

Items 1–4 of the card and To-do 5. The ruling item (comment 7118795825) is not built here: see "Ruling item" below.

  • Item 1, a re-pick over a filled cell says why (closed: behaviour route, no describe narrowed). A withheld value now records held, the value its target held at the pick. The note shows while the target still holds that value (empty, or the earlier value a re-pick or an overwrite: true pair left in place: withheldStillStands), on the grid and on the record face, and ends "Unit Price still holds its earlier value." Editing the target ends the note.
  • Item 2, the opening fill's wait is bounded (closed). useFollowedParentRead (followedParentRow.ts) reports where the parent read stands: none, pending, read, or unread (the read failed or answered no row, the source has no findOne, or no parent object is stamped). LookupField waits only while it is pending. An unread parent puts a following amount in the new AmountCurrency kind unread: it is withheld with the reason targetCurrencyUnread ("the currency here could not be read"), and every target that does not depend on currency (the description) fills.
  • Item 3, every record-form host is stamped (closed by measurement plus a pin). Measured on 7a5ae65e54e: the only writer of onAutofill is the form renderer, and every record-form layout draws through gateFormFields → stampRecordFormFields: ObjectForm simple and sectioned arms, DrawerForm, ModalForm, TabbedForm, WizardForm, and the forms drawn through ObjectForm (MasterDetailForm header and line form, EmbeddableForm). The record page's body tables (RecordBodyTableEditor) are a line-item grid and judge their own picks; the record page's own field editing hands no onAutofill, so it fills nothing. No host needed a change; the recordFormStamp.ts header now lists the hosts and names the one that keeps the old behaviour: a standalone form node (the @object-ui/components form renderer outside these hosts), which holds no object field map.
  • Item 4, an amount is judged with this pick's own code write applied (closed). planDeclaredLookupAutofill and the grid's planLookupAutofill now collect every value a pick would write (declaredPickWrites, the same-named copy) and judge them together (judgePickWrites): targetCurrency is handed the pick's writes, and amountCurrencyOf's new third argument lays a write to the amount's own code field on the record before resolving. A parent path is not overlaid (a parent's code is not the record's to write). Pinned through the grid and through ObjectForm.
  • i18n: two sentences, lookup.autofillCurrencyUnread and lookup.autofillKept, in all 11 packs (zh-Hant generated) and in FIELD_DEFAULTS.
  • One changeset: @object-ui/fields, @object-ui/i18n, @object-ui/plugin-form (the last for the comment in recordFormStamp.ts), all patch.

Ruling item (not built here)

Not built, so this PR carries Refs #36412 and leaves the card open. Two reasons. First, size: items 1–4 already change 714 lines, and the ruling item needs a copied-under record and a per-render re-judgement on both hosts plus a sentence in 11 packs and its pins, which puts the total past the 900-line bound. Second, one visible case the ruling does not settle: a withheld note refreshed to a new record currency that equals the picked amount's own currency (the reason no longer holds, and the target is still empty) could drop the note, keep the old wording, or say something new. Follow-up: none filed; the seat decides.

Tests

Tests on head 12d8d3bb3bd: pnpm --dir ui exec vitest run --maxWorkers=2 packages/fields/ packages/plugin-form/ packages/i18n/ (Test Files 682 passed, 1 skipped; Tests 9796 passed, 21 skipped); type-check of @object-ui/fields, @object-ui/plugin-form, @object-ui/i18n exit 0.

New pins and ablations
  • GridField.lookupAutofill-28245.test.tsx, describe "(objectstack#36412)", 8 tests: amountCurrencyOf reads the pick's code write, not a parent's; the same-named copy and declared pairs copy a code and the price in it onto a fresh line (control: a grid drawing no code column withholds the price; a code the record holds is kept and judges the price); a withheld value over a filled target carries held (control: over an empty one it does not); through the grid, a fresh line fills code and price with no note (control: no code column, "no currency is chosen"), a pick over a filled JPY cell keeps 80 and says so until the cell is edited (control: an empty cell's note has no kept sentence).
  • ObjectForm.lookupAutofill-28245.test.tsx, describe "(objectstack#36412)", 13 tests: an overwrite: true pick over a filled JPY price keeps it and says so (control: a EUR quote replaces it, no note); a code-plus-price pick fills both on a quote with no code (control: a pick without the code pair says no currency is chosen); the opening fill does not wait on a failed parent read or a source with no findOne, fills the description and says the currency could not be read (control: an answering read fills the price); each of six layouts (simple flat, simple sections, drawer, modal, tabbed, wizard) withholds a EUR price from a JPY quote and fills a EUR one.
  • Ablations on the committed tree, scripts/ablation-replace.mjs, vitest aliasing @object-ui/* to src (no dist between mutation and run), each restored to the HEAD blob with git diff HEAD empty:
    • item 4, lookupAutofill.ts anchor const refused = judgeCopy(currency, c, writes); x1 to x0 (writes not handed): Tests 4 failed, 56 passed (60); restored blob faf38ecb05a9.
    • item 2, LookupField.tsx anchor const followedParentPending = followedParentState === 'pending'; x1 to x0 (an unread parent waits again): Tests 2 failed, 26 passed (28); restored blob 4717859dc284.
    • item 1, withheldStillStands reduced to "the target is empty": Tests 2 failed, 58 passed (60); restored blob faf38ecb05a9.

Acceptance notes

  • N9 (record-page editor re-renders): not measured. This diff adds no work per render there; the new work runs once per pick.
  • Addendum 7088192432 is kept as it is: a record that names no parent and holds no code still gets "no currency is chosen here yet".
  • A standalone form node with a lookup carrying lookupAutofill in its field carrier still copies across currencies. Making it judge needs a change in @object-ui/components (outside this card's surface) or narrowing the FieldSchema.lookupAutofill describe in packages/spec; neither is done here, and it is reported to the seat.
  • followedParentRow.ts: a failed read now records an answer with no row instead of clearing the answer. The amount box (CurrencyField) reads the same record either way.

Verification

Gates
  • dispatch-gates --commands derived 41 commands at 12d8d3bb3bd; 40 ran with exit 0; pnpm --dir ui exec vitest run scripts/ is NOT MEASURED (SIGKILL beside the package suite, then exit 124 at the 590 s limit under the lock; its closure-budget case needs a console build) and is left to CI. dispatch-gates --ran: 41 derived, 40 run, 1 NOT-MEASURED, 0 UNRUN.
  • ui check:new-line-citations: 0 new citations, exit 0.
  • overlap-check before every push: VERDICT clean exit 0.

Read first, by risk: (1) judgePickWrites and withCodeWrite in lookupAutofill.ts; (2) useFollowedParentRead in followedParentRow.ts and its use in LookupField.tsx; (3) withheldStillStands at the two note sites.

Two-minute check: pnpm --dir ui exec vitest run packages/plugin-form/src/ObjectForm.lookupAutofill-28245.test.tsx -t 36412 passes 13 tests; in it, a quote with no code picks a EUR product and holds EUR and 100.

https://claude.ai/code/session_01WGufzhoBbwh8URjwQHde8v

🤖 Generated with Claude Code

…ait, code-plus-amount pick

Claude-Session: https://claude.ai/code/session_01WGufzhoBbwh8URjwQHde8v
Co-Authored-By: Claude <noreply@anthropic.com>
…ugh the grid and every record-form host

Claude-Session: https://claude.ai/code/session_01WGufzhoBbwh8URjwQHde8v
Co-Authored-By: Claude <noreply@anthropic.com>
…changeset for the cross-currency pick follow-ups

Claude-Session: https://claude.ai/code/session_01WGufzhoBbwh8URjwQHde8v
Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 24, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzesUz1Y8VZuKJRhVL8

席位核对 — ACCEPT · repo:objectstack#3 · head 12d8d3b · 2026-11-24T09:10Z

L1-a read of #36918 (card #36412) at 12d8d3bb3bd66b741d2f0b0e7fc93ff63ea942ae.

Mechanical.

Relation. Refs #36412 is right. Items 1–4 are delivered here, but the ruling item 7118795825 (「保留金额并提示」: a note beside a pick-copied amount after the currency changes) is not built. The card stays open for it, as the ruling allows (Refs #36412 follow-up).

Read, item by item.

  • Item 1. declaredPickWrites keeps the overwrite rule unchanged and records each target's held. judgeCopy carries held onto a withheld value. Both hosts now filter the note through withheldStillStands: empty when nothing was held, otherwise equal to the kept value. The note therefore stands over a re-pick's earlier price until someone writes the cell, and autofillKept names what was kept. The grid passes row on every pick (GridFieldWidget.tsx:977), so a same-named copy carries held too. Pinned in the grid and in ObjectForm, each with a control.
  • Item 2. useFollowedParentRead returns none / pending / read / unread. A rejected read, a read that answers no row, a source without findOne, and a form with no stamped parent object all end at unread. Before, a rejected read set the answer back to undefined and the wait never ended. followedParentPending is now pending alone. With unread, currencyFor answers {kind:'unread'} only for a target that follows a parent, so the description fills and the amount is withheld with targetCurrencyUnread. Pinned for the failed read and for no findOne, with an answering-read control.
  • Item 3. Closed by listing the hosts, which the card allows as an alternative ("or list the hosts that keep the old behaviour"). I checked the host list in recordFormStamp.ts against the layout pin every record-form host judges the pick: ${layout}. The standalone form node is named as the one host left on the old behaviour.
  • Item 4. judgePickWrites collects every write of one pick first, then judges each amount with amountCurrencyOf(def, record, writes). withCodeWrite applies the pick's write only to the amount's own code field, never to a parent path. In the grid, a header-driven columnCurrencies code also ignores the writes, correctly, because the header's code is not the line's to write. Pinned in the unit, in the grid and in ObjectForm, each with a control.
  • Changeset. Each sentence holds against the tree, including the new exports (declaredPickWrites, judgePickWrites, withheldStillStands, PickWrite), the unread kind, held, and the two lookup.* sentences in all 11 packs. @object-ui/plugin-form is named for a documentation-only change, and the changeset says that is all it is.

Nits (no action required):

  • N1. unread has four arms: a rejected read, a read that answers no row, no findOne, and no stamped parent object. The pins cover the first and third. The other two reach the same return, so the risk is low. A one-line case for "no parent object" would close the set.
  • N2. The standalone form node in @object-ui/components still copies across currencies. This is disclosed and the area is routing it to the seat. It needs a card of its own (the seat files it), since this card closes on the ruling item.
  • N3. withheldStillStands compares with sameValue, so retyping the identical earlier value keeps the note. This is cosmetic.

Every open finding is a nit, so ACCEPT. On landing, #36412 stays open for ruling 7118795825.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzhoBbwh8URjwQHde8v

Landing · 2026-11-24T09:11Z · area ux-B · head 12d8d3bb3bd66b741d2f0b0e7fc93ff63ea942ae

  • L1: ACCEPT 7127057550 (L1-a, on this head). Only optional nits remain: N1, the "no parent object" and "answered no row" arms of unread have no pin of their own; N2, the standalone form node gets its own card (sent to triage, mailbox pm:mailbox — triage#1 · os-warren #36743 comment 7127028135); N3, cosmetic. None has a user-visible defect.
  • Refs #36412: the card stays open for ruling item 7118795825, which is not built here.
  • Contract review: none owed (Clause-② no, Metadata-protocol none).
  • check-governed-merges.mjs --pr 36918: NOT governed, 714 changed lines. Card total (this is its only PR) is 714, under the per-card 3,000-line line.
  • landing-k.mjs --pr 36918: CAN'T ANSWER on this UI-only PR (no Test Core shard ran). Merge-base reading: 8 commits behind main, under 15.
  • Checks on this head: 45 success / 13 skipped / 0 failing; mergeable_state clean.
  • Action: ready for review + auto-merge through the merge queue.

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

Labels

documentation Improvements or additions to documentation size/l tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants