Repository navigation
Keep non-ASCII letters and punctuation in ids derived from names - #1605
Open
midigofrank wants to merge 2 commits into
Open
midigofrank wants to merge 2 commits into
midigofrank wants to merge 2 commits into
Conversation
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.
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.
midigofrank
marked this pull request as ready for review
October 29, 2026 15:30
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.
Short Description
Workflow, step and channel ids now keep non-ASCII letters and punctuation from their names, so they match the ids Lightning uses.
Fixes #1602
Fixes #1603
Background
Until OpenFn/lightning#5106 (September 2026), Lightning only allowed ASCII letters, digits, spaces,
_and-in job and workflow names, andslugifywas written for that. Lightning now accepts any character except control characters, so names like患者確認orEvent-based workflow 1 (rename)reach the CLI. Lightning's own v2 export builds ids by lowercasing the name and replacing spaces with-, and nothing else. This PR follows the same rule.Implementation Details
slugifyused to turn every non-word character into a hyphen. Names in other scripts lost their letters (患者確認became an empty id), and names with punctuation got ids that didn't match Lightning's (Event-based workflow 1 renameandEvent-based workflow 1 (rename)both becameevent-based-workflow-1-rename). It now trims, NFC-normalizes and lowercases the name, and turns spaces into-as Lightning does. Characters that aren't safe in file names (/ \ : * ? " < > |) and a leading.are also replaced with-. Those are the only cases where our ids differ from Lightning's.The same
slugifyis used for workflow, step, channel and project ids. Project ids for names with punctuation change too. That's harmless, because projects are matched by uuid first.Ids are no longer URL-safe. Nothing puts a local id in a URL: they're only used as file and folder names and as YAML keys.
Some different names still resolve to the same id:
Foo Barandfoo-bar). Lightning's export rejects these too.Q3/Q4andQ3:Q4) or by a leading dot (.fooand-foo). Lightning keeps these characters in its ids, so its export allows these pairs.A pull now fails with an error listing the clashing workflow, step or channel names. Clashing channel keys used to get a
-2suffix intoResourceChannels. They are now rejected like the others, so a project with channels namedMy Channelandmy-channelthat used to pull will now fail until one of them is renamed.The new rules change some ids, which changes some
resources.yamlchannel keys. Merge matched channels by key only, so a channel whose key changed lost its id and was flagged as removed. To fix that, the checkout file now recordschannel_uuidsby key, as it already does forworkflow_uuids.from-fsreads them back, andmergeChannelsmatches by id first, then key, then name.Matching by name covers checkouts written by an older CLI, which have no
channel_uuids. One case can still recreate a channel: the checkout has nochannel_uuids, the channel's name has punctuation, and the name was changed locally before deploying. The first pull with this version writeschannel_uuidsand closes that gap.Known limits: Windows reserved names (
CON,NUL) and trailing dots aren't handled.QA Notes
Flujo de atención (v2.0). The folder and step ids should keep those characters.resources.yamlkeys for those names will change. Channels should keep their ids and should not show up as removed on deploy.My Flowandmy-flow, then pull. It should fail with an error naming both.AI Usage
Please disclose whether you've used AI anywhere in this PR (it's cool, we just
want to know!):
You can read more details in our
Responsible AI Policy