Skip to content

Commit e78313a

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/project-thread-ybjm3h
2 parents 4581139 + 5782008 commit e78313a

68 files changed

Lines changed: 4782 additions & 1611 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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@object-ui/i18n': patch
3+
---
4+
5+
feat(i18n): five Studio pillars, the data source pages and the field types move into the `studio` namespace
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
- **Fourth slice of the move ruled on objectstack#25922** (6431032267, Q2 = A; kept by 6431234244). The keys under `engine.studio.access.*`, `engine.studio.if.*`, `engine.studio.data.*`, `engine.studio.auto.*` and `engine.studio.settings.*`, the data source pages' `engine.datasource.*`, `engine.externalDatasource.*` and `engine.datasourcePreview.*`, and the field types' `engine.fieldType.*`, `engine.fieldTypeDesc.*` and `engine.fieldCategory.*` (549 keys in both `en` and `zh`) now live in `@object-ui/i18n/namespaces/studio` instead of `@object-ui/app-shell`'s private table, text unchanged. Studio reads the same strings; a Chinese viewer sees these labels in English for the moment the `zh` catalogue takes to load, as with the earlier slices. No export changes.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@objectstack/metadata-protocol': patch
3+
---
4+
5+
fix(metadata-protocol): a draft's `_diagnostics` reports what its publish will refuse (#26707)
6+
7+
Clause-②: no (the draft verdict reports more; no accepted value is refused)
8+
Metadata-protocol: none
9+
10+
A draft the runtime authoring gate refuses at publish (a flow edge whose condition does not parse, an API-triggered flow with no secret, an RLS predicate over a field the database cannot filter, a summary field with no operations, a dashboard global filter on an unknown field, a dataset `include` that names an unknown relationship) used to read `_diagnostics.valid: true` on the draft read, so the editors and the Problems tab called it valid and the refusal arrived only at Publish, where one such draft rolls back the whole package release.
11+
12+
- **One rule set.** The draft read (`GET /api/v1/meta/:type/:name?state=draft`, and the `previewDrafts` read of a pending draft) now runs the same runtime authoring gate the publish runs, on the stored draft body, with the same package scope, the same pending in-package drafts (so a reference to a sibling draft the same Publish-all lands is not an error) and the same restored credential paths. Each refusal is added to `_diagnostics.errors` with the gate's rule id as `code` and the publish's own `message`, and `valid` becomes `false`. ⛔ No rule is restated.
13+
- **The draft still saves.** No draft save is refused; publish refuses exactly what it refused before; package publish keeps its atomic rollback.
14+
- **Paths.** A gate path inside the item (`objects.invoice.fields.total.summaryOperations`) is served item-relative (`fields.total.summaryOperations`); a gate path that names a place rather than a key (a flow edge) is served as the gate wrote it.
15+
- **Not covered.** The save-door refusals (they refuse the save itself, so no stored draft carries them), the plugin authoring gates and the package build probes that `publish-drafts` runs, and the list reads and the diagnostics sweep, which keep their read-time verdicts.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@object-ui/data-objectstack': patch
3+
---
4+
5+
`ObjectStackAdapter.createView` no longer adds a top-level `data` to a ViewItem envelope (`{ name, object, viewKind, config }`). `data` belongs inside `config` there, and the platform's `view` write door now refuses a top-level key the envelope does not declare (objectstack#26711), so such a create was refused naming `data`. Before, the door dropped the key and the view saved. A flat list view still gets its default `data`, where that shape declares it. The console's own create flow writes through `createRuntimeMetadata` and was not affected.
6+
7+
Clause-②: no
8+
Metadata-protocol: none
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
'@objectstack/spec': minor
3+
---
4+
5+
fix(spec)!: the `view` write door refuses an unknown top-level key on a view item record and on an inline list or form view, as the object, page and dashboard doors do, instead of saving without it
6+
7+
`ViewMetadataSchema` judges every `view` body saved through `PUT /api/v1/meta/view/:name` (draft or publish), the MCP metadata tools and Studio. Three of its four members (the view item record `{ name, object, viewKind, config }`, and the inline list and form views that carry their config at the top level) dropped a top-level key they do not declare. The save stores the parsed body, so a misspelt or retired key answered success and was not stored. They now refuse it with `422 INVALID_METADATA` / `unrecognized_keys`, naming the key and the shape: `Unrecognized key(s) on this inline list view: \`striped\`.` The `defineView` container was already closed.
8+
9+
Clause-②: no (narrowing) — the `view` write door refuses a body carrying an undeclared top-level key on a view item record or an inline list or form view, which it saved before without the key. Nothing is widened.
10+
11+
Metadata-protocol: narrowed (a saved `view` body may no longer carry a top-level key its shape does not declare)
12+
13+
<!-- adr-0087: not-required (no-migration-prescription) No key of any schema is added, removed or renamed: the three members declared the same keys before and after, and every key the console writes and reads back is among them. An undeclared key never reached the store, since the save stores the parsed body, so there is nothing for a migration to rewrite; the author decides, and the refusal names the key. -->
14+
15+
**BREAKING** accept-set narrowing at the `view` write door (`@objectstack/spec`), served by every door that saves a `view`.
16+
17+
- **Before.** `PUT /api/v1/meta/view/:name` with a valid inline list view plus `"zzz_junk_key": true`, or a retired list key such as `"striped": true`, answered `200`, and the key was absent from the stored view. The same held for a view item record and an inline form view.
18+
- **Now.** The same body answers `422 INVALID_METADATA` with an `unrecognized_keys` issue naming the key. A retired key gets what its retirement gives it: a key whose retirement is still current (`filterableFields`, `pageName`, `tabs`, `owner`, `hidden`) raises its own prescription, as before; one whose retirement has aged out (`striped`, `bordered`, `virtualScroll`) is named and pointed at the protocol upgrade guide. `objectName` is answered with `Did you mean \`objectName\` → \`object\`?`, and a top-level `id` with `name`.
19+
- **Unchanged.** Every key the console writes and reads back on a stored view (`isDefault`, `isPinned`, `sortOrder`, `visibility`, `columnState`, `_isOverride`) is declared and saves as before. The console's row ids on `filter[]` / `sort[]` are still removed before the check. The read decorations (`_diagnostics`, `_draft`) and the server-stamped provenance (`_packageId`, `_packageVersion`, `_provenance`) are still removed by the save before it validates. `defineView` / `defineViewItem` were already closed.
20+
- **Who sees it.** An author (a person, an MCP client or an AI agent) who sends a `view` body with a key its shape does not declare. That key was not stored before. A stored view row written before the save began storing the parsed body may still carry such a key; the next save of that row through the console is refused, naming it.
21+
22+
**The remedy.** Remove the key, or move it to where it is declared: a list view setting on a view item record goes under `config`, `objectName` is `object`, a top-level `id` is `name`.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@objectstack/rest': patch
3+
---
4+
5+
fix(rest): `GET /api/v1/data/:object/:id` answers a malformed query `400`, not `404`
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The by-id route answered every refusal in the `400` band as `404`, so a malformed query on a record that exists read as "no such record": `?select=nope` and `?expand=nope` answered `404 INVALID_FIELD`, and a blank `?select=` (or `?select=,`) answered `404 VALIDATION_ERROR`. A client, or an AI agent, told `404` concludes the record is missing and stops, when the fault is its own query string. The runtime dispatcher's twin route already answered the same requests `400`.
11+
12+
The route now answers the mapped status, as every other Data API route does. The body is unchanged: the same `code`, `error`, `field` and `object` the `404` carried.
13+
14+
What still answers `404 RECORD_NOT_FOUND`, unchanged: an id that names no record, and a record the caller's row scope hides. Those two are the same answer by construction (a read that returns no row), and neither ever went through the rewrite. A `400` does not reveal whether a record exists: each one is raised before the record is read, so it is the same for any id.

