Skip to content

fix(inspect): suppress banner and spinner in JSON mode#745

Merged
DingmaomaoBJTU merged 5 commits into
release/v0.1.0from
qiowu/fix-inspect-json-734
May 26, 2026
Merged

fix(inspect): suppress banner and spinner in JSON mode#745
DingmaomaoBJTU merged 5 commits into
release/v0.1.0from
qiowu/fix-inspect-json-734

Conversation

@DingmaomaoBJTU
Copy link
Copy Markdown
Collaborator

@DingmaomaoBJTU DingmaomaoBJTU commented May 26, 2026

Summary

Fixes #734

Two fixes for winml inspect e2e test failures:

1. JSON mode: suppress banner and spinner (20 failures)

  • Click 8.4 removed mix_stderr and always mixes stderr into CliRunner.result.output
  • The banner ("Inspecting …") and spinner added in fix(inspect): show banner + spinner during HF metadata fetch (#543) #718 write to stderr via _stderr_console, contaminating the JSON payload and causing JSONDecodeError in all JSON-parsing tests
  • Suppress banner and spinner when --format json is requested — JSON consumers expect clean stdout

2. CLIP model_type: use parent config type (2 failures)

  • For multimodal models (CLIP), resolve_loader_config narrows the hf_config to a sub-config (e.g. clip_text_model), which is correct for internal registry lookups
  • But the user-facing InspectResult.model_type should show the parent type (clip), not the narrowed sub-config type
  • Use parent_hf_config.model_type for the display field while keeping the narrowed type for internal resolution

🤖 Generated with Claude Code

Click 8.4 removed the mix_stderr parameter and always mixes stderr
into CliRunner.result.output. The banner and spinner added in #718
write to stderr via _stderr_console, which contaminates the JSON
payload in result.output — causing all 20 JSON-parsing e2e tests
to fail with JSONDecodeError.

Suppress the banner and spinner when --format json is requested,
matching the expectation that JSON consumers get clean stdout.
@DingmaomaoBJTU DingmaomaoBJTU requested a review from a team as a code owner May 26, 2026 05:50
For multimodal models like CLIP, resolve_loader_config narrows the
hf_config to a sub-config (e.g. CLIPTextConfig with model_type
"clip_text_model"). The narrowed type is correct for internal
registry lookups (TasksManager, I/O specs), but the user-facing
InspectResult should show the parent model_type ("clip").

Use parent_hf_config.model_type for the display field while keeping
the narrowed model_type for all internal resolution paths.
timenick

This comment was marked as outdated.

Copy link
Copy Markdown
Collaborator

@timenick timenick left a comment

Choose a reason for hiding this comment

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

One question on the trade-off: was a test-side fix considered before reaching for the production-side suppression?

Comment thread src/winml/modelkit/commands/inspect.py
The previous fix used only parent_hf_config.model_type, which works
when model_id is provided (step 1 loads the parent config). But for
--model-type clip (no model_id), parent_hf_config falls back to the
narrowed hf_config at line 340, so display_model_type was still
"clip_text_model".

Add model_type_override as the first precedence level: when the user
explicitly passes --model-type, use that value directly.

Precedence chain:
  1. model_type_override (user's --model-type flag)
  2. parent_hf_config.model_type (pre-narrowing, when model_id given)
  3. loader_config.model_type (narrowed fallback)
…suppression

Revert the banner/spinner suppression in JSON mode — the original design
(PR #718) deliberately puts them on stderr so pipe-to-jq users still see
progress feedback.  The real issue is Click 8.4's result.output mixing
both streams; fix the tests to read result.stdout (which preserves the
split), matching the pattern already used in test_sys_e2e.py.
@DingmaomaoBJTU DingmaomaoBJTU merged commit 0eaf711 into release/v0.1.0 May 26, 2026
9 checks passed
@DingmaomaoBJTU DingmaomaoBJTU deleted the qiowu/fix-inspect-json-734 branch May 26, 2026 07:52
timenick added a commit that referenced this pull request May 27, 2026
…757)

## Summary

- Folds the seven fixes merged after the v0.1.0 release notes into the
existing v0.1.0 changelog section: #745, #746 (inspect), #747, #753
(perf), #750 (eval), #744/#752, #754 (analyze/compile e2e).
- Trims the v0.1.0 section to focus on user-visible changes:
  - Removed telemetry mentions (#728 preview bullet and #693 fix line).
- Removed pure-internal CI/test items (CI display name rename, ADO
pipeline UI plumbing, mock fixes, branch back-merge).
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.

3 participants