From 16bd342196ff1426fef15e19d659e90b53756089 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 16 Nov 2026 22:43:07 +0000 Subject: [PATCH 1/3] fix(spec)!: refuse a record:activity types list without comment while the comment composer is on Claude-Session: https://claude.ai/code/session_01ADHkmP9G6thtpoRS58fpJy Co-authored-by: Claude --- packages/spec/src/ui/component.test.ts | 77 +++++++++++++++++++++++++- packages/spec/src/ui/component.zod.ts | 45 ++++++++++++++- 2 files changed, 118 insertions(+), 4 deletions(-) diff --git a/packages/spec/src/ui/component.test.ts b/packages/spec/src/ui/component.test.ts index 8cb29983118..846a36930ef 100644 --- a/packages/spec/src/ui/component.test.ts +++ b/packages/spec/src/ui/component.test.ts @@ -2794,7 +2794,11 @@ describe('RecordActivityProps (enhanced)', () => { // Under the closed enum, 'commnet' got a named rejection. An open // vocabulary cannot distinguish a typo from a contributed kind, and the // ruling accepted that trade rather than re-close the vocabulary. - const result = RecordActivityProps.safeParse({ types: ['commnet'] }); + // `showCommentInput: false`: a list without 'comment' beside the composer + // is refused on its own account (#34383, pinned below), which is not a + // by-name rejection of the typo — this case keeps the composer off so it + // reads the vocabulary alone. + const result = RecordActivityProps.safeParse({ types: ['commnet'], showCommentInput: false }); expect(result.success).toBe(true); }); @@ -2812,6 +2816,77 @@ describe('RecordActivityProps (enhanced)', () => { }); }); +// --------------------------------------------------------------------------- +// #34383 — a feed `types` without 'comment' beside the comment composer +// --------------------------------------------------------------------------- +describe('RecordActivityProps — a `types` that leaves out comment is refused while the composer is on (#34383)', () => { + const refusedAtTypes = (result: { success: boolean; error?: { issues: z.core.$ZodIssue[] } }) => { + expect(result.success).toBe(false); + const issues = result.error!.issues.filter((i) => i.path.join('.') === 'types'); + expect(issues).toHaveLength(1); + expect(issues[0].code).toBe('custom'); + return issues[0]; + }; + + it('refuses the measured producer shape (HotCRM lead_activity: types [task], composer by default)', () => { + const issue = refusedAtTypes(RecordActivityProps.safeParse({ types: ['task'], limit: 20, showCompleted: true })); + // Both fixes are named; the message is the author's prescription. + expect(issue.message).toContain("add 'comment' to `types`"); + expect(issue.message).toContain('set `showCommentInput: false`'); + }); + + it('refuses it when the composer is asked for explicitly, and for a list of contributed kinds only', () => { + refusedAtTypes(RecordActivityProps.safeParse({ types: ['task', 'email'], showCommentInput: true })); + refusedAtTypes(RecordActivityProps.safeParse({ types: ['scheduled'] })); + // An empty list shows nothing at all, so it shows no comment either. + refusedAtTypes(RecordActivityProps.safeParse({ types: [] })); + }); + + it('matches exactly, as the renderers do: a cased spelling is not the comment kind', () => { + refusedAtTypes(RecordActivityProps.safeParse({ types: ['Comment', 'task'] })); + }); + + it('accepts the first fix: comment added to types', () => { + const result = RecordActivityProps.safeParse({ types: ['task', 'comment'] }); + expect(result.success).toBe(true); + }); + + it('accepts the second fix: the composer turned off', () => { + const result = RecordActivityProps.safeParse({ types: ['task'], showCommentInput: false }); + expect(result.success).toBe(true); + }); + + it('leaves an absent types alone, with the composer on or off', () => { + expect(RecordActivityProps.safeParse({}).success).toBe(true); + expect(RecordActivityProps.safeParse({ showCommentInput: true }).success).toBe(true); + expect(RecordActivityProps.safeParse({ showCommentInput: false }).success).toBe(true); + }); + + it('leaves a non-string entry to its own element issue', () => { + const result = RecordActivityProps.safeParse({ types: [42] }); + expect(result.success).toBe(false); + expect(result.error!.issues.map((i) => i.path.join('.'))).toEqual(['types.0']); + }); + + it('keeps the strict-object refusal of an unknown key beside the new check', () => { + const result = RecordActivityProps.safeParse({ types: ['comment'], typo_key: true }); + expect(result.success).toBe(false); + expect(result.error!.issues[0].code).toBe('unrecognized_keys'); + }); + + it('is the row both mounts judge with: record:activity, and the feed of record:chatter / record:discussion', () => { + expect(ComponentPropsMap['record:activity']).toBe(RecordActivityProps); + refusedAtTypes(ComponentPropsMap['record:activity'].safeParse({ types: ['task'] })); + for (const type of ['record:chatter', 'record:discussion'] as const) { + const result = ComponentPropsMap[type].safeParse({ feed: { types: ['task'] } }); + expect(result.success, type).toBe(false); + const issue = result.error!.issues.find((i) => i.path.join('.') === 'feed.types'); + expect(issue?.code, type).toBe('custom'); + expect(ComponentPropsMap[type].safeParse({ feed: { types: ['task'], showCommentInput: false } }).success, type).toBe(true); + } + }); +}); + // --------------------------------------------------------------------------- // RecordChatterProps (replaces EmptyProps) // --------------------------------------------------------------------------- diff --git a/packages/spec/src/ui/component.zod.ts b/packages/spec/src/ui/component.zod.ts index 3eec6db7ac2..d3235f080d3 100644 --- a/packages/spec/src/ui/component.zod.ts +++ b/packages/spec/src/ui/component.zod.ts @@ -1969,6 +1969,45 @@ export const RecordHighlightsProps = strictObject({ aria: AriaPropsSchema.optional().describe('ARIA accessibility attributes'), }); +/** + * #34383 — a feed whose authored `types` allow-list leaves out `'comment'` + * while its comment composer is on is refused where it is written. + * + * `types` names the feed item kinds the feed SHOWS, and `comment` is one of + * them; both renderers of this shape (`record:activity`, and the `feed` of + * `record:chatter` / `record:discussion`) filter their rows by that allow-list. + * So with `'comment'` left out, a comment posted through the composer is + * stored and then filtered out of the very feed it was posted to — the + * HotCRM `lead_detail` `lead_activity` block (`types: ['task']`) lost every + * post that way. The `record:activity` renderer withholds the composer on such + * a feed since #34388; this is the authoring half, so the contradiction is + * refused where it is written instead of being quietly corrected on screen. + * + * Judged on the PARSED value, so an omitted `showCommentInput` reads as its + * default `true` (the composer is on); the console mirror strips spec + * defaults, so `undefined` reads as on there too — `!== false` is the one + * reading both doors share. An absent `types` means every kind and is never + * refused. Matching is exact, as the renderers match: `'Comment'` is not + * `'comment'`. A `types` that already failed its own element check (a + * non-string entry) is left to that issue. + */ +function refuseFeedTypesWithoutCommentBesideComposer( + feed: { types?: unknown; showCommentInput?: unknown }, + ctx: z.RefinementCtx, +): void { + if (!Array.isArray(feed.types) || feed.showCommentInput === false) return; + if (!feed.types.every((entry) => typeof entry === 'string')) return; + if (feed.types.includes('comment')) return; + ctx.addIssue({ + code: 'custom', + path: ['types'], + message: `\`types\` (${JSON.stringify(feed.types)}) leaves out 'comment', so this feed never shows a comment, ` + + 'yet `showCommentInput` (default true) asks for a comment composer on it: a comment posted there would be ' + + 'stored and never shown on this feed. To take comments on this feed, add \'comment\' to `types`; ' + + 'to keep it comment-free, set `showCommentInput: false`.', + }); +} + export const RecordActivityProps = strictObject({ surface: 'this `record:activity`', history: PROPS_HISTORY, @@ -2021,7 +2060,7 @@ export const RecordActivityProps = strictObject({ * name; the ruling accepted that cost rather than re-close the vocabulary. */ types: z.array(z.union([FeedItemType, z.string().min(1)])).optional().describe( - 'Feed item kinds to show (default: all). Open vocabulary: the FeedItemType members are the platform built-in kinds, and author-contributed activity kinds (open sys_activity.type vocabulary, ADR-0052 §5b.2) are equally legal — entries are never validated against the built-in set.', + 'Feed item kinds to show (default: all). Open vocabulary: the FeedItemType members are the platform built-in kinds, and author-contributed activity kinds (open sys_activity.type vocabulary, ADR-0052 §5b.2) are equally legal — entries are never validated against the built-in set. A list that leaves out \'comment\' while `showCommentInput` is not false is refused: such a feed never shows a comment, so the composer would take posts it then hides — add \'comment\' or set `showCommentInput: false`.', ), /** Default filter mode (Airtable-style dropdown) */ filterMode: FeedFilterMode.default('all').describe('Default activity filter'), @@ -2034,7 +2073,7 @@ export const RecordActivityProps = strictObject({ /** Merge field_change + comment in a unified timeline */ unifiedTimeline: z.boolean().default(true).describe('Mix field changes and comments in one timeline (Airtable style)'), /** Show the comment input box at the bottom */ - showCommentInput: z.boolean().default(true).describe('Show "Leave a comment" input at the bottom'), + showCommentInput: z.boolean().default(true).describe('Show "Leave a comment" input at the bottom. Needs a `types` that admits \'comment\' (or no `types`): beside a `types` that leaves it out, set this false.'), /** Enable @mentions in comments */ enableMentions: z.boolean().default(true).describe('Enable @mentions in comments'), /** Enable emoji reactions */ @@ -2045,7 +2084,7 @@ export const RecordActivityProps = strictObject({ showSubscriptionToggle: z.boolean().default(true).describe('Show bell icon for record-level notification subscription'), /** ARIA accessibility */ aria: AriaPropsSchema.optional().describe('ARIA accessibility attributes'), -}); +}).superRefine(refuseFeedTypesWithoutCommentBesideComposer); // `position` old-spelling prescriptions (#8762). Each names `--from 17`: the // conversion is registered `toMajor: 18`, and a bare `os migrate meta` is From 3f150b7639521e98b96c4b6983b12e2abae25d6e Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 16 Nov 2026 22:49:24 +0000 Subject: [PATCH 2/3] fix(spec): register the refusal's semantic entry, changeset, refinement baseline and reference page Claude-Session: https://claude.ai/code/session_01ADHkmP9G6thtpoRS58fpJy Co-authored-by: Claude --- ...3-record-activity-types-without-comment.md | 22 ++++++++++++ content/docs/references/ui/component.mdx | 8 ++--- .../spec/dropped-refinements.baseline.json | 14 ++++++-- ...without-comment-beside-composer-refused.ts | 35 +++++++++++++++++++ 4 files changed, 73 insertions(+), 6 deletions(-) create mode 100644 .changeset/34383-record-activity-types-without-comment.md create mode 100644 packages/spec/src/migrations/entries/semantic/18.record-activity-types-without-comment-beside-composer-refused.ts diff --git a/.changeset/34383-record-activity-types-without-comment.md b/.changeset/34383-record-activity-types-without-comment.md new file mode 100644 index 00000000000..4e2af97501c --- /dev/null +++ b/.changeset/34383-record-activity-types-without-comment.md @@ -0,0 +1,22 @@ +--- +'@objectstack/spec': minor +--- + +fix(spec)!: a `record:activity` feed whose `types` leaves out `comment` is refused while its comment composer is on + +Clause-②: no (narrowing) +Metadata-protocol: narrowed +Skills-docs: none — `git grep` of `skills/` finds no `record:activity` block, feed `types` list or `showCommentInput` taught anywhere; the two `.describe()` texts and the generated reference page (`content/docs/references/ui/component.mdx`) carry the rule in this change. + + + +**BREAKING** for a page whose `record:activity` block (or the `feed` of a `record:chatter` / `record:discussion` block) authors a `types` list without `'comment'` while `showCommentInput` is not `false`. `types` is the allow-list of feed item kinds the feed shows, and `comment` is one of them, so on such a feed a comment posted through the composer was stored and then filtered out of the very feed it was posted to. The `record:activity` renderer already withholds the composer on such a feed; the contradiction is now refused where it is written. + +What moves (each line FROM → TO): + +- `RecordActivityProps` (`@objectstack/spec/ui`, the `record:activity` row of `ComponentPropsMap`) with `types` present, `'comment'` not in it, and `showCommentInput` absent or `true`: FROM parsed clean TO refused with one `custom` issue at `types` whose message names both fixes. `os lint`, `os validate`, `os build` and the page authoring door report it at error as `component-props-invalid` at `properties.types`. +- `RecordChatterProps.feed` (the same object, on `record:chatter` and `record:discussion`): the same, reported at `properties.feed.types`. + +The fix: add `'comment'` to `types` when the block should take comments, or set `showCommentInput: false` when it should stay comment-free. Which one is a judgement about the block, so nothing is converted (ADR-0087 D3, entry `record-activity-types-without-comment-beside-composer-refused`). + +Unchanged: a feed with no `types` (every kind), a `types` that lists `'comment'`, and any `types` beside `showCommentInput: false`. Entries are still never judged against the built-in kinds. Matching is exact, as the renderers match, so `'Comment'` is not the comment kind. Measured first-party exposure: zero — no example app, platform page, skill or docs sample authors `types` on a feed. diff --git a/content/docs/references/ui/component.mdx b/content/docs/references/ui/component.mdx index b147a09df45..87f5034f350 100644 --- a/content/docs/references/ui/component.mdx +++ b/content/docs/references/ui/component.mdx @@ -1634,13 +1634,13 @@ An any-of group: `{ or: [rule, ...] }` matches a record when ANY of its rules ma | Property | Type | Required | Description | | :--- | :--- | :--- | :--- | -| **types** | `(Enum<'comment' \| 'field_change' \| 'task' \| 'event' \| 'email' \| 'call' \| 'note' \| 'file' \| 'record_create' \| 'record_delete' \| 'approval' \| 'sharing' \| 'system'> \| string)[]` | optional | Feed item kinds to show (default: all). Open vocabulary: the FeedItemType members are the platform built-in kinds, and author-contributed activity kinds (open sys_activity.type vocabulary, ADR-0052 §5b.2) are equally legal — entries are never validated against the built-in set. | +| **types** | `(Enum<'comment' \| 'field_change' \| 'task' \| 'event' \| 'email' \| 'call' \| 'note' \| 'file' \| 'record_create' \| 'record_delete' \| 'approval' \| 'sharing' \| 'system'> \| string)[]` | optional | Feed item kinds to show (default: all). Open vocabulary: the FeedItemType members are the platform built-in kinds, and author-contributed activity kinds (open sys_activity.type vocabulary, ADR-0052 §5b.2) are equally legal — entries are never validated against the built-in set. A list that leaves out 'comment' while `showCommentInput` is not false is refused: such a feed never shows a comment, so the composer would take posts it then hides — add 'comment' or set `showCommentInput: false`. | | **filterMode** | `Enum<'all' \| 'comments_only' \| 'changes_only' \| 'tasks_only'>` | optional (default: `"all"`) | Default activity filter | | **showFilterToggle** | `boolean` | optional (default: `true`) | Show filter dropdown in panel header | | **limit** | `integer` | optional (default: `20`) | Number of items to load per page | | **showCompleted** | `boolean` | optional (default: `false`) | Include completed activities | | **unifiedTimeline** | `boolean` | optional (default: `true`) | Mix field changes and comments in one timeline (Airtable style) | -| **showCommentInput** | `boolean` | optional (default: `true`) | Show "Leave a comment" input at the bottom | +| **showCommentInput** | `boolean` | optional (default: `true`) | Show "Leave a comment" input at the bottom. Needs a `types` that admits 'comment' (or no `types`): beside a `types` that leaves it out, set this false. | | **enableMentions** | `boolean` | optional (default: `true`) | Enable @mentions in comments | | **enableReactions** | `boolean` | optional (default: `false`) | Enable emoji reactions on feed items | | **enableThreading** | `boolean` | optional (default: `false`) | Enable threaded replies on comments | @@ -1714,13 +1714,13 @@ An any-of group: `{ or: [rule, ...] }` matches a record when ANY of its rules ma | Property | Type | Required | Description | | :--- | :--- | :--- | :--- | -| **types** | `(Enum<'comment' \| 'field_change' \| 'task' \| 'event' \| 'email' \| 'call' \| 'note' \| …> \| string)[]` | optional | Feed item kinds to show (default: all). Open vocabulary: the FeedItemType members are the platform built-in kinds, and author-contributed activity kinds (open sys_activity.type vocabulary, ADR-0052 §5b.2) are equally legal — entries are never validated against the built-in set. | +| **types** | `(Enum<'comment' \| 'field_change' \| 'task' \| 'event' \| 'email' \| 'call' \| 'note' \| …> \| string)[]` | optional | Feed item kinds to show (default: all). Open vocabulary: the FeedItemType members are the platform built-in kinds, and author-contributed activity kinds (open sys_activity.type vocabulary, ADR-0052 §5b.2) are equally legal — entries are never validated against the built-in set. A list that leaves out 'comment' while `showCommentInput` is not false is refused: such a feed never shows a comment, so the composer would take posts it then hides — add 'comment' or set `showCommentInput: false`. | | **filterMode** | `Enum<'all' \| 'comments_only' \| 'changes_only' \| 'tasks_only'>` | optional (default: `"all"`) | Default activity filter | | **showFilterToggle** | `boolean` | optional (default: `true`) | Show filter dropdown in panel header | | **limit** | `integer` | optional (default: `20`) | Number of items to load per page | | **showCompleted** | `boolean` | optional (default: `false`) | Include completed activities | | **unifiedTimeline** | `boolean` | optional (default: `true`) | Mix field changes and comments in one timeline (Airtable style) | -| **showCommentInput** | `boolean` | optional (default: `true`) | Show "Leave a comment" input at the bottom | +| **showCommentInput** | `boolean` | optional (default: `true`) | Show "Leave a comment" input at the bottom. Needs a `types` that admits 'comment' (or no `types`): beside a `types` that leaves it out, set this false. | | **enableMentions** | `boolean` | optional (default: `true`) | Enable @mentions in comments | | **enableReactions** | `boolean` | optional (default: `false`) | Enable emoji reactions on feed items | | **enableThreading** | `boolean` | optional (default: `false`) | Enable threaded replies on comments | diff --git a/packages/spec/dropped-refinements.baseline.json b/packages/spec/dropped-refinements.baseline.json index 707a851edf6..9184de15554 100644 --- a/packages/spec/dropped-refinements.baseline.json +++ b/packages/spec/dropped-refinements.baseline.json @@ -2,8 +2,8 @@ "description": "Shrink-only ledger of every PUBLISHED JSON Schema that is STILL WIDER than the Zod type it was generated from, because a rule written as `.refine()` reaches the runtime and not the file (#18670). `z.toJSONSchema()` has no arm for a `custom` check: a plain record, the same record with a `.refine()`, and the same record with an ABORTING `.refine()` all project byte-identically (measured on zod 4.4.3, the version packages/spec resolves). So a document one of these files ACCEPTS can still be refused at parse time, and an author -- or an AI -- validating against packages/spec/json-schema/** finds out a release later. Each `sites` path is a position under that schema at which a refinement is dropped; the same paths are written onto the artifact itself as `x-dropped-refinements`. Item 2 closed the first patterns: a refinement DECLARED through the closed list in src/shared/refinement-projection.ts is emitted into the published file, reads `projected` rather than `dropped`, and its row LEAVES this ledger in the same PR -- which is why the ledger shrinks and never grows on a repair. Every refinement outside that closed list stays here, and adding an arm to the list is a public-contract decision, not a refactor. Hand-edited on purpose and with no `gen:` script: a generator would let a new gap be admitted by running a command instead of by a decision, which is the silence this ledger exists to end. Adding, removing or moving a site fails packages/spec/scripts/build-schemas.ts until the line moves with it, and the failure prints the corrected entry in full. ⛔ Do not delete or weaken a refinement to shorten this file -- the runtime rule is correct; it is the projection that is silent, and the remedy is to teach the closed list a NAMED pattern, never to drop the rule.", "measured": { "zod": "4.4.3", - "publishedSchemasWithDroppedRefinements": 266, - "droppedRefinementSites": 1090, + "publishedSchemasWithDroppedRefinements": 268, + "droppedRefinementSites": 1092, "refinementSitesThatDidProject": 728, "refinementSitesWithNoJsonFormToCompare": 0 }, @@ -2040,6 +2040,16 @@ "components.element.lazy.type" ] }, + "ui/RecordActivityProps": { + "sites": [ + "" + ] + }, + "ui/RecordChatterProps": { + "sites": [ + "feed" + ] + }, "ui/RecordDetailsProps": { "sites": [ "emptyState.link.url", diff --git a/packages/spec/src/migrations/entries/semantic/18.record-activity-types-without-comment-beside-composer-refused.ts b/packages/spec/src/migrations/entries/semantic/18.record-activity-types-without-comment-beside-composer-refused.ts new file mode 100644 index 00000000000..fa96aaec4f8 --- /dev/null +++ b/packages/spec/src/migrations/entries/semantic/18.record-activity-types-without-comment-beside-composer-refused.ts @@ -0,0 +1,35 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import type { SemanticMigration } from '../../types.js'; + +// #34383 — a feed `types` allow-list that leaves out 'comment' while the comment +// composer is on (`showCommentInput` not false) is refused where it is written. +// The renderer half (#34388) already withholds the composer on such a +// `record:activity`; this is the authoring half. Not converted: whether the +// block should take comments or stay comment-free is the author's call, and +// the two fixes render differently. +export const entry: SemanticMigration = { + id: 'record-activity-types-without-comment-beside-composer-refused', + surface: + 'pages[].…components[] of type record:activity (its properties), and the properties.feed of a record:chatter or ' + + 'record:discussion component, loaded by os lint / os validate / os build or saved through the page authoring ' + + 'door: a `types` list that does not contain \'comment\' while `showCommentInput` is not false (absent ' + + 'showCommentInput defaults to true)', + replacement: + 'Add \'comment\' to `types` when the block should take comments, or set `showCommentInput: false` when it should ' + + 'stay comment-free. Omitting `types` (every feed item kind) is unaffected. Refused at error as ' + + '`component-props-invalid` at properties.types (properties.feed.types on record:chatter / record:discussion).', + reason: + '`types` is the allow-list of feed item kinds the feed shows, and `comment` is one of them; both renderers of ' + + 'this shape filter their rows by it. With \'comment\' left out and the composer on, a comment posted through ' + + 'the composer was stored and then filtered out of the very feed it was posted to, so the member read it as a ' + + 'lost post (measured producer: the HotCRM lead_detail page, `lead_activity` with `types: [\'task\']`). The ' + + 'record:activity renderer now withholds the composer on such a feed; the spec refuses the contradiction where ' + + 'it is written instead of letting the screen quietly correct it. There is no mechanical rewrite: which of ' + + 'the two fixes the author meant is a judgement about the block.', + acceptanceCriteria: + 'Load every page (`os validate` or `os build`): no `component-props-invalid` finding at ' + + 'components[N].properties.types or properties.feed.types naming \'comment\'. Each record:activity block and ' + + 'record:chatter / record:discussion feed either omits `types`, lists \'comment\' in it, or sets ' + + '`showCommentInput: false`.', +}; From b843ae565c188bde3b3bee03b5dfbd57519edc70 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 00:41:51 +0000 Subject: [PATCH 3/3] fix(spec): locate the refusal at showCommentInput, the composer the list rules out A lone types list stays valid; the issue sits on the composer key so a per-key judge does not read it as the list itself being refused. Claude-Session: https://claude.ai/code/session_01ADHkmP9G6thtpoRS58fpJy Co-authored-by: Claude --- ...3-record-activity-types-without-comment.md | 6 +++--- ...without-comment-beside-composer-refused.ts | 8 ++++--- packages/spec/src/ui/component.test.ts | 21 +++++++++++-------- packages/spec/src/ui/component.zod.ts | 11 ++++++++-- 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/.changeset/34383-record-activity-types-without-comment.md b/.changeset/34383-record-activity-types-without-comment.md index 4e2af97501c..33e906d8c1c 100644 --- a/.changeset/34383-record-activity-types-without-comment.md +++ b/.changeset/34383-record-activity-types-without-comment.md @@ -6,7 +6,7 @@ fix(spec)!: a `record:activity` feed whose `types` leaves out `comment` is refus Clause-②: no (narrowing) Metadata-protocol: narrowed -Skills-docs: none — `git grep` of `skills/` finds no `record:activity` block, feed `types` list or `showCommentInput` taught anywhere; the two `.describe()` texts and the generated reference page (`content/docs/references/ui/component.mdx`) carry the rule in this change. +Skills-docs: follow-up #34534 @@ -14,8 +14,8 @@ Skills-docs: none — `git grep` of `skills/` finds no `record:activity` block, What moves (each line FROM → TO): -- `RecordActivityProps` (`@objectstack/spec/ui`, the `record:activity` row of `ComponentPropsMap`) with `types` present, `'comment'` not in it, and `showCommentInput` absent or `true`: FROM parsed clean TO refused with one `custom` issue at `types` whose message names both fixes. `os lint`, `os validate`, `os build` and the page authoring door report it at error as `component-props-invalid` at `properties.types`. -- `RecordChatterProps.feed` (the same object, on `record:chatter` and `record:discussion`): the same, reported at `properties.feed.types`. +- `RecordActivityProps` (`@objectstack/spec/ui`, the `record:activity` row of `ComponentPropsMap`) with `types` present, `'comment'` not in it, and `showCommentInput` absent or `true`: FROM parsed clean TO refused with one `custom` issue at `showCommentInput` (the composer the list rules out; `types` itself is not refused) whose message names both fixes. `os lint`, `os validate`, `os build` and the page authoring door report it at error as `component-props-invalid` at `properties.showCommentInput`. +- `RecordChatterProps.feed` (the same object, on `record:chatter` and `record:discussion`): the same, reported at `properties.feed.showCommentInput`. The fix: add `'comment'` to `types` when the block should take comments, or set `showCommentInput: false` when it should stay comment-free. Which one is a judgement about the block, so nothing is converted (ADR-0087 D3, entry `record-activity-types-without-comment-beside-composer-refused`). diff --git a/packages/spec/src/migrations/entries/semantic/18.record-activity-types-without-comment-beside-composer-refused.ts b/packages/spec/src/migrations/entries/semantic/18.record-activity-types-without-comment-beside-composer-refused.ts index fa96aaec4f8..576cdd9e496 100644 --- a/packages/spec/src/migrations/entries/semantic/18.record-activity-types-without-comment-beside-composer-refused.ts +++ b/packages/spec/src/migrations/entries/semantic/18.record-activity-types-without-comment-beside-composer-refused.ts @@ -18,7 +18,8 @@ export const entry: SemanticMigration = { replacement: 'Add \'comment\' to `types` when the block should take comments, or set `showCommentInput: false` when it should ' + 'stay comment-free. Omitting `types` (every feed item kind) is unaffected. Refused at error as ' - + '`component-props-invalid` at properties.types (properties.feed.types on record:chatter / record:discussion).', + + '`component-props-invalid` at properties.showCommentInput (properties.feed.showCommentInput on record:chatter / ' + + 'record:discussion), the composer the list rules out.', reason: '`types` is the allow-list of feed item kinds the feed shows, and `comment` is one of them; both renderers of ' + 'this shape filter their rows by it. With \'comment\' left out and the composer on, a comment posted through ' @@ -29,7 +30,8 @@ export const entry: SemanticMigration = { + 'the two fixes the author meant is a judgement about the block.', acceptanceCriteria: 'Load every page (`os validate` or `os build`): no `component-props-invalid` finding at ' - + 'components[N].properties.types or properties.feed.types naming \'comment\'. Each record:activity block and ' - + 'record:chatter / record:discussion feed either omits `types`, lists \'comment\' in it, or sets ' + + 'components[N].properties.showCommentInput or properties.feed.showCommentInput naming \'comment\'. ' + + 'Each record:activity block and record:chatter / record:discussion feed either omits `types`, lists ' + + '\'comment\' in it, or sets ' + '`showCommentInput: false`.', }; diff --git a/packages/spec/src/ui/component.test.ts b/packages/spec/src/ui/component.test.ts index 846a36930ef..b55c5496c81 100644 --- a/packages/spec/src/ui/component.test.ts +++ b/packages/spec/src/ui/component.test.ts @@ -2820,30 +2820,33 @@ describe('RecordActivityProps (enhanced)', () => { // #34383 — a feed `types` without 'comment' beside the comment composer // --------------------------------------------------------------------------- describe('RecordActivityProps — a `types` that leaves out comment is refused while the composer is on (#34383)', () => { - const refusedAtTypes = (result: { success: boolean; error?: { issues: z.core.$ZodIssue[] } }) => { + const refusedAtComposer = (result: { success: boolean; error?: { issues: z.core.$ZodIssue[] } }) => { expect(result.success).toBe(false); - const issues = result.error!.issues.filter((i) => i.path.join('.') === 'types'); + // Located at the composer the list rules out, not at `types` (see the + // check's docblock), so nothing reads it as a refusal of the list itself. + const issues = result.error!.issues.filter((i) => i.path.join('.') === 'showCommentInput'); + expect(result.error!.issues.filter((i) => i.path[0] === 'types')).toEqual([]); expect(issues).toHaveLength(1); expect(issues[0].code).toBe('custom'); return issues[0]; }; it('refuses the measured producer shape (HotCRM lead_activity: types [task], composer by default)', () => { - const issue = refusedAtTypes(RecordActivityProps.safeParse({ types: ['task'], limit: 20, showCompleted: true })); + const issue = refusedAtComposer(RecordActivityProps.safeParse({ types: ['task'], limit: 20, showCompleted: true })); // Both fixes are named; the message is the author's prescription. expect(issue.message).toContain("add 'comment' to `types`"); expect(issue.message).toContain('set `showCommentInput: false`'); }); it('refuses it when the composer is asked for explicitly, and for a list of contributed kinds only', () => { - refusedAtTypes(RecordActivityProps.safeParse({ types: ['task', 'email'], showCommentInput: true })); - refusedAtTypes(RecordActivityProps.safeParse({ types: ['scheduled'] })); + refusedAtComposer(RecordActivityProps.safeParse({ types: ['task', 'email'], showCommentInput: true })); + refusedAtComposer(RecordActivityProps.safeParse({ types: ['scheduled'] })); // An empty list shows nothing at all, so it shows no comment either. - refusedAtTypes(RecordActivityProps.safeParse({ types: [] })); + refusedAtComposer(RecordActivityProps.safeParse({ types: [] })); }); it('matches exactly, as the renderers do: a cased spelling is not the comment kind', () => { - refusedAtTypes(RecordActivityProps.safeParse({ types: ['Comment', 'task'] })); + refusedAtComposer(RecordActivityProps.safeParse({ types: ['Comment', 'task'] })); }); it('accepts the first fix: comment added to types', () => { @@ -2876,11 +2879,11 @@ describe('RecordActivityProps — a `types` that leaves out comment is refused w it('is the row both mounts judge with: record:activity, and the feed of record:chatter / record:discussion', () => { expect(ComponentPropsMap['record:activity']).toBe(RecordActivityProps); - refusedAtTypes(ComponentPropsMap['record:activity'].safeParse({ types: ['task'] })); + refusedAtComposer(ComponentPropsMap['record:activity'].safeParse({ types: ['task'] })); for (const type of ['record:chatter', 'record:discussion'] as const) { const result = ComponentPropsMap[type].safeParse({ feed: { types: ['task'] } }); expect(result.success, type).toBe(false); - const issue = result.error!.issues.find((i) => i.path.join('.') === 'feed.types'); + const issue = result.error!.issues.find((i) => i.path.join('.') === 'feed.showCommentInput'); expect(issue?.code, type).toBe('custom'); expect(ComponentPropsMap[type].safeParse({ feed: { types: ['task'], showCommentInput: false } }).success, type).toBe(true); } diff --git a/packages/spec/src/ui/component.zod.ts b/packages/spec/src/ui/component.zod.ts index d3235f080d3..f4d64ba0835 100644 --- a/packages/spec/src/ui/component.zod.ts +++ b/packages/spec/src/ui/component.zod.ts @@ -1987,7 +1987,14 @@ export const RecordHighlightsProps = strictObject({ * default `true` (the composer is on); the console mirror strips spec * defaults, so `undefined` reads as on there too — `!== false` is the one * reading both doors share. An absent `types` means every kind and is never - * refused. Matching is exact, as the renderers match: `'Comment'` is not + * refused. + * + * Located at `showCommentInput`, not at `types`: `types` on its own is valid + * (any list of kinds, the open-vocabulary ruling), and what this feed cannot + * honour is the composer beside it — the key whose value (written, or the + * default) asks for something the list rules out. An issue AT `types` would + * also read, to a per-key judge such as the console's member probe, as the + * container itself being refused. Matching is exact, as the renderers match: `'Comment'` is not * `'comment'`. A `types` that already failed its own element check (a * non-string entry) is left to that issue. */ @@ -2000,7 +2007,7 @@ function refuseFeedTypesWithoutCommentBesideComposer( if (feed.types.includes('comment')) return; ctx.addIssue({ code: 'custom', - path: ['types'], + path: ['showCommentInput'], message: `\`types\` (${JSON.stringify(feed.types)}) leaves out 'comment', so this feed never shows a comment, ` + 'yet `showCommentInput` (default true) asks for a comment composer on it: a comment posted there would be ' + 'stored and never shown on this feed. To take comments on this feed, add \'comment\' to `types`; '