Skip to content

Support full Python slice syntax in expand_node_string using real instance/device counts - #77

Merged
harsh-sikhwal merged 7 commits into
mainfrom
enhance-node-expansion
Aug 11, 2026
Merged

Support full Python slice syntax in expand_node_string using real instance/device counts#77
harsh-sikhwal merged 7 commits into
mainfrom
enhance-node-expansion

Conversation

@harsh-sikhwal

Copy link
Copy Markdown
Member

Summary

  • Replaced the digit-only [start:stop] regex in expand_node_string (infragraph_service.py) with a slice parser supporting full Python slice syntax: [:], [:-1], [1:], [::2], and bare/negative single indices.
  • Added a _resolve_slice_indices() helper that resolves open-ended or negative slice bounds using real counts pulled from:
    • _instance_data — for the leading instance name
    • _device_data[...].components — for chained nested component/device names
  • Falls back to the old explicit non-negative start:stop behavior when counts aren't known yet; raises InfrastructureError when a slice can't be resolved without a known count.
  • Fixed test_expand_node_string.py, which was calling a nonexistent _expand_node_string method (pre-existing bug — all 7 tests were erroring). Corrected to expand_node_string and added 2 new tests covering count-based slice resolution and the unresolvable-count error case.

@harsh-sikhwal harsh-sikhwal changed the title Support full Python slice syntax in expand_node_string using real instance/device counts Draft: Support full Python slice syntax in expand_node_string using real instance/device counts Jul 23, 2026
@harsh-sikhwal harsh-sikhwal changed the title Draft: Support full Python slice syntax in expand_node_string using real instance/device counts Support full Python slice syntax in expand_node_string using real instance/device counts Aug 10, 2026
@harsh-sikhwal
harsh-sikhwal merged commit 79d2b4f into main Aug 11, 2026
@harsh-sikhwal
harsh-sikhwal deleted the enhance-node-expansion branch August 11, 2026 05:57
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