Skip to content

Commit 8111c0d

Browse files
committed
docs(skills): name the two driver-layer tenantId symbols in the two-axes note
Contract review should-fixes on the save-notice rows: the two-axes note in references/data-hooks.md now carries execCtx.tenantId / DriverOptions.tenantId, which the deleted blockquote had named; paid by the session.roles history clause and two bytes of punctuation in the new rows. The ratchet row comment states the net move instead of per-piece counts. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibx4SVi1CLmwbLz82b7
1 parent 79305e9 commit 8111c0d

2 files changed

Lines changed: 12 additions & 9 deletions

File tree

‎scripts/check-skills-token-ratchet.mjs‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -681,11 +681,13 @@ export const CEILINGS = new Map([
681681
// headings); the row carried 2,727 tokens of headroom left by an earlier
682682
// shrink that nobody re-locked, so the TOC needed no raise. Pinned AT the
683683
// measurement — zero headroom, the ratchet's steady state.
684-
// 10066 -> 10011: re-locked at the landed count. A `ctx.notice` row in the sandbox
685-
// table and a `notice?` member in the HookContext listing (+95), paid by three
686-
// same-file restatements: the reverse-engineering aside in the `body` intro, the
687-
// `tenantId` blockquote (the listing comment and the two-axes note say both
688-
// halves) and the `ctx.user` paragraph under the `??` line that shows it (-141).
684+
// 10066 -> 10011: re-locked at the landed count (main measured 10056; the
685+
// move is -45). A `ctx.notice` row in the sandbox table and a `notice?` member
686+
// in the HookContext listing, paid by same-file restatements: the
687+
// reverse-engineering aside in the `body` intro, the `tenantId` blockquote
688+
// (its two halves live in the listing comment and the two-axes note, which
689+
// now names the two `tenantId` symbols), the `ctx.user` paragraph under the
690+
// `??` line that shows it, and the `session.roles` history clause.
689691
['skills/objectstack-data/references/data-hooks.md', 10011],
690692
['skills/objectstack-data/rules/datasources.md', 911],
691693
// -552 (was 3584): re-locked at the landed count (#16374) after PR #16187

‎skills/objectstack-data/references/data-hooks.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,13 +358,13 @@ The sandbox is handed a **JSON snapshot** of these (built by
358358
| `ctx.previous` | object \| `undefined` | Pre-write record on update/delete. **`undefined` on insert** → use `!ctx.previous` to detect *create*. |
359359
| `ctx.result` | object \| `undefined` | `after*` only. ⚠️ **partial** on afterUpdate — see gotcha 1. |
360360
| `ctx.user` | object \| `undefined` | `{ id, name, email, organizationId }`. `undefined` for system / unauthenticated writes. |
361-
| `ctx.session` | object \| `undefined` | `{ userId, organizationId, isSystem, … }`. **No role list** — `session.roles` was retired in 17.0.0: it was declared but never produced, so every read was `undefined`. |
361+
| `ctx.session` | object \| `undefined` | `{ userId, organizationId, isSystem, … }`. **No role list** — `session.roles` was retired in 17.0.0 (declared, never produced). |
362362
| `ctx.event` | string | e.g. `'afterUpdate'` — dispatch on it when one hook subscribes to several events. |
363363
| `ctx.object` | string | The target object name. |
364364
| `ctx.api` | object | Cross-object CRUD. Gated by `api.read` / `api.write` — see below. |
365365
| `ctx.log` | `{ debug, info, warn, error }` | Gated by `log`. Call **`ctx.log.info(msg, data?)`** — `ctx.log` is an **object, not** callable as `ctx.log(msg)`. Emission is **best-effort** (see Troubleshooting). |
366366
| `ctx.crypto` | `{ randomUUID }` | Gated by `crypto.uuid`. |
367-
| `ctx.notice` | `(message) => void` | **Tell the saver what this save set in motion** — answered as the create/update `notice`, shown on the save toast. No capability; insert/update only; last call wins. Rules: [`rules/lifecycle.md` § Save Notice](../rules/lifecycle.md#save-notice). |
367+
| `ctx.notice` | `(message) => void` | **Tell the saver what this save set in motion** — answered as the create/update `notice`, shown on the save toast. No capability; insert/update only; last call wins. [`rules/lifecycle.md` § Save Notice](../rules/lifecycle.md#save-notice). |
368368
| `ctx.title` | `(field?) => Promise<string \| null>` | **Name the record, not its id.** `ctx.title()` resolves this object's `nameField`, a **formula** included (no extra read); `ctx.title('account_id')` resolves a lookup's title (needs `api.read`). `null` when there is no title, never the id. **Per door:** `body` has it; a deprecated `handler` gets it at runtime, undeclared on `HookContext` (TS2339 when annotated) — use `body`; `ql.registerHook` and a bare `ObjectQL` `bindHooks` lack it. |
369369

370370
(Action bodies additionally receive `ctx.recordId` and `ctx.record`, and their
@@ -598,7 +598,7 @@ interface HookContext {
598598
// Engine access
599599
ql: IDataEngine; // ObjectQL engine instance
600600
api?: ScopedContext; // Cross-object CRUD API
601-
notice?: (message: string) => void; // Save notice — rules/lifecycle.md § Save Notice
601+
notice?: (message: string) => void; // Save notice: rules/lifecycle.md § Save Notice
602602

603603
// User info shortcut (undefined for system / unauthenticated writes)
604604
user?: {
@@ -630,7 +630,8 @@ const org = ctx.user?.organizationId ?? ctx.session?.organizationId;
630630
> ADR-0132). That is different from
631631
> **environment / database-per-tenant** isolation (`service-tenant`,
632632
> `driver-turso`), where "tenant" means an entire environment/database and the
633-
> generic driver-layer `tenantId` knob can carry that environment id. The
633+
> generic driver-layer `tenantId` knob (`execCtx.tenantId` / `DriverOptions.tenantId`)
634+
> can carry that environment id. The
634635
> object-metadata `tenancy.*` knob configures the *mechanism* (isolation on/off
635636
> + which column); the *value* you read and write is your `organization_id`
636637
> column. Under `single` the bootstrapped Default Organization is the only

0 commit comments

Comments
 (0)