Skip to content

fix(doctor): guard malformed extension diagnostics json in doctor report - #6083

Closed
vaibhavsrv wants to merge 1 commit into
Osmantic:public-betafrom
vaibhavsrv:fix/doctor-ext-diagnostics-resilience
Closed

vaibhavsrv wants to merge 1 commit into
Osmantic:public-betafrom
vaibhavsrv:fix/doctor-ext-diagnostics-resilience

Conversation

@vaibhavsrv

Copy link
Copy Markdown
Contributor

Why this matters

In ods/scripts/ods-doctor.sh, extension diagnostics collected by the shell subshell are passed into Python as a JSON string argument (ext_diagnostics_json) and deserialized directly with json.loads(ext_diagnostics_json). If collect_extension_diagnostics outputs an empty string, non-JSON error messages from external commands, or a non-list/non-dict payload, Python raises an unhandled json.JSONDecodeError or subsequent AttributeError when accessing extension health properties. This crashes the doctor run before any JSON diagnostic report can be rendered.

This change wraps ext_diagnostics_json decoding in exception guards for TypeError and ValueError, defaults invalid or non-list payloads to an empty list, and filters elements to dictionary mappings. Existing diagnostic summaries, hint generators, and CLI flags remain completely unaffected.

Validation

  • Baseline reproduction: Passing an empty string or malformed JSON payload to the extension diagnostics deserializer raised json.decoder.JSONDecodeError and aborted report generation.
  • Post-fix verification: Running ods/tests/test_doctor_ext_diagnostics_guard.py verifies both end-to-end report generation with valid extension summaries and safe handling of empty, scalar, and malformed extension diagnostic payloads.
  • Telemetry: ODS Doctor test suite: test_doctor_ext_diagnostics_guard.py passes cleanly with exit code 0. Wired into Linux CI workflow under ODS Doctor Tests.

Overlap check

Risk / AI disclosure

AI-assisted investigation, implementation, and test regressions. This strengthens error handling for extension diagnostics JSON parsing in ods-doctor.sh. Independent human review and platform/runtime qualification remain gates. No running configuration, deployment or upstream merge changed.

Follow-up integration evidence

Composed with #6076, #6077, #6078, #6079, #6080, #6081, and #6082 at HEAD without conflicts. Production and test diffs passed together; doctor diagnostic and extension checks remain intact.
Backlog composition was local-only (production/test diffs, excluding workflow/Makefile wiring); it is not an upstream merge or independent human approval. Declared live-review gates remain open.

@Lightheartdevs

Copy link
Copy Markdown
Collaborator

Thanks for this contribution. public-beta was promoted into main on 2026-09-24 and no longer receives changes, so we're closing pull requests that target it. This isn't a judgment on the change itself. If it's still needed, please rebase onto main and open a focused PR. See #7253 for details and the contribution policy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants