diff --git a/.changeset/sys-activity-declares-scheduled.md b/.changeset/sys-activity-declares-scheduled.md new file mode 100644 index 00000000000..2dad6c3445c --- /dev/null +++ b/.changeset/sys-activity-declares-scheduled.md @@ -0,0 +1,34 @@ +--- +'@objectstack/plugin-audit': patch +--- + +Declare `sys_activity.type: 'scheduled'` and record its writer in the type census + +A shipped app action writes the value today. `objectstack-ai/hotcrm` +`src/actions/global.actions.ts` builds a `schedule_meeting` action for +`crm_lead`, `crm_contact`, `crm_account`, `crm_opportunity` and `crm_case` +whose body runs `ctx.api.object('sys_activity').insert({ type: EVENT_STATUS +=== 'held' ? 'completed' : 'scheduled', … })`, and `SCHEDULE_MEETING_SPEC` +declares `eventStatus: 'planned'`, so that action always takes the `scheduled` +branch. Read at hotcrm `5eee1bd` on 2026-08-24. + +**Nothing accepts or rejects differently.** Every `sys_activity` field is +`readonly: true`, and `validateRecord` skips readonly fields on both the insert +and the update branch (`objectql/src/validation/record-validator.ts`), so the +`invalid_option` check that enforces a select field's declared options never +runs for one — measured here, not assumed: with the value added to the enum and +nothing else changed, exactly one of the package's 313 assertions moved, the +writer census below, which exists to force that row to be written. Every +behavioural case stayed green, including the one that inserts an undeclared +value into this very column and measures that it lands. Before and after, the +row is stored verbatim. What changes is that the declaration names the value +the platform stores, so the timeline filter offers it and the four generated +locale bundles carry a label for it (`已安排` / `予定` / `Programado`). + +The census (`sys-activity-type-vocabulary.test.ts`) gains the writer row, which +is what forces this to be measured rather than asserted: adding a value to the +enum without inventorying its writer fails that pin. Two further facts are +recorded there in passing — `completed` has a second writer at the same app +(`src/actions/contact.actions.ts`), and the census's in-repo sweep cannot see +either of them, because an app's server-side action reaches this column directly +through `ctx.api`. diff --git a/packages/plugins/plugin-audit/src/objects/sys-activity-type-vocabulary.test.ts b/packages/plugins/plugin-audit/src/objects/sys-activity-type-vocabulary.test.ts index fe7a632a805..3570674de64 100644 --- a/packages/plugins/plugin-audit/src/objects/sys-activity-type-vocabulary.test.ts +++ b/packages/plugins/plugin-audit/src/objects/sys-activity-type-vocabulary.test.ts @@ -14,7 +14,7 @@ import { SysActivity } from './index.js'; * insert and the update branch (`objectql/src/validation/record-validator.ts`), * so the `invalid_option` check that enforces a `select` field's declared * options never runs for one. Every `sys_activity` field is `readonly: true`, - * which makes its eleven-value `type` enum **documentation, not a contract**: + * which makes its declared `type` enum **documentation, not a contract**: * an undeclared value is written silently, and narrowing the enum away from a * value a writer still emits is equally silent. * @@ -53,9 +53,9 @@ import { SysActivity } from './index.js'; * * Recorded because it changes what "no writer" licenses. objectui's * `packages/plugin-detail/src/renderers/recordActivityFeed.ts` maps - * `sys_activity.type` onto a feed item type, and its key set is set-equal to - * this enum today — the seven writerless values included. Six carry a - * deliberate rendering decision (`assigned` / `shared` map to `field_change`, + * `sys_activity.type` onto a feed item type, and its key set was set-equal to + * this enum at the #8203 census — the seven writerless values included. Six + * carry a deliberate rendering decision (`assigned` / `shared` map to `field_change`, * `system` to `system`; `commented` / `mentioned` / `login` / `logout` are * dropped as not-record-activity). So a writer census answers "may this value * be retired?" only in part: a second consumer sits across a repo boundary, @@ -64,7 +64,10 @@ import { SysActivity } from './index.js'; * That mirror is unguarded in both directions — objectui pins its key set * against a hardcoded literal rather than against this declaration, so an * addition here does not reach it. Filed as #8852; deliberately NOT asserted - * here, since this package cannot import objectui. + * here, since this package cannot import objectui. Per objectstack-ai/objectui#5840 + * that map has since been widened past the declaration to cover values a shipped + * producer measurably writes, so the two key sets are no longer set-equal — + * recorded from that card, not measured here, for the same reason. */ /** @@ -83,7 +86,20 @@ const TYPES_WITH_WRITERS: ReadonlyArray 'author-declared `activityMilestones[].type` (ADR-0052 §5b.2), applied by ' + 'audit-writers.ts `if (milestone.type) activityType = milestone.type`. Shipped ' + 'declaration: examples/app-showcase/src/data/objects/task.object.ts — ' - + "{ field: 'status', value: 'done', type: 'completed' }.", + + "{ field: 'status', value: 'done', type: 'completed' }. ALSO written directly " + + 'by an app action, through the door the `scheduled` row describes: ' + + "objectstack-ai/hotcrm src/actions/contact.actions.ts inserts type: 'completed' " + + 'on the send_email body.', + ], + [ + 'scheduled', + 'objectstack-ai/hotcrm src/actions/global.actions.ts — the `schedule_meeting` ' + + "action body runs `ctx.api.object('sys_activity').insert({ type: EVENT_STATUS " + + "=== 'held' ? 'completed' : 'scheduled', … })`, and SCHEDULE_MEETING_SPEC " + + "declares `eventStatus: 'planned'`, so this action always takes the " + + '`scheduled` branch. Registered on crm_lead / crm_contact / crm_account / ' + + 'crm_opportunity / crm_case via activityActionFor(). Read at hotcrm 5eee1bd ' + + 'on 2026-08-24 (#11424).', ], ]; @@ -99,6 +115,15 @@ const TYPES_WITH_WRITERS: ReadonlyArray * missed — so the technique demonstrably finds writers when they exist. Beyond * that single site the only other way into this column is an author-declared * milestone `type`, which is why `completed` is in the list above. + * + * ⚠️ That sweep is IN-REPO, and in-repo is not the whole population. An app's + * server-side action reaches this column directly — + * `ctx.api.object('sys_activity').insert({ type: … })` — and no grep of this + * repository can see it. Both hotcrm entries in the list above were found by + * reading that repository, not by any instrument here (#11424, 2026-08-24). + * What that door means for the vocabulary is the open question on that card; + * it is recorded here only so the next census knows the sweep has a second + * half, and where it is. */ const TYPES_WITHOUT_WRITER_AT_CENSUS: ReadonlyArray = [ ['commented', 'no writer: sys_comment hooks write comment rows, never a sys_activity row'], diff --git a/packages/plugins/plugin-audit/src/objects/sys-activity.object.ts b/packages/plugins/plugin-audit/src/objects/sys-activity.object.ts index f3e27bb4bdd..acd3c75fbe5 100644 --- a/packages/plugins/plugin-audit/src/objects/sys-activity.object.ts +++ b/packages/plugins/plugin-audit/src/objects/sys-activity.object.ts @@ -64,6 +64,7 @@ export const SysActivity = ObjectSchema.create({ 'shared', 'assigned', 'completed', + 'scheduled', 'login', 'logout', 'system', diff --git a/packages/plugins/plugin-audit/src/translations/en.objects.generated.ts b/packages/plugins/plugin-audit/src/translations/en.objects.generated.ts index 7b9fe2485af..66b58183d22 100644 --- a/packages/plugins/plugin-audit/src/translations/en.objects.generated.ts +++ b/packages/plugins/plugin-audit/src/translations/en.objects.generated.ts @@ -130,6 +130,7 @@ export const enObjects: NonNullable = { shared: "shared", assigned: "assigned", completed: "completed", + scheduled: "scheduled", login: "login", logout: "logout", system: "system" diff --git a/packages/plugins/plugin-audit/src/translations/es-ES.objects.generated.ts b/packages/plugins/plugin-audit/src/translations/es-ES.objects.generated.ts index 946c8840c93..89135d97d3f 100644 --- a/packages/plugins/plugin-audit/src/translations/es-ES.objects.generated.ts +++ b/packages/plugins/plugin-audit/src/translations/es-ES.objects.generated.ts @@ -130,6 +130,7 @@ export const esESObjects: NonNullable = { shared: "Compartido", assigned: "Asignado", completed: "Completado", + scheduled: "Programado", login: "Inicio de sesión", logout: "Cierre de sesión", system: "Sistema" diff --git a/packages/plugins/plugin-audit/src/translations/ja-JP.objects.generated.ts b/packages/plugins/plugin-audit/src/translations/ja-JP.objects.generated.ts index 7bfc4881ad7..dbf617dacf3 100644 --- a/packages/plugins/plugin-audit/src/translations/ja-JP.objects.generated.ts +++ b/packages/plugins/plugin-audit/src/translations/ja-JP.objects.generated.ts @@ -130,6 +130,7 @@ export const jaJPObjects: NonNullable = { shared: "共有", assigned: "割り当て", completed: "完了", + scheduled: "予定", login: "ログイン", logout: "ログアウト", system: "システム" diff --git a/packages/plugins/plugin-audit/src/translations/zh-CN.objects.generated.ts b/packages/plugins/plugin-audit/src/translations/zh-CN.objects.generated.ts index 3e04bfdf5ab..109cb1212fb 100644 --- a/packages/plugins/plugin-audit/src/translations/zh-CN.objects.generated.ts +++ b/packages/plugins/plugin-audit/src/translations/zh-CN.objects.generated.ts @@ -130,6 +130,7 @@ export const zhCNObjects: NonNullable = { shared: "已共享", assigned: "已分配", completed: "已完成", + scheduled: "已安排", login: "登录", logout: "登出", system: "系统"