You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f2ca884
Browse filesBrowse the repository at this point in the historyBrowse files
docs(skills): teach the grouping fields a grid refuses, the ungranted hook body call and updateById under api.write (#39031)
Part of #38655
Clause-②: no
Metadata-protocol: none
This PR lands the two pages that fit their token ceilings and the first
`actions.md` item. Two `actions.md` items stay open on the card, because
that file has no restatement left to pay for them:
`action-body-capability-undeclared`, and the identity-assignment write
an action body is refused. Their text is written and pushed on the
backup branch `claude/issue-38655-skills-save-refusals-wip` (`8b30ebeb`,
no PR); see Acceptance notes.
## 维护者速读
- 用户能看到什么变化:照技能包让 AI
写应用的人,在列表分组、数据钩子和动作按钮三处,会先读到哪些写法在保存时被拒、该怎么改;此前技能包没写,要到保存被拒才知道。
- 为什么做:平台新增了三条保存期拒绝,技能包教的比平台拒的少;这是替照技能包写配置的 AI 作者补上。
- 出错会怎样:最坏是某句教学写错,AI 作者照着写出仍被拒的配置;只改文字,可直接撤回。
- 要你做什么:审阅这三页的文字改动。
## What changes
Text only, in three published skill pages. Each sentence follows the
merged rule explanation in `packages/lint/src/rule-explanations/`
(`list-view-field-refs.ts`, `record-writes.ts`), read at `444dce61`.
- `skills/objectstack-ui/rules/list-views.md`, Grouping: on a grid (the
default `type`) a grouping level's `field` is a stored single-valued
field of the object. A multi-valued, JSON-stored or `formula` field is
refused at validate and publish as `list-view-group-field-ungroupable`
(show it as a column). Dotted grouping is on main, so the same sentence
covers it: a dotted path is refused as `list-view-field-dotted` (group
by the lookup itself).
- `skills/objectstack-data/references/data-hooks.md`, Capabilities: a
hook body call whose token is missing is refused at save as
`hook-body-capability-undeclared` (an error from `os validate`, `os
build`, `os lint` and a runtime save, `422 INVALID_METADATA`); add the
token the message names, or remove the call. The paragraph names the
spellings the rule reads, and the token table under it is the list the
rule judges. Its `api.write` row now lists every write leaf the sandbox
gates, `updateById(id, patch)` included.
- `skills/objectstack-ui/rules/actions.md`, opening paragraph: a body
writes through `ctx.api.object(X).update(...)` or `.updateById(id,
patch)` under `api.write`; without the grant the write is refused at
save (`action-body-write-capability-undeclared`, which the page already
named).
- `.changeset/38655-skills-save-refusals.md`: `@objectstack/skills`
patch, with the list of what was deleted to pay for each addition.
Skills size, both readings (tokens are the ratchet's own count):
| File | Lines before | Lines after | Bytes before | Bytes after |
Tokens before | Tokens after |
|:--|--:|--:|--:|--:|--:|--:|
| `rules/list-views.md` | 407 | 409 | 18035 | 18035 | 4509 | 4509 |
| `rules/actions.md` | 271 | 270 | 15669 | 15669 | 3918 | 3918 |
| `references/data-hooks.md` | 851 | 847 | 40480 | 40477 | 10120 | 10120
|
| Every `SKILL.md`, summed | 2144 | 2144 | | | | |
| Every `.md` under `skills/` | 17093 | 17090 | | | | |
| Ratcheted bundle | | | | | 182270 | 182270 |
No ceiling row moves. Each addition is paid for by deletion in its own
file; the changeset lists every cut.
Read first, by risk:
1. `skills/objectstack-data/references/data-hooks.md`, the Capabilities
hunk: the reworded paragraph is the one place an existing sentence
changed meaning order (the save refusal now comes before the sandbox
throw). The cuts in this file are the "What Are Hooks?" heading with its
one sentence, and the Status row of the `body` / `handler` table.
2. `skills/objectstack-ui/rules/list-views.md`, the Grouping hunk, then
the `userFilters` hunk: it drops "and the `validate` list-view-mode lint
reports it" after the parse rejection.
3. `skills/objectstack-ui/rules/actions.md`, the new-tab warning: it no
longer names the `ActionParam[]` type.
Two-minute verification: `node scripts/check-skills-token-ratchet.mjs`
prints the three files at `4509`, `10120` and `3918` tokens with
headroom 0 and ends on its `✓` line.
## Tests
No package source changes, so no package test or typecheck is owed. No
behaviour a test pins changed, so no ablation.
## Acceptance notes
- Held, not in this PR: the two remaining `actions.md` items. With them
the file measures 16206 bytes, 4052 tokens, against a ceiling of 3918
(+134), after the one cut the file offers. The ratchet's earlier notes
on this row say the same ("Nothing else in the file restates another
passage"). Moving the row is outside this card's claimed file surface,
so the text waits on the backup branch named above.
- `data-hooks.md`: the method table under "the cross-object repo" still
lists `update` and not `updateById`; the `api.write` token row now names
it. Not widened here.
- `check:closed-ceremony-text` crashes locally in its self-test with
`spawnSync git ENOBUFS` (the tracked-file listing overflows the default
buffer in this container). Not measured locally; CI reads it.
## Verification
Local run at `e284151c`, the derived list of `node
scripts/pm/dispatch-gates.mjs --commands` (51 commands).
<details><summary>Gate readings</summary>
- Exit 0 (46 of 51): `check-skills-token-ratchet` and its self-test,
`check:skill-refs`, `check:skill-served-sections`, `check:skill-links`,
`check:skill-identifier-liveness`, `check:skill-compatibility`,
`check:skill-frame-sync`, `check:doc-authoring`,
`check:doc-formula-expressions` (after building its closure),
`check:pm-skill-id-lint`, `check:role-word`, `check:nul-bytes`,
`check:published-files`, `check-empty-changeset`,
`check-changeset-no-major`, `check-adr-0087-registration`,
`check:changeset-gate-self-tests`, `check-comment-mask-corpus` (24733
files, 0 disagree; a second run with a longer limit after the first
timed out), and the remaining whole-tree and self-test commands on the
list.
- NOT MEASURED, prerequisite not met (exit 3, no full build in this
worktree): `check:dts-closure`, `check:dual-build-cjs-loads`,
`check:lean-entry-closure`, `check:sourcemap-no-sources-content`.
Reason: they read built output of every package; this diff touches no
package. CI runs them.
- NOT MEASURED: `check:closed-ceremony-text` (the crash above), and
`check:skill-examples` (outside the derived list; needs the client SDK
built; no checked example block changed).
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzhKEbEnW8pwZRgK2gJ)_
<!-- signed: repo:objectstack@os-support-ai · os-support-ai ·
session_01WGufzhKEbEnW8pwZRgK2gJ -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
docs(skills): the published skills teach three refusals the save door makes: a grid grouping field the engine does not group by, a hook body call without its capability token, and `updateById` under `api.write`
6
+
7
+
Clause-②: no
8
+
Metadata-protocol: none
9
+
10
+
Text only: no schema, rule or runtime behaviour changes here. Each sentence follows the rule's own explanation (`os explain RULE`).
11
+
12
+
`skills/objectstack-ui/rules/list-views.md`, Grouping: on a grid (the default `type`) a grouping level's `field` is a stored single-valued field of the object. A multi-valued field (`multiselect`, `checkboxes`, `tags`, `multiple: true`), a JSON-stored one (`json`, `address` and the like) or a `formula` field is refused at validate and publish as `list-view-group-field-ungroupable`; the fix is to show the field as a column. A dotted path (`account.name`) is refused as `list-view-field-dotted`; the fix is to group by the lookup itself.
13
+
14
+
`skills/objectstack-data/references/data-hooks.md`, Capabilities: a hook body call whose token is missing from `body.capabilities` is refused at save as `hook-body-capability-undeclared`, an error from `os validate`, `os build`, `os lint` and a runtime save (`422 INVALID_METADATA`); the fix is to add the token the message names, or remove the call. The paragraph says which spellings the rule reads (a call on `ctx`, on a local bound once to it, on a handle bound once to `.object(…)`) and that a call spelled another way still throws in the sandbox. The `api.write` row lists every write leaf the sandbox gates: `insert`, `update`, `updateById(id, patch)`, `delete`, `updateMany`, `deleteMany`, `upsert`.
15
+
16
+
`skills/objectstack-ui/rules/actions.md`, opening paragraph: an action body writes through `ctx.api.object(X).update(...)` or `.updateById(id, patch)`, both under `api.write`, and without that grant the write is refused at save (`action-body-write-capability-undeclared`).
17
+
18
+
No file grows: each addition is paid for by deletion in its own file, so the three token counts stay 4509, 10120 and 3918.
19
+
20
+
-`list-views.md`: the view-switcher consequence of a bare flat view object; the lead-in sentence of Data Source; two words of each Columns comment; "still ANDed with the elements beside it" (the paragraph opens with "elements must all match"); the `userFilters` lead-in's list of elements (the block under it names them); the comment over `appearance`; that the list-view-mode lint also reports a `tabs` element the parse rejects; the second pointer to objectstack-data Search Fields and to Inline Editing (each is named a few lines above); "you almost never need a custom page" (item 2 says when a page is used).
21
+
-`data-hooks.md`: the "Reference companion" line under the contents list; the "What Are Hooks?" heading and its one sentence (the two tables under it say when a hook runs); the Status row of the `body` / `handler` table (its header marks `handler` deprecated); a comment in the `input` example; "the layout both real hook modules in the repo use".
22
+
-`actions.md`: the new-tab warning no longer names the `ActionParam[]` type, and keeps "user input only".
| `api.transaction` | `ctx.api.transaction(async () => { … })` — runs the callback's `ctx.api` ops in **one transaction on the default datasource**: commit on return, rollback on throw. A write in it to an object on another datasource is refused before it runs (`400 ERR_CROSS_DATASOURCE_TRANSACTION_WRITE`), except an append-only ledger (`lifecycle.class` `audit` / `telemetry` / `event`), written outside the unit and surviving its rollback. Inside a unit already open (the hook's write's, a caller's, or one an action body opened with `ctx.api.transaction`) it **joins** that unit: its return is no commit and its throw no rollback; the outer unit commits or rolls back all of it, so a throw the body catches keeps the callback's writes. Hooks of a write made inside a body's transaction run in that unit, and their `ctx.api` writes and own `ctx.api.transaction` join it. One level per body: a nested call is refused ("nested ctx.api.transaction is not supported"). On PostgreSQL and a MongoDB replica set a failed statement aborts the whole unit, even when caught. A driver with no transactions runs the callback with none and no warning: each write is stored as made, and a throw undoes none. Pair it with `api.write`. |
0 commit comments