Repository navigation
Commit 8a0516c
refactor(plugin-detail): pair timeline audit entries by the spec's folded activity types (#30517)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuXpPPZiBKyj1HzrdQ6La3ZH)_
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`.
<details><summary>Package tests and type-check (plugin-detail)</summary>
- `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.
</details>
<details><summary>Positive control (ablation)</summary>
- 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.
</details>
<details><summary>Derived gates (dispatch-gates --commands, 35
families)</summary>
- 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.
</details>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L6bhgUR8Nu4M7tbtgES7q2
<!-- signed: domain:ui#6 · os-sales · session_01L6bhgUR8Nu4M7tbtgES7q2
-->
Co-authored-by: Claude <noreply@anthropic.com>1 parent b13fc74 commit 8a0516c
3 files changed
Lines changed: 55 additions & 8 deletions
File tree
- .changeset
- ui/packages/plugin-detail/src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
399 | 400 | | |
400 | 401 | | |
401 | 402 | | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
169 | 174 | | |
170 | 175 | | |
171 | 176 | | |
| |||
183 | 188 | | |
184 | 189 | | |
185 | 190 | | |
186 | | - | |
| 191 | + | |
187 | 192 | | |
188 | 193 | | |
189 | 194 | | |
| |||
0 commit comments