fix(workflows): workflow add detects local YAML files case-insensitively#3633
Open
jawwad-ali wants to merge 1 commit into
Open
fix(workflows): workflow add detects local YAML files case-insensitively#3633jawwad-ali wants to merge 1 commit into
jawwad-ali wants to merge 1 commit into
Conversation
`workflow add` gated the local-file branches on a case-SENSITIVE
`.suffix in (".yml", ".yaml")` (the `--dev` branch and the plain
local-path branch), while every other YAML-file detector in the CLI
normalizes case: `workflow run` uses `source_path.suffix.lower()` and
`WorkflowEngine.load_workflow` uses `path.suffix.lower()`.
The result was an add/run inconsistency: `specify workflow run Sample.YAML`
loads the file, but `specify workflow add Sample.YAML` does not recognize
it as a local workflow — the `--dev` branch rejects it with "--dev source
must be a workflow YAML file ..." and the plain path falls through to a
catalog lookup that fails with "not found in catalog".
Add `.lower()` to both suffix reads so `workflow add` matches its siblings.
The lowercase happy path is unchanged.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
specify workflow addgated its two local-file branches on a case-sensitive extension check —.suffix in (".yml", ".yaml")— at both the--devbranch (src/specify_cli/workflows/_commands.py) and the plain local-path branch. Every other YAML-file detector in the CLI normalizes case first:workflow run→source_path.suffix.lower() in (".yml", ".yaml")WorkflowEngine.load_workflow→path.suffix.lower() in (".yml", ".yaml")Why it matters
An add/run inconsistency for uppercase extensions (e.g.
Sample.YAML,wf.YML):specify workflow run Sample.YAMLloads the file (case-insensitive), butspecify workflow add Sample.YAMLdoes not recognize it as a local workflow:--devbranch rejects it with "--dev source must be a workflow YAML file or a directory containing workflow.yml"Path("x.YAML").suffixpreserves case regardless of filesystem, so the mismatch isn't masked on case-insensitive systems.Fix
Add
.lower()to both suffix reads soworkflow addmatchesworkflow runand the engine loader. The lowercase happy path is unchanged (2-line source change).Tests
tests/test_workflows.py::TestWorkflowAddCaseInsensitiveSuffix:test_plain_path_accepts_uppercase_extension—workflow add Sample.YAMLinstalls (fails before the fix with "not found in catalog")test_dev_path_accepts_uppercase_extension—workflow add --dev Sample.YAMLinstalls (fails before with the "--dev source must be…" error)test_lowercase_extension_still_installs— happy-path regression guardVerified fail-before / pass-after (reverting only the source hunk makes the two uppercase tests fail with the exact errors above).
ruff checkclean.AI-assisted: authored with Claude Code. I reviewed the change, verified it against the
workflow run/load_workflowsiblings, and confirmed the fail-before/pass-after behavior.