fix(manifest): avoid KeyError when override bottle has repos absent from base #464

Merged
didericis merged 2 commits from fix/457-merge-bottles-git-repo-keyerror into main 2026-07-23 18:33:01 -04:00
Collaborator

Summary

  • merge_bottles_runtime used .get(n, base_repos_by_name[n]) which eagerly evaluates the default, crashing with KeyError when a repo name exists only in the override bottle
  • Replaced with a conditional expression so the base lookup only runs when the key is absent from the override dict
  • Adds three regression tests: override-only repo, base-only repo, and name-collision (override wins)

Closes #457

Test plan

  • pytest tests/unit/test_manifest_bottle_merge.py — all 25 tests pass
  • pyright — 0 errors
  • test_git_repo_only_in_override_does_not_raise directly exercises the --bottle base --bottle with-repo crash path; no separate manual run needed
## Summary - `merge_bottles_runtime` used `.get(n, base_repos_by_name[n])` which eagerly evaluates the default, crashing with `KeyError` when a repo name exists only in the override bottle - Replaced with a conditional expression so the base lookup only runs when the key is absent from the override dict - Adds three regression tests: override-only repo, base-only repo, and name-collision (override wins) Closes #457 ## Test plan - [x] `pytest tests/unit/test_manifest_bottle_merge.py` — all 25 tests pass - [x] `pyright` — 0 errors - [x] `test_git_repo_only_in_override_does_not_raise` directly exercises the `--bottle base --bottle with-repo` crash path; no separate manual run needed
didericis-claude added 1 commit 2026-07-23 18:17:53 -04:00
fix(manifest): avoid KeyError when override bottle has repos absent from base
test / integration-docker (pull_request) Successful in 19s
test / unit (pull_request) Successful in 38s
lint / lint (push) Failing after 2m47s
test / integration-firecracker (pull_request) Successful in 3m17s
test / coverage (pull_request) Successful in 44s
test / publish-infra (pull_request) Has been skipped
tracker-policy-pr / check-pr (pull_request) Failing after 12m13s
7b9b1c6312
merge_bottles_runtime used .get(n, base_repos_by_name[n]) which eagerly
evaluates the default, crashing when a repo exists only in the override
bottle. Replaced with a conditional expression so the base lookup only
runs when needed.

Adds three regression tests covering override-only, base-only, and
name-collision cases.

Closes #457

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
didericis added 1 commit 2026-07-23 18:25:33 -04:00
test: annotate _git_repo helper to satisfy pyright strict mode
test / integration-docker (pull_request) Successful in 17s
lint / lint (push) Successful in 55s
test / unit (pull_request) Successful in 1m44s
tracker-policy-pr / check-pr (pull_request) Successful in 7s
test / integration-firecracker (pull_request) Successful in 3m24s
test / coverage (pull_request) Successful in 16s
test / publish-infra (pull_request) Has been skipped
f3437528d6
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
didericis-codex approved these changes 2026-07-23 18:32:38 -04:00
didericis-codex left a comment
Collaborator

Reviewed: no actionable findings. The fix avoids eager evaluation of the missing base-repository lookup while preserving repository order and override-wins behavior. The focused 25-test unittest suite passes under Python 3.13.

Reviewed: no actionable findings. The fix avoids eager evaluation of the missing base-repository lookup while preserving repository order and override-wins behavior. The focused 25-test unittest suite passes under Python 3.13.
didericis approved these changes 2026-07-23 18:32:53 -04:00
didericis merged commit 12b071833d into main 2026-07-23 18:33:01 -04:00
didericis deleted branch fix/457-merge-bottles-git-repo-keyerror 2026-07-23 18:33:01 -04:00
Sign in to join this conversation.