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 b49a264
Browse filesBrowse the repository at this point in the historyBrowse files
docs(skills): teach transferBehavior, the Change Owner cascade, in the data skill (#37076)
repo:objectstack#4 · os-justin · session_01QSeKYo86w1wqy2z2fMrryr
Fixes#36713
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户能看到什么变化:AI 助手在建数据模型时,知道可以让「更换负责人」连带移交子记录,并知道哪些写法会被拒绝;此前它不知道有这个设置。
- 为什么做:属于「技能包教学」这条线,是「更换负责人连带移交」功能落地后欠下的教学补齐。
- 出错会怎样:AI 可能照着教学写出系统拒收的设置,保存时当场报错;可以直接撤回,只是文字改动。
-
要你做什么:批准合并。只改技能文字和一道评测题;按需人工批准处理,是因为契约审核判它「涉及权限」:教的是「更换负责人」连带移交子记录,负责人决定谁能看到记录。它没有放宽任何检查,也没有教授权写法。契约审核
PASS:记录 7141869539,Head-sha `84459523cd70acc86a20162638981d7e2a1a6473`。
## What changes
- `skills/objectstack-data/rules/relationships.md`, Delete Behaviors:
one paragraph teaches `transferBehavior: 'cascade'` on a child's
`lookup` / `master_detail`. It says what the parent's Change Owner
dialog then offers (moving the child rows the parent's previous owner
owns), that the default is `'none'`, when to declare it, and the parse
refusals in one sentence.
- `skills/objectstack-data/rules/field-types.md`: `transferBehavior` is
listed in the Key Config cell of the `lookup` and `master_detail` rows.
- `skills/objectstack-data/evals/objects-fields-relationships.json`: one
case (id 28) that asks for the declaration in place of an
owner-rewriting hook, and where it is refused.
- One `@objectstack/skills` patch changeset.
The refusals taught are the ones the merged code makes (read on main at
896bfc4, `packages/spec/src/data/field.zod.ts`, `object.zod.ts` and
`user-action-transfer.ts`): the key on any type but `lookup` /
`master_detail` (an authored `'none'` too); `'cascade'` on a reference
to a `sys_` object; `'cascade'` with `multiple: true`; `'cascade'` on a
field of an object that does not offer Change Owner itself (not
structurally eligible, a `controlled_by_parent` detail, or
`userActions.transfer` off).
### Paid for in the same files (no ceiling row moved, the ratchet script
is not edited)
- relationships.md: the two "Incorrect" code blocks become one sentence
each (each block restated the pattern above it); two `required: false`
lines the Relationship Types table already states as the default; two
code comments that repeated the `name:` under them; and three prose
repeats in the inline-edit part.
- field-types.md: the autonumber example in the Calculated row, which
the Autonumber section gives; "embedded" twice in the Embedded table,
which its heading and lead sentence already say.
| File | Lines before / after | Tokens before / after | Ceiling |
Headroom |
|:--|:--|:--|:--|:--|
| `rules/relationships.md` | 401 / 389 | 4202 / 4201 | 4203 | 2 |
| `rules/field-types.md` | 270 / 270 | 3540 / 3539 | 3541 | 2 |
| `evals/objects-fields-relationships.json` | 491 / 506 | 8588 / 8922 |
not ratcheted | n/a |
| whole `skills/objectstack-data` bundle | 4715 / 4718 | 62592 / 62923
(bytes 250366 / 251692) | n/a | n/a |
Net lines in `skills/**`: +3 (budget +10). Without the eval fixture the
bundle shrinks: 3779 / 3767 lines, 175356 / 175348 bytes.
## Tests
No package source changes, so there is no package test to run. The gates
that read these files, at 8445952:
- `node scripts/check-skills-token-ratchet.mjs`: exit 0, `60 authored
bundle file(s) within their ceilings`.
- `pnpm --filter @objectstack/spec run check:skill-served-sections`:
exit 0, 24 served sections (the Roll-up Summaries section this file
serves is untouched).
- `node ui/scripts/check-skill-eval-tokens.mjs`: exit 0, `Every
must_contain token is taught by its own skill bundle.`
- `pnpm check:skill-links`, `check:skill-identifier-liveness`,
`check:skill-compatibility`, `check:skill-frame-sync`,
`check:doc-authoring`, `check:nul-bytes`: exit 0.
## Acceptance notes
- `evals/README.md` lists what the fixture covers and does not name the
new case; it is outside this card's file surface.
- Open PR #36158 raises both ceilings and, merged with today's main
alone, already reads 4347 tokens against its own 4343 row for
relationships.md. Merged with this branch it reads 4346. That gap is not
from this change, which removes 4 bytes.
- Combined with open PR #37072 (head cd69066): relationships.md 16798
bytes, 4200 tokens, ceiling 4203; field-types.md 14156 bytes, 3539
tokens, ceiling 3541.
## Verification
Read first, by risk:
1. `skills/objectstack-data/rules/relationships.md`, the new paragraph
before "Roll-up Summaries": every refusal named there against the merged
schema.
2. The same file, "Incorrect vs Correct": two code blocks reduced to a
sentence each.
3. `skills/objectstack-data/rules/field-types.md`, the Relational table
rows.
Two-minute check: `node scripts/check-skills-token-ratchet.mjs` exits 0
and prints headroom 2 for both rule files.
<details>
<summary>Gate readings at 8445952</summary>
- `node scripts/pm/dispatch-gates.mjs --ran`: `✓ dispatch-gates --ran:
48 derived famil(ies) accounted for — 43 run, 5 NOT-MEASURED (5 DERIVED
from a recorded exit 3).`
- NOT MEASURED locally (exit 3, PREREQUISITE NOT MET: no built `dist/`
in this worktree; none reads a file this diff changes; CI runs them):
`check:doc-formula-expressions`, `check:dts-closure`,
`check:dual-build-cjs-loads`, `check:lean-entry-closure`,
`check:sourcemap-no-sources-content`.
- `node scripts/pm/overlap-check.mjs`: `VERDICT clean exit 0` against
origin/main, #37072 and #36158.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QSeKYo86w1wqy2z2fMrryr)_
<!-- signed: repo:objectstack#4 · os-justin ·
session_01QSeKYpEsWWE9Y5YtSsDgqZ -->
Co-authored-by: Claude <noreply@anthropic.com>
docs(skills): the data skill teaches `transferBehavior`, the Change Owner cascade of a relationship
6
+
7
+
Clause-②: no
8
+
Metadata-protocol: none
9
+
10
+
objectstack-data's `rules/relationships.md`, Delete Behaviors: one paragraph says what `transferBehavior: 'cascade'` on a child's `lookup` / `master_detail` does (the parent's Change Owner dialog offers to move the child rows its previous owner owns too), when to declare it, that the default is `'none'`, and where parse refuses it: the key on any other type, and `cascade` on a `sys_*` reference, on `multiple: true`, and on a child that does not offer Change Owner itself, such as a `controlled_by_parent` detail. `rules/field-types.md` lists the key on the `lookup` and `master_detail` rows. `evals/objects-fields-relationships.json` gains one case. The new text is paid for by removing restatement in the same files: in relationships.md the two "Incorrect" code blocks become one sentence each, and two `required: false` lines and five comment or prose repeats go; in field-types.md the autonumber example that the Autonumber section already gives and two "embedded" repeats go.
Copy file name to clipboardExpand all lines: skills/objectstack-data/evals/objects-fields-relationships.json
+15Lines changed: 15 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -486,6 +486,21 @@
486
486
"overrides:"
487
487
]
488
488
}
489
+
},
490
+
{
491
+
"id": 28,
492
+
"prompt": "When a sales manager changes the owner of an `account`, the Change Owner dialog should offer to hand the account's `opportunity` records that the old owner owns to the new owner too. `opportunity.account` is a `lookup` to `account`. A colleague proposes a hook on `account` that rewrites `owner_id` on its opportunities. What do we declare instead, and where is that declaration refused?",
493
+
"expected_output": "No hook: declare the cascade on the child's reference field, beside `deleteBehavior`: on `opportunity`, `account: { type: 'lookup', reference: 'account', transferBehavior: 'cascade' }`. The account's Change Owner dialog then offers that relationship, and moves the opportunities the account's previous owner owns; the default `'none'` leaves them with their owner. The key is refused at parse on any type but `lookup` / `master_detail`; `cascade` is also refused on a reference to a `sys_*` object, on a `multiple: true` field, and on a child object that does not offer Change Owner itself, such as a `controlled_by_parent` detail.",
|`master_detail`| Parent–child with lifecycle control |`reference`, `deleteBehavior` (`cascade`/`restrict` — `set_null` is refused), `transferBehavior`, `lookupAutofill`|
94
94
|`tree`| Hierarchical self-reference |`reference` — optional; when written, this object's own name (any other object is refused at parse) |
95
95
|`user`| Person picker — a lookup specialized to `sys_user` (reviewer, watchers). Stored identically to `lookup`|`multiple` (collaborators), `defaultValue: 'current_user'`, `deleteBehavior` (no default; declared, as on `lookup`: relationships.md → Delete Behaviors) |
96
96
@@ -122,8 +122,8 @@ Stored as JSON on the parent row, no separate table/FK:
122
122
123
123
| Type | When to Use |
124
124
|:-----|:------------|
125
-
|`composite`| Single embedded JSON object, **untyped**: a field declares no sub-fields (`fields`/`subFields` are refused) |
126
-
|`repeater`|Embedded JSON **array**, **untyped**: no sub-fields or `columns`; a typed list is a `master_detail` child a parent `fieldGroups[].relatedList` names |
125
+
|`composite`| Single JSON object, **untyped**: a field declares no sub-fields (`fields`/`subFields` are refused) |
126
+
|`repeater`| JSON **array**, **untyped**: no sub-fields or `columns`; a typed list is a `master_detail` child a parent `fieldGroups[].relatedList` names |
127
127
|`record`| Name-keyed **map** of embedded sub-objects (insertion order = display order; ADR-0007) |
128
128
129
129
## Calculated
@@ -132,7 +132,7 @@ Stored as JSON on the parent row, no separate table/FK:
132
132
|:-----|:------------|:-------|
133
133
|`formula`| Computed on read: neither aggregatable nor a dataset or cube dimension (group key); both need a stored field of its return type with the same `expression` (objectstack-ui → Dashboards → Dataset-Bound Widgets) that reads only its own row (relationships.md → Computed column) |`expression` (CEL, `record.` prefixes), `returnType` (`'number' \| 'text' \| 'boolean' \| 'date' \| 'currency'`); `'currency'` carries its own `currencyConfig`|
134
134
|`summary`| Roll-up aggregation from child records |`summaryOperations` ({ object, field? (omit for `count`), function, relationshipField?, filter? }) |
0 commit comments