zone_record: write to the id in the path - #71
Merged
Conversation
PUT /zone_record/{id} passed the path id first and spread the body over
it, so a body id replaced it. The handler read the record named in the
URL, found it, then wrote to the record named in the body and answered
200.
before: 7314 address=203.0.113.2
PUT /zone_record/7313 {id: 7314, address: 198.51.100.99} -> 200
after: 7313 address=203.0.113.1 named in the URL, untouched
after: 7314 address=198.51.100.99 never named in the URL
Only zone_record accepts an id in a PUT body. The zone and nameserver
schemas refuse the key, so those two routes answer 400 before the
handler runs. Their argument order matches group and user now, and the
route tests reach their update handlers for the first time.
msimerson
approved these changes
Aug 30, 2026
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.
PUT /zone_record/{id}writes to the id in the body, not the id in the path.The handler reads the record named in the URL, finds it, then hands the store a
merge that starts with the path id and spreads the body over it. A body id wins.
The call answers 200 and reports success for a record it never touched.
Two records in one zone, driven through the routes:
zone_record.PUTforksidto optional. The key reaches the handler. Thezoneandnameserverschemas do not list it and answer 400 with"id" is not allowed. Both handlers had the same argument order, so this puts all fourentities on the order
groupanduseralready use.The regression test asserts on the bystander's stored row, since the response
body looks correct either way. Pinning the status code would tie the test to a
schema that accepts the key, so it does not. It fails on
mainand passes here.Neither
zonenornameserverhad a route test for its update handler. The twochanged lines arrived uncovered. They have a test now. All three stores run
clean: mysql 398, json and toml the file-store subset.