Skip to content

Commit 9b3449b

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/project-thread-80b6qg
2 parents c67b39c + 3eeb81d commit 9b3449b

59 files changed

Lines changed: 2040 additions & 256 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
'@object-ui/collaboration': patch
3+
'@object-ui/types': patch
4+
---
5+
6+
refactor(collaboration, types)!: retire the zero-consumer `useMentionNotifications` hook and the `MentionNotification` interface
7+
8+
Clause-②: no (narrowing)
9+
Metadata-protocol: none
10+
11+
<!-- adr-0087: not-required (runtime-export-retired @object-ui/collaboration#useMentionNotifications, @object-ui/collaboration#MentionNotificationsConfig, @object-ui/collaboration#MentionNotificationsResult, @object-ui/types#MentionNotification) the retired operands are a React hook that kept an in-memory list of mention notifications, its two TypeScript config and result interfaces, and the `MentionNotification` interface of `@object-ui/types` that only the hook read; nothing in the workspace or in hotcrm imports any of them (the console bell reads the server inbox through `useInboxBell`), and no packages/spec schema, registered node type, conversion surface or stored shape names them, so there is nothing for `objectstack migrate meta` to rewrite -->
12+
13+
**BREAKING** for a host that imports `useMentionNotifications`, `MentionNotificationsConfig` or `MentionNotificationsResult` from `@object-ui/collaboration`, or the type `MentionNotification` from `@object-ui/types`. The hook held a client-side list of mention notifications with read flags; no console surface used it, because mention notifications are server records (`sys_notification`, topic `collab.mention`) that the console bell reads from the inbox feed. `CommentEntry` and `ActivityEntry` stay exported unchanged. The `CommentSearchResult` entry of this release said `MentionNotification` stays exported; it leaves here.
14+
15+
- FROM `useMentionNotifications` TO a local hook in your own code, or read the server inbox (`GET /api/v1/notifications`) as the console bell does.
16+
- FROM `MentionNotificationsConfig` TO a local interface in your own code: `{ currentUserId: string; initialNotifications?: MentionNotification[]; onDeliver?: (notification: MentionNotification) => void | Promise<void> }`.
17+
- FROM `MentionNotificationsResult` TO a local interface in your own code, typed by what your own hook returns.
18+
- FROM `MentionNotification` TO a local interface in your own code: `{ id: string; type: 'mention'; recipientId: string; commentId: string | number; mentionedBy: string; commentText: string; objectName?: string; recordId?: string; createdAt: string; read?: boolean; channels?: Array<'in_app' | 'email' | 'push'> }`.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/metadata-protocol': patch
3+
---
4+
5+
refactor(metadata-protocol): `getMetaTypes()` declares a named return type, held equal to the type it returned before
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
No behaviour change and no type change. `ObjectStackProtocolImplementation.getMetaTypes()` now declares `Promise<MetaTypesListing>`, composed from `@objectstack/spec`'s `MetadataTypeRegistryEntryParsed`, `Action` and `FormView`, in place of an inferred type that the published `index.d.ts` printed inline over 793 lines. A compile-time equality check in the method holds the name equal to what the body builds, so the two cannot drift. The `.d.ts` text is shorter; the type a consumer reads is the same one, checked equal against the declaration file `main` built before this change. `MetaTypesListing` is not exported from the package. Nothing to migrate.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@objectstack/objectql': patch
3+
'@objectstack/runtime': patch
4+
---
5+
6+
fix(objectql, runtime): a converted stale-roll-up refusal that a sandboxed hook body lets leave keeps its lead and its `cause`, and one that escapes a transaction whose rollback threw no longer claims a rollback
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
- A sandboxed hook body whose `ctx.api` write was refused because a nested write's roll-up could not be recomputed (a delete whose cascade stopped, a transaction that rolled back) used to hand that refusal out of the QuickJS runner as a `SandboxError`. The hook-dispatch seam did not recognise it, so the outer write's caller read the hook's own write ("The delete of …") and the original `ERR_SUMMARY_RECOMPUTE` refusal was gone from `cause`. The runner now hands the engine's own refusal back out when the body let it leave unchanged, as it already did for the duplicate-record refusal, so the seam leads with the write the hook is bound to (every hook event, the read events included) and `cause` keeps the original refusal. A body that catches it and throws its own error, or rewrites it first, is relayed as before.
12+
- `ObjectQL.transaction` whose rollback threw now hedges an already-converted refusal too: it leads with "The transaction did not complete, and its rollback failed too", instead of keeping the cascade's or hook's "under a transaction that rolls back nothing was written".
13+
- Status and code are unchanged at every door: `500 INTERNAL_ERROR`.
14+
- `@objectstack/objectql` exports `isUnlandedWriteRefusal(e)`, the predicate the runner asks of a host call's rejection.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/spec': patch
3+
---
4+
5+
fix(spec): `os migrate meta --stored` lists a stored dashboard whose global filter is keyed `dateRange` beside a declared `dateRange`
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
- **Before.** `DashboardSchema` refuses a dashboard that declares the built-in `dateRange` and also keys a `globalFilters` entry `dateRange` (its `name`, or its `field` when it has no `name`), and the dashboard save door answers 422 `INVALID_METADATA`. A dashboard already stored in that shape still loads with `_diagnostics` reading `valid: false`, but the v18 stored-row preview had no detector for it, so `os migrate meta --stored` named no such row before the upgrade.
11+
- **Now.** The preview lists each such stored dashboard under the TODO id `ui-dashboard-global-filter-reserved-date-range-refused` (the refusal's upgrade guide entry), at the entry's `name` (or `field`), the site the parse refuses, with the refusal's own message. The detector calls the refinement's own predicate, so a row is listed exactly when the parse refuses it. Nothing rewrites it: whether the entry was meant to be the date range or a filter of its own, only the author knows. The upgrade guide entries of this refusal and of the duplicate-key refusal now say that `os migrate meta --stored` lists such a row.
12+
- **Not changed.** What any door accepts or refuses. On a dashboard that does not declare `dateRange`, an entry keyed `dateRange` is not listed; nor is a named entry whose `field` is `dateRange`.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@objectstack/lint': patch
3+
---
4+
5+
feat(lint): warn when a permission set's own View All or Modify All makes its field mask inert
6+
7+
Clause-②: yes (widening)
8+
Metadata-protocol: none
9+
10+
A permission set holding View All (`viewAllRecords`) or Modify All (`modifyAllRecords`) on an object votes on every field of it in the field-permission merge (ADR-0066 D2 as amended). So that set's own `readable: false` on the object hides the field from none of its holders, and under Modify All its edit lock (`editable: false`, or `editable` omitted) holds none of them back either. The new warning `security-superuser-field-mask-inert` names the entry, the bit that unbinds it and the fix: remove the bit and reach the rows with `readScope` / `writeScope` or a row-level policy, or delete the entry if the bypass is meant. View All beside an edit lock is not reported, because View All never widens a write.
11+
12+
The warning never refuses anything. It runs wherever `validateSecurityPosture` runs: `os lint`, `os validate`, `os build` and the runtime publish gate for a permission set, where it is reported as an advisory.
13+
14+
The rule reads the bypass the way the runtime does, through `holdsSuperuserBypass`, now exported from `@objectstack/lint`: a verbatim copy of the function of that name in `@objectstack/core` (the set's own entry for the object, else its `'*'` entry, as a lookup and never a merge).
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
---
4+
5+
feat(studio): a Chinese display name derives its identifier by pinyin at every Studio create door
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
A Chinese-speaking administrator names things in Chinese, and every Studio create door used to keep only Latin letters, so `维修中心` derived no identifier and the door waited for a hand-typed English one. Now each door that derives a machine name from a display name turns each Chinese word into its toneless pinyin first, then applies the rule it always applied: `维修中心` gives `weixiu_zhongxin` (a package id `com.<org>.weixiu-zhongxin` with the namespace `weixiu_zhongxin`), `客户等级` gives `kehu_dengji`. The derived identifier is shown and stays editable; the namespace prefix, the `__c` suffix of a customization pair and the taken-name refusal are unchanged.
11+
12+
- **Doors.** New package, the new-item dialog (objects and the other Studio items), Add field (the name the popover previews is the name the field is created under), the generic create form, New view, the object, report and dataset designers' Name, a fresh field's API name in the field inspector, and a picklist option's value (a Chinese option label used to derive an empty value, and the option was silently never saved).
13+
- **Words, not syllables.** Word boundaries come from the browser's `Intl.Segmenter`, and a polyphone reads by its word (`银行` → `yinhang`, `行动` → `xingdong`). Without `Intl.Segmenter`, each character's reading is joined by `_` (`ke_hu_deng_ji`).
14+
- **Bundle.** The dictionary (`pinyin-pro`, the library the server's pinyin search already uses) is a lazy chunk, fetched the first time a door sees a Chinese character; until it lands the door keeps Create off without a "not derived" line, and if it cannot be fetched the door falls back to that line and a hand-typed identifier, as before.
15+
- **Japanese.** Text with kana is left alone, so a Japanese name still asks for the identifier.
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
/**
4+
* The author-time copy of the super-user bypass answers exactly as the
5+
* runtime's own reading does, over one case matrix.
6+
*
7+
* `holdsSuperuserBypass` (`@objectstack/core`, `security/effective-object-permissions.ts`)
8+
* is the ONE reading of "does this set hold View All / Modify All on this
9+
* object": the row bypass and both field merges ask it (ADR-0066 D2, ruling
10+
* of record 6573563853 letter A). `@objectstack/lint` depends on
11+
* `@objectstack/spec` alone, so its `security-superuser-field-mask-inert`
12+
* rule reads the bypass through a verbatim COPY exported under the same name.
13+
* A copy is a second reading the day the two drift, and a drifted lint either
14+
* warns about a mask the runtime enforces or stays silent about one it
15+
* ignores. This package depends on both, so the parity is pinned here: a
16+
* change to either function reds this file until the other follows.
17+
*
18+
* The matrix is the cartesian product of what the lookup reads: the set's own
19+
* entry for the object and its `'*'` entry, each absent, `null`, empty, or
20+
* carrying View All, Modify All, both, or a non-boolean truthy / falsy bit
21+
* (the reading is `Boolean(...)`, not `=== true`); the object asked about; and
22+
* the bit. Plus the sets with no usable `objects` at all.
23+
*/
24+
25+
import { describe, expect, it } from 'vitest';
26+
import { holdsSuperuserBypass as runtimeReading } from '@objectstack/core';
27+
import { holdsSuperuserBypass as authoringCopy } from '@objectstack/lint';
28+
29+
const ENTRIES: ReadonlyArray<[string, unknown]> = [
30+
['absent', undefined],
31+
['null', null],
32+
['empty', {}],
33+
['view', { allowRead: true, viewAllRecords: true }],
34+
['modify', { allowRead: true, allowEdit: true, modifyAllRecords: true }],
35+
['both', { viewAllRecords: true, modifyAllRecords: true }],
36+
['neither, spelled false', { viewAllRecords: false, modifyAllRecords: false }],
37+
['view, truthy non-boolean', { viewAllRecords: 1 }],
38+
['modify, truthy non-boolean', { modifyAllRecords: 'yes' }],
39+
['modify, falsy non-boolean', { modifyAllRecords: 0 }],
40+
];
41+
const OBJECTS = ['deal', '*'] as const;
42+
const BITS = ['view', 'modify'] as const;
43+
44+
type Case = { label: string; set: unknown; objectName: string; bit: 'view' | 'modify' };
45+
46+
function matrix(): Case[] {
47+
const cases: Case[] = [];
48+
for (const [ownLabel, own] of ENTRIES) {
49+
for (const [wildLabel, wild] of ENTRIES) {
50+
const objects: Record<string, unknown> = {};
51+
if (own !== undefined) objects.deal = own;
52+
if (wild !== undefined) objects['*'] = wild;
53+
for (const objectName of OBJECTS) {
54+
for (const bit of BITS) {
55+
cases.push({ label: `deal: ${ownLabel} · '*': ${wildLabel} · ask ${objectName} for ${bit}`, set: { objects }, objectName, bit });
56+
}
57+
}
58+
}
59+
}
60+
for (const set of [null, undefined, {}, { objects: null }, { objects: 'deal' }]) {
61+
for (const bit of BITS) cases.push({ label: `set ${JSON.stringify(set) ?? 'undefined'} · ${bit}`, set, objectName: 'deal', bit });
62+
}
63+
return cases;
64+
}
65+
66+
const CASES = matrix();
67+
type Reading = (set: never, objectName: string, bit: 'view' | 'modify') => boolean;
68+
const ask = (fn: Reading, c: Case) => fn(c.set as never, c.objectName, c.bit);
69+
70+
describe('holdsSuperuserBypass — the lint copy and the runtime reading agree', () => {
71+
it('the matrix is the product it claims, and it exercises both answers', () => {
72+
// 10 own entries x 10 wildcard entries x 2 objects x 2 bits, plus 5 sets x 2 bits.
73+
expect(CASES).toHaveLength(410);
74+
const answers = CASES.map((c) => ask(runtimeReading as Reading, c));
75+
expect(answers.filter(Boolean).length).toBeGreaterThan(0);
76+
expect(answers.filter((a) => !a).length).toBeGreaterThan(0);
77+
});
78+
79+
it('answers every case of the matrix alike', () => {
80+
const diverging = CASES.filter((c) => ask(authoringCopy as Reading, c) !== ask(runtimeReading as Reading, c)).map(
81+
(c) => `${c.label}: runtime ${ask(runtimeReading as Reading, c)}, lint ${ask(authoringCopy as Reading, c)}`,
82+
);
83+
expect(diverging).toEqual([]);
84+
});
85+
86+
it('a few readings the rule depends on, spelled out', () => {
87+
for (const fn of [runtimeReading, authoringCopy] as Reading[]) {
88+
const read = (set: unknown, bit: 'view' | 'modify') => fn(set as never, 'deal', bit);
89+
// Modify All implies View All; View All never implies Modify All.
90+
expect(read({ objects: { deal: { modifyAllRecords: true } } }, 'view')).toBe(true);
91+
expect(read({ objects: { deal: { viewAllRecords: true } } }, 'modify')).toBe(false);
92+
// The wildcard answers for an object the set does not name ...
93+
expect(read({ objects: { '*': { modifyAllRecords: true } } }, 'modify')).toBe(true);
94+
// ... and an entry that names the object answers alone: a lookup, never a merge.
95+
expect(read({ objects: { '*': { modifyAllRecords: true }, deal: { allowRead: true } } }, 'modify')).toBe(false);
96+
}
97+
});
98+
});

‎packages/lint/src/index.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,8 @@ export {
361361
SECURITY_CBP_NO_RELATION,
362362
SECURITY_CBP_AMBIGUOUS_RELATION,
363363
SECURITY_CBP_OWNER_POLICY_WITHOUT_OPT_IN,
364+
SECURITY_SUPERUSER_FIELD_MASK_INERT,
365+
holdsSuperuserBypass,
364366
} from './validate-security-posture.js';
365367
export type { SecurityFinding, SecuritySeverity } from './validate-security-posture.js';
366368

‎packages/lint/src/rule-explanations.ts‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,30 @@ const SECURITY_MODIFY_ALL_DELETE_WITHHELD_EXPLANATION: RuleExplanation = {
889889
],
890890
};
891891

892+
const SECURITY_SUPERUSER_FIELD_MASK_INERT_EXPLANATION: RuleExplanation = {
893+
rule: 'security-superuser-field-mask-inert',
894+
covers: 'why a field mask beside View All or Modify All hides nothing',
895+
paragraphs: [
896+
'`viewAllRecords` (View All) and `modifyAllRecords` (Modify All) are the super-user bypass on an object. ' +
897+
'A set that holds one votes on every field of that object when the field permissions are merged: View ' +
898+
'All votes `readable: true`, Modify All votes `readable: true` and `editable: true` (ADR-0066 D2 as ' +
899+
'amended). The merge is a union, so a `readable: false` the same set declares on that object hides the ' +
900+
'field from none of the set\'s holders, and under Modify All its edit lock (`editable: false`, or ' +
901+
'`editable` omitted, which parses to false) holds none of them back either. The stored set still reads ' +
902+
'as masked, which is why an author or a reviewer takes the field to be protected.',
903+
'The set\'s bypass is read the way the runtime reads it: its own entry for the object when it has one, ' +
904+
'otherwise its `\'*\'` entry, as a lookup and never a merge. View All beside an edit lock is not ' +
905+
'reported, because View All never widens a write, so that lock still binds. Only the set that declares ' +
906+
'the entry is judged: a holder of two sets is unmasked by the other set\'s bypass too, but no author ' +
907+
'wrote an inert entry there.',
908+
'This is a warning, not an error: the pair is legal and no door refuses it. To fix it, decide which half ' +
909+
'is meant. If the field must stay hidden or read-only, remove the bypass bit from the object entry and ' +
910+
'reach every row another way, with `readScope: \'org\'` / `writeScope: \'org\'` on the entry or a ' +
911+
'`rowLevelSecurity` policy whose condition every row satisfies; the mask then binds. If the bypass is ' +
912+
'meant, delete the field entry, which never took effect.',
913+
],
914+
};
915+
892916
const SECURITY_OWD_ALIAS_EXPLANATION: RuleExplanation = {
893917
rule: 'security-owd-alias',
894918
covers: 'which sharing values are retired or misplaced',
@@ -5563,6 +5587,7 @@ export const RULE_EXPLANATIONS: Readonly<Record<string, RuleExplanation>> = Obje
55635587
[SECURITY_MASTER_DETAIL_UNGRANTED_EXPLANATION.rule]: SECURITY_MASTER_DETAIL_UNGRANTED_EXPLANATION,
55645588
[SECURITY_WILDCARD_VAMA_EXPLANATION.rule]: SECURITY_WILDCARD_VAMA_EXPLANATION,
55655589
[SECURITY_MODIFY_ALL_DELETE_WITHHELD_EXPLANATION.rule]: SECURITY_MODIFY_ALL_DELETE_WITHHELD_EXPLANATION,
5590+
[SECURITY_SUPERUSER_FIELD_MASK_INERT_EXPLANATION.rule]: SECURITY_SUPERUSER_FIELD_MASK_INERT_EXPLANATION,
55665591
[SECURITY_OWD_ALIAS_EXPLANATION.rule]: SECURITY_OWD_ALIAS_EXPLANATION,
55675592
[SECURITY_DELEGATION_MISSING_REASON_EXPLANATION.rule]: SECURITY_DELEGATION_MISSING_REASON_EXPLANATION,
55685593
[VISIBILITY_ROOT_MISLAYERED_EXPLANATION.rule]: VISIBILITY_ROOT_MISLAYERED_EXPLANATION,

0 commit comments

Comments
 (0)