Skip to content

[release-1.18] Add CI check for invalid characters in file paths#9691

Merged
kaovilai merged 3 commits intovelero-io:release-1.18from
kaovilai:pr-filepath-check-release-1.18
Apr 13, 2026
Merged

[release-1.18] Add CI check for invalid characters in file paths#9691
kaovilai merged 3 commits intovelero-io:release-1.18from
kaovilai:pr-filepath-check-release-1.18

Conversation

@kaovilai
Copy link
Copy Markdown
Collaborator

@kaovilai kaovilai commented Apr 8, 2026

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

Note

Responses generated with Claude

kaovilai and others added 2 commits April 8, 2026 17:18
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>
Copilot AI review requested due to automatic review settings April 8, 2026 21:19
@kaovilai kaovilai changed the title Add CI check for invalid characters in file paths [release-1.18] Add CI check for invalid characters in file paths Apr 8, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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-files paths 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.

Comment on lines +33 to +36
# Characters explicitly rejected by Go's fileNameOK
# (path separators / and \ are inherent to paths so we check per-element)
bad_ascii = set('\"' + \"'\" + '*<>?\`|:')

Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

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).

Suggested change
# Characters explicitly rejected by Go's fileNameOK
# (path separators / and \ are inherent to paths so we check per-element)
bad_ascii = set('\"' + \"'\" + '*<>?\`|:')

Copilot uses AI. Check for mistakes.
Comment on lines +66 to +70
)
print(f'::error file={name}::File \"{name}\" contains invalid char {char_desc}')
bad_files.append((name, clean, char_desc))
break

Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.64%. Comparing base (4b1d236) to head (c8c77dc).
⚠️ Report is 1 commits behind head on release-1.18.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kaovilai kaovilai added the kind/changelog-not-required PR does not require a user changelog. Often for docs, website, or build changes label Apr 13, 2026
@kaovilai kaovilai merged commit 77945d9 into velero-io:release-1.18 Apr 13, 2026
58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

has-changelog kind/changelog-not-required PR does not require a user changelog. Often for docs, website, or build changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants