Skip to content

Report adapter capabilities and prove public repositories reach anonymous clients - #134

Merged
Meldiron merged 1 commit into
mainfrom
feat-adapter-capabilities
Aug 19, 2026
Merged

Report adapter capabilities and prove public repositories reach anonymous clients#134
Meldiron merged 1 commit into
mainfrom
feat-adapter-capabilities

Conversation

@Meldiron

Copy link
Copy Markdown
Contributor

What

  • Adds capability methods to the Git adapter so consumers can ask what a provider supports instead of calling into a missing endpoint just to catch it throwing:

    • supportsRepositoryCreation()
    • supportsRepositoryDeletion()
    • supportsRepositoryArchives()
    • supportsCommentImages()
    • supportsPublicRepositories()

    All default to true; providers that lack a capability override the method.

  • Adds testPublicRepositoryIsPubliclyAccessible to the shared suite. Existing tests only asserted the private flag the provider reports; this one proves publicness end to end by sending the git smart-HTTP ref advertisement request (GET …/info/refs?service=git-upload-pack, the request git clone opens with) without credentials. A public repository has to answer 200 with a real git-upload-pack advertisement, and a private one has to refuse the same request — otherwise the public answer would say nothing beyond the server being up. Each adapter test supplies its anonymous clone URL via a new abstract anonymousCloneUrl().

  • Marks GitLab and Bitbucket as supported in the README's adapter table.

Verification

  • composer lint and composer check (PHPStan level 8) pass.
  • Full Gitea suite green against the Docker stack: 103 tests, 371 assertions (12 capability skips), including the new public-access test.

🤖 Generated with Claude Code

… anonymous clients

Consumers ask the adapter what a provider can do - create or delete
repositories, hand out archive URLs, render comment images, host
public repositories - instead of calling into a missing endpoint just
to catch it throwing.

The shared suite now also proves publicness end to end: a public
repository has to answer the anonymous git ref advertisement request
that git clone opens with, and a private one has to refuse it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Meldiron
Meldiron marked this pull request as ready for review August 19, 2026 08:32

@Meldiron Meldiron left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

lgtm

Meldiron added a commit that referenced this pull request Aug 19, 2026
supportsRepositoryArchives(), supportsCommentImages(),
supportsPublicRepositories(), the anonymous public-access test and the
non-Origin README marks now land through #134; Origin
keeps only its own overrides here.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The pull request adds provider capability-reporting methods, introduces an end-to-end anonymous smart-HTTP test for public repositories, supplies provider-specific clone URLs, and updates the support table.

  • Adds five capability methods to the shared Git adapter.
  • Verifies anonymous access to public repositories while rejecting access to private repositories.
  • Adds anonymous clone URL construction for all six adapter test suites.
  • Marks GitLab and Bitbucket as supported in the README.

Confidence Score: 4/5

The pull request should not merge until comment-image capability reporting reflects each provider; the test resource-cleanup gap is additionally worth correcting.

All adapters currently inherit a true comment-image capability even though the new contract says providers without suitable proxying require a text fallback, and the new two-repository test can leak its first resource when the second creation fails.

Files Needing Attention: src/VCS/Adapter/Git.php, tests/VCS/Base.php

Important Files Changed

Filename Overview
src/VCS/Adapter/Git.php Adds five capability methods, but the shared true default incorrectly advertises comment-image support for adapters lacking the behavior described by the method contract.
tests/VCS/Base.php Adds the shared anonymous smart-HTTP visibility test; its partial setup can leak the first repository if creation of the second fails.
tests/VCS/Adapter/GitHubTest.php Adds the expected unauthenticated HTTPS clone URL for GitHub repositories.
tests/VCS/Adapter/GitLabTest.php Adds an anonymous clone URL using the configured GitLab instance and normalized owner path.
tests/VCS/Adapter/BitbucketTest.php Adds the expected anonymous Bitbucket Cloud clone URL.
tests/VCS/Adapter/GiteaTest.php Adds an anonymous clone URL using the configured Gitea instance.
tests/VCS/Adapter/GogsTest.php Adds an anonymous clone URL using the configured Gogs instance.
tests/VCS/Adapter/ForgejoTest.php Adds an anonymous clone URL using the configured Forgejo instance.
README.md Marks GitLab and Bitbucket as supported adapters.

Fix all with Greploop Fix All in Claude Code Fix All in Codex

Prompt To Fix All With AI
### Issue 1
src/VCS/Adapter/Git.php:138-141
**Comment-image support is misreported**

When a consumer checks `supportsCommentImages()` for GitLab, Bitbucket, Gitea, Gogs, or Forgejo, every adapter inherits `true` even though the method contract says providers without suitable image proxying require a text fallback, causing consumers to publish image markup that recipients cannot view.

### Issue 2
tests/VCS/Base.php:516-517
**Partial setup bypasses cleanup**

If public repository creation succeeds but private repository creation fails, execution never enters the `try` block, so the public repository is not discarded and remains in the provider account.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "feat: report adapter capabilities and pr..." | Re-trigger Greptile

Comment thread src/VCS/Adapter/Git.php
Comment thread tests/VCS/Base.php
@Meldiron
Meldiron merged commit 3ed77e5 into main Aug 19, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants