Skip to content

refactor(plugin-detail): pair timeline audit entries by the spec's folded activity types - #30517

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-30408-timeline-folded-types
Nov 5, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-30408-timeline-folded-types

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Sales · project thread
domain:ui#6 · os-sales · session_01L6bhgUR8Nu4M7tbtgES7q2
Fixes #30408
Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:记录页「动态」流配对审计条目与活动行时,不再用组件内自抄的映射表,改读 spec 的 RECORD_TIMELINE_FOLDED_ACTIVITY_TYPES。
  • 为什么改:服务端计数(动态角标)已按这个 spec 常量折叠,客户端另抄一份,两边一旦只改一处,角标数与实际画出的行数会再次对不上。
  • 风险与回滚:无行为变化,仍是 create/update/delete 三对;回滚即 revert 本 PR,仅涉及一个 ui 文件与其测试。
  • 先看:ui/packages/plugin-detail/src/recordTimelineStream.ts 的 foldedActivityTypeOf,再看同包测试文件末尾新增的 describe。
  • 两分钟验证:pnpm --dir ui exec vitest run packages/plugin-detail/src/__tests__/recordTimelineStream-27055.test.tsx,预期 42 个测试全部通过。
  • 需要你做的:无,席位落地。

What changes

  • ui/packages/plugin-detail/src/recordTimelineStream.ts: the local AUDIT_ACTION_TO_ACTIVITY_TYPE map is gone. pairGap now asks foldedActivityTypeOf(action), which reads RECORD_TIMELINE_FOLDED_ACTIVITY_TYPES from @objectstack/spec/api (the module the file already imported RECORD_TIMELINE_UPDATE_ACTIVITY_TYPE from) through an own-key check, so an action outside the constant (restore, an unknown action, a prototype key such as toString) pairs with nothing.
  • One root changeset: @object-ui/plugin-detail patch.
  • No packages/** change.

Tests

A new top-level describe in recordTimelineStream-27055.test.tsx (the file that already holds the pairing pins): for each entry of the spec constant, the audit action pairs with its activity type and with no other folded type; for restore, unknown_action, toString, constructor, __proto__ and hasOwnProperty, nothing pairs. The cases are driven from the spec constant itself, so the client cannot fold a different set without this red.

Acceptance notes

  • The positive control dropped the client's delete pairing; only the new pin went red. No earlier pin covered the delete pair.
  • The own-key guard has no red-capable control of its own: with the old lookup, a prototype key resolves to a function, which never equals an activity type string, so it could not pair either. The guard is defensive and the prototype-key cases pin the outcome, not the guard.

Verification

All readings at head 0e467929a3, worktree on base a1d0b1ee9e.

Package tests and type-check (plugin-detail)
  • pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-detail/src/__tests__/recordTimelineStream-27055.test.tsx: Test Files 1 passed (1), Tests 42 passed (42).
  • pnpm --dir ui exec vitest run --maxWorkers=2 packages/plugin-detail/: Test Files 371 passed, 1 skipped (372); Tests 3328 passed, 18 skipped (3346); exit 0.
  • pnpm --filter @object-ui/plugin-detail type-check (both tsc legs): exit 0.
Positive control (ablation)
  • Mutation via node scripts/ablation-replace.mjs on recordTimelineStream.ts: anchor return RECORD_TIMELINE_FOLDED_ACTIVITY_TYPES[ replaced so delete returns undefined; anchor 1 to 0, marker 0 to 1, blob ca01922c2dbc to 5837636a3f05.
  • Run: Tests 1 failed, 41 passed (42); the failing case is the audit delete entry pairs with the activity deleted row. VERDICT command-exit 1.
  • Restore: blob after restore ca01922c2dbc equals the HEAD blob, git diff HEAD empty.
  • A first attempt with an anchor the replacement also contained was refused by the tool before any run (anchor count did not drop); it measured nothing.
Derived gates (dispatch-gates --commands, 35 families)
  • All 35 commands exit 0, including pnpm --dir ui exec vitest run scripts/ (Test Files 170 passed, 2 skipped; Tests 4985 passed, 2 skipped).
  • node scripts/pm/dispatch-gates.mjs --ran: 35 derived families accounted for, 35 run, 0 NOT-MEASURED (a derived zero, every line with its exit code).
  • Not run locally: the repo-wide pnpm lint and the full CI farm, which CI owns.

🤖 Generated with Claude Code

https://claude.ai/code/session_01L6bhgUR8Nu4M7tbtgES7q2

…lded activity types

The record timeline stream kept a local audit action to activity type map
that restated RECORD_TIMELINE_FOLDED_ACTIVITY_TYPES from @objectstack/spec/api.
Read the spec constant instead (own-key lookup, so an action outside it,
including a prototype key, never pairs), and pin that the stream pairs
exactly the entries the constant names.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgUR8Nu4M7tbtgES7q2
@github-actions github-actions Bot added size/s documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 5, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#6 · os-sales · session_01L6bhgUR8Nu4M7tbtgES7q2

维护者速读

席位核对 — ACCEPT · head 0e46792

  • 形态:3 文件 +55/−8(recordTimelineStream.ts、recordTimelineStream-27055.test.tsx 新 describe、changeset @object-ui/plugin-detail patch)。check-governed-merges --pr 30517:NOT governed,63 行 ≤ 3000。Fixes #30408,draft,目标 main。席位逐行读过 diff:本地映射换成 foldedActivityTypeOf,只认 spec 常量的自有键(hasOwnProperty),所以 restore、未知动作和 toString 这类原型键都不配对;RECORD_TIMELINE_UPDATE_ACTIVITY_TYPE 的导入仍有别处使用。
  • 契约:Clause-② no,Metadata-protocol none,与认领 6658959363 一致:没有新导出,@objectstack/spec 是 workspace:^。
  • 前提实测:dev 报告 6659897078。新钉子由 spec 常量驱动:每一对都配上、不配别的折叠类型,六个常量外的动作都不配。正对照:用 ablation-replace 让 delete 返回 undefined 时 1 红 41 绿(红的正是 delete 那一对),还原后 blob 与 HEAD 一致;包内 371 文件 3328 测试绿;type-check 两段 exit 0;派生门禁 35 条全部 exit 0。
  • 门禁 check-runs:head 上 55 个,44 success,11 skipped,0 红。mergeable_state clean。
  • 接受的偏差:PR 正文页脚和末行 signed 注释按派发令与中继的 PR 正文格式写,而 os-dev.md 不许 dev 写 HTML 注释,以中继格式为准。
  • 范围外去向:无(dev 记的「改前没有钉子覆盖 delete 这一对」已由本 PR 的新钉子补上)。
  • 落地条款:中继 pr_ready + automerge_enable。合并后由 Fixes 关卡,席位同一笔摘掉 pm:dispatched 并留落地评论。

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 5, 2026 14:19
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit 8a0516c Nov 5, 2026
56 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-30408-timeline-folded-types branch November 5, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/s tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Record timeline: the client's audit→activity pairing map restates the spec's new RECORD_TIMELINE_FOLDED_ACTIVITY_TYPES

1 participant