Skip to content

Commit e4ee8af

Browse files
committed
docs(changeset, spec): name the null-guard refusal an extension rule now meets, and its fix
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibyToDkPxCjvNiWsv6e
1 parent ffd8972 commit e4ee8af

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

‎.changeset/33154-object-extension-validation-rules-judged.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ Skills-docs: none owed — this PR edits `content/docs/deployment/validating-met
1717

1818
**Now:** each rule an `objectExtensions` entry adds is judged by the object's own rule pass (its `condition` and `when`, every nested `then` / `otherwise` branch, the `parent` root verdict and the null-guard gate), with the same rule id `expression-invalid`, against the extended object as served (its own fields and every field an extension adds). A finding is located at the entry: `object 'crm_account' · objectExtensions[0] · validation 'no_blocked__c'`, key path `objectExtensions[0].validations[0].condition`. At the door the refusal is `422 INVALID_METADATA`, the door still runs one pass (the extension walk), and a republish is judged without the package's own stored extension, which the write replaces.
1919

20+
The null-guard gate is part of that pass, and it is the narrowing most likely to meet a working tenant: an extension rule that reads a nullable field with no guard, such as `record.credit > 5000000` on a `number` field with no `required: true` and no `defaultValue`, is now refused. At runtime that predicate aborts on every save where the field is empty, and the save is refused fail-closed. The repository's own suite carried one such rule and now guards it.
21+
2022
**Unchanged:** the object save door, an object's own rules, a draft save (never gated), a stored row (judged only when it is published again), and the regex and JSON-schema checks of a `format` / `json_schema` rule, which still judge an object's own rules only.
2123

22-
**Fix:** before building or publishing again, repair each refused rule the way you would on a rule declared on the same object: read `record.FIELD` for a field the object serves, call only registered functions, guard a nullable operand with `!= null`, and read through a reference only in the shape a declared rule may.
24+
**Fix:** before building or publishing again, repair each refused rule the way you would on a rule declared on the same object: read `record.FIELD` for a field the object serves, call only registered functions, guard a nullable operand with `!= null` (`record.credit != null && record.credit > 5000000`), and read through a reference only in the shape a declared rule may.

‎packages/spec/src/migrations/entries/semantic/18.object-extension-validation-rule-expression-judged.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ export const entry: SemanticMigration = {
2323
replacement:
2424
'A rule the expression rule accepts on a declared rule of the same object: CEL that reads `record.FIELD` for '
2525
+ 'a field the extended object serves (its own fields and every field an extension adds), calls only '
26-
+ 'registered functions, guards a nullable operand with `!= null`, and reads one hop through a reference '
27-
+ 'only as a declared rule may.',
26+
+ 'registered functions, guards a nullable operand with `!= null` (`record.credit != null && record.credit > '
27+
+ '5000000`, not a bare `record.credit > 5000000` on a field with no `required: true` and no `defaultValue`), '
28+
+ 'and reads one hop through a reference only as a declared rule may.',
2829
reason:
2930
'The registry merges an extension\'s rules onto the target, so every save of the target runs them, but '
3031
+ 'neither `os build` nor the `object_extension` publish door judged them: a misspelt field or an '
31-
+ 'unregistered function was accepted and failed only when an end user saved a record. Each rule an '
32+
+ 'unregistered function was accepted and failed only when an end user saved a record, and a rule reading a '
33+
+ 'nullable field with no guard aborted and refused every save where that field was empty. Each rule an '
3234
+ 'extension adds is now judged by the object\'s own rule pass, against the extended object as served '
3335
+ '(at the door, without the package\'s own stored extension, which the write replaces), and refused with '
3436
+ 'the same rule id (`expression-invalid`; at the door `422 INVALID_METADATA`), located at '

0 commit comments

Comments
 (0)