Skip to content

metadata: an object's fields come back in alphabetical order after save/publish, so the default create form loses the declared field order #32398

Closed as not planned

Description

@os-bob

Edition: ObjectOS Cloud (os-test environment, MCP connection)

What happened

An object was created over MCP create_metadata(type: object) with its fields map in business order:

leave_no, employee_name, department, leave_type, start_date, end_date, days, reason, status, approver, approval_comment, attachment

After publish, describe_object returns the fields (after the system columns) in alphabetical order:

approval_comment, approver, attachment, days, department, employee_name, end_date, leave_no, leave_type, reason, start_date, status

The console's default create form ("新建请假申请", with no form view declared) follows that order, so it opens with 审批意见 / 审批人 / 证明附件 first and 员工姓名 / 开始日期 at the bottom: the form reads as random to an end user.

Expected

The declared order of fields is the order the default form, the default list columns and describe_object use. A JSON object's insertion order is the only ordering an author has for fields, and it should survive save and publish. Today the author has to hand-write a form view just to get a sensible field order.

Steps

  1. Create an object whose fields keys are not in alphabetical order (MCP create_metadata or apply_blueprint).
  2. Publish it, then describe_object → fields come back alphabetically.
  3. Open the object's list and click 新建 → the form follows the alphabetical order.

Generated by Claude Code

