Repository navigation
Conversation
257b351 to
89b8cf5
Compare
Regression test report ✅Commit: Selected 1 changed tests (limit=20, 0 not selected) 2 tests: regression=2 unreleased=0 coverage=0 failing=0
TestAccept/bundle/templates-machinery/null-value/DMS=: branch ✅ | main (21661cc) ❌ | latest (v1.28.0) ❌main (21661cc): latest (v1.28.0): TestAccept/bundle/templates-machinery/null-value/DMS=true: branch ✅ | main (21661cc) ❌ | latest (v1.28.0) ❌main (21661cc): latest (v1.28.0): |
✅ Integration test reportCommit: 2fca0df
Top 6 slowest tests (at least 2 minutes):
|
There was a problem hiding this comment.
Automated review at 89b8cf5. Each finding was verified against the code.
No blocking issues found.
This PR stops bundle init from panicking when a number property, or an integer property declared only in anyOf, is null. It adds a nil check to validateNumber and validateInteger before they call reflect.TypeOf(v).Kind(), so a null now gets the usual type error. The fix is correct for every path in the acceptance test, and non-null inputs behave as before. I have no blocking issues. One thing outside this PR's scope: integer properties declared only in anyOf are still never converted from float64 in LoadInstance, so even a valid number like {"extra": 3} fails there with the same error. That is worth a follow-up.
89b8cf5 to
c2a34c5
Compare
Sankalp-Mittal
left a comment
There was a problem hiding this comment.
[AI Generated] Review by review-factory (Claude Sonnet 5.5 + Claude Opus 5.5 + Claude Opus 5.5, cross-verified). Only points the reviewers agreed on are posted.
No issues found.
…alues validateNumber and validateInteger called reflect.TypeOf(v).Kind(), which dereferences a nil reflect.Type when the JSON value is null. bundle init crashed this way for a null number property in --config-file, a null in a number property's enum, and a null for an integer property that only a root anyOf schema declares. Both validators now report the null as a wrong type, as validateString and validateBoolean already do. Co-authored-by: Isaac <no-reply@databricks.com>
c2a34c5 to
2fca0df
Compare
Sankalp-Mittal
left a comment
There was a problem hiding this comment.
[AI Generated] Review by review-factory (Claude Opus 5.5 + Claude Sonnet 5.5 + Claude Opus 5.5, cross-verified). Only points the reviewers agreed on are posted.
No issues found.
Changes
validateNumberandvalidateIntegerin libs/jsonschema/validate_type.go now return their usualexpected type float/integer, but value is <nil>error for a JSONnullinstead of calling.Kind()on the nilreflect.Typethatreflect.TypeOf(nil)returns.validateStringandvalidateBooleanalready handle null this way.bundle initeffect, in acceptance/bundle/templates-machinery/null-value (from the test PR):--config-file{"ratio": null}for anumberproperty:Error: failed to load config from file ratio-null.json: incorrect type for property ratio: expected type float, but value is <nil>instead of a panic."enum": [0.5, null]on anumberproperty:Error: failed to load schema: type validation for enum at index 1 failed for property ratio: expected type float, but value is <nil>instead of a panic.{"extra": null}for anintegerproperty declared only in a rootanyOfsubschema:Error: failed to load config from file extra-null.json: instance does not match any of the schemas in anyOfinstead of a panic. A valid{"extra": 3}gets the same error (recorded in the test PR, a separate bug), so this case shows only that the panic is gone.Unit tests in validate_type_test.go cover nil for both validators. The stack-trace filter is no longer needed. Badness now describes only the remaining anyOf integer bug.
Why
This PR was created by analyzing coverage gaps. Coverage: http://go/cli/dashboard/coverage/file/libs/jsonschema/validate_type.go (validateNumber and validateInteger, lines 33-51).
A typo or a generated config file with a null crashes
bundle initwith a stack trace and a "please report this issue" message, when a one-line type error is all the user needs.Test: #8154
Gaps and risks
"default": nulland"const": nullare treated as absent (no type check). This PR leaves those behaviors alone.anyOfare still rejected for every value; that is left for a separate fix.🤖 AI agent (opus5.5, isaac_claude)
This pull request and its description were written by Isaac.