Repository navigation
fix(app-shell): a field-backed action param reaches its record picker, and an unreadable one is refused - #10158
Conversation
…n unreadable one is refused An action param backed by a `lookup` field rendered as a bare text input — no options, no typeahead, and no request for the referenced object on the wire, because no picker was ever built. With the param `required` the action could not be launched from the UI at all, while the same field rendered a working picker on a record form in the same build. `resolveActionParams()` resolves a field-backed param against the `objects` list its caller holds. `ConsoleShell`'s root action runtime passes none and `DeclaredActionsBar` passes exactly one, so a param whose owner object is not in that list took the resolver's last-resort shape — and for a field-backed param that shape is `text`, because it declares no inline `type`. The binding was never missing from the client; this seam never asked the metadata store for it. - `useConsoleActionRuntime` unions the caller's objects with the console metadata store's, caller first (`withKnownObjects`), after awaiting the object type so "this field does not exist" is an answer, not a boot race. - `resolveActionParams()` stamps `unresolvedField: '<object>.<field>'` when it cannot read a field-backed param. That degradation used to be anonymous: by then the param IS a `text` param, so `paramDegradesWithoutTarget()` answered false and not even the "paste a record id" hints fired. - `ActionParamDialog` refuses such a param — an alert naming the pair in place of the control, one console line per opening in every build, and a disabled Confirm. objectui#10129. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018HrVaotisyhgmot9o2MLRq
…der-phase ref `react-hooks/refs` flags a ref written during render, and the ref bought nothing here: the context value's `objects` getter and `ensureType` both read the provider's live cache through refs of their own, so a value captured at any render answers with today's data at call time. The dep carries it only so the lint rule can see it. The test harness's `onReady` moves into an effect for the same reason. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018HrVaotisyhgmot9o2MLRq
|
changeset-claim-re-read
|
✅ Console Performance Budget
The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it. 📦 Bundle Size Report
Size Limits
|
✅ Console Performance Budget
The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it. 📦 Bundle Size Report
Size Limits
|
ACCEPT — PR #10158, card objectui#10129Reviewed by the The card's own boundary is answered: outcome 1, and ⛔ no upstream card is owedThe card refused to be worked until somebody established 「which side dropped the field's object binding」, and the dispatch made that binding. The answer, with the spec read first-hand in
⇒ the contract puts the binding on the client, in the metadata store the record form already reads. The renderer is not innocent and the server is not at fault. The action-param seam simply never asked the store. ⭐ The root cause, re-derived by this seat with an uncapped enumerationThe dev's account is that two console callers cannot hold the right objects list. This seat enumerated every
⭐ That is what makes the card's strangest observation exact rather than mysterious: 「no request for the referenced object appears on the wire at all — the picker is not failing to load; it is never attempted.」 Nothing was attempted because by the time the picker code could run, the param was no longer a lookup. The lit control is the right one and it is inside the pin
The reverse verification has three mutation legs, each proved on disk by blob comparison (and the surgical one by an occurrence count moving 1 → 0), each restored under a trap and the restore proved by an empty The fix does the second half the dispatch insisted on⭐ The dispatch required that 「a required param with no way to supply a value should be impossible to ship — if the binding cannot be resolved, the dialog should refuse loudly rather than render an unusable text box」. It does: the resolver stamps the unresolved The new key carries the Clause-② —
|
Fixes #10129
Clause-②: no —
node scripts/check-governed-queue-guard.mjs --testover this branch's 16 paths answersNOT GOVERNED — none matched. The diff ispackages/app-shell,packages/core,packages/i18nand one changeset; it touches noAGENTS.md, noCLAUDE.md, nothing under.claude/**,skills/**ordocs/adr/**.Step 1 first: which side dropped the binding
The card refused to name a side and asked for one to be established. Outcome: the binding reaches the client, and the renderer path ignores it. The fix is here, in this repo.
The decision site is
paramToField()inpackages/app-shell/src/utils/paramToField.ts— theparamDegradesWithoutTarget(param)branch that rewritestypeto'text'. But that is not where this defect lives, and finding that out is most of the work: for the reported param that branch never fires.One step earlier,
resolveActionParam()inpackages/app-shell/src/utils/resolveActionParams.tsresolves a field-backed param against theobjectslist its caller hands it:A field-backed param (
{ field: 'contract_type' }) declares no inlinetype, so when the owner object is absent from that list the param becomes atextparam — before any picker logic runs. Measured on this tree, both before and after the change:typereferenceToparamDegradesWithoutTarget{ field }, owner object presentlookupclm_contract_typelookup{ field }, owner object absenttexttext{ name, type: 'lookup', reference }inlinelookupclm_contract_typelookupRow 2 is the card, in every detail.
paramDegradesWithoutTargetanswering false is the load-bearing half: by the time anything downstream looks, the param is atextparam, and text params do not degrade. So no "no reference target" warning fired, the "paste a record id" placeholder and help text (#3405) did not apply, and the user got an unannotated empty box — no dropdown, no typeahead, and no request for the referenced object on the wire, because no picker was ever built. That silence is why this survived a version.Which callers cannot hold the right list
packages/app-shell/src/console/ConsoleShell.tsx—GlobalActionRuntimeProvidercallsuseConsoleActionRuntime({ dataSource })with noobjectsand noobjectName. Its own docblock says why it exists: everyaction:buttonoutside ObjectView / RecordDetailView / PageView / DeclaredActionsBar binds to it, and it was added so atype: 'flow'action there stops failing with "Flow handler not registered". The card's action is a flow trigger (POST /api/v1/automation/contract_intake/trigger).packages/app-shell/src/views/DeclaredActionsBar.tsx—objects: objectDef ? [objectDef] : []. One object, so anyobjectOverrideparam misses; and when the bar is driven by itsactionsprop,useMetadataItem('object', undefined)leavesobjectDefundefined and the list is empty.ObjectViewandRecordDetailViewpass the full list and were never affected.What the server serves, versus what the record form gets
Read in
/home/user/objectstack(read-only; nothing was committed, pushed or opened there):packages/spec/src/ui/action.zod.ts—ActionParamSchemaisstrictObject, and its own docblock names the two declaration modes: field-backed{ field }, and inline, where "alookup/master_detailparam declared this way MUST name its target object viareference". So for a field-backed param the server serves no object binding on the param at all, and is not supposed to: the binding lives on the object's field def, and the client already holds it.packages/spec/src/ui/action-params.zod.ts— "Field-backed params are resolved to their effective value-shape inputs by the CALLER (the runtime, which holds the object metadata registry)". The client side of that same contract isresolveActionParams, and its registry isuseMetadata().objects.packages/spec/src/conversions/registry.ts,field-reference-to-alias— the serve path canonicalises a storedreference_totoreferenceso objectui may delete its fallback arms. That interlock is intact here:normalizeSchemaReferenceKeysstill stamps both spellings at ingestion inMetadataProvider, and a control leg confirms a def carrying onlyreference_toresolves its target once it has been through that door.⇒ the object binding is on the client, in the same store the record form reads. The action-param seam simply never asked the store for it. ⛔ Nothing in the server's contract had to change, and nothing upstream is filed.
The lit control
legDin the new pin file drives two paths in one run, against the same field def:contract_typedef handed to the shared field widget the form renders. Clicking the trigger queriesclm_contract_typeand offers its records. This is the card's "it works there in this same build", measured here rather than quoted.useConsoleActionRuntime({ dataSource }),ConsoleShell's supply verbatim, under a metadata store that has the object. Same outcome now: a picker, a query namingclm_contract_type, and options offered.With the supply half reverted, the second leg alone goes red and the record-form control stays green — which is the difference the card asked to be located.
The change
useConsoleActionRuntimeresolves field-backed params against the caller's objects unioned with the metadata store's, caller first (withKnownObjects, exported beside the resolver with its own docblock). A draft or preview overlay the caller carries still wins on any name it defines. The handler awaitsensureType('object')first — it is already promise-returning by contract — so "this field does not exist" is an answer and not a cold-boot race, which is what makes the refusal below sound.resolveActionParamstampsunresolvedField(theOBJECT.FIELDpair, as a string) when it cannot read a field-backed param, and says so in dev. The last-resorttextshape stays — a partially cached console must not crash — but it no longer travels anonymously.ActionParamDialogrefuses such a param: an alert naming the pair in place of the control, aconsole.errorper dialog opening in every build, and a disabled Confirm so the action cannot be launched with a value the dialog had no contract to collect. The refusal is deliberately not gated onrequired— a param that cannot be read is a broken declaration either way, and a silent optional one is the same invisible failure a submit later.actionDialog.unresolvedParamis added to all ten locale bundles. TheOBJECT.FIELDlocator renders as its own node rather than an interpolation, so an identifier is never re-ordered by a translation.Evidence
Pins:
packages/app-shell/src/views/ActionParamDialog.fieldBackedPickerReach-10129.test.tsx— 13 passing, four legs, every leg with a control beside it.Reverse verification. Each leg mutated one file on disk, proved the mutation by blob hash (and for the surgical one, by an occurrence count that had to move
1 -> 0), ran the pins, then restored withgit checkout HEAD -- pathand proved the restore by an emptygit diff HEAD— never by an exit code. Atrap … EXIT INT TERMcarried the restore. Run from the committed fix, so the red and green numbers are about committed bytes.useConsoleActionRuntime.tsxto the branch baseActionParamDialog.tsxto the branch baseUnable to find an element by: [data-testid="param-unresolved-contract_type"]unresolvedFieldemit from the resolverexpected undefined to be 'clm_contract.contract_type', plus both refusal legsgit diff HEADemptyLocal checks, all run from the repository root after the merge of
origin/mainat6cae9a0b3, against6d4f4da96:pnpm exec vitest run packages/app-shell/ packages/core/src/actions/ packages/i18n/—Test Files 837 passed (837),Tests 8925 passed | 1 skipped (8926).pnpm --filter @object-ui/core --filter @object-ui/app-shell --filter @object-ui/i18n type-check— exit 0, afterpnpm --filter '@object-ui/app-shell^...' build.check:i18n-keys,check:i18n-drift,check:i18n-dead-keys,check:i18n-designer-parity,check:control-bytes,check:new-line-citations,check:changeset-claims,check:pending-changeset-literals,check:test-path-roots,check:vi-mock-specifiers,check:vi-mock-inherit— all exit 0.node scripts/check-changeset-presence.mjsandnode scripts/check-changeset-no-major.mjs— exit 0.check:eager-locale-cataloguesandcheck:eager-closure— exit 0 afterpnpm --filter '@object-ui/console...' build. The tenth locale key adds nothing eager: the nine non-encatalogues stay on demand andenstays the only resident one. ⛔ No ceiling inscripts/check-eager-closure-budget.mjswas touched.Lint, as a declared narrowing rather than a repo-wide run.
pnpm exec eslint --no-inline-configover the five changed.ts/.tsxsources: exit 0,0 errors, 76 warnings, 0 of them new — the tworeact-hooks/refswarnings in the report are the pre-existingserverActionEnvRefpair, not this diff's. The population is whateslint.config.jsitself configures, the file count is read off--format json(5), and the narrowing is sound because this repo does not enable type-aware linting: noparserOptions.projectand noprojectServiceappear ineslint.config.js, so nothing in this diff can move a verdict on a file it did not touch. The full repo-wideeslint . --no-inline-configis CI's run, not this branch's.Acceptance notes
Out of scope, observed, ⛔ not filed and ⛔ not changed here:
RecordDetailViewbuilds a second, near-identicalparamCollectionHandlerthat does not go through the store union. It is not a defect today — that view receives the fullobjectslist as a prop, which is why it was never in the reported path — but the two handlers are documented as a pair that must not drift (RecordDetailView.paramRuntimeParity-6431.test.tsx), and they now differ by this union. Successor: whoever next edits either handler; the pin file names both.RuntimeFieldinresolveActionParams.tsstill declaresreference_to, which no read in that file consumes any more (objectui#6837 narrowed the read toreference). Dead declaration, no behavioural effect — ingestion canonicalises both spellings.⛔ The card's two further dialog defects — no max-height / internal scroll, and the file widget posting a browser blob — are each their own card and neither is touched here.
🤖 Generated with Claude Code
https://claude.ai/code/session_018HrVaotisyhgmot9o2MLRq
Generated by Claude Code