Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .changeset/34383-record-activity-types-without-comment.md
Original file line number Diff line number Diff line change
@@ -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: follow-up #34534

<!-- adr-0087: registered record-activity-types-without-comment-beside-composer-refused -->

**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 `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`).

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.
8 changes: 4 additions & 4 deletions content/docs/references/ui/component.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down Expand Up @@ -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 |
Expand Down
14 changes: 12 additions & 2 deletions packages/spec/dropped-refinements.baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": 1114,
"publishedSchemasWithDroppedRefinements": 268,
"droppedRefinementSites": 1116,
"refinementSitesThatDidProject": 728,
"refinementSitesWithNoJsonFormToCompare": 0
},
Expand Down Expand Up @@ -2064,6 +2064,16 @@
"components.element.lazy.type"
]
},
"ui/RecordActivityProps": {
"sites": [
""
]
},
"ui/RecordChatterProps": {
"sites": [
"feed"
]
},
"ui/RecordDetailsProps": {
"sites": [
"emptyState.link.url",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// 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.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 '
+ '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.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`.',
};
80 changes: 79 additions & 1 deletion packages/spec/src/ui/component.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand All @@ -2812,6 +2816,80 @@ 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 refusedAtComposer = (result: { success: boolean; error?: { issues: z.core.$ZodIssue[] } }) => {
expect(result.success).toBe(false);
// 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 = 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', () => {
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.
refusedAtComposer(RecordActivityProps.safeParse({ types: [] }));
});

it('matches exactly, as the renderers do: a cased spelling is not the comment kind', () => {
refusedAtComposer(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);
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.showCommentInput');
expect(issue?.code, type).toBe('custom');
expect(ComponentPropsMap[type].safeParse({ feed: { types: ['task'], showCommentInput: false } }).success, type).toBe(true);
}
});
});

// ---------------------------------------------------------------------------
// RecordChatterProps (replaces EmptyProps)
// ---------------------------------------------------------------------------
Expand Down
Loading
Loading