Skip to content

fix: sync config only deploy#12

Merged
stevensJourney merged 2 commits intomainfrom
fix-sync-config-deploy
Mar 4, 2026
Merged

fix: sync config only deploy#12
stevensJourney merged 2 commits intomainfrom
fix-sync-config-deploy

Conversation

@stevensJourney
Copy link
Collaborator

@stevensJourney stevensJourney commented Mar 3, 2026

The deploy sync-config command is used when users only want to deploy Sync config (without service changes) - if service config isn't deployed, users don't need to track the PowerSync service Sync config in their projects. This command should not require a service.yaml file to be present.

The previous implementation threw an error, blocking deploy, if the service.yaml file was not found.

This updates the sync-config deploy to not require service.yaml to be present. We also allow the sync config to be present in any location with a new optional sync-config-file-path flag.

powersync deploy sync-config
# works if the project is linked with:
#  - /powersync/sync-config.yaml present
#  - instance is linked via any of the linkable methods (cli.yaml, direct flags, env vars)

powersync deploy sync-config --sync-config-file-path=sync.yaml
# allows the sync config to be present given the provided path (relative to CWD in this case)

Unit tests have been added to ensure this behaviour. Unit tests have also been added to ensure the deploy service-config command - which does not require sync-config to be present, works as expected.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the powersync deploy sync-config flow so it can deploy/validate sync rules without requiring a local service.yaml, and adds an option to point at a sync config file in a custom location.

Changes:

  • Stop requiring service.yaml for deploy sync-config by avoiding local service config parsing for that command.
  • Add --sync-config-file-path to deploy sync config from an arbitrary file location.
  • Add unit tests covering deploy sync-config (no service.yaml) and deploy service-config (no sync-config.yaml) scenarios.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/cli-core/src/command-types/SelfHostedInstanceCommand.ts Renames config parsing method to parseLocalConfig.
packages/cli-core/src/command-types/CloudInstanceCommand.ts Renames config parsing method to parseLocalConfig and updates docs.
cli/src/commands/link/cloud.ts Updates call site to renamed parsing method.
cli/src/commands/deploy/index.ts Updates override + call sites to renamed parsing method.
cli/src/commands/deploy/service-config.ts Updates call site to renamed parsing method.
cli/src/commands/deploy/sync-config.ts Implements optional sync config path flag and removes local service.yaml dependency for this command.
cli/test/commands/deploy/sync-config.test.ts Adds coverage for sync-config deploy without service.yaml and with custom sync config path.
cli/test/commands/deploy/service-config.test.ts Adds coverage for service-config deploy without sync-config.yaml.
cli/README.md Documents the new --sync-config-file-path flag in CLI docs.
Comments suppressed due to low confidence (2)

packages/cli-core/src/command-types/CloudInstanceCommand.ts:223

  • Renaming the exported method parseConfig() to parseLocalConfig() is a breaking change for any external consumers/plugins extending CloudInstanceCommand. Consider keeping parseConfig() as a backwards-compatible wrapper (possibly deprecated) that forwards to parseLocalConfig() so existing plugins don’t break on upgrade.
  parseLocalConfig(projectDirectory: string): ServiceCloudConfigDecoded {
    const servicePath = join(projectDirectory, SERVICE_FILENAME);
    const doc = parseYamlFile(servicePath);

    // validate the config with full schema
    const validationResult = validateCloudConfig(doc.contents?.toJSON());
    if (!validationResult.valid) {
      throw new Error(`Invalid cloud config: ${validationResult.errors?.join('\n')}`);
    }

    this.serviceConfig = ServiceCloudConfig.decode(doc.contents?.toJSON());
    return this.serviceConfig;
  }

packages/cli-core/src/command-types/SelfHostedInstanceCommand.ts:127

  • Same API-compat concern as CloudInstanceCommand: renaming parseConfig()parseLocalConfig() on an exported base command can break downstream plugin code. If this package is consumed outside this repo, consider keeping a deprecated parseConfig() wrapper for compatibility.
  parseLocalConfig(projectDirectory: string): ServiceSelfHostedConfigDecoded {
    const servicePath = join(projectDirectory, SERVICE_FILENAME);
    const doc = parseYamlFile(servicePath);

    // validate the config with full schema
    const validationResult = validateSelfHostedConfig(doc.contents?.toJSON());
    if (!validationResult.valid) {
      throw new Error(`Invalid self-hosted config: ${validationResult.errors?.join('\n')}`);
    }

    return ServiceSelfHostedConfig.decode(doc.contents?.toJSON());
  }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@stevensJourney stevensJourney marked this pull request as ready for review March 4, 2026 06:48
Copy link

@Chriztiaan Chriztiaan left a comment

Choose a reason for hiding this comment

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

Quality diff. Happy.

@stevensJourney stevensJourney merged commit d166a16 into main Mar 4, 2026
2 checks passed
@stevensJourney stevensJourney deleted the fix-sync-config-deploy branch March 4, 2026 07:20
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.

3 participants