fix: prevent ENAMETOOLONG crash for long parallel:matrix job names#1865
Merged
firecow merged 3 commits intoMay 31, 2026
Merged
Conversation
…ob names When parallel:matrix entries contain long variable values, the base64url encoding in safeDockerString expands the job name beyond the 255-byte NAME_MAX limit, crashing with ENAMETOOLONG before any job executes. Fix: when the encoded name exceeds 238 chars (255 minus the 17-char worst-case suffix from Docker volume names), truncate to a readable prefix and append a 16-char SHA-256 hash of the original name. Short names are unchanged. Fixes firecow#1862
firecow
reviewed
May 30, 2026
… e2e test
- MAX_FILENAME_LENGTH now shows derivation (255 - 17) instead of magic 238
- Added invariant comment: \w without /u guarantees ASCII, so .length == bytes
- Noted why we hash jobName not encoded (encoding isn't injective)
- Changed toContain('Lw') to toBe('jobLwname') for exact assertion
- Added tests/test-cases/parallel-matrix-long-name/ integration fixture
that exercises the actual crash path end-to-end (regression guard for firecow#1862)
Contributor
Author
|
Thanks for the thorough review @firecow — all four points addressed in the latest push:
Really appreciate the note about the /u invariant — exactly the kind of subtle correctness detail that would bite someone later. All tests green (61 unit + 33 integration). |
firecow
reviewed
May 31, 2026
firecow
approved these changes
May 31, 2026
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.
Problem
When
parallel:matrixentries contain long variable values,safeDockerString()encodes non-alphanumeric characters using base64url, which expands the string (e.g.,/→Lw,→IA). The encoded name is used directly as a filename/volume name. Linux/macOSNAME_MAXis 255 bytes — the reproducer generates ~340 characters, causing an immediate crash.Fixes #1862
Fix
When the encoded name exceeds 238 chars, truncate to a readable prefix +
-+ 16-char SHA-256 hash of the original name.gcl-...-999999-build)Changes
src/utils.ts: Added length guard tosafeDockerString()with hash-based truncationtests/utils.test.ts: Added 9 test cases covering short names, long names, extreme lengths, boundary conditions, volume name safety, determinism, and uniquenessVerification
npm run typecheck✅npm run lint✅Summary by cubic
Prevents ENAMETOOLONG crashes when
parallel:matrixgenerates long job names whosebase64url-expanded values exceed filesystem limits. Ensures Docker volume/file names stay within 255 bytes. Fixes #1862.MAX_FILENAME_LENGTH = 255 - 17(NAME_MAX minusgcl-${name}-999999-build) insafeDockerString.parallel-matrix-long-namefixture (YAML updated) to ensure both long and short matrix entries complete.Written for commit 62e73ba. Summary will update on new commits.