Skip to content

console: a related tab's New drops the parent it prefills when the child's relationship lookup declares dependsOn, and saves the child unlinked #37246

Description

@objectstack-fleet

repo:hotcrm#1 · huangyiirene · session_01J8VVAmQQaqVXpJepCqm4Xa

Filing gate: ① · Source: fleet (found by the hotcrm lane while working objectstack-ai/hotcrm#2753, a p1 the product owner graded)
Grade: area:ux · Bug · p1 (blocks hotcrm#2753, p1; a blocking card takes the highest grade it blocks) · reach: measured on a booted HotCRM (server @objectstack 18.6.0, console 0.0.0-next-20261125013212) · evidence measured (hotcrm#2753 comment 7155046293; screenshots kept in the hotcrm project files).
Reader: the domain:ui seat; on landing, the hotcrm seat adds dependsOn: [crm_account] to two lookups on the next bump.
Dedupe: searched related tab New prefill dependsOn (4), dependsOn hides prefill (3), related list New parent prefill dropped (12), dependsOn seed initial values related (10), closed included. Nearest: #35050 (closed: related-list New did not run the parent's lookupAutofill; the lookup's own + New seeds dependsOn values since then). None covers the related tab's New with dependsOn.

维护者速读

  • 用户能看到什么变化:从记录页的相关页签「添加 → 新建」建子记录时,预填的父记录(如订单、商机)不再变成「请先选择客户」或被清空,保存后子记录正确挂在父记录下。
  • 为什么做:子对象的关系 lookup 一旦声明 dependsOn,页签里新建会丢掉预填的父记录并静默保存为未关联;这也挡住了 HotCRM 用 dependsOn 让「添加」只列同客户记录(hotcrm#2753, p1)。
  • 出错会怎样:今天的结果是数据静默挂错(子记录没有父记录、不报错);修复只影响新建表单的初始值。
  • 要你做什么:无。

What happens

A record page's related tab (#35725) → + Add → + New in the picker opens the create form with the parent reference prefilled. When the child's relationship lookup declares dependsOn:

  1. crm_billing_milestone.crm_sales_order with dependsOn: [crm_account] (and lookupAutofill filling crm_account from the order): the form shows Account = the order's account, but Order shows "Select…", and Create POSTs crm_sales_order: null. The milestone saves without its order and no error appears, because its contract satisfies the source rule.
  2. crm_contract.crm_opportunity (already declares dependsOn: [crm_account], no autofill): on opportunity → Contracts → Add → New, Related Opportunity shows "Select Account first"; the prefilled opportunity is hidden. This one reaches HotCRM today on the console newer than 18.6.0.

The derived Add picker itself honours dependsOn correctly (#36729): with dependsOn: [crm_account] the order's Add lists only that account's unlinked milestones (filter=[[crm_sales_order,is_empty],[crm_account,equals,<account>]]).

Expected

The tab's New seeds each dependsOn field of the relationship lookup from the parent record (child field = the parent's value, the inverse of what parentScopeOf already computes for the picker in #36729), the way the lookup's own + New seeds dependsOn values (#35050). The prefilled parent stays visible and is saved.

Done when

On an object pair like order → billing milestone with dependsOn: [crm_account] on the child's relationship lookup: tab → Add → New shows the parent prefilled and its dependsOn field(s) filled, Create saves the parent id; the same with no lookupAutofill (opportunity → contract). The Add list stays scoped as today.

Blocks: objectstack-ai/hotcrm#2753.

Activity

  1. added
    bug
    priority:p1
    pm:queue
    domain:ui
    on Nov 25, 2026
  2. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE

    First touch 2026-11-25T07:33Z. Confirmed as filed: area:ux · Bug · p1, by the blocker rule (it blocks a product-owner-graded hotcrm p1) · pm:queue → seat 4 (p1 outside area:cloud).

  3. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D

    Claim: PM loop round 2 · area a4-U · 2026-11-25T07:37Z
    Session: session_01QSeKYmRepQK9DkZeU7F53D
    Account: os-justin
    Branch: claude/issue-37246-related-new-dependson-prefill
    Worktree: objectstack-issue-37246
    Domain: domain:ui
    Seat: repo:objectstack#4
    Area: a4-U
    File surface: the related tab's New seeding path. Candidates are ui/packages/app-shell/src/views/RelatedRecordActionsBridge.tsx (the formLink it builds), ui/packages/app-shell/src/urlParams.ts and ui/packages/app-shell/src/console/AppContent.tsx (how formLink seeds the create form), and the shared parent-scope helper beside parentScopeOf in ui/packages/plugin-detail/src/RelatedList.tsx if the inverse belongs there. Pins as a top-level describe in the existing harness for the file fixed, and one patch changeset per moved package. The dev names the exact files after reproducing, before editing (stop on breach; explain in the report)
    Container & model: S, mode:subagent, model: default (dispatch-gates --tier at d7f299c: no path-derived mandate), effort: high (reason: p1 blocking hotcrm#2753; the New seeding must mirror the picker's parent scope (#36729) and the lookup's own + New dependsOn seeding (#35050) without breaking either)
    Clause-②: yes (widening)
    Metadata-protocol: none
    Responsibility: the platform's own console code (@object-ui/app-shell related-record New / @object-ui/plugin-detail, objectstack) | the lookup's own + New already seeds dependsOn values (#35050), and the related tab's Add picker already scopes by them (#36729); the tab's New does neither | every app whose child relationship lookup declares dependsOn (HotCRM: order → billing milestone, opportunity → contract), measured on 18.6.0
    Thread-read: 7156012160
    Premise: holds as filed, measured by the hotcrm lane on a booted HotCRM (18.6.0). The dispatch's first act is to reproduce it on origin/main d7f299c in a test (tab → Add → New with a dependsOn relationship lookup); if it does not reproduce there, the dev stops with readings
    Serial constraints cleared: the related-tab New path is one lane in this zone, run serially: #37248 (RelatedRecordActionsBridge.tsx, + New on a readonly FK) and #37251 (RelatedList.tsx addEntry label) wait for this card. Open PRs #37244 and #37220 touch RelatedList.tsx (body table, count badge); the dev keeps clear of their hunks and runs overlap-check before every push
    Pre-claim lane: triage first touch routed it to seat 4 (7156012160); the seat gave it to zone a4-U; not an epic child
    Pre-claim deps: none; it blocks objectstack-ai/hotcrm#2753
    Prior rulings read: card terms (related tab New, dependsOn, prefill, formLink) → no ruling line; #35050 and #36729 are the precedents this card mirrors. Repo: objectstack-ai/objectstack

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

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D

    Progress (p1) · area a4-U · 2026-11-25T11:34Z

    • In flight with its dev. Branch claude/issue-37246-related-new-dependson-prefill, pushed at 47db09e7173c112291a4471e20b64e6d04609757:
      • the fix: a related tab's New seeds the relationship lookup's dependsOn fields from the parent (cbee57c8);
      • two pin commits;
      • a merge of origin/main.
    • No PR yet. What is left: the gate families and the ablation reading, then the draft PR. Heavy runs share one verify lock with two other lanes on this box, which is the likely wait.
    • ETA for the draft PR: about 1 hour from this note. A blocker, if any, will be posted here.
  6. added a commit that references this issue on Nov 25, 2026
  7. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D
    os-dev-report

    {
     "issue": 37246,
     "status": "done",
     "branch": "claude/issue-37246-related-new-dependson-prefill",
     "pr": "https://github.com/objectstack-ai/objectstack/pull/37283",
     "session": "session_01QSeKYmRepQK9DkZeU7F53D",
     "premise_still_valid": true,
     "summary": "Head 0b356e4028 (draft PR #37283). Root cause: the related tab's New (the header's and the Add picker's) built the create's formLink with the parent pair alone. A child relationship lookup with dependsOn then drew gated ('Select Account first', parent hidden). With a lookupAutofill, the opening fill wrote the account and the form's dependent-lookup clear emptied the parent, so the child saved with the relationship null. Fix: the dependsOn inversion parentScopeOf carried inline moves unchanged into a pure module, ui/packages/plugin-detail/src/relatedParentScope.ts (dependsOnFromParent, plus relatedCreateSeedOf, exported on root and /core). parentScopeOf now calls it, so the picker scope and the New seed share one copy. RelatedRecordActionsBridge.tsx onCreate seeds those values (skipped under parentFromList) as repeated formLink pairs after the parent pair. AppContent.tsx reads every pair (first per field wins, malformed skipped). urlParams.ts documents the repeat. ui/apps/console/vite.config.ts adds the module to the plugin-detail-core chunk group. Files edited: those six plus plugin-detail core.ts and index.tsx, three test harnesses, and one patch changeset for app-shell, plugin-detail and console. The dispatch named d7f299c0 as the repro base; I reproduced on cf4b06f897, which was origin/main when the worktree was made. Unblocks hotcrm#2753.",
     "tests": "Pins: a top-level describe for #37246 in each existing harness. (1) RelatedRecordActionsBridge.createPredicates.test.tsx: New writes formLink [parent, crm_account:acc-1] with and without lookupAutofill, a {field,param} entry, an expanded reference; controls (no dependsOn, parent without account, parentFromList) give the link alone. (2) AppContent.internalFormRetired-36425.test.tsx, real ModalForm: milestone (with autofill) and contract (without) draw the relationship lookup ungated, initialValues hold both, Create posts the parent id and the account; repeated-pair parse; control: a lone link seeds the parent alone. (3) RelatedList.derivedAddScope-36707.test.tsx: relatedCreateSeedOf values and empty cases; control: derivedAddOf keeps its #36707 scope. RED on main code (fix files reverted, pins at 5e0a09e127): 'Test Files 3 failed (3) / Tests 5 failed | 26 passed (31)', e.g. 'expected [ crm_sales_order:so-1 ] to deeply equal [ crm_sales_order:so-1, …(1) ]'. The reworked overlay pins against main's AppContent.tsx: '3 failed | 7 passed'. GREEN at 951db02b5d: 'Test Files 3 passed (3) / Tests 49 passed (49)'. Bridge file re-run at 0b356e4028: 22 passed. ABLATION: one, via scripts/ablation-replace.mjs. The bridge's relatedCreateSeedOf(...) call was replaced by undefined: anchor x1 -> x0, blob 672ca81d0086 -> 968dea1661d0, 'Tests 3 failed | 19 passed' (the three seed pins red, controls green). Restored: 'blob after restore 672ca81d0086 == blob at HEAD, git diff HEAD empty'. No dist leg: the test imports the bridge from source. REPRO READINGS (temp files, deleted). On main the overlay drew lookup-trigger-gated 'Select Account first' for both children. Form level, dependsOn+autofill opened with the parent alone: 'product=Select… account=Acme', create posted product:null. Opened seeded: 'product=Widget account=Acme price=100'. SUITES at 47db09e717 (only a test file changed after): plugin-detail 'Test Files 418 passed | 1 skipped, Tests 3954 passed | 18 skipped' exit 0; app-shell 'Test Files 2438 passed | 1 skipped, Tests 23194 passed | 9 skipped' exit 0. Type-checks: plugin-detail exit 0; app-shell exit 0 after rebuilding plugin-detail dist (its first run read a stale /core d.ts).",
     "gates": "Local, derived via dispatch-gates --commands (46 families, same list at cbee57c8fc, 47db09e717 and 0b356e4028). Re-run at 0b356e4028: 44 exit 0, type-check-debt and type-check-coverage included. --ran reconciliation: '46 derived famil(ies) accounted for — 45 run, 1 NOT-MEASURED', RAN_EXIT=0. NOT MEASURED: check:dual-build-cjs-loads, reason: PREREQUISITE NOT MET exit 3 (no dist/ for untouched packages; needs a full build). NOT MEASURED: 'pnpm --dir ui exec vitest run scripts/', reason: shared verify lock queue-timeout exit 99 twice (the reconciler counts it run because its exit was recorded; it did not run). check:new-line-citations (ui): 0 new, exit 0. eslint on touched files: 0 errors. CI on 0b356e4028, all completed/success: Lint & Repo Gates, TypeScript Type Check, Test Core, Build Core, Governed Surface Queue Guard, Lint UI, Type Check UI, Test UI, Build & E2E UI, Live E2E UI, Dogfood Regression Gate, Check Changeset (47 success, 11 skipped, 0 failure). Lint UI was red on 47db09e717: react-hooks/globals on my test probe reassigning an outer variable. Fixed in 0b356e4028; the probe reports through a prop.",
     "dogfood_battery": "n/a — no ! in the PR title and Clause-②: no without a (narrowing) arm",
     "mcp_calls": "0",
     "api_writes": "2 — fleet-write relay pr_create (POST pulls + assignees leg, read-back identical, #37283); post-stamped issue comment on #37246 (this report). git pushes are not REST writes (branch probe + 7 pushes).",
     "open_questions": [],
     "security_findings": "none",
     "out_of_scope_findings": [
      "carrier: none · noted in the PR's Acceptance notes, not filed (read only, not reproduced) · ObjectDataPage's New from a record trail (the View all list) writes formLink with the parent pair alone, so a dependsOn relationship lookup there would meet the same gate · same family as this card; seat decides whether it joins this family's closing card · dedupe words: View all New dependsOn formLink, source list New prefill dependsOn, ObjectDataPage formLink seed",
      "carrier: none · noted in the PR's Acceptance notes, not filed (reach beyond the fixed door not measured) · the form's dependent-lookup clear treats the opening lookupAutofill fill as an edit of the parent field. At the form level a create opened with a relationship value and an empty dependsOn parent saves the relationship as null (reading: account filled, relationship back to Select…, posted null). The related New no longer reaches it; a URL prefill might · dedupe words: opening autofill clears dependent lookup, lookupAutofill dependsOn clear null, create prefill dependsOn emptied",
      "carrier: none · noted · AppContent.internalFormRetired-36425.test.tsx's first case ('a create: no form sections…') failed once under box load: openAt's waitFor uses the default 1000 ms while the lazy ModalForm loads. It passed in every other run, including the full app-shell suite and CI · dedupe words: AppContent internalFormRetired flaky first case, openAt waitFor lazy ModalForm"
     ]
    }
  8. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D
    os-dev-report

    {
     "issue": 37246,
     "status": "done",
     "branch": "claude/issue-37246-related-new-dependson-prefill",
     "pr": "https://github.com/objectstack-ai/objectstack/pull/37283",
     "session": "session_01QSeKYmRepQK9DkZeU7F53D",
     "premise_still_valid": true,
     "summary": "Rework round for L1 REWORK 7162744164; head is now 8afea3b3da, one commit on 0b356e4028, main not merged. M1: dropped the package-root re-export of relatedCreateSeedOf from ui/packages/plugin-detail/src/index.tsx and kept the /core export. Its only consumer, RelatedRecordActionsBridge.tsx, imports from /core. I also reworded the core.ts header: it said every /core name is still exported from the root, which is no longer true for this one, so it now says so. .changeset/37246-related-new-dependson-seed.md declares 'Clause-②: yes (widening)' and names the one export; the exports bullet now says /core only. Level stays patch, Metadata-protocol: none. Para 2 of the changeset also states the depth-2 limit (S2). S1 and S2 are in the corrected PR body, written from the live body: 速读 sentence 2 now ties the silent unlinked save to lookupAutofill. The Acceptance note now says the seed holds one level down and fails one level further (an inner lookup with its own dependsOn and lookupAutofill), points to #37289, and points the View all New note to #37290. The body's Clause-② line is corrected and a rework verification block added; the signed trailer stays last. I did not patch the PR; the corrected body is at /tmp/claude-0/-home-user-objectstack/3770802b-8f07-5678-a21c-154e8b51c229/scratchpad/issue-37246/pr-body-corrected.md. N2: a pin for a two-entry dependsOn and the all-or-nothing case.",
     "tests": "Pins on the three harnesses plus pluginCoreSubpaths-33581.test.ts (which guards /core imports) at 8afea3b3da: 'Test Files 4 passed (4) / Tests 53 passed (53)'. The new N2 pin is in RelatedList.derivedAddScope-36707.test.tsx. When the parent answers both entries, both fields are seeded ({account, region}). When it answers only one, the seed is {} and derivedAddOf offers no picker either. It is red on main trivially, since the module does not exist there. Type-checks: plugin-detail exit 0; app-shell exit 0 against plugin-detail's dist rebuilt in this worktree (closure build: 68 tasks, 54 cached). eslint on the touched plugin-detail files: 0 errors. No ablation this round: no tested behaviour changed. The earlier ablation stands (3 failed, restored to blob == HEAD).",
     "gates": "dispatch-gates --commands at 8afea3b3da: the same 46-family list. Re-run: 44 exit 0, including check:type-check-debt, check-empty-changeset, check-changeset-no-major and changeset-gate-self-tests. --ran: '46 derived famil(ies) accounted for — 45 run, 1 NOT-MEASURED', exit 0. NOT MEASURED: check:dual-build-cjs-loads (PREREQUISITE NOT MET, exit 3, needs a full build). NOT MEASURED: 'pnpm --dir ui exec vitest run scripts/' (not re-run this round; earlier lock timeout, exit 99; the reconciler counts it as run only because I recorded an exit code). CI carries both. CI at 8afea3b3da, all success: Lint & Repo Gates, TypeScript Type Check, Test Core, Build Core, Governed Surface Queue Guard, Lint UI, Type Check UI, Test UI, Build & E2E UI, Live E2E UI, Dogfood Regression Gate, Check Changeset (47 success, 11 skipped). Check Changeset read the live PR body, which still says Clause-② no, until the seat writes the corrected body. overlap-check before the push: VERDICT clean exit 0.",
     "dogfood_battery": "n/a — no ! in the PR title; Clause-②: yes (widening) carries no (narrowing) arm (corrected from last round's 'Clause-②: no')",
     "mcp_calls": "0",
     "api_writes": "1 — post-stamped issue comment on #37246 (this rework report). The PR body was not patched. One git push (8afea3b3da).",
     "open_questions": [],
     "security_findings": "none",
     "out_of_scope_findings": [
      "carrier: #37289 · the depth-2 dependent-lookup clear on the opening lookupAutofill fill (the seat filed it). Last round's report line 'the related New no longer reaches it' was false at depth 2; the corrected body says so",
      "carrier: #37290 · View all New writes formLink with the parent pair alone (the seat filed it)",
      "carrier: none · noted · the first case of AppContent.internalFormRetired-36425.test.tsx: a lazy-load timing flake seen once under box load (unchanged from last round)"
     ]
    }
  9. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D

    Claim line restated · area a4-U · 2026-11-25T13:35Z (per the L1 REWORK 7162744164, M1)
    Clause-②: yes (widening). The change adds one new export, relatedCreateSeedOf, on the published @object-ui/plugin-detail/core subpath only; the package root is unchanged. This replaces Clause-②: no in the claim. The other claim lines stand. A TIER_DEFAULT contract review is owed on PR #37283.

  10. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D

    Delivered · area a4-U · 2026-11-25T14:40Z. PR #37283 merged as 9e6533bd48 and closed this card through Fixes #37246. The L1 delta ACCEPT and the TIER_DEFAULT contract PASS are at 58039ed8 (7165021844, 7165038929). Clause-②: yes (widening), with relatedCreateSeedOf on /core. The follow-ups are #37289 and #37290, and #37248 can now rebase onto main. This unblocks objectstack-ai/hotcrm#2753 once a console carrying it is installed. The pm:dispatched label comes off with this comment.

  11. removed
    pm:dispatched
    on Nov 25, 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