fix: use loop variable instead of global ticker in GenerateFreshName #40

Merged
mvhutz merged 1 commits from fix/fresh-name-generation into main 2026-01-18 20:58:24 +00:00
Owner

Description

GenerateFreshName used a global ticker variable but never incremented it inside the loop.
This caused an infinite loop if the first generated name (_0) was already in the used set.

  • Remove global ticker variable.
  • Use loop variable i directly to generate candidate names.

Benefits

  • Fixes infinite loop bug when generated name collides with used set.
  • Removes unnecessary global state.
  • Simpler and more predictable behavior.

Checklist

  • Code follows conventional commit format.
  • Branch follows naming convention (<type>/<description>). Always use underscores.
  • Tests pass (if applicable).
  • Documentation updated (if applicable).
## Description `GenerateFreshName` used a global `ticker` variable but never incremented it inside the loop. This caused an infinite loop if the first generated name (`_0`) was already in the used set. - Remove global `ticker` variable. - Use loop variable `i` directly to generate candidate names. ## Benefits - Fixes infinite loop bug when generated name collides with used set. - Removes unnecessary global state. - Simpler and more predictable behavior. ## Checklist - [x] Code follows conventional commit format. - [x] Branch follows naming convention (`<type>/<description>`). Always use underscores. - [x] Tests pass (if applicable). - [x] Documentation updated (if applicable).
mvhutz added 1 commit 2026-01-18 20:57:35 +00:00
The function used a global `ticker` variable but never incremented it
inside the loop, causing an infinite loop if the first generated name
was already in the used set.

This fix removes the global state and uses the loop variable `i`
directly, which is cleaner and avoids the bug.
mvhutz merged commit f2c8d9f7d2 into main 2026-01-18 20:58:24 +00:00
mvhutz deleted branch fix/fresh-name-generation 2026-01-18 20:58:24 +00:00
Sign in to join this conversation.