Skip to content

[AAASM-4942] 🐛 (scripts): Make check_readme_version --check flag meaningful#292

Merged
Chisanan232 merged 2 commits into
masterfrom
v0.0.1/AAASM-4942/fix/readme_check_flag
Jul 20, 2026
Merged

[AAASM-4942] 🐛 (scripts): Make check_readme_version --check flag meaningful#292
Chisanan232 merged 2 commits into
masterfrom
v0.0.1/AAASM-4942/fix/readme_check_flag

Conversation

@Chisanan232

@Chisanan232 Chisanan232 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Description

scripts/check_readme_version.py accepted a --check flag but never read its
parsed value: parser.parse_args(argv) was discarded and audit() ran
unconditionally, so drift always returned exit 1 regardless of the flag. The flag
implied a mode that didn't exist. This makes it meaningful:

  • --check (the CI-gate mode, unchanged for callers): exit 1 on drift.
  • bare invocation: report drift to stderr but exit 0 — informational, non-gating.

The on-sync path is identical in both modes (prints the in-sync message, exits 0),
so the existing CI invocation (python scripts/check_readme_version.py --check in
readme-version-check.yml) and the CONTRIBUTING.md guidance keep working with no
caller changes.

Type of Change

  • 🔧 Bug fix

Breaking Changes

  • No

Related Issues

Testing

  • Unit tests added/updated

New test/unit/test_check_readme_version.py pins the two modes (loads the script
via importlib, monkeypatches _repo_root onto a temp tree): --check exits 1 on
drift, bare run exits 0 on drift, both exit 0 when in sync.

Manual validation:

  • .venv/bin/python scripts/check_readme_version.py --check on the current tree → exit 0.
  • Simulated-drift temp tree: --check → exit 1, bare → exit 0.
  • ruff check + ruff format --check + mypy clean; new tests pass.

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • All tests passing

The parsed args were discarded, so --check was a no-op: audit() ran
unconditionally and drift always forced exit 1 regardless of the flag.
Read args.check so --check gates (exit 1 on drift, the CI mode) while a
bare invocation reports drift but exits 0 for informational runs.

Refs AAASM-4942
…ting

Pin the two distinct modes so --check can't regress to a no-op: --check
exits 1 on drift while a bare run reports drift but exits 0.

Refs AAASM-4942
@Chisanan232

Copy link
Copy Markdown
Contributor Author

🤖 Claude Code review

Scope — Two commits: the one-word-of-logic fix (scripts/check_readme_version.py) and its regression tests (test/unit/test_check_readme_version.py). No caller changes; verified all four invocations still pass --check and behave identically (CI readme-version-check.yml, CONTRIBUTING.md ×2, .claude/CLAUDE.md).

Root causeparser.parse_args(argv) was called for validation only; the return value was dropped, so args.check was never consulted and drift always forced exit 1. The --check flag was inert — the exact no-op AAASM-4942 describes.

Fix — Capture args = parser.parse_args(argv) and gate the drift branch: return 1 if args.check else 0. On-sync behavior is unchanged in both modes. --check remains the CI gate; a bare run becomes an informational, non-failing report, which is what the help text always implied.

Risk — Low. The CI gate keeps failing on drift exactly as before (it passes --check); only the previously-unreachable non---check path changes, and it now honestly does something. No behavior change for any existing caller.

Validation--check exits 1 on simulated drift / 0 in sync; bare run exits 0 either way. ruff check, ruff format --check, and strict mypy clean; 3 new unit tests pass.

@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@sonarqubecloud

Copy link
Copy Markdown

@Chisanan232
Chisanan232 merged commit 81d5ffa into master Jul 20, 2026
23 checks passed
@Chisanan232
Chisanan232 deleted the v0.0.1/AAASM-4942/fix/readme_check_flag branch July 20, 2026 12:44
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.

1 participant