Skip to content

Prevent shortened label collisions in generated links - #32

Open
sylvesterkaczmarek wants to merge 1 commit into
esa:mainfrom
sylvesterkaczmarek:fix/label-shortening-collision
Open

sylvesterkaczmarek wants to merge 1 commit into
esa:mainfrom
sylvesterkaczmarek:fix/label-shortening-collision

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown

Fixes #31.

Distinct labels can collapse to the same interface/network name after label shortening (high and hi both become hi). In csv_to_compose.py that reuses the same MultiDiGraph edge key and silently drops one link.

Detect shortened-label collisions per node pair and fall back to the original label only for those collisions. Non-colliding generated names keep the existing shortening behavior.

Validation:

  • reproduced the issue on main: two a -> b links labelled high and hi generated one edge
  • after the fix the same input generates two distinct edges: a_b_high and a_b_hi
  • pytest tests/test_csv_label_collisions.py -q — 2 passed
  • Python compile checks pass
  • git diff --check passes

@axodentally

Copy link
Copy Markdown
Collaborator

Thanks for the contribution!
Though two links being different, but having the suffix 'high' and 'hi', with all else being equal, is not really a realistic scenario. The conversion scripts are mainly to convert files in the CCSDS scenario reference format, which for the foreseeable future will only be the ones in the upstream repo anyway: https://github.com/esa/ccsds-dtn-reference-scenarios
And those don't have that.

On the other hand it also does not really hurt to include the change since it has no negative consequences. @gh0st42 needs to decide on that.

@axodentally
axodentally requested a review from gh0st42 September 22, 2026 07:36
@sylvesterkaczmarek
sylvesterkaczmarek force-pushed the fix/label-shortening-collision branch from 9c0ac60 to cb3c7ae Compare October 1, 2026 00:37
@sylvesterkaczmarek

Copy link
Copy Markdown
Author

Thanks @axodentally. I agree this is a defensive edge case rather than something present in the current reference scenarios. I have kept the change narrowly scoped and rebased it onto current main; it is now 0 behind and mergeable. Happy to leave the merge decision to @gh0st42.

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.

Prevent interface-name collisions after label shortening

2 participants