Skip to content

meta: /meta/objects reports field metadata from the build artifact, not the registry — created_at reads readonly: false while the write path enforces read-only #4513

Closed

Description

@os-zhuang

发现于修复 #4447 时(PR #4511),与该 issue 同源但是另一处缺陷,故单独记录,未认领。

摘要

GET /api/v1/meta/objects/<object> 返回的字段元数据来自应用构建产物(dist/objectstack.json),而不是运行时注册表(registry.getObject())。两者已经不一致:写入路径按注册表强制 created_at 为只读,而这个机器可读面仍然声称它可写。

复现

pnpm dev -- --fresh -p <port>,showcase,admin 会话,在 #4447 修复之后:

GET /api/v1/meta/objects/showcase_task
→ "created_at": {"label":"Created At","type":"datetime", …, "readonly": false}

但同一个字段在同一次启动里确实是只读的:

PATCH /api/v1/data/showcase_task/<id>  {"progress":42,"created_at":"1999-01-01T00:00:00Z"}
→ 200
   droppedFields: [{"object":"showcase_task","fields":["created_at"],"reason":"readonly"}]
GET  …?select=created_at,progress
→ {"created_at":"2026-06-22T00:00:00.000Z","progress":42}   ← 锚点没动

即:面说可写,引擎按只读执行。

另外注意同一响应里 updated_at / created_by / updated_by 根本不出现,只有 created_at 出现——这本身就说明这份字段表不是注册表的投影(注册表四个都有),而是构建产物里恰好被物化的那一个。

与 #4447 的区别

影响

AGENTS.md「Route & surface ownership」第 4 条:机器可读面不许撒谎。/meta/objects 会被 SDK、代码生成、Studio 表单渲染和 AI 客户端读取:

  • 表单/Studio 会把 created_at 渲染成可编辑输入框,用户改了却静默不生效(值被 droppedFields 丢弃,UI 若不读该字段就完全无提示);
  • 代码生成/AI 作者会据此认为该字段可写,产出写它的代码;
  • 更一般地:任何构建产物与注册表存在差异的字段,这个面给出的都是产物那一侧的答案,而强制的是注册表那一侧。created_at 只是第一个被抓到的样本,不一定是唯一的。

期望

/meta/objects 投影应以运行时注册表为准(registry.getObject(),即 applySystemFields / provisionPrimary 之后的规范形状),使它与实际执行的写入契约一致。若出于性能或其他原因必须读产物,则产物必须在构建时就经过同样的规范化,并有门禁保证两者不漂移。

顺带值得查清的:构建产物里那个 created_at 是谁物化进去的(showcase 源码并未声明它,task.view.ts / dashboards / datasets 只是引用了它)。如果是「把视图引用到的字段补进对象」这类构建步骤,那它用 FieldSchema 默认值补出一个系统字段本身就该修——那会是第三处,比这个面更靠上游。

