Rename ProtocolVersion to StartupRequestCode - #12
Conversation
There was a problem hiding this comment.
Pull request overview
Renames the startup packet discriminator enum from ProtocolVersion to StartupRequestCode to reflect that the 4-byte startup field is a request-code discriminator (protocol versions + magic request codes), and updates framing/registry/tests/docs accordingly.
Changes:
- Introduce
StartupRequestCode(replacingProtocolVersion) and update public exports. - Rename startup registry/framing discriminator terminology from
version_codetorequest_code. - Update unit tests and documentation to use the new name/terminology.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/test_messages_startup.py | Updates startup message tests to use StartupRequestCode. |
| tests/unit/test_framing.py | Updates framing tests/error-message expectations to “request code”. |
| tests/unit/test_codec.py | Updates codec tests to use StartupRequestCode. |
| src/pygwire/messages/_startup.py | Switches startup message registrations/encoding to StartupRequestCode and request_code registration arg. |
| src/pygwire/messages/_registry.py | Renames startup registry API from version_code to request_code and updates docs/comments. |
| src/pygwire/framing.py | Renames parsed discriminator from version_code to request_code and updates error messages/docs. |
| src/pygwire/constants.py | Replaces ProtocolVersion enum with StartupRequestCode and updates __all__. |
| src/pygwire/init.py | Updates top-level re-export from ProtocolVersion to StartupRequestCode. |
| docs/reference/messages/startup.md | Updates StartupMessage field description to “startup request code”. |
| docs/reference/messages/index.md | Updates terminology/signature in lookup section to “request code”. |
| docs/reference/constants.md | Renames constants doc section to StartupRequestCode. |
Comments suppressed due to low confidence (1)
src/pygwire/init.py:42
pygwireno longer re-exportsProtocolVersionfrom the top-level package, which will breakfrom pygwire import ProtocolVersionfor existing users. If this is intended, it should be called out as a breaking change; otherwise consider re-exporting a deprecated alias for a transition period.
from pygwire.constants import ConnectionPhase, StartupRequestCode, TransactionStatus
from pygwire.exceptions import (
DecodingError,
FramingError,
ProtocolError,
PygwireError,
StateMachineError,
)
from pygwire.state_machine import (
BackendStateMachine,
FrontendStateMachine,
)
__version__ = version("pygwire")
__all__ = [
"BackendConnection",
"BackendMessageDecoder",
"BackendStateMachine",
"Connection",
"ConnectionPhase",
"DecodingError",
"FramingError",
"FrontendConnection",
"FrontendMessageDecoder",
"FrontendStateMachine",
"ProtocolError",
"StartupRequestCode",
"PygwireError",
"StateMachineError",
"TransactionStatus",
]
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
37575a7 to
1cdc64d
Compare
There was a problem hiding this comment.
Pull request overview
Renames the startup packet “ProtocolVersion” enum to StartupRequestCode to reflect that the first 4 bytes in startup framing are a discriminator for multiple startup-phase message types (protocol versions plus SSL/GSSENC/CANCEL magic codes), and updates related registry/framing naming and docs accordingly.
Changes:
- Replace
ProtocolVersionwithStartupRequestCodeacross constants, startup message implementations, and tests/docs. - Rename startup registry API from
version_codetorequest_codeand propagate through framing and error messages. - Update documentation to reflect the new naming and semantics.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/test_messages_startup.py | Updates startup-message unit tests to use StartupRequestCode and request-code wording. |
| tests/unit/test_framing.py | Updates framing tests to expect request-code terminology and error messages. |
| tests/integration/test_malformed_payloads.py | Updates integration malformed-payload test to use StartupRequestCode / request-code wording. |
| src/pygwire/messages/_startup.py | Switches startup-phase message registrations and encodings to StartupRequestCode and request_code= registry args. |
| src/pygwire/messages/_registry.py | Renames startup registry decorator/lookup parameter from version_code to request_code and updates docstrings. |
| src/pygwire/framing.py | Renames parsed startup discriminator variable and error messages from version-code to request-code terminology. |
| src/pygwire/constants.py | Introduces StartupRequestCode enum and exports it (replacing ProtocolVersion). |
| src/pygwire/init.py | Re-exports StartupRequestCode from the package top-level. |
| docs/reference/messages/startup.md | Updates reference docs to mention StartupRequestCode as the default for the startup discriminator field. |
| docs/reference/messages/index.md | Removes outdated lookup-function docs that referenced version-code lookups. |
| docs/reference/constants.md | Renames the constants reference section to StartupRequestCode and updates description. |
| CHANGELOG.md | Notes the breaking rename (ProtocolVersion → StartupRequestCode) and registry API rename (version_code → request_code). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
852e29c to
8da1a81
Compare
The startup packet's 4-byte field is a request code discriminator, not exclusively a protocol version. Renames the enum and updates version_code to request_code throughout registry, framing, and docs.
8da1a81 to
34abd44
Compare
🦑 Description
Rename ProtocolVersion to StartupRequestCode
The startup packet's 4-byte field is a request code discriminator, not exclusively a protocol version. Renames the enum and updates version_code to request_code throughout registry, framing, and docs.