Skip to content

Commit c3f79fc

Browse files
committed
Merge origin/main into claude/project-thread-vo0alu
Claude-Session: https://claude.ai/code/session_016WV4d1JeXeWGVzxc12FsUx Co-authored-by: Claude <noreply@anthropic.com>
2 parents a54649c + badf24d commit c3f79fc

19 files changed

Lines changed: 1686 additions & 24 deletions
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'create-objectstack': patch
3+
---
4+
5+
Clause-②: no
6+
Metadata-protocol: none
7+
8+
The blank template now says its `note` object is a sample: the generated README gains a "The sample `note` object" section with the steps to delete or replace it, and `src/objects/note.object.ts` opens with a comment saying the same. A developer no longer finds a `note` object in their app, over REST or in an MCP client's object list, without anything telling them it came from the scaffold.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/service-messaging': patch
3+
---
4+
5+
i18n(service-messaging): the notification objects and the digest heading ship in Russian, German and Korean
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The messaging objects and the digest heading "You have {{count}} notifications" now carry `ru`, `de` and `ko` as well, so the package ships all eleven platform languages. `t()` selects no plural form, so the Russian heading is worded as a tally (`Уведомлений: {{count}}`), correct for every count. Each new locale is registered under its platform-table tag with its source-hash companion and its messages, and the package's extract command lists the tags, so the existing `check:i18n` bundle check covers them. Second half of package 5 of #30512.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/core': patch
3+
---
4+
5+
fix(core): a banned user's assigned-work count and hand-over now include the platform's injected `owner_id`
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The field picker behind the assigned-work count and the bulk hand-over skipped every `system: true` user reference. The `owner_id` the platform injects on every business object is `system: true` (it is a platform column) but not `readonly` (ownership is transferable), so it was skipped: on any object whose author had not declared `owner_id` themselves, the records a banned user owned were counted as zero and never handed over. The picker now leaves out `readonly` user references only, so `created_by` / `updated_by` stay out and the injected `owner_id` is counted and handed over. Platform tables (`sys_*`), `managedBy` objects and injected columns with no storage stay excluded as before.

