Skip to content

Commit 3b4a693

Browse files
committed
wip(spec): the stored-shape listing test types, and the changeset
Claude-Session: https://claude.ai/code/session_01P6EWuSSDC4q1RNpSTNbyCU Co-authored-by: Claude <noreply@anthropic.com>
1 parent 4e4776c commit 3b4a693

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@objectstack/spec': patch
3+
'@objectstack/metadata-protocol': patch
4+
---
5+
6+
fix(spec): `os migrate meta --stored` lists a stored object bound `external` to a stored or registered managed datasource
7+
8+
Clause-②: yes (widening)
9+
10+
Metadata-protocol: none
11+
12+
The stored-shape listing for `object-external-binding-managed-datasource-refused` resolved an object's named datasource only from the stack being converted. A stored object row reaches the conversion chain alone, so the listing judged only a binding on the primary datasource (`'default'`), while the object save door also refuses one on a datasource stored or registered beside the object. The stored-metadata pass therefore did not list a stored object row bound `external` to a managed datasource, the row whose next save is refused with `422 INVALID_METADATA`.
13+
14+
- **Now:** for each stored `object` row carrying `external` and naming a datasource, the pass reads that datasource the way the object save door does (the environment's stored row, else the definition the code layer registers; both go through one read) and hands it to the chain. The row is listed under `rows[].todos` with this entry's id exactly when that door refuses its next save. A datasource declared `schemaMode: 'external'` or `'validate-only'`, and a datasource no layer holds, give no listing, as at the door. Nothing is rewritten.
15+
- **`@objectstack/spec`:** `ApplyConversionsOptions` (and so `StoredConversionOptions` for `applyConversionsToStoredItem`) gains an optional `knownDatasources`, a map of datasource definitions by name that the caller's door can see beyond the stack. Only the refused-shape listing reads it, so only when an `onTodo` sink is passed. A datasource the stack declares is read from the stack first. Without it, behaviour is unchanged.

‎packages/spec/src/conversions/refused-shapes.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ describe('#25279 — a stored object bound `external` to a datasource the caller
544544
const listed = (todos: ConversionTodoNotice[]) =>
545545
todos.filter((t) => t.conversionId === 'object-external-binding-managed-datasource-refused');
546546

547-
it.each([
547+
it.each<[string, Record<string, unknown>]>([
548548
["declared `schemaMode: 'managed'`", { name: 'warehouse', driver: 'sqlite', config: {}, schemaMode: 'managed' }],
549549
['declaring no `schemaMode` (managed by the spec default)', { name: 'warehouse', driver: 'sqlite', config: {} }],
550550
])('a stored row on a known datasource %s is listed, once, and not rewritten', (_label, datasource) => {

0 commit comments

Comments
 (0)