Conversation
|
I'm confused about the |
|
@claude review and answer #1198 (comment) |
|
Claude finished @coretl's task in 3m 0s —— View job Code Review Complete
Answer to Documentation ErrorThe
Solution: Add from ._pvi_connector import PviDeviceConnector, PviTree, SignalDetails, Entry__all__ = [
"PviDeviceConnector",
"PviTree",
"SignalDetails",
"Entry", # Add this
...
]Code Review SummaryArchitecture: The Key findings (see inline comments for details):
Positive aspects:
Tests: Test coverage looks comprehensive, including mock mode, recursive typing, and edge cases. |
|
@claude re-review, please. |
|
Claude finished @shihab-dls's task in 2m 18s —— View job Re-review Complete
SummaryDocumentation error: ✅ Fixed - Code quality: The implementation is solid:
Addressed from previous review:
Minor observations (see inline comments):
The PR successfully implements PVI introspection with proper DeviceVector type selection. Ready for merge pending CI checks. |
| write_pv: str | ||
|
|
||
| @classmethod | ||
| def from_entry(cls, entry: dict[str, str]) -> SignalDetails: |
Check notice
Code scanning / CodeQL
Explicit returns mixed with implicit (fall through) returns Note
Copilot Autofix
AI about 12 hours ago
Copilot could not generate an autofix suggestion
Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.
|
@coretl, this is ready for a re-review now. |
coretl
left a comment
There was a problem hiding this comment.
Almost there! Take it or leave it on the nit, but the trailing comma should go...
| FastCSPVIVector = dict[Literal["d"], Entry] | ||
| # The newer pva FastCS PVI structure has vectors of the form | ||
| # structure ttlout | ||
| # structure d | ||
| # string v1 FASTCS_PANDA:Ttlout1:PVI | ||
| # string v2 FASTCS_PANDA:Ttlout2:PVI | ||
| # string v3 FASTCS_PANDA:Ttlout3:PVI | ||
| # string v4 FASTCS_PANDA:Ttlout4:PVI |
There was a problem hiding this comment.
It occurs to me that we could relatively easily still support this structure for backwards compatibility, which would make it easier for people to upgrade...
There was a problem hiding this comment.
I've pushed changes to support this, and amended panda.db to have a block that uses this legacy structure. Do you see a point in supporting:
# The older PVI structure has vectors of the form
# structure[] ttlout
# (none)
# structure
# string d PANDABLOCKS_IOC:TTLOUT1:PVI
# structure
# string d PANDABLOCKS_IOC:TTLOUT2:PVI
# structure
# string d PANDABLOCKS_IOC:TTLOUT3:PVIas well?
There was a problem hiding this comment.
Nope, let's drop the old old style...
| # Build PviTree for each vector entry | ||
| sub_trees = await gather_dict( | ||
| { | ||
| int(entry_name.split("v")[1]): cls.build_device_tree( |
There was a problem hiding this comment.
| int(entry_name.split("v")[1]): cls.build_device_tree( | |
| int(entry_name.split("v")[1:]): cls.build_device_tree( |
There was a problem hiding this comment.
Since we must've passed the regex re.match(r"^v(\d+)$", child_name), split('v') must return 2 sub-strings, one with v and the other with all other digits, hence directly [1] (which also avoids making a list object)
|
|
||
|
|
||
| $(INCLUDE_EXTRA_BLOCK=#)record(ao, "$(IOC_NAME=PANDAQSRV):EXTRA:1:SIG1") | ||
| $(INCLUDE_EXTRA_BLOCK=#)record(ao, "$(IOC_NAME=PANDAQSRV):EXTRA1:SIG1") |
There was a problem hiding this comment.
Do we test __1 somewhere else? If not, then can we keep both the legacy and the new style tests?
There was a problem hiding this comment.
We do! we test __1 with all the other panda blocks, for example, we now do:
record(stringin, "$(IOC_NAME=PANDAQSRV):SEQ:_PVI")
{
field(VAL, "$(IOC_NAME=PANDAQSRV):SEQ:PVI")
info(Q:group, {
"$(IOC_NAME=PANDAQSRV):PVI": {
"value.seq.d": {
"+channel": "VAL",
"+type": "plain",
"+putorder":18
}
}
})
}
record(stringin, "$(IOC_NAME=PANDAQSRV):SEQ:1:_PVI")
{
field(VAL, "$(IOC_NAME=PANDAQSRV):SEQ:1:PVI")
info(Q:group, {
"$(IOC_NAME=PANDAQSRV):SEQ:PVI": {
"value.__1.d": {
"+channel": "VAL",
"+type": "plain",
"+putorder":18
}
}
})
}
which makes SEQ:PVI, and attaches SEQ:1:PVI as __1 onto it. So all the tests that connect to this IOC will test the new structure, except for test_panda_with_extra_blocks_and_signals, which will check the legacy structure. I'll add a comment onto EXTRA to make this explicit, but otherwise, is that good enough for testing?
EDIT: test_panda_gets_types_from_common_class, for example. accesses seq[1], which would've been parsed from the new PVI vector structure
dd6ceaf to
e1ba902
Compare
|
Commenting for clarity. This PR now adds support for introspecting |
Closes #1197
This PR mainly creates a
PviTreedata structure, to recursively explore a PVI structure, providing enough information forDevice/DeviceVectortype selection when creating devices.