Activity

  1. added
    bug
    on Nov 11, 2026
  2. objectstack-fleet commented on Nov 11, 2026

    @objectstack-fleet
    Contributor

    triage#1 · os-zhuang · session_01AavokzJ5DndAwitDXvKy4U

    Path: none

    Triage: first touch → domain:server · p2 · pm:queue · 2026-11-11T06:57Z

    ⛔ Not a claim.

    • Lane: domain:server (metadata save and publish; describe_object).
    • Grade: p2. Declared field order is lost after save or publish, so the default form and list columns read alphabetically. It is a usability defect with no data loss.

    Generated by Claude Code

  3. added
    domain:server
    pm:queue
    priority:p2
    on Nov 11, 2026
  4. objectstack-fleet commented on Nov 11, 2026

    @objectstack-fleet
    Contributor

    domain:server#3 · os-bill · session_01Utp6CaAUev5V62cLHhQwBi

    Claim: PM loop round 1 · #32398 · 2026-11-11T12:29Z · bug (p2)
    Session: session_01Utp6CaAUev5V62cLHhQwBi (seat); dev = card thread session_01Utp6CZ3AbHTKFisziGAaK5
    Account: os-bill
    Branch: claude/project-thread-1hwmue (the card thread's harness-pinned branch; platform exception to claude/issue-<n>-<slug>)
    Worktree: objectstack-issue-32398
    Domain: domain:server
    Seat: domain:server#3
    File surface: the hop that reorders ObjectSchema.fields on create → publish → describe, expected in packages/metadata-core/**, packages/metadata/**, packages/metadata-protocol/** or packages/mcp/**, named by the dev's step 0 before editing; their tests; one changeset (stop on breach; explain in the report)
    Container & model: M, mode:thread, model: default tier (dispatch-gates --tier: no path-derived mandate), effort: high
    Clause-②: no
    Metadata-protocol: none
    Responsibility: platform code (objectstack) on the metadata save/publish/describe path produces the sort; no platform path covers it today (authors hand-write a form view); every author who creates an object with non-alphabetical fields reaches it
    Thread-read: 6789288757
    Premise: holds (read at 7d82b2da: canonicalize.ts keeps object.fields order only when the type is passed; type-blind sorts remain on the tree; the reorder hop itself is the dev's step 0 measurement)
    Serial constraints cleared: none on a named file; open PR #32327 edits protocol-meta-item-face.ts / protocol-meta-layered-reads.ts — if step 0 lands the fix there, the later lander merges main

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

    @objectstack-fleet
    Contributor

    domain:server#3 · os-bill · session_01Utp6CZ3AbHTKFisziGAaK5
    os-dev-report

    Step 0 did not reproduce the card on objectstack 7d82b2da: every hop this repository owns keeps the declared fields order. No code changed, no PR. The create_metadata / apply_blueprint tools the card names are not implemented in this repository; docs/adr/0070-package-first-authoring.md names ../cloud (service-ai-studio) as their home. Carrier: cloud.

    Per-hop readings (probe: showcase dogfood boot plus MCPServerPlugin; package app.ordprobe32398; object ordprobe_leave with the card's 12 fields in the card's order):

    hop sqlite-wasm (database file) memory driver
    PUT /meta/object/NAME?mode=draft&package=PKG 200 200
    POST /packages/PKG/publish-drafts 200, published 1 200, published 1
    GET /meta/object/NAME declared order declared order
    GET /meta/object (list) declared order declared order
    objectql registry.getObject declared order declared order
    MCP HTTP describe_object 8 injected system columns, then declared order same
    stop, cold boot on the same file, GET + registry declared order n/a (in-memory)

    Artifact door (MetadataPlugin artifactSource local-file, build-shaped showcase artifact): 6 showcase objects whose declared fields are not alphabetical; the artifact keeps their order and the served order equals the declared one.

    {
      "issue": 32398,
      "status": "done",
      "branch": "claude/project-thread-1hwmue",
      "pr": null,
      "session": "session_01Utp6CZ3AbHTKFisziGAaK5",
      "premise_still_valid": false,
      "summary": "Step 0 measured create (draft save door) -> publish-drafts -> /meta item and list reads -> registry -> MCP describe_object -> cold boot, on sqlite-wasm and the memory driver, plus the artifact door: the declared fields order survives every hop in this repository. The seat's candidate sites were read: the type-blind canonicalize callers (draft-changes, package-upgrade-plan, package-upgrade-environment), metadata-history-utils normalizeJSON, the extension owner-field canonical(), and the metadata plugin's artifact checksum only hash or compare and never feed a stored or served body; sortObjectKeys is opt-in sortKeys on the json/typescript serializers. Postgres jsonb is ruled out by the card's own reading (jsonb orders keys length-first, the card shows plain alphabetical). The card's door (create_metadata / apply_blueprint) lives in cloud service-ai-studio, which this session cannot read.",
      "tests": "Scratch probes only, not committed (os-dev: no permanent file for a one-off proof): showcase boot over sqlite-wasm with databaseFile + cold reboot, and over databaseDriver memory, each printing the field order after every hop; a second probe over the MetadataPlugin artifact door. All readings above; each run's os-verify-lock VERDICT command-exit 0.",
      "gates": "none run: no diff",
      "dogfood_battery": "n/a — no diff",
      "mcp_calls": "2 — issue_read get, issue_read get_comments (reads only)",
      "api_writes": "1 — this os-dev-report comment via post-stamped",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": ["carrier: cloud · the alphabetical order reaches describe_object on the os-test deployment through the cloud create_metadata / apply_blueprint path or the deployment's own storage; neither is in objectstack. Dedupe words: create_metadata field order alphabetical, service-ai-studio fields sort, describe_object field order"]
    }

    Report taken 2026-11-11T12:42Z.

  7. objectstack-fleet commented on Nov 11, 2026

    @objectstack-fleet
    Contributor

    domain:server#3 · os-bill · session_01Utp6CaAUev5V62cLHhQwBi

    Release: claim 6795835969 (domain:server#3 · session_01Utp6CaAUev5V62cLHhQwBi) · 2026-11-11T12:44Z · reason: premise false in objectstack · next: triage, for a cloud re-route

    • Reading: os-dev-report 6796124697 has premise_still_valid: false and pr: null. Measured at 7d82b2da, every hop keeps the declared field order: draft PUT → publish-drafts → GET /meta/object/<name> → registry → MCP describe_object → cold boot. That holds on sqlite-wasm, on the memory driver and through the artifact door. create_metadata and apply_blueprint are not in this repo; ADR-0070 Consumers names cloud service-ai-studio as their home. So the reorder is on the cloud path, or in the os-test deployment's driver, and neither is measurable from here.
    • Ask to triage: route the card to cloud (carrier: cloud), or close it with a cloud card. The card returns to pm:queue with pm:retriage and no assignee. Resume-from: none (nothing pushed).
  8. added
    pm:queue
    pm:retriage
    and removed
    pm:dispatched
    on Nov 11, 2026
  9. objectstack-fleet commented on Nov 11, 2026

    @objectstack-fleet
    Contributor

    triage#1 · os-zhuang · session_01AavokzJ5DndAwitDXvKy4U

    Path: none

    Triage: re-routed domain:server → domain:cloud · p2 · 2026-11-11T12:46Z

    ⛔ Not a claim.

    • Reading: domain:server#3's step 0 (6796124697) measured every objectstack hop and found the declared fields order kept throughout. Those hops are the draft save, publish-drafts, the /meta item and list reads, the registry, MCP describe_object, a cold boot, and the artifact door, run on sqlite-wasm and the memory driver.
    • Producer: create_metadata and apply_blueprint, the tools the card names, live in cloud's packages/service-ai-studio (authoring-whitelist.ts), not in this repository.
    • Lane: domain:cloud + repo:cloud.
    • One hop is not measured: the hosted storage. If os-test runs on PostgreSQL through objectstack's driver-sql, the claimer first checks the order there. If that platform hop reorders the fields, it comes back as its own domain:server card.

    Generated by Claude Code

  10. added
    domain:cloud
    repo:cloud
    and removed
    domain:server
    pm:retriage
    on Nov 11, 2026
  11. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    Contributor

    repo:cloud#5 · hotlong · session_01Q4EjjPP1zuWBNq3nBXVei9

    Claimed 2026-11-16T13:39Z on the owner's question in the cloud seat thread (2026-11-16), verbatim: 「AI 搭建器五张:#32984、#32398、#32397、#32456、#32598(p2) 这些是否应该你认领派发」. This card is domain:cloud and the fix lands in objectstack-ai/cloud, so the cloud seat takes it. Owner priorities 「CI降本,AI 搭建质量 优先」. Kept priority:p2 as triaged.

    Claim: PM loop round 12
    Session: session_01Q4EjjPP1zuWBNq3nBXVei9
    Account: hotlong
    Branch: claude/issue-32398-field-order (in objectstack-ai/cloud)
    Worktree: cloud-issue-32398
    Domain: domain:cloud
    Seat: repo:cloud#5
    File surface: packages/service-ai-studio/src and packages/objectos-runtime/src (wherever the declared fields order is lost between create_metadata / apply_blueprint and describe_object), their tests, one changeset (stop on breach; explain in the report)
    Container & model: M, mode:subagent, model: default, effort: high
    Clause-②: no
    Metadata-protocol: none
    Responsibility: cloud's build door (service-ai-studio authoring path or the hosted storage hop) reorders fields; if the reorder is in objectstack's driver-sql, that half comes back as its own domain:server card | none | every app built over MCP or the AI builder without a form view
    Thread-read: 6796213367
    Premise: corrected 6796213367 (objectstack hops measured clean by domain:server#3; the dev reproduces on cloud main first, including the hosted PostgreSQL hop, and returns premise_still_valid:false with evidence if order is kept)
    Serial constraints cleared: #32456 and #32598 (same round, service-ai-studio): disjoint files; cloud#4737 (propose tools, in the merge queue): disjoint

  12. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 16, 2026
  13. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    Contributor

    repo:cloud#5 · hotlong · session_01Q4EjjPP1zuWBNq3nBXVei9
    os-dev-report

    Step 0 did not reproduce the card on cloud main 1fee288b0 (framework pin 8436f67a2d52). Every hop between the MCP build door and describe_object keeps the declared fields order. No code changed, no PR.

    Probe: a hosted tenant kernel (createTenantKernelE2e), driven through the MCP build door with an OAuth token. The object has the card's 12 fields in the card's order, with card-shaped types (autonumber, select with options, date, number, textarea, lookup to sys_user, file).

    hop SqlDriver better-sqlite3 TursoDriver, REMOTE face
    apply_blueprint → publish-drafts → describe_object / GET /meta/object/NAME declared order declared order
    create_metadata(type: object) → publish-drafts → describe_object / /meta declared order declared order
    kernel evict + rebuild on a fresh OS_HOME → both objects declared order declared order
    update_metadata adds two fields → publish declared 12, then the new two appended same
    default list view columns blueprint: declared order; create_metadata scaffold: title field first, then declared order same

    describe_object serves the 8 injected system columns and then the declared order. The PostgreSQL hop does not apply, because hosted environments are Turso-only. jsonb would also give length-first order, not the alphabetical order the card shows.

    {
      "issue": 32398,
      "status": "done",
      "branch": "claude/issue-32398-field-order",
      "pr": null,
      "session": "session_01Q4EjjPP1zuWBNq3nBXVei9",
      "premise_still_valid": false,
      "summary": "Step 0 did not reproduce the card on cloud main 1fee288b0 (framework pin 8436f67a2d52) through the real door: a hosted tenant kernel (createTenantKernelE2e) driven over the MCP build door with an OAuth token, the 12 card fields in the card's business order with card-shaped types (autonumber, text, select with options, date, number, textarea, lookup to sys_user, file). apply_blueprint, create_metadata(type: object), the person's publish-drafts, MCP describe_object, GET /api/v1/meta/object/NAME, a kernel evict plus rebuild on a fresh OS_HOME, and update_metadata adding two fields then publishing all keep the declared order; describe_object serves the 8 injected system columns and then the declared order. The default list views keep it too (the blueprint view in declared order; the create_metadata scaffold puts the title field employee_name first, then the declared order, which is the intended title-first rule, not a sort). Measured on SqlDriver better-sqlite3 and on TursoDriver in REMOTE transport mode, the face every hosted tenant database is on. The PostgreSQL hop does not apply: hosted environments are Turso-only (artifact-environment-registry: createDefaultEnvironmentAdapters is turso-only), and objectstack driver-sql materialises json as knex json (not jsonb) in any case, while jsonb would give length-first order, not the alphabetical order the card shows. A static read of every key sort in service-ai-studio, service-ai, objectos-runtime, service-cloud and security-enterprise found only hash, signature, comparison and audit-summary uses (blueprint-amend canonical, confirm-scope proposalSignature, action-confirmation canonicalJson, package-publish-bodies stableJson, mcp-tool-interceptor mcpArgumentKeys); none feeds a stored or served body. No code changed, no PR.",
      "tests": "Scratch probe only, not committed (os-dev: no permanent file for a one-off proof): apps/objectos test probe built on the verify-build-publish-parity-4444 harness, six runs under os-verify-lock, each VERDICT command-exit 0, Tests 1 passed (1). Readings (user fields after the system columns), identical on every hop and both drivers: [leave_no, employee_name, department, leave_type, start_date, end_date, days, reason, status, approver, approval_comment, attachment]. Hops: blueprint after publish (describe_object, /meta), create_metadata after publish (describe_object, /meta), both after kernel evict + rebuild on a fresh OS_HOME, create_metadata object after update_metadata + publish (new fields zz_note, aa_first appended after the declared 12, in the patch's order). TursoDriver run printed transportMode=remote. List views: blueprint .list columns in declared order (days carries summary sum); create_metadata .list columns employee_name first then the declared order. Draft reads before publish answered 404 / no fields on both doors (unpublished objects are not served there), so the draft row itself is not read here; the published readings cover what the card reports. Ablation: n/a, no diff.",
      "gates": "none run: no diff. Build closure for the probe: pnpm --workspace-concurrency=2 --filter '@objectstack/objectos^...' build under the lock, VERDICT command-exit 0.",
      "dogfood_battery": "n/a — no diff, no PR",
      "mcp_calls": "0 — card, comments and claim read through gh api REST (single-issue reads); the huayan connector (production) was not used",
      "api_writes": "1 — POST repos/objectstack-ai/objectstack/issues/32398/comments (this os-dev-report, via post-stamped). Not REST: git push of the empty branch claude/issue-32398-field-order to objectstack-ai/cloud (routing probe; it sits at origin/main 1fee288b0 with no commits and can be deleted)",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none · two hops stay NOT MEASURED and are not cloud main code: (1) the cloud build os-test ran when the card was filed (on 2026-11-11, cloud main then was e88c118e with framework pin ff04ad811da5; the pin has moved four times since, to 8436f67a2d52; step 0 on the framework side measured objectstack 7d82b2da, a descendant of ff04ad81, clean) — reason: the huayan connector is production and off limits, and building a second framework pin tree for a historical cloud commit was not attempted; (2) the reporter's MCP client serialising tool arguments with sorted keys before they reach the server — reason: no access to the reporting session's client. Re-filing should start with a fresh reproduction on os-test at its current build that records the raw tools/call request body. Dedupe words: create_metadata field order alphabetical, describe_object field order, MCP arguments key order"
      ]
    }

    Report taken 2026-11-16T13:56Z.


    Generated by Claude Code

  14. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    Contributor

    repo:cloud#5 · hotlong · session_01Q4EjjPP1zuWBNq3nBXVei9

    Seat review of the os-dev report 6918456074, 2026-11-16T13:58Z: premise_still_valid: false, pr: null. Accepted after reading the report's readings. The claim 6918077363 is released in this stroke (assignee removed); the next stroke closes the card and takes pm:dispatched off with it.

  15. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    Contributor

    repo:cloud#5 · hotlong · session_01Q4EjjPP1zuWBNq3nBXVei9

    Closing not_planned: the defect does not reproduce at the current build. Closed 2026-11-16T13:58Z. Reopening is free.

    • Cloud side, measured (report 6918456074, cloud main 1fee288b0, framework pin 8436f67a2d52):
      • The test used a hosted tenant kernel through the real MCP build door, with the card's 12 fields in its business order.
      • The declared order survived every hop: apply_blueprint and create_metadata, publish, describe_object, /api/v1/meta/object/NAME, a kernel evict plus rebuild on a fresh home, and update_metadata plus publish (new fields are appended in the patch's order).
      • Measured on better-sqlite3 and on Turso in remote mode, the driver every hosted tenant uses. Hosted environments are Turso-only, so the PostgreSQL hop the triage named does not apply.
      • A static read of every key sort in the cloud packages found only hashes, signatures and comparisons. None feeds a stored or served body.
    • Framework side, measured earlier: clean (domain:server#3, 6796124697).
    • Not measured:
      1. The os-test build of 2026-11-11. The framework pin has moved four times since.
      2. The reporter's MCP client, which might send tool arguments with sorted keys.

    A re-filing should start from a fresh reproduction on the current build that records the raw tools/call request body; that tells the two apart.

  16. removed
    pm:dispatched
    on Nov 16, 2026
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:cloudpriority:p2repo:cloud

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions