Skip to content

rest(record page): a record:related_list whose relationshipValueField names a lookup on the parent passes os validate, then the one-request record page refuses it with 400 invalid_relationship and the whole page fails to load #33609

Closed

Description

@os-bob

Summary

The spec allows relationshipValueField to name any parent field whose value the child's relationshipField stores (packages/spec/src/ui/component.zod.ts:1663-1667).

That includes a lookup on the parent that points at a third object. Example: a sales order's selected_plan → crm_allocation_plan, with the child list being the plan's lines.

os validate accepts such a page (exit 0). At runtime the one-request record page refuses it:

POST /api/v1/data/crm_cb_order/<id>/page
400 VALIDATION_FAILED
  code: invalid_relationship
  'allocation_plan' on 'crm_allocation_line' is not a … field that references 'crm_cb_order'

The check is packages/rest/src/record-page-routes.ts:222:

if (!def || referenceOf(def) !== object)

It requires relationshipField to reference the route's own object, whatever relationshipValueField says.

One refused related list takes down the whole record page: the Console shows 「无法加载此记录」 (record cannot be loaded).

Repro (18.4.0)

Declare this component on a record page of crm_cb_order:

{ type: 'record:related_list', id: 'plan_lines',
  properties: { objectName: 'crm_allocation_line', relationshipField: 'allocation_plan', relationshipValueField: 'selected_plan' } }

Here crm_cb_order.selected_plan is a lookup to crm_allocation_plan, and crm_allocation_line.allocation_plan is a lookup to crm_allocation_plan.

  1. Run objectstack validate. It exits 0.
  2. Open any order full page in the Console. /page answers 400 invalid_relationship and the page does not render.

Measured downstream in steedos-labs/os-project-blackcat-crm#45 (read-only probe, 2026-11-15).

Expected (either is fine; the platform decides)

  • A. The record page door serves the list. When relationshipValueField names a lookup on the parent, the related list filters by child[relationshipField] = parent[relationshipValueField], and relationshipField only has to reference the lookup's target.
  • B. If that shape is not meant to be supported, os validate refuses it at build time with the same reason.

In both cases a single bad related list should not blank the whole page. Either degrade that one block, or refuse at build time.

Notes

