Skip to content

Commit 0d4d95d

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/area-A4-33454
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cxkE5YceM1ZSSAeofZ
2 parents 616d63a + 53f5a4c commit 0d4d95d

391 files changed

Lines changed: 19348 additions & 1517 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/data-objectstack': patch
3+
---
4+
5+
refactor(data-objectstack)!: retire the test-only `clearSharedDiscoveryCache` from the package entry
6+
7+
Clause-②: no (narrowing)
8+
Metadata-protocol: none
9+
10+
<!-- adr-0087: not-required (runtime-export-retired @object-ui/data-objectstack#clearSharedDiscoveryCache) the retired operand is a test-only function that empties the adapter's in-memory per-origin discovery cache; nothing in the workspace or in hotcrm calls it outside tests, and no packages/spec schema, registered node type, conversion surface or stored shape names it, so there is nothing for `objectstack migrate meta` to rewrite -->
11+
12+
**BREAKING** for a host that imports `clearSharedDiscoveryCache` from `@object-ui/data-objectstack`. It reset module state between tests, and no code outside a test called it, in the workspace or in hotcrm, so the Console and every `@object-ui/*` package are unaffected. Nothing fetches or renders differently.
13+
14+
The per-origin discovery cache moves verbatim into the package's own module `sharedDiscovery.ts`. `ObjectStackAdapter.connect()` still reads through it, and `getSharedDiscovery` stays exported from the entry unchanged. Only the reset helper stops being published, the same way the package roots already keep `resetRuntimeConfigForTesting`, `resetInflightGetsForTesting` and `__clearRecordEditableCache` off their barrels. The workspace's own tests import it from the module.
15+
16+
What leaves, and what to write instead:
17+
18+
- FROM `clearSharedDiscoveryCache` TO no replacement. The helper was test-only; a host test that needs a fresh discovery read gives each case its own `baseUrl`, or stubs the fetch its adapter makes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/plugin-email': patch
3+
---
4+
5+
fix(plugin-email): a template name an enabled and a disabled package hold sends what it sends when only the enabled package holds it (ADR-0150 D3)
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
While one of two packages that hold an email template name is disabled, the send (over the metadata protocol's execution list) now reads the bundle the way it reads a name one package holds: from the environment-wide list, which no longer lists a disabled package's members, its customization pair's rows or a dependent's added locales. Before, it read the enabled package's own address, which leaves out the locales its dependents add.
11+
12+
FROM → TO, with `B` disabled and `A` the one enabled holder: a send of a locale that both `A`'s customization pair (`A.custom`) and a dependent of `A` carry answered the pair's row, and now answers the same member a send answers when `B` holds nothing of the name (the dependent's locale). Every other answer is unchanged, and nothing changes while no holder of the name is disabled, or when the loader reads the registry's own list (no protocol registered).
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@objectstack/types': patch
3+
'@objectstack/rest': patch
4+
---
5+
6+
fix(types, rest): a package-scoped refusal's `details.candidates` is answered only when every element is a holder
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
`packageScopedRefusalCandidates` (`@objectstack/types`), the one recogniser every door reads for a package-scoped refusal's `details.candidates`, answered the refusal's list as `readonly unknown[]` without looking at its elements, and the rest door cast that to core's `PackageScopedHolder[]`. The recogniser now checks each element against the four holder kinds (`package` with a string `packageId`, `environment`, `platform`, `residual` with a string `ownerId`) and answers the list typed as those holders, so the rest door assigns it without a cast. Every holder core's `PackageScopedNameRefusedError` carries passes, so every answer a framework producer can cause is unchanged.
12+
13+
One corner moves, for a refusal no framework producer throws: a `409 RESOURCE_CONFLICT` of the refusal's shape whose `refusal.candidates` holds an element that is not a holder. FROM `details.candidates` echoing the list as thrown TO no `details.candidates` member, the answer the recogniser already gave a `candidates` that is not an array. It moves on every door that reads the recogniser alike (the `/data` doors, a batch row's error, the `/meta` reads, the resolver's doors), so they keep agreeing. Status, `code` and the sentence are unchanged.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
'@objectstack/plugin-auth': patch
3+
'@objectstack/platform-objects': patch
4+
---
5+
6+
feat(auth)!: a managed environment adds pending, SSO-only people with their positions, permission sets and manager, and ban works without the admin plugin
7+
8+
Clause-②: yes (narrowing) — narrowed: ban works without the admin plugin — `admin/ban-user` now works without the admin plugin, and a banned row is refused a session, with the admin plugin's own `403 BANNED_USER` answer; both ban doors answered `501 NOT_IMPLEMENTED` there. Widened: two doors, `POST /admin/add-sso-user` and `POST /admin/import-sso-users` (cloud-managed environments only; `409 RESOURCE_CONFLICT` elsewhere); the `idp_pending` value of `sys_user.source`, which every password door and every session refuses; the auth plugin's optional `environmentUserHost` option; `AuthManager#isAdminPluginMounted()`; the exports of `pending-sso-marker`, `environment-user-host` and `pending-sso-users`; and, re-exported from the package root, the helpers `bindUserToSoleOrganization`, `writeAdminAudit`, `joinCurrentOrganization` and `multiOrgCreationJoinsCurrentOrganization`, the class `CreationRefused`, the type `AdminAuditDecisions` (with its `user.admin_added_pending` event), `SetInitialPasswordOptions` (the optional third argument of `runSetInitialPassword`) and the optional `getBanWriter`, `host`, `getDataEngine` and `logger` members of `AdminBanEndpointDeps`. The cloud-managed refusals of `create-user`, `import-users` and the invitation doors point to Setup → Users.
9+
Metadata-protocol: none
10+
Skills-docs: none — no skill under `skills/**` teaches the admin user doors, the ban doors or the cloud-managed refusals; `content/docs/permissions/authentication.mdx` gains the two doors, the pending state, the host option and the ban change in this change.
11+
12+
<!-- adr-0087: not-required (no-migration-prescription) No schema key or metadata type is added, removed, renamed or re-shaped. `sys_user.source` gains one select option, `idp_pending`, which no existing row carries; the narrowed answer is a runtime refusal at session creation for a row already marked banned, so there is nothing stored for a migration to rewrite and no tombstone. -->
13+
14+
**BREAKING** for a deployment that runs without the better-auth admin plugin (`auth.plugins.admin` off, and SCIM off): `admin/ban-user` now works without the admin plugin, and a banned row is refused a session, with the admin plugin's own `403 BANNED_USER` code and sentence. `admin/unban-user` lifts the ban there too. A ban with an expiry that has passed is lifted at the next sign-in, as the admin plugin does. A deployment with the admin plugin on answers exactly as before: the plugin still decides.
15+
16+
Unchanged: the admin plugin's own ban enforcement where it is mounted; `create-user` and `import-users` off a managed environment; every row whose `source` is `env_native` or `idp_provisioned`.
17+
18+
What to do: before upgrading a deployment that runs without the admin plugin, list the users whose `sys_user.banned` is true, platform administrators first, and unban every one who should keep signing in: turn the admin plugin on (`auth.plugins.admin`), call `POST /admin/unban-user` for each, then turn it off again. A banned sole platform administrator cannot reach `admin/unban-user` after the upgrade. After it, a user who should not be banned is unbanned with `POST /admin/unban-user`.
19+
20+
New on a cloud-managed environment (`OS_CLOUD_MANAGED=1`): a platform administrator adds a person ahead of their first sign-in with `POST /admin/add-sso-user` (email, name, and optionally positions, permission sets and the manager's email address), or many with `POST /admin/import-sso-users` (CSV or rows, at most 500, a result per row, a bad row failing alone). The person is stored with `sys_user.source` = `idp_pending`: no password, refused by `set-user-password`, `set-initial-password`, `reset-password` and `phone-number/reset-password`, and refused a session on every channel, until their first sign-in through the platform identity provider attaches to the row and moves it to `idp_provisioned`. Positions, permission sets and the manager apply from the moment the person is added. Adding a person who is still pending again re-tells the host and changes nothing else; positions, permission sets or a manager sent with it are named on the answer as `notApplied`. A host passed as `environmentUserHost` is told after a person is added, and asked before a person is deactivated (`ban-user`) or reactivated (`unban-user`), never inside a transaction; the event names the administrator, the administrator at the keyboard on an impersonation session (`impersonatedBy`), and the administrator's cloud user id from their linked `objectstack-cloud` account. A host may refuse with `EnvironmentUserHostRefusal` (`409` or `403`, such as `DEVELOPER_ORGANIZATION_MEMBER_LIMIT_REACHED`): the door answers with it, a refused deactivation or reactivation writes nothing, and a refused add takes that person back out (one import row fails alone). Any other host failure refuses a deactivation (`503`, nothing written), and never undoes an add or a reactivation, whose answer says so on the row.
21+
22+
`@objectstack/platform-objects`: `sys_user.source` gains the option `idp_pending` ("Pending SSO Sign-In").
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
'@objectstack/spec': minor
3+
'@objectstack/runtime': minor
4+
'@objectstack/lint': minor
5+
---
6+
7+
feat(spec,runtime): a hook written as a TypeScript `handler` can declare `refusals`, and a refusal code can hold several declared sentences with parameters
8+
9+
Clause-②: yes
10+
Metadata-protocol: added
11+
Skills-docs: follow-up #33658 — skills/objectstack-data/references/data-hooks.md (the "Declared refusals (`refusals`)" section teaches a sandboxed `body` only, one sentence per code, no params), skills/objectstack-i18n/SKILL.md (the `hooks.<hook>.refusals.<CODE>.message` row has no `reasons` key)
12+
13+
A hook's refusal catalogue (`HookSchema.refusals`) is answered on every path the hook runs on, and an entry can hold more than one sentence (maintainer ruling 6879477573: letter A, S1, params; inside ruling 6431311681 letter A).
14+
15+
- **A `handler` hook may declare `refusals`.** `defineStack`, `os validate`, `os build` and the metadata save door used to refuse `refusals` on a hook with no `js` body. They now accept it on a hook whose `handler` is an inline function or a string reference. An undeclared code that the handler's source throws literally is refused at save, at `handler`. The catalogue is answered on every path: the body `os build` lowers the handler to (as before), and the in-process handler of a source boot (`bootStack(config)`, `os serve` over a host config), plus the function a string `handler` names when the build could not lower it. Both answer with the same envelope. An error a `ctx.api` or `ctx.ql` call raised, which the handler lets through unchanged, passes through as it does on the body path. Still refused: `refusals` on a hook whose code cannot throw a code (an `expression` body, or neither a body nor a handler).
16+
- **`reasons`: several sentences under one wire code.** `refusals.CODE.reasons.REASON.message`, with a snake_case reason. The hook throws `{ code, reason }`. The caller reads the reason's sentence, with the code and the status of its entry, so the wire code and the envelope are unchanged. Under a code that declares `reasons`, a reason it does not declare is refused loudly: at save where the hook's source throws it literally, otherwise at run time as a `500` naming the hook, the code and the reason. Under a code that declares no `reasons`, a thrown `reason` is not read, as before: the entry's own sentence answers. Translated through `hooks.HOOK.refusals.CODE.reasons.REASON.message`. `os i18n extract` and `os i18n check` count each declared reason, and `os validate` refuses a translation key over a reason the code does not declare (`translation-target-unknown`).
17+
- **`params`: names a sentence may fill.** An entry declares `params: ['state']`, and its sentences (its `message` and each reason) may write a double-brace hole over those names. The hook throws `params: { state }`. The runtime fills the holes after it picks the translation, through the formula template engine the flow `end` refusal renders with, and only declared names are in scope. A hole over an undeclared name is refused at save. A hole holding logic, an unknown formatter, an empty hole and a `currency` formatter with no code (a hook refusal carries no default currency) are refused by `os validate`, `os compile` and the publish gate's `hook` write (`@objectstack/lint`). An entry with no `params` stays plain text and every hole in it is refused, as before. The rule is now a refinement (`dropped-refinements.baseline.json` gains `data/HookRefusal`), so the published JSON Schema no longer carries the hole pattern on `message`.
18+
19+
Unchanged: a hook that declares none of the new parts answers byte-for-byte as before (pinned against the base commit's output), including one that throws a `reason` property under a code with no `reasons` (saved and answered as on `main`, pinned on both paths), and a hook that declares no `refusals` is untouched on both paths.
20+
21+
New exports in `@objectstack/spec/data`: `HOOK_REFUSAL_REASON_PATTERN`, `HOOK_REFUSAL_PARAM_PATTERN`, `hookRefusalReasonsThrownIn`, `undeclaredHookRefusalReasonAtSave`, `undeclaredHookRefusalReasonAtRun`. `hookRefusalMessageKey(hook, code, reason?)` takes an optional reason.
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/cli': minor
4+
---
5+
6+
feat(spec, cli): `i18n.sourceLocale` names the language the inline metadata text is written in, apart from the users' `defaultLocale`; `os lint`, `os i18n check` and `os i18n extract` read it as the source language
7+
8+
Clause-②: yes
9+
Metadata-protocol: added
10+
Skills-docs: follow-up owed — `skills/objectstack-i18n/SKILL.md` (the `i18n` key table and the `os i18n extract` flag list teach `defaultLocale` / `--default-locale` as the only locale knobs; it needs a `sourceLocale` row). `content/docs/ui/translations.mdx` and the `os lint` flag row in `content/docs/deployment/cli.mdx` are updated here.
11+
12+
`TranslationConfigSchema` (the stack's `i18n` block) gains an optional `sourceLocale`, validated by the same `LocaleSchema` as `defaultLocale` and, like it, not required to be one of `supportedLocales`. `defaultLocale` stays the language a user who has not chosen one gets; `sourceLocale` is the language a plain-string `label:` is written in. Absent, it is `defaultLocale`, so a stack that declares nothing reads exactly as before. Near-miss spellings `sourceLanguage`, `authoringLocale` and `authoringLanguage` are refused with `sourceLocale` as the suggestion.
13+
14+
An app authored in English that defaults its users to Chinese declares:
15+
16+
```ts
17+
i18n: { defaultLocale: 'zh-CN', sourceLocale: 'en', supportedLocales: ['en', 'zh-CN', 'es-ES'] }
18+
```
19+
20+
**`os lint` and `os i18n check`** count the inline text as the source locale's translation: they ask for no `en` bundle row that restates it, and they report each missing `zh-CN` and `es-ES` row. With `defaultLocale: 'zh-CN'` alone they read the English labels as Chinese: every key was reported missing in `en` (an error under `os lint --strict`) and no `zh-CN` gap was ever reported. On a stack declaring `sourceLocale`, the users' `defaultLocale` is gated even when `supportedLocales` omits it or no bundle for it exists yet; an explicit `--locales` list is still the whole set. `--strict` / `--i18n-strict` help and the closing hint of `os i18n check` now say "non-source locales".
21+
22+
**`os i18n extract`** fills the source locale's bundle from the inline text and rewrites it from the source on every merge; every other locale, `defaultLocale` included, keeps its hand translations. On a stack declaring `sourceLocale` it also scaffolds `defaultLocale` when no `--locales` list is given.
23+
24+
**`--default-locale`** on all three commands keeps working and still wins over the config for one run; its help text now says it overrides the source locale (`i18n.sourceLocale`, else `i18n.defaultLocale`, else `en`). The `defaultLocale` field of `os i18n check --json` keeps its name and carries the source locale that was used.
25+
26+
**Not yet read by the serving layer.** The runtime label resolvers still treat `defaultLocale` as the authored label's language when they decide whether a request walks the fallback chain. With `defaultLocale: 'zh-CN'` and no `fallbackLocale`, an `en` request walks to the `zh-CN` bundle before it reaches the English inline label. Declare `fallbackLocale: 'en'` to keep an `en` request on the authored text.

‎.changeset/33238-position-rename-hot-install.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ A position that declares `renamedFrom` moves the holders of each old name (`sys_
1212
Carried at once, without a restart:
1313

1414
- a hot install or upgrade through the marketplace install-local door (`/marketplace/install-local`), for the positions of the package it names (`app/ID`). An upgrade over a version the running kernel still serves is carried too: re-registering the package withdraws the position its new version no longer ships (`@objectstack/objectql`, #33050), so the old name is no position the kernel serves when the announcement is heard;
15-
- a per-item publish of a position, and a package publish of drafts, for each position they publish (`position/NAME`).
15+
- a per-item publish of a position, and a package publish of drafts, for each position they publish (`position/NAME`);
16+
- the runtime's package install (`POST /packages`) and the enable of a disabled package (`PATCH /packages/:id/enable`), which announce `app/ID` (`@objectstack/runtime`, #33302). A package still disabled when it is announced is not carried until the enable switches it on and announces it again.
1617

1718
Still carried at the next restart, by the boot run:
1819

19-
- the runtime's package install and enable routes, which do not announce `metadata:reloaded`;
2020
- an artifact reload, which announces a file path and names no package or position.
2121

2222
An uninstall's announcement names a package no longer registered, so a withdrawal carries nothing. A reload heard before the boot run is ignored. Runs never overlap, and a run never fails the door that announced it. A reload run that moves no row does not read the other references it would leave behind, and a warning the run before already gave is not repeated; a move is always reported.

0 commit comments

Comments
 (0)