FormatChangesForDisplay is the Go twin of formatChangesForDisplay in web/src/lib/utils/activityChanges.ts (BUG-2789). It sanitises an activity row's `changes` metadata string for a surface where a HUMAN reads it: the CLI's `pad project activity` and `pad workspace audit-log`. The rules, and the reas
(changes string)
| 32 | // The wire surfaces (REST, --format json, bootstrap, MCP) return the metadata |
| 33 | // verbatim by design; this is a display rule only. |
| 34 | func FormatChangesForDisplay(changes string) string { |
| 35 | if changes == "" { |
| 36 | return "" |
| 37 | } |
| 38 | var kept []string |
| 39 | for _, part := range strings.Split(changes, ";") { |
| 40 | trimmed := strings.TrimFunc(part, jsIsSpace) |
| 41 | colon := strings.IndexByte(trimmed, ':') |
| 42 | if colon == -1 { |
| 43 | continue |
| 44 | } |
| 45 | field := strings.TrimFunc(trimmed[:colon], jsIsSpace) |
| 46 | if !looksLikeFieldKey(field) || suppressedChangeFields[field] { |
| 47 | continue |
| 48 | } |
| 49 | if !strings.Contains(trimmed[colon+1:], "→") { |
| 50 | continue |
| 51 | } |
| 52 | kept = append(kept, trimmed) |
| 53 | } |
| 54 | return strings.Join(kept, "; ") |
| 55 | } |
| 56 | |
| 57 | var suppressedChangeFields = map[string]bool{"implementation_notes": true, "decision_log": true} |
| 58 |