Skip to content

fix(fields): the fill-in dialog judges option visibleWhen on the record the write would leave - #37264

Draft
objectstack-fleet[bot] wants to merge 2 commits into
mainfrom
claude/issue-37250-fill-in-dialog-pending-values
Draft

objectstack-fleet[bot] wants to merge 2 commits into
mainfrom
claude/issue-37250-fill-in-dialog-pending-values

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ
Fixes #37250

Clause-②: yes (widening) — the exported RequiredWhenPromptField of @object-ui/fields gains one optional member, record?: Record<string, unknown>
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:在记录上就地改动(改阶段、改列表单元格、行内编辑、看板拖动)弹出「补填必填字段」时,弹窗里的下拉、单选、级联选择、关联查找和金额币种,都按这次改动后的记录来显示;比如商机改为「失败」后,丢单原因会列出该有的选项,不再显示「暂无可选项」。
  • 为什么做:补填弹窗之前根本没把记录交给里面的控件,凡是要读记录的控件都按一条空记录判断,于是有的选项被藏掉、要先选上级的列表一直停在「请先选择」,改动保存不了。
  • 出错会怎样:影响补填弹窗里各控件如何读取记录(选项显示、级联、关联查找的过滤、金额跟随的币种);若有误,最多是弹窗里某些选项多显示或少显示,可直接撤回本次改动,不涉及数据。
  • 要你做什么:无

What changes