Activity

  1. os-zhuang commented on Aug 2, 2026

    @os-zhuang
    ContributorAuthor

    PM 分诊:暂不可派发——正文已被 GitHub 净化器截断。 现存正文在 GET /api/v1/meta/objects/ 处戛然而止:路径里的尖括号占位符(如 &lt;name&gt; 直接写成裸尖括号)被当作未闭合的 HTML 标签,其后全部内容在存储层丢失。这是已知陷阱(写法规避:尖括号后加空格,或用反引号包裹整段代码)。

    原始细节无法从 GitHub 恢复。请知情人(原发现记录于修复 #4447 / PR #4511 期间)重新补写正文;补好后打回 pm:queue 即可进入派发。


    Generated by Claude Code

  2. xuyushun441-sys commented on Aug 3, 2026

    @xuyushun441-sys
    Collaborator

    ⚠️ 正文被截断,当前无法派发 —— 请作者修复

    本 issue 的正文在 ## 摘要 之后只剩一行就断了:

    `GET /api/v1/meta/objects/
    

    后面的全部内容(复现、定位、影响、期望)在 GitHub 上不存在 —— 不是显示问题,API 取回的原文就到此为止。

    原因:正文里写了裸的尖括号占位符(几乎可以肯定是 `GET /api/v1/meta/objects/<objectName>` 这种形式)。GitHub 的 HTML sanitizer 把 <objectName> 当成未知标签,从该处起吞掉后面的所有内容并持久化,连反引号里的也不放过。这是本仓已知的一种 issue 正文丢失形态。

    修复方式(作者 @os-zhuang 重新编辑正文即可):把裸尖括号换成任一安全写法 ——

    • `GET /api/v1/meta/objects/:objectName`(冒号占位,推荐)
    • `GET /api/v1/meta/objects/{objectName}`(花括号)
    • 或对尖括号做 HTML 转义:&lt;objectName&gt;

    为什么现在提:PM 在做发版前的未入队清单扫描时命中本条。从残存的标题看,这是一个够得上发版考虑的缺陷 —— /meta/objects 从构建产物而非 registry 报字段元数据,导致 created_at 对外报 readonly: false,而写路径实际强制只读:同一个字段,读接口与写行为互相矛盾,而客户端(以及照着 /meta 写代码的 AI)只看得到读接口那一面。

    但正文没有复现与定位,任何人都无法据此派发。修好之后我会把它重新纳入清单。


    Generated by Claude Code

  3. added
    bug
    on Aug 3, 2026
  4. added
    pm:queue
    and removed on Aug 5, 2026
  5. os-zhuang commented on Aug 6, 2026

    @os-zhuang
    ContributorAuthor

    存量裁决轮(维护者 2026-08-06 委托,session_01LeEfA7CFwbJb7JJmXm2KM3):裁定入队(正文已补全,按评论区既定口径打回 pm:queue)。前提经 origin/main 核实仍在:scoped 内核下 meta 读面仍优先走 protocol 存储、注册表仅回退,与 #4447 修复后的写路径公开矛盾——机器可读面对 readonly 撒谎。派发时注意与 #3682 同触 meta 读路径。维护者可否决。


    Generated by Claude Code

  6. hotlong commented on Aug 7, 2026

    @hotlong
    Contributor

    迁移:domain:engine-core → domain:metadata(维护者 2026-08-07 批准拆分;座位贴 #6367,SKILL PR #6370)。落点证据:GET /api/v1/meta/objects 读 build artifact 而非 registry,created_at 读写 readonly 不一致 —— /meta 读/注册表接缝。全量分类审计 49 卡三判,本卡 MOVE/high。分诊会话:session_01BickTBKm2JYSNnrtPT8ysa。


    Generated by Claude Code

  7. added
    pm:dispatched
    on Aug 7, 2026
  8. self-assigned this
    on Aug 7, 2026
  9. baozhoutao commented on Aug 7, 2026

    @baozhoutao
    Collaborator

    Claim: PM loop round 1 (domain:metadata seat, sticker #6367)
    Session: session_01KDU3qAuJyajAQm3GkUXfdA
    Branch: claude/issue-4513-meta-fields-from-registry
    Worktree: objectstack-issue-4513
    Domain: domain:metadata
    File surface: meta single-object/list read seam — packages/metadata-protocol/src/protocol.ts (getMetaItem read side / sys-metadata repository read) and/or packages/runtime/src/domains/meta.ts; packages/rest/src/rest-server.ts only if the defect proves to live in the route handler (cross-lane touch, to be minimized and flagged in the report). Stop on breach; explain in the report.
    Serial constraints cleared: #3682 (same meta read path, per the 2026-08-06 ruling comments here and there) deliberately held to a later round — never same batch; #5839 in flight (engine-core session claim 15:30Z, surface: metadata-core + a protocol.ts runtime index migration — different function region); #4636 closed today via PR #6261; churn on this seam in the last 24h: #5895 (envelope convergence), #6271, #6336, #6051, and queued #6348 (rest :type normalization) — dev is instructed to verify the premise against current origin/main and merge main before opening the PR.
    Container class: M — mode:subagent, shared container.

    Note: the issue body remains sanitizer-truncated; per the 2026-08-06 backlog-adjudication comment the authoritative scope is the comment thread (readonly mismatch between the /meta read surface and the enforced write path), and dispatch proceeds on that basis.


    Generated by Claude Code

  10. baozhoutao commented on Aug 8, 2026

    @baozhoutao
    Collaborator

    Correction to the claim above: the session ID contains a transposition typo. The correct ID is session_01KDU3qAuJyajAQm3GkUXdfA (matches the seat takeover audit on #6367). Branch, worktree, and all other claim fields are unchanged.


    Generated by Claude Code

  11. baozhoutao commented on Aug 8, 2026

    @baozhoutao
    Collaborator

    File-surface amendment to the claim above (PM, session session_01KDU3qAuJyajAQm3GkUXdfA, after the dev's mid-flight briefing):

    Verified premise is wider than filed: all four metadata-protocol read exits (single / list / cached / layered-effective) report readonly: false for materialized audit fields, because only the SchemaRegistry segment of the resolution chain (overlay → MetadataService → SchemaRegistry) applies applySystemFields (#4447's write-path enforcement).

    Amended surface, checked against in-flight claims before approval:


    Generated by Claude Code

  12. added a commit that references this issue on Aug 8, 2026
  13. baozhoutao commented on Aug 8, 2026

    @baozhoutao
    Collaborator

    ACCEPT (PM review, domain:metadata seat, session session_01KDU3qAuJyajAQm3GkUXdfA) — PR #6561.

    Shipped: every /meta object read exit now reports the audit-provenance family the way the engine enforces it (readonly: true, system: true on declared audit fields), closing the read/write contradiction #4447 left open. The premise held and proved broader than the title: the root cause is that only the SchemaRegistry link of the overlay → MetadataService → SchemaRegistry chain ever ran applySystemFields. The governance table sank into @objectstack/metadata-core (dependency-direction forced, same criterion as #5619), objectql re-exports it — verified in the diff as re-export-only with a byte-identical table, per the claim's cross-lane condition.

    Review verified against GitHub: 7 files exactly on the amended surface (rest-server.ts, packages/spec, releases untouched); ESLint and TypeScript Type Check success, 24 checks zero failures; one case table drives all 7 exits (19 cases) with the reverse verification measured 8-red/11-green in the predicted direction, and the 11 greens correctly identified as over-forcing guard rails; both ratchets paid down rather than raised (query-options-erasure 264→263, objectql debt re-measured 353 < 355). Changeset present (patch × 3 packages) — skip-changeset correctly not applied.

    Scoping judgments accepted as correct: declared-fields-only (protects the #4326 GET→PUT round-trip), effective-only on the layered read (keeps its documented promise), stored bodies untouched (no phantom customization). The authored-vs-effective contract question this surfaced is properly parked as #6562 (finding, for triage to grade) rather than guessed at.

    PR flipped ready and queued (auto-merge); the issue closes on merge via the Fixes line. On merge, the same-seam holds on #3682 / #6190 / #5079 lift.


    Generated by Claude Code

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

Metadata

Metadata

Assignees

Labels

bugpm:dispatchedpm:queue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions