Skip to content

Commit 5dd8c0a

Browse files
committed
docs(skills): the datasources rule states default is host-reserved, connected from OS_DATABASE_URL, and refused in a stack's datasources
skills/objectstack-data/rules/datasources.md L5-6 read "Most apps need only the `default` datasource; declare more to read/write a separate or external database" — an invitation to the shape the stack's `datasources` collection refuses (`defineStack`, `os validate`, publish) and AppPlugin refuses at boot. The sentence now states the rule the spec and runtime hold: `default` is host-reserved, the host connects it from `OS_DATABASE_URL`, a stack that declares a datasource named `default` is refused, and a datasource is declared under its own name only for a separate or external database. Token ratchet paid inside the file by deleting two restatements of the field reference: "`external` settings are required when `schemaMode !== 'managed'`" (the schema's own superRefine refuses the omission) and "Set `autoConnect: true` to force a live connection" (item 3 of the auto-connect list above it). 903/911 tokens before and after; 80 lines before and after. Changeset: @objectstack/skills patch — skills/** ships through packages/skills dist via sync-catalog. Claude-Session: https://claude.ai/code/session_01VqGhCg9wdsBXPz54uAEWg7 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 0b1179f commit 5dd8c0a

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): the `objectstack-data` datasources rule states that `default` is host-reserved — the host connects it from `OS_DATABASE_URL`, and a stack that declares a datasource named `default` is refused (#23768)
6+
7+
Clause-②: no
8+
9+
`skills/objectstack-data/rules/datasources.md`'s opening paragraph read "Most apps need only the `default` datasource; declare more to read/write a separate or external database." "Declare more" implied that `default` is declared too, and a stack whose `datasources` collection carries an entry named `default` is refused at `defineStack`, `os validate`, publish and boot: the host declares and connects `default` itself. The sentence is replaced by the rule the spec and runtime hold: `default` is host-reserved, the host connects it from `OS_DATABASE_URL`, a stack that declares a datasource named `default` is refused, and a datasource is declared under its own name only to read/write a separate or external database. The added words are paid for inside the same file by deleting two restatements of the field reference: "`external` settings are required when `schemaMode !== 'managed'`" (the schema refuses the omission itself) and "Set `autoConnect: true` to force a live connection" (the auto-connect list two lines above already names it). No behaviour changes; nothing an author writes changes.

‎skills/objectstack-data/rules/datasources.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
A **datasource** (`defineDatasource`, a `*.datasource.ts` metadata file) is a
44
connection to a data store. Objects route to one via their `datasource` field
5-
(default: `'default'`). Most apps need only the `default` datasource; declare more
6-
to read/write a **separate** or **external** database.
5+
(default: `'default'`). `default` is host-reserved: the host connects it from
6+
`OS_DATABASE_URL`, and a stack that declares a datasource named `default` is
7+
refused. Declare a datasource under its own name only to read/write a
8+
**separate** or **external** database.
79

810
Full field reference: `node_modules/@objectstack/spec/src/data/datasource.zod.ts`.
911

@@ -15,8 +17,6 @@ Full field reference: `node_modules/@objectstack/spec/src/data/datasource.zod.ts
1517
| `external` | A mature external DB ObjectStack does **not** own; DDL forbidden; boot mismatch **fails**. |
1618
| `validate-only` | Like `external`, but a mismatch **warns** instead of failing boot. |
1719

18-
`external` settings are **required** when `schemaMode !== 'managed'`.
19-
2020
## Federated (external) objects
2121

2222
An object on an external datasource binds to its remote table via `external`:
@@ -55,7 +55,7 @@ objects' read metadata registered **automatically at boot** — no `onEnable` /
5555
4. a **`datasourceMapping` rule routes at least one object to it**.
5656

5757
A `managed` datasource that nothing routes to stays **metadata-only** — visible but
58-
not connected. Set `autoConnect: true` to force a live connection.
58+
not connected.
5959

6060
⚠️ A `datasourceMapping` rule is **routing, not a hint**. A rule pointing at a
6161
datasource that cannot be connected fails the boot, and a query against a mapped

0 commit comments

Comments
 (0)