Skip to content

fix(workflows): workflow add detects local YAML files case-insensitively#3633

Merged
mnriem merged 1 commit into
github:mainfrom
jawwad-ali:fix/workflow-add-case-insensitive-yaml-suffix
Jul 22, 2026
Merged

fix(workflows): workflow add detects local YAML files case-insensitively#3633
mnriem merged 1 commit into
github:mainfrom
jawwad-ali:fix/workflow-add-case-insensitive-yaml-suffix

Conversation

@jawwad-ali

Copy link
Copy Markdown
Contributor

What

specify workflow add gated its two local-file branches on a case-sensitive extension check — .suffix in (".yml", ".yaml") — at both the --dev branch (src/specify_cli/workflows/_commands.py) and the plain local-path branch. Every other YAML-file detector in the CLI normalizes case first:

  • workflow runsource_path.suffix.lower() in (".yml", ".yaml")
  • WorkflowEngine.load_workflowpath.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.YAML loads the file (case-insensitive), 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 or a directory containing workflow.yml"
    • the plain path falls through to a catalog lookup and fails with "not found in catalog"

Path("x.YAML").suffix preserves case regardless of filesystem, so the mismatch isn't masked on case-insensitive systems.

Fix

Add .lower() to both suffix reads so workflow add matches workflow run and the engine loader. The lowercase happy path is unchanged (2-line source change).

Tests

tests/test_workflows.py::TestWorkflowAddCaseInsensitiveSuffix:

  • test_plain_path_accepts_uppercase_extensionworkflow add Sample.YAML installs (fails before the fix with "not found in catalog")
  • test_dev_path_accepts_uppercase_extensionworkflow add --dev Sample.YAML installs (fails before with the "--dev source must be…" error)
  • test_lowercase_extension_still_installs — happy-path regression guard

Verified fail-before / pass-after (reverting only the source hunk makes the two uppercase tests fail with the exact errors above). ruff check clean.


AI-assisted: authored with Claude Code. I reviewed the change, verified it against the workflow run / load_workflow siblings, and confirmed the fail-before/pass-after behavior.

`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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Makes workflow add recognize uppercase YAML extensions consistently with workflow execution and loading.

Changes:

  • Normalizes local file suffixes in standard and --dev paths.
  • Adds regression tests for uppercase and lowercase extensions.
Show a summary per file
File Description
src/specify_cli/workflows/_commands.py Makes YAML suffix detection case-insensitive.
tests/test_workflows.py Covers both add paths and lowercase behavior.

Review details

Tip

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

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Medium

@mnriem
mnriem merged commit 0add713 into github:main Jul 22, 2026
12 checks passed
@mnriem

mnriem commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

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