Repository navigation
feat(rules)!: rule shape — expression and semantic decide the kind - #164
Conversation
b70cf3d to
78f5b1b
Compare
78f5b1b to
16d3f2e
Compare
| if ( | ||
| judge && | ||
| r.semantic !== undefined && | ||
| options.judgeTarget !== undefined && | ||
| node.label !== options.judgeTarget | ||
| ) { | ||
| // Ancestors only matter through the gates they could raise. | ||
| if (!(targetAncestors.has(node.title) && ruleCanGate(r))) continue; | ||
| } |
There was a problem hiding this comment.
With --judge-target, this continue drops the whole rule for non-target nodes, including its expression, whenever the rule has a semantic part. That contradicts the PR description ("expressions on ancestor nodes now always run"; semantic rules outside the target are skipped only when a model provider is in use).
Example: a rule has both expression and semantic, gatesDescendants is unset, and semantic.severity maps only to warnings. On an ancestor of the target, ruleCanGate(r) is false, so the rule is skipped. Its failing expression never runs and never gates, although a plain validate would have gated the target. On non-ancestor, non-target nodes the expression is skipped too, unlike an expression-only rule.
Fix: keep the rule in applicable and withhold only its semantic part when the node is outside the target or cannot gate. For example, mark the rule as expression-only for that node instead of continue.
16d3f2e to
c62370d
Compare
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
6eaf54e to
86e98fa
Compare
Replace rule fields check/mode/rubric/verdicts/scope with expression, a semantic object (rubric, verdicts, severity), and global: true. A rule has an expression, a semantic part, or both; the semantic part is skipped when the rule's own expression fails. Severity is top-level for the expression and the default fail verdict; semantic.severity maps the other verdicts. Old-shape schemas fail to load with a pointer to the replacement field. Regenerate the latest metaschema, migrate bundled schemas and fixtures, and drop the mode dimension from --rule-filter.
Update rules, semantic rules, config, concepts, schemas docs, README, AGENTS.md and plugin skill text for expression, semantic, global, semantic.severity, --semantic [provider] and the semantic config key.
…unknown properties
86e98fa to
958ac77
Compare
Stacked on #161.
Summary
expression(wascheck), asemanticobject, or both.mode,rubricandverdictsmove off the top level. A rule with neither part is rejected when the schema loads.semanticobject holdsrubric(falls back todescription),verdictsand a per-verdictseveritymap.semantic: {}takes every default.severityis the severity of a failedexpressionand of the defaultfailverdict.global: truereplacesscope: "global", so Semantic rules: rule scope and judge input (what the model sees) #152 can usesemantic.scopefor related nodes. A global rule rejectswhen,typeandsemantic.--semantic [provider]replaces--judge. The config key issemantic: { provider }(wasjudge).--rule-filterloses itsmodedimension.(Semantic evaluation error: …)and "Model provider returned …".Behaviour changes
--judge-target: expressions on ancestor nodes now always run. Semantic rules on nodes outside the target are skipped only when a model provider is in use.expression failed: …evidence appears only when the rule also has a semantic part.Tests
lint and typecheck clean;
bun run test739 pass, 15 skip, 0 fail.test:smoke: 2 known failures from an external schema still in the old shape, which gets migrated after merge.