[release-1.18] Add CI check for invalid characters in file paths#9691
Conversation
Go's module zip rejects filenames containing certain characters (shell special chars like " ' * < > ? ` |, path separators : \, and non-letter Unicode such as control/format characters). This caused a build failure when a changelog file contained an invisible U+200E LEFT-TO-RIGHT MARK (see PR velero-io#9552). Add a GitHub Actions workflow that validates all tracked file paths on every PR to catch these issues before they reach downstream consumers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com> (cherry picked from commit 6d18d9b)
Remove LEFT-TO-RIGHT MARK unicode characters from changelog filenames that would cause Go module zip failures. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering> Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
There was a problem hiding this comment.
Pull request overview
Adds a pull-request CI workflow to validate that all tracked repository file paths are compatible with Go module zip filename rules, preventing downstream module consumers from failing on invalid/unicode format characters. The PR also reintroduces/renames several unreleased changelog entries to remove invisible invalid characters from their filenames.
Changes:
- Add a GitHub Actions workflow that scans
git ls-filespaths and fails the PR on invalid characters per Go module zip constraints. - Rename/fix affected unreleased changelog filenames (previously containing invisible U+200E) and ensure their entries exist under valid paths.
Reviewed changes
Copilot reviewed 1 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/pr-filepath-check.yml |
New PR CI workflow to validate tracked file paths against Go module zip filename constraints. |
changelogs/unreleased/9594-Lyndon-Li |
Changelog entry file present under a cleaned/valid filename. |
changelogs/unreleased/9606-Lyndon-Li |
Changelog entry file present under a cleaned/valid filename. |
changelogs/unreleased/9609-Lyndon-Li |
Changelog entry file present under a cleaned/valid filename. |
changelogs/unreleased/9610-Lyndon-Li |
Changelog entry file present under a cleaned/valid filename. |
changelogs/unreleased/9669-Lyndon-Li |
Changelog entry file present under a cleaned/valid filename. |
changelogs/unreleased/9672-Lyndon-Li |
Changelog entry file present under a cleaned/valid filename. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Characters explicitly rejected by Go's fileNameOK | ||
| # (path separators / and \ are inherent to paths so we check per-element) | ||
| bad_ascii = set('\"' + \"'\" + '*<>?\`|:') | ||
|
|
There was a problem hiding this comment.
The bad_ascii set is defined but never used. This adds quoting/escaping complexity inside the python3 -c string and makes the check harder to maintain; either remove it or use it as part of the validation logic (e.g., for clearer rejection reasons).
| # Characters explicitly rejected by Go's fileNameOK | |
| # (path separators / and \ are inherent to paths so we check per-element) | |
| bad_ascii = set('\"' + \"'\" + '*<>?\`|:') |
| ) | ||
| print(f'::error file={name}::File \"{name}\" contains invalid char {char_desc}') | ||
| bad_files.append((name, clean, char_desc)) | ||
| break | ||
|
|
There was a problem hiding this comment.
The break here only exits the inner for ch in element loop, so a single path can be appended to bad_files multiple times (e.g., if more than one path element contains invalid chars). Consider stopping validation for the current file after the first invalid character is found (break out of both loops or track a per-file "already flagged" boolean) to avoid duplicate error annotations and duplicate rename suggestions.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-1.18 #9691 +/- ##
=============================================
Coverage 60.64% 60.64%
=============================================
Files 387 387
Lines 36896 36896
=============================================
Hits 22376 22376
Misses 12891 12891
Partials 1629 1629 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Cherry-pick of #9553 to release-1.18.
Go's module zip rejects filenames containing certain characters (shell special chars, path separators, and non-letter Unicode such as control/format characters). This adds a GitHub Actions workflow that validates all tracked file paths on every PR to catch these issues before they reach downstream consumers.
Also fixes 6 changelog filenames containing invisible U+200E LEFT-TO-RIGHT MARK characters:
9594-Lyndon-Li,9606-Lyndon-Li,9609-Lyndon-Li,9610-Lyndon-Li,9669-Lyndon-Li,9672-Lyndon-LiNote
Responses generated with Claude