Repository navigation
lib: one cascade graph for every store - #68
Merged
Merged
Conversation
Which children a hard delete takes with it was decided separately in each backend. mysql gets each of them from a FOREIGN KEY. The file stores have no constraints and never implemented them, so destroying a group left its nameservers behind, a user its sessions, and a zone its records. references.js names those three edges once. The file stores call cascade() from destroy() before removing the row, mysql goes on getting it from the constraints, and references.test.js holds whichever store is configured to the same graph. Each case seeds a second parent whose child must survive, so a store that takes too much fails as loudly as one that takes too little.
aberoham
marked this pull request as ready for review
October 16, 2026 05:50
There was a problem hiding this comment.
🟡 Changes recommended
Cascades can delete children concurrently moved to surviving parents and repeatedly rewrite entire child files.
1 open finding
What changed in this PR
Aligns JSON and TOML hard-delete cascades with existing MySQL behavior through a shared relationship graph.
Changes:
- Cascades group, user, and zone destruction to their children.
- Adds cross-store tests for deletion, unrelated-child preservation, and retry behavior.
- Documents the behavior change.
| File | Description |
|---|---|
| lib/zone/store/file.js | Cascades before removing zones. |
| lib/user/store/file.js | Cascades before removing users. |
| lib/references.test.js | Tests cascade behavior across stores. |
| lib/references.js | Declares relationships and implements cascades. |
| lib/group/store/file.js | Cascades before removing groups. |
| CHANGELOG.md | Documents file-store cascade support. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
|
also, the previous PR broke test-win for some reason. |
Contributor
Author
|
test-win failed before any test ran. choco got a 503 and then a 504 from community.chocolatey.org for mysql 9.7.2, so mysqld never started. #68 hit the same outage in the same minute. The feed answers again now, and a re-run should pass. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Destroy a group, user or zone on json or toml and its nameservers, sessions or records stay behind. mysql removes them through its FOREIGN KEY constraints.
references.jsdeclares the three edges once. On the file stores,destroy()callscascade()first. It removes all of the parent's children in one write, matched on the parent key, and mysql keeps its constraints.references.test.jsis the repro. Each case seeds a second parent whose children must survive, so taking too much fails as loudly as taking too little.