Skip to content

Commit ef311d6

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/issue-35401-user-actions-transfer
# Conflicts: # packages/platform-objects/src/apps/translations/object-lifecycle-panel-echo-decisions.test.ts
2 parents 68e4fc1 + 6d86b43 commit ef311d6

157 files changed

Lines changed: 4906 additions & 1155 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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@objectstack/spec': minor
3+
'@objectstack/platform-objects': patch
4+
---
5+
6+
feat(spec): the Studio hook form offers a hook's declared `texts`, and `HookContext` declares `ctx.text`
7+
8+
Clause-②: yes (widening)
9+
Metadata-protocol: added
10+
11+
The added key is the type member `HookContext.text` (the authorable-surface record lists `HookContext` members); nothing a stack writes changes.
12+
13+
- **Studio hook form.** `hookForm` gains a `texts` row beside `refusals`: a key-only record keyed by the snake_case key the hook's code asks for with `ctx.text`, each entry editing its `message` and `params`. An author editing a hook in the Studio can now write the `texts` the schema has accepted since 18.6.0, instead of going through the metadata API or the package source. The row's label and help text ship in all eleven metadata-forms locale packs of `@objectstack/platform-objects`. Nothing about what a hook may declare changes.
14+
- **`HookContext.text`.** `HookContext` now declares `text?: (key: string, params?: Record<string, unknown>) => Promise<string>` (named `HookTextReader`), the call the runtime already binds on every path a hook runs on, declared the way `api` and `notice` are: `z.unknown()` at parse, a static cast for the type, optional because a context parsed without the runtime carries none. A typed handler no longer needs a local type to call `ctx.text`. `HookContextSchema.parse` now keeps a bound `text` instead of stripping it.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
---
4+
5+
fix(studio): removing a field that holds data asks before the Data pillar saves it
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
In Studio's Data pillar, removing a stored field from a published object (or retyping or requiring one) made the draft autosave answer `409 DESTRUCTIVE_CHANGE`, and the pillar showed only its generic "changes not saved" strip, with no way to finish the change. The refusal now opens a confirmation that lists what the save would lose, in the server's own findings. **Force save** sends the same body to the same object and package again with `force`; **Cancel** puts each field the findings name back as the server holds it and sends nothing more. While the confirmation is open the autosave sends nothing. Every other refusal reads on the strip as before.
11+
12+
The confirmation reuses the existing `engine.edit.destructiveTitle`, `engine.edit.destructiveDesc`, `engine.edit.forceSave` and `engine.cancel` strings: no locale key, prop or export changes.
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/objectql': patch
4+
'@object-ui/fields': patch
5+
'@object-ui/app-shell': patch
6+
---
7+
8+
feat(spec): a formula field can return `percent`
9+
10+
Clause-②: yes (widening)
11+
Metadata-protocol: added
12+
13+
A ratio formula (budget used, gross margin) can now declare `returnType: 'percent'` and read and display as a `percent` field does, instead of a bare decimal beside the stored percentages.
14+
15+
- **The value.** A `percent` formula result is read exactly as a `percent` field reads its stored value: a fraction (`0.25` shows `25%`, so the expression divides and does not multiply by 100), unless the formula declares a `max` above 1, then percentage points (`percentScaleOf`).
16+
- **Its places.** `scale` counts the decimal places of the displayed percentage, as on a `percent` field (absent: 0). The engine rounds a fraction result to `scale + 2` places and a whole percentage to `scale`, so `scale: 1` keeps 0.417 (41.7%) instead of rounding it to 0.4.
17+
- **An existing `percent` field computed from its `expression` rounds the same way.** The engine shares one rounding step for computed values, so a stored `percent` field that computes from an `expression` now keeps `scale + 2` places for a fraction (and `scale` for a whole percentage). Before, its computed fraction was rounded to `scale` itself: at `scale: 1`, 0.417 was stored as 0.4 and read 40.0%; it is now stored 0.417 and reads 41.7%. The change applies to the next computed write; rows written earlier are not rewritten.
18+
- **Its face.** `percentDisplay` applies to a `percent` formula too (bar or plain). The formula renderer formats the result with the percent formatter, and the field and object forms offer `percent` as a return type. Editing the expression in the Studio field inspector keeps a declared `percent` (or `currency`) unless the new expression proves text, a boolean or a date.
19+
- **Declared, never inferred.** No CEL type proves a quotient is a percentage, so authoring keeps a declared `percent` where it would otherwise stamp `number`. Readers that switch on `returnType` (display-name eligibility, filter operator and comparand typing) treat `percent` as a number.
20+
21+
The enum only gains a member: every formula that parsed before parses the same, and nothing stored needs migrating.

