Repository navigation
fix: bound names to their column and document the rejections - #265
Conversation
A name longer than the VARCHAR(255) column that stores it reached the database, where the failed write was flattened to false: 500 on a rename, a generic 400 on a create. The request bodies and the debug path variable now carry @SiZe(max = 255), so it is answered 400 naming the field, and the spec states the bound as maxLength. GET /environments/name/{name} could answer 400 without the spec saying so, because the drift guard ignored @notblank. The guard now counts it, the route documents the answer, and the ErrorResponse description agrees with docs/MVP.md about the bodiless 401 and 403. Closes #263 Closes #264 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Self-review rubric, scored against head
Findings fixed before this review: both blank-name tests first used a literal Non-blocking notes:
The dev loop's merge hold applies because the diff touches This review was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
Summary
400withname: size must be between 0 and 255on every create and rename route, instead of reaching theVARCHAR(255)column and being reported as a500on a rename or a generic400on a create.@Size(max = 255)was added to all five request bodies and to the debug route'senvironmentName.maxLength, documents the400onGET /api/v1/environments/name/{name}, names the rejected name in the debug route's400, and no longer claimsErrorResponseaccompanies the bodiless401and403.OpenApiSpecDriftTestnow counts@NotBlankas validated input, which is how the undocumented400went unnoticed, and has a new check that the request bodies'@Sizebound matches the spec'smaxLength.docs/MVP.mdrecords the rule.Closes #263
Closes #264
Client impact
Neither client changes. The bound is enforced by the service, and both clients already raise on a
400: the Python client throughraise_for_status, the Java client through its general catch. Names of 256 or more characters could never be stored, so no previously working request is refused, with one edge:@Sizecounts UTF-16 code units while the column counts characters, so a name made mostly of characters outside the Basic Multilingual Plane can be refused below 255 characters.Test plan
mvn -B test: 680 tests, 0 failurespytest: 128 passed (client untouched)PATCHa 256-character name and confirm400, then a 255-character name and confirm200Verification gap
The Java tests run on H2 and mocks, and the sandbox cannot start Postgres. The
500was reproduced by making the repository report the failed write, not by a real over-long write on Postgres. The fix does not depend on Postgres, since validation runs before the database is reached.The over-long tests cannot fail silently: their rename stubs answer
500if validation is bypassed. The two blank-name tests are characterization, because that validation already existed.Scope
The diff touches 12 files against a soft ceiling of about 10: five are the same one-line annotation, and the production change is under 20 lines.
Merge hold
This PR changes
docs/openapi/viron-api.json, which is on the dev loop's do-not-auto-merge list, so it is left open for human review.Issues not picked up
pom.xmlchange beyond one cycle.This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
🤖 Generated with Claude Code
drafted by Claude on behalf of Daniel Stephenson