Repository navigation
(janitor/dedupe): consolidate duplicated cloud-agent git URL utilities - #7708
Conversation
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.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (4 files)
Verified: (1) Reviewed by deepseek-v4.1-flash · Input: 42.5K · Output: 4.8K · Cached: 368.5K Review guidance: REVIEW.md from base branch |
eshurakov
left a comment
There was a problem hiding this comment.
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.tsapps/web/src/components/cloud-agent/utils/git-utils.test.ts(deleted)apps/web/src/components/cloud-agent-next/utils/git-utils.tsapps/web/src/components/cloud-agent-next/utils/git-utils.test.ts
Summary
The legacy
cloud-agentand newercloud-agent-nextcomponent trees each carried a copy of the git URL parsing helpers. The two copies had already drifted:cloud-agent-nextgained Bitbucket support, GitLab/-/path handling, andssh://URI support.cloud-agentstill returned the wrong result for nested GitLab project URLs without a.gitsuffix (e.g.https://gitlab.com/group/subgroup/projecttruncated togroup/subgroup).This consolidates the concept to a single authoritative implementation.
Changes
cloud-agent/utils/git-utils.tsnow re-exportsextractRepoFromGitUrl(and theGitPlatformtype) from the canonicalcloud-agent-nextmodule. The legacy tree already imports fromcloud-agent-nextelsewhere, so the dependency direction is established.buildPrepareSessionRepoParamshelper (no production call sites in either tree) and its unusedPLATFORMimport.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
tsgotypecheck of the two changed modules passes.oxlinton the changed files: 0 warnings, 0 errors.extractRepoFromGitUrl/buildRepoBrowseUrl/detectGitPlatform/findAllGitPlatformUrlsdirectly against the divergent cases (Bitbucket, GitLab/-/, nested groups,ssh://, null/empty); all pass and the re-export resolves at runtime.pnpm --filter web testcould 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.