Skip to content

zone_record: file stores check a record at create - #98

Merged
msimerson merged 1 commit into
NicTool:mainfrom
aberoham:zr-file-create-check
Nov 17, 2026
Merged

msimerson merged 1 commit into
NicTool:mainfrom
aberoham:zr-file-create-check

Conversation

@aberoham

Copy link
Copy Markdown
Contributor

json and toml stored a create without checkRecord, so a record mysql refuses went in, and since #95 its rdata edits are refused:

await ZoneRecord.create({ zid: 4096, owner: 'x.example.com.', ttl: 300, type: 'MX', preference: 10 })
// mysql: STORE_INVALID. json, toml: stored, then put({ id, preference: 20 }) is refused.

The file stores now run the check, and an unchanged PUT answers false on them as it does on mysql.

json and toml stored a create unchecked, so an invalid record went in and later rdata edits to it were refused unless they also repaired it. They now run checkRecord as mysql does, and an unchanged PUT answers false on every store.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the file-backed record validation and no-op update changes.

No open issues 🎉

What changed in this PR

Aligns JSON and TOML zone-record behavior with MySQL, extending the PUT validation work from #95 to record creation.

Changes:

  • Validates file-backed records before allocating an ID or storing them.
  • Returns false for unchanged PUTs, avoiding unnecessary file writes.
  • Adds shared regression tests for invalid creates and unchanged updates.
File Description
lib/​zone_record/​test/​mysql.js Removes the invalid-create test now covered by shared tests.
lib/​zone_record/​test/​index.js Adds cross-backend tests for rejected creates and unchanged PUTs.
lib/​zone_record/​store/​file.js Adds creation validation and no-op update detection.
CHANGELOG.md Documents the JSON and TOML behavior fixes.

Review effort: Balanced

@msimerson
msimerson merged commit b44d745 into NicTool:main Nov 17, 2026
11 checks passed
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.

3 participants