Skip to content

Fix drift in core / api / config docstrings - #100

Open
kgdunn wants to merge 5 commits into
mainfrom
claude/ecstatic-johnson-w8lfrg
Open

Fix drift in core / api / config docstrings#100
kgdunn wants to merge 5 commits into
mainfrom
claude/ecstatic-johnson-w8lfrg

Conversation

@kgdunn

@kgdunn kgdunn commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Summary

Audit of computational and user-facing docstrings under src/scorepilot/core/, src/scorepilot/db/, and src/scorepilot/api/ (plus the Settings class and API request schemas that back them). Four real inconsistencies were found; each is fixed by editing the docstring to match the code. No behaviour changes.

Inconsistencies fixed

  • src/scorepilot/core/transforms.pyapply_transform Notes for power.
    The docstring stated sign(x) * abs(x) ** c1 with "default c1 = 0.5, i.e. signed root". The signature actually defaults c1 to 0.0; the code substitutes an exponent of 0.5 only when c1 == 0.0 (exponent = c1 if c1 != 0.0 else 0.5). The rewritten note reflects the real fallback while still explaining why the default acts as a signed square root.

  • src/scorepilot/schemas.pyFitModelRequest docstring.
    Claimed that in auto_components mode n_components "is used only as an upper bound on what is evaluated." _run_fit in api/models.py explicitly passes _AUTO_MAX_COMPONENTS (the server's fixed auto-fit ceiling) to cross_validate, ignoring request.n_components; the inline comment in _run_fit calls out that this is deliberate. Docstring rewritten to say n_components is ignored in auto mode.

  • src/scorepilot/config.pySettings Attributes block.
    The formal Attributes list only covered database_url, host/port, open_browser, and the four agent_* fields. auth_username, auth_password, docs_enabled, max_upload_mb, and max_cells were only documented via inline comments in the class body. Extended the docstring to describe all of them.

  • src/scorepilot/core/cross_validation.pycross_validate Raises.
    Listed four ValueError cases but not the pre-check that rejects an x_block with fewer than two rows (if n_rows < 2: raise ValueError(...)). Added it so callers know the condition surfaces as ValueError.

Other changes

  • Version bumped 0.22.00.22.1 (PATCH, docstring-only).
  • No lockfile update in this PR (per session policy).

Test plan

  • uv run ruff check . / uv run ruff format --check .
  • uv run pyright
  • uv run pytest

Generated by Claude Code

claude added 5 commits July 31, 2026 07:16
The Notes section claimed the `power` transform has "default c1 = 0.5" and
described the formula as `sign(x) * abs(x) ** c1`. The signature actually
defaults `c1` to 0.0, and the function substitutes an exponent of 0.5 only
when c1 == 0.0. Rewrite the note so it matches the code's behaviour and
still explains why the default acts as a signed square root.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TikjthFYE6JPHA38JkXzub
The docstring said n_components was used "as an upper bound on what is
evaluated" when auto_components is set. In practice `_run_fit` explicitly
passes `_AUTO_MAX_COMPONENTS` (the server's fixed auto-fit ceiling) to
`cross_validate`, ignoring `request.n_components` entirely - the inline
comment in `_run_fit` calls out that this is deliberate. Rewrite the
docstring to match.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TikjthFYE6JPHA38JkXzub
Settings' Attributes block listed only the core / agent fields; the auth,
docs, and resource-cap knobs were only described via inline comments in
the class body. Extend the docstring so the formal attribute list matches
the class body.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TikjthFYE6JPHA38JkXzub
The Raises section listed four ValueError cases but not the pre-check that
rejects an X block with fewer than two rows. Add it so callers know the
condition surfaces as ValueError rather than an opaque failure from the
downstream selector.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TikjthFYE6JPHA38JkXzub
PATCH bump for the docstring-only fixes in this PR (transforms,
FitModelRequest, Settings, cross_validate).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TikjthFYE6JPHA38JkXzub
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