Skip to content

docs: make CLAUDE.md and CONTRIBUTING.md agree, and each own its facts - #490

Merged
kgdunn merged 3 commits into
mainfrom
claude/ruff-errors-chat-agents-xr89vb
Aug 9, 2026
Merged

docs: make CLAUDE.md and CONTRIBUTING.md agree, and each own its facts#490
kgdunn merged 3 commits into
mainfrom
claude/ruff-errors-chat-agents-xr89vb

Conversation

@kgdunn

@kgdunn kgdunn commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary

Started as the follow-up to #489 (record the two-command lint gate in CLAUDE.md), then grew to cover the reason that gate went unrecorded in the first place: the two contributor-facing documents had drifted apart, and neither pointed at the other.

Three commits.

1. Record the lint gate in CLAUDE.md

The gate is two independent commands; the ruff-pre-commit rev must track the ruff pin; and a # noqa stranded by a reflow should be moved, not deleted. That last one was the only non-mechanical part of #489: four directives sat at the end of long lines the reflow split, so each stayed behind while the code it suppressed moved. Ruff then reports both the unsuppressed rule and the unused directive, and the tempting fix (delete the RUF100) silently drops a live suppression.

2. Correct three stale instructions in CONTRIBUTING.md

Each sends a new contributor somewhere the repository no longer is:

Said Reality
pip install -e ".[dev]" Omits the optional runtime deps. pyDOE3 is in expt/all, so a large part of the suite fails on ImportError rather than skipping. Now ".[dev,all]", matching CI's uv sync --dev --all-extras.
black . Configured nowhere in the repo, and contradicts the ruff-only policy. Now ruff format ., plus ruff format --check . as the second gate from #489.
mypy process_improve Wrong path under the src layout. Now mypy src/process_improve.
"Add the method to the class in multivariate/methods.py" methods.py has been a re-export shim since ENG-01, so a method added there has no effect. Now points at _pca.py / _pls.py.

The first one is not theoretical: following that setup line in this session produced 130 failing tests before I matched CI's install.

3. Restructure CLAUDE.md around single sources of truth

It was accurate, but acting as a parallel contributor guide: it referenced none of the repo's other authoritative documents, restated policy CONTRIBUTING.md owns, and carried reference data duplicating the source.

Removed (code or CONTRIBUTING.md is the better source): the PCA/PLS fitted-attribute lists, which duplicated each class's Attributes docstring and had already drifted (PCA sets algorithm_, which the list omitted); the _model_method snippet, keeping the rule and rationale; and the long-form Docstrings / Scaling / "Adding New Methods" sections. One-line rules stay, so common cases do not need a second file open.

Added (nothing pointed at these):

  • An Authoritative documents table: CONTRIBUTING.md, the five policy docs under docs/development/ (error handling, reproducibility, deprecation, logging, tool authoring), and SKLEARN_COMPATIBILITY.md.
  • Test tier markers. pytest.ini registers unit/integration/slow/dataset; an untagged slow or network-bound test silently breaks -m 'not slow' for everyone.
  • Expt and the pi_ prefix, a public-API convention the file did not mention at all.
  • MAJOR in the versioning list. The section defined only PATCH and MINOR, then asked the reader to decide whether a change was "major or minor" using a word it never defined, and never mentioned the deprecation schedule.
  • _LazyFrame (ENG-18). Seven fitted attributes are descriptors over a private ndarray, so the "set only in fit()" rule alone would mislead anyone adding one.

Test plan

  • Documentation-only; no code paths touched
  • ruff check . and ruff format --check . both pass
  • Every path referenced by the new table resolves on disk (7 docs + 3 source modules checked)
  • Every CONTRIBUTING.md anchor linked from CLAUDE.md matches a real heading
  • No em-dashes in either file, per the repo prose rule
  • Claims verified against the source, not assumed: package tree (all 19 entries), methods.py shim, _LazyFrame semantics, Expt/pi_* attributes, pytest.ini markers, and that black appears in no config file

Checklist

  • Version bumped in pyproject.toml - not bumped, per maintainer instruction on this PR. Both files are contributor documentation and neither is packaged.
  • Tests added or updated where relevant (none applicable)
  • ruff check . passes
  • CHANGELOG.md updated - not required: CLAUDE.md classes edits to itself as internal-only, and the CONTRIBUTING.md corrections are not user-facing.

Follow-up to #489. That PR made `ruff format --check .` a CI gate alongside
`ruff check .`, but nothing wrote the convention down, so the next agent would
have gone on assuming a clean `ruff check .` meant the lint job would pass.

- Code Quality: state that the gate is two independent commands, that the
  ruff-pre-commit rev must track the ruff pin in pyproject.toml, and how to
  handle a `# noqa` stranded by a reflow (move it, do not delete it).
- CI/CD: the run-tests.yml description still listed `lint` as `ruff check .`
  alone, which is now wrong.

No version bump: CLAUDE.md is agent instructions rather than shipped code or
configuration, and this file already classes edits to itself as internal-only.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MT8LQS1YtrAGzir5SUeqWD
@codecov

