OpenCyphal / OpenCyphal/yakut

Yakut Mon fails to gracefully handle empty bitmask and sparse_list

Open
#118 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
65
Forks
14
PR merge metrics
No merged PRs in 30d

Description

When a node publishes a empty bitmask or sparse list for the on the uavcan.node.port.List publishers and subscrivbers topic, Yakut fails to handle it correctly.

  uavcan_node_port_SubjectIDList_1_0_select_mask_(&port_list.publishers);

  uavcan_node_port_SubjectIDList_1_0_select_sparse_list_(&port_list.subscribers);

  size_t size = uavcan_node_port_List_1_0_SERIALIZATION_BUFFER_SIZE_BYTES_;
  uint8_t buf[size];

  uavcan_node_port_List_1_0_serialize_(port_list, buf, &size);

OS: Ubuntu 24.04
Yakut Version: git release 3a22dd4
Installation method: pip3

Error:

pycyphal.util._broadcast: Unhandled exception in <bound method Avatar._on_trace of Avatar(node_id=42)>: 
Traceback (most recent call last):
  File "/home/opencyphal/.venv/lib/python3.12/site-packages/pycyphal/util/_broadcast.py", line 46, in delegate
    r: typing.Union[R, Exception] = fn(*args, **kwargs)
                                    ^^^^^^^^^^^^^^^^^^^
  File "/home/opencyphal/.venv/lib/python3.12/site-packages/yakut/cmd/monitor/_model.py", line 165, in _on_trace
    handler(float(ts.monotonic), obj)
  File "/home/opencyphal/.venv/lib/python3.12/site-packages/yakut/cmd/monitor/_model.py", line 102, in _on_port_list
    self._ports.pub = expand_subjects(obj.publishers)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/opencyphal/.venv/lib/python3.12/site-packages/yakut/cmd/monitor/_model.py", line 198, in expand_subjects
    assert False
           ^^^^^
AssertionError

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in yakut/cmd/monitor/_model.py, following _on_port_list into expand_subjects, where the traceback shows the assertion. Reproduce the monitor input with empty publishers or subscribers bitmasks and sparse lists, then verify that both forms are handled without an AssertionError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.