‎content/docs/deployment/validating-metadata.mdx‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,8 @@ orthogonal to both, and no cell here can carry it; it is written out in
489489
| Ordering comparands naming a date-range preset — `last_30_days` in a `>=` position (#8793) | ✓ | ✓ | ✓ | ✓ᵈᵛᵒᵖᶠ |
490490
| Empty filter combinators — `$and: []`, `$or: []`, `$not: {}` (#5330) | ✓ | ✓ | ✓ | ✓ᶠ |
491491
| Object & action name references (#3583) | ✓ | ✓ | ✓ | — |
492-
| Flow reference integrity — node writes, template paths, read-only writes (#3583) | ✓ | ✓ | ✓ | ✓ᶠ |
492+
| Reference integrity — flow node writes, template paths, read-only writes (#3583); at the publish door each write type runs only the members that declare it, and the flow members run on `flow` alone (#9313) | ✓ | ✓ | ✓ | ✓ᶠᵛᵒᵈᵗʳᵖ |
493+
| List-view field members — a list view's `sort` (a `sortable: false` field, a `formula`, an unknown name: `sort-field-unsortable`), its `searchableFields` (`searchable-field-unknown`) and its field references, columns, filter keys, grouping and the board bindings (`list-view-field-unknown`); the row merges three members, so its codes follow no one rule's order, and the `page` door runs the sort member only (#9313, #15495, #30095) | ✓ | ✓ | ✓ | ✓ᶠᵛᵒᵖ |
493494
| Page-component field bindings (#3583) | ✓ | ✓ | ✓ | — |
494495
| React page block field bindings — §10 (#4340) | ✓ | ✓ | ✓ | — |
495496
| Chart bindings outside dashboards (#3583) | ✓ | ✓ | ✓ | — |
@@ -525,11 +526,11 @@ orthogonal to both, and no cell here can carry it; it is written out in
525526
**Every superscript in the `runtime publish` column is one metadata type whose
526527
writes that rule inspects: `✓ᶠ` `flow`, `✓ᵛ` `view`, `✓ᵈ` `dashboard`, `✓ᵒ`
527528
`object`, `✓ᵖ` `page`, `✓ˢ` `seed`, `✓ᵇ` `book`, `✓ᵖᵉ` `permission`,
528-
`✓ᵖᵒ` `position`, `✓ᵃ` `app`, `✓ᵉ` `email_template`** — the two
529+
`✓ᵖᵒ` `position`, `✓ᵃ` `app`, `✓ᵉ` `email_template`, `✓ᵈᵗ` `dataset`, `✓ʳ` `report`** — the two
529530
`ᵖ`-initial pairs carry a second letter because `page` already holds `ᵖ` on its
530-
own. Read the codes **longest-first**: `ᵖᵒ` is `position`, never `page`
531-
followed by `object`, and `ᵖᵉ` is `permission`, never `page` followed by
532-
`email_template`. A cell lists one superscript per declared type, in the order the rule declares them, and that
531+
own, and `dataset` carries `ᵈᵗ` because `dashboard` holds `ᵈ`. Read the codes **longest-first**: `ᵖᵒ` is `position`, never `page`
532+
followed by `object`, `ᵖᵉ` is `permission`, never `page` followed by
533+
`email_template`, and `ᵈᵗ` is `dataset`. A cell lists one superscript per declared type, in the order the rule declares them, and that
533534
rule's own `runtimeTypes` in `AUTHORING_RULES` is the authority — the set has
534535
grown a type at a time (#4463 shipped P1 as `flow` and four rule families, #7220
535536
moved the whole `views[]` visibility-predicate family across in one edit, #7529

‎packages/core/src/security/user-assigned-work.test.ts‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { describe, it, expect } from 'vitest';
44
import { assertEngineUpdateDispatch } from '@objectstack/metadata-core';
5+
import { AUDIT_FIELD_DEFS, OWNER_FIELD_DEF } from '@objectstack/spec/data';
56
import {
67
countUserAssignedWork,
78
transferUserAssignedWork,
@@ -10,18 +11,22 @@ import {
1011
type UserWorkEngine,
1112
} from './user-assigned-work.js';
1213

14+
// [#30646] `owner_id`, `created_by` and `updated_by` are the platform's own
15+
// injected definitions, as `applySystemFields` spreads them: the owner column is
16+
// `system: true` but not `readonly`, the audit lookups are both.
1317
const ticket = {
1418
name: 'ticket',
1519
fields: {
1620
title: { type: 'text' },
17-
owner_id: { type: 'lookup', reference: 'sys_user' },
21+
owner_id: OWNER_FIELD_DEF,
1822
assignee: { type: 'user' },
1923
watchers: { type: 'lookup', reference: 'sys_user', multiple: true },
20-
created_by: { type: 'lookup', reference: 'sys_user', readonly: true, system: true },
24+
created_by: AUDIT_FIELD_DEFS.created_by,
25+
updated_by: AUDIT_FIELD_DEFS.updated_by,
2126
account: { type: 'lookup', reference: 'account' },
2227
},
2328
};
24-
const account = { name: 'account', fields: { owner_id: { type: 'lookup', reference: 'sys_user' } } };
29+
const account = { name: 'account', fields: { owner_id: OWNER_FIELD_DEF } };
2530
const grant = { name: 'sys_user_permission_set', fields: { user_id: { type: 'lookup', reference: 'sys_user' } } };
2631
const managed = { name: 'auth_session', managedBy: 'better-auth', fields: { user_id: { type: 'lookup', reference: 'sys_user' } } };
2732

@@ -37,6 +42,14 @@ describe('[#30205] userAssignedWorkFields', () => {
3742
]);
3843
});
3944

45+
it('[#30646] takes the injected owner_id as the platform defines it, and leaves the audit lookups out', () => {
46+
// The premise this pins: the injected owner column is a platform column
47+
// (`system`) that stays assignable, so `system` alone cannot exclude it.
48+
expect({ system: OWNER_FIELD_DEF.system, readonly: OWNER_FIELD_DEF.readonly }).toEqual({ system: true, readonly: false });
49+
const { fields } = userAssignedWorkFields([{ name: 'deal', fields: { owner_id: OWNER_FIELD_DEF, ...AUDIT_FIELD_DEFS } }]);
50+
expect(fields).toEqual([{ object: 'deal', field: 'owner_id', multiple: false }]);
51+
});
52+
4053
it('stops at the cap and says so', () => {
4154
const { fields, truncated } = userAssignedWorkFields([ticket, account], 2);
4255
expect(fields).toHaveLength(2);
@@ -98,7 +111,7 @@ function seed(): Record<string, Row[]> {
98111
{ id: 'u_also_banned', banned: true, ban_expires: null },
99112
],
100113
ticket: [
101-
{ id: 't1', owner_id: 'u_gone', assignee: 'u_gone', watchers: ['u_gone'] },
114+
{ id: 't1', owner_id: 'u_gone', assignee: 'u_gone', watchers: ['u_gone'], created_by: 'u_gone', updated_by: 'u_gone' },
102115
{ id: 't2', owner_id: 'u_gone', assignee: 'u_x', watchers: [] },
103116
{ id: 't3', owner_id: 'u_x', assignee: 'u_gone', watchers: ['u_x', 'u_gone'] },
104117
],
@@ -157,8 +170,9 @@ describe('[#30205] transferUserAssignedWork', () => {
157170
});
158171
const t = engine.tables.get('ticket')!;
159172
expect(t.map((r) => [r.owner_id, r.assignee])).toEqual([['u_next', 'u_next'], ['u_next', 'u_x'], ['u_x', 'u_next']]);
160-
// A multi-valued field is never rewritten.
173+
// A multi-valued field is never rewritten, and neither is who did what.
161174
expect(t[0].watchers).toEqual(['u_gone']);
175+
expect([t[0].created_by, t[0].updated_by]).toEqual(['u_gone', 'u_gone']);
162176
// Every write went through `update` under the caller's own context.
163177
const writes = engine.calls.filter((c) => c.op === 'update');
164178
expect(writes).toHaveLength(5);

‎packages/core/src/security/user-assigned-work.ts‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@
1717
* platform's `owner_id`, which is itself a lookup to the user object, and the
1818
* app's own fields such as an `assignee`. Left out, on purpose:
1919
*
20-
* - `readonly` and `system` fields: `created_by` / `updated_by` record who did
21-
* something, not who holds the work, and moving them would rewrite history.
20+
* - `readonly` fields: `created_by` / `updated_by` record who did something,
21+
* not who holds the work, and moving them would rewrite history. `system`
22+
* alone does not exclude a field: it marks a column the platform provides,
23+
* and the injected `owner_id` is one (`OWNER_FIELD_DEF` is `system: true`,
24+
* `readonly: false`, because ownership is transferable).
2225
* - platform tables (`sys_*`) and `managedBy` objects: `sys_user_permission_set.user_id`
2326
* is a grant, not work, and moving it would move the person's permissions.
2427
* - a column the platform registers but provisions no storage for (an injected
@@ -98,8 +101,8 @@ export function userAssignedWorkFields(
98101
for (const [field, def] of Object.entries(obj.fields as Record<string, unknown>)) {
99102
if (phantom.has(field)) continue;
100103
if (referenceTargetOf(def) !== USER_OBJECT) continue;
101-
const d = def as { readonly?: unknown; system?: unknown; multiple?: unknown };
102-
if (d.readonly === true || d.system === true) continue;
104+
const d = def as { readonly?: unknown; multiple?: unknown };
105+
if (d.readonly === true) continue;
103106
if (fields.length >= cap) return { fields, truncated: true };
104107
fields.push({ object: name, field, multiple: d.multiple === true });
105108
}

‎packages/create-objectstack/src/templates/blank/README.md‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@ curl -c cookies.txt -X POST http://localhost:3000/api/v1/auth/sign-in/email \
2626
curl -b cookies.txt "http://localhost:3000/api/v1/data/<your_object>"
2727
```
2828

29+
## The sample `note` object
30+
31+
`src/objects/note.object.ts` is a **sample**, there so a blank project has one
32+
object to boot, query and test on day one. It is not part of your app: until
33+
you remove it, it ships in every build, is served over REST, and is listed to
34+
any MCP client next to your own objects. Delete or replace it once your own
35+
objects exist:
36+
37+
1. Delete `src/objects/note.object.ts` and its export line in
38+
`src/objects/index.ts`.
39+
2. Point `note.test.ts` at one of your own objects (rename the file to match).
40+
It imports `Note`, so it stops compiling until you do.
41+
3. Run `pnpm validate` and `pnpm test`.
42+
2943
## The Console — this starter ships no app
3044

3145
`pnpm dev` also serves the admin Console at `http://localhost:3000/_console/`,
@@ -67,7 +81,8 @@ for OAuth, API keys, and which objects/actions become tools.
6781

6882
- `objectstack.config.ts` — environment manifest (objects, API, plugins), and
6983
the wiring for every directory below
70-
- `src/objects/` — object definitions (one file per object)
84+
- `src/objects/` — object definitions (one file per object); `note.object.ts`
85+
is the sample described [above](#the-sample-note-object)
7186
- `src/views/`, `src/actions/`, `src/flows/`, `src/dashboards/`, `src/apps/`,
7287
`src/skills/`, `src/picklists/`, `src/security/` (permission sets),
7388
`src/datasets/` (analytics datasets) — empty to start. Each directory's `index.ts`

‎packages/create-objectstack/src/templates/blank/src/objects/note.object.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
22

3+
// SAMPLE OBJECT: delete or replace it once your own objects exist.
4+
//
5+
// `note` is here so a blank project has one object to boot, query and test
6+
// on day one. It is not part of the app you are building: until you remove
7+
// it, it ships in every build, is served over REST and is listed to MCP
8+
// clients like any object of yours. To remove it, delete this file and its
9+
// export line in `src/objects/index.ts`, then point `note.test.ts` at one of
10+
// your own objects (it imports `Note` and will not compile without it).
11+
// The README's "The sample `note` object" section says the same.
12+
313
import { ObjectSchema, Field } from '@objectstack/spec/data';
414

515
export const Note = ObjectSchema.create({

‎packages/services/service-messaging/scripts/i18n-extract.config.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* `--merge` preserves every hand-translated string.
88
*
99
* os i18n extract packages/services/service-messaging/scripts/i18n-extract.config.ts \
10-
* --locales=zh-CN,ja-JP,es-ES,zh-Hant,ar,fr,pt-BR --fill=default --objects-only --no-metadata-forms \
10+
* --locales=zh-CN,ja-JP,es-ES,zh-Hant,ar,fr,pt-BR,ru,de,ko --fill=default --objects-only --no-metadata-forms \
1111
* --source-hashes \
1212
* --out=packages/services/service-messaging/src/translations
1313
*
@@ -53,6 +53,9 @@ import { zhHantObjects } from '../src/translations/zh-Hant.objects.generated.js'
5353
import { arObjects } from '../src/translations/ar.objects.generated.js';
5454
import { frObjects } from '../src/translations/fr.objects.generated.js';
5555
import { ptBRObjects } from '../src/translations/pt-BR.objects.generated.js';
56+
import { ruObjects } from '../src/translations/ru.objects.generated.js';
57+
import { deObjects } from '../src/translations/de.objects.generated.js';
58+
import { koObjects } from '../src/translations/ko.objects.generated.js';
5659

5760
/**
5861
* The annotation is load-bearing, not decoration (#10868). `defineStack`
@@ -87,6 +90,9 @@ const config: ObjectStackDefinition = defineStack({
8790
{ 'ar': { objects: arObjects } },
8891
{ 'fr': { objects: frObjects } },
8992
{ 'pt-BR': { objects: ptBRObjects } },
93+
{ 'ru': { objects: ruObjects } },
94+
{ 'de': { objects: deObjects } },
95+
{ 'ko': { objects: koObjects } },
9096
],
9197
});
9298

‎packages/services/service-messaging/src/objects/admin-copy-vocabulary.test.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ import { zhHantObjects } from '../translations/zh-Hant.objects.generated.js';
3030
import { arObjects } from '../translations/ar.objects.generated.js';
3131
import { frObjects } from '../translations/fr.objects.generated.js';
3232
import { ptBRObjects } from '../translations/pt-BR.objects.generated.js';
33+
import { ruObjects } from '../translations/ru.objects.generated.js';
34+
import { deObjects } from '../translations/de.objects.generated.js';
35+
import { koObjects } from '../translations/ko.objects.generated.js';
3336

3437
/** The design-record vocabulary an admin-facing string must not carry. */
3538
const DESIGN_RECORD_VOCABULARY: ReadonlyArray<readonly [string, RegExp]> = [
@@ -103,6 +106,9 @@ const OBJECT_BUNDLES = {
103106
'ar': arObjects,
104107
'fr': frObjects,
105108
'pt-BR': ptBRObjects,
109+
'ru': ruObjects,
110+
'de': deObjects,
111+
'ko': koObjects,
106112
} as const;
107113

108114
describe('messaging objects: admin-facing copy carries no design-record vocabulary', () => {

0 commit comments

Comments
 (0)