Skip to content

Fix pull alias - #1610

Merged
josephjclark merged 3 commits into
release/nextfrom
fix-pull-alias
Nov 3, 2026
Merged

josephjclark merged 3 commits into
release/nextfrom
fix-pull-alias

Conversation

@josephjclark

Copy link
Copy Markdown
Collaborator

When fetching or pulling a sandbox by UUID with no --alias, the CLI always defaulted the alias to the sandbox id. If the project had already been pulled under a different alias, this wrote a second project file and could fail with a UUID conflict.

Now the sandbox id is only used as the alias when the local project doesn't already have one, so a repeat fetch updates the existing file.

QA

This is the problem which we're facing with github sync in prod:

  • I pull a sandbox project with its UUID and set the alias
  • A project.yaml is created using the alias, all good
  • Now we pull again, using the UUID and NOT setting the alias

We expect that when pulling the project, we re-use the existing local alias, and no new file is created.

But actually, the fetch code will force the alias to the sandbox id, creating a new statefile, and then throwing an error for a UUID conflict.

Tests

  • packages/cli/test/projects/fetch.test.ts: fetches a sandbox twice (with, then without an alias) and asserts only the staging file exists, and that no my-sandbox file is written after either fetch.
  • integration-tests/cli/test/sync/commands.test.ts: the same flow through project pull against the mock Lightning.

Both fail without the fix and pass with it.

Notes

A first-ever sandbox pull with no alias should still default to the sandbox id. The new condition relies on remoteProject.cli.alias being unset in that case, which is worth a look in review.

AI Usage

Please disclose whether you've used AI anywhere in this PR (it's cool, we just
want to know!):

  • I have used Claude Code
  • I have used another model
  • I have not used AI

You can read more details in our
Responsible AI Policy

@github-project-automation github-project-automation Bot moved this to New Issues in Core Nov 3, 2026
@josephjclark
josephjclark merged commit 222473d into release/next Nov 3, 2026
12 checks passed
@github-project-automation github-project-automation Bot moved this from New Issues to Done in Core Nov 3, 2026
@josephjclark
josephjclark deleted the fix-pull-alias branch November 3, 2026 18:03
josephjclark added a commit that referenced this pull request Nov 3, 2026
* Keep non-ASCII letters and punctuation in ids derived from names (#1605)

* Keep non-ASCII letters and punctuation in ids

slugify replaced every non-word character with a hyphen, so names in
other scripts lost their letters and their ids didn't match Lightning's.
It now only replaces characters that aren't safe in file names.

Names that differ only by case or by space vs hyphen still give the same
id. A pull now rejects them, as Lightning's export does, so the
resources.yaml writer no longer adds -2 suffixes to channel keys.

* Track channel ids in the checkout file

The new slug rules change some resources.yaml keys, and merging only
matched channels by key, so a channel whose key changed lost its id and
was treated as removed. The checkout file now records channel_uuids by
key, as it already does for workflows. A merge matches channels by id
first, then by key, then by name.

* add changeset for channels change

* comments and tests

---------

Co-authored-by: Joe Clark <jclark@openfn.org>

* Fix pull alias (#1610)

* add failing tests

* fix

* changeset

* versions

---------

Co-authored-by: Midigo Frank <39288959+midigofrank@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant