Skip to content

Use message_subtype instaed of subservice in PUS C code paths#135

Merged
robamu merged 5 commits into
us-irs:mainfrom
mokagio:pus-c-message-subtype-compat
Mar 13, 2026
Merged

Use message_subtype instaed of subservice in PUS C code paths#135
robamu merged 5 commits into
us-irs:mainfrom
mokagio:pus-c-message-subtype-compat

Conversation

@mokagio
Copy link
Copy Markdown
Contributor

@mokagio mokagio commented Mar 11, 2026

Summary

Addresses #130 by aligning PUS C terminology with ECSS-E-ST-70-41C:

  • Rename subservice -> message_subtype in PUS C code paths
  • Keep backward compatibility for existing users

Background

Hi all, I hope you don't mind an out of the blue contribution. I've been interested in space for a long time and recently decided it would be fun (and hopefully useful) to contribute to some open-source projects. Not knowing where to start and not having industry know how to offer, I set out an AI research agent to discover projects with open issues that required software help rather than domain knowledge. That's how I discovered this project and #130.

From there, I planned a rename with GPT-5.3-Codex and executed it.

I hope this is useful. Feel free to push back strongly if it misses the mark. Happy to go back to the drawing board.

Details

  1. Introduces message_subtype as the primary PUS C API term.
  2. Keeps legacy compatibility aliases in PUS C:
    • subservice constructor args/properties
    • Subservice enum alias (where renamed)
    • legacy helper methods where applicable
  3. Adds deprecation warnings for legacy subservice usage in PUS C.
  4. Adds tests verifying:
    • old subservice calls still work
    • deprecation warnings are emitted

Compatibility

This is non-breaking for existing PUS C users:

  • Legacy subservice usage continues to work in this release
  • Users can migrate to message_subtype incrementally

Validation

Full suite passed locally:

image

Comment on lines +49 to +50
if message_subtype is not None and subservice is not None and message_subtype != subservice:
raise ValueError("message_subtype and subservice must have the same value")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Alternatively, we could fail if both values are given, pointing users to only pass message_subtype. The models suggests this is a more common approach and friendlier to migrations that maintain compatibility, so I left it as is.

Adopt ECSS-E-ST-70-41C wording in PUS C by using
`message_subtype` across packet APIs and service helpers.
Preserve compatibility by keeping legacy `subservice`
constructor/property aliases and the `Subservice` enum alias,
with deprecation markers and warnings to guide migration.
PUS A implementation remains unchanged.

---

Generated with the help of Codex (GPT-5)

Co-Authored-By: OpenAI Codex <noreply@openai.com>
@mokagio mokagio force-pushed the pus-c-message-subtype-compat branch from f6423fa to 972ab21 Compare March 11, 2026 03:19
mokagio and others added 3 commits March 12, 2026 06:02
The constant `DEPRECATED_IN_SUBSERVICE_ALIAS` was placed between
import groups, causing E402 (module level import not at top of file)
for the two imports that followed it.

---

Generated with the help of Claude Code, https://claude.ai/code

Co-Authored-By: Claude Code Opus 4.6 <noreply@anthropic.com>
The backward-compatible `subservice` alias pushes the parameter
count to 11, one over the limit.
This is intentional for the deprecation period.

---

Generated with the help of Claude Code, https://claude.ai/code

Co-Authored-By: Claude Code Opus 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.85%. Comparing base (f891552) to head (d775e58).
⚠️ Report is 15 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #135   +/-   ##
=======================================
  Coverage   99.85%   99.85%           
=======================================
  Files          43       43           
  Lines        3511     3534   +23     
=======================================
+ Hits         3506     3529   +23     
  Misses          5        5           
Flag Coverage Δ
unittests 99.85% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@robamu
Copy link
Copy Markdown
Contributor

robamu commented Mar 12, 2026

this looks great. Could you also update the CHANGELOG.md ? :)

@robamu robamu added this to the vNext milestone Mar 12, 2026
Document the PUS-C message_subtype rename accurately.\nNote that legacy subservice aliases remain available but deprecated.\n\n---\n\nGenerated with the help of Codex (GPT-5)\n\nCo-Authored-By: OpenAI Codex <noreply@openai.com>
@robamu robamu merged commit abba178 into us-irs:main Mar 13, 2026
10 checks passed
mokagio added a commit to mokagio/tmtccmd that referenced this pull request Mar 15, 2026
See abba178451e39974ad96d0a4478a554365a14e05 in spacepackages-py,
us-irs/spacepackets-py#135
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