codecov Bot commented Aug 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

claude added 2 commits August 9, 2026 08:34
Each of these sends a new contributor somewhere the repository no longer is:

- Setup said `pip install -e ".[dev]"`, which omits the optional runtime
  dependencies. pyDOE3 lives in the `expt`/`all` extras, so that environment
  fails a large part of the suite on ImportError rather than skipping. Now
  `".[dev,all]"`, matching CI's `uv sync --dev --all-extras`.
- The lint block told contributors to run `black .`, which is configured
  nowhere in the repository and contradicts the ruff-only policy, and
  `mypy process_improve`, which is the wrong path under the src layout. It now
  also documents `ruff format --check .` as the second, independent gate added
  in #489, and the pre-commit rev/pin alignment that gate depends on.
- "Adding new methods" pointed at `multivariate/methods.py`, which has been a
  re-export shim since ENG-01; a method added there has no effect. Now points
  at `_pca.py` / `_pls.py` and names the sibling modules.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MT8LQS1YtrAGzir5SUeqWD
The file was accurate but was acting as a parallel contributor guide: it
referenced none of the repository's other authoritative documents, restated
policy that CONTRIBUTING.md owns, and carried reference data that duplicates
the source and had already gone stale in one place.

Removed, because the code or CONTRIBUTING.md is the better source:

- The PCA and PLS fitted-attribute lists. They duplicated each class's
  Attributes docstring and had already drifted; PCA sets `algorithm_`, which
  the list omitted. Replaced with a pointer to read the class.
- The `_model_method` code snippet. The rule and its rationale are kept; an
  agent editing that class reads the real code anyway.
- Long-form Docstrings, Scaling and "Adding New Methods to PCA/PLS" sections
  that CONTRIBUTING.md already covers. One-line rules stay so common cases do
  not need a second file open.

Added, because nothing pointed at them:

- An Authoritative documents table: CONTRIBUTING.md plus the five policy
  documents under docs/development/ (error handling, reproducibility,
  deprecation, logging, tool authoring) and SKLEARN_COMPATIBILITY.md.
- Test tier markers. pytest.ini registers unit/integration/slow/dataset, and an
  untagged slow or network-bound test silently breaks `-m 'not slow'`.
- `Expt` and the `pi_` metadata prefix, a public-API convention the file did
  not mention at all.
- MAJOR in the versioning list. The section defined only PATCH and MINOR, then
  asked the reader to decide whether a change was "major or minor" using a word
  it never defined, and never mentioned the deprecation schedule.
- The `_LazyFrame` descriptor (ENG-18). Seven fitted attributes are descriptors
  over a private ndarray, so the "set only in fit()" rule alone would mislead
  anyone adding one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MT8LQS1YtrAGzir5SUeqWD
@kgdunn kgdunn changed the title docs: record the two-command lint gate in CLAUDE.md docs: make CLAUDE.md and CONTRIBUTING.md agree, and each own its facts Aug 9, 2026
@kgdunn
kgdunn merged commit ebd4e23 into main Aug 9, 2026
14 checks passed
@kgdunn
kgdunn deleted the claude/ruff-errors-chat-agents-xr89vb branch August 9, 2026 08:49
kgdunn added a commit that referenced this pull request Aug 10, 2026
The branch was cut from 0e8e8d1 on 7 August, before #486 through #490 merged,
and had gone stale. Four files conflicted.

Version metadata. This branch set 1.63.0 in pyproject.toml and CITATION.cff, but
1.63.0 was released from main on 8 August by #486, and main now stands at 1.66.1.
Taking this branch's value would have moved the version backwards onto a number
already in use, so main's 1.66.1 is kept in both files and no bump is made here.

CHANGELOG. The "## [1.63.0] - 2026-08-07" heading is dropped for the same reason
and its body moves under [Unreleased], leaving main's released history untouched.
The link-reference footer is taken from main, which carries the four releases
this branch predates.

experiments/__init__.py. Both sides appended to __all__ in the same region: this
branch added moment_aberration, main added manufacture and omars_minimum_runs.
All three are kept, alphabetical order restored, and the list checked
programmatically against the module's imports.

evaluate.py merged without conflict.

One thing the merge could not flag. SKILL.md stated that ten @tool_spec DOE tools
are reachable through the dispatcher and listed them in a table. Main added an
eleventh, trade_off_table, in #487. The count and the table are corrected, and
the documented list is now checked against the modules actually present in
experiments/_tools.

Verification after the merge:

  ruff check . and ruff format --check . clean
  mypy src/process_improve clean, 146 source files
  pytest: 2530 passed, 5 skipped, coverage 94.12%
  moment_aberration still reproduces the paper's Table 1 pattern exactly
    (3.27, 11.67, 42.47, 157.27, 591.27, 2251.67, 8666.47) at resolution IV,
    both directly and through the evaluate_design metric
  all three skill scripts run, including the non-zero exit path:
    verify_design.py --require-resolution 5 exits 3 on a resolution IV design

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W1daHPaXLs7PPRsq8CmMMm
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.

2 participants