‎.changeset/35079-skills-write-staged-swap.md‎

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
'@objectstack/objectql': patch
3+
---
4+
5+
fix(objectql)!: a by-id delete whose driver removes nothing after the row was read answers RECORD_NOT_FOUND and runs no after-delete work
6+
7+
Clause-②: no (narrowing)
8+
Metadata-protocol: none
9+
10+
<!-- adr-0087: not-required (no-migration-prescription) No key of any schema is added, removed, renamed or re-shaped, and no export changes shape. What moves is the answer an engine caller gets from a by-id delete that loses a race for its row: no stored row, registry key or authored value changes, so there is nothing for a migration to rewrite and no tombstone. -->
11+
12+
**BREAKING** for a caller of the engine's by-id delete (`engine.delete(object, { where: { id } })`, a hook's `ctx.api`, an action handler, a flow `delete_record` step) whose row is removed by another writer after this delete read it and before its own driver call. This happens when two deletes of one row run at once on a store whose writers do not queue behind each other: for example PostgreSQL for any object, and SQLite for an object with no metadata `beforeDelete` hook and no blocking metadata `afterDelete` hook. On SQLite such a hook makes the second delete wait for the first, and the second then finds no row when it reads it.
13+
14+
- FROM: the loser's driver answered `false` (it removed nothing), and the engine still ran every after-delete step for it: the `afterDelete` hooks, the parent roll-up summary recompute and the `data.record.deleted` realtime event. The loser's answer was `false`. On SQLite, with such a metadata hook the loser waited for the winner and answered `RECORD_NOT_FOUND`, so the answer depended on the hook binding.
15+
- TO: the loser answers `RECORD_NOT_FOUND` (404), the error a by-id delete already gives for an id that names no row, and none of those steps runs for it. The winner's delete is unchanged and runs each step once. A recycle-bin entry the loser wrote is still withdrawn, as before. When the loser's delete runs in a transaction (its object is referenced by a cascading relation), the cascade it walked rolls back with it.
16+
- The same answer applies when the row is removed by the delete's own `beforeDelete` hook (a hook that deletes the row it is asked about through `ctx.api`): that delete answered `false` and now answers `RECORD_NOT_FOUND`.
17+
- A child delete that a parent's cascade issued is the exception: when its driver answers `false`, the dependent the cascade was sent to remove is already gone, so that child delete still answers `false`, runs none of the after-delete steps, and the cascade goes on; the parent's delete completes, as it did before. A child that was already gone when its own delete read it still stops the cascade with `RECORD_NOT_FOUND`, unchanged.
18+
19+
The REST and batch delete routes, and the own-row delete route, already answered 404 for this case; their code and status do not change. On the own-row delete route the loser's `RECORD_NOT_FOUND` is now raised by the engine, so its `userMessage` is built from the route's system context, which carries no locale, where the route used to build it from the caller's.
20+
21+
The fix for a caller: treat `RECORD_NOT_FOUND` from a by-id delete as "the row is already gone", as for any id that names no row. The error this change adds always names the row the caller addressed, since a cascade's child delete no longer raises it; a cascade can still stop on a dependent with `RECORD_NOT_FOUND`, as before; the addressed row is then kept. A caller that tested the answer for `false` reads the error's `code` instead.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/service-automation': patch
3+
---
4+
5+
fix(service-automation): the "invalid expression" registration refusal names the template-braces rule only when a refusal it lists is a brace refusal
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
Registering a flow whose only refused expression is not about braces — the date-text verdict on `timestamp(record.borrow_date)` over a date field, an unknown function, a `{{ }}` hole over a `$` name the engine does not bind — used to open with the ADR-0032 §1a braces sentence ("Predicates … must not wrap references in `{…}` template braces …"), telling the author about a mistake they did not make. That refusal now opens with a neutral count, `Flow 'X' has N invalid expression(s); each is refused for the reason given with it, and the flow does not register until every one is fixed:`. The braces sentence, unchanged, still heads any list that holds a brace refusal: a `{…}` brace in a CEL slot, a single-brace token in a text slot, a retired `{…}` token in a value slot, or an envelope naming the wrong dialect for its slot.
11+
12+
Which flows are refused, and every refusal line listed under the header, are unchanged.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/cli': patch
3+
---
4+
5+
fix(cli): `os doctor` no longer advises `--verbose` when no warning has a fix for it to show
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
When `os doctor` finished with warnings it closed with "Run with --verbose to see fix suggestions." whenever any warning fired. Several warnings have no fix suggestion in either mode (a missing `*.test.ts` beside a `*.zod.ts`, `@deprecated` usages, circular dependencies, unused objects, orphan views), so for those the re-run printed nothing new. The line is now printed only when at least one warning that fired carries a fix that `--verbose` would reveal. The warnings themselves, and exit codes, are unchanged.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
---
4+
5+
fix(console): a refused metadata save draws a nested cause under the row its path names
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
After a refused save, Studio's metadata form drew an issue under a field only when the issue's path was exactly that field's key. A cause one level down — a label carrying a key that is not a locale (`label.not_a_locale`), a nested predicate's part, a list column's sub-field (`columns.0.field`) — lit no field at all, and since the server stopped sending the bare "Invalid input" head at the field's own key, about 25 keys across 12 metadata types showed no red line after a refused save.
11+
12+
An issue is now drawn on the deepest field the form shows for a prefix of its path, for every issue source (the server's refusal, the live check, load-time diagnostics):
13+
14+
- a field draws a deeper issue itself, led by the path's trail (`Label → not_a_locale: …`, `Columns → #1 → field: …`);
15+
- a field rendered as a nested form passes the issue down to the nested field it names, which draws it as its plain message;
16+
- an issue under a list, map or code field stays on that field, with its trail; an issue under a hidden or canvas-owned key stays in the summary banner, as before.
17+
18+
One mistake is still one message: the summary banner and the refusal line leave out every issue whose top-level field the form draws it under. In a new item's form, a nested field's issue shows exactly when its parent field's does.
19+
20+
The Save button's reason for a refused draft no longer starts with a comma when the server also refused the document as a whole: the whole-document entry is not named as an empty field, and a refusal of only the whole document names its own message.
21+
22+
No locale keys, props or exports change.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@object-ui/console': patch
3+
---
4+
5+
fix(console): the language seed's `me/localization` leaves at parse time, beside discovery
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
On a device's first visit the console's language seed asked `GET /api/v1/auth/me/localization` from the bundle, so the request waited for the whole eager module graph to download and evaluate, about half a second after navigation on a local server and longer on a hosted one. It needs nothing from the bundle except discovery's `locale.supported`, which `index.html` already asks for during parse. A new parse-time script now asks the seed's question the moment that discovery answers, under the seed's own gates (no stored language choice, no cached seed), and leaves the pending response for the seed. The seed takes it once, and only when it is exactly the request it would send itself, `Accept-Language` included, so the page still sends one `me/localization` and the language it picks is unchanged. The seed's 500 ms race and its fallback, the in-flight sharing with the localization provider and the hand-off of the settled answer are unchanged. A failed parse-time discovery sends nothing early, and the seed asks as before.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/plugin-list': patch
4+
'@object-ui/plugin-grid': patch
5+
'@object-ui/components': patch
6+
'@object-ui/types': patch
7+
'@object-ui/fields': patch
8+
'@object-ui/i18n': patch
9+
---
10+
11+
feat(console): the list page's frame — a 44px page bar, a 40px view bar, a denser grid and per-column totals in the grid's own last row
12+
13+
Clause-②: no
14+
Metadata-protocol: none
15+
16+
The object list page is redrawn around two bars and a denser grid (objectstack#35548, the first card of the list-page epic):
17+
18+
- **Page bar, 44px.** The object's icon in one colour and its name on the left; ⋮ and 「+ 新建」 on the right. The object's description, Import and Favorite moved into ⋮.
19+
- **View bar, 40px.** The view switcher is one trigger on the left, reading the view type's icon, the view name, the record count and a caret (the count beside the name returns, after objectstack#34603 removed it). 「筛选」「排序」「选项」 are text buttons on the right beside the search icon, and open the same panels as before; below `sm` they stay icons. The kanban and every other view type draw the same two bars. An empty condition row under the bar takes no height.
20+
- **Grid.** A 32px header and 33px default rows, 13px on the header, the cells and the bar buttons, faint row lines, no rule after the first column, and the frozen-column shadow only once the grid scrolls sideways. The row ⋮ trigger is 24px so it fits the row. Lookup values read as small chips, money and number columns (a money formula with `returnType: 'currency'` among them) align right with tabular digits, and select labels keep their colour at lower saturation.
21+
- **Totals.** Column summaries are drawn as the table's own last row, each figure under its column (so they line up at any width and are never covered by pinned columns), led by 「计数 N」; the separate footer line and its doubled colon are gone.
22+
23+
`DataTableSchema` gains one host-only runtime slot, `summaryRow` (`{ lead?, cells }`), which `ObjectGrid` fills; like `rowGroups`, the zod face refuses it by name, so it is not authorable. New locale keys: `list.options`, `grid.summary.countLead`.

0 commit comments

Comments
 (0)