Repository navigation
ci(health): bump pyscn to 1.32.4 and read its snake_case report - #451
Merged
Merged
Conversation
- Pin pyscn==1.32.4 (was 1.29.0) in the [health] extra. - One pyscn run now writes both the JSON and the HTML report (--json --html), instead of analyzing the package twice. - The sanity step reads the 1.30.0+ snake_case keys (system.summary.project_root, total_dependencies, total_modules) and also reports resolved_imports and unresolved_imports, warning when any import is unresolved as well as when the root is not the checkout. - Regenerate .pyscn-known-clones.json with 1.32.4. Its default clone grouping (complete_linkage, was connected) and min_lines (8, was 10) changed, so the accepted groups differ. - Note the new Linux ARM64 wheel. The scores are not comparable across the bump: on main, 1.29.0 reports 77/100 and 1.32.4 reports 87/100 for the same tree, with the same root and no unresolved imports. Closes DOI-USGS#415. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HBt3Ee7eneKtdKQWq2T3YK
Review fixes for the pyscn 1.32.4 bump. - The sanity step no longer relies on unresolved_imports: under a wrong root pyscn counts the package's own imports as external, so the count stays 0 (checked by analyzing a copy under another root: 15 modules, 5 dependencies, 0 unresolved). It now warns separately when the root is not the checkout and when pyscn analyzed fewer than 90% of the package's .py files. - Missing report keys are named in the summary instead of raising a KeyError to stderr, so a future key rename shows up rather than silently dropping the sanity line. - The 1.32.4 Linux wheels need glibc 2.34 (1.29.0's needed 2.17), and there is no sdist; pyproject.toml and CONTRIBUTING.md say so. - .pyscn-known-clones.json: the 2026-08-09 docstring measurements are marked as pyscn 1.29.0 only, since 1.32.4 skips docstrings; the Water Data rationales no longer cite docstrings; the marginal type-4 pair (0.672) gets its own rationale; default_thresholds records group_mode, group_threshold, skip_docstrings, and clone_types; and the sub-threshold note says it was a 1.29.0 scan. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HBt3Ee7eneKtdKQWq2T3YK
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.
Closes #415. The pyscn author raised two points in that issue: we analyzed the package twice to get both report formats, and our sanity check would read pyscn's JSON with the old key names after an upgrade.
Change
Pin:
pyscn==1.32.4, up from 1.29.0, in the[health]extra.One run:
pyscn analyze --json --html --no-open dataretrievalwrites both reports, replacing the two separate runs.Sanity step:
system.summary.project_root,total_dependencies,total_modules)..pyfiles.unresolved_importscount. Under a wrong root, pyscn counts the package's own imports as external, so the count stays 0. A copy of the package analyzed under another root gave 15 modules, 5 dependencies and 0 unresolved imports..pyscn-known-clones.jsonis regenerated with 1.32.4. Two defaults changed in pyscn: clone grouping went fromconnectedtocomplete_linkage, andmin_linesfrom 10 to 8. As a result, 1.32.4 no longer reports the NGWMN, NWIS and WQP getter families as clone groups. It reports two new small pairs instead, the_validationchecksreject_together/require_any_ofand NWDC's_validate_county/_validate_huc, each recorded with a rationale.The file was already out of date: 1.29.0 reports 10 groups on today's
main, while the file recorded 5.The file also changes in these ways:
default_thresholdsrecordsgroup_mode,group_threshold,skip_docstringsandclone_types.Docs:
pyproject.tomlandCONTRIBUTING.mdnow list the new Linux ARM64 wheel and say the 1.32.4 Linux wheels need glibc 2.34 or later (1.29.0's needed 2.17). There is no sdist, so.[health]no longer installs on RHEL 8, Ubuntu 20.04, Debian 11 or Amazon Linux 2. CONTRIBUTING also mentions--json --html.Comparison on
main(macOS ARM64)Both versions resolve the checkout as the root. The score rise comes from the new version's scoring, not from any code change, so the next weekly run is a new baseline.
I ran the updated workflow by hand on this branch from my fork (run). Every step succeeded, the sanity step printed
modules=62 files=62 dependencies=198 root=/home/runner/work/dataretrieval-python/dataretrieval-pythonwith no warning, and the artifact contains both the JSON and the HTML report. Locally, the check printed both warnings for a report edited to a wrong root and 15 modules, and named the key for a report withproject_rootremoved. Pre-commit passes.For the issue author
The project-root comment was written defensively when the workflow was added. In the weekly runs I checked (08-24, 09-07 and 10-12), the reported root was always the checkout and the warning never fired, so I have no run where it went wrong.
Follow-ups, not in this PR
.pyscn-known-clones.json, which is how the file drifted._validate_county/_validate_hucpair is private, so the file's reason for accepting clones does not apply. One helper could replace both, and their messages lack a remedy.🤖 Generated with Claude Code
https://claude.ai/code/session_01HBt3Ee7eneKtdKQWq2T3YK