Skip to content

Add input_model field support to cli_doc marker#2805

Merged
koxudaxi merged 3 commits intomainfrom
feature/cli-doc-input-model
Dec 26, 2025
Merged

Add input_model field support to cli_doc marker#2805
koxudaxi merged 3 commits intomainfrom
feature/cli-doc-input-model

Conversation

@koxudaxi
Copy link
Copy Markdown
Owner

@koxudaxi koxudaxi commented Dec 26, 2025

Summary by CodeRabbit

  • New Features

    • Added support for an input_model field as an accepted alternative in CLI documentation markers.
    • Validation now enforces module:name formatting for input_model when provided.
  • Tests

    • Strengthened marker validation and updated error messages to reflect the new input_model requirements.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 26, 2025

Warning

Rate limit exceeded

@koxudaxi has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 3 minutes and 19 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between a28ef84 and dd4e09f.

📒 Files selected for processing (1)
  • tests/conftest.py
📝 Walkthrough

Walkthrough

Added a public TypedDict CliDocKwargs and tightened CLI doc marker validation in tests/conftest.py: marker kwargs are cast to CliDocKwargs, input_model is accepted and validated as a str in module:name format, and required-field logic now treats input_model as an alternative to input_schema/config_content.

Changes

Cohort / File(s) Summary
CLI validation & types
tests/conftest.py
Introduced CliDocKwargs (TypedDict); changed _validate_cli_doc_marker(node_id: str, kwargs: CliDocKwargs) -> list[str]; cast marker.kwargs to CliDocKwargs during collection; added runtime validation for input_model (must be str and follow module:name with a colon); updated required-fields checks to accept input_model as an alternative to input_schema/config_content and adjusted error messages.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I hopped into tests with a tiny cheer,
A colon-bound model has now drawn near,
TypedDict in paw, I check each name,
Module:Name dances into the game,
Tests hum softly — validation clear.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add input_model field support to cli_doc marker' directly and accurately summarizes the main change: introducing support for a new input_model field to the cli_doc marker, which aligns with the summary of changes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 355a344 and 4e9872f.

📒 Files selected for processing (1)
  • tests/conftest.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (19)
  • GitHub Check: py312-isort7 on Ubuntu
  • GitHub Check: py312-black24 on Ubuntu
  • GitHub Check: py312-black22 on Ubuntu
  • GitHub Check: py312-black23 on Ubuntu
  • GitHub Check: py312-isort6 on Ubuntu
  • GitHub Check: 3.10 on Ubuntu
  • GitHub Check: 3.10 on Windows
  • GitHub Check: 3.10 on macOS
  • GitHub Check: py312-isort5 on Ubuntu
  • GitHub Check: 3.11 on Windows
  • GitHub Check: 3.12 on Windows
  • GitHub Check: 3.14 on macOS
  • GitHub Check: 3.13 on Ubuntu
  • GitHub Check: 3.14 on Windows
  • GitHub Check: 3.13 on macOS
  • GitHub Check: 3.12 on Ubuntu
  • GitHub Check: 3.11 on Ubuntu
  • GitHub Check: benchmarks
  • GitHub Check: Analyze (python)
🔇 Additional comments (1)
tests/conftest.py (1)

69-74: LGTM! Logic for input_model alternative is correct.

The required-fields validation correctly treats input_model as an alternative to input_schema and config_content, and the error message accurately reflects all available options.

Comment thread tests/conftest.py Outdated
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Dec 26, 2025

CodSpeed Performance Report

Merging #2805 will not alter performance

Comparing feature/cli-doc-input-model (dd4e09f) with main (355a344)

Summary

✅ 73 untouched
⏩ 10 skipped1

Footnotes

  1. 10 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.51%. Comparing base (355a344) to head (dd4e09f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2805   +/-   ##
=======================================
  Coverage   99.51%   99.51%           
=======================================
  Files          89       89           
  Lines       13745    13758   +13     
  Branches     1619     1619           
=======================================
+ Hits        13678    13691   +13     
  Misses         36       36           
  Partials       31       31           
Flag Coverage Δ
unittests 99.51% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
tests/conftest.py (1)

67-67: Clean up the noqa directive.

According to static analysis, PLR0912 and PLR0914 are not enabled and can be removed from the noqa directive.

🔎 Proposed fix
-def _validate_cli_doc_marker(node_id: str, kwargs: CliDocKwargs) -> list[str]:  # noqa: ARG001, PLR0912, PLR0914  # pragma: no cover
+def _validate_cli_doc_marker(node_id: str, kwargs: CliDocKwargs) -> list[str]:  # noqa: ARG001  # pragma: no cover
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4e9872f and a28ef84.

📒 Files selected for processing (1)
  • tests/conftest.py
🧰 Additional context used
🪛 Ruff (0.14.10)
tests/conftest.py

67-67: Unused noqa directive (non-enabled: PLR0912, PLR0914)

Remove unused noqa directive

(RUF100)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: py312-black24 on Ubuntu
  • GitHub Check: py312-isort5 on Ubuntu
  • GitHub Check: py312-black22 on Ubuntu
  • GitHub Check: py312-isort7 on Ubuntu
  • GitHub Check: py312-pydantic1 on Ubuntu
  • GitHub Check: 3.11 on macOS
  • GitHub Check: 3.11 on Windows
  • GitHub Check: py312-black23 on Ubuntu
  • GitHub Check: 3.12 on Ubuntu
  • GitHub Check: 3.12 on Windows
  • GitHub Check: py312-isort6 on Ubuntu
  • GitHub Check: 3.12 on macOS
  • GitHub Check: 3.14 on macOS
  • GitHub Check: 3.14 on Ubuntu
  • GitHub Check: 3.11 on Ubuntu
  • GitHub Check: 3.13 on Ubuntu
  • GitHub Check: 3.13 on Windows
  • GitHub Check: 3.14 on Windows
  • GitHub Check: benchmarks
  • GitHub Check: Analyze (python)
🔇 Additional comments (5)
tests/conftest.py (5)

12-12: LGTM!

The added imports (Required, TypedDict, cast) are necessary for the new CliDocKwargs TypedDict and type casting functionality.


28-42: LGTM!

The CliDocKwargs TypedDict properly formalizes the marker kwargs structure with appropriate use of Required for mandatory fields (options, cli_args) and optional typing for the rest, including the new input_model field.


85-90: LGTM!

The validation logic correctly treats input_model as an alternative to input_schema and config_content, with a clear error message explaining the requirement.


113-120: LGTM!

The format validation for input_model is thorough and correctly addresses the concern from the past review comment. It now:

  1. Validates the type is a string
  2. Splits on the first ":"
  3. Ensures exactly two parts exist
  4. Verifies both parts are non-empty after stripping whitespace

This prevents invalid formats like ":", "module:", ":name", or whitespace-only parts.


191-191: LGTM!

The cast to CliDocKwargs is appropriate here. It's a type hint for static analysis while the actual runtime validation occurs in _validate_cli_doc_marker, ensuring type safety.

@koxudaxi koxudaxi merged commit 9f8de8a into main Dec 26, 2025
36 checks passed
@koxudaxi koxudaxi deleted the feature/cli-doc-input-model branch December 26, 2025 01:33
@github-actions
Copy link
Copy Markdown
Contributor

Breaking Change Analysis

Result: No breaking changes detected

Reasoning: PR #2805 modifies only internal test infrastructure in tests/conftest.py. It adds a new optional input_model field to the @pytest.mark.cli_doc pytest marker, which is used internally for test documentation and coverage tracking. This is not part of the public API - it's purely internal test tooling that library consumers never interact with. The change is additive (adding a new optional field) and backward compatible (existing tests using input_schema or config_content continue to work unchanged). No changes affect: generated code output, custom templates, CLI options, Python API, default behavior, Python version support, or error handling for end users.


This analysis was performed by Claude Code Action

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant