Skip to content

chore(sceptre): remove the unused SunSpec protocol - #156

Merged
cmulk merged 1 commit into
sandialabs:mainfrom
adamsrnmsu:chore-remove-sunspec
Oct 10, 2026
Merged

cmulk merged 1 commit into
sandialabs:mainfrom
adamsrnmsu:chore-remove-sunspec

Conversation

@adamsrnmsu

@adamsrnmsu adamsrnmsu commented Oct 2, 2026 •

Copy link
Copy Markdown

Description

Remove SunSpec support from the SCEPTRE app.

SunSpec had been broken for years without anyone noticing: until #137, every inverter on the sunspec protocol raised KeyError. #137 asked whether SunSpec was still wanted. @GhostofGoes voted to remove it ("It was never used in all my time working on this stack"), and @mgaliar agreed ("I am good with keeping this fix or burning sunspec. We haven't used it in years.").

What's removed:

  • Protocol code and data: protocols/sunspec/, meaning the SunSpecDevice register generator and about 1 MB of vendored SMDX models (99 files).
  • Templates: templates/sunspec.mako, the gobennu branch of sceptre_start.mako, and the four sunspec branches of fep_template.mako.
  • Protocol registrations: sunspec comes out of the metadata parser, the validation model, the field-device port table and the register builder.
  • Exclusions: the SunSpec entries in package-data, the ruff exclude and per-file ignores, and .codespellrc.
  • Docs: the SunSpec row in the app README's Known Issues table, the SunSpec note in src/python/AGENTS.md, and the (unreleased) CHANGELOG entry for the fix(sceptre): normalise the SunSpec infrastructure key #137 fix. A new ### Removed entry replaces it.

A field device whose metadata still has a sunspec key now fails validation with an error saying SunSpec was removed. Without that check, extra="allow" would silently ignore the key.

Related Issues/PRs

Follows up the discussion on #137. It doesn't depend on #152–#155 and doesn't conflict with #152, #153 or #155. #154 no longer touches the sunspec/__init__.py this PR deletes, so the two don't conflict.

Type of Change

  • Chore (CI, build, dependencies, etc.) (chore)
  • Other (please describe): removal of an unused protocol

Checklist

  • This PR conforms to the process detailed in the Contributing Guide.
  • I have included no proprietary/sensitive information in my code or the PR.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • I have tested my code (describe below).

Testing

  • make check and make test in src/python on Python 3.12: 698 passed. That's main's 697 plus a new validation case for a leftover sunspec key.
  • test_sceptre_golden.py passes unchanged, so the FEP and field-device configs rendered for the golden scenario are byte-identical after the template edits.
  • infrastructures_golden.txt was regenerated, and the diff is exactly the 50 sunspec rows removed.
  • A built wheel has no SunSpec files and still ships infrastructures.yaml and the mydesigner tree.

Additional Notes

An open question, deliberately left alone here: both inverters in configs/infrastructures.yaml still list SunSpec model numbers ([1, 103, 120, 123] and [1, 101, 123, 126]) as their analog-read-write fields. On DNP3 and Modbus those were already exposed as registers literally named 1, 103 and so on (visible in the golden file before this PR). That's pre-existing and unchanged here, and the table comment now says so. Should those become real field names, or be dropped?

🤖 Generated with Claude Code

https://claude.ai/code/session_016KAfcDUSerQCCWwBM9BxAo

@GhostofGoes GhostofGoes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the slop then this is perfect. Feels good to burn away 25,000 lines of long dead code. Good riddance.

Comment thread CHANGELOG.md Outdated

### Removed
- **SCEPTRE App**: The `reg_config` manual register-map path. It was dead code: the app never populated it, so every device always took the automatic numbering branch. Output is unchanged.
- **SCEPTRE App**: SunSpec support: the `sunspec` field-device protocol, its register generator and bundled SMDX models, the `sunspec.mako` and gobennu startup templates, and the SunSpec branches of the FEP template. It had been broken for years without anyone noticing, and maintainers confirmed it is unused. A field device that still declares `metadata.sunspec` now fails validation with an error that says so. Output for every other protocol is unchanged.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of the slop, use this: ' Sceptre app: SunSpec has been burned away by the SCORCHing heat of 3000 Suns and thus no longer exists in this repo.'

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, verbatim.

Comment thread CHANGELOG.md

### Fixed
- **SCEPTRE App**: With more than one PowerWorld provider, only the last one's `hil_tags` reached the object list, and only the last one's `objects.txt` was written. Tags now aggregate across providers and every PowerWorld provider gets the combined `objects.txt`.
- **SCEPTRE App**: Every `sunspec` inverter raised `KeyError`: the SunSpec register mappings are keyed `PowerDistribution` but received `power-distribution`. The whole protocol was unusable.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOL

SunSpec support had been broken for years without anyone noticing: until
sandialabs#137 every inverter on the sunspec protocol raised KeyError. On that PR the
maintainers agreed it is unused ("It was never used in all my time working on
this stack", "We haven't used it in years") and that removing it is fine.

Remove the protocol entirely: the SunSpecDevice register generator and its
~1 MB of vendored SMDX models, the sunspec.mako config and gobennu startup
templates, the sunspec branches of the FEP template, and the protocol from
the metadata parser, validation model, port table and register builder.
Packaging, ruff and codespell no longer need their SunSpec exclusions.

A field device whose metadata still has a sunspec key now fails validation
with an error saying SunSpec was removed, rather than having the key
silently ignored. Every other protocol's output is unchanged: the rendered
scenario golden is untouched, and the infrastructure golden only loses its
sunspec rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016KAfcDUSerQCCWwBM9BxAo
@adamsrnmsu
adamsrnmsu force-pushed the chore-remove-sunspec branch from 205c380 to b64cd26 Compare October 4, 2026 23:53
@cmulk
cmulk merged commit 3b6ba4b into sandialabs:main Oct 10, 2026
3 checks passed
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.

3 participants