Skip to content

Add Hugging Face OAuth2 provider to migration allow-list - #221

Merged
Meldiron merged 1 commit into
mainfrom
feat/huggingface-oauth-provider
Aug 19, 2026
Merged

Add Hugging Face OAuth2 provider to migration allow-list#221
Meldiron merged 1 commit into
mainfrom
feat/huggingface-oauth-provider

Conversation

@Meldiron

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds huggingface to the OAuth2Provider::PROVIDERS allow-list.

Appwrite server is adding a built-in Hugging Face OAuth2 provider (appwrite/appwrite#13123). Once that provider is enabled in app/config/oAuthProviders.php, it shows up in GET /project/oauth2-providers, and the Appwrite source enumerates it during a migration. Without an allow-list entry, OAuth2Provider::fromArray() returns null and Sources/Appwrite.php records:

{"code":500,"message":"No migration resource for OAuth2 provider 'huggingface'; skipped.","resourceName":"oauth2-provider","resourceGroup":"auth"}

addError marks the whole migration failed. Note the null check runs before isConfigured(), so this fires even for projects that never configured the provider — it breaks every migration, not just ones using Hugging Face. This is currently failing the Migrations E2E suite on the Appwrite PR.

Only clientId migrates (to the destination's huggingfaceAppid attribute); clientSecret is write-only and stays redacted per the existing policy. Hugging Face uses the default clientId/clientSecret field names and exposes no extra settings ('form' => false in the Appwrite config), so it needs no TARGET_SECRET fields — same shape as github.

Same change as #0eb1a58 (Add appwrite OAuth2 provider to migration allow-list).

Test Plan

  • Added testFromArrayHuggingFace, mirroring testFromArrayAppwrite: asserts clientId lands on the app ID target, no secret fields are produced, and clientSecret is not copied into settings.
  • testFromArrayNeverCopiesSecrets already iterates array_keys(OAuth2Provider::PROVIDERS), so it now covers the new key too.

Follow-up

Needs a 2.0.4 tag, then a composer.lock bump on appwrite/appwrite#13123 (its ^2.0.0 constraint already allows it).

🤖 Generated with Claude Code

Appwrite server is adding a built-in 'huggingface' OAuth2 provider
(appwrite/appwrite#13123). Without an entry in the PROVIDERS allow-list,
migrations fail with "No migration resource for OAuth2 provider
'huggingface'; skipped." — fromArray() returns null before the
isConfigured() check, so the error fires even on projects that never
configured the provider, failing the whole migration.

Only clientId migrates (to the huggingfaceAppid attribute); clientSecret
is write-only and stays redacted per the existing policy. Hugging Face
uses the default clientId/clientSecret field names and has no extra
settings, so there are no TARGET_SECRET fields.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds Hugging Face to the explicit OAuth2 provider allow-list so migrations preserve its client ID without copying its write-only client secret.

  • Maps huggingface.clientId to the destination application ID.
  • Adds focused hydration, destination-field, configuration, and secret-exclusion assertions.

Confidence Score: 5/5

The PR appears safe to merge with no actionable defects identified.

The new provider follows the established client-ID-only mapping, and the focused test verifies that the destination app ID is populated while secret data remains excluded.

Important Files Changed

Filename Overview
src/Migration/Resources/Auth/OAuth2/OAuth2Provider.php Adds a Hugging Face provider mapping consistent with the existing client-ID-only OAuth2 provider shape and secret-handling policy.
tests/Migration/Unit/Resources/OAuth2ProviderTest.php Verifies Hugging Face hydration, application-ID mapping, configured state, and exclusion of the client secret.

Reviews (1): Last reviewed commit: "Add Hugging Face OAuth2 provider to migr..." | Re-trigger Greptile

@Meldiron
Meldiron merged commit 49eca43 into main Aug 19, 2026
4 checks passed
@Meldiron
Meldiron deleted the feat/huggingface-oauth-provider branch August 19, 2026 09:09
Meldiron added a commit to arpit10128/appwrite that referenced this pull request Aug 19, 2026
2.0.4 adds 'huggingface' to the OAuth2 provider migration allow-list
(utopia-php/migration#221). Without it, the Appwrite migration source
cannot map the new provider and every migration fails with "No migration
resource for OAuth2 provider 'huggingface'; skipped.", which was breaking
the Migrations E2E suite on this PR.

Reaching 2.0.4 also requires utopia-php/abuse 2.0.1 (within the existing
2.0.* constraint): migration >= 2.0.3 needs the appwrite/appwrite PHP SDK
^27, and abuse 2.0.0 pinned it to ^26. abuse 2.0.1 requires ^27.1, so the
SDK moves 26.1.0 => 27.1.0. Nothing in this repository uses that SDK
directly; it is a transitive dependency of abuse and migration only.

Lock-only change, no composer.json constraints touched.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

1 participant