From 3fab2676cb6b8637d86ad9da65b3853837cff964 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 14 Nov 2026 21:32:13 +0000 Subject: [PATCH 1/5] fix(app-shell): a record page asks no definition a member is refused or nothing draws The record route asked the targets of hidden system lookups (organization_id, owning_business_unit_id) by name, and the record view asked the reaction object's presence of a caller whose grants hold no read on it; the metadata door answers both as absent for such a caller, so a member logged 404s on every record page. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_016WV4cy1y7UNVbT2QAdmgdn --- .../__tests__/appObjectScope-12811.test.tsx | 50 ++++++++++++-- .../app-shell/src/console/appObjectScope.ts | 14 +++- .../RecordDetailView.feedGrant-12082.test.tsx | 65 +++++++++++++++++++ .../app-shell/src/views/RecordDetailView.tsx | 22 +++++-- 4 files changed, 139 insertions(+), 12 deletions(-) diff --git a/ui/packages/app-shell/src/console/__tests__/appObjectScope-12811.test.tsx b/ui/packages/app-shell/src/console/__tests__/appObjectScope-12811.test.tsx index e5a3f7e5ee4..495b0ae6daf 100644 --- a/ui/packages/app-shell/src/console/__tests__/appObjectScope-12811.test.tsx +++ b/ui/packages/app-shell/src/console/__tests__/appObjectScope-12811.test.tsx @@ -37,7 +37,7 @@ const OBJECTS = [ { name: 'sys_user', _packageId: 'plugin.auth', fields: {} }, ]; -function makeAdapter(calls: string[], apps: unknown[]) { +function makeAdapter(calls: string[], apps: unknown[], objects: readonly { name: string }[] = OBJECTS) { return { clearCache: vi.fn(), invalidateCache: vi.fn(), @@ -53,13 +53,13 @@ function makeAdapter(calls: string[], apps: unknown[]) { meta: { getItems: (type: string, options?: { packageId?: string }) => { calls.push(options?.packageId ? `${type}?package=${options.packageId}` : type); - const all = type === 'object' ? OBJECTS : type === 'app' ? apps : []; + const all = type === 'object' ? objects : type === 'app' ? apps : []; const items = options?.packageId ? all.filter((o: any) => o._packageId === options.packageId) : all; return Promise.resolve({ type, items: structuredClone(items) }); }, getItem: (type: string, name: string) => { calls.push(`${type}/${name}`); - const item = (type === 'object' ? OBJECTS : []).find((o) => o.name === name); + const item = (type === 'object' ? objects : []).find((o) => o.name === name); return item ? Promise.resolve({ item: structuredClone(item) }) : Promise.reject(new Error('404')); }, }, @@ -72,12 +72,12 @@ function Prefetch() { return null; } -function mount(url: string, apps: unknown[]): string[] { +function mount(url: string, apps: unknown[], objects?: readonly { name: string }[]): string[] { // Each mount reads its own app list, not the one a previous mount cached. sessionStorage.clear(); const calls: string[] = []; render( - + @@ -251,3 +251,43 @@ describe('objectstack#29551 — a packaged app asks its lookup targets without v expect(scope()).toBe('crm_account[crm_account.all],crm_contact[crm_contact.all]'); }); }); + +describe('objectstack#33343 — a hidden lookup asks no definition of its target', () => { + /** + * The route object carries the injected system scope anchors as the server + * serves them: `organization_id` and `owning_business_unit_id`, hidden + * lookups to `sys_organization` and `sys_business_unit`. No cell draws a + * hidden field, and the metadata door answers a definition the caller may + * not read as absent, so a member was answered 404 on every route. + */ + const withAnchors = (hidden: boolean) => [ + { + name: 'crm_account', + _packageId: CRM, + fields: { + owner: { type: 'lookup', reference: 'sys_user' }, + organization_id: { type: 'lookup', reference: 'sys_organization', hidden, system: true }, + owning_business_unit_id: { type: 'lookup', reference: 'sys_business_unit', hidden, system: true }, + }, + }, + { name: 'sys_user', _packageId: 'plugin.auth', fields: {} }, + { name: 'sys_organization', _packageId: 'plugin.auth', fields: {} }, + { name: 'sys_business_unit', _packageId: 'plugin.security', fields: {} }, + ]; + + it('the route asks its drawn lookup target by name, and never the targets of its hidden lookups', async () => { + const calls = mount('/apps/crm/crm_account', APPS, withAnchors(true)); + await waitFor(() => expect(calls).toContain('object/sys_user')); + await new Promise((resolve) => setTimeout(resolve, 50)); + expect(objectCalls(calls)).toEqual([`object?package=${CRM}`, 'object/sys_user']); + }); + + it('CONTROL: the same lookups drawn ask every target by name', async () => { + const calls = mount('/apps/crm/crm_account', APPS, withAnchors(false)); + await waitFor(() => expect(calls).toContain('object/sys_business_unit')); + await new Promise((resolve) => setTimeout(resolve, 50)); + expect([...objectCalls(calls)].sort()).toEqual( + [`object?package=${CRM}`, 'object/sys_business_unit', 'object/sys_organization', 'object/sys_user'].sort(), + ); + }); +}); diff --git a/ui/packages/app-shell/src/console/appObjectScope.ts b/ui/packages/app-shell/src/console/appObjectScope.ts index 9184fa27207..bf21d319e98 100644 --- a/ui/packages/app-shell/src/console/appObjectScope.ts +++ b/ui/packages/app-shell/src/console/appObjectScope.ts @@ -430,12 +430,24 @@ function hasRecordFormOverlay(search: string): boolean { return sp.has(RECORD_FORM_PARAM) || sp.has(RECORD_FORM_OBJECT_PARAM); } -/** The objects an object's lookup and master-detail fields point at. */ +/** + * The objects an object's drawn lookup and master-detail fields point at. + * + * A target is read for the cell that links and names it, so a field declared + * `hidden: true` asks for none: no surface this scope serves draws it. That + * includes the injected system scope anchors (`organization_id` and + * `owning_business_unit_id`), which point at `sys_organization` and + * `sys_business_unit` from every object; asking their definitions read nothing + * a page draws, and for a caller the object read check refuses, the metadata + * door answers that definition as absent (ADR-0106 as amended by ruling record + * 6787890900), so the read answered 404 on every route of every object. + */ function lookupTargetNames(def: any): string[] { const fields = def?.fields; const defs: any[] = Array.isArray(fields) ? fields : Object.values((fields ?? {}) as Record); const out = new Set(); for (const field of defs) { + if (field?.hidden === true) continue; if ((field?.type === 'lookup' || field?.type === 'master_detail') && typeof field.reference === 'string' && field.reference) { out.add(field.reference); } diff --git a/ui/packages/app-shell/src/views/RecordDetailView.feedGrant-12082.test.tsx b/ui/packages/app-shell/src/views/RecordDetailView.feedGrant-12082.test.tsx index 13e6373aa47..251eb6f60ad 100644 --- a/ui/packages/app-shell/src/views/RecordDetailView.feedGrant-12082.test.tsx +++ b/ui/packages/app-shell/src/views/RecordDetailView.feedGrant-12082.test.tsx @@ -426,3 +426,68 @@ describe('on the column store the reaction control reads feedReactionColumn: upd expect(!!addReaction(view)).toBe(offered); }); }); + +/** + * Which store the chatter uses is asked of the object registry only by a + * caller who may read `sys_comment_reaction` (objectstack#33343). The metadata + * door serves an object's definition only to a caller its read check admits, + * so a caller whose grants hold no read on the object was answered 404 on every + * record page; that answer took the column store. Here the registry is the + * by-name scope reader, which records each name the page asks. + */ +describe('the reaction store is asked of the registry only by a caller who may read sys_comment_reaction (objectstack#33343)', () => { + /** Mounts the page over a by-name registry; returns the object names it was asked. */ + async function mountAsking(perms: MePermissionsResponse | null, registry: unknown[], dataSource = makeDataSource()) { + const asked: string[] = []; + const pages = [PAGE]; + const readObjectScope = (scope: { packageId?: string; names?: readonly string[] }) => { + asked.push(...(scope.names ?? []).filter((name) => typeof name === 'string' && name !== '')); + const served = scope.names + ? registry.filter((o) => scope.names!.includes((o as { name: string }).name)) + : registry; + return { objects: served, served, missing: [], settled: true, failed: [], refused: {}, answers: {}, views: [] }; + }; + const metadata = { + ...metadataFor(registry), + readObjectScope, + getTypeStatus: (type: string) => (type === 'object' ? 'idle' : 'ready'), + ensureType: async () => pages, + } as any; + const page = ( + + + {}} + objectNameOverride={OBJECT_NAME} + recordIdOverride={RECORD_ID} + embedded + /> + + + ); + const view = render(perms ? {page} : page); + await within(view.container).findByText(COMMENT_BODY); + await act(async () => {}); + const reactionReads = dataSource.find.mock.calls.filter(([objectName]: [string]) => objectName === REACTION); + return { asked, reactionReads }; + } + + it('a caller whose grants hold no read on sys_comment_reaction is not asked about it, and takes the column store its absence took', async () => { + const { asked, reactionReads } = await mountAsking(answer({ [COMMENT]: SHAPE.full }), REGISTRY.column); + expect(asked).not.toContain(REACTION); + expect(reactionReads).toEqual([]); + }); + + it('CONTROL — a caller who may read it asks the registry, and the records store reads its rows', async () => { + const { asked, reactionReads } = await mountAsking(answer({ [COMMENT]: SHAPE.full, [REACTION]: SHAPE.readOnly }), REGISTRY.records); + expect(asked).toContain(REACTION); + expect(reactionReads).toHaveLength(1); + }); + + it('CONTROL — with no permission provider every grant reads open: the registry is asked, as before', async () => { + const { asked } = await mountAsking(null, REGISTRY.records); + expect(asked).toContain(REACTION); + }); +}); diff --git a/ui/packages/app-shell/src/views/RecordDetailView.tsx b/ui/packages/app-shell/src/views/RecordDetailView.tsx index eb89f06eef9..b688dab3b38 100644 --- a/ui/packages/app-shell/src/views/RecordDetailView.tsx +++ b/ui/packages/app-shell/src/views/RecordDetailView.tsx @@ -3176,12 +3176,22 @@ export function RecordDetailView({ dataSource, objects, onEdit, objectNameOverri // path, and every uncertain answer takes the records path. `null` until the // registry has answered, and the feed read waits for it: comments and their // reactions are read as one answer. - const reactionPresence = useObjectPresence(COMMENT_REACTION_OBJECT); - const reactionStore: 'records' | 'column' | null = !reactionPresence.settled - ? null - : reactionPresence.presence === 'absent' - ? 'column' - : 'records'; + // + // A caller whose loaded grants hold no read on the object is not asked about + // it: the metadata door serves an object's definition only to a caller its + // read check admits (ADR-0106 as amended by ruling record 6787890900), and + // the object declares no `schemaReadDelegate`, so that read could only + // answer absent (a 404 on every record page). It takes the path that answer + // takes. With no permission provider every grant reads open, as before. + const reactionReadRefused = perms.isLoaded && !perms.can(COMMENT_REACTION_OBJECT, 'read'); + const reactionPresence = useObjectPresence(reactionReadRefused ? '' : COMMENT_REACTION_OBJECT); + const reactionStore: 'records' | 'column' | null = reactionReadRefused + ? 'column' + : !reactionPresence.settled + ? null + : reactionPresence.presence === 'absent' + ? 'column' + : 'records'; /** * The signed-in user's own reaction rows, per comment (`[thread, comment]`) * and emoji: the row id a click that takes the reaction back deletes. Filled From e7b95effb8c2b09602797d01e200d5ccde0fb046 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 14 Nov 2026 22:39:15 +0000 Subject: [PATCH 2/5] chore(changeset): record page member meta reads Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_016WV4cy1y7UNVbT2QAdmgdn --- .changeset/33343-record-page-member-meta-404.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .changeset/33343-record-page-member-meta-404.md diff --git a/.changeset/33343-record-page-member-meta-404.md b/.changeset/33343-record-page-member-meta-404.md new file mode 100644 index 00000000000..ac29762165f --- /dev/null +++ b/.changeset/33343-record-page-member-meta-404.md @@ -0,0 +1,15 @@ +--- +'@object-ui/app-shell': patch +--- + +fix(app-shell): a member's record page asks no object definition the metadata door would answer as absent + +Clause-②: no +Metadata-protocol: none + +A member (a caller with no administrator grant) opening a record page logged two `404`s, `GET /api/v1/meta/object/sys_business_unit` and `GET /api/v1/meta/object/sys_comment_reaction`. The metadata door serves an object's definition only to a caller its read check admits, and answers any other caller as if the object did not exist; the stock member grants hold no read on either object, so both answers are correct, and the page should not have asked. + +- The record and list routes ask the definitions of their object's lookup targets, for the cells that link and name them. They no longer ask the target of a field declared `hidden: true`, which no cell draws. That includes the system scope fields the platform adds to an object (`organization_id` and `owning_business_unit_id`), which point at `sys_organization` and `sys_business_unit`; those two reads are gone for every caller. +- The record page asks whether the deployment has `sys_comment_reaction` to choose where reactions are stored. A caller whose loaded grants hold no read on that object is no longer asked: it takes the reactions path the absent answer took before. With no permission provider mounted, the page asks as before. + +Nothing a member or an administrator sees on the page changes, and no server answer changes. From a1dfed0051b3deccceefb916c5ee743fad6cb5c0 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 01:51:30 +0000 Subject: [PATCH 3/5] fix(app-shell): a record page offers the reactions column write only where sys_comment still declares the column Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_016WV4cy1y7UNVbT2QAdmgdn --- .../app-shell/src/hooks/useObjectPresence.ts | 29 +++++-- .../RecordDetailView.feedGrant-12082.test.tsx | 81 ++++++++++++++++++- .../app-shell/src/views/RecordDetailView.tsx | 45 +++++++++-- 3 files changed, 140 insertions(+), 15 deletions(-) diff --git a/ui/packages/app-shell/src/hooks/useObjectPresence.ts b/ui/packages/app-shell/src/hooks/useObjectPresence.ts index 3b4decf0109..a5dd0c2512a 100644 --- a/ui/packages/app-shell/src/hooks/useObjectPresence.ts +++ b/ui/packages/app-shell/src/hooks/useObjectPresence.ts @@ -223,6 +223,14 @@ export interface ObjectPresenceReading { * `presence`: `absent` skips the read, anything else performs it. */ settled: boolean; + /** + * The object's definition as the registry served it, when `presence` is + * `present`; otherwise `undefined`. A reader that chooses a path by what the + * deployment's object declares (the record chatter asks whether + * `sys_comment` still declares its retired `reactions` column) reads it here + * rather than asking the registry a second time. + */ + definition?: unknown; } /** @see ObjectPresenceReading.settled */ @@ -271,17 +279,24 @@ export function useObjectPresence(name: string): ObjectPresenceReading { if (readObjectScope && getTypeStatus?.('object') === 'idle') { const readNames = readObjectScope as ReadNamesWithoutViews; const scope = readNames(packageId ? { packageId, names: [name], views: false } : { names: [name], views: false }); - const presence: ObjectPresence = !scope.settled - ? 'unknown' - : scope.objects.some((o) => (o as { name?: unknown } | null | undefined)?.name === name) - ? 'present' - : 'absent'; - return { presence, settled: scope.settled }; + const definition = scope.settled ? definitionNamed(scope.objects, name) : undefined; + const presence: ObjectPresence = !scope.settled ? 'unknown' : definition !== undefined ? 'present' : 'absent'; + return { presence, settled: scope.settled, definition }; } // Reading the items is also what ENSURES the type is fetched (MetadataProvider // `readType`), so a surface that only ever asks this question still gets an // answer instead of waiting on somebody else to populate the cache. const objects = getItemsByType('object'); const status = getTypeStatus?.('object'); - return { presence: objectPresence(name, status, objects), settled: metadataTypeSettled(status) }; + const presence = objectPresence(name, status, objects); + return { + presence, + settled: metadataTypeSettled(status), + definition: presence === 'present' ? definitionNamed(objects, name) : undefined, + }; +} + +/** The definition in `objects` named `name`, if one is. */ +function definitionNamed(objects: readonly unknown[], name: string): unknown { + return objects.find((o) => (o as { name?: unknown } | null | undefined)?.name === name) ?? undefined; } diff --git a/ui/packages/app-shell/src/views/RecordDetailView.feedGrant-12082.test.tsx b/ui/packages/app-shell/src/views/RecordDetailView.feedGrant-12082.test.tsx index 251eb6f60ad..d07cc090ee9 100644 --- a/ui/packages/app-shell/src/views/RecordDetailView.feedGrant-12082.test.tsx +++ b/ui/packages/app-shell/src/views/RecordDetailView.feedGrant-12082.test.tsx @@ -104,10 +104,27 @@ const PAGE = { ], }; -/** The object registry: with the reaction object (the records store), or without it (the column store). */ +/** + * `sys_comment` as a framework without `sys_comment_reaction` serves it: it + * still declares the `reactions` column the column store writes. + */ +const COLUMN_ERA_COMMENT = { + name: COMMENT, + label: 'Comment', + fields: { body: { type: 'textarea', label: 'Body' }, reactions: { type: 'textarea', label: 'Reactions' } }, +}; +/** `sys_comment` as a framework with `sys_comment_reaction` serves it: the column is retired. */ +const RECORDS_ERA_COMMENT = { name: COMMENT, label: 'Comment', fields: { body: { type: 'textarea', label: 'Body' } } }; + +/** + * The object registry: with the reaction object (the records store); without + * it, on a framework that predates it (the column store); or a framework that + * has it, as a caller refused it is served, without it (objectstack#33521). + */ const REGISTRY = { records: [...OBJECTS, { name: REACTION, label: 'Comment Reaction' }], - column: OBJECTS, + column: [...OBJECTS, COLUMN_ERA_COMMENT], + refused: [...OBJECTS, RECORDS_ERA_COMMENT], }; /** The four grant shapes of the map's enumeration pin, as `/me/permissions` carries them. */ @@ -491,3 +508,63 @@ describe('the reaction store is asked of the registry only by a caller who may r expect(asked).toContain(REACTION); }); }); + +/** + * The column store is taken only where `sys_comment_reaction` is not deployed, + * never where the caller is refused it (objectstack#33521). Both answers read + * alike: the metadata door answers a refused caller's definition read as + * absent, and a caller's grants name neither. The column left `sys_comment` in + * the release that added the object, so `sys_comment`'s own served definition + * tells them apart. On a framework that has the object, a caller refused it was + * offered the column control, and its click was a + * `PATCH /api/v1/data/sys_comment/:id` naming the retired `reactions` column, + * which the data door answers `400 INVALID_FIELD`. + */ +describe('a caller refused sys_comment_reaction is offered no column write where the column is retired (objectstack#33521)', () => { + /** The writes that named the reactions column. */ + const columnWrites = (dataSource: ReturnType) => + dataSource.update.mock.calls.filter(([o, , patch]: [string, string, any]) => o === COMMENT && 'reactions' in (patch ?? {})); + const reactionReads = (dataSource: ReturnType) => + dataSource.find.mock.calls.filter(([objectName]: [string]) => objectName === REACTION); + + it('a caller whose grants hold no read on it is offered no reaction control and sends no reaction request', async () => { + const { view, dataSource } = await mount(answer({ [COMMENT]: SHAPE.full }), makeDataSource(), REGISTRY.refused); + expect(addReaction(view)).toBeNull(); + // The stored chip is not read off the retired column either: a comment + // read on this framework never returns it. + expect(thumbsChip(view)).toBeUndefined(); + expect(columnWrites(dataSource)).toEqual([]); + expect(reactionReads(dataSource)).toEqual([]); + expect(dataSource.create).not.toHaveBeenCalled(); + }); + + it('with no permission provider, a registry that answers the object absent is read the same way: no control', async () => { + const { view, dataSource } = await mount(null, makeDataSource(), REGISTRY.refused); + expect(addReaction(view)).toBeNull(); + expect(thumbsChip(view)).toBeUndefined(); + expect(columnWrites(dataSource)).toEqual([]); + }); + + it('CONTROL — where the object is not deployed (sys_comment declares the column) the column path is still used', async () => { + const { view, dataSource } = await mount(answer({ [COMMENT]: SHAPE.full }), makeDataSource('u2'), REGISTRY.column); + expect(addReaction(view)).not.toBeNull(); + expect(reactionReads(dataSource)).toEqual([]); + fireEvent.click(thumbsChip(view)!); + await act(async () => {}); + expect(columnWrites(dataSource)).toHaveLength(1); + const [, id, patch] = columnWrites(dataSource)[0]; + expect(id).toBe(COMMENT_ID); + expect(JSON.parse(patch.reactions)).toEqual({ '👍': ['u2', 'u1'] }); + expect(dataSource.create).not.toHaveBeenCalled(); + }); + + it('CONTROL — a caller who holds the grant takes the records store: its rows are read and a click creates its own row', async () => { + const { view, dataSource } = await mount(answer({ [COMMENT]: SHAPE.full, [REACTION]: SHAPE.full }), makeDataSource('u2'), REGISTRY.records); + expect(addReaction(view)).not.toBeNull(); + expect(reactionReads(dataSource)).toHaveLength(1); + fireEvent.click(thumbsChip(view)!); + await act(async () => {}); + expect(dataSource.create.mock.calls).toEqual([[REACTION, { comment_id: COMMENT_ID, emoji: '👍' }]]); + expect(columnWrites(dataSource)).toEqual([]); + }); +}); diff --git a/ui/packages/app-shell/src/views/RecordDetailView.tsx b/ui/packages/app-shell/src/views/RecordDetailView.tsx index b688dab3b38..a63343be760 100644 --- a/ui/packages/app-shell/src/views/RecordDetailView.tsx +++ b/ui/packages/app-shell/src/views/RecordDetailView.tsx @@ -632,6 +632,21 @@ const COMMENT_REACTION_REMOVE_PATH = '/api/v1/comments/reactions'; /** The object the record feed's comments and replies are rows of. */ const COMMENT_OBJECT = 'sys_comment'; +/** + * Whether a served `sys_comment` definition still declares the retired + * `reactions` column: the one deployment the column store writes to. The + * column left `sys_comment` in the release that added + * {@link COMMENT_REACTION_OBJECT} (`sys-comment-reactions-column-retired`), so + * a definition that declares it is a framework without that object, and one + * that does not refuses a write naming it (`400 INVALID_FIELD`). No definition + * (none served, or not read yet) is not evidence of the column. + */ +function declaresReactionsColumn(definition: unknown): boolean { + const fields = (definition as { fields?: unknown } | null | undefined)?.fields; + if (Array.isArray(fields)) return fields.some((f) => (f as { name?: unknown } | null)?.name === 'reactions'); + return !!fields && typeof fields === 'object' && Object.prototype.hasOwnProperty.call(fields, 'reactions'); +} + /** * `sys_approval_request`'s declared recall. While the decision bar draws it, * the DetailView approval band yields its own Recall (objectstack#25877). @@ -3183,15 +3198,31 @@ export function RecordDetailView({ dataSource, objects, onEdit, objectNameOverri // the object declares no `schemaReadDelegate`, so that read could only // answer absent (a 404 on every record page). It takes the path that answer // takes. With no permission provider every grant reads open, as before. + // + // Neither answer tells an undeployed object from a refused one: the door + // answers both as absent, and a caller's grants name neither. What does is + // `sys_comment`'s own definition, which this caller reads: the release that + // added `sys_comment_reaction` retired the `reactions` column in the same + // step (`sys-comment-reactions-column-retired`), so a framework without the + // object still declares the column, and one with it does not. So the column + // path is taken only where `sys_comment` declares `reactions`. Anywhere else + // the object is there and this caller may not read it: `none`, no reaction + // is read or offered. The column write there answered `400 INVALID_FIELD` + // on every click, and the caller's own reaction row is refused too. const reactionReadRefused = perms.isLoaded && !perms.can(COMMENT_REACTION_OBJECT, 'read'); const reactionPresence = useObjectPresence(reactionReadRefused ? '' : COMMENT_REACTION_OBJECT); - const reactionStore: 'records' | 'column' | null = reactionReadRefused - ? 'column' - : !reactionPresence.settled + const reactionObjectUnread = + reactionReadRefused || (reactionPresence.settled && reactionPresence.presence === 'absent'); + const commentPresence = useObjectPresence(reactionObjectUnread ? COMMENT_OBJECT : ''); + const reactionStore: 'records' | 'column' | 'none' | null = !reactionObjectUnread + ? reactionPresence.settled + ? 'records' + : null + : !commentPresence.settled ? null - : reactionPresence.presence === 'absent' + : declaresReactionsColumn(commentPresence.definition) ? 'column' - : 'records'; + : 'none'; /** * The signed-in user's own reaction rows, per comment (`[thread, comment]`) * and emoji: the row id a click that takes the reaction back deletes. Filled @@ -3383,7 +3414,9 @@ export function RecordDetailView({ dataSource, objects, onEdit, objectNameOverri reactions: reactionStore === 'records' ? toReactions(records?.stored.get(String(c.id))) - : parseReactions(c.reactions), + : reactionStore === 'column' + ? parseReactions(c.reactions) + : undefined, })); // Into THIS record's slice — `threadId` is the key the effect closed // over, so a response that arrives after the user navigated away From 9a682b0d5b7dde5b5086e73c194727f2d42cd7f0 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 01:59:09 +0000 Subject: [PATCH 4/5] test(app-shell): column-store fixtures serve the sys_comment that still declares its reactions column Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_016WV4cy1y7UNVbT2QAdmgdn --- ...ecordDetailView.reactionKeepIds-11019.test.tsx | 15 +++++++++++++-- ...ecordDetailView.reactionRecords-12078.test.tsx | 11 +++++++++-- ...DetailView.reactionWriteFailure-10899.test.tsx | 15 +++++++++++++-- ...ilView.reactionsCommentRowsOnly-11035.test.tsx | 15 +++++++++++++-- 4 files changed, 48 insertions(+), 8 deletions(-) diff --git a/ui/packages/app-shell/src/views/RecordDetailView.reactionKeepIds-11019.test.tsx b/ui/packages/app-shell/src/views/RecordDetailView.reactionKeepIds-11019.test.tsx index e12296da537..f5d18333220 100644 --- a/ui/packages/app-shell/src/views/RecordDetailView.reactionKeepIds-11019.test.tsx +++ b/ui/packages/app-shell/src/views/RecordDetailView.reactionKeepIds-11019.test.tsx @@ -85,6 +85,16 @@ const OBJECTS = [ }, ]; +/** + * The object registry of a framework without `sys_comment_reaction`: its + * `sys_comment` still declares the `reactions` column the column store writes + * (objectstack#33521). + */ +const REGISTRY = [ + ...OBJECTS, + { name: 'sys_comment', label: 'Comment', fields: { reactions: { type: 'textarea', label: 'Reactions' } } }, +]; + const PAGE = { name: 'customer_record_page', type: 'record', @@ -131,8 +141,9 @@ async function mountAs(userId: string, dataSource: any) { getItem: async () => null, // The registry lists this deployment's objects, and `sys_comment_reaction` // is not one of them, so the page keeps reactions in the - // `sys_comment.reactions` column (objectui#12078). - getItemsByType: (type: string) => (type === 'page' ? pages : type === 'object' ? OBJECTS : []), + // `sys_comment.reactions` column (objectui#12078), which its `sys_comment` + // still declares (objectstack#33521). + getItemsByType: (type: string) => (type === 'page' ? pages : type === 'object' ? REGISTRY : []), } as any; render( diff --git a/ui/packages/app-shell/src/views/RecordDetailView.reactionRecords-12078.test.tsx b/ui/packages/app-shell/src/views/RecordDetailView.reactionRecords-12078.test.tsx index 195a8138cb3..5d59f067cf1 100644 --- a/ui/packages/app-shell/src/views/RecordDetailView.reactionRecords-12078.test.tsx +++ b/ui/packages/app-shell/src/views/RecordDetailView.reactionRecords-12078.test.tsx @@ -115,10 +115,17 @@ const PAGE = { ], }; -/** The object registry each case serves: with the reaction object, without it, or listing nothing. */ +/** + * The object registry each case serves: with the reaction object, without it + * (a framework that predates it, whose `sys_comment` still declares the + * `reactions` column, objectstack#33521), or listing nothing. + */ const REGISTRY = { present: [...OBJECTS, { name: REACTION, label: 'Comment Reaction' }], - absent: OBJECTS, + absent: [ + ...OBJECTS, + { name: 'sys_comment', label: 'Comment', fields: { reactions: { type: 'textarea', label: 'Reactions' } } }, + ], empty: [] as unknown[], }; diff --git a/ui/packages/app-shell/src/views/RecordDetailView.reactionWriteFailure-10899.test.tsx b/ui/packages/app-shell/src/views/RecordDetailView.reactionWriteFailure-10899.test.tsx index 825654ba6bf..6306cb666ee 100644 --- a/ui/packages/app-shell/src/views/RecordDetailView.reactionWriteFailure-10899.test.tsx +++ b/ui/packages/app-shell/src/views/RecordDetailView.reactionWriteFailure-10899.test.tsx @@ -91,6 +91,16 @@ const OBJECTS = [ }, ]; +/** + * The object registry of a framework without `sys_comment_reaction`: its + * `sys_comment` still declares the `reactions` column the column store writes + * (objectstack#33521). + */ +const REGISTRY = [ + ...OBJECTS, + { name: 'sys_comment', label: 'Comment', fields: { reactions: { type: 'textarea', label: 'Reactions' } } }, +]; + const PAGE = { name: 'customer_record_page', type: 'record', @@ -146,8 +156,9 @@ function mount(dataSource: any, wrap: (tree: React.ReactElement) => React.ReactE getItem: async () => null, // The registry lists this deployment's objects, and `sys_comment_reaction` // is not one of them, so the page keeps reactions in the - // `sys_comment.reactions` column (objectui#12078). - getItemsByType: (type: string) => (type === 'page' ? pages : type === 'object' ? OBJECTS : []), + // `sys_comment.reactions` column (objectui#12078), which its `sys_comment` + // still declares (objectstack#33521). + getItemsByType: (type: string) => (type === 'page' ? pages : type === 'object' ? REGISTRY : []), } as any; return render( wrap( diff --git a/ui/packages/app-shell/src/views/RecordDetailView.reactionsCommentRowsOnly-11035.test.tsx b/ui/packages/app-shell/src/views/RecordDetailView.reactionsCommentRowsOnly-11035.test.tsx index ceaf94c9914..f5febb8e06e 100644 --- a/ui/packages/app-shell/src/views/RecordDetailView.reactionsCommentRowsOnly-11035.test.tsx +++ b/ui/packages/app-shell/src/views/RecordDetailView.reactionsCommentRowsOnly-11035.test.tsx @@ -85,6 +85,16 @@ const OBJECTS = [ }, ]; +/** + * The object registry of a framework without `sys_comment_reaction`: its + * `sys_comment` still declares the `reactions` column the column store writes + * (objectstack#33521). + */ +const REGISTRY = [ + ...OBJECTS, + { name: 'sys_comment', label: 'Comment', fields: { reactions: { type: 'textarea', label: 'Reactions' } } }, +]; + /** * Hands the page's reaction handler an id directly, the way any consumer of * `DiscussionContext` can: one button per feed id. @@ -164,8 +174,9 @@ async function mount(dataSource: any, { withProbe = false } = {}) { getItem: async () => null, // The registry lists this deployment's objects, and `sys_comment_reaction` // is not one of them, so the page keeps reactions in the - // `sys_comment.reactions` column (objectui#12078). - getItemsByType: (type: string) => (type === 'page' ? pages : type === 'object' ? OBJECTS : []), + // `sys_comment.reactions` column (objectui#12078), which its `sys_comment` + // still declares (objectstack#33521). + getItemsByType: (type: string) => (type === 'page' ? pages : type === 'object' ? REGISTRY : []), } as any; render( From b3eecbde15315588da573be114cd0f361cb44cca Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 01:59:51 +0000 Subject: [PATCH 5/5] chore(changeset): record page refused reaction column Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_016WV4cy1y7UNVbT2QAdmgdn --- .../33521-record-page-refused-reaction-column.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .changeset/33521-record-page-refused-reaction-column.md diff --git a/.changeset/33521-record-page-refused-reaction-column.md b/.changeset/33521-record-page-refused-reaction-column.md new file mode 100644 index 00000000000..5da4d26589f --- /dev/null +++ b/.changeset/33521-record-page-refused-reaction-column.md @@ -0,0 +1,15 @@ +--- +'@object-ui/app-shell': patch +--- + +fix(app-shell): a record page offers the reactions column write only where `sys_comment` still declares the column + +Clause-②: no +Metadata-protocol: none + +A caller refused `sys_comment_reaction` (a permission set with no read on it, or an external user) was offered the reaction control on a record page's discussion, and every click answered `400 INVALID_FIELD`: the page fell back to writing the retired `sys_comment.reactions` column with `PATCH /api/v1/data/sys_comment/ID`, which the server refuses because the column left `sys_comment` in the release that added `sys_comment_reaction`. + +The page took that fallback whenever it could not read `sys_comment_reaction`, and a refusal reads the same as an object the deployment does not have: the metadata door answers both as absent. It now tells them apart by `sys_comment`'s own definition, which the caller can read. Where `sys_comment` still declares `reactions` (a framework that predates `sys_comment_reaction`), the column path is used exactly as before. Anywhere else the caller is refused the reaction object: the page offers no reaction control, reads no reactions and sends no reaction request. + +- A caller who holds read on `sys_comment_reaction` is unchanged: reactions are that object's records. +- `useObjectPresence` also returns the object's served `definition` when the object is present, so a reader can choose by what the object declares without a second registry read.