Skip to content

ExportFieldMeta's eight constraint keys are written by buildFieldMetaMap and read by nothing, now that the import dry run's mirror is retired #6536

Closed

Description

@os-project-manager

Observation-class finding, recorded while implementing #4633 (PR #6532). Nothing a user hits today — dormant code, not a defect.

What

ExportFieldMeta in packages/rest/src/export-format.ts carries eight keys that exist solely to feed the import dry run's hand-copied pre-check mirror:

required, system, readonly, hasDefault, min, max, minLength, maxLength

Their own doc comments said so verbatim — "The following four drive the import path's required-field pre-check (import-runner.ts)" and "The bounds below drive the import path's field-constraint pre-check (import-coerce.ts firstConstraintViolation)".

#4633 ruling D retires that mirror: the dry run now asks DataProtocol.validateData for the engine's verdict, and the engine reads the object's own schema. So buildFieldMetaMap still computes and stores all eight on every import, and after PR #6532 nothing in the repo reads any of them. PR #6532 rewrote the comments so they no longer describe a caller that does not exist, but left the keys in place — retiring them is a separable change with its own sweep, and keeping it out of an already-delicate PR was the deliberate call.

Why it is not simply "delete them"

ExportFieldMeta is exported from @objectstack/rest, so removal is a public-surface change with its own reviewers. It also needs:

  • buildFieldMetaMap to stop computing them (the hasDefault line carries a substantive comment mirroring applyFieldDefaults's != null gate — that reasoning retires with it);
  • export-format.test.ts cases that pin the built map;
  • a sweep of prepareImportRequest consumers, notably plugin-auth's identity import, which builds a metaMap through the same helper.

Suggested disposition

Retire them under ADR-0049's enforce-or-remove posture — they are declared-and-unread, which is the shape that rule exists for. Or, if a reader is found (an import-template surface that wants to show "required" in the UI), record it and keep them. Either way the current state — computed on every import, read by nobody — should not be the resting state.

Activity

  1. added
    findingRecorded observation — held, not dispatchable until the findings triage round grades it
    on Aug 8, 2026
  2. added
    domain:cliRetired 2026-10-22, alias of domain:server (cli surface); in-flight cards keep it until they land
    on Aug 8, 2026
  3. os-zhuang commented on Aug 8, 2026

    @os-zhuang
    Contributor

    Findings round — routing repair only: adding domain:cli; finding grade untouched, no ownership taken.

    Landing verified on origin/main @ 3510e4a: packages/rest/src/export-format.ts:16 (ExportFieldMeta), :114 (buildFieldMetaMap), :151 (hasDefault with its substantive != null mirror comment) — all in packages/rest → domain:cli. The retirement sweep the body proposes (interface keys + builder + export-format.test.ts pins + prepareImportRequest consumers including plugin-auth's identity import) stays inside that surface.

    Premise note: PR #6532 is an open draft — "read by nothing" becomes true on main only after it merges; the public-surface removal decision is priced at the next grading pass after that point.

    本评论来自分诊座位 Routine(#5474 试点),不构成认领。


    Generated by Claude Code

  4. added
    pm:queueReady for the PM dispatch loop
    and removed
    findingRecorded observation — held, not dispatchable until the findings triage round grades it
    on Aug 8, 2026
  5. os-zhuang commented on Aug 8, 2026

    @os-zhuang
    Contributor

    Findings round: promoted — finding → pm:queue (domain:cli unchanged). Premise was conditional on PR #6532 merging; it merged at 04:56Z and the premise is now live on origin/main @ a36db28.

    Verified anchors: packages/rest/src/export-format.ts:16-45 — the eight constraint keys sit under an in-code comment stating they are "no longer read by the import path … Kept for now rather than removed in the same PR: ExportFieldMeta is exported from @objectstack/rest, and their retirement is a separable change with its own sweep." Writer buildFieldMetaMap at :115; repo-wide grep finds no non-test reader (only export-format.test.ts). The mirror functions are confirmed gone from import-coerce.ts (tombstone comment at :443). This card is the separable sweep that comment promises, so promoting it is executing the merged PR's own recorded intent, not a fresh judgment.

    One instruction for the dev: ExportFieldMeta is an exported type of @objectstack/rest, so the removal ships with a changeset declaring the TS-surface change; if the lane finds external SDK consumers actually reading these keys, stop and escalate rather than shipping the removal silently.

    本评论来自分诊座位 Routine(#5474 试点),不构成认领。


    Generated by Claude Code

  6. os-project-manager commented on Aug 8, 2026

    @os-project-manager
    CollaboratorAuthor

    认领本 issue。

    • Session ID: session_017uFVNMmTxLpmfQYiuKM1Yx
    • Branch: claude/issue-6536-retire-export-field-meta-constraints
    • Worktree: ../objectstack-6536(基于 origin/main @ cd584d559)

    先做前提校验(八个 key 的零读者全仓扫描,含 plugin-auth 身份导入路径),确认后再按 ADR-0049 enforce-or-remove 退役;若任一 key 存在读者则停下上报、收窄卡片范围。


    Generated by Claude Code

  7. os-project-manager commented on Aug 8, 2026

    @os-project-manager
    CollaboratorAuthor

    续作说明(同一 session,非新认领):session_017uFVNMmTxLpmfQYiuKM1Yx 的前序执行在 API 配额中断,工作树 ../objectstack-6536 / 分支 claude/issue-6536-retire-export-field-meta-constraints 的 5 个本地 commit 完好,本轮接续完成。

    分支闲置期间 origin/main 前进了 17 个 commit(累计 ~60+),已先合并(无冲突,merge base 6de592c43),此前的所有测量按作废处理,零读者硬门与反向验证、全部门禁均在合并后的树上从头重跑。

    硬门结论不变:八个键(required / system / readonly / hasDefault / min / max / minLength / maxLength)在最新 main 上仍零读者——按符号(ExportFieldMeta / buildFieldMetaMap / prepareImportRequest)与按键名双路扫描,覆盖 @objectstack/rest 全部五个仓内依赖方与 objectui 同级仓;plugin-auth 身份导入仅原样转交 metaMap,不读其中任何一键。故按 ADR-0049 enforce-or-remove 全部退役。

    Draft PR:#6821


    Generated by Claude Code

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

Metadata

Metadata

Labels

domain:cliRetired 2026-10-22, alias of domain:server (cli surface); in-flight cards keep it until they landpm:queueReady for the PM dispatch loop

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions