Repository navigation
Description
aggregator(activity): summary caps split surrogate pairs — watchdog/kaneo writers and the record-time cap raw-slice at 500, bypassing the #7694/#7711 capUnits guard
Problem
pm-stack/aggregator/src/activity.ts caps activity summaries with raw slice(0, 500) at four sites, none of them pair-safe:
- line 120 —
watchdogDeliveries:summary: item.title.slice(0, 500) - line 196 —
kaneoChangeDeliveries(appeared): composed summary.slice(0, 500) - line 207 —
kaneoChangeDeliveries(moved): composed summary.slice(0, 500) - line 485 — the ingestion record:
summary: (d.link ?${d.summary} — ${d.link}: d.summary).slice(0, 500)— a second cap applied at persist time, so even a pair fully inside a writer's 500 can be split when the— linksuffix pushes the boundary into it.
This is the #3178 defect class that #7694 fixed for actions.ts cleanText and #7711 fixed for markResult (both merged 2026-11-08) via the capUnits helper (actions.ts:292, not exported): an astral character straddling the cap is dropped whole. The activity writers were not audited in either fix. Summaries are persisted through events.record (line 478-486) into the activity stream and rendered on the board, so a split pair is stored, not just displayed: the stored summary ends in a lone high surrogate, and any UTF-8 round-trip (file write, HTTP response) replaces it with U+FFFD.
Evidence (verified this run, laptop primary @ f9dfb4c, real module md5 1512d949c61186d2cdec988887197654)
Probe ~/git/fleet/probe-activity-surrogate/probe.ts (bun, imports the real activity.ts):
watchdog straddle | len: 500 | last unit: 0xd83d | lone high surrogate at end: true | utf8 roundtrip changes: true | roundtrip last: 0xfffd
watchdog control | len: 500 | last unit: 0xde00 | lone high surrogate at end: false | utf8 roundtrip changes: false
kaneo straddle | len: 500 | last unit: 0xd83d | lone high surrogate at end: true | utf8 roundtrip changes: true | roundtrip last: 0xfffd
- Straddle case (watchdog): title = 499 ×
x+ 😀 + tail →watchdogDeliveriessummary is 500 units ending in lone\ud83d. - Straddle case (kaneo): card title padded so the pair straddles the composed summary's 500 cap → same lone
\ud83dending. - Control: 498 ×
x+ 😀 (pair fully inside the cap) → summary intact, round-trips cleanly.
Dedup: searches for "activity surrogate", "watchdogDeliveries", and "kaneo summary" (open + closed) return no issue for these caps; #7694/#7711 cover actions.ts only (filed and fixed this morning; this is the residual door in the sibling module).
Why it matters
- Watchdog titles and Kaneo card titles are operator/user text — emoji in a card title at the wrong offset permanently corrupts the stored activity record's summary (U+FFFD in the persisted stream), the same failure aggregator(actions): cleanText caps can split a surrogate pair — a stored action field ends in a lone surrogate #7694/aggregator(actions): markResult caps split surrogate pairs — appliedByRun/resultNote stored with a lone surrogate (residual of #7694) #7711 were filed for in
actions.ts. - The record-time cap (line 485) makes the writers' own caps insufficient as a fix location: the persist path must be pair-safe too.
Acceptance criteria
- All four summary caps in
activity.ts(lines 120, 196, 207, 485) are surrogate-pair-safe: an astral character straddling the 500-unit cap is dropped whole, never split (mirroringcapUnitssemantics from aggregator(actions): markResult caps split surrogate pairs — appliedByRun/resultNote stored with a lone surrogate (residual of #7694) #7711). - Regression tests in the aggregator suite pin the straddle case for the watchdog writer, a kaneo writer, and the record-time cap, plus an exact-fit control (pair fully inside the cap stays intact); the new tests fail on the pre-fix code.
- The existing aggregator test suite stays green.
Activity
developing-today commentedon Nov 8, 2026
🤖 Agent note · state: filed
developing-today commentedon Nov 8, 2026
🤖 Agent note · state: picked up
Merge pull request #7730 from developing-today/creator-a/7725-activit…
developing-today commentedon Nov 8, 2026
🤖 Agent note · state: done