Skip to content

Make the defaults of strict graphs explicit and their comparisons exact (#429) - #532

Merged
lehni merged 1 commit into
mainfrom
feature/429-strict-explicit
Oct 25, 2026
Merged

lehni merged 1 commit into
mainfrom
feature/429-strict-explicit

Conversation

@lehni

@lehni lehni commented Oct 25, 2026

Copy link
Copy Markdown

Follow-up for #429 before 4.3.0: strict graphs get explicit defaults and exact comparisons. Strict mode is unreleased, so this changes its semantics without breaking anything that was released.

  • added: 'throw' is now a value and the default of upsertGraph(), for relations and root. It names what an unset added did before (the NotFoundError with its hints), and a later entry can now narrow an earlier '*': { added: 'relate' } for one relation. insertGraph() keeps the default 'insert' and accepts 'throw' to stop inserting rows with ids.
  • removed has no default. Every relation that a strict graph contains, at any depth and also when given as null or [], needs a removed setting from some entry. Otherwise the call throws a ValidationError of type InvalidGraph that lists the relations, before anything is loaded or written. Relations inside rows marked #delete or #unrelate are exempt, since they're ignored.
  • Rows given only by the key of a BelongsToOneRelation are always added rows. The special case that let created decide when added wasn't set is gone.
  • Comparisons are exact. kept: 'preserve' and the strict placement checks no longer use ==, so '', ' ' and false don't equal 0. Numbers match numeric strings ('1.50' and 1.5), booleans match 1/0, dates compare by time, Buffers by bytes and bigints exactly.
  • The docs and typings show the default of each setting next to its values.

@lehni
lehni enabled auto-merge (squash) October 25, 2026 14:36
@lehni
lehni merged commit 8ef3196 into main Oct 25, 2026
7 checks passed
@lehni
lehni deleted the feature/429-strict-explicit branch October 25, 2026 14:42
@lehni lehni mentioned this pull request Oct 25, 2026
2 tasks done
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