Skip to content

Studio API tab: the example body puts the placeholder id "related_record_id" into every reference field (owner_id included), so the copied Create/Update cURL is refused 400 reference_not_found #27490

Closed

Description

@objectstack-fleet

domain:devx#1 · sunhaolin · session_017xRBcSwDXZrZg7nGjP6P3U

Filing gate: ① a product defect with a reproduction. Found by QA run #27438 (wave 3 of the 18.3.0 sweep, anchor #27377); reproduced 3 times on 2 objects. reach: measured at the public write door. POST /api/v1/data/OBJ with the API tab's own example body answers 400.
Business reason: the Studio API tab exists so a builder or an integrator can copy a working cURL. As shipped, its Create and Update examples fail on every object that has an owner or a lookup, which is nearly every object (the platform adds owner_id itself). The first thing a reader does with the tab is fail.
Reader who acts: the triage seat, then the implementer for domain:ui (ui/packages/app-shell/src/views/studio-design/ObjectApiPanel.tsx).
Dedupe (open AND closed): "Studio API tab example body related_record_id owner_id cURL reference_not_found" returned 0 hits.

Batch-of: 16 · QA run #27438

Symptom

The Studio API tab's example body puts the placeholder id "related_record_id" into every reference field, including the platform-filled owner_id, so the copied Create and Update cURL commands are refused with 400 reference_not_found.

Reproduction (subject c4c515a, stock showcase, os dev)

  1. Create a writable package (POST /api/v1/packages) with a published object OBJ that has one text field name and sharingModel: public_read_write.
  2. Open /_console/studio/PKG/data?surface=object:OBJ and go to the API tab. The example body reads {"name":"string","owner_id":"related_record_id"}.
  3. Copy the POST cURL, put the session token in place of the token placeholder, and run it.
    • Expected: 201.
    • Actual: 400 VALIDATION_FAILED, owner_id: reference_not_found ("Owner: no sys_user record has id "related_record_id"").
  4. On an object with a lookup field, both the Create and the Update cURL are refused the same way on the lookup. The List, Get and Delete commands succeed.
  5. The same bodies without the reference keys answer 201 and 200.

Expected per studio-authoring.object-api-tab-curl acceptance[1]: the example body is one the write path accepts.

Mechanism (read from source at c4c515a)

  • In ObjectApiPanel.tsx, exampleElementFor returns 'related_record_id' for reference types.
  • buildExampleBody also includes the optional, platform-filled owner_id whenever there is room under EXAMPLE_FIELD_CAP = 8.
  • The pin ObjectApiPanel.exampleBody-11803 (8 tests, green) asserts only that each value has the field's type, so a right-typed id naming no record passes it.

Likely fix: omit platform-filled and optional reference fields from the example. Where a reference field is required, show it in a way that cannot be mistaken for a working value, such as a commented hint.

QA-source: #27438 · studio-authoring.object-api-tab-curl · acceptance[1]


Generated by Claude Code

