Select a unique target from a semantic snapshot
Implement select_target(nodes, role, name, scope, observed_revision, current_revision). Return a unique actionable node ID, return None for no match, and raise ValueError for ambiguity or stale observations.
Your task
- Match role, name, and scope exactly; consider only visible and enabled nodes.
- Reject stale revisions before selecting a target.
- Raise ValueError if more than one actionable target matches.
- Return None for zero matches and leave node dictionaries unchanged.
Examples
EXAMPLE 1
InputOne visible, enabled Save button in invoice scope at revision 4; current revision 4
Output'x'
Implement the function, then run the tests.
Ctrl / ⌘ + Enter to test · Shift + Tab leaves editor