Skip to content

chore: absorb vcs into packages/vcs - #13932

Merged
ChiragAgg5k merged 831 commits into
mainfrom
chore/absorb-vcs
Sep 28, 2026
Merged

ChiragAgg5k merged 831 commits into
mainfrom
chore/absorb-vcs

Conversation

@ChiragAgg5k

Copy link
Copy Markdown
Member

Summary

Moves utopia-php/vcs into packages/vcs, so Appwrite loads it directly. Wave 3 of #13828, following rfc/monorepo.md. The mirror head is the 5.5.1 release Appwrite already locks (f8b0c717), so there is no version gap.

# Commit What
1 Add 'packages/vcs/' from commit 'f8b0c717…' Subtree import from the mirror with full history
2 chore(vcs): mirror plumbing mirror.yml points at this repository's mirror-redirect.yml; README banner refreshed. No banned files
3 refactor: load vcs from packages/ Root autoload and replace entries; drops utopia-php/vcs: 5.5.* and the https://github.com/utopia-php/vcs vcs repository entry; step A of the standard shape (below); PHPStan baseline; RFC phase 8 bullet
4 refactor(vcs): replace utopia-php/fetch with client The one decided exception to the pure move (below)
5 style(vcs): strip trailing whitespace… Two upstream lines that fail git diff --check

Step A

