Repository navigation
fix(cli): skip settings in push and pull all when only an API key is configured - #2080
Merged
Merged
Conversation
…configured Settings live on console endpoints that an API key cannot reach, so in CI the fan-out stopped at its first step and never pushed or pulled tables, functions or sites. The fan-out now warns and moves on when an action reports ErrConsoleNeedsSession; an explicit push or pull settings still fails as before.
🟢 Tier S · Ready to merge
This change lets
📂 Walkthrough · 4
Reviewed |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
appwrite push allandappwrite pull allstopped at their first step when the CLI was configured with only an API key (appwrite client --endpoint ... --project-id ... --key ...), which is the usual CI setup. Both fan-outs start with project settings, and settings go through console endpoints:consoleClient()returnsErrConsoleNeedsSession("session not found...") for a key-only session, and the fan-out returned that error before touching tables, functions, sites, buckets, teams, webhooks, topics or analytics.The fan-outs now recognise
ErrConsoleNeedsSession, print a one-line warning and carry on with the remaining resources:The check reuses the existing auth detection in
consoleClient()(session.go) rather than adding a second one, so a signed-in session behaves exactly as before. Any other error still stops the fan-out, and an explicitpush settings/pull settingsstill fails with the same message.Test Plan
New tests in
templates/cli/internal/cmd/fanout_test.go:TestEverythingSkipsConsoleOnlyActionsUnderAnAPIKey: for both pull and push, a settings action returningErrConsoleNeedsSessionis skipped with the warning and later actions still run.TestEverythingStillStopsOnOtherErrors: other errors still abort the fan-out.TestAllUnderAnAPIKeyLeavesOutOnlySettings: end to end through the root command with a key-onlyprefs.json, a project config and a mock server;pull all --forceandpush all --forceboth succeed and report the skipped settings.Red/green: with the two
skipsConsoleOnlychecks removed from a scratch copy of the generated CLI, the first and third tests fail withsession not found. Run appwrite login...; with the fix they pass.php example.php cli,gofmt -l,go build ./...,go vet ./...,go test ./...,composer lint-twig,composer refactor:checkand the twig line-length check all pass.Related PRs and Issues
None.
Closes #2083