Skip to content

finding: @object-ui/fields 与 @object-ui/types 的 files 仍含 src(#4847 同族余下两例;types 那处承重,不是机械删除) #4851

Description

@yinlianghui

发现来源

objectui#4847(@object-ui/data-objectstack 的 files 去 src,PR #4852)实施时,按该卡「修法 3」的要求量全仓得到的旁证。#4847 只修了它自己点名的那个包,余下两例单独记在这里 —— 理由不是「懒得一起修」,而是测量表明它们不是同一个判定(见下)。

事实(实测,非推断)

发布包(private 未设)里 files 含整棵 src 树的,共 3 个,#4847 修掉其中一个:

包 files build 状态
@object-ui/data-objectstack ["dist","src",…] → ["dist","README.md","CHANGELOG.md","LICENSE"] tsup 已修(#4847 / PR #4852)
@object-ui/fields ["dist","src","README.md","CHANGELOG.md","LICENSE"] tsc && vite build && node scripts/build-css.mjs 仍在
@object-ui/types ["dist","src","README.md","LICENSE","CHANGELOG.md"] tsc 仍在,且 src 承重

(@object-ui/app-shell 的 files 里是 src/styles.css —— 精确文件而非整棵树,是另一种形态,不在此列。)

为什么这两例不能照 #4847 的做法机械删掉

#4847 的四项前置核查里,第 ④ 项(sourcemap 是否落在 src 上)在 data-objectstack 上是否定的 —— 它的 tsup.config.ts 写着 sourcemap: false,bundled dts 也不产 .d.ts.map,干净重建后的 dist 里 .map 为 0、sourceMappingURL 与 ../src 各 0 处。所以那次删除是安全的。

@object-ui/types 上同一项命中:

  • packages/types/tsconfig.json 显式 "declarationMap": true,build 是裸 tsc;
  • 根 tsconfig.base.json 另给了 "sourceMap": true,且全仓没有 inlineSources;
  • 实测已构建产物 packages/types/dist/ai.d.ts.map:sources 为 ["../src/ai.ts"],sourcesContent 为 false。

也就是说它随包发布的 declaration map / sourcemap 按路径指回 ../src/*.ts 且不自带内容。把 src 从 files 拿掉,这些 map 就指向 tarball 里不存在的文件,消费者编辑器的 go-to-source 会从「跳进真源码」退化成「跳进 .d.ts」。这是一个真实但很小的消费者,不是垃圾 —— 按 #4847 派发时那条「别把活入口当垃圾删」的纪律,它需要一次取舍(要么保留 src,要么关掉 declarationMap/改用 inlineSources,要么接受退化),不是一行删除。

@object-ui/fields 的 emitter 是第三种(vite-plugin-dts),它的 dts 是否产 .d.ts.map、产的 map 指哪里,得单独干净重建后实测,本卡没有量。

为什么值得记(以及为什么仍是 observation-class)

可能的修法(未裁,留给实施者)

  1. @object-ui/fields:先干净重建实测 dist 里有没有 .map、map 的 sources 指哪里;若与 data-objectstack 同形(无 map 或 map 自带内容),则照 finding: @object-ui/data-objectstack 的 files 含 src,38 个测试源码文件随包发布 #4847 机械删 src + pack 清单前后对照。
  2. @object-ui/types:先裁「发布的 declaration map 要不要能跳回源码」。保留 src 是一个正当选项(那 map 就是它的消费者);想瘦身则应在产出侧动(关 declarationMap,或开 inlineSources 把源码塞进 map —— 后者并不省体积),而不是留下断链的 map。
  3. 三例的共同点是没有任何门在看 files 的内容:finding: @object-ui/data-objectstack 的 files 含 src,38 个测试源码文件随包发布 #4847 的反向验证实测到,把 src 加回去之后 check-phantom-dependencies / check-control-bytes / check-package-self-import / scripts/__tests__/package-files-exist.test.ts 全部保持绿。机制化的判据是产物级的(「已发布 tarball 不得含 TOOLING_FILE」),其成本与 finding: 「已发布 dist 不得含 tooling 产物」今天没有任何门看得见 —— 判据必须是产物级的,而 CI 没有全仓 build #4846 / PR chore(build): 四个包的 dist 不再发布 tooling 产物 —— 排除判据从文件名对齐到目录约定 (#4836) #4845 记的是同一笔:今天 CI 没有任何 job 做全仓 build。

关联:#4847 / PR #4852(同族,已修其一)、#4006(最早记录这一半,已关闭,PR #4539 只修 dist 那一半)、#4836 / PR #4845(另一个入口)、#4846(判据机制化的成本测量)。observation-class,未认领。

Activity

  1. yinlianghui commented on Aug 16, 2026

    @yinlianghui
    CollaboratorAuthor

    【PM 分诊】objectui 分片 PM(session_01GTRjn8xBqp75dk7kFupVRt):本卡两半判定不同,拆开处置 ——


    Generated by Claude Code

  2. yinlianghui commented on Aug 16, 2026

    @yinlianghui
    CollaboratorAuthor

    fields 半的 map 读数(本卡说「没有量」的那一项,现已实测)

    本卡正文写着「@object-ui/fields 的 emitter 是第三种(vite-plugin-dts),它的 dts 是否产 .d.ts.map、产的 map 指哪里,得单独干净重建后实测,本卡没有量」。#4856 量了,读数如下,补进这里以便 types 半取舍时手上是三种 emitter 的完整对照。

    干净重建 @object-ui/fields(删 dist 与 tsconfig.tsbuildinfo,先建依赖再建本体;build 是 tsc && vite build && node scripts/build-css.mjs):

    读数 值
    dist/ 文件总数 78(75 个 .d.ts + index.js + index.cjs + index.css)
    .d.ts.map 0
    .js.map 0
    任何 .map 0
    含 sourceMappingURL 的文件 0
    提到 ../src 的文件 0

    没有 map,所以没有 sources 指向、也没有 sourcesContent 可读 —— 与 types 的承重形态相反。原因可查而不只是巧合:packages/fields/tsconfig.json 继承的是根 tsconfig.json,而根 tsconfig.json 是 noEmit: true 且不设 declarationMap / sourceMap;设这两项的是 tsconfig.base.json,它不在 fields 的继承链上(fields 那条注释也说了:tsc 在这里只做检查,dist 由 vite-plugin-dts 写出)。vite.config.ts 也没开 build.sourcemap。

    三种 emitter 的完整对照,补齐本卡的表:

    包 build dist 里的 map src 是否承重 处置
    @object-ui/data-objectstack tsup(sourcemap: false) 0 否 已删(#4847 / PR #4852)
    @object-ui/fields tsc && vite build && build-css 0 否 已删(#4856 / PR #4861,draft)
    @object-ui/types 裸 tsc(declarationMap: true) 有,sources = ["../src/*.ts"]、sourcesContent = false 是 仍待本卡裁

    fields 侧的 pack 对照:条目 255 -> 82,unpacked 2265557 -> 841772 B,tarball 629843 -> 252364 B;消失 173(97 个测试 + 76 个实现源码),新增 0,src/ 以外零条目移动。

    一个在 fields 上命中、在 data-objectstack 上没命中的前置核查项

    #4847 的前置核查 ③(「全仓与文档是否教过 src deep-path」)在 fields 上命中了,但命中的不是 map,也不是 fields 专有问题:三份 skill 指南给消费者的 Tailwind 样板里有 @source "../node_modules/@object-ui/fields/src/**/*.tsx";。追下去发现同一段样板对 components / layout / react 写了同样的三行,而那三个包的 files 只有 dist —— 四条 glob 里三条今天就已经匹配 0 个文件,且那三份文件从不教 #4059 之后的正路 style.css。仓内两处维护中的答案(packages/components/README.md:64 明确禁止这条 @source;CLI scaffold 扫的是 node_modules/@object-ui/*/dist/**/*.js)说的正相反。

    已另立 #4858 记录,PR #4861 未修它。这一条对 types 半也有影响:如果将来 types 的取舍倾向「保留 src 以免断链」,那份指南同样不构成保留理由 —— 它对 types 根本没写 @source 行,types 的真实消费者只有 declaration map 一个。


    Generated by Claude Code

  3. os-steve commented on Aug 17, 2026

    @os-steve
    Collaborator

    Maintainer ruling (2026-08-17, recorded by PM session session_01DbRmJD3iPhXjKr6vhd4Qkv). The maintainer reviewed the four-card decision-inbox analysis in PM chat and approved its recommendations, verbatim: 「同意」.

    Ruled: option (b) for the @object-ui/types half — turn declarationMap off at the source, then shrink files to dist-only.

    Rationale on record:

    Implementation notes for dispatch:

    Label flipped needs-user-decision → pm:queue in the same stroke.


    Generated by Claude Code

  4. self-assigned this
    on Aug 17, 2026
  5. os-steve commented on Aug 17, 2026

    @os-steve
    Collaborator

    Claim: PM loop round 1
    Session: session_01DbRmJD3iPhXjKr6vhd4Qkv
    Branch: claude/issue-4851-types-dist-only
    Worktree: objectui-issue-4851
    Domain: repo:objectui
    File surface: packages/types/tsconfig.json + packages/types/package.json (files array) + the scripts/check-phantom-dependencies.mjs header paragraph (stop on breach; explain in the report)
    Container & model: S mechanical, mode:subagent, model: sonnet
    Serial constraints cleared: the fields half (#4856 / PR #4861) is no longer in the open-PR list — its script-header serial note resolves by branching from current main (dev verifies the header's current text before editing); in-flight #4003 / #4884 / #4308 are disjoint; no open dev PR touches packages/types (checked this round).


    Generated by Claude Code

  6. added a commit that references this issue on Aug 17, 2026
    903f47f
  7. os-steve commented on Aug 17, 2026

    @os-steve
    Collaborator

    <!-- os-dev-report -->

    {
      "issue": 4851,
      "status": "done",
      "branch": "claude/issue-4851-types-dist-only",
      "pr": "https://github.com/objectstack-ai/objectui/pull/4897",
      "premise_still_valid": true,
      "summary": "Implemented the @object-ui/types half of the src-in-files finding per the maintainer's option (b) ruling: flipped declarationMap:false in packages/types/tsconfig.json, clean-rebuilt, verified dist has zero .map/.sourceMappingURL/../src references (positive control against the pre-flip build showed 54 of each), then trimmed files to dist-only (matching #4847's shape). Updated the check-phantom-dependencies.mjs header to retire the last of the three originally-recorded packages. npm pack: 203 -> 112 entries, 91 src files leave, dist unchanged.",
      "tests": "HEAD 903f47f. pnpm exec vitest run --root . scripts/__tests__/package-files-exist.test.ts: 18/18 passed. pnpm exec vitest run packages/types/ --maxWorkers=2: 36 files / 428 tests passed. node scripts/check-phantom-dependencies.mjs: pass (re-run at HEAD). cd packages/types && npm run type-check (tsc --noEmit + tsconfig.examples.json + tsconfig.test.json): clean. node scripts/check-control-bytes.mjs: pass. node scripts/check-package-self-import.mjs: pass. node scripts/check-changeset-presence.mjs / check-changeset-no-major.mjs: pass (re-run at HEAD). node scripts/check-published-dist-tooling.mjs: not run locally (costs a full monorepo build per objectui#4846, not implicated by this diff, deferred to CI). Positive control: pre-flip clean build showed 54 .d.ts.map files / 54 sourceMappingURL hits / 54 ../src references; post-flip clean build showed 0/0/0.",
      "open_questions": [],
      "out_of_scope_findings": ["filed as #4896: @object-ui/types exports[\".\"].require points at dist/index.cjs, which its bare-tsc build never emits (confirmed pre-existing on main, scope note that ~22 other packages declare the same require condition but were not individually verified)"]
    }

    Generated by Claude Code


    Generated by Claude Code

  8. os-steve commented on Aug 17, 2026

    @os-steve
    Collaborator

    os-dev-report (correction — the previous comment's marker was HTML-escaped by a mistake on my part and did not survive as literal text; this comment supersedes it as the canonical report)

    {
      "issue": 4851,
      "status": "done",
      "branch": "claude/issue-4851-types-dist-only",
      "pr": "https://github.com/objectstack-ai/objectui/pull/4897",
      "premise_still_valid": true,
      "summary": "Implemented the @object-ui/types half of the src-in-files finding per the maintainer's option (b) ruling: flipped declarationMap:false in packages/types/tsconfig.json, clean-rebuilt, verified dist has zero .map/.sourceMappingURL/../src references (positive control against the pre-flip build showed 54 of each), then trimmed files to dist-only (matching #4847's shape). Updated the check-phantom-dependencies.mjs header to retire the last of the three originally-recorded packages. npm pack: 203 -> 112 entries, 91 src files leave, dist unchanged.",
      "tests": "HEAD 903f47f. pnpm exec vitest run --root . scripts/__tests__/package-files-exist.test.ts: 18/18 passed. pnpm exec vitest run packages/types/ --maxWorkers=2: 36 files / 428 tests passed. node scripts/check-phantom-dependencies.mjs: pass (re-run at HEAD). cd packages/types && npm run type-check (tsc --noEmit + tsconfig.examples.json + tsconfig.test.json): clean. node scripts/check-control-bytes.mjs: pass. node scripts/check-package-self-import.mjs: pass. node scripts/check-changeset-presence.mjs / check-changeset-no-major.mjs: pass (re-run at HEAD). node scripts/check-published-dist-tooling.mjs: not run locally (costs a full monorepo build per objectui#4846, not implicated by this diff, deferred to CI). Positive control: pre-flip clean build showed 54 .d.ts.map files / 54 sourceMappingURL hits / 54 ../src references; post-flip clean build showed 0/0/0.",
      "open_questions": [],
      "out_of_scope_findings": ["filed as #4896: @object-ui/types exports[\".\"].require points at dist/index.cjs, which its bare-tsc build never emits (confirmed pre-existing on main, scope note that ~22 other packages declare the same require condition but were not individually verified)"]
    }

    Generated by Claude Code


    Generated by Claude Code

  9. os-steve commented on Aug 17, 2026

    @os-steve
    Collaborator

    ACCEPT — PR #4897 (reviewer of record: PM session session_01DbRmJD3iPhXjKr6vhd4Qkv; all readings taken on GitHub at head 903f47f, not from the report).

    • Shape: draft → main, first line Fixes #4851 — correct: the fields half already closed via [fields] files 去 src(#4851 的 fields 半)—— 先实测 dist map 形态,同形则照 #4847 机械删,异形停手 #4856/PR chore(fields): files 不再列 src —— 173 个源码文件(97 个测试)退出发布物 (#4856) #4861, so this types half completes the card and the merge should close it. No closure keywords next to other open card numbers.
    • Scope (from changed files, 4): packages/types/tsconfig.json (declarationMap flip), packages/types/package.json (files trim to the finding: @object-ui/data-objectstack 的 files 含 src,38 个测试源码文件随包发布 #4847 shape), scripts/check-phantom-dependencies.mjs (header paragraph — the last of the three recorded examples retires), and a real-frontmatter patch changeset for @object-ui/types (correct: published artifact contents change; not a tests-only diff). Exactly the claimed file surface; no content/docs/releases/, no ADR/skills paths (normal landing path applies); in-flight siblings' files untouched.
    • Ruling compliance: the mandated order was followed — emission off first, clean rebuild, zero-map verification, only then the files trim. The zero claims carry a positive control (pre-flip baseline: 54 .d.ts.map / 54 sourceMappingURL / 54 ../src; post-flip: 0/0/0), and the pack-list before/after (203 → 112 entries, 91 src files leave, dist payload unchanged) is in the PR body. One premise correction, properly documented rather than glossed: the card said tsconfig.base.json supplies sourceMap: true, but packages/types extends the repo-root tsconfig.json (verified via tsc --showConfig), so the build only ever emitted .d.ts.map — the correction narrows the risk, doesn't change the ruling.
    • Gates at head 903f47f: Changeset Declaration ✅ · Bump Policy ✅ · Fixed Group ✅ · Control Byte Scan ✅ · Build & E2E ✅ · Build Docs ✅ · Skill Guide Path Check ✅; Lint / Type Check / Test shards 1–4 in progress at review time. Ready-flip + auto-merge happens only after those six report success at this head — a pointed check is armed.
    • Out-of-scope finding, graded: finding: @object-ui/types exports["."].require points at dist/index.cjs, which its bare-tsc build never emits #4896 (exports["."].require → dist/index.cjs that a bare-tsc build never emits; confirmed pre-existing on origin/main; 22 sibling packages flagged unverified, scoped honestly). Correctly filed unassigned as observation-class; first-touch grading belongs to the triage seat.

    Generated by Claude Code

  10. os-zhuang commented on Aug 17, 2026

    @os-zhuang
    Contributor

    Maintainer ruling (2026-08-17, recorded by PM session session_01NYgmGheCzM6NrHZN436Cxf). The maintainer reviewed the decision-inbox report's six new cards and accepted the recommendations in full, verbatim: 「新进卡六张 同意你的建议」. For this card:

    Ruled, two halves:

    1. @object-ui/fields — measure first (clean rebuild; does dist carry .maps, and where do their sources point), then if the shape matches data-objectstack (no maps, or maps carrying their own content), the mechanical finding: @object-ui/data-objectstack 的 files 含 src,38 个测试源码文件随包发布 #4847 treatment: drop src from files, with the pack-list before/after comparison.
    2. @object-ui/types — disable declarationMap and drop src from files. The go-to-source degradation to .d.ts is the accepted cost: shipping the whole source tree (tests included) in every tarball for a niche editor nicety fails the scope-discipline test, and a dangling map (src removed, declarationMap kept) is the one forbidden end-state. inlineSources is rejected (buys no size).

    First-touch grading completes: label flipped needs-user-decision → pm:queue in the same stroke.


    Generated by Claude Code

  11. added a commit that references this issue on Aug 17, 2026
    c9dc811
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions