Skip to content

acc: record that null values for number template properties panic - #8154

Merged
denik merged 3 commits into
mainfrom
denik/acc-jsonschema-null
Nov 28, 2026
Merged

denik merged 3 commits into
mainfrom
denik/acc-jsonschema-null

Conversation

@denik

@denik denik commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Changes

New test acceptance/bundle/templates-machinery/null-value: custom templates initialized non-interactively with bundle init, recording what happens when a property gets a JSON null:

  • --config-file with {"ratio": null} for a number property: the CLI panics (runtime error: invalid memory address or nil pointer dereference).
  • --config-file with {"count": null} for an integer property: a clean error (failed to parse property count: cannot convert <nil> to an integer), included for contrast.
  • A template schema with "enum": [0.5, null] on a number property: panics while loading the schema.
  • --config-file with {"extra": null}, where extra is an integer property that the schema's only root anyOf alternative declares: panics.
  • --config-file with {"extra": 3} for the same property: rejected with instance does not match any of the schemas in anyOf, although 3 is a valid integer. LoadInstance converts only root-level integer properties from float64, so an integer declared only in anyOf fails for every value. This is a separate bug; the case shows that the null case's error after the fix is not specific to null.

Every command is expected to fail, so the script asserts it with musterr. It drops the stack frames after Stack Trace: because they depend on the build, as acceptance/panic does. Badness in test.toml describes the wrong behavior and the expected one.

Cause: validateNumber and validateInteger in libs/jsonschema/validate_type.go call reflect.TypeOf(v).Kind(), and reflect.TypeOf(nil) returns a nil reflect.Type. For top-level integer properties toInteger rejects nil first, which is why only the anyOf path reaches the integer validator with a nil value.

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: unit tests cover them, but no test passes a null).
This is a new small test next to the other templates-machinery tests, since none of them sends a null. Runtime is about 0.05s per variant (DMS matrix inherited from acceptance/bundle, 2 variants).

Fix: #8155

Gaps and risks

  • Self-review (Opus, Astra) and review: the stack-trace filter works with BSD sed, and the failures are asserted with musterr.
  • The anyOf integer rejection is recorded, not fixed; it needs its own fix PR.
  • Test-only. Risk: low.

🤖 AI agent (opus5.5, isaac_claude)

This pull request and its description were written by Isaac.

bundle init crashes with a nil-pointer panic in the JSON schema type check
when a property of type number gets null, from --config-file or from the
template schema's enum, and when an integer property that only a root anyOf
schema declares gets null from --config-file. A null for a top-level integer
property fails cleanly.

Co-authored-by: Isaac <no-reply@databricks.com>
@github-actions github-actions Bot added DABs DABs related issues test-only-fix PRs that update failing of flaky tests without changing CLI code. labels Nov 28, 2026
Co-authored-by: Isaac <no-reply@databricks.com>
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Regression test report ✅

Commit: 619e881cd | Workflow run

Selected 1 changed tests (limit=20, 0 not selected)

2 tests: regression=0 unreleased=0 coverage=2 failing=0
test branch main (905b0f7) latest (v1.28.0)
TestAccept/bundle/templates-machinery/null-value/DMS= ✅ ✅ ✅
TestAccept/bundle/templates-machinery/null-value/DMS=true ✅ ✅ ✅

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 619e881

Run: 46092153104

Env ✅​pass 🙈​skip Time
✅​ aws linux-2core-8gb 174 18 4:58
✅​ aws-windows-latest-4core-16gb 174 18 2:42
✅​ azure linux-2core-8gb 173 18 3:46
✅​ azure-windows-latest-4core-16gb 173 18 3:38
✅​ gcp linux-2core-8gb 174 18 3:44
✅​ gcp-windows-latest-4core-16gb 174 18 3:46
Top 6 slowest tests (at least 2 minutes):
duration env testname
3:47 aws linux-2core-8gb TestAccept
3:44 gcp-windows-latest-4core-16gb TestAccept
3:36 azure-windows-latest-4core-16gb TestAccept
3:22 azure linux-2core-8gb TestAccept
3:18 gcp linux-2core-8gb TestAccept
2:41 aws-windows-latest-4core-16gb TestAccept

@denik
denik marked this pull request as ready for review November 28, 2026 00:49
@denik
denik requested review from a team as code owners November 28, 2026 00:49

@review-oss-bot review-oss-bot Bot 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.

Automated review at a51b35b. Each finding was verified against the code.

No blocking issues found. 2 non-blocking comment(s) below.

This PR adds an acceptance test that records how bundle init handles JSON null for template properties. Three cases hit the nil reflect.TypeOf panic in validateNumber/validateInteger, and one is a clean integer error included for contrast. The fixtures and golden output match the current code paths. Two things are worth changing: the expected failures should use musterr, and the anyOf case can't tell a null apart from a valid integer.

@Sankalp-Mittal Sankalp-Mittal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[AI Generated] Review by review-factory (Claude Opus 5.5 + Claude Opus 5.5 + Claude Sonnet 5.5, cross-verified). Only points the reviewers agreed on are posted.

No blocking or major issues found.

… integer rejection

Co-authored-by: Isaac <no-reply@databricks.com>

@Sankalp-Mittal Sankalp-Mittal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[AI Generated] Follow-up review by review-factory (Claude Opus 5.5 + Claude Opus 5.5 + Claude Sonnet 5.5, cross-verified). Only points the reviewers agreed on are posted.

Earlier findings: 1 still open.

No new issues found.

@denik
denik added this pull request to the merge queue Nov 28, 2026
Merged via the queue into main with commit 21661cc Nov 28, 2026
27 checks passed
@denik
denik deleted the denik/acc-jsonschema-null branch November 28, 2026 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DABs DABs related issues factory-generated test-only-fix PRs that update failing of flaky tests without changing CLI code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants