Skip to content

feat: carry the corrected value in a fix field on every check - #32

Merged
shenxianpeng merged 1 commit into
mainfrom
claude/submit-patch-commit-check-42ac3i
Sep 5, 2026
Merged

feat: carry the corrected value in a fix field on every check#32
shenxianpeng merged 1 commit into
mainfrom
claude/submit-patch-commit-check-42ac3i

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented Sep 5, 2026

Copy link
Copy Markdown
Member

What

commit-check/commit-check#564 makes a failed check name its correction when the fix is unambiguous and serialises it as a fix field next to suggest. This PR makes that field part of the MCP contract.

  • _run_checks gives every check a fix key. With a commit-check that emits it, the engine's value flows through untouched; with an older commit-check the key is present and empty, so an agent can always test check["fix"] instead of probing for it.
  • Tool descriptions for all five validation tools tell the agent what the field is and how to use it: apply a non-empty fix as it stands, rewrite from suggest when it is empty.
  • README documents the field in the response shape.

Tests

  • 70 passed against the released commit-check 2.16.0 (key present, empty).
  • 70 passed against commit-check main, where Fix: add x comes back with "fix": "fix: add x" and suggest Use "fix: add x".
  • Three new tests: the key is always present, an engine value passes through untouched, an engine without the field yields an empty string.

No dependency bump: the passthrough works with the existing commit-check>=2.11.0 floor, and populated values arrive as soon as the next commit-check release is installed.

🤖 Generated with Claude Code

https://claude.ai/code/session_018xYa7m3qup5wyN5MaXFgf6


Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Validation results now include a fix field for every check.
    • When an unambiguous correction is available, fix contains the corrected value; otherwise, it remains empty.
    • Human-readable suggestions continue to be provided through the suggest field.
  • Documentation

    • Updated validation-result examples and tool descriptions to explain suggest and fix, including compatibility details for older releases.

commit-check now names the correction when a failed check has an
unambiguous one and serialises it as "fix" (commit-check#564). The
server already returns to_dict() as is, so the value flows through
once that release is installed; with an older commit-check the key was
simply absent, and an agent had to probe for it. Give the key a stable
presence, empty when the engine has nothing to say, and tell agents in
the tool descriptions how to use it: apply a non-empty fix as it
stands, rewrite from the suggestion otherwise.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018xYa7m3qup5wyN5MaXFgf6
@github-actions github-actions Bot added the enhancement New feature or request label Sep 5, 2026
@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: dcb0433e-2e70-4a05-ba27-774e1326d778

📥 Commits

Reviewing files that changed from the base of the PR and between 9bb8189 and 8300c86.

📒 Files selected for processing (3)
  • README.md
  • src/commit_check_mcp/server.py
  • tests/test_server.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Validation results now include a fix field for every check. Existing fixes remain unchanged, and missing fixes become empty strings. Server tool documentation, README examples, and tests describe and verify this behavior.

Changes

Validation fix field

Layer / File(s) Summary
Serialize and test stable fix results
src/commit_check_mcp/server.py, tests/test_server.py
_run_checks preserves engine-provided fix values and defaults missing values to empty strings. Tests verify the field type, passthrough behavior, and fallback.
Document the fix contract
src/commit_check_mcp/server.py, README.md
Tool documentation and the validation-result example describe suggest, fix, unambiguous corrections, and compatibility with older releases.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 8300c

Validation results now consistently include a fix field while retaining corrections from newer engines and safely supporting older versions. Documentation and tests cover the contract, with no current merge-blocking risk identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 58.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 2 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding a fix field that carries the corrected value for every check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 58.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 2 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/submit-patch-commit-check-42ac3i

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.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (9bb8189) to head (8300c86).

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #32   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines          203       205    +2     
=========================================
+ Hits           203       205    +2     

☔ View full report in Codecov by Harness.
📢 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.

@shenxianpeng
shenxianpeng merged commit 2bfe28b into main Sep 5, 2026
7 checks passed
@shenxianpeng
shenxianpeng deleted the claude/submit-patch-commit-check-42ac3i branch September 5, 2026 21:11
shenxianpeng added a commit to commit-check/commit-check.com that referenced this pull request Sep 5, 2026
## What

Restores the MCP guide paragraph held back from #32.
commit-check/commit-check-mcp#32 gives every check a `fix` key:
populated with the corrected value when commit-check can name one, empty
otherwise. The guide now says so, with a pointer to [Reading the
JSON](https://commit-check.com/example/#reading-the-json) for the
field's semantics.

Merge after commit-check-mcp#32 ships, so the guide describes a released
server.

Docs-sync tests: 9 passed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants