Skip to content

fix(cli): skip settings in push and pull all when only an API key is configured - #2080

Merged
ChiragAgg5k merged 1 commit into
mainfrom
fix/cli-push-all-api-key
Oct 17, 2026
Merged

ChiragAgg5k merged 1 commit into
mainfrom
fix/cli-push-all-api-key

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

appwrite push all and appwrite pull all stopped 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() returns ErrConsoleNeedsSession ("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:

ℹ Warning: Skipping settings: it needs a signed-in session, and only an API key is configured. Run `appwrite login` to push settings too.

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 explicit push settings / pull settings still 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 returning ErrConsoleNeedsSession is 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-only prefs.json, a project config and a mock server; pull all --force and push all --force both succeed and report the skipped settings.

Red/green: with the two skipsConsoleOnly checks removed from a scratch copy of the generated CLI, the first and third tests fail with session 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:check and the twig line-length check all pass.

Related PRs and Issues

None.

Closes #2083

…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.
@hansi-codes

hansi-codes Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

The change matches the targeted API-key-only case, preserves failure behavior for other errors, and tests both fan-outs.

This change lets push all and pull all continue past console-only settings when the CLI is configured with an API key, and prints an actionable warning. Other errors remain fatal, with tests covering the skip behavior and key-only runs.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 4
File Change
templates/cli/internal/cmd/fanout_test.go Adds unit and end-to-end coverage for skipping settings under an API key while retaining other error handling.
templates/cli/internal/cmd/pullall.go Continues the pull fan-out when a console-only action returns ErrConsoleNeedsSession.
templates/cli/internal/cmd/pushall.go Continues the push fan-out when a console-only action returns ErrConsoleNeedsSession.
templates/cli/internal/cmd/session.go Adds a shared console-only skip check that prints an actionable warning.

Reviewed 43af547 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@hansi-codes hansi-codes Bot 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 S · Looks good to merge. Summary

@ChiragAgg5k ChiragAgg5k self-assigned this Oct 17, 2026
@ChiragAgg5k
ChiragAgg5k merged commit 092fd6e into main Oct 17, 2026
61 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the fix/cli-push-all-api-key branch October 17, 2026 10:02
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.

Skip settings in push all and pull all when only an API key is configured

1 participant