Repository navigation
acc: record that a null property schema in a template panics - #8167
Conversation
A template schema with "properties": {"p": null} (at the root, or in a
root anyOf branch with a matching config value) makes bundle init panic
with a nil pointer dereference. Record the current behavior with a
Badness note.
Co-authored-by: Isaac <no-reply@databricks.com>
Regression test report ✅Commit: Selected 1 changed tests (limit=20, 0 not selected) 2 tests: regression=0 unreleased=0 coverage=2 failing=0
|
✅ Integration test reportCommit: 8498221
Top 3 slowest tests (at least 2 minutes):
|
There was a problem hiding this comment.
Automated review at 04ae399. Each finding was verified against the code.
No blocking issues found. 1 non-blocking comment(s) below.
This PR adds an acceptance test that records two bundle init panics, both caused by a template schema property whose schema is JSON null: one at the root and one inside a root anyOf branch. The fixtures are small and the Badness note describes the expected fix. My one change request is about the stack-trace filter, which drops every frame. As a result, the golden output can't tell these panics apart from any other nil dereference, and the trace isn't kept anywhere.
The stack trace says where each panic comes from (LoadFS for the root case, validateEnum for the anyOf case); go test -v shows LOG.* files but the runner doesn't diff them. Co-authored-by: Isaac <no-reply@databricks.com>
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.
Changes
New test acceptance/bundle/templates-machinery/null-property-schema: custom templates initialized non-interactively with
bundle init, whosedatabricks_template_schema.jsonhas a property whose schema is JSONnull:"properties": {"p": null}at the root: the CLI panics (runtime error: invalid memory address or nil pointer dereference) while loading the schema, even without a config file."anyOf": [{"properties": {"q": null}}], withqalso declared at the root and set in--config-file: the CLI panics while validating the config.The stack frames depend on the build, so the script tees each command's raw output into
LOG.top/LOG.any-of(shown bygo test -v, not diffed; they show the panic sites,LoadFSandvalidateEnum) and drops the frames aftergoroutinefrom output.txt. Badness in test.toml describes the wrong behavior and the expected one.Cause:
json.Unmarshalstores"p": nullinProperties map[string]*Schemaas a nil pointer.LoadFSin libs/jsonschema/schema.go readsproperty.Typeon it for the root case, and the instance validators (validateEnumand the others in libs/jsonschema/instance.go) read fields of it for theanyOfcase.Why
This PR was created by analyzing coverage gaps. Coverage: http://go/cli/dashboard/coverage/file/libs/jsonschema/schema.go (LoadFS, lines 323-368: covered by unit and acceptance tests, but none loads a schema with a null property).
This is a new small test next to the other templates-machinery tests instead of an addition to null-value, which is about null values in the config file (and which an open PR is changing). Runtime is about 0.06s per variant (DMS matrix inherited from acceptance/bundle, 2 variants).
Fix: #8168
Gaps and risks
skip_prompt_ifvariant of the same panic needs a TTY, so it is covered by unit tests in the fix PR instead.🤖 AI agent (opus5.5, isaac_claude)
This pull request and its description were written by Isaac.