Activity

  1. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    Contributor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Path: none

    Triage: first touch → domain:server · p2 · 2026-11-15T02:45Z

    ⛔ Not a claim.

    A record:related_list whose relationshipValueField names a parent lookup passes os validate, then the one-request record page answers 400 and the whole page fails to load. It is loud, but it breaks the entire page, and authors cannot see it coming (p2 row). Reach is one page shape (−1), and it is raised once because a downstream CRM (the allocation-plan lines) hits it: p2. Two halves: make the runtime resolve the parent lookup the spec allows, or make os validate refuse what the runtime refuses. They must agree either way. Not in the lease table (rest record page), so domain:server#5 places it.

  2. added
    bug
    domain:server
    pm:queue
    priority:p2
    on Nov 15, 2026
  3. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    Contributor

    domain:server#5 · zhuangjianguo · session_01QsR2jRsWwTRkuRCyQwvpAG

    Claim: server area-lease pilot (#33059), area A3, dispatched by seat domain:server#5 · p2 · executed by an os-dev card thread · posted at 2026-11-15T09:04Z
    Session: session_01QsR2jRdYZ7uv1MtK2hsidC
    Account: zhuangjianguo
    Branch: claude/project-thread-im5d3x
    Worktree: objectstack-issue-33609
    Domain: domain:server
    Seat: domain:server#5
    File surface: packages/rest/src/record-page-routes.ts and its tests, a changeset; ui/** only after the seat agrees (stop on breach; explain in the report)
    Container & model: M, mode:thread, model: default (no path-derived mandate; dispatch-gates --tier at 53f5a4c9), effort: high
    Clause-②: no
    Metadata-protocol: none
    Responsibility: rest record-page-routes.ts refuses a related list the spec allows (objectstack) | none | any record page whose related list keys on a parent lookup; steedos-labs/os-project-blackcat-crm#45 today
    Thread-read: 6888124378
    Premise: holds
    Serial constraints cleared: #33613 and #33652 (os-elon-musk) touch other packages/rest/src test files only: not edited

    Order: /mnt/project-files/server-seat-5/order-33609.md (project brief) · the seat's ruling region quotes the triage first-touch line verbatim.


    Generated by Claude Code

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

    @objectstack-fleet
    Contributor

    domain:server#5 · zhuangjianguo · session_01QsR2jRsWwTRkuRCyQwvpAG

    Release: the seat's claim 6892088715, 2026-11-15T09:07Z — premise falsified before any code: the fix lands wholly in ui/**, outside domain:server. No branch, no WIP.
    State: pm:dispatched → pm:queue + pm:retriage, assignee cleared. Ask to triage: re-lane to domain:ui (the remaining work is console-only; the seat recommends option A below and no spec or route change).

    The os-dev's premise reading (card thread session session_01QsR2jRdYZ7uv1MtK2hsidC, origin/main f06f064), handed over so the next holder need not re-scan:

    What holds

    • Governing docblock holds: RecordRelatedListProps.relationshipValueField (packages/spec/src/ui/component.zod.ts) =
      "Parent-record field whose value relationshipField stores (default 'id'; e.g. 'name' for name-keyed junctions)",
      used "to FILTER the list ({[relationshipField]: parent[relationshipValueField]})". A parent lookup's stored value
      is the target id, so the card's shape is spec-legal.
    • The refusal is real: record-page-routes.ts related check if (!def || referenceOf(def) !== object) answers the whole
      request 400 VALIDATION_FAILED / invalid_relationship before any read.

    PM mechanism hypothesis: falsified in its key part

    • The route does not "ignore" relationshipValueField: it never receives it. RecordPageRelatedRequestSchema
      (packages/spec/src/api/record-page.zod.ts) is .strict() with keys object, field, filter, top, sort, expand only;
      its field docblock fixes the contract: "The list is the child records whose field holds this record's id."
      The route enforces its own published contract correctly.
    • The defect is the console: recordPageRelatedLists (ui/packages/app-shell/src/views/recordPagePayload.ts) puts EVERY
      record:related_list with objectName+relationshipField into the /page request and drops relationshipValueField. The
      console's own count prefetch rule relatedCountTargetOf (ui/packages/plugin-detail/src/useRelatedCounts.ts) already
      refuses exactly these lists ("a parent link through a field other than id ... keeps reading for itself").
    • So the PM route "filter child[field] = parent[valueField] in the route" needs a NEW key on a published spec/api
      request schema (contract shape) => needs_decision under os-dev stop rules.

    Reach is wider than the card (read, not measured live)

    Two shipped platform pages hit the same 400 by reading:

    • plugin-sharing sys-queue.page.ts: list sys_queue_member.queue (Field.text) + relationshipValueField 'name'.
    • plugin-audit sys-audit-log.page.ts: list sys_audit_log.record_id + relationshipValueField 'record_id'.
      Neither child field references the page object, so /page refuses both whole pages the same way.

    Second ui disagreement (read, not measured live)

    The page record is read with every lookup expanded (pageRecordExpand = buildExpandFields, RecordDetailView.tsx), and that
    record is the RecordContext data. record-related-list.tsx reads parentLinkValue = ctx.data[relationshipValueField] raw,
    so for a LOOKUP value field (the card's selected_plan) the list filters by the expanded object, not the id. Even with
    /page fixed, the card's list would not draw the right rows.

    Options (four axes)

    A. ui only (recommended). (1) recordPageRelatedLists skips a list with relationshipValueField other than 'id' (and a
    dataSource / parentDataSource binding), the rule relatedCountTargetOf already applies; those lists keep their own
    GET /data read. (2) record-related-list.tsx reads the id of an expanded reference value. Route untouched.

    • Business need: fixes the card's CRM page and the two shipped platform pages; no new surface.
    • Long term: one rule for "which lists the one-request door can answer", shared by both console callers; the door's
      contract stays strict. Cost: one extra GET per such list (the pre-Seam: one request opens a record — a record-page payload (record + related counts and first rows + field access + lock) and an app-scoped metadata bundle, so a record open is 2–3 requests instead of 23–45 serialized in three stages #27627 shape), for a rare shape.
    • AI-error: the server keeps refusing a list that does not point at the page object; nothing becomes lenient.
    • No scope spread: no spec key, no gate. ~2 ui files + pins.
      B. Door serves it. Add optional valueField to RecordPageRelatedRequestSchema; route resolves parent[valueField] from the
      record it already read, judges the child field against that parent field's target; console sends it; plus (2) above.
    • Business need: same pages, one request instead of N+1; no measured pull for the saving.
    • Long term: coherent, but a contract widening (spec/api + generated artifacts + Clause-② yes (widening)), 3 packages.
    • AI-error: neutral to slightly better (one server judgement).
    • Scope: widest; a new API key for a rare shape cuts against the startup-focus axis.
      C. Route per-part degrade (invalid_relationship becomes that list's error, the shape already exists).
    • Page loads, but the console keeps asking a question the door cannot answer, and a truly mismatched list goes quiet
      instead of loud. Consumer-side tolerance; not recommended.

    Recommendation: A. It needs the seat's agreement because the claim surface becomes ui/** (app-shell recordPagePayload.ts,
    plugin-detail record-related-list.tsx and their tests) and packages/rest is not touched. Under A, os validate stays as is
    (it accepts what the runtime then serves).


    Generated by Claude Code

  6. added
    pm:queue
    pm:retriage
    and removed
    pm:dispatched
    on Nov 15, 2026
  7. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    Contributor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Path: none

    Triage: re-lane → domain:ui · p2 · pm:queue · 2026-11-15T09:09Z

    ⛔ Not a claim.

    As requested by domain:server#5 (release 6892118138, premise reading inside). The /page route enforces its published contract correctly: RecordPageRelatedRequestSchema is strict and keys a related list by "the child records whose field holds this record's id". The defect is the console. recordPageRelatedLists (ui/packages/app-shell/src/views/recordPagePayload.ts) folds every record:related_list into the one-request payload, including one keyed by a non-id relationshipValueField, so the whole page fails. The console's own count prefetch (relatedCountTargetOf) already leaves those lists to read for themselves.

    The fix is console-only, with no spec or route change: keep non-id-keyed related lists out of the /page request and let them read on their own, as the count prefetch does. Grade p2 unchanged (a downstream CRM page fails whole). A route that filters on relationshipValueField would be a new key on a published request schema, so it is not part of this card.

  8. added
    domain:ui
    and removed
    pm:retriage
    domain:server
    on Nov 15, 2026
  9. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    Contributor

    domain:ui#2 · os-project-manager · session_01FEkQ5oF8GgTHN2jBZoDwz8

    Claim: PM loop round 1 · 2026-11-15T09:41Z
    Session: session_01FEkQ5ogAAW3KBKDyrAs5C7 (card thread, dev) · seat session_01FEkQ5oF8GgTHN2jBZoDwz8
    Account: os-project-manager
    Branch: claude/project-thread-dd4iyn
    Worktree: objectstack-issue-33609
    Domain: domain:ui
    Seat: domain:ui#2
    File surface: ui/packages/app-shell/src/views/recordPagePayload.ts, the record page's consumer of it in ui/packages/app-shell/src/views/** (only where the non-id-keyed list must read for itself), their tests, root .changeset/. ⛔ No packages/spec/**, no packages/rest/**, no os validate change. ⛔ Off seat 2's plugin-chatbot / AiChatPage.tsx (#33746, #33734) and ui seat 1's sys_user / sys_invitation / Setup files (#33755, #33758, #33759).
    Container & model: M, mode:thread, model: default tier, effort: default
    Clause-②: no (app-shell internals); stop and report if an exported symbol of a published package changes
    Metadata-protocol: none
    Responsibility: one record:related_list keyed by a non-id relationshipValueField 400s the one-request /page call and the whole record page shows 「无法加载此记录」 | recordPageRelatedLists folds every related list into the /page request, unlike the count prefetch relatedCountTargetOf | any console record page whose related list keys on a parent lookup; steedos-labs/os-project-blackcat-crm#45 today
    Thread-read: 6892143116
    Premise: holds: triage#1 re-lane 6892143116 (console-only option A), from domain:server#5's release 6892118138 premise reading; the dev measures first
    Serial constraints cleared: no other pm:dispatched domain:ui card claims a file in this surface (live label read; ui seat 1's live cards #33657 #33186 #33187 are disjoint; ui seat 1 left this card to seat 2); no other ui seat holds a Claim: on these files

    Scope: p2. Order: /mnt/project-files/pm-orders/ui/order-33609.md. Summons: the maintainer's 「同意 给队列最深的 ui 和 spec 各再开一个座位」 (this project, 2026-11-14T22:46Z) and 「任务进展如何,后续只处理 p1 p2」 (2026-11-15T05:05Z).

  10. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 15, 2026
  11. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    Contributor

    domain:ui#2 · os-project-manager · session_01FEkQ5oF8GgTHN2jBZoDwz8

    Claim amendment 1 to claim 6892483975 · 2026-11-15T09:52Z
    Branch: claude/project-thread-dd4iyn (unchanged)
    File surface (added): ui/packages/plugin-detail/src/renderers/record-related-list.tsx and its test.
    Why: the dev measured that, once the non-id-keyed list is kept out of /page, the list's own read still fails. The page record carries every lookup $expanded, and the renderer reads parentLinkValue = ctx.data[relationshipValueField] raw, so the filter value is the expanded {id, name} and the read refuses it (INVALID_FILTER). This is the second ui disagreement named in domain:server#5's release 6892118138. The card's shape cannot render its rows without it.
    Ruling: one PR closes the card (option A). Collapse an expanded reference to its stored id by reusing core's existing rule; no new rule is written. No exported symbol changes, and Clause-②: no stands.
    Deviation accepted, to be named in the PR: relatedCountTargetOf is reused whole through the exported relatedCountTargetsIn, so dataSource- and parentDataSource-bound related lists also read for themselves instead of riding /page. Pin it.
    Serial check: no open PR touches record-related-list.tsx or recordPagePayload.ts (open-PR file sweep at 2026-11-15T09:52Z); ui seat 1's live cards are disjoint.

  12. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    Contributor

    domain:ui#2 · os-project-manager · session_01FEkQ5oF8GgTHN2jBZoDwz8
    os-dev-report
    {
    "issue": 33609,
    "status": "done",
    "branch": "claude/project-thread-dd4iyn",
    "pr": "#33780",
    "session": "session_01FEkQ5ogAAW3KBKDyrAs5C7",
    "premise_still_valid": true,
    "summary": "Measured on origin/main a557fa3 through a rendered RecordDetailView (real ObjectStackAdapter, a /page transport refusing like record-page-routes.ts, the card's order.selected_plan -> plan lines shape): the page drew record-load-failed (VALIDATION_FAILED). Fold-in: recordPagePayload.ts recordPageRelatedLists, record:related_list branch of visit. Fix 1 (5dc9212): a list rides /page only when pageAnswersRelatedList says so, which is the count prefetch's relatedCountTargetOf rule reached through the already-exported relatedCountTargetsIn on a bare {type, properties} node (relatedCountTargetOf is not in plugin-detail's index, so no published export changes). With fix 1 alone the page rendered but the plan-lines list drew 'Couldn't load records' (INVALID_FILTER, the expanded selected_plan object as the filter value); fix 2 (6bb2558, seat amendment 6892596732) collapses the parent value through core's toPredicateRecord over ctx.objectSchema.fields in record-related-list.tsx. Changeset 69abddd: @object-ui/console + @object-ui/plugin-detail patch. Clause-2 no, Metadata-protocol none.",
    "tests": "New ui/packages/app-shell/src/views/RecordDetailView.nonIdKeyedRelatedList-33609.test.tsx (4 tests): rendered pin (no record-load-failed, record drawn, one /page request naming only the id-keyed list, task row drawn, a plan-lines GET filtered ["allocation_plan","=","plan-7"] and none with [object Object], both plan lines drawn) + 3 builder pins (non-id list out, id and explicit 'id' in; dataSource/parentDataSource-bound out; visibleWhen-gated id-keyed in). Red first on a557fa3: record-load-failed drawn, VALIDATION_FAILED. Ablations via scripts/ablation-replace.mjs on committed HEAD (vitest aliases plugin-detail to src, no build), marker grep -c 1, restored blob == HEAD and git diff HEAD empty: fix 1 bypassed 3 failed / 1 passed; fix 2 reverted to raw ctx.data 1 failed / 3 passed. A third probe (dropping a visibleWhen strip) stayed green and showed the strip dead; removed it before the final commit. On 69abddd: plugin-detail/ 379 files passed 1 skipped, 3383 tests passed 18 skipped; app-shell views RecordDetailView* + recordPage* 97 files 711 tests passed; VERDICT command-exit 0 both.",
    "gates": "dispatch-gates --commands --repo objectstack-ai/objectstack on 69abddd: 37 families, all 37 exit 0 (codes captured before any pipe, record /mnt/project-files/pm-orders/ui/33609-gates-ran.txt); --ran: 37 derived, 37 run, 0 NOT-MEASURED, 0 UNRUN (derived zero). Extra: type-check plugin-detail and app-shell exit 0 after building @object-ui/app-shell^...; eslint --no-inline-config on the 3 changed files exit 0 (0 errors, warnings only); check:new-line-citations 0 new, exit 0. CI check-runs on PR #33780: not yet read at report time (in_progress).",
    "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm",
    "mcp_calls": "3 — mcp__github__issue_read (get #33609, get_comments #33609 x2); no MCP write",
    "api_writes": "2 — POST /repos/objectstack-ai/objectstack/dispatches (relay pr_create, run 43705099222, read-back identical, PR #33780, no labels, no assignees); this os-dev-report comment on #33609 via post-stamped. git push is not a REST write.",
    "open_questions": [],
    "security_findings": "none",
    "out_of_scope_findings": [
    "carrier: none · noted, not filed (order: name it): any other 400 from /page still blanks the whole record page; a cheap local degrade is RecordDetailView treating a VALIDATION_FAILED payload as no payload so each reader reads for itself, as an adapter without getRecordPage does. PR Acceptance notes.",
    "carrier: none · noted, not filed: plugin-sharing sys-queue.page.ts (relationshipValueField name) and plugin-audit sys-audit-log.page.ts (record_id) are shipped non-id-keyed lists; this PR keeps them out of /page the same way (by reading, not measured live). PR Acceptance notes."
    ],
    "deviations": "Seat-accepted (amendment 6892596732): reusing relatedCountTargetOf whole also takes dataSource/parentDataSource-bound related lists off /page; pinned and named in the PR body. relatedCountTargetOf is reused through the exported relatedCountTargetsIn rather than a new package export (claim: stop if an exported symbol changes). os-dev.md rule 2 says pr_create carries assignees; the order says no assignees: sent none, per the order.",
    "line_budget": "4 files, +392 / -3: production 2 files about 40 lines, changeset 14, pin file 338.",
    "files_changed": [
    ".changeset/33609-related-list-parent-lookup-page.md",
    "ui/packages/app-shell/src/views/RecordDetailView.nonIdKeyedRelatedList-33609.test.tsx",
    "ui/packages/app-shell/src/views/recordPagePayload.ts",
    "ui/packages/plugin-detail/src/renderers/record-related-list.tsx"
    ]
    }


    Generated by Claude Code

  13. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    Contributor

    domain:ui#2 · os-project-manager · session_01FEkQ5oF8GgTHN2jBZoDwz8

    Seat review: PR #33780 ACCEPT on head 69abddd7 (2026-11-15T11:00Z). K = 11 and CI is green, so ready + auto-merge are set in the same stroke. Clause-②: no, so no contract record is owed.

  14. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    Contributor

    domain:ui#2 · os-project-manager · session_01FEkQ5oF8GgTHN2jBZoDwz8

    Landed · 2026-11-15T11:51Z

    reading value
    PR #33780 MERGED as fbe349f2 on main (closes this card via Closes #33609)

    State: pm:dispatched removed, assignee cleared; card closed by the merge. The seat ACCEPT is 6893331357.

    • A related list keyed by a parent lookup now stays off the one-request /page call. It reads for itself, filtered by the parent's stored id.
    • The page no longer blanks with 「无法加载此记录」.
    • The accepted deviation: dataSource/parentDataSource-bound lists also read for themselves.
  15. removed
    pm:dispatched
    on Nov 15, 2026
  16. added a commit that references this issue on Nov 16, 2026
    fbe349f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdomain:uipriority:p2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions