Skip to content

(janitor/dedupe): consolidate duplicated cloud-agent git URL utilities - #7708

Merged
kilo-code-bot[bot] merged 1 commit into
mainfrom
janitor/dedupe-git-url-utils
Oct 19, 2026
Merged

kilo-code-bot[bot] merged 1 commit into
mainfrom
janitor/dedupe-git-url-utils

Conversation

@kilo-code-bot

@kilo-code-bot kilo-code-bot Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Summary

The legacy cloud-agent and newer cloud-agent-next component trees each carried a copy of the git URL parsing helpers. The two copies had already drifted:

  • cloud-agent-next gained Bitbucket support, GitLab /-/ path handling, and ssh:// URI support.
  • cloud-agent still returned the wrong result for nested GitLab project URLs without a .git suffix (e.g. https://gitlab.com/group/subgroup/project truncated to group/subgroup).

This consolidates the concept to a single authoritative implementation.

Changes

  • cloud-agent/utils/git-utils.ts now re-exports extractRepoFromGitUrl (and the GitPlatform type) from the canonical cloud-agent-next module. The legacy tree already imports from cloud-agent-next elsewhere, so the dependency direction is established.
  • Removed the dead buildPrepareSessionRepoParams helper (no production call sites in either tree) and its unused PLATFORM import.
  • Deleted the now-redundant cloud-agent/utils/git-utils.test.ts, whose assertions encoded the stale behavior (including one that directly contradicted the canonical test).

Net: -266 lines (2 insertions, 266 deletions).

Verification

  • Focused tsgo typecheck of the two changed modules passes.
  • oxlint on the changed files: 0 warnings, 0 errors.
  • Ran extractRepoFromGitUrl / buildRepoBrowseUrl / detectGitPlatform / findAllGitPlatformUrls directly against the divergent cases (Bitbucket, GitLab /-/, nested groups, ssh://, null/empty); all pass and the re-export resolves at runtime.
  • Full pnpm --filter web test could not run in this environment because the Jest worker setup requires PostgreSQL (unavailable here). The affected unit tests are pure and do not touch the database.

The legacy cloud-agent and cloud-agent-next components each carried a
copy of the git URL parsing helpers. The copies had already drifted:
the legacy one missed Bitbucket support, GitLab /-/ path handling, and
ssh:// URIs. Point the legacy module at the canonical cloud-agent-next
implementation and remove the dead buildPrepareSessionRepoParams helper
plus its now-redundant test file.
@kilo-code-bot kilo-code-bot Bot added the janitor Automated dead-code/duplication cleanup label Oct 16, 2026
@kilo-code-bot
kilo-code-bot Bot enabled auto-merge October 16, 2026 07:26
@kilo-code-bot

kilo-code-bot Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (4 files)
  • apps/web/src/components/cloud-agent/utils/git-utils.ts - now re-exports the canonical helpers
  • apps/web/src/components/cloud-agent/utils/git-utils.test.ts - deleted (encoded stale behavior)
  • apps/web/src/components/cloud-agent-next/utils/git-utils.ts - removed dead buildPrepareSessionRepoParams + unused PLATFORM import
  • apps/web/src/components/cloud-agent-next/utils/git-utils.test.ts - removed tests for the deleted helper

Verified: (1) buildPrepareSessionRepoParams has zero references repo-wide, so its removal and the corresponding test deletions are safe; (2) the only importer of the legacy module is apps/web/src/components/cloud-agent/store/db-session-atoms.ts, which consumes extractRepoFromGitUrl and benefits from the canonical nested-GitLab fix; (3) the canonical module imports nothing, so the new cloud-agent → cloud-agent-next re-export introduces no import cycle; (4) the removed PLATFORM import and GitPlatform widening are unused in the legacy tree. No security, logic, or memory-leak concerns in the changed lines.


Reviewed by deepseek-v4.1-flash · Input: 42.5K · Output: 4.8K · Cached: 368.5K

Review guidance: REVIEW.md from base branch main

@eshurakov eshurakov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

Independently reviewed the full diff and pinned head/base source at c143913. No major behavioral or security regressions found: the removed helper has no production callers in either snapshot, the canonical utility remains dependency-free, and the legacy re-export preserves callers while correcting nested GitLab paths.

Validation: 52 retained canonical test bodies and 18 compatible deleted legacy parser cases passed in a read-only Node assertion harness; the intentionally obsolete GitLab expectation was checked against the corrected result. In-memory module linking verified the re-export resolves to the exact canonical function. CI typecheck, lint, formatting, build and tests passed; logs confirm the canonical utility and both session-atom suites ran (1,191 suites passed). Reviewed existing review/conversation comments. No installs or broad local suites; harness execution is not a local Jest/integration run. Head rechecked unchanged before submission.

Files Reviewed (4 files)
  • apps/web/src/components/cloud-agent/utils/git-utils.ts
  • apps/web/src/components/cloud-agent/utils/git-utils.test.ts (deleted)
  • apps/web/src/components/cloud-agent-next/utils/git-utils.ts
  • apps/web/src/components/cloud-agent-next/utils/git-utils.test.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

janitor Automated dead-code/duplication cleanup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant