Skip to content

Commit ecf913e

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/project-thread-gvqm55
2 parents 340e070 + f72bc9e commit ecf913e

11 files changed

Lines changed: 738 additions & 40 deletions

‎.changeset/29153-field-help-on-inline-help-text.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ Metadata-protocol: none
1010
Nothing changes in what a metadata author can write. What changes is the served, translated read of an object: `translateObject` (the resolver behind `GET /api/v1/meta/object/:name` and every other localized object read) now serves a field's `objects.OBJECT.fields.FIELD.help` translation on the field's own `inlineHelpText` when the field authors one.
1111

1212
- **Before.** The translation was served on `description` only. The i18n extractor scaffolds that entry from `help ?? inlineHelpText ?? description`, and the console draws a field's help line from `inlineHelpText || description`, so a field that authored `inlineHelpText` showed its source-language text in every locale and its translation never appeared.
13-
- **Now.** A field that authors a non-empty `inlineHelpText` is served the translation there, and on `description` as before. A field without one (absent, or an empty string, which the console reads as absent) gains no `inlineHelpText` key; its translation stays on `description`, which the console already draws.
13+
- **Now.** A field that authors a non-empty `inlineHelpText` is served the translation there, the text the entry was scaffolded from, and keeps its source-language `description`. A field without one (absent, or an empty string, which the console reads as absent) gains no `inlineHelpText` key; its translation stays on `description`, which the console already draws.
1414
- **Unchanged.** A locale with no `help` entry for the field, and the source locale, serve the authored text. Each slot keeps a value that diverged from the packaged declaration (a tenant's own edit), judged per slot by the same rule that already guards `description`. Nothing is ever served on a `help` key.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
'@objectstack/core': patch
3+
---
4+
5+
fix(core)!: an ordinary member of an organization with more than 1,000 members sees every fellow member in `sys_user` again, and an organization too large for the database's bound-parameter limit is refused loudly instead of served a short list
6+
7+
Clause-②: no (narrowing)
8+
Metadata-protocol: none
9+
10+
The claim declared `no` for an interim that reads the membership to completion; the seat's ruling (6577690137 on #29281) reads the refusal past the bound-parameter limit as a narrowing.
11+
12+
<!-- adr-0087: not-required (no-migration-prescription) No key of any schema is added, removed, renamed or re-shaped, and no export, type or metadata changes: the authorization resolver reads a list it already read, to completion. No author has anything to rewrite; the one new refusal is the database's own, for an organization whose membership exceeds what one statement can bind. -->
13+
14+
**BREAKING** for organizations past the database's bound-parameter limit only: their members' `sys_user` reads, which used to answer a silently short list, now fail.
15+
16+
`sys_user`'s organization-members row scope (`id in current_user.org_user_ids`, the object's default row scope and `member_default`'s `sys_user_org_members`) reads the fellow-org peer list the request's authorization resolver builds. That list was built from one `sys_member` read bounded at 1,000 rows, so in an organization with more members everyone past the 1,000th `sys_member.id` was missing from it with no signal: a people picker or lookup searching for them found nothing, and reading them by id answered `404`. Which members vanished was arbitrary, because member ids are random.
17+
18+
- **Every member, nobody else.** When that first read comes back at its bound, the resolver now reads the active organization's membership to completion, in pages of 10,000 ordered by id, and the list holds every member plus the caller. Members of other organizations stay out.
19+
- **Smaller organizations are unchanged.** An organization under 1,000 members issues exactly the one read it always did; nothing else is read and nothing is logged. An organization of exactly 1,000 gets the same list after one more read, and nothing is logged.
20+
- **Said once.** The first time an organization's membership outgrows the first read, the server logs one `warn` naming the organization and its member count. Every request in that organization now reads its whole membership, and each `sys_user` read in it binds one parameter per member.
21+
- **Who sees the narrowing.** An organization whose membership passes the backend's bound-parameter limit: on SQLite, 32,000 members were served and 40,000 refused (`too many SQL variables`, `500`); Postgres's wire protocol caps a statement at 65,535 parameters. Its members' `sys_user` reads now fail where they used to answer a list missing everyone past the 1,000th member. The `warn` line names the organization and its count so an operator can connect the two.
22+
- **Loud, never short.** A membership page that fails to read, or a driver that does not honour the id cursor, fails the request with the existing `503` authorization-store error instead of answering a shorter list.
23+
24+
**The remedy.** None is needed below the limit. Past it there is no workaround in this release: the relational membership predicate (#29360) removes the per-member parameters altogether.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@objectstack/spec': patch
3+
---
4+
5+
fix(spec): a field that authors both `inlineHelpText` and a different `description` keeps its source-language `description`
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
Nothing changes in what a metadata author can write. What changes is the served, translated read of an object: `translateObject` serves a field's `objects.OBJECT.fields.FIELD.help` translation on ONE slot, the one the i18n extractor scaffolded the entry from.
11+
12+
- **Before.** The translation was served on `description`. The extractor scaffolds the entry from `help ?? inlineHelpText ?? description`, so on a field that authors both a non-empty `inlineHelpText` and a different `description`, the entry translates the `inlineHelpText`, and every reader of `description` (Studio, the designer) showed that other sentence's translation.
13+
- **Now.** A field that authors a non-empty `inlineHelpText` is served the translation there and keeps its source-language `description` (and gains none when it has none). `description` takes the translation only when neither the served field nor its packaged declaration authors a non-empty `inlineHelpText`. An empty `inlineHelpText` reads as absent, as it does in the extractor and the console.
14+
- **Unchanged.** A field that authors only `description` is served its translation there. Each slot keeps a value that diverged from the packaged declaration (a tenant's own edit). Nothing is ever served on a `help` key.

‎packages/core/src/security/__tests__/resolve-authz-context.batch-equivalence.testkit.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,10 @@ export const FIXTURES: Fixture[] = [
359359
// limit, 1005 peers against the 1000 limit. Truncation is OBSERVABLE here
360360
// (the double slices like a driver), so a batch that changed either limit —
361361
// or merged the two reads under one of them — moves these arrays.
362+
// [#29281] …except the peers': a fellow-org read that comes back AT its
363+
// bound is now a first page, and the membership is read to completion, so
364+
// `org_user_ids` holds all 1,006 members; the 1000 bound is still pinned
365+
// by the recorded `queries`, and the 200 one by `accessible_org_ids`.
362366
name: 'read-limits-truncate',
363367
userId: 'u_lim',
364368
opts: { tenantId: 'org_0000', seedEmail: 'lim@x.com', nowMs: T0 },

‎packages/core/src/security/resolve-authz-context.batch-equivalence.golden.json‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1767,7 +1767,13 @@
17671767
"peer_0995",
17681768
"peer_0996",
17691769
"peer_0997",
1770-
"peer_0998"
1770+
"peer_0998",
1771+
"peer_0999",
1772+
"peer_1000",
1773+
"peer_1001",
1774+
"peer_1002",
1775+
"peer_1003",
1776+
"peer_1004"
17711777
],
17721778
"accessible_org_ids": [
17731779
"org_0000",
@@ -1999,6 +2005,14 @@
19992005
"limit": 1000,
20002006
"isSystem": true
20012007
},
2008+
{
2009+
"object": "sys_member",
2010+
"where": {
2011+
"organization_id": "org_0000"
2012+
},
2013+
"limit": 10000,
2014+
"isSystem": true
2015+
},
20022016
{
20032017
"object": "sys_user_permission_set",
20042018
"where": {

‎packages/core/src/security/resolve-authz-context.batch-equivalence.test.ts‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,18 @@
8787
* it joins the activation-ledger read's wave, so the fixture still resolves in
8888
* two legs. That read is in the golden because the code genuinely issues it —
8989
* the organization-less row this fixture used to hold asked none.
90+
*
91+
* ⚠️ A fifth recorded move ([#29281], the visible set it corrects is the
92+
* defect the card reports): the fellow-org `sys_member` read that comes back
93+
* AT its 1,000-row bound is a first page, no longer the membership, and the
94+
* resolver reads the active organization's membership to completion. One
95+
* fixture's golden moved, `read-limits-truncate`, whose 1,006 rows for
96+
* `org_0000` came back at the bound: `grants.org_user_ids` gains the six
97+
* members the bound cut (`peer_0999` … `peer_1004`), `queries` gains the
98+
* completion read (`sys_member {organization_id}`, limit 10,000), and the
99+
* fixture resolves in three legs, the completion read being its own. The
100+
* first read itself, its bound and every other recorded read are unchanged,
101+
* and so is every other fixture: none comes back at the bound.
90102
*/
91103

92104
import { readFileSync } from 'node:fs';
@@ -143,7 +155,9 @@ const BATCHED_LEGS: Record<string, number> = {
143155
'ai-seat-and-email-from-sys-user': 2,
144156
'ai-seat-denied': 2,
145157
'seeded-permissions-and-email': 2,
146-
'read-limits-truncate': 2,
158+
// [#29281] Three: the fellow-org read came back at its bound, so the
159+
// membership is read to completion after wave 1, in a leg of its own.
160+
'read-limits-truncate': 3,
147161
'no-active-org': 2,
148162
};
149163

@@ -283,6 +297,9 @@ describe('[#10825] batched resolveUserAuthzGrants — equivalence with the seque
283297
// Wave 2: the activation ledger and the Default Organization read,
284298
// which are issued together after wave 1 (#10757 leg 4).
285299
.filter((c) => c.object !== 'sys_metadata_activation' && c.object !== 'sys_organization')
300+
// [#29281] …and the membership completion read (limit 10,000), which
301+
// exists only because wave 1's fellow-org read came back at its bound.
302+
.filter((c) => !(c.object === 'sys_member' && c.limit === 10000))
286303
.map((c) => c.object)
287304
.sort(),
288305
);

0 commit comments

Comments
 (0)