Skip to content

fix!: validity is json-rules' answer on the builder's targets — 0.31.0 - #10

Merged
agreenspan merged 1 commit into
mainfrom
fix/validate-with-lens
Oct 8, 2026
Merged

agreenspan merged 1 commit into
mainfrom
fix/validate-with-lens

Conversation

@agreenspan

Copy link
Copy Markdown
Contributor

Fixes the adversarial-review findings A1–A5 (TDD: test/targetValidation.test.tsx failed 11/12 before the fix).

  • A1 useRuleBuilder().validate(target) passes the narrowed lens root's map/mapName/model (as json-rules describeRule does) — {field:'name',operator:'equals',path:'nick'} now validates for toPrisma, matching describe().
  • A2 Leaf and array valid include json-rules validateRule on every builder target with the lens schema. The path picker offers only refs of the field's own kind (an enum: its own enum) that every target compiles; empty scopes are left out (toPrisma drops $$.).
  • A3 Deleted the stale validateAggregate copy; filter is offered on aggregates where every target takes a window (check, toPrisma) or one is already authored. The aggregate-target picker's own validity still folds into valid. The aggregate test fixture gained FK fields so toPrisma can actually compile it.
  • A4 Removed runSources / SourceRows (no consumers outside the examples). Examples now use json-rules materializeSources with bridge far sides stitched inline (indexBridges); sample users gained accountId so the bridged industry source has data.
  • A5 useActionRuleBuilder rel walks read the view's visit at every hop (no rawView). resourceFields stays for the raw-record builders only (permissions, transitions).
  • Peer @inixiative/json-rules ^3.5.0; version 0.31.0; CHANGELOG.

bun run check: typecheck, examples typecheck, lint, 422 tests pass.

🤖 Generated with Claude Code

- validate(target) passes the lens root's map/mapName/model (A1)
- leaf/array valid includes validateRule on every target; the path picker
  offers only same-kind refs every target compiles (A2)
- delete the stale validateAggregate copy; offer filter on aggregates where
  every target takes a window (A3)
- remove runSources/SourceRows; examples use json-rules materializeSources (A4)
- useActionRuleBuilder rel walks read the view's visit at every hop (A5)
- peer @inixiative/json-rules ^3.5.0

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@agreenspan
agreenspan merged commit d3ae8c4 into main Oct 8, 2026
1 check passed
@agreenspan
agreenspan deleted the fix/validate-with-lens branch October 8, 2026 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant