Skip to content

docs(project): correct stale #1867 crash notes on actual_cost / progress_percent (#84)#91

Merged
os-zhuang merged 1 commit into
mainfrom
claude/live-rollups-project
Jul 19, 2026
Merged

docs(project): correct stale #1867 crash notes on actual_cost / progress_percent (#84)#91
os-zhuang merged 1 commit into
mainfrom
claude/live-rollups-project

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

背景

延续 #84。project 是五个受影响字段里唯一没有可转换 rollup 的模板 —— 所以这里只修过时的说明,不做转换。

调查结论(对 seed 做了 boot 核对)

  • actual_cost(105000 / 340000 / 0)没有子表金额来源pm_timesheet 只记 hours,成本 = 工时 × 人/角色费率,而 4-object CHARTER schema 里根本没有费率列。它是外部算出来的实际值,summary 和 hook 都重建不出来。
  • progress_percent(38 / 55 / 0)不是里程碑比例。两个各 2 个里程碑的项目状态分布完全一样(1 completed + 1 in_progress = 50%),issue 又都是 0% —— 所以任何子表聚合都会把手工调的 38/55 压成同一个值。它是精心编排的交付指标,不是朴素计数。

改动(纯注释 / description,无逻辑、无 schema 变更)

pm_project.hook.tspm_project.object.ts(两个字段 description)、pm_timesheet.view.ts 里都写着「因为 hook 嵌套写会把 QuickJS 沙箱写崩所以存成字段」。framework#1867 修复后这已不成立。改成真实原因:

  • actual_cost 没有子表成本列可求和;
  • progress_percent 是策展指标,子表计数会把它压平;
  • 并注明 hook 嵌套写现在是安全的。

留给 maintainer 的选择(未在本 PR 中做)

progress_percent 可以用 afterInsert/afterUpdate 钩子做成实时的里程碑完成度 rollup(#1867 的修复已支持),但前提是接受 count-based 进度——那样会把 seed 的 38/55 重写成 50/50,失去每个项目的差异。我把这个选项写在字段注释里而没有直接做,因为它会改变已发布样板的演示语义。如果你希望我做成实时 rollup(A 方案),回复一声即可。

验证

tsc ✓、build ✓(6 objects / 72 fields)、format:check clean。纯文档改动,无需 boot。

影响

至此 #84 五个字段全部处理完:


Generated by Claude Code

…ess_percent (#84)

Unlike the other four #84 fields, neither project field is a reconstructible
child aggregate, so there is nothing to convert to a summary or hook roll-up —
only the stale framing to fix.

Investigation (boot-inspected the seed):
- `actual_cost` (105000 / 340000 / 0) has NO child cost source. pm_timesheet
  records `hours` only; cost = hours × a person/role rate, and no rate column
  exists in the 4-object CHARTER schema. It is an externally-computed actual,
  not a rollup a summary or hook could rebuild.
- `progress_percent` (38 / 55 / 0) is NOT a milestone ratio. Both 2-milestone
  projects have the same status mix (1 completed + 1 in_progress = 50%), and
  issues are 0% — so any child aggregate flattens the hand-tuned 38/55 to a
  single value. It is a curated delivery metric, not a naive count.

What changed (comments/descriptions only, no logic/schema change): the notes
in pm_project.hook.ts, pm_project.object.ts (both field descriptions) and
pm_timesheet.view.ts claimed these are stored "because a nested write crashes
the QuickJS sandbox". That is no longer true (framework#1867 is fixed). Reframe
them to the real reason — actual_cost has no child cost column to sum;
progress_percent is a curated metric a child count would flatten — and note
that nested hook writes are now safe.

Follow-up left to the maintainer: `progress_percent` COULD be made a live
milestone-completion roll-up via an afterInsert/afterUpdate hook (the #1867 fix
enables it), but only if count-based progress is acceptable — it would re-seed
38/55 → 50/50 and lose the per-project nuance. Flagged in the field note rather
than done here, since it changes shipped demo semantics.

Build-verified (tsc + build, 6 objects / 72 fields); format:check clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BZguyAaQbyUpwMZ2gMLaAP
@os-zhuang
os-zhuang merged commit f992733 into main Jul 19, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants