Skip to content

docs(handbooks): belongsTo states ownership, not a delete behaviour - #201

Merged
clabonte merged 1 commit into
mainfrom
docs/belongsto-states-ownership
Nov 3, 2026
Merged

clabonte merged 1 commit into
mainfrom
docs/belongsto-states-ownership

Conversation

@clabonte

@clabonte clabonte commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

The handbooks said a belongsTo foreign key cascades on delete. That is no longer true at the pinned generator: clabonte/generator#3103 (0.24.0) makes a soft-delete parent's foreign keys NoAction. One consumer's tenant check read ownership from OnDelete, and after regenerating, non-admin users got 403 on rows with no tenant column of their own.

Changes

  • API_Handbook.md: belongsTo states ownership. New paragraph gives the rule and says never to infer ownership from OnDelete.
  • Vendor_Extensions.md: x-references and x-fk-for no longer promise Cascade.
  • docs/generator-releases.md: records the change under 0.24.0, whose notes missed it.

Verification

Generated entityTypeConfiguration from hello-orders, changing only Order's delete mode:

Order declares OrderLine FK, 0.24.0 OrderLine FK, 0.23.0
delete: soft NoAction Cascade
delete: hard Cascade not measured
nothing Cascade not measured

Order, with two parents, is NoAction on its owning foreign keys in every run.

The mutual-parent condition comes from reading RelationshipSide.computeDeleteBehavior in a generator checkout, not from a jar run. The 403 account is the consumer's report; I did not reproduce it. check-shipped-docs.py passes.

The handoff's second request, flagging OnDelete changes as breaking in generator release notes, is for the generator and is not done here.

No version bump; that belongs to the release.

🤖 Generated with Claude Code

The handbooks said a `belongsTo` foreign key cascades. Generator 0.24.0 makes a
soft-delete parent's foreign keys `NoAction`, and a child with two parents was
already `NoAction`, so `OnDelete` no longer tells owned from not owned. A consumer
that read ownership from it got `403`s after regenerating.

State the rule as measured on the 0.24.0 jar, tell readers to take ownership from
`belongsTo`, and record the change in the generator release notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@clabonte
clabonte merged commit 1eb6adb into main Nov 3, 2026
6 checks passed
@clabonte
clabonte deleted the docs/belongsto-states-ownership branch November 3, 2026 18:41
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