Skip to content

Port read/write values data type improvements & more - #217

Merged
ccrisan merged 6 commits into
mainfrom
improvement/non-nullable-write-value
Aug 21, 2026
Merged

Port read/write values data type improvements & more#217
ccrisan merged 6 commits into
mainfrom
improvement/non-nullable-write-value

Conversation

@ccrisan

@ccrisan ccrisan commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This pull request tightens value typing across the port subsystem by distinguishing readable values (which may be unavailable) from writable values (which must be concrete), and updates related drivers, virtual/slave ports, and API entry points accordingly.

Changes:

  • Change multiple write_value/write-queue entry points to accept PortValue (non-nullable), while keeping reads as NullablePortValue.
  • Update expression-driven writes (eval_and_push_write) to compare against get_last_value() and adjust unit tests accordingly (including removal of get_target_value() tests).
  • Adjust API “set port attrs” behavior to avoid attempting background writes when "value": null.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/unit/qtoggleserver/mock/ports.py Updates mock port write_value signature to PortValue.
tests/unit/qtoggleserver/core/test_ports.py Removes get_target_value() tests and updates expression-write tests to use get_last_value().
qtoggleserver/slaves/ports.py Updates slave port write_value signature to PortValue.
qtoggleserver/lib/polled.py Updates _write_value_safe signature to PortValue for polled ports.
qtoggleserver/drivers/ports/gpio/gpio.py Updates GPIO port read/write typing and removes nullable-write no-op behavior.
qtoggleserver/drivers/ports/gpio/dummy.py Updates dummy GPIO port read/write typing to align with new PortValue writes.
qtoggleserver/drivers/ports/dummynumeric.py Updates dummy numeric port read/write typing to align with new PortValue writes.
qtoggleserver/core/vports.py Updates virtual port write_value signature to PortValue.
qtoggleserver/core/ports.py Core refactor: removes get_target_value(), makes write paths non-nullable, tweaks expression write decision logic, and changes legacy persisted value handling.
qtoggleserver/core/api/funcs/ports.py Avoids background writes for "value": null and aligns casts with PortValue.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread qtoggleserver/core/ports.py
@ccrisan
ccrisan merged commit 370d5a3 into main Aug 21, 2026
8 checks passed
@ccrisan
ccrisan deleted the improvement/non-nullable-write-value branch August 21, 2026 20:42
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