Nerves board: flag library config keys no library code reads (#174) - #175
Merged
Merged
Conversation
scripts/board.py scans every library package's .py (and autonerves/) with
an AST walk for config lookups — literal conf.instance[...] chains (multi-line,
.get("k")), non-literal subscripts as wildcards, sections bound to a local and
indexed later (closures included) and should_output("name") — and classes
every library settings key used / section-read / unused against the reads
of the whole stack (priors exempt; skipped if any library is missing).
Rendered as an unused chip on the key and per-file counts on the repo page,
a "Possibly unused config keys" index section grouped by library with GitHub
links, the class in board.json and the key index, and one info item per
library in state.json — never yellow. SOURCES gains each library's package
dir; the workflow's sparse checkout also fetches <package>/**/*.py.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SbKQQHRRgm2b69aT9t7771
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
Extends the Nerves board so it flags library config keys that no library code reads (closes #174).
scripts/board.pynow walks every library package's.pyfiles (andautonerves/) with an AST scan for config lookups: literalconf.instance[...]chains (multi-line,.get("k")), non-literal subscripts treated as wildcards, sections bound to a local and indexed later (closures included), andshould_output("name"). Every library settings key is then classed used / section-read / unused against the reads of the whole stack. Priors are exempt, and the scan is skipped if any library is missing.Where it shows up: an "unused" chip on the key, per-file counts on the repo page, a "Possibly unused config keys" section on the index (grouped by library, with GitHub links), the class in
board.jsonand the key index, and one info item per library instate.json. It is never yellow.SOURCESgains each library's package dir, and the workflow's sparse checkout now also fetches<package>/**/*.py.Scan results (used / section-read / unused)
False-positive review list (needs human review, may be read dynamically)
These PyAutoFit
general.yamlkeys are flagged unused. They may be read through a dynamic path the AST scan cannot see, so do not delete them on this evidence alone:output.log_leveloutput.log_to_fileoutput.log_fileoutput.search_internalprofiling.repeatsAlso: PyAutoLens has a dead 57-key
DynestyStatic/DynestyDynamicblock innon_linear.yaml, which accounts for almost all of Lens's 58 unused keys. It is a cleanup candidate for a follow-up, not something this PR changes.API Changes
None to the
autonervespackage. This is internal to the board script and workflow. The only visible schema change is additive:board.json/ the key index gain a per-key usage class, andstate.jsongains one info item per library.See full details below.
Test Plan
python -m pytest test_autonerves -q: 206 passed (worktree, before push)nerves_board.ymlrenders the "Possibly unused config keys" section after merge (dispatch after merge)Heart YELLOW acknowledged by human (reasons: manifest drift in the hub organism blurb (7), organism-map blocks (1) and workspace checkouts (1); release validation stale for PyAutoFit/Array/Galaxy/Lens). None of these involve this repo.
Full API Changes (for automation & release notes)
Added
scripts/board.py: AST config-read scanner over library packages; per-key classused/section-read/unusedboard.json/ key index: per-key usage class fieldstate.json: oneinfoitem per library summarising possibly-unused keys.github/workflows/nerves_board.yml: sparse checkout adds<package>/**/*.pyChanged Behaviour
Closes #174
Generated by the PyAutoLabs agent workflow.
🤖 Generated with Claude Code