Before After
Source src/VCS/*, Utopia\VCS\ → src/VCS src/*, Utopia\VCS\ → src/
Unit tier tests/Unit/*, Utopia\Tests\Unit tests/*, Utopia\VCS\Tests
Provider tier tests/E2E/*, Utopia\Tests\E2E unchanged path, Utopia\VCS\Tests\E2E
phpstan.neon includes ../../phpstan.neon (level 5) standalone, level max over src and tests, keeps the adhocore/jwt stub
rector.php none standalone, the monorepo root's sets

src/ is the release byte for byte apart from the path move and Pint formatting (empty {} bodies and fn ( spacing); Rector changes nothing in src, so rector.php needs no skips. In tests/, Rector rewrites one dirname(__DIR__) in credentials.php.

The provider tier already lived in tests/E2E/. GitHub and Bitbucket skip without TESTS_GITHUB_* / TESTS_BITBUCKET_* credentials; Gitea, Forgejo, Gogs and GitLab run against the package's docker-compose.yml on offset ports. Nothing in the unit tier calls a provider.

Nothing new to hoist: adhocore/jwt is already in the root require, and utopia-php/cache is in packages/. The upstream repository has no LICENSE file (the manifest says MIT); left as released.

fetch → client

src/ never used Utopia\Fetch: the adapters call cURL directly, and utopia-php/fetch was a stale runtime requirement. The only users were three request-catcher and git-smart-HTTP helpers in tests/E2E/Base.php. Commit 4 moves them to Utopia\Client with Utopia\Psr7 requests, drops utopia-php/fetch from the package require, and adds utopia-php/client: ^0.5 and utopia-php/psr7: ^0.2.1 to require-dev (only the tests use them).

fetch client
new Client() new Client(new CurlAdapter())
default 15 s timeout withTimeout(15)
default 5 s connect timeout client default (5 s)
follows redirects, max 5 withFollowRedirects(), max 50 (see below)
fetch(url:, method: 'GET') RequestFactory::createRequest(Method::GET, …)
fetch(…, query: [...]) RequestFactory::query(Method::GET, …, [...])
text() (string) getBody()

The 5-hop cap does not carry over. withFollowRedirects(maxHops:) exists only on packages/client head (#13910), not in the released client 0.5.1 that the package's registry-resolved CI job installs, so any cap argument either fails there or is stripped by Rector. The three requests go to the local request catcher and self-hosted git servers, where the cap never comes into play. Once client 0.6.0 is released, the cap can be restored with ^0.6 and maxHops: 5.

No src request-building logic changed, so there are no new unit tests.

utopia-php/fetch leaves the package manifest. It stays in the root lock only because the still-vendored utopia-php/audit requires it.

Validation

Check Result
bin/monorepo validate all packages valid
bin/monorepo check vcs Rector, Pint and PHPStan level max (with baseline) pass
bin/monorepo test vcs (registry-resolved), unit tier 150 tests / 439 assertions, 1 skipped (Origin's live suite, skipped upstream by design)
bin/monorepo test vcs, e2e tier 559 tests / 1,127 assertions, 253 skipped (GitHub and Bitbucket without credentials, plus per-provider capability skips) against Gitea, Forgejo, Gogs and GitLab from the package compose file
phpunit --testsuite packages --filter 'Utopia\\VCS' 150 tests / 439 assertions under the root autoloader (the host has no igbinary, so packages/cache's codec providers error, as on main)
phpunit tests/unit/Vcs 43 tests / 179 assertions
Root PHPStan (host) on the 27 Appwrite files that use Utopia\VCS plus tests/unit/Vcs no errors
Class resolution Utopia\VCS\Adapter\Git\GitHub → packages/vcs/src/Adapter/Git/GitHub.php; vendor/utopia-php/vcs gone
composer update --lock lock drops only utopia-php/vcs (−60 lines plus the content hash)
composer validate --no-check-publish valid (the existing utopia-php/platform exact-constraint warning only)
bin/monorepo split vcs --dry-run e3743a38, fast-forwards from the mirror head f8b0c717
git diff --check clean

Baseline: 1,087 findings (level 5 in the monorepo, max here). 970 are in src, nearly all offset access, arguments and casts on the decoded mixed provider responses across the six Git adapters. 117 are in the tests, mostly the same response handling in the e2e Base. Listed under phase 8 in the RFC.

Merge and follow-up

Merge with a merge commit. A squash drops the git-subtree-* annotation and orphans the package from its mirror.

The mirror already has the canonical main ruleset (id 12522958: no force push, PRs required, no deletion; split app 4016286 always bypasses), so the absorb ran with --skip-ruleset. There is no classic branch protection on main.

After merge:

Step
Split Confirm Split pushes to utopia-php/vcs
Retire Remove packages/vcs from utopia-php/monorepo
client 0.6.0 Once released, restore the 5-hop cap in tests/E2E/Base.php
Triage Open on the mirror, listed below
Mirror Opened Title
issue utopia-php/vcs#84 2026-04 Improve Gogs adapter quality
PR utopia-php/vcs#132 (draft) 2026-08 fix: report a provider failure when reading pull request files
PR utopia-php/vcs#111 2026-06 fix(github): drop per-file patch in getPullRequestFiles to bound memory
PR utopia-php/vcs#109 2026-06 feat: add getCheckRunByName to look up check run ID by commit ref and name
PR utopia-php/vcs#103 2026-05 feat: add specific exceptions on provider errors and add retry
PR utopia-php/vcs#102 2026-05 Improve GitHub branch listing pagination
PR utopia-php/vcs#92 (draft) 2026-04 feat: return structured clone commands from git adapters
PR utopia-php/vcs#89 2026-04 fix: disable sparse checkout cone mode to prevent root file leaks
PR utopia-php/vcs#50 2025-12 add pagination to listBranches and add method listAllBranches
PR utopia-php/vcs#26 2024-10 Replace expectException with try/catch
PR utopia-php/vcs#25 2024-09 Add list repos for GitHub App
PR utopia-php/vcs#19 2024-06 cache methods call signature update
PR utopia-php/vcs#5 2023-09 fix: update dart commads

Nothing is ported here. Anything still wanted gets re-opened against packages/vcs/src/ (paths lost the VCS/ segment).

🤖 Generated with Claude Code

HarshMN2345 and others added 30 commits June 8, 2026 16:35
fix: include status code and response body in GitHub token error
fix: pass HTTP status code as exception code
Adds a way to get a presigned/downloadable URL for a repository archive
across all adapters.

- GitHub: captures the native 302 redirect to the signed codeload URL
- Gitea/Forgejo/Gogs & GitLab: build a directly-downloadable archive URL
  with the short-lived access token embedded as a query param, so it works
  without object storage
- adds a followRedirects flag to Adapter::call() so the GitHub redirect can
  be captured instead of followed

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…-ref path

- encode ref in GitHub/Gitea archive URLs (preserve slashes for nested branches)
- map GitHub 401/403 to a clear access-denied error
- document the opt-in @throws on the base getRepositoryPresignedUrl
- test the Gitea default-branch resolution (no-ref) path

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
feat: presigned URL to download repository archive
Add listTags($owner, $repositoryName, $search) to every Git adapter,
mirroring listBranches. Returns bare tag names, optionally filtered by a
shell glob (fnmatch) via a shared matchGlob helper on the Git base class,
so a resolved tag feeds straight into getRepositoryPresignedUrl.

- GitHub: single git/matching-refs/tags call, then glob-filter
- GitLab/Gitea: paginate the tags endpoint, then glob-filter
- Gogs: non-paginated override (mirrors its listBranches override)
- Forgejo inherits from Gitea

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@ChiragAgg5k ChiragAgg5k added the absorb History-preserving package absorption; merge commit required label Sep 26, 2026
@greptile-apps

greptile-apps Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[High risk] Moves VCS package from external dependency to monorepo.

The PR appears safe to merge based on the changes reviewed.

Summary

The PR moves Utopia VCS into packages/vcs, switches Appwrite to the in-tree package, and adapts its package tests and tooling.

  • The changes since the previous review correct an adapter-guide example, a README variable, Bitbucket test setup, and the no-credentials GitHub preflight path.
  • No new actionable issue was identified.

Reviews (13) · Last reviewed commit: "docs(vcs): show the absorbed layout in t..."

Comment thread packages/vcs/docker-compose.yml Resolved
Comment thread packages/vcs/tests/E2E/Base.php Resolved
@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → chore/absorb-vcs (after).

Metric Before After Change
🚀 Requests/sec 161.62 173.74 🟢 +7.5%
⏱️ Latency P50 106.73 ms 99.42 ms 🟢 -6.8%
⏱️ Latency P95 251.15 ms 233.23 ms 🟢 -7.1%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 99.42 233.23 11,286 173.74 -17.92
Account 197.18 375.88 594 9.94 -13.9
TablesDB 96.05 186.15 6,138 97.81 -26.52
Storage 91.76 193.66 2,970 48.51 -18.4
Functions 138.82 279.41 1,584 26.5 -27.85

Top API waits (after)

API request Max wait (ms)
account.name.update 554.62
account.prefs.update 516.15
functions.delete 429.93
tablesdb.rows.get 413.33
tablesdb.rows.increment 407.31

@ghost

ghost commented Sep 28, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

The new documentation matches the package layout, and I found no issue in the incremental change.

This PR moves VCS into packages/vcs and loads it through Appwrite’s root autoloader instead of the external Composer package. It gives VCS standalone package tooling and provider tests, migrates E2E HTTP helpers from Fetch to Client/PSR-7, and updates monorepo documentation. The latest commit corrects the adapter guide’s directory tree to match the new package layout.

Latest changes: The newest commit updates the adapter guide’s source and test directory tree for the flattened VCS package layout.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 15
File Change
composer.json, composer.lock Load VCS from the local package and remove the external VCS resolution.
packages/vcs/src/, packages/vcs/tests/ Import VCS adapters and tests, with E2E HTTP helpers using Client and PSR-7.
packages/vcs/composer.json, packages/vcs/phpunit.xml, packages/vcs/phpstan.neon, packages/vcs/phpstan-baseline.neon, packages/vcs/phpstan/stubs/adhocore-jwt.stub, packages/vcs/rector.php Configure standalone package dependencies, tests, and analysis.
packages/vcs/docker-compose.yml, packages/vcs/resources/gogs/app.ini, packages/vcs/tests/credentials.php Configure local provider services and E2E credentials.
packages/vcs/README.md, packages/vcs/docs/add-new-vcs-adapter.md Document VCS usage and the flattened adapter source and test layout.
packages/vcs/.github/workflows/mirror.yml, packages/vcs/.gitignore Add mirror routing and package ignore rules.
rfc/monorepo.md Record the VCS absorption and analysis baseline.
composer.json Maps Emails source and tests locally, replaces the Composer package, and removes the external Emails requirement.
packages/vcs/composer.json Defines the absorbed package manifest and its runtime and test dependencies.
packages/vcs/phpstan.neon Adds standalone PHPStan configuration and baseline.
packages/vcs/rector.php Adds package-specific Rector configuration.
packages/vcs/docker-compose.yml Defines local provider containers and bootstrap services for E2E tests.
packages/vcs/README.md Adds the package readme and setup, testing, and adapter guidance.
packages/vcs/.github/workflows/mirror.yml Routes mirror-repository issues and pull requests to the monorepo.
packages/vcs/resources/gogs/app.ini Adds Gogs configuration for the local E2E stack.

Reviewed the commits since a2e133a · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Tier A · See the inline comments. Summary

Comment thread packages/vcs/README.md Resolved

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Tier A · Looks good to merge. Summary

Comment thread packages/vcs/docker-compose.yml Resolved
Comment thread packages/vcs/tests/GitHubTest.php Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

absorb History-preserving package absorption; merge commit required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants