Skip to content

Fix docstring drift surfaced by audit#96

Open
kgdunn wants to merge 2 commits into
mainfrom
claude/ecstatic-johnson-io6c8o
Open

Fix docstring drift surfaced by audit#96
kgdunn wants to merge 2 commits into
mainfrom
claude/ecstatic-johnson-io6c8o

Conversation

@kgdunn

@kgdunn kgdunn commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Summary

Three docstrings had drifted from the code they describe. Docstring-only fixes; no signature or behaviour changes.

  1. src/scorepilot/db/models.py -- Model class docstring. Old text claimed the params blob held P, W, means, scales, .... In practice _pack_params in src/scorepilot/api/models.py only writes x_loadings, explained_variance, and r2_cumulative. Rewrote the docstring to enumerate exactly those three arrays and note the "swap for object storage if artifacts grow" pattern still holds.

  2. src/scorepilot/core/transforms.py -- apply_transform Notes. Old text said the power branch's default c1 is 0.5 (signed root). The signature default is c1 = 0.0; 0.5 is only substituted internally by _transform_values when c1 == 0.0. Rewrote the Note to describe the two-layer default.

  3. src/scorepilot/core/profiling.py -- suggest_transform. Old text said "milder skew suggests a signed power (root)". The code actually returns POWER only when the variable is strongly skewed (skewness > 1.0) but fails either the strict-positivity or wide-range check for LOG. Milder skew returns NONE. Rewrote to describe the real branches.

Version bumped from 0.22.0 -> 0.22.1 (PATCH: docstrings only), lockfile refreshed in the same commit per the ScorePilot CLAUDE.md rule.

Test plan

  • uv run ruff check . -- passes
  • uv run ruff format --check . -- passes
  • Human review of the three rewritten docstrings against the referenced code:
    • Model docstring vs _pack_params in src/scorepilot/api/models.py
    • apply_transform Notes vs the POWER branch of _transform_values
    • suggest_transform docstring vs its if strongly_skewed and positive and wide_range / if strongly_skewed ladder

Generated by Claude Code

claude added 2 commits July 3, 2026 07:19
- Model.params (db/models.py): reflect that today's blob holds
  x_loadings, explained_variance, and r2_cumulative, not P/W/means/scales.
- apply_transform (core/transforms.py): the power branch's signature
  default is c1=0.0; 0.5 (signed root) is only substituted internally
  when c1==0.0.
- suggest_transform (core/profiling.py): describe the actual branches
  (POWER only for strongly skewed + not-strictly-positive/narrow-range;
  milder skew is left alone).
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