-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
In api/entities/entity_encoder.py:7, encode_node removes the 'Searchable' label from the node object:
def encode_node(n: Node) -> dict:
n.labels.remove('Searchable')
return vars(n)This modifies the original node in place. Encoding the same node twice will raise ValueError because 'Searchable' is already removed on the second call.
Impact
- Encoding a node is destructive — the original node object loses the label
- Encoding the same node twice crashes with
ValueError: list.remove(x): x not in list
Suggested Fix
Create a copy of the labels instead of modifying in place:
def encode_node(n: Node) -> dict:
result = vars(n).copy()
result['labels'] = [l for l in n.labels if l != 'Searchable']
return resultContext
Found during code review of PR #522.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working