Skip to content

Conversation

@shihab-dls
Copy link
Contributor

It was found that setting an AttrRW would update the AttrR, but not the AttrW. This was because we must now do:

op.done()
pv.post(value)

However, it seems that the value you get for an Enum in value = op.value() is in the form ntenum(3, TTLIN4.VAL) (for example), which is correctly converted to the FastCS value <Labels.TTLIN4.VAL: 4> (for example), but a value in the form of:

{
                "index": attribute.datatype.index_of(value),
                "choices": attribute.datatype.names,
            }

must be passed in the pv.post(). This has led to this addition:

        if isinstance(self._attr_w.datatype, Enum):
            pv.post(cast_to_p4p_value(self._attr_w, cast_value))
        else:
            pv.post(value)

in order to cast the value to the write form.

@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.56%. Comparing base (a2a7808) to head (eceea0e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #292      +/-   ##
==========================================
+ Coverage   90.55%   90.56%   +0.01%     
==========================================
  Files          69       69              
  Lines        2414     2417       +3     
==========================================
+ Hits         2186     2189       +3     
  Misses        228      228              

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

@shihab-dls shihab-dls requested a review from GDYendell December 16, 2025 17:00
if isinstance(self._attr_w.datatype, Enum):
pv.post(cast_to_p4p_value(self._attr_w, cast_value))
else:
pv.post(value)
Copy link
Contributor

@GDYendell GDYendell Dec 17, 2025

Choose a reason for hiding this comment

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

What happens on the client if put raises an exception and op.done() is not called? I am wondering if what we are supposed to do when a put fails is call op.done() but not pv.post. Is there any guidance on this? Any thoughts @coretl?

Copy link
Contributor

Choose a reason for hiding this comment

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

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.

4 participants