Repository navigation
Commit ef1fc78
fix(plugin-audit): the generic activity entry for an update names the fields that changed (#25958)
<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DUJM4Nrn5kmLCwNBJDQeHpe)_
Fixes #25787
Clause-②: no
Metadata-protocol: none
## What changed
The activity mirror in `plugin-audit` (`audit-writers.ts`, ADR-0052 §5b)
writes an update entry in one of three shapes: a fired milestone's
sentence, a `trackHistory` diff (`Stage: Proposal → Closed Won`), or a
generic fallback. The fallback said `Updated OBJECT "LABEL"` and nothing
else. On HotCRM 18.1.0 the campaign roll-up counters (`num_sent`,
`num_responses`, … — plain `number` fields, none tracked, bumped once
per enrolled member by `campaign_member.hook.ts`) produced thirteen
identical entries in a row.
The fallback now names the changed fields by label, in declaration
order:
`Updated Campaign "CPG-0001": Number Sent, Responses, and Leads`
- **Labels only, never values.** `trackHistory` still decides whether
old → new VALUES are rendered; an untracked field's value (or a
credential's) never reaches the text. The ADR-0052 §5b.1 opt-in is
unchanged.
- **Bounded.** At most five fields are named and the rest counted (`…,
Field 5, and 3 more`). When `sys_activity.summary` declares `maxLength`
(500 today; the SQL driver sizes the column `varchar(500)` from it, so
an over-long text fails the whole activity insert), fewer fields are
named until the text fits; if not even one name fits, the field-less
frame is written as before.
- **Redaction still applies.** Every named or counted field is recorded
in the row's summary-source declaration (`text_sources.summary`), so
`activity-field-redaction.ts` drops the summary for a reader not served
one of them, exactly as for a tracked-change summary.
- **Localized.** Two message keys in the plugin's own en / zh-CN / ja-JP
/ es-ES bundles (`translations/messages.ts`):
`messages.activityUpdatedFields` (frame with `{{fields}}`) and
`messages.activityMoreFields` (`{{count}} more`). The list is joined
with `Intl.ListFormat` in the frame's locale (zh-CN: `F1、F2、F3、F4、F5和另外
2 个字段`). A locale bundle that has only the older
`messages.activityUpdated` (an app-shipped locale) keeps its own
field-less sentence rather than an English one.
- Unchanged: which rows are written (no input refused, no event
dropped), the milestone and tracked branches, create/delete summaries,
`metadata.old/new`, `changed_fields`.
Folding consecutive same-actor entries is the renderer's half (objectui)
and is not in this PR; #25787's triage routes it to its own card.
## Evidence
- Red first: the new and updated cases in `audit-writers.test.ts` run
against `origin/main` `2a728ba2`'s `audit-writers.ts` + `messages.ts`
(restored into the tree, then `git checkout HEAD --` back; `git diff
HEAD` 0 bytes after): `Tests 8 failed | 108 passed (116)`. With the fix:
all pass.
- `pnpm --filter @objectstack/plugin-audit test`: `Test Files 60 passed
(60)`, `Tests 993 passed (993)` (before the last two commits;
`audit-writers.test.ts` re-run at head: 117 passed).
- `pnpm --filter @objectstack/plugin-audit typecheck`: exit 0.
- Pins: declaration order; no value (untracked or `secret`) in the text;
source declaration; five-name cap with count; 40 long labels under a
declared 500 bound (length at most 500, count still present); field-less
frame when nothing fits; zh-CN list; an app locale with only
`activityUpdated` keeps its sentence. `audit-milestone-summary.test.ts`
and `audit-option-label-summary.test.ts` pass unchanged.
## Gates (local subset, at head `cebc2d01`)
- `pnpm --filter @objectstack/plugin-audit test` at `cebc2d01`: `Test
Files 60 passed (60)`, `Tests 993 passed (993)`; `pnpm --filter
@objectstack/plugin-audit typecheck`: exit 0.
- `node scripts/pm/dispatch-gates.mjs --commands` (72 families, merge
base `2a728ba2a`), reconciled with `--ran`: 71 run, all exit 0; 1 NOT
MEASURED: `pnpm check:dual-build-cjs-loads` (exit 3, needs a whole-tree
build; CI's lint lane owns it). `check:i18n` was run after its declared
CLI closure build (10 packages in sync, `plugins/plugin-audit` 7
bundles); `check-plugin-teardown-shape --self-test` after fetching its
pinned fixture commit.
- `check:commit-card-trailers --range origin/main..HEAD`: 4 commits
clean. `check:nul-bytes`: exit 0.
- `origin/main` moved 5 commits since the base; none touches
`packages/plugins/plugin-audit`, so no merge was taken.
- CI's own families are read from this PR's check-runs.
## Acceptance notes
- An update that changes only computed fields (`formula`, `summary`,
`rollup`, `autonumber`) writes no activity row at all: `diff()` drops
those types and the writer returns on an empty diff. Unchanged here,
noted by the seat on the claim.
- The 500 bound is guaranteed for the field list this PR adds. A record
label or object label that alone exceeds it overflows every branch
(create, delete, generic), and a `trackHistory` diff of long values is
unbounded too; both predate this PR. Not measured against a SQL driver
here.
- A changed key the object does not declare is named by its machine key
(the tracked branch's existing label fallback).
---
_Generated by [Claude
Code](https://claude.ai/code/session_0166WnEHW3hURHjBf9cLK32f)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 0c37228 commit ef1fc78
4 files changed
Lines changed: 324 additions & 11 deletions
File tree
- .changeset
- packages/plugins/plugin-audit/src
- translations
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
562 | 562 | | |
563 | 563 | | |
564 | 564 | | |
565 | | - | |
| 565 | + | |
566 | 566 | | |
567 | 567 | | |
568 | 568 | | |
| |||
575 | 575 | | |
576 | 576 | | |
577 | 577 | | |
578 | | - | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
579 | 701 | | |
580 | 702 | | |
581 | 703 | | |
| |||
1047 | 1169 | | |
1048 | 1170 | | |
1049 | 1171 | | |
1050 | | - | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
1051 | 1208 | | |
1052 | 1209 | | |
1053 | 1210 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
760 | 760 | | |
761 | 761 | | |
762 | 762 | | |
763 | | - | |
| 763 | + | |
| 764 | + | |
764 | 765 | | |
765 | 766 | | |
766 | 767 | | |
| |||
798 | 799 | | |
799 | 800 | | |
800 | 801 | | |
801 | | - | |
802 | | - | |
803 | | - | |
| 802 | + | |
804 | 803 | | |
805 | 804 | | |
806 | 805 | | |
| |||
822 | 821 | | |
823 | 822 | | |
824 | 823 | | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
825 | 934 | | |
826 | 935 | | |
827 | 936 | | |
| |||
1439 | 1548 | | |
1440 | 1549 | | |
1441 | 1550 | | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
1442 | 1558 | | |
1443 | 1559 | | |
1444 | 1560 | | |
| |||
2125 | 2241 | | |
2126 | 2242 | | |
2127 | 2243 | | |
2128 | | - | |
| 2244 | + | |
| 2245 | + | |
2129 | 2246 | | |
2130 | 2247 | | |
2131 | 2248 | | |
| |||
2183 | 2300 | | |
2184 | 2301 | | |
2185 | 2302 | | |
2186 | | - | |
2187 | | - | |
2188 | | - | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
| 2311 | + | |
| 2312 | + | |
| 2313 | + | |
| 2314 | + | |
| 2315 | + | |
| 2316 | + | |
| 2317 | + | |
| 2318 | + | |
| 2319 | + | |
| 2320 | + | |
2189 | 2321 | | |
2190 | 2322 | | |
2191 | 2323 | | |
| |||
0 commit comments