Skip to content

Validate baseline.strategy; align docs with implemented metrics - #9

Merged
mmcky merged 1 commit into
mainfrom
claude/textstrata-audit-rxgyuj
Aug 25, 2026
Merged

Validate baseline.strategy; align docs with implemented metrics#9
mmcky merged 1 commit into
mainfrom
claude/textstrata-audit-rxgyuj

Conversation

@quantecon-services

Copy link
Copy Markdown
Collaborator

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.strategy was accepted but never read. load_config now validates it: unknown values are rejected, and the planned but unimplemented state-file strategy raises a clear "planned but not implemented" error, mirroring the existing guard for prose.strategy: source-diff. Previously baseline: {strategy: state-file} — which #1 directs the operator to try on programming.zh-cn — was silently accepted and scanned with script-jump, producing plausible-but-wrong baselines. Added test_baseline_strategy_validated covering 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.md said 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 in git.py, scan.py and tests/test_units.py; fixed mechanically (renamed ambiguous l variables, split multi-statement lines) so this PR's CI — and the next push to main — stays green.

Also adds CHANGELOG entries for both fixes.

Validation

ruff check src tests clean; pytest -q 7 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 use script-jump, and the regression-compared quantities are untouched.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MhveTMPqgH3AhmJui3h41m


Generated by Claude Code

- 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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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_config now validates baseline.strategy, rejecting unknown values and raising a clear "planned but not implemented" error for state-file, mirroring the existing prose.strategy guard.
  • F2: README and docs/method.md no 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, and tests/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.

@mmcky
mmcky merged commit ee68ac6 into main Aug 25, 2026
4 checks passed
@mmcky
mmcky deleted the claude/textstrata-audit-rxgyuj branch August 25, 2026 05:59
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.

4 participants