Validate baseline.strategy; align docs with implemented metrics - #9
Merged
Conversation
- load_config now rejects unknown baseline.strategy values and the planned but unimplemented state-file strategy, instead of silently scanning with script-jump (issue #1 directs operators to try state-file on programming.zh-cn, which would have produced wrong baselines without warning). - README and docs/method.md no longer claim character-level churn is reported; that work is tracked in #4. - Fix pre-existing lint errors (E701/E702/E741) surfaced by ruff 0.15, which CI installs unpinned. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MhveTMPqgH3AhmJui3h41m
There was a problem hiding this comment.
Pull request overview
This PR lands Phase 0 of the work plan in issue #8: two audit defect fixes plus the lint fixes needed to keep CI green under current ruff. It fits into the deterministic scan pipeline by closing a silent-misconfiguration gap in load_config and correcting documentation that overstated the implemented metrics, without altering any scanning behaviour (all shipped configs use script-jump).
Changes:
- F1:
load_confignow validatesbaseline.strategy, rejecting unknown values and raising a clear "planned but not implemented" error forstate-file, mirroring the existingprose.strategyguard. - F2: README and
docs/method.mdno longer claim character-level churn is reported; they now mark it as planned and point to #4. - Mechanical ruff E701/E702/E741 fixes in
git.py,scan.py, andtests/test_units.py, plus a new validation test and CHANGELOG entries.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/textstrata/config.py | Adds baseline.strategy validation and reuses the validated instance in Config. |
| tests/test_units.py | Adds test_baseline_strategy_validated; splits multi-statement lines to satisfy ruff. |
| src/textstrata/scan.py | Renames ambiguous l loop variable to ln (E741). |
| src/textstrata/git.py | Renames ambiguous l loop variable to ln (E741). |
| README.md | Marks character-level churn as planned, linking #4. |
| docs/method.md | Aligns the known-limits note with implemented metrics, linking #4. |
| CHANGELOG.md | Records the F1 validation and F2 doc-alignment fixes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 0 of the work plan in #8: the two defects found by the 2026-08-25 audit, plus the lint fixes needed to keep CI green under current ruff.
What changed
F1 —
baseline.strategywas accepted but never read.load_confignow validates it: unknown values are rejected, and the planned but unimplementedstate-filestrategy raises a clear "planned but not implemented" error, mirroring the existing guard forprose.strategy: source-diff. Previouslybaseline: {strategy: state-file}— which #1 directs the operator to try on programming.zh-cn — was silently accepted and scanned withscript-jump, producing plausible-but-wrong baselines. Addedtest_baseline_strategy_validatedcovering both the unimplemented value and a typo.F2 — docs claimed character-level churn that does not exist. README said churn "is also reported in changed characters" and
docs/method.mdsaid it is "available in changed characters from the pairs"; no artefact carries a character count. Both now say character-level churn is planned and point at #4 (no closing keyword — this PR does not implement it).Lint. ruff 0.15 (CI installs ruff unpinned,
>=0.6) now enforces E701/E702/E741, which flagged 7 pre-existing errors ingit.py,scan.pyandtests/test_units.py; fixed mechanically (renamed ambiguouslvariables, split multi-statement lines) so this PR's CI — and the next push tomain— stays green.Also adds CHANGELOG entries for both fixes.
Validation
ruff check src testsclean;pytest -q7 passed, 1 skipped (the regression test needs the pinned lecture-intro.zh-cn checkout and runs in CI). No behaviour change for any existing config: all shipped configs usescript-jump, and the regression-compared quantities are untouched.🤖 Generated with Claude Code
https://claude.ai/code/session_01MhveTMPqgH3AhmJui3h41m
Generated by Claude Code