fix: resolve alias correctly in generate_refactoring_code#884
fix: resolve alias correctly in generate_refactoring_code#884abhiramvsmg wants to merge 1 commit into
Conversation
|
✅ Health: 7.6 (unchanged) 📋 At a glance Files & modules (2)
🩹 Review priority (files here with the most recent bug-fix history — defects cluster, so review these first)
🔎 More signals (1)🔥 Hotspots touched (2)
📊 Full report · ⭐ Star Repowise · 📥 Install bot · Last updated 2026-07-17 10:09 UTC |
|
|
||
| result = await generate_refactoring_code(suggestion_id="does-not-exist", repo="frontend") | ||
|
|
||
| assert result["error"] is not None |
There was a problem hiding this comment.
Thank you for adding a regression test, and I confirmed that it does fail with the original LookupError when the production fix is reverted, so it genuinely guards the bug.
Could I suggest tightening the assertion to assert result["error"] == "not_found"? The tool has three different early returns that all set an error key, and only not_found proves that execution actually got past the repository lookup that this pull request fixes. In particular, llm_enrichment_enabled currently defaults to True when the repository has no configuration file, which is why the test reaches the lookup at all today. If that default were ever flipped, the tool would return error: "disabled" before touching the database, the test would still pass, and it would quietly stop testing anything.
|
This is outside the scope of your fix, so please feel free to leave it for a separate change, but I noticed while reviewing that |
generate_refactoring_code passed repo to _get_repo(session, repo) even though _resolve_repo_context(repo) had already resolved the alias and scoped the session to that one repository. This caused LookupError: Repository not found for workspace aliases that differ from the repo's directory basename, since _get_repo only matches on paths, IDs, and Repository.name.
Dropped the repo argument, matching the same fix already applied to get_health in #865.
Added test_generate_refactoring_code_resolves_alias_different_from_repo_name using the existing frontend/web-client alias fixture. Full test suite passes (28/28 in test_mcp_workspace.py).
Fixes #880