The required-fields fill-in dialog rendered each control with no record at all, so an option visibleWhen reading record.* was judged on an empty record. An option list whose every option reads the field the change writes (hotcrm's crm_opportunity.loss_reason, shown only while stage == "closed_lost") offered nothing: the select drew its empty state and the change could not be saved.

  • collectRequiredWhenPromptFields already judges the prompt on one merge, the stored record with the change (next = { ...record, ...changes }). Each field it returns now carries that record as record (new optional member of RequiredWhenPromptField).
  • RequiredFieldsDialog hands every control dependentValues = that record with the values typed into the dialog on top, i.e. the record the write would leave. A row a host builds itself (a refusal-named field) reads the same record whenever any shown field carries one.
  • requiredWhen / field visibleWhen / readonlyWhen: already judged on next by the collector (unchanged); the new collector assertion pins that the carried record is that same merge.

Tests

ui/packages/fields/src/__tests__/RequiredFieldsDialog.inPlace-35956.test.tsx, new top-level describe (objectstack#37250), four cases: the collector carries the merged record; a select whose options read the changed field offers them instead of the empty state; a radio offers exactly the options visible on the merged record (a won-only option stays hidden); a value typed into the dialog joins the record the other rows read.

Acceptance notes

  • Same family, outside this card's file surface, not changed here: the hosts' refusalField rows are built as { name, def } with no record. With at least one collected field shown they now read the dialog's record; with zero collected fields (the record header's stage menu opening the dialog as a pure confirmation) a refusal-added option row reads only the typed values. Hosts: ui/packages/plugin-detail/src/renderers/recordPathStageChange.tsx, ui/packages/plugin-detail/src/InlineEditSaveBar.tsx, ui/packages/plugin-grid/src/objectGridRequiredPrompt.tsx (kanban passes no refusalField).
  • ui/packages/plugin-timesheet/src/ObjectTimesheet.tsx add-row dialog renders FieldEditWidget with no dependentValues, so an option visibleWhen reading a sibling row field is judged on an empty record there too. Not a pending-change case; noted only.

Verification

Two-minute check: cd ui && pnpm --filter @object-ui/fields exec vitest run --root ../.. --maxWorkers=2 packages/fields/src/__tests__/RequiredFieldsDialog.inPlace-35956.test.tsx — expect 11/11 passed.

Read first: ui/packages/fields/src/RequiredFieldsDialog.tsx (the liveRecord memo and the dependentValues prop), then ui/packages/fields/src/requiredWhenPrompt.ts (record: next).

Rework round 1 (head f731d2461f2)

Per the seat L1 7158746595: M1 — the widening is declared here and in the changeset; S1 — the changeset now states the condition as "the dialog handed its controls no record" and names what now resolves (option visibility, dependsOn gates, dependent-lookup filters, a money field's followed currency); N1 — a win_reason mirror pin. Dialog file 12/12; @object-ui/fields 5021 passed; type-check 0; 38/38 derived gates exit 0. Follow-up for host refusal rows: #37270.

Provenance

Opened by seat repo:objectstack#4 on the maintainer's authorization in the seat session (「#37250(推送被拦):放行」). The seat's os-dev subagent's first push was refused by its permission check; it stopped without retrying. Branch claude/issue-37250-fill-in-dialog-pending-values @ 57e988ac224.


🤖 Generated with Claude Code

https://claude.ai/code/session_01QSeKYpEsWWE9Y5YtSsDgqZ

…rd the write would leave

The required-fields fill-in dialog rendered each control with no record,
so an option visibleWhen reading the field the change writes (a loss
reason shown only while stage is closed_lost) was judged on an empty
record and every option was hidden. The collector already judges the
prompt on the stored record merged with the change; each returned field
now carries that record, and the dialog hands it, with the values typed
so far, to every control as dependentValues.

Claude-Session: https://claude.ai/code/session_01QSeKYpEsWWE9Y5YtSsDgqZ
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m 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 25, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ

席位核对 — REWORK · L1 · head 57e988ac2247a28ed81a799fb0fb47fa1fa67e4e · 2026-11-25T09:44Z

  • Scope: PR fix(fields): the fill-in dialog judges option visibleWhen on the record the write would leave #37264 (draft → main), Fixes #37250. 4 files, +129/−1: .changeset/37250-fill-in-dialog-pending-options.md, ui/packages/fields/src/RequiredFieldsDialog.tsx, ui/packages/fields/src/requiredWhenPrompt.ts, and the RequiredFieldsDialog.inPlace-35956 test. All files are inside the claim's file surface (claim comment 7156052572). Nothing touches content/docs/releases/.
  • Root cause, not a mask. At merge-base d7f299c0b1e, the dialog rendered <FieldEditWidget field value onChange> with no dependentValues. useCascadingOptions resolves dependentValues ?? {} and has no context fallback (retired under objectui#7206). So every option visibleWhen in the dialog was judged on {}. The collector already judges on next = { ...record, ...changes } (requiredWhenPrompt.ts, unchanged). The fix carries that same next to the controls, and the dialog adds the typed values on top. Dev claims 1–3 hold as stated.
  • Hosts: kanban (ObjectKanban.tsx), recordPathStageChange.tsx, InlineEditSaveBar.tsx and objectGridRequiredPrompt.tsx all label their fields with { ...f, def, label }. record therefore reaches the dialog on every collected row and every moreFields row with no host edit.
  • Pins re-run at head in a scratch worktree at 57e988ac224, using vitest run … RequiredFieldsDialog.inPlace-35956.test.tsx: 11/11 passed.
  • Ablation readings (same file):
  • Full @object-ui/fields suite at head: 329 files passed, 1 skipped; 5020 tests passed, 7 skipped (vitest run packages/fields, ~574 s). That matches the dev's 5020.
  • Check-runs on 57e988ac224: 57 runs, 44 success, 13 skipped, 0 failed. Named: Lint & Repo Gates success, TypeScript Type Check success, Type Check UI success, Lint UI success, Check Changeset success. GitHub reports mergeable_state: clean.
  • K = 8 against origin/main @ ede9b91f402. git merge-tree --write-tree origin/main 57e988ac224 is clean. Main has moved nothing under ui/packages/{fields,plugin-detail,plugin-grid} since the merge-base.
  • Overlap: I listed the files of all 42 other open PRs. None touches RequiredFieldsDialog*, requiredWhenPrompt*, useCascadingOptions*, recordPathStageChange*, InlineEditSaveBar* or objectGridRequiredPrompt*. No open issue mentions refusalField.
  • Changeset level: patch is right. AGENTS.md Post-Task step 3 sets the level by the Metadata-protocol kind alone. none takes patch, and a non-protocol widening ships patch. Metadata-protocol: none is right too: no metadata key, value or default moves.
  • M1 (must-fix) — Clause-②: no is a false declaration. The criterion (execution-duties.md) asks whether the card relaxes an accept set or enlarges the public surface. The public surface is what the built entry .d.ts reaches.
    • @object-ui/fields 18.6.0 is published (not private; exports["."].types = ./dist/index.d.ts). Its index.tsx re-exports type RequiredWhenPromptField, and RequiredFieldsDialogField extends it. That interface reaches RequiredFieldsDialogProps.fields and refusalField.
    • The new record?: Record<string, unknown> therefore widens both the exported shape and the props the dialog accepts.
    • Repo practice for exactly this shape is Clause-②: yes (widening). Examples in ui/packages/fields/CHANGELOG.md: "ActionParamDef gains one optional member, widget?: string" and "the exported RecordPointer type gains the optional deletedLabel".
    • Fix: write Clause-②: yes (widening) line-initial in the PR body, the changeset body and the claim comment 7156052572. The queue gate reads only the claim comment. Then route the declared widening to a TIER_DEFAULT L2 (contract-review.md) before ready or queue.
    • The dev flagged the member "For the L1" in comment 7157459458. The seat carried the claim's pre-design no forward.
  • S1 (should-fix) — Two sentences of shipping text understate the defect and the fix.
    • Changeset ¶1 says: "This happened when the field's options are each shown only for some values of the field the change writes." That is one sufficient case, not the condition. With no record handed over, any option visibleWhen reading any record field was judged on {}. That includes fields the change does not write. In addition, every dependsOn-gated option list and every dependent lookup in the dialog stayed on its "select the parent first" gate (isOptionGroupGated(dependsOn, {})). The progress comment itself says the cause "is broader than the card says".
    • 维护者速读 「出错会怎样」 says "只影响补填弹窗里下拉、单选等选项的显示". dependentValues also feeds dependent-lookup filters (LookupField), CurrencyField's followed currency and the option widgets' cascade-clear.
    • Fix: restate the condition as "the dialog handed its controls no record". Name the dependsOn gates and dependent lookups among what now resolves. Widen 「出错会怎样」 to "how the dialog's controls read the record". 「为什么做」 has the same narrowing ("没有用到这次待保存的改动"): the dialog used no record at all, so it should say that.
  • Changeset, sentence by sentence, other than M1 and S1:
    • Title: true.
    • ¶1, the hosts list (stage move, list cell, inline edit, kanban drop): true against the four hosts above.
    • "No options available": true. It is the fields.options.empty copy.
    • The loss-reason example: true.
    • ¶2 "saved record, the change, and the values typed": true (liveRecord).
    • "appears once that value is typed": pinned by case 4.
    • "not visible on that record stay hidden": pinned by case 3.
    • "fields asked for do not change": true. The collector's selection is untouched.
    • ¶3 "now carries record" and "hands it, with the typed values, to every control as dependentValues": true.
    • "reads the same record when the dialog has a field that carries one": true as far as it goes. It leaves out the zero-field case, which the PR body does state.
    • "No metadata key, value or default changes": true.
  • 维护者速读, sentence by sentence, other than S1: 「用户能看到什么变化」 is true. 「要你做什么:无」 holds: an L2 review is a seat route, not a maintainer action.
  • refusalField rows: the PR is honest about them. The PR body's acceptance notes, the changeset ¶3, the record TSDoc ("Absent on a row a host builds itself") and the progress comment all state the gap.
    • Read at head: refusalField in all three hosts returns label({ name, def: { name, ...def } }) with no record.
    • In the stage-menu confirmation (zero collected fields), judged is undefined. A refusal-added option row then reads only the typed values, without even the stage change.
    • This is no worse than main ({}), and the hosts are outside the claim's file surface, so leaving them out is right.
    • Owed: one follow-up card covering recordPathStageChange.tsx, InlineEditSaveBar.tsx and objectGridRequiredPrompt.tsx. All three share one fix shape: each refusalField sets record to the stored record with the change, through the member this PR adds. The pin is a stage-menu confirmation whose refusal names loss_reason.
    • The ObjectTimesheet.tsx add-row note (line 637, no dependentValues) is confirmed. It is a different dialog and not a pending-change case, so it is a separate card if the seat files it. It should not be folded into the refusalField card.
  • N1 — The card's triage "Done when" asks for a win_reason (→ closed_won) pin as well. The mechanism is field-agnostic, and case 3's won-only option is the inverse check. Acceptable as is.
  • N2 — The dev's report reads "each of the two ablations turns 3 red". Measured here, the collector ablation turns 4 red (it also reds the collector assertion) and the dialog ablation turns 3 red. Record the measured pair.
  • N3 — recordPathStageChange recomputes asked (fieldsNeededAt) on every host render. judged, and so liveRecord, take a new identity per render. No effect loop was found: the option widgets' cascade-clear is idempotent, and the dialog passes no onAutofill. Note only.
  • Patch round: M1 and S1 are text-only (PR body, changeset and claim comment). The changeset edit moves the head, and the PR is then owed a TIER_DEFAULT L2 on the declared widening before it can be accepted.

…the dialog's record now resolves

The changeset declares Clause-② yes (widening) for the optional `record`
member on the exported RequiredWhenPromptField, and states the defect as
the dialog handing its controls no record: option visibility, dependsOn
gates, dependent-lookup filters and a record-following currency now
resolve on the record the change would leave. Adds the win_reason mirror
pin (a move to closed_won offers the won-only reasons).

Claude-Session: https://claude.ai/code/session_01QSeKYpEsWWE9Y5YtSsDgqZ
Co-authored-by: Claude <noreply@anthropic.com>

This branch has not been deployed

No deployments
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/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants