Skip to content

Make message version dynamic#81

Open
mraspaud wants to merge 4 commits intopytroll:mainfrom
mraspaud:allow_newer_messages_not_affecting_dates
Open

Make message version dynamic#81
mraspaud wants to merge 4 commits intopytroll:mainfrom
mraspaud:allow_newer_messages_not_affecting_dates

Conversation

@mraspaud
Copy link
Member

The jump to message version v1.01 to v1.2 was triggered by downstream
problems (ie in other packages) by passing timezone-aware datetime
objects instead of the naive times posttroll returned before. Since
then, v1.2 means message data might contain timezone-aware datetime
objects, while v1.01 ensure only naive datetmes are passed on.

Posttroll also has a configuration item the user can set to force the
message version to use, so that backwards-compatible messages can be
sent by newer instances of posttroll.

However, to facilitate the migration to newer message versions, it seems
to be necessary (eg for the nameserver) to be able to send both v1.01
messages or v1.2 messages, depending on the contents of the message.

This commit implements just that mechanism, so that if the message
version-number is not provided explicitly (either as an argument to
Message, or as a configuration item), the lower compatible
message-version will be used. This means v1.01 for messages not
containing datetime objects, and v1.2 otherwise.

The jump to message version v1.01 to v1.2 was triggered by downstream
problems (ie in other packages) by passing timezone-aware datetime
objects instead of the naive times posttroll returned before. Since
then, v1.2 means message data might contain timezone-aware datetime
objects, while v1.01 ensure only naive datetmes are passed on.

Posttroll also has a configuration item the user can set to force the
message version to use, so that backwards-compatible messages can be
sent by newer instances of posttroll.

However, to facilitate the migration to newer message versions, it seems
to be necessary (eg for the nameserver) to be able to send both v1.01
messages or v1.2 messages, depending on the contents of the message.

This commit implements just that mechanism, so that if the message
version-number is not provided explicitly (either as an argument to
`Message`, or as a configuration item), the lower compatible
message-version will be used. This means v1.01 for messages not
containing datetime objects, and v1.2 otherwise.
@mraspaud mraspaud self-assigned this Feb 11, 2026
@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

❌ Patch coverage is 94.36620% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.73%. Comparing base (0bb8cdb) to head (b041234).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
posttroll/message.py 91.66% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #81      +/-   ##
==========================================
+ Coverage   88.70%   88.73%   +0.03%     
==========================================
  Files          26       26              
  Lines        2576     2611      +35     
==========================================
+ Hits         2285     2317      +32     
- Misses        291      294       +3     

☔ 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.

@mraspaud mraspaud requested a review from pnuu February 11, 2026 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments