Skip to content

Commit de1ff20

Browse files
committed
Merge origin/main into claude/issue-33845-reading-four
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ADHkmSXPDB46NVRepWVrL3
2 parents cda8df9 + f6f5b50 commit de1ff20

165 files changed

Lines changed: 1270 additions & 39 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: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
'@objectstack/spec': minor
3+
'@objectstack/plugin-sharing': patch
4+
'@objectstack/plugin-hono-server': patch
5+
'@objectstack/client': patch
6+
'@object-ui/permissions': patch
7+
'@object-ui/plugin-list': patch
8+
---
9+
10+
feat: the list toolbar offers the "In a queue" toggle only on objects that actually use queues
11+
12+
Clause-②: yes (widening)
13+
Metadata-protocol: added
14+
15+
Until now the toggle appeared on every list of an object with a user owner as soon as the organization had a single queue, although on most of those objects no record ever sits in a queue, so it could only return an empty list. It now appears only on an object where a queue can hold something:
16+
17+
- a record of the object sits in a queue now (no owner, a queue set), or
18+
- an active assignment rule routes the object's new records into a queue: one of the organization's own rules, or a rule an installed package declares that is not switched off.
19+
20+
Nothing is authored for this. The server works it out from the rules and the records.
21+
22+
`GET /auth/me/permissions` carries the answer as a new field beside `hasAnyQueue`: `objectsUsingQueues`, a list of object names, declared in `MePermissionsAuthenticatedResponseSchema`. It names only objects the caller may read, and never a queue name or a count. It is empty when the organization has no queue, when no ownership-queue service is registered, and on the closed body. The ownership-queue service contract gains the optional method `objectsUsingQueues(organizationId)`, implemented by `@objectstack/plugin-sharing`. The method checks each owned object for one sitting record (`limit 1`) and reads the routing rules once. The route asks only when `hasAnyQueue` is true, so an organization with no queue pays nothing extra.
23+
24+
**Migration.** `objectsUsingQueues` is required on the strict `MePermissionsAuthenticatedResponseSchema`. Code that builds a `MePermissionsAuthenticatedResponse` (a test fixture, a stub server) adds `objectsUsingQueues: []` beside `hasAnyQueue`. Code that parses a body from a server older than this release with the schema gets a parse failure for the missing key: parse with `.partial({ objectsUsingQueues: true })` or default it to `[]` until the server is upgraded. The console does not parse; it reads the field and treats its absence as "no object".
25+
26+
The console reads the field from the payload it already loads once per session. A record that starts sitting in a queue on an object not listed yet shows the toggle from the next time the permissions are read. An answer without the field is treated as "no", the same way an unknown `hasAnyQueue` is.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@objectstack/lint': patch
3+
---
4+
5+
fix(lint): the line-items and association inline-edit advisories read every inline-edit mode, not only `inlineEdit: true`
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`inlineEdit` on a relationship field accepts `true`, `'grid'` and `'form'`, and the platform edits the child inline in all three. Two `os lint` advisories read only `true`:
11+
12+
- `relationship/line-items-inline-edit` told a `*_line` / `*_item` child whose `master_detail` already declares `inlineEdit: 'grid'` or `'form'` to "consider inlineEdit: true", offering a fix that would replace the mode the author chose. It is now silent for any of the three values and suggests inline editing only when `inlineEdit` is absent or `false`.
13+
- `relationship/association-inline-edit` warned an association child (comments, audit, activity) only for `inlineEdit: true`. It now warns for `'grid'` and `'form'` too, which clutter the parent's entry form the same way.
14+
15+
Rule ids, severities and messages are unchanged. Nothing is refused; both rules stay advisories.

‎content/docs/automation/queues-and-assignment-rules.mdx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ The moment someone claims it, the queue path stops applying: the other members l
119119

120120
In the Console, a list of an object that carries the `queue` column has an **In a queue** toggle in its toolbar when your organization has at least one queue and the view's own filter does not require `owner_id` to hold a value (a top-level `equals`, `in` or `is_not_empty` condition on it, such as a "my records" view; one inside an OR group does not count), since a parked record has no owner. It narrows the list to parked records (`owner_id` empty and `queue` set); which of them you see is still the server's read filter, so a member sees what sits in their own queues.
121121

122+
The toggle appears only where it can find something: on an object where a record of your organization sits in a queue now, or where an active assignment rule (the organization's own or a package's) routes new records into a queue. Nothing is declared for this; the server works it out and the Console reads it once per session from `GET /api/v1/auth/me/permissions` (`objectsUsingQueues`, which names only objects you may read). So the toggle on an object whose first record was just parked by hand appears from the next time the Console loads your permissions, for example after signing in again or reloading the page.
123+
122124
## How a claim is spelled
123125

124126
A **claim** is an ordinary update of `owner_id` to your own user id, by record id:

‎content/docs/references/api/auth.mdx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ const result = AuthProvider.parse(data);
9797
| **systemPermissions** | `string[]` | optional | The effective system capabilities (ADR-0066). Absent only on the degraded body, where it means unknown; an empty array means none. |
9898
| **tabPermissions** | `Record<string, Enum<'visible' \| 'hidden' \| 'default_on' \| 'default_off'>>` | optional | The effective app tab visibilities, keyed by app name. Absent only on the degraded body. |
9999
| **hasAnyQueue** | `boolean` | ✅ | Whether the caller's organization has at least one ownership queue: a declared queue the activation ledger has not switched off, or a `sys_queue` row of the organization. Resolved server-side through the ownership-queue service, so a member who may not read `sys_queue` still gets the answer; no names and no counts are disclosed. False when no ownership-queue service is registered, and on the closed body. |
100+
| **objectsUsingQueues** | `string[]` | ✅ | The objects, by name, on which a queue filter can find something in the caller's organization: a record of the object sits in an ownership queue now (no owner, a queue set), or an active assignment rule of the organization or of an installed package routes the object's new records into a queue. Resolved server-side through the ownership-queue service and listed only for objects the caller may read, except on the degraded body, where no object permissions resolved and the list is not narrowed; no queue names and no counts are disclosed. Empty when `hasAnyQueue` is false, for a person outside every organization, for a caller with no active organization on a deployment that walls organizations apart (`isolated` or `group`; under `single` that caller is answered environment-wide), when the ownership-queue service is not registered or cannot answer, and on the closed body. Read once per session, so a record that starts sitting in a queue later shows here from the next read on. |
100101

101102
### Nested Shape: `MePermissionsAuthenticatedResponse.objects[string]`
102103

@@ -160,6 +161,7 @@ This schema accepts one of the following structures:
160161
| **systemPermissions** | `string[]` | optional | The effective system capabilities (ADR-0066). Absent only on the degraded body, where it means unknown; an empty array means none. |
161162
| **tabPermissions** | `Record<string, Enum<'visible' \| 'hidden' \| 'default_on' \| 'default_off'>>` | optional | The effective app tab visibilities, keyed by app name. Absent only on the degraded body. |
162163
| **hasAnyQueue** | `boolean` | ✅ | Whether the caller's organization has at least one ownership queue: a declared queue the activation ledger has not switched off, or a `sys_queue` row of the organization. Resolved server-side through the ownership-queue service, so a member who may not read `sys_queue` still gets the answer; no names and no counts are disclosed. False when no ownership-queue service is registered, and on the closed body. |
164+
| **objectsUsingQueues** | `string[]` | ✅ | The objects, by name, on which a queue filter can find something in the caller's organization: a record of the object sits in an ownership queue now (no owner, a queue set), or an active assignment rule of the organization or of an installed package routes the object's new records into a queue. Resolved server-side through the ownership-queue service and listed only for objects the caller may read, except on the degraded body, where no object permissions resolved and the list is not narrowed; no queue names and no counts are disclosed. Empty when `hasAnyQueue` is false, for a person outside every organization, for a caller with no active organization on a deployment that walls organizations apart (`isolated` or `group`; under `single` that caller is answered environment-wide), when the ownership-queue service is not registered or cannot answer, and on the closed body. Read once per session, so a record that starts sitting in a queue later shows here from the next read on. |
163165

164166
### Nested Shape: `MePermissionsResponse[authenticated=true].objects[string]`
165167

‎packages/client/src/auth-me-permissions.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ describe('[#28709] client.auth.mePermissions over the real /auth/me/permissions
110110
expect(answer.userId).toBe(USER);
111111
expect(answer.tenantId).toBe(ACTIVE_ORG);
112112
expect(answer.hasAnyQueue).toBe(true);
113+
// [#34602] Typed on the client too; this service names no object.
114+
expect(answer.objectsUsingQueues).toEqual([]);
113115
expect(answer.permissionSets).toContain('member_default');
114116
});
115117

‎packages/client/src/index.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5400,7 +5400,8 @@ export class ObjectStackClient {
54005400
* Discriminate on `authenticated`: an anonymous caller RESOLVES
54015401
* `{ authenticated: false }` (the route answers it at 200, so a client can
54025402
* tell "signed out" from a fault), unlike {@link me}, which rejects. The
5403-
* authenticated answer carries `hasAnyQueue` among the rest;
5403+
* authenticated answer carries `hasAnyQueue` and `objectsUsingQueues`
5404+
* among the rest;
54045405
* `systemPermissions` / `tabPermissions` are absent only on a server
54055406
* without SecurityPlugin, where absent means unknown and an empty array
54065407
* means none.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
/**
4+
* R5 `relationship/line-items-inline-edit` and R6
5+
* `relationship/association-inline-edit` ask one question of a relationship:
6+
* is it edited inline within the parent's form at all?
7+
*
8+
* `FieldSchema.inlineEdit` accepts `true`, `'grid'` and `'form'`, and every
9+
* reader treats all three as inline-edited (the console's inline subforms, the
10+
* spec's body-table predicate, the sibling `relationship/inline-edit-needs-bulk`
11+
* rule). So R5 stays silent on any of the three — telling an author who chose
12+
* `'grid'` to "consider inlineEdit: true" would replace the mode they picked —
13+
* and R6 warns on any of the three, because a `'grid'` or `'form'` association
14+
* clutters the parent's entry form exactly as `true` does. Absent (and `false`)
15+
* is the control on both sides: R5 suggests, R6 is silent.
16+
*/
17+
18+
import { describe, expect, it } from 'vitest';
19+
import { lintDataModel } from './data-model-rules.js';
20+
21+
const R5 = 'relationship/line-items-inline-edit';
22+
const R6 = 'relationship/association-inline-edit';
23+
24+
const INLINE_VALUES = [true, 'grid', 'form'] as const;
25+
26+
/** A parent plus one child whose `master_detail` back to it carries `inlineEdit` (omitted when `undefined`). */
27+
const stack = (child: string, inlineEdit: unknown): any[] => [
28+
{ name: 'order', fields: { name: { type: 'text' } } },
29+
{
30+
name: child,
31+
fields: {
32+
order: {
33+
type: 'master_detail',
34+
reference: 'order',
35+
required: true,
36+
deleteBehavior: 'cascade',
37+
...(inlineEdit === undefined ? {} : { inlineEdit }),
38+
},
39+
},
40+
},
41+
];
42+
43+
const hits = (objects: any[], rule: string) => lintDataModel(objects).filter((i) => i.rule === rule);
44+
45+
describe('R5 relationship/line-items-inline-edit — silent on every inline-edit mode', () => {
46+
it.each(INLINE_VALUES)('is silent when the line-item relationship declares inlineEdit: %s', (inlineEdit) => {
47+
expect(hits(stack('order_line', inlineEdit), R5)).toEqual([]);
48+
});
49+
50+
it.each([undefined, false])('suggests inline editing when inlineEdit is %s', (inlineEdit) => {
51+
const [issue, ...rest] = hits(stack('order_line', inlineEdit), R5);
52+
expect(rest).toEqual([]);
53+
expect(issue?.severity).toBe('suggestion');
54+
expect(issue?.path).toBe('objects[1].fields.order.inlineEdit');
55+
});
56+
});
57+
58+
describe('R6 relationship/association-inline-edit — warns on every inline-edit mode', () => {
59+
it.each(INLINE_VALUES)('warns when an association relationship declares inlineEdit: %s', (inlineEdit) => {
60+
const [issue, ...rest] = hits(stack('order_comment', inlineEdit), R6);
61+
expect(rest).toEqual([]);
62+
expect(issue?.severity).toBe('warning');
63+
expect(issue?.path).toBe('objects[1].fields.order.inlineEdit');
64+
});
65+
66+
it.each([undefined, false])('is silent when inlineEdit is %s', (inlineEdit) => {
67+
expect(hits(stack('order_comment', inlineEdit), R6)).toEqual([]);
68+
});
69+
});

‎packages/lint/src/data-model-rules.ts‎

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,19 @@ function isAssociationName(name: string): boolean {
215215
return ASSOCIATION_TOKENS.some((t) => lc === t || lc.endsWith(`_${t}`) || lc.endsWith(`_${t}s`));
216216
}
217217

218+
/**
219+
* Is this relationship edited inline within its parent's form at all?
220+
* `FieldSchema.inlineEdit` accepts `true` (auto-pick by child shape), `'grid'`
221+
* and `'form'`, and every reader — the console's inline subforms, the spec's
222+
* `isBodyTableRelationship` — treats all three as inline-edited; `false` and
223+
* absent are not. The one copy of that question in this file, so no rule can
224+
* read a single literal of the three.
225+
*/
226+
function isInlineEdited(def: { inlineEdit?: unknown } | null | undefined): boolean {
227+
const inlineEdit = def?.inlineEdit;
228+
return inlineEdit === true || inlineEdit === 'grid' || inlineEdit === 'form';
229+
}
230+
218231
interface FieldEntry {
219232
name: string;
220233
def: any;
@@ -300,7 +313,7 @@ export function lintInlineEditBulk(objects: any[]): LocatedLintIssue[] {
300313
if (!child?.name) continue;
301314
for (const { name: fieldName, def } of fieldEntries(child.fields)) {
302315
if (!RELATIONSHIP_TYPES.has(def?.type)) continue;
303-
if (def.inlineEdit !== true && def.inlineEdit !== 'grid' && def.inlineEdit !== 'form') continue;
316+
if (!isInlineEdited(def)) continue;
304317
const parent = refOf(def);
305318
if (!parent) continue;
306319
for (const target of [parent, child.name]) {
@@ -1146,7 +1159,9 @@ export function lintDataModel(objects: any[]): LintIssue[] {
11461159
});
11471160
}
11481161
// R5 — line-item children are usually entered inline with the parent.
1149-
if (isLineItemName(obj.name) && def.inlineEdit !== true) {
1162+
// Any inline-edit mode the author already chose (`true`, 'grid' or
1163+
// 'form') satisfies it; only an absent or `false` inlineEdit is nudged.
1164+
if (isLineItemName(obj.name) && !isInlineEdited(def)) {
11501165
issues.push({
11511166
severity: 'suggestion',
11521167
rule: 'relationship/line-items-inline-edit',
@@ -1168,8 +1183,9 @@ export function lintDataModel(objects: any[]): LintIssue[] {
11681183
});
11691184
}
11701185

1171-
// R6 — associations should NOT be inlined into the parent's entry form.
1172-
if (def.inlineEdit === true && isAssociationName(obj.name)) {
1186+
// R6 — associations should NOT be inlined into the parent's entry form,
1187+
// in any inline-edit mode ('grid' and 'form' clutter it as `true` does).
1188+
if (isInlineEdited(def) && isAssociationName(obj.name)) {
11731189
issues.push({
11741190
severity: 'warning',
11751191
rule: 'relationship/association-inline-edit',

‎packages/plugins/plugin-hono-server/src/current-user-endpoints-execution-context-envelope.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@ describe('[#15747] the current-user faces assemble through the shared assembler'
278278
tabPermissions: { exports: 'visible' },
279279
// [#28508] No ownership-queue service in this mount: `false`.
280280
hasAnyQueue: false,
281+
// [#34602] No queue, so no object uses one.
282+
objectsUsingQueues: [],
281283
});
282284
});
283285

0 commit comments

Comments
 (0)