‎docs/audits/2026-07-unknown-key-strictness-ledger.counts/ui.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The `strict` column is the one the campaign schedules against; it counts both th
2121

2222
| Dir | Sites | strict | passthrough | catchall | strip |
2323
|---|---|---|---|---|---|
24-
| `ui/` | 217 | 206 | 4 | 0 | 7 |
24+
| `ui/` | 217 | 208 | 4 | 0 | 5 |
2525

2626
## `ui/` — sites
2727

@@ -54,21 +54,21 @@ Per file, how many of its sites still silently discard unknown keys. The `Class`
5454
column that decides the bucket split is hand-written in the ledger; the arithmetic
5555
over it is here.
5656

57-
**7 strip of 217**, in 4 file(s).
57+
**5 strip of 217**, in 4 file(s).
5858

5959
| File | Strip | Sites |
6060
|---|---|---|
6161
| `action-params.zod.ts` | 1 | 1 |
6262
| `app.zod.ts` | 1 | 19 |
63-
| `view.zod.ts` | 4 | 59 |
63+
| `view.zod.ts` | 2 | 59 |
6464
| `widget.zod.ts` | 1 | 1 |
65-
| **total** | **7** | **217** |
65+
| **total** | **5** | **217** |
6666

6767
| Bucket | Sites |
6868
|---|---|
6969
| authorable — the ruling's forced scope | 1 |
7070
| unresolved — needs a per-schema verdict | 0 |
71-
| wire / open — out of forced scope | 4 |
71+
| wire / open — out of forced scope | 2 |
7272
| no door — no carrier, ADR-0049 territory | 1 |
7373
| no gate — carrier live, no parse | 0 |
7474
| covered — no carrier, no parse, guarded at every consumer | 1 |

