Skip to content

Conversation

@timrcm
Copy link
Contributor

@timrcm timrcm commented Oct 20, 2025

Extend permute_identifier to replace last two characters for more unique combinations

@timrcm timrcm requested a review from hartmans October 20, 2025 16:07
Copy link
Member

@hartmans hartmans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a general design principle called the rule of zero, one or infinity. Briefly, either you don't need to do something at all, it's a singleton, or it's worth taking the time to build in extensibility rather than arbitrary limits.
It doesn't always apply, but I think it applies here.
By the time you overflow one character, I think it's time to come up with a better design.
What I would probably do is add one character if the identifier is not already 14 chars long.
Then from the last character, modify backward until you find a unique combination.
I would probably assume that only one character is going to be modified from the original identifier.
So progression would be something like

  • add if there's room.
  • Go through increments for added character.
  • walk back through identifier incrementing/modifying one character at a time
  • yielding until you find something unique at each step.

While you are in there, make a change in a separate commit to get the tests passing.

@timrcm
Copy link
Contributor Author

timrcm commented Oct 27, 2025

That is a great design point that I will keep in mind, thanks!

I'll take a look at what is going on with the tests separately.

- First, add a single char if maxlen allows
- Next, walk backwards through identifier modifying one character at a time until a unique combination can be found
@hartmans hartmans force-pushed the extend_permute_identifier branch from 9f5831f to 5953d0c Compare November 17, 2025 21:35
@hartmans hartmans merged commit e16464c into master Nov 17, 2025
4 of 10 checks passed
@hartmans hartmans deleted the extend_permute_identifier branch November 17, 2025 21:40
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.

3 participants