Skip to content

Action param dialog: a field-backed lookup param ignores the field's allowCreate: false, and a quick-created record that fails lookupFilters stays selected #36865

Description

@sunhaolin

Summary

An action param that borrows a lookup field ({ field, objectOverride }) draws the picker with a "+ New" entry even though the borrowed field declares allowCreate: false. The record created through it is then selected in the picker although it does not match the field's lookupFilters, and running the action is refused by the server.

Measured on @objectstack/* 18.6.0 (console served by the same version), HotCRM 6.6.0, zh-CN, signed in as an admin.

Metadata

The field (crm_expense_report.crm_expense_request):

crm_expense_request: Field.lookup('crm_expense_request', {
  label: 'Travel Request',
  readonly: true,
  lookupFilters: [
    { field: 'owner_id', operator: 'eq', value: '{current_user_id}' },
    { field: 'status', operator: 'eq', value: 'approved' },
  ],
  // A request is filed and approved on its own page first; the picker
  // offers no "Create new".
  allowCreate: false,
}),

The action param (a type: 'script' action on crm_expense, locations: ['record_header'], promoted to the list's selection toolbar):

params: [
  { field: 'crm_expense_request', objectOverride: 'crm_expense_report', required: true },
],

Steps

  1. Open a list of crm_expense, select one or more rows, choose the action from the selection toolbar (the record-header dialog draws the same picker).
  2. Open the "Travel Request" picker. With no approved request of the user's own it lists no record — the lookupFilters are applied. It also offers "+ 新建" (New).
  3. Choose "+ 新建". The full create form of crm_expense_request opens; fill it and save. The new request is a draft.
  4. The picker now holds the new draft request as its value.
  5. Run the action.

Actual

  • Step 2: "+ New" is offered, though the field says allowCreate: false.
  • Step 4: the created record is selected although it fails the field's lookupFilters (status = approved); the same record is not in the picker's list when it is reopened.
  • Step 5: the action answers 400 (its body re-checks the request and refuses it), so the user is led through a create form to a refusal.

Expected

  • A field-backed lookup param reads allowCreate from the field it borrows, as it already reads lookupFilters, lookupColumns, lookupPageSize and descriptionField: with allowCreate: false the picker offers no "+ New".
  • Where quick-create is offered on a picker that has lookupFilters, a created record that does not match the filters is not left selected (or the user is told why it cannot be chosen).

Where

ui/packages/fields/src/resolveActionParams.ts copies descriptionField, lookupColumns, lookupFilters and lookupPageSize from the resolved field (around lines 880–884) and has no allowCreate among them; ui/packages/app-shell/src/utils/paramToField.ts (around lines 196–205) passes the same four on and no allowCreate. Related, closed: #26951 (the bulk dialog dropped the field's lookupFilters), #34197.

Impact

An app author cannot keep "create" out of an action's picker, so a dialog meant to choose among approved records invites the user to create a new one that the action must then refuse. Found in a browser pass of HotCRM's expense app ("按出差申请报销" / Submit for a Trip).

Activity

  1. added
    bug
    priority:p1
    domain:ui
    area:records
    on Nov 24, 2026
  2. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    Contributor

    triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE

    Triage: lands in area:ux · domain:ui · priority:p1 · Bug · pm:queue · size S. area:records is not a North Star area. The p1 grade was set by a person, and it stands.
    Rationale: the lookup picker in an action's param dialog does not follow the borrowed field's allowCreate: false, and it keeps a quick-created record that fails lookupFilters selected until the server refuses the run. This sits in the lookup-picker family that repo:objectstack#3 holds (#36825 via PR #36844, and #36832), so it is routed there. The claiming seat should check whether the field-backed param path reads the field's allowCreate and lookupFilters the way LookupField does.

  3. added
    pm:queue
    and removed
    area:records
    on Nov 24, 2026
  4. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    Contributor

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

    Claim: PM loop round 5 · 2026-11-24T06:58Z · p1, serial after #36832 (merged) on the seat's order (2026-11-24T05:37Z)
    Session: session_01WGufziG2t1d9cfRQJDrHkB
    Account: os-support-ai
    Branch: claude/issue-36865-lookup-param-allowcreate-filters
    Worktree: objectstack-issue-36865
    Domain: domain:ui
    Seat: repo:objectstack#3
    Area: ux-C
    File surface: ui/packages/fields/src/resolveActionParams.ts (the borrowed-field copy, ~880–884), ui/packages/app-shell/src/utils/paramToField.ts (~196–205), ui/packages/fields/src/widgets/LookupField.tsx (the quick-create result vs. lookupFilters), their tests, changeset. A change in packages/spec/** or the server ⇒ stop and report before code.
    Container & model: S, mode:subagent, model: opus (TIER_DEFAULT; dispatch-gates --tier: "no path-derived mandate"), effort: medium
    Clause-②: no — no accept set or public type changes; a field key already declared is now honoured on the param path.
    Metadata-protocol: none — allowCreate and lookupFilters keep their meaning; the param path stops dropping one of them.
    Responsibility: platform code in objectstack-ai/objectstack (ui/packages/fields + ui/packages/app-shell action-param lookup) produces it | no platform path covers it | every user running an action whose lookup param borrows a field with allowCreate: false or lookupFilters (HotCRM expense actions, reproduced on 18.6.0); reproduced by the dev on main before code
    Thread-read: 7123048376
    Premise: reported with metadata and steps on 18.6.0 (card body); on main resolveActionParams.ts and paramToField.ts copy descriptionField, lookupColumns, lookupFilters, lookupPageSize and no allowCreate (card's reading; the dev confirms on main before code). The second half (a created record that fails lookupFilters stays selected) is measured by the dev; the fix chooses between not selecting it and telling the user why — say which.
    Pre-claim lane: domain:ui — ui/packages/fields/src/resolveActionParams.ts, ui/packages/app-shell/src/utils/paramToField.ts, ui/packages/fields/src/widgets/LookupField.tsx
    Pre-claim deps: none (no Blocked-by:); #36832 (same file LookupField.tsx) merged as 97e0f934; overlap census: no open PR touches these files (read 2026-11-24T06:53Z); overlap-check.mjs runs before each push.
    Prior rulings read: allowcreate,lookupfilters,objectoverride,quick-create → 0 hits; none; thread: none; repo: objectstack-ai/objectstack
    Serial constraints cleared: #36852 (this area, queued, PeoplePicker scroll lock) may also touch LookupField.tsx; not claimed, goes after this card.
    Resume-from: none
    Fold-or-serial: alone. #36852 shares the file but not the defect or the fix (① fails).

  5. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 24, 2026
  6. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#3 · os-support-ai · session_01WGufziG2t1d9cfRQJDrHkB
    os-dev-report

    Reported 2026-11-24T07:02Z.

    {
      "issue": 36865,
      "status": "blocked",
      "branch": "claude/issue-36865-lookup-param-allowcreate-filters",
      "pr": null,
      "session": "session_01WGufziG2t1d9cfRQJDrHkB",
      "premise_still_valid": true,
      "summary": "Stopped at the fence before code, per the dispatch rule for files outside the claimed File surface. Premise confirmed by source reading on origin/main 370e14d8a: resolveActionParams.ts lookupExtras (lines 878-885) copies descriptionField/lookupColumns/lookupFilters/lookupPageSize and no allowCreate; paramToField.ts (196-205) forwards the same four; LookupField.tsx 484-486 then defaults allowCreate to isUserFacingReference(reference), so a crm_expense_request picker offers create. Half 1 cannot land inside the fence: (1) ActionParamDef in ui/packages/core/src/actions/ActionRunner.ts (lines 958-980, no index signature) declares no allowCreate, so lookupExtras: Partial of ActionParamDef and param.allowCreate in paramToField do not type-check without one added optional member; (2) the card's own repro path is the list selection toolbar, which resolves through ui/packages/plugin-grid/src/resolveBulkActions.ts toBulkParam (lines 171-196) - it carries the same four keys under their own names and would drop allowCreate even after the fence files are fixed. Half 2 fits the fence for the not-selected arm (re-read the created id through the picker's own popoverFilter with mergeFilterNodes, as the recents rail does at lines 1500-1507; absent means do not select). The told-why arm needs a new lookup.* string: ui/packages/i18n/src/locales/*.ts (11 packs) plus the FIELD_DEFAULTS row in ui/packages/fields/src/widgets/useFieldTranslation.ts, also outside the fence. Size stays S with the widened fence (about 6 code lines across core and plugin-grid, plus one string). Branch pushed empty as the routing probe; no commits.",
      "tests": "NOT MEASURED: runtime pin of the premise (allowCreate:false on a field-backed param still draws create), reason: stopped at the fence before install and build; the premise rests on source reads at origin/main 370e14d8a cited in summary. No tests run, no ablation (no code).",
      "gates": "local: node scripts/pm/overlap-check.mjs -> VERDICT clean exit 0 (0 files, merges cleanly with origin/main 370e14d8a0). No package touched, so no build closure, no package tests, no derived families. CI: no PR, no check-runs.",
      "line_budget": "n/a - no diff",
      "files_changed": [],
      "deviations": "none. Fence widening requested rather than taken. Runtime premise pin not taken (NOT MEASURED above).",
      "dogfood_battery": "n/a - no PR",
      "mcp_calls": "0",
      "api_writes": "1 - this report comment via scripts/pm/post-stamped.mjs (POST /repos/objectstack-ai/objectstack/issues/36865/comments); git push of the empty branch is not a REST write",
      "open_questions": [
        {
          "question": "Widen the File surface for half 1 to ui/packages/core/src/actions/ActionRunner.ts (one optional allowCreate member on ActionParamDef, plus its test-free doc line) and ui/packages/plugin-grid/src/resolveBulkActions.ts (carry allowCreate in toBulkParam, plus its test), so both the record-header dialog and the selection-toolbar dialog honour the field's allowCreate:false?",
          "options": [
            "A widen to both files: the card's own repro path (selection toolbar) is fixed in the same PR; no spec or server change; allowCreate also joins RESOLVED_ONLY_PARAM_KEYS in the fenced resolver file",
            "B widen to ActionRunner.ts only: record-header dialog fixed, selection toolbar stays broken and needs a follow-up card",
            "C keep the fence: half 1 cannot type-check; only half 2 lands"
          ],
          "recommendation": "A, because the repro in the card is the toolbar path and B leaves the reported symptom in place; cost is about six lines and two pins"
        },
        {
          "question": "For half 2, may the user be told why a just-created record was not selected (new lookup.* string in ui/packages/i18n/src/locales/*.ts and the FIELD_DEFAULTS row in useFieldTranslation.ts), or should the fix only leave it unselected (in-fence, satisfies the card's Expected via its 'or')?",
          "options": [
            "A widen to the i18n packs and useFieldTranslation.ts: not selected, and the picker's existing error line (role=alert, the createError slot) says the record was created but does not match this field's filters",
            "B keep the fence: not selected, no message; the user sees the modal close and the picker stay empty"
          ],
          "recommendation": "A, because B silently swallows a record the user just saved; A reuses the existing createError display and costs one string in 11 packs"
        }
      ],
      "security_findings": "withheld",
      "out_of_scope_findings": [
        "carrier: none - noted, not filed: ui/packages/types/src/__tests__/page-nav-misc-spec-parity.test.ts pins the resolved-only picker group as nine keys; if allowCreate joins RESOLVED_ONLY_PARAM_KEYS the parity test can gain a tenth ts-expect-error line (optional, same widening)"
      ],
      "Dev-effort": "medium",
      "Rounds": "1"
    }
  7. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    Contributor

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

    Claim amendment · 2026-11-24T07:04Z · amends claim 7124488286 after the os-dev report 7124565256 (blocked at the fence before code). Seat route (2026-11-24T07:04Z), a route call, not a maintainer ruling: widen for both halves, size stays S.

    File surface (added to the claim's line):

    • ui/packages/core/src/actions/ActionRunner.ts — one optional allowCreate member on the exported ActionParamDef;
    • ui/packages/plugin-grid/src/resolveBulkActions.ts — toBulkParam carries allowCreate (the selection-toolbar path of the card's repro), with a pin;
    • allowCreate joins RESOLVED_ONLY_PARAM_KEYS in resolveActionParams.ts (and, optionally, the parity pin in ui/packages/types/src/__tests__/page-nav-misc-spec-parity.test.ts);
    • one new lookup.* string in the 11 ui/packages/i18n/src/locales/*.ts packs (zh-CN, ja-JP and es-ES written by hand, not an English echo) plus its FIELD_DEFAULTS row in ui/packages/fields/src/widgets/useFieldTranslation.ts, shown in the picker's existing createError slot when a quick-created record fails the field's lookupFilters and is therefore not selected.
      Changeset gains @object-ui/core and @object-ui/plugin-grid (and @object-ui/i18n if it ships).
      Clause-②: yes (widening) — an optional member on the published @object-ui/core ActionParamDef; replaces the claim's Clause-②: no. L2 owed at TIER_DEFAULT (declaration-only face), run by L1-a.
      Metadata-protocol: none — stands.
  8. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    Contributor

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

    Close-out: 2026-11-24T10:39Z · area ux-C · landed by PR #36919 (merge 49c6bf3d513efd3d15a82f5a54b7887563eb0439, head a0cfa725a7b1f24dd7eb706bf28ab45817e0b853, L1 ACCEPT 7128519679, contract-review delta PASS 7128510004). A lookup param on an action dialog now honours the field's allowCreate and its filters. A record created from the picker is selected only once it is checked against the field's filters. A record that fails the check, or whose check could not run, is not chosen, and the picker says so. A create error now shows as a notice above a list that stays usable, which also ends the older lock-out after a failed inline create. Carry-over: the bulk-param prescription text (S3) is spec card #36927. N2b/N2c stay nits (L1). Browser reach not measured. pm:dispatched removed.

  9. removed
    pm:dispatched
    on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:uxbugdomain:uipriority:p1

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions