Skip to content

Commit 92e660d

Browse files
docs(skills): objectstack-formula says an unlowerable SharingRule condition fails the build and the rule is skipped at runtime (#36562)
<!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi91tYCagMT6JaQ6YA5YqnWwi)_ Fixes #36516 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:用公式技能包写共享规则的 AI 和开发者,以前被告知「条件算不出来会让写入失败」,现在读到的是真实情况:这样的共享规则在构建时就报错,运行时整条规则被跳过、不授予任何访问权,只留一行警告日志。 - 为什么做:这是公式技能包教错失效方式的一处文字;权限规则教错,AI 会按错误的预期去设计和排查共享。 - 出错会怎样:只改了技能包里的一句说明和两处重复文字,不改任何运行行为;如果新句子有误,读者会被教错,撤回这一个改动即可恢复原文。 - 要你做什么:批准这一处受管技能包文字改动。 ## What changes `skills/objectstack-formula/SKILL.md`, section "Surfaces that take an Expression", the fault-open warning paragraph. The sentence used to say an unevaluable `Hook` / `SharingRule` `condition` or validation predicate aborts the write. It now reads: > an unevaluable `Hook` `condition` or validation predicate **aborts the write** (§5); a `SharingRule` `condition` that does not lower to a filter fails the build, and at runtime the rule is skipped and grants nothing (one WARN). Only the `SharingRule` half changed. The `Hook` and validation-predicate halves say what they said before. What the code does, read at `main` d463c46: - Build: `packages/lint/src/validate-sharing-rule-enforceability.ts:18-28` and its "Why `error`" section: a condition that does not lower is reported as an `error`. - Runtime: `packages/plugins/plugin-sharing/src/declared-sharing-rules.ts:154` compiles the condition with `compileCelToFilter` and no variables; `:217` turns a refusal into a `condition` skip; `:370-374` calls `warnOnce` and `continue`s, so the rule never enters the served set; `:336-348` logs one WARN per rule and cause. A sharing rule's condition is never evaluated on a write, so there is no write to abort. No eval case is added: case 14 in `skills/objectstack-formula/evals/cel-predicates-formulas.json` already expects "the rule would grant nothing" for a condition that does not lower. ### Token budget: paid by two cuts, ceiling not raised The corrected sentence costs +127 bytes. Two restatements in the same file are cut to pay for it: | Cut | Bytes | Where the content still lives in the file | |:---|---:|:---| | The note under the translation table: `previous.x` fails the write on an insert unless guarded by `previous != null &&` | -105 | Section 5: the `previous` table's "Insert events" row (`previous` is `null`, the two guard spellings, a column read off it faults) and the "An unevaluable condition ABORTS the operation" paragraph (a column read off `previous` on an insert fails the write) | | "Two more dialects ride the same envelope." at the head of "Cron and template surfaces" (the next sentence now starts "Neither dialect is CEL") | -34 | "Core contract": "Every expression in metadata is the same envelope" and the three-dialect table listing `cron` and `template` | Readings (the ratchet prices `ceil((bytes - 20) / 4)`; the 20 is the release-stamp line): | | Before (`main` d463c46) | After (f768c92) | |:---|---:|---:| | `skills/objectstack-formula/SKILL.md` lines | 493 | 491 | | `skills/objectstack-formula/SKILL.md` bytes | 24048 | 24036 | | `skills/objectstack-formula/SKILL.md` tokens (ceiling 6008) | 6007 | 6004 | | All `skills/*/SKILL.md` lines | 4951 | 4949 | | All `skills/*/SKILL.md` bytes | 261175 | 261163 | | Ratcheted authored bundle tokens (ceiling sum 202541) | 197573 | 197570 | `scripts/check-skills-token-ratchet.mjs` is not edited; the formula row's ceiling stays 6008. ## Tests Text-only change to a published skill; no code, no test file. No ablation (no tested behaviour changed). All readings at f768c92. - `node scripts/check-skills-token-ratchet.mjs`: exit 0, "skills/objectstack-formula/SKILL.md is 6004 tokens (ceiling 6008; headroom 4)", "60 authored bundle file(s) within their ceilings". - `pnpm --filter @objectstack/spec run check:skill-docs`: exit 0, "Skill docs in sync". - `pnpm --filter @objectstack/lint run check:doc-formula-expressions` (after building the lint closure under the verify lock, VERDICT command-exit 0): "26 record-scoped formula example(s) across 593 files / 1864 TS blocks judged clean". ## Acceptance notes - Gates: `node scripts/pm/dispatch-gates.mjs --commands` derived 49 families; `--ran` answers "49 derived famil(ies) accounted for — 45 run, 4 NOT-MEASURED (4 DERIVED from a recorded exit 3)". The four are `check:dts-closure`, `check:dual-build-cjs-loads`, `check:lean-entry-closure` and `check:sourcemap-no-sources-content`: each refuses without a full `pnpm build`, which this text-only diff does not owe locally. NOT MEASURED locally; CI reads them. - `node scripts/pm/overlap-check.mjs` at f768c92: "VERDICT clean exit 0" (one open PR shares the file and merges cleanly). - The first cut removes a reminder that sat next to the `ISCHANGED(x)` row. Its content is intact in section 5, which the cheat-sheet's "Previous record" row already points to. ## Verification - Read first: `skills/objectstack-formula/SKILL.md` (the changed sentence near line 447, then the two cuts), then `.changeset/36516-formula-skill-sharing-rule-skip.md`. - Two-minute check: `node scripts/check-skills-token-ratchet.mjs` and read the `objectstack-formula/SKILL.md` line: 6004 tokens, ceiling 6008. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ADHkmPTDM2MxHR8cvoMVUX Co-authored-by: Claude <noreply@anthropic.com>
1 parent 84853fd commit 92e660d

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): objectstack-formula says an unlowerable `SharingRule` `condition` fails the build and that the rule is skipped at runtime, instead of saying it aborts the write
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The "Surfaces that take an Expression" warning used to group `SharingRule` `condition` with `Hook` `condition` and validation predicates as "aborts the write". A sharing rule's condition is never evaluated on a write: it is compiled to a query filter. One that does not lower to a filter fails the build (`validate-sharing-rule-enforceability`, an `error`), and at runtime the rule is skipped and grants nothing, with one WARN line. The sentence now says so; the `Hook` and validation-predicate halves are unchanged.
11+
12+
Text only. Two restatements are cut to pay for it under the token ceiling, which is not raised: the translation-table note that `previous.x` fails the write on an insert (it stays in section 5's `previous` table and warning), and the "ride the same envelope" lead-in of the cron and template section (it stays in Core contract).

‎skills/objectstack-formula/SKILL.md‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -400,9 +400,6 @@ When migrating Salesforce-flavor metadata, apply these rules in order:
400400
| `ISCHANGED(x)` | `previous.x != record.x` |
401401
| `MONTH_DIFF`, `MID`, `LEFT`, `RIGHT`, `SUBSTITUTE` | _not in stdlib — propose addition_ |
402402

403-
> ⚠️ `previous.x` **fails the write** on an insert unless guarded by
404-
> `previous != null &&` (§5).
405-
406403
> ⚠️ **Flow conditions are the exception to row 1.** The engine spreads the
407404
> trigger record's fields, nulls included, to top level wherever no flow variable
408405
> or node id holds the name, so in a start, edge or `decision` condition a bare
@@ -447,8 +444,9 @@ and `autonumber` have real columns and need no such care.
447444
is CLIENT-SIDE only, and an unbound root falls back to `true`, so the control
448445
renders for everyone — never use one as access control; that is permission-set
449446
field-level security. Everywhere else on this table the opposite holds: an
450-
unevaluable `Hook` / `SharingRule` `condition` or validation predicate **aborts
451-
the write** (§5).
447+
unevaluable `Hook` `condition` or validation predicate **aborts the write**
448+
(§5); a `SharingRule` `condition` that does not lower to a filter fails the
449+
build, and at runtime the rule is skipped and grants nothing (one WARN).
452450

453451
View list filters are **not** a CEL surface — they are structured JSON filter
454452
rules (`ViewFilterRuleSchema`), so do not emit CEL there. For "last 30 days"
@@ -457,7 +455,7 @@ objectstack-query `rules/filters.md` has the token list.
457455

458456
### Cron and template surfaces
459457

460-
Two more dialects ride the same envelope. Neither is CEL; both take
458+
Neither dialect is CEL; both take
461459
a bare string (auto-wrapped) or their helper, and read the same variable scope.
462460

463461
| Dialect | Helper | Grammar | Carriers |

0 commit comments

Comments
 (0)