Fix drift in core / api / config docstrings - #100
Open
kgdunn wants to merge 5 commits into
Open
Conversation
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
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.
Summary
Audit of computational and user-facing docstrings under
src/scorepilot/core/,src/scorepilot/db/, andsrc/scorepilot/api/(plus theSettingsclass 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.py—apply_transformNotes forpower.The docstring stated
sign(x) * abs(x) ** c1with "defaultc1 = 0.5, i.e. signed root". The signature actually defaultsc1to0.0; the code substitutes an exponent of0.5only whenc1 == 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.py—FitModelRequestdocstring.Claimed that in
auto_componentsmoden_components"is used only as an upper bound on what is evaluated."_run_fitinapi/models.pyexplicitly passes_AUTO_MAX_COMPONENTS(the server's fixed auto-fit ceiling) tocross_validate, ignoringrequest.n_components; the inline comment in_run_fitcalls out that this is deliberate. Docstring rewritten to sayn_componentsis ignored in auto mode.src/scorepilot/config.py—SettingsAttributesblock.The formal
Attributeslist only covereddatabase_url,host/port,open_browser, and the fouragent_*fields.auth_username,auth_password,docs_enabled,max_upload_mb, andmax_cellswere only documented via inline comments in the class body. Extended the docstring to describe all of them.src/scorepilot/core/cross_validation.py—cross_validateRaises.Listed four ValueError cases but not the pre-check that rejects an
x_blockwith fewer than two rows (if n_rows < 2: raise ValueError(...)). Added it so callers know the condition surfaces asValueError.Other changes
0.22.0→0.22.1(PATCH, docstring-only).Test plan
uv run ruff check ./uv run ruff format --check .uv run pyrightuv run pytestGenerated by Claude Code