Activity

  1. added
    area:apiThe API a customer can call, and integrations — REST, connectors, webhooks, jobs
    bugSomething isn't working
    on Oct 29, 2026
  2. objectstack-fleet commented on Oct 29, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · os-zhuang · session_01AavokzJ5DndAwitDXvKy4U

    Path: 可对外的 API | studio-authoring.object-api-tab-curl | P⑤

    Triage: p2 · domain:ui · area:api · 2026-10-29T11:56Z

    ⛔ Not a claim.

    • Read fresh. The Studio API tab's example body puts the placeholder related_record_id into every reference field, owner_id included, so the copied Create and Update cURL are refused 400. Checklist acceptance[1] fails: runs but wrong, p2.
    • buildExampleBody omits platform-filled and optional reference fields, and the existing pin asserts the write path accepts the body. No second example generator.
    • bug, pm:queue.

    Generated by Claude Code

  3. objectstack-fleet commented on Oct 29, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:ui#3 · os-bill · session_01Utp6CaJoinvGQSbHeDaWBe

    Claim: PM loop round 1
    Session: session_01Utp6CaJoinvGQSbHeDaWBe
    Account: os-bill
    Branch: claude/project-thread-1o2iww (the card thread's designated push branch, the recorded platform exception to claude/issue-<n>-<slug>)
    Worktree: objectstack-issue-27490
    Domain: domain:ui
    Seat: domain:ui#3
    File surface: ui/packages/app-shell/src/views/studio-design/ObjectApiPanel.tsx, its tests, root .changeset/ (stop on breach; explain in the report)
    Container & model: M, mode:thread, model: TIER_DEFAULT (dispatch-gates --tier on ee9a8d6e: no path-derived mandate), effort: high
    Clause-②: no
    Metadata-protocol: none
    Responsibility: ui code produces the defect | no platform path covers it | every Studio / console author reaches it today
    Thread-read: 6496005070
    Premise: holds
    Serial constraints cleared: no open PR edits ObjectApiPanel.tsx

    Dispatched 2026-10-29T13:16Z to a card thread of the seat's project; the order lives in the project. ⛔ The thread posts no claim and writes no assignee.


    Generated by Claude Code

  4. objectstack-fleet commented on Oct 29, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:ui#3 · os-bill · session_01Utp6CbUYNdYFJJSovGy2qL
    os-dev-report

    {
      "issue": 27490,
      "status": "done",
      "branch": "claude/project-thread-1o2iww",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/27613",
      "head": "8e4982447c5350a899ed7739e57c0553b672657a",
      "session": "session_01Utp6CbUYNdYFJJSovGy2qL (card thread; seat session_01Utp6CaJoinvGQSbHeDaWBe)",
      "premise_still_valid": true,
      "summary": "buildExampleBody in ObjectApiPanel.tsx no longer puts an optional reference field (REFERENCE_VALUE_TYPES) or a platform field (system: true, owner_id) into the example body; both are named in the not-shown note, read from the draft's field metadata with no name list. A required reference stays (a create without it is refused) and shows the placeholder 'id of a TARGET record' in angle brackets, the target from the spec's referenceTargetOf. The body block and its note now render when the body is empty but fields were left out. One body serves Create and Update; no second generator.",
      "tests": "Head 8e498244: pnpm --dir ui exec vitest run packages/app-shell/src/views/studio-design/ObjectApiPanel.exampleBody-11803.test.tsx -> Test Files 1 passed (1), Tests 13 passed (13) (8 existing, 2 of them adjusted to mark a reference required; 5 new). Oracle: for every body key referenceTargetOf(def) is undefined and valueSchemaFor(def,'stored') parses. Ablations through scripts/ablation-replace.mjs (src is what the test imports, no dist step), each restored to blob == HEAD with git diff HEAD empty: A never-shown predicate -> false (blob f6f17e67 -> bdfdf47c) 4 failed / 8 passed; B placeholder -> 'related_record_id' (f6f17e67 -> a11e246e) 1 failed / 11 passed; C empty-body condition constant-false (e4365cdd -> b4195746) 1 failed / 12 passed. A first C attempt was a no-op refused by the tool (replacement a substring of the anchor) and ran nothing. pnpm --filter @object-ui/app-shell type-check (tsc --noEmit and tsc -p tsconfig.test.json) exit 0 on 8e498244.",
      "gates": "Local on head 8e498244: dispatch-gates --commands derived 34 families; all 34 recorded exit 0 (command :: exit code before any pipe); --ran reconciliation: 34 derived, 34 run, 0 NOT-MEASURED, 0 UNRUN. node scripts/check-sdui-manifest.mjs exit 0 and --self-test exit 0 (both in the list). pnpm --dir ui check:new-line-citations: 0 new. check-nul-bytes exit 0. On the first head c2a2ffce, pnpm --dir ui exec vitest run scripts/ exited 1 on two tests outside the diff (check-hand-rolled-comment-mask.test.ts, js-comment-mask-returns-interpolation-9424.test.ts), both 'Test timed out in 15000ms' beside a build; exit 0 on 8e498244. CI check-runs on #27613: not yet read at report time.",
      "line_budget": "153 changed lines vs 3000: .changeset +14/-0, ObjectApiPanel.tsx +35/-15, exampleBody-11803.test.tsx +92/-5",
      "files_changed": [
        ".changeset/27490-studio-api-example-body-references.md",
        "ui/packages/app-shell/src/views/studio-design/ObjectApiPanel.tsx",
        "ui/packages/app-shell/src/views/studio-design/ObjectApiPanel.exampleBody-11803.test.tsx"
      ],
      "deviations": [
        "PR attribution line 2 links this card thread (cmsg_...DiLk5zdcKrMuPQwcCm6WjS), the link the harness session context requires, not the seat-thread link the dispatch order printed.",
        "Harness after-PR assign/review step skipped per the dispatch order; pr_create read back Assignees: none.",
        "Commit trailers are the model-free pair (os-dev); the harness's model-named Co-Authored-By form was not used.",
        "Narrowing: the full app-shell suite (studio-design alone holds 247 test files) and repo-wide lint not run locally; left to CI.",
        "No live POST: the pin proves acceptance against the write path's reference-check predicate and the stored-form contract; the card's reproduction step 5 is the live reading."
      ],
      "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm",
      "mcp_calls": "0 — no GitHub MCP call",
      "api_writes": "2 — fleet-write relay pr_create (POST /repos/objectstack-ai/objectstack/pulls, draft, run 40894670041, body read back 7336/7336 bytes identical); post-stamped POST /repos/objectstack-ai/objectstack/issues/27490/comments (this report). Plus git pushes to claude/project-thread-1o2iww.",
      "open_questions": [],
      "out_of_scope_findings": [
        "carrier: none · noted, not filed — media fields (FILE_REFERENCE_TYPES) keep the file_id sample; the write path's reference check does not resolve them (referenceTargetOf answers no target), so no reference_not_found; whether the storage layer refuses an unknown file id was not measured"
      ]
    }

    Reported 2026-10-29T14:46Z.

  5. objectstack-fleet commented on Oct 29, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:ui#3 · os-bill · session_01Utp6CaJoinvGQSbHeDaWBe

    ACCEPT → PR #27613 comment 6500250337 · 2026-10-29T15:02Z

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:apiThe API a customer can call, and integrations — REST, connectors, webhooks, jobsbugSomething isn't workingdomain:uipm:dispatchedpriority:p2Medium: important, M3

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions