Skip to content

fix: address non-blocking reviewer nits from #178, #179, and #157#194

Open
mimran-khan wants to merge 2 commits into
NVIDIA:mainfrom
mimran-khan:fix/reviewer-nits-178-179-157
Open

fix: address non-blocking reviewer nits from #178, #179, and #157#194
mimran-khan wants to merge 2 commits into
NVIDIA:mainfrom
mimran-khan:fix/reviewer-nits-178-179-157

Conversation

@mimran-khan

@mimran-khan mimran-khan commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Addresses non-blocking reviewer suggestions from two approved PRs:

Changes

  • src/skillspector/providers/base.py — add DEFAULT_MODEL: ClassVar[str] and SLOT_DEFAULTS: ClassVar[dict[str, str]] to ModelMetadataProvider
  • src/skillspector/providers/chat_models.py — add validate_base_url(), called from create_openai_compatible_chat_model
  • src/skillspector/constants.py — remove stale # type: ignore[attr-defined]
  • tests/unit/test_reviewer_nits.py — 10 tests: Protocol attribute declarations, existing provider conformance, URL validation (valid/invalid/edge cases)

Test plan

  • 10 new tests pass (pytest tests/unit/test_reviewer_nits.py -v)
  • 36 existing provider tests pass (no regressions)
  • Protocol declares DEFAULT_MODEL and SLOT_DEFAULTS
  • All existing providers (NvBuild, OpenAI, Anthropic) satisfy updated Protocol
  • Stale type: ignore[attr-defined] removed from constants.py
  • Valid http/https URLs produce no warnings
  • None base URL produces no warnings
  • Non-http scheme (ftp) warns
  • Empty/missing host warns
  • Malformed URLs warn but never raise
  • Linting clean (ruff check)

Add DEFAULT_MODEL and SLOT_DEFAULTS as ClassVar declarations to
ModelMetadataProvider Protocol so callers no longer need
type: ignore[attr-defined] when accessing provider attributes.

Add validate_base_url() helper that warns on malformed (non-http/https
or missing host) base URLs at model creation time, catching operator
misconfigurations early without raising.

@mohgupta-ship-it mohgupta-ship-it left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

PR #194 is mostly good, but I would ask for one small fix before merging.

The real reason it’s needed: it makes the provider interface honest. ModelMetadataProvider users already access DEFAULT_MODEL and SLOT_DEFAULTS, but the protocol did not declare them, so type checkers needed a suppressing comment. The base URL warning is also useful operator polish: bad OPENAI_BASE_URL / provider URLs fail earlier with a clear warning instead of later with a vague HTTP/client error.

One issue: the PR adds the protocol attributes but does not remove the old ignore in src/skillspector/constants.py:36.

_SKILLSPECTOR_DEFAULT_MODEL = _provider.DEFAULT_MODEL  # type: ignore[attr-defined]

With the PR applied, that ignore becomes unused. I verified:

uv run --extra dev mypy src/skillspector/constants.py src/skillspector/providers/base.py
src/skillspector/constants.py:36: error: Unused "type: ignore" comment

So the fix is just:

_SKILLSPECTOR_DEFAULT_MODEL = _provider.DEFAULT_MODEL

Other results: targeted tests pass, 46 passed, 9 skipped; ruff passes on changed files.

Small nit: assert hasattr(ModelMetadataProvider, "__protocol_attrs__") or True in the new test is a no-op and should be removed. Also the PR mentions #157, but that SVG change is not actually in this PR, so the wording is a little confusing.

Verdict: good small cleanup PR, genuinely useful, but merge after removing the stale type: ignore and the no-op test assertion.

Remove unused # type: ignore[attr-defined] from constants.py now that
ModelMetadataProvider declares DEFAULT_MODEL.

Remove no-op `assert hasattr(...) or True` from test.
@mimran-khan

Copy link
Copy Markdown
Contributor Author

Thanks @mohgupta-ship-it — all three items addressed:

  1. Stale type: ignore — removed from constants.py:36. Confirmed mypy no longer flags it.
  2. No-op assertion — removed assert hasattr(...) or True; the test now goes straight to the __annotations__ check.
  3. fix(static-runner): skip binary/PDF files and filter PE3 .env doc references #157 mention — removed from the PR description since that SVG change is on fix(static-runner): skip binary/PDF files and filter PE3 .env doc references #157's branch, not this diff.

46 passed, 9 skipped; ruff clean. Ready for re-review.

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