Repository navigation
Commit 038ccf5
docs(adr,skills): ADR-0163 records the two-tier field write lock; objectstack-data teaches the four locks (#38428)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4Uu8dhiDUf1jDKZiZnYduzapm)_
Fixes #37405
Clause-②: no (no accept set or export changes; governed rules text, so
one contract-review-tier review before the queue; Tier H)
Metadata-protocol: none
## 维护者速读
- 用户能看到什么变化:给应用建数据模型的人和
AI,现在能从技能里学到「锁定一个字段」的四种写法各在什么时候用(比如销售订单的状态只让「确认」按钮改、不让人手改);把两种锁同时配在一个字段上时,校验报错会指出该看哪份设计说明。平台行为不变。
- 为什么做:你对「字段只读分两级」那张决策卡已经定了长远模型,功能也已上线,但设计说明和技能里一直没有记下来,这一步是补上记录。
- 出错会怎样:最坏是说明里某句话和平台实际做法对不上,作者照着配错了锁;只改文字和一句报错提示,可以直接撤回。
- 要你做什么:设计说明和技能文件的改动需要你批准合并。
## What changes
No key, schema, accepted value, default or runtime behaviour changes.
This records the ruling of record on #36806 (ruling record 7180466652,
「按长远模型」) and the two object-level rulings on #37402 (ruling records
7235326611 and 7237772411), whose code landed in #37436, #37888 and
#38169.
-
`docs/adr/0163-field-write-locks-two-tiers-two-forms-two-levels-ui-prefix-admission.md`
(new, `Accepted (2026-11-26)` on the ruling record; it reaches `main`
only by the Tier H approval). D1 two tiers (server lock `readonly` /
`readonlyWhen`, hand lock `uiReadonly` / `uiReadonlyWhen`), D2 two forms
(`readonlyWhen: P\`true\`` is the set-once spelling), D3 two levels (the
object's `uiReadonlyWhen`; a field's own declaration wins; `uiReadonly:
false` is not a declaration), D4 what "by hand" is, D5 the admission
rule of the `ui` prefix (`uiVisibleWhen` / `uiRequiredWhen` are not
admitted), D6 contradictions, D7 the server lock stays a strip. The
record keeps two kinds of statement apart: Decision carries only what
the rulings say, quoted; "As built" says what `main` does at `c610020e`,
by symbol anchor. A third section, "Ruled and not yet held", lists the
three places the ruling covers and the code does not reach yet, each
with its open carrier card.
- `docs/adr/README.md`: regenerated by `node scripts/adr-index.mjs` (164
records).
- `skills/objectstack-data/rules/validation.md`: new section `## Locking
a Field`: a two-by-two table of the four keys (who is kept out, and
when), one checked sales-order example (the hotcrm#2716 case: a `status`
only the Confirm action moves), and five bullets on what each column
does at run time.
- `skills/objectstack-data/SKILL.md` § Conditional Field Rules: the
first bullet keeps its trap (the value is dropped, the write is not
refused, a declarative action's included) and routes to the new section.
- `skills/objectstack-data/evals/objects-fields-relationships.json`:
case 30, a `uiReadonly` status field (`must_contain`: `uiReadonly:
true`, `state_machine`). `evals/README.md` names it.
- `packages/spec/src/data/field.zod.ts`: the parse refusal for
`uiReadonly: true` beside `readonly: true` keeps its wording and now
ends `The two locks and which one to choose: ADR-0163 (D1, D6).` This is
the text `objectstack validate` prints for the pair. Pinned in
`field-ui-readonly.test.ts`.
- `.changeset/37405-field-write-lock-adr-skill.md`: `@objectstack/spec`
and `@objectstack/skills`, patch.
**One sentence of the skill is corrected, not only moved.**
`rules/validation.md` said "Imports and migrations are system-context
writes too." An import is not a system-context write. The `readonly`
describe in `FieldSchema` says so ("A normal (non-system) import is NOT
system-context and still strips"), `importControlOptOutRefusal` in
`packages/rest/src/import-prepare.ts` refuses the historical-import
opt-out to every HTTP caller, and the #36806 measurement found the same.
The new section lists an import among the writes `readonly: true` drops,
and a migration among the system writers it lets through.
**Token ratchet** (`scripts/check-skills-token-ratchet.mjs`), two rows:
- `skills/objectstack-data/SKILL.md` 2239 → 2224: lowered to the
measurement.
- `skills/objectstack-data/rules/validation.md` 3466 → 3862 (+396). The
section is ordered into this skill by the ruling of record on #36806
(ruling record 7180466652: the four spellings, which one to use, the
sales-order status example), and the raise follows the standing ruling,
verbatim: 「A:先削重复,余额按实测提高」 (ruling record 6513306068). Paid down first
in the same file, 1035 bytes cut against 2622 added:
- the two `readonly` / `readonlyWhen` bullets of § Conditional Field
Rules are now one pointer at the new section, which says the same once;
- § Conditional Validation loses its first example
(`enterprise_requires_manager`) and the lead-in of the second, whose
`when` / `then` / `otherwise` rule shows everything the first did.
### Skills readings (lines / bytes / tokens)
| | before | after |
|:-|:-|:-|
| `skills/objectstack-data/rules/validation.md` | 392 / 13861 / 3466 |
421 / 15448 / 3862 |
| `skills/objectstack-data/SKILL.md` | 167 / 8983 / 2239 | 167 / 8923 /
2224 |
| `skills/objectstack-data/evals/objects-fields-relationships.json` (not
ratcheted) | 520 / 37381 | 533 / 38751 |
| `skills/objectstack-data/evals/README.md` (not ratcheted) | 17 / 969 |
18 / 1016 |
| all of `skills/objectstack-data/**` | 4643 / 252853 | 4686 / 255797 |
| all `skills/*/SKILL.md` | 4386 / 228159 | 4386 / 228099 |
| all of `skills/**` | 23333 / 1230467 | 23376 / 1233411 |
| ratcheted (authored) total, tokens | 200510 | 200891 |
### Round 2 (head 6e397de): the contract review of 0922ab3
The review (comment 7248470779, PASS) left one should-fix and one nit.
Both are done in one commit.
- S1, `SKILL.md`: "a button's action included" was true of a declarative
action only. A script action's body runs in a system context, so its
write to a `readonly: true` field lands (ADR-0163, Alternatives, row 3).
The clause now reads "a declarative action's included". The ratchet row
follows the file to its measurement, 2224 (2223 at the previous head).
- N1, `rules/validation.md`: the table's left column was headed "Every
non-system write" over `readonlyWhen` too, which binds system writes as
well. The header is now "Every write" and the `readonly: true` cell
carries "(system writes pass)". The right header lost one word to pay
for it ("Only a person at the console"), and the Confirm sentence names
"a declarative Confirm". The file is 15448 bytes and its row stays 3862.
- The changeset's sentence on the Confirm action says "a declarative
action's own write" to match.
## Tests
- `packages/spec/src/data/field-ui-readonly.test.ts`: the existing
refusal case also asserts the message ends with `ADR-0163 (D1, D6).`
`vitest run src/data/field-ui-readonly.test.ts` in `packages/spec`: 5 of
5 pass.
- The new skill example carries the `os:check` marker, so
`check:skill-examples` type-checks it against the built
`@objectstack/spec` declarations. Exit 0: 353 marked examples
type-check, this one among them. The example was also parsed by
`ObjectSchema` and read by `validateStackExpressions` in two scratch
vitest files (not committed): it parses, and the expression lint reports
no issue for `readonlyWhen: P`true`` or `uiReadonlyWhen: P`false``.
- `check:skill-eval-tokens`: exit 0; both `must_contain` tokens of case
30 are taught by the bundle.
- Not run: a model-driven round of the skill evals. Case 30 has a new
hash and no recorded answer yet.
## Acceptance notes
- Done-when, line by line. "ADR accepted on `main`": the record's status
is `Accepted` on the ruling record and it lands by the Tier H approval
of this PR. "Skill section in place and its eval exercises a
`uiReadonly` status field": the section and case 30. "`objectstack
validate`'s refusal text for `uiReadonly` + `readonly` points at the
ADR": the message above.
- The card's Asked lists what the ruling says. Three points of it are
not held by code on `main` yet. The ADR says so in "Ruled and not yet
held" and names the open carrier of each: #37898 (the assistant is among
the hands the ruling names; cloud AI service), #38202 (console Duplicate
carries a hand-locked value), #38249 (inline child lines of a
hand-locked parent). The skill section teaches only what `main` does
today.
- "`uiVisibleWhen` / `uiRequiredWhen` refused" (card wording): the
ruling's rule is that a key earns a `ui` twin only when an action must
write what a person may not, and only read-only meets it. Neither key
exists in the schema, so a strict parse answers each as an unknown key.
No dedicated refusal is added here; the ADR records the rule (D5) and
the skill says there is no `uiVisibleWhen`.
- D3 records that an object-level server lock (`readonlyWhen` on the
object) is not filed anywhere; it is named so a later reader does not
infer it from the hand lock's object level.
- The refusal message names the ADR by number, the form the spec's other
messages use (`ADR-0158 U2`, `ADR-0049`).
- Branch `claude/project-thread-bqsxpg` is assigned by the harness, not
the repo's `claude/issue-N-…` convention.
## Verification
Two-minute check: `node scripts/check-skills-token-ratchet.mjs`, expect
exit 0 with `skills/objectstack-data/rules/validation.md` 3862 / 3862
and `skills/objectstack-data/SKILL.md` 2224 / 2224.
Read first, by risk:
1. `skills/objectstack-data/rules/validation.md` § Locking a Field (it
ships to third parties verbatim): the left-column bullet, where the
writers `readonly: true` drops and lets through are listed, and the
import correction.
2. `docs/adr/0163-…md` D3 and D4 against the ruling records, then "Ruled
and not yet held".
3. `scripts/check-skills-token-ratchet.mjs`: the two rows and their
arithmetic.
<details><summary>Local gates at 6e397de (only what reads the two
changed skill files)</summary>
Not the whole list again: the second commit changes two skill files, the
ratchet rows and one changeset sentence. Re-run, each exit 0:
`check-skills-token-ratchet.mjs` (and `--self-test`), `ui`
`check:skill-eval-tokens`, `check:skill-links`,
`check:skill-frame-sync`, `check:skill-identifier-liveness`, spec
`check:skill-examples` (353 examples), `check:skill-docs`,
`check:skill-refs`, `check:skill-served-sections`,
`check-nul-bytes.mjs`.
</details>
<details><summary>Local gates at 0922ab3</summary>
`node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack
--ran FILE`, each command recorded as `CMD :: exit N`: **124 derived,
120 run, 4 NOT-MEASURED, 0 UNRUN**. Every run family exit 0, among them
`check-skills-token-ratchet.mjs` (and `--self-test`), `check:adr-index`,
`check:adr-anchors`, `check:adr-symbol-anchors`, `check-adr-links.mjs`,
`check:skill-links`, `check:skill-frame-sync`,
`check:skill-identifier-liveness`, spec `check:docs` /
`check:api-surface` / `check:authorable-surface` / `check:skill-docs` /
`check:skill-refs` / `check:liveness`, `check-empty-changeset.mjs`,
`check-adr-0087-registration.mjs --base origin/main`,
`check:ratchet-remedy-authority`, `check:type-check-debt`.
- The four recorded exit 3 (prerequisite not met), as the tool reads the
record:
- `check-plugin-teardown-shape.mjs --self-test`: NOT MEASURED. Its
positive control is pinned to a commit this shallow clone cannot reach.
The gate itself (without `--self-test`) ran, exit 0.
- `check:doc-formula-expressions`, `check:dual-build-cjs-loads`,
`check:lean-entry-closure`: exit 3 on the first pass (their build
closures were missing). After the closures were built each was run again
alone, exit 0. The record keeps both lines, and the tool reads a command
with two codes as the worse one, so its count stays 4.
- Outside the derived list, run by hand: spec `check:skill-examples`
(exit 3 before the `@objectstack/client-react` closure was built, exit 0
after: 353 examples), `ui` `check:skill-eval-tokens` (exit 0), `ui`
`check:skills-paths` (exit 0).
- `scripts/pm/overlap-check.mjs`: clean against `origin/main` (3579cf1)
and the one open PR that shares a file (#38192,
`skills/objectstack-data/SKILL.md`).
- Built at `c610020e` plus this diff; `main` moved three commits since
(none under this diff's paths), not merged in.
</details>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L6bhgTpyo8gQyqf9Tj9mfz
<!-- signed: repo:objectstack#2 · os-sales ·
session_01L6bhgTpyo8gQyqf9Tj9mfz -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 4437c50 commit 038ccf5
10 files changed
Lines changed: 260 additions & 37 deletions
File tree
- .changeset
- docs/adr
- packages/spec/src/data
- scripts
- skills/objectstack-data
- evals
- rules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
| 233 | + | |
233 | 234 | | |
234 | 235 | | |
235 | 236 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3430 | 3430 | | |
3431 | 3431 | | |
3432 | 3432 | | |
3433 | | - | |
| 3433 | + | |
| 3434 | + | |
3434 | 3435 | | |
3435 | 3436 | | |
3436 | 3437 | | |
| |||
3444 | 3445 | | |
3445 | 3446 | | |
3446 | 3447 | | |
3447 | | - | |
| 3448 | + | |
| 3449 | + | |
3448 | 3450 | | |
3449 | 3451 | | |
3450 | 3452 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
914 | 914 | | |
915 | 915 | | |
916 | 916 | | |
917 | | - | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
918 | 925 | | |
919 | 926 | | |
920 | 927 | | |
| |||
1731 | 1738 | | |
1732 | 1739 | | |
1733 | 1740 | | |
1734 | | - | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
1735 | 1753 | | |
1736 | 1754 | | |
1737 | 1755 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
86 | | - | |
87 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
515 | 515 | | |
516 | 516 | | |
517 | 517 | | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
518 | 531 | | |
519 | 532 | | |
520 | 533 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | 201 | | |
221 | 202 | | |
222 | 203 | | |
| |||
364 | 345 | | |
365 | 346 | | |
366 | 347 | | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
| 348 | + | |
| 349 | + | |
374 | 350 | | |
375 | 351 | | |
376 | 352 | | |
| |||
390 | 366 | | |
391 | 367 | | |
392 | 368 | | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
0 commit comments