‎docs/audits/2026-07-unknown-key-strictness-ledger.md‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎docs/qa/platform-checklist/areas/api-backend.json‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2789,7 +2789,7 @@
27892789
"title": "RestServerConfig.routes is an all-tombstone sub-object: every one of the four retired selectors refuses at construction with the prescription that names where the contract moved, while the empty block still constructs",
27902790
"since": "v17",
27912791
"status": "active",
2792-
"revision": 3,
2792+
"revision": 4,
27932793
"priority": "P2",
27942794
"surface": "build",
27952795
"personas": [
@@ -2861,8 +2861,8 @@
28612861
"stale-dist"
28622862
],
28632863
"automated": {
2864-
"kind": "unit",
2865-
"ref": "packages/rest/src/rest-sub-config-parse-not-cast.test.ts — per clause. acceptance[1] in full, by §B's case 'rejects `createRestApiPlugin({ api: { routes: { nameTransform: \"none\" } } }).start()` — a #14691 tombstone, through the plugin path' (§E's own plugin-path case drives batch.defaultAtomic, not a routes key). acceptance[0] by §E's 'refuses every `routes.*` key — the whole sub-object is tombstones', for one authored value per key: nameTransform is driven with 'none' only, so its former 'plural' value is driven by hand. That case matches `routes.KEY`, RouteGenerationConfigSchema and /was removed/, never the clause's full 'was removed in @objectstack/spec 17', so the release-naming half is read off the harness's refusal texts and the pin scores acceptance[0] partial. acceptance[4]'s empty-block half by §E's 'an empty `routes` sub-object still constructs — the tombstones refuse keys, not the block'; its other half, an unknown key inside `routes` stripped, is pinned for batch and metadata.endpoints only (§C's 'STRIPS an unknown key inside a sub-object rather than refusing it — the schemas are non-strict'), never for routes. No pin covers acceptance[2] (each prescription names a replacement that exists today) or acceptance[3] (the tsc error): drive them by hand"
2864+
"kind": "dogfood",
2865+
"ref": "packages/rest/src/rest-sub-config-parse-not-cast.test.ts — per clause. acceptance[1] in full, by §B's case 'rejects `createRestApiPlugin({ api: { routes: { nameTransform: \"none\" } } }).start()` — a #14691 tombstone, through the plugin path' (§E's own plugin-path case drives batch.defaultAtomic, not a routes key). acceptance[0] by §E's 'refuses every `routes.*` key — the whole sub-object is tombstones', for one authored value per key: nameTransform is driven with 'none' only, so its former 'plural' value is driven by hand. That case matches `routes.KEY`, RouteGenerationConfigSchema and /was removed/, never the clause's full 'was removed in @objectstack/spec 17', so the release-naming half is read off the harness's refusal texts and the pin scores acceptance[0] partial. acceptance[4]'s empty-block half by §E's 'an empty `routes` sub-object still constructs — the tombstones refuse keys, not the block'; its other half, an unknown key inside `routes` stripped, is pinned for batch and metadata.endpoints only (§C's 'STRIPS an unknown key inside a sub-object rather than refusing it — the schemas are non-strict'), never for routes. packages/qa/dogfood/test/rest-route-generation-tombstones.test.ts (#26572) carries what that file leaves open: acceptance[0] on a real RestServer for every key, nameTransform at 'none' AND 'plural', each refusal naming RouteGenerationConfigSchema and '`routes.KEY` was removed in @objectstack/spec 17'; acceptance[1] the same five through createRestApiPlugin(...).start(), beside a control that boots; acceptance[2] each prescription's surface — enable.apiEnabled / enable.apiMethods declared on the strict ObjectCapabilities, crud.dataPrefix moving a real RestServer's data routes, the :object path segment, and object_operation parsed by ApiEndpointSchema (the 404/405 enforcement itself is second-object-exposure.dogfood.test.ts's, over HTTP); acceptance[3] each key authored as a RestServerConfig in a scratch TypeScript file fails tsc with an error on the key's own line naming '[REMOVED] Key retired', beside a clean control; acceptance[4] routes: {} normalizing to {} and an unknown key inside routes stripped"
28662866
},
28672867
"source": [
28682868
"packages/spec/liveness/route_generation.json (the ADR-0049 ledger this item answers: all four properties dead, removed 2026-09-03 — the sub-object ships nothing but its refusals)",
@@ -2890,6 +2890,12 @@
28902890
"date": "2026-10-26",
28912891
"change": "automated.ref says which half of acceptance[0]'s message the §E case asserts, from QA run #25815 (release-18.2.0-tier1, at 6679644a), finding a0. Re-read at base f6c61932: 'refuses every `routes.*` key' asserts the key, RouteGenerationConfigSchema and /was removed/, not 'was removed in @objectstack/spec 17'; nameTransform 'none' only, as the ref already said. No clause changed",
28922892
"ref": "#25837"
2893+
},
2894+
{
2895+
"revision": 4,
2896+
"date": "2026-10-27",
2897+
"change": "acceptance[0]–[4] and negative[0] are pinned at the layers their oracles name (the release-18.2.0 Tier 1 sweep #26468 scored a0, a4 and n0 half-asserted and a2, a3 unpinned). The new rest-route-generation-tombstones.test.ts drives every retired key at every former value through the constructor and the plugin path, checks each prescription against the shipped spec and a real RestServer, runs tsc over each authored key, and holds the empty-block and unknown-key controls. automated.kind is dogfood; automated.ref names what it asserts. Measured at base 4c29f384. No clause changed",
2898+
"ref": "#26572"
28932899
}
28942900
]
28952901
},

‎packages/metadata-protocol/src/metadata-diagnostics.ts‎

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ import { zodIssuesToMetadataIssues } from './protocol.js';
3737
// landed by #8300). Composed into `decorateMetadataItem` below — see the
3838
// ordering note there for why it is not applied per read exit.
3939
import { redactMetadataItem } from './metadata-redaction.js';
40+
// [#26707] The snapshot key a write type's findings are spelled under — the
41+
// runtime gate's own answer, so the publish verdict below is re-spelled
42+
// against the same prefix the gate wrote it with.
43+
import { stackKeyForType } from '@objectstack/lint/runtime';
44+
import type { RuntimeAuthoringIssue } from '@objectstack/spec/api';
4045

4146
/**
4247
* Re-export the canonical validation-result type so callers in this
@@ -316,6 +321,64 @@ export function decorateMetadataItems<T>(type: string, items: T[]): T[] {
316321
return items.map((item) => decorateMetadataItem(type, item));
317322
}
318323

324+
// ---------------------------------------------------------------------------
325+
// [#26707] The publish verdict on a draft's `_diagnostics`
326+
// ---------------------------------------------------------------------------
327+
328+
/**
329+
* A runtime-gate finding's path, re-spelled relative to the item it was found
330+
* on: the gate spells it inside its private per-write snapshot
331+
* (`flows[0].edges[1].condition`, `objects.invoice.fields.total`), and
332+
* `_diagnostics` paths are dotted and item-relative (`edges.1.condition`), the
333+
* spelling Studio's inline errors and canvas badges resolve. A path that does
334+
* not start at the written item (a finding located on a sibling, or a `where`-
335+
* style locator) is kept as the gate wrote it.
336+
*/
337+
function itemRelativeIssuePath(type: string, name: string, path: string): string {
338+
const stackKey = stackKeyForType(PLURAL_TO_SINGULAR[type] ?? type);
339+
if (!stackKey) return path;
340+
let rest: string | undefined;
341+
for (const prefix of [`${stackKey}[0]`, `${stackKey}.${name}`]) {
342+
if (path === prefix || path.startsWith(`${prefix}.`) || path.startsWith(`${prefix}[`)) {
343+
rest = path.slice(prefix.length);
344+
break;
345+
}
346+
}
347+
if (rest === undefined) return path;
348+
return rest.replace(/\[(\d+)\]/g, '.$1').replace(/^\./, '');
349+
}
350+
351+
/**
352+
* Fold what publishing a draft would refuse into the draft's `_diagnostics`.
353+
*
354+
* `issues` are the runtime authoring gate's refusal for the draft body —
355+
* `ObjectStackProtocolImplementation#draftPublishVerdict`, the judgement the
356+
* publish door enforces — and each becomes one `errors[]` entry carrying the
357+
* publish's own `message`, with its `rule` id as the entry's `code`. Any of
358+
* them makes the verdict `valid: false`: the draft is still stored, but it does
359+
* not say it is valid while the publish says it is not. No issues: the schema
360+
* verdict is returned as it was. A type with no schema verdict (`undefined`)
361+
* gets one only when there is something to report.
362+
*/
363+
export function withPublishVerdict(
364+
type: string,
365+
name: string,
366+
diagnostics: MetadataDiagnostics | undefined,
367+
issues: readonly RuntimeAuthoringIssue[],
368+
): MetadataDiagnostics | undefined {
369+
if (issues.length === 0) return diagnostics;
370+
const refusals = issues.map((issue) => ({
371+
path: itemRelativeIssuePath(type, name, issue.path),
372+
message: issue.message,
373+
code: issue.rule,
374+
}));
375+
return {
376+
...diagnostics,
377+
valid: false,
378+
errors: [...(diagnostics?.errors ?? []), ...refusals],
379+
};
380+
}
381+
319382
// ---------------------------------------------------------------------------
320383
// ADR-0047 — reference-integrity diagnostics for list views
321384
// ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)