Investigation found the Paste-JSON dialog already prompted on a duplicate server name (replace vs. keep-both-renamed), but the drag-and-drop-a-.json-file import path did not — it silently renamed collisions to a fixed -imported suffix without checking that name was itself free, which could let two servers end up with the same name in memory and get silently collapsed into one at save time (apply_servers() in bcc_core.py rebuilds the on-disk dict via {s.name: s.data for s in servers}, last-value-wins).
Changes:
bcc_core.py: new pure, tested resolve_name_collision(name, existing) -> str — appends -2, -3, ... until unique.
bcc.py: extracted a shared MainWindow._import_server(name, data) helper used by both paste_json and dropEvent; it always prompts on collision (replace / keep-both-renamed) and always resolves the renamed name through resolve_name_collision, so drag-and-drop now behaves identically to paste — no more silent overwrite/collapse.
tests/test_core.py: 5 new unit tests for resolve_name_collision (no-conflict passthrough, single collision, multiple taken suffixes, empty existing set, and a repeated-call scenario simulating a double file-drop that previously could collide).
Verified locally: ruff check ., ruff format --check ., and pytest -q all pass (100 tests).
Closes #8
Investigation found the Paste-JSON dialog already prompted on a duplicate server name (replace vs. keep-both-renamed), but the drag-and-drop-a-.json-file import path did not — it silently renamed collisions to a fixed `-imported` suffix without checking that name was itself free, which could let two servers end up with the same name in memory and get silently collapsed into one at save time (`apply_servers()` in bcc_core.py rebuilds the on-disk dict via `{s.name: s.data for s in servers}`, last-value-wins).
Changes:
- `bcc_core.py`: new pure, tested `resolve_name_collision(name, existing) -> str` — appends `-2`, `-3`, ... until unique.
- `bcc.py`: extracted a shared `MainWindow._import_server(name, data)` helper used by both `paste_json` and `dropEvent`; it always prompts on collision (replace / keep-both-renamed) and always resolves the renamed name through `resolve_name_collision`, so drag-and-drop now behaves identically to paste — no more silent overwrite/collapse.
- `tests/test_core.py`: 5 new unit tests for `resolve_name_collision` (no-conflict passthrough, single collision, multiple taken suffixes, empty existing set, and a repeated-call scenario simulating a double file-drop that previously could collide).
Verified locally: `ruff check .`, `ruff format --check .`, and `pytest -q` all pass (100 tests).
the_og
added the P1 label 2026-07-07 20:27:36 -04:00
Supervisor review (Cowork): approve. CI run #164 green; diff is isolated to bcc.py/bcc_core.py/tests. Good catch — the drag-and-drop path was a genuine silent-overwrite (only paste prompted); extracting _import_server so both paths prompt, plus a pure/tested resolve_name_collision (incl. the drop-twice case), is the right fix. Ready to merge into v1.2.0.
Supervisor review (Cowork): **approve.** CI run #164 green; diff is isolated to `bcc.py`/`bcc_core.py`/`tests`. Good catch — the drag-and-drop path was a genuine silent-overwrite (only paste prompted); extracting `_import_server` so both paths prompt, plus a pure/tested `resolve_name_collision` (incl. the drop-twice case), is the right fix. Ready to merge into v1.2.0.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #8
Investigation found the Paste-JSON dialog already prompted on a duplicate server name (replace vs. keep-both-renamed), but the drag-and-drop-a-.json-file import path did not — it silently renamed collisions to a fixed
-importedsuffix without checking that name was itself free, which could let two servers end up with the same name in memory and get silently collapsed into one at save time (apply_servers()in bcc_core.py rebuilds the on-disk dict via{s.name: s.data for s in servers}, last-value-wins).Changes:
bcc_core.py: new pure, testedresolve_name_collision(name, existing) -> str— appends-2,-3, ... until unique.bcc.py: extracted a sharedMainWindow._import_server(name, data)helper used by bothpaste_jsonanddropEvent; it always prompts on collision (replace / keep-both-renamed) and always resolves the renamed name throughresolve_name_collision, so drag-and-drop now behaves identically to paste — no more silent overwrite/collapse.tests/test_core.py: 5 new unit tests forresolve_name_collision(no-conflict passthrough, single collision, multiple taken suffixes, empty existing set, and a repeated-call scenario simulating a double file-drop that previously could collide).Verified locally:
ruff check .,ruff format --check ., andpytest -qall pass (100 tests).Supervisor review (Cowork): approve. CI run #164 green; diff is isolated to
bcc.py/bcc_core.py/tests. Good catch — the drag-and-drop path was a genuine silent-overwrite (only paste prompted); extracting_import_serverso both paths prompt, plus a pure/testedresolve_name_collision(incl. the drop-twice case), is the right fix. Ready to merge into v1.2.0.Superseded by #26 (release: v1.2.0), which merged this change into
mainas part of the integrated release. Closing.Pull request closed