Skip to content

feat(ci): assert .github/workflows holds only workflows, correctly named - #37616

Merged
yuneng-berri merged 3 commits into
litellm_internal_stagingfrom
litellm_/workflow-dir-hygiene
Aug 20, 2026
Merged

feat(ci): assert .github/workflows holds only workflows, correctly named#37616
yuneng-berri merged 3 commits into
litellm_internal_stagingfrom
litellm_/workflow-dir-hygiene

Conversation

@yuneng-berri

@yuneng-berri yuneng-berri commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

#37586 has merged, so this now stands alone against staging and holds only its own four files.

TLDR

Problem this solves:

How it solves it:

  • WF001 fails a top-level file that is not a workflow at all, in either extension
  • WF004 fails a real .yaml workflow separately, and says to rename rather than relocate
  • A subdirectory is left alone, because GitHub does not read one either
  • Fails if a call-only workflow lacks the _ prefix, or a _ one is uncallable
  • Renames the one misspelled workflow so the repo starts green

User Flow

Before: a helper script goes into the workflows directory and nobody notices

  1. Someone adds .github/workflows/backfill_prices.py next to the workflow that runs it, because that is where the workflow is
  2. GitHub reads the directory, fails to parse the file as a workflow, and lists it as invalid in the Actions tab
  3. CI is green, so the PR merges
  4. The script drifts out of use and nobody finds it, which is exactly how the two in chore(ci): close the test-census blind spots and move scripts out of workflows/ #37586 got there

After: the same PR fails, and says where the file goes

  1. The PR adds the script under .github/workflows/
  2. assert-ci-coverage fails with WF001 naming the file and pointing at .github/scripts/ or a subdirectory
  3. The author moves it, and the workflow's run: line keeps working unchanged
  4. The Actions tab keeps listing only things that are actually workflows

Relevant issues

Linear ticket

Pre-Submission checklist

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/test_litellm/<your_test_file>.py -v
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review

Screenshots / Proof of Fix

Before (03b7438)

  1. Command, on the parent branch where the stray is still named .yaml:
python3 .github/scripts/assert_workflow_dir_hygiene.py; echo "exit=$?"
  1. Output:
ERROR: .github/workflows/ holds files that break its own conventions
  - test-model-map.yaml: WF004 is a real workflow and GitHub reads it, but this directory spells them .yml; rename it to test-model-map.yml
exit=1

After (3e825a7)

Green once the stray is renamed

  1. Command:
python3 .github/scripts/assert_workflow_dir_hygiene.py; echo "exit=$?"
  1. Output:
OK: 52 workflows, every file in .github/workflows/ is one, and the _ prefix means callable in both directions.
exit=0

The census is unaffected

  1. Command:
python3 .github/scripts/assert_ci_coverage.py
  1. Output:
OK: 2422 test files and 10 Dockerfiles are each invoked by at least one job or carry an explicit allowlist entry.

Red-first on the repo-state tests

  1. Command, putting the stray back:
git mv .github/workflows/test-model-map.yml .github/workflows/test-model-map.yaml
uv run pytest tests/test_litellm/test_assert_workflow_dir_hygiene.py -q -k repo_as_it_stands
  1. Output:
1 failed, 1 passed, 11 deselected, 1 warning in 0.25s

Unit tests

  1. Command:
uv run pytest tests/test_litellm/test_assert_workflow_dir_hygiene.py -q
  1. Output:
13 passed, 1 warning in 0.22s

Type

🆕 New Feature
🧹 Refactoring
✅ Test

Caveats

  • The rename is safe: check contexts come from the workflow and job names, not the filename
  • test-model-map.yml is not a required check, and its job id does not change
  • Dual-mode workflows keep their plain name on purpose, so create-release-branch.yml stays as it is
  • The kebab-case and test-/lint-/scan- prefix parts of the convention are not enforced here; 29 of 52 files would need renaming and that wants its own PR

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

@greptile-apps

greptile-apps Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds a CI hygiene check that ensures top-level workflow files use the expected extension and that reusable-workflow names agree with their triggers.

  • Adds workflow-directory validation and focused unit/repository-state tests.
  • Runs the validation from the existing CI coverage workflow.
  • Renames test-model-map.yaml to the canonical .yml extension.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
.github/scripts/assert_workflow_dir_hygiene.py Adds validation for stray files, noncanonical workflow extensions, and reusable-workflow naming consistency.
.github/workflows/ci-coverage.yml Adds the workflow-directory hygiene check to the existing CI coverage job.
.github/workflows/test-model-map.yml Renames the existing workflow to the repository’s canonical .yml extension without changing its contents.
tests/test_litellm/test_assert_workflow_dir_hygiene.py Adds focused coverage for trigger parsing, naming rules, directory traversal, and current repository state; the previously reported annotation issue is fixed.

Reviews (4): Last reviewed commit: "fix(ci): report a .yaml workflow as a na..." | Re-trigger Greptile

Comment thread tests/test_litellm/test_assert_workflow_dir_hygiene.py Outdated
@yuneng-berri

Copy link
Copy Markdown
Contributor Author

Added the Final annotations. Worth noting the type-discipline gate targets litellm/ only, so tests are convention-enforced, not gated.

@yuneng-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Base automatically changed from litellm_/testing-strategy-audit-d946a6 to litellm_internal_staging August 20, 2026 17:07
@yuneng-berri
yuneng-berri requested a review from a team August 20, 2026 17:07
@yuneng-berri
yuneng-berri force-pushed the litellm_/workflow-dir-hygiene branch from 174838c to 7a0d3b9 Compare August 20, 2026 17:08
@yuneng-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@tin-berri tin-berri 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.

New WF001/WF004 checks catch non-workflow files or misnamed workflows landing in .github/workflows/ (the exact class of issue #37586 found manually). Confirmed the rename is safe — check contexts come from workflow/job names not filenames, so test-model-map.yaml -> .yml doesn't break the required check. Red-first repro (putting the stray back, showing the specific test fails) is solid proof. Scope stays to its stated four files now that #37586 merged. Deliberately doesn't scope-creep into enforcing the kebab-case/prefix convention (29 more files) — correctly left for its own PR. CI green.

@yuneng-berri
yuneng-berri enabled auto-merge (squash) August 20, 2026 18:01
GitHub reads .yml and .yaml alike, so WF001 telling you to move a valid
.yaml workflow to .github/scripts/ was wrong advice. WF001 now covers only
files that are not workflows at all, and the .yml spelling this directory
keeps moves to WF004, which says to rename rather than relocate.

WF001 also never looked into subdirectories, since GitHub does not read
them either; the message now says so. The directory is injected rather
than read off a module constant, so the cases are testable without
monkeypatching.
@yuneng-berri
yuneng-berri force-pushed the litellm_/workflow-dir-hygiene branch from 843f253 to c6d0e72 Compare August 20, 2026 21:20
@yuneng-berri
yuneng-berri disabled auto-merge August 20, 2026 21:25
@yuneng-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@yuneng-berri
yuneng-berri enabled auto-merge (squash) August 20, 2026 21:32
@yuneng-berri
yuneng-berri merged commit 648c6e7 into litellm_internal_staging Aug 20, 2026
67 checks passed
@yuneng-berri
yuneng-berri deleted the litellm_/workflow-dir-hygiene branch August 20, 2026 21:36
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