mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-09-06 08:16:02 +00:00
* fix(mcp): disambiguate duplicate-name repo resolution for worktrees When multiple indexed repos share the same registry name (main checkout plus linked worktrees), MCP tools no longer silently pick the first sibling. Resolution prefers the repo matching process.cwd()'s git root, throws RegistryAmbiguousTargetError when still ambiguous, and uses canonical path matching aligned with the CLI registry. Fixes #1658. Complements worktree detect_changes fixes in #1654/#1691. * fix(mcp): refresh registry on duplicate-name ambiguity before failing resolveRepo now retries resolveRepoFromCache after RegistryAmbiguousTargetError so stale in-memory siblings clear when the registry changes. Adds detect_changes callTool ambiguity test, registry-refresh regression test, pickRepoHandleForCwd MCP cwd doc, and temp-dir cleanup in #1658 fixtures. * chore(autofix): apply prettier + eslint fixes via /autofix command * fix(mcp): PR #1753 review follow-ups + collision-id case bug Address Findings 3-6 from the production-readiness review on PR #1753, plus a latent bug surfaced while writing the F5 regression test: - F3: drop the no-op `try { ... } catch (err) { throw err; }` wrapper around the miss-path retry in `resolveRepo`; the catch only re-threw. - F4: rewrite the misleading "child/repo" example on the relative-path tier — `child/repo` would be classified as path-like and never reach this branch. Comment now describes bare, separator-free names resolved against `process.cwd()`. - F5: add regression test for the stable hashed-id tier so a duplicate sibling can be reached by its `<name>-<hash>` id. Writing this test exposed that `repoId()` produced a mixed-case base64url suffix while `resolveRepoFromCache` lowercased the param before the Map lookup, so collision ids with any uppercase byte in the hash were unreachable. Fix: lowercase the hash in `repoId` so it survives `paramLower`. - F6: add regression test asserting two repos sharing a name prefix (`project-a`, `project-b`) cause `resolveRepo("project")` to reject as not-found rather than silently returning the first partial match. * refactor(mcp): tighten PR #1753 follow-up tests + pin hash length Address three P2 maintainability findings from the ce-code-review pass on commit aa7f2050: - Export `REPO_ID_HASH_LENGTH` from local-backend.ts and use it in both `repoId()` and the hashed-id test. Closes the silent-drift hole where the test's inline formula could fall out of sync with the source without any signal. - Extract `makeSharedPrefixFixture(nameA, nameB)` next to `makeDuplicateNameFixture`. Centralises the temp-dir + `.gitnexus` scaffolding + `duplicateFixtureDirs.push()` cleanup contract so future callers can't drop the cleanup step. - Reorder the hashed-id test's comment block so the intentional-coupling rationale leads, before the description of the formula being mirrored. * chore(autofix): apply prettier + eslint fixes via /autofix command * chore: re-run CI --------- Co-authored-by: Test <test@example.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| fixtures | ||
| helpers | ||
| integration | ||
| unit | ||
| utils | ||