Repository navigation
fix(build): reject dist paths Hub cannot store - #360
Open
kenilghetia wants to merge 1 commit into
Open
kenilghetia wants to merge 1 commit into
kenilghetia wants to merge 1 commit into
Conversation
The build action accepted two kinds of dist path that Hub refuses when it
imports the package: a .replica-internal segment, which Hub reserves for
its storage, and paths that exceed Hub's 1,024-byte storage-name limit
once stored as builds/{Build ID}/dist/{path}. The workflow succeeded and
the Build then failed in Hub without naming the file.
Reject both in validateOutputPath with errors that name the path. The
992-byte limit reserves 32 bytes for the prefix with the largest 64-bit
Build ID, so it fits every Build. Document both rules with the other
output limits.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the change that rejects unsupported build-output paths before upload.
No open issues 🎉
What changed in this PR
This PR moves two Hub storage checks into the shared build-output validator, so unsupported dist paths fail before upload with an error naming the offending path.
Changes:
- Reject paths containing a
.replica-internalsegment or exceeding the conservative 992-byte limit. - Add regression tests for the reserved name and the 992/993-byte boundary.
- Document the storage restrictions and path-length limit.
| File | Description |
|---|---|
hub/docs/github-actions-builds.md |
Documents reserved paths and the 992-byte limit. |
actions/build/scripts/validate-output-path/index.ts |
Adds early validation with path-specific errors. |
actions/build/scripts/validate-build-output/index.test.ts |
Covers reserved-name rejection and the length boundary. |
actions/build/scripts/constants.ts |
Defines the shared path-length limit. |
Review effort: Balanced (adaptive)
Author
|
Hi @nshki |
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.
Why
The build action accepts some dist file paths that Hub later refuses to store. The prototype's workflow succeeds and uploads its package, and then the Build fails during Hub's import. The message does not say which file caused it: "package contains an unsupported path or entry type". The author has to wait for a full CI run and then work out the cause alone.
I found this while setting up the monorepo locally. I ran the build action tests and Hub's Build model tests in separate containers, then passed packages built by the real action scripts to Hub's real
Build::PackageExtraction. An ordinary build passed both. A build containing a.replica-internalfolder, or a file path longer than Hub's storage allows, passed the action and failed in Hub.This is a developer-experience and reliability fix, not a security fix. Hub's checks already keep these paths out of storage. Few builds will hit it, but those that do currently fail late and without a useful message.
Closes #359
What changes
The action's dist path check,
validateOutputPath, gains the two Hub storage rules it was missing. Most rules already match: the action's 20-segment depth limit mirrors Hub, and its template validator already rejects.replica-internal..replica-internalis rejected. Hub reserves that name for its storage layout. The comparison is case-sensitive, like Hub's.builds/{Build ID}/dist/{path}and limits that whole name to 1,024 bytes. Reserving 32 bytes for the prefix with the largest 64-bit Build ID gives a limit that fits every Build.Both errors name the path and the rule, like the action's other path errors:
Because the check sits in the shared output validation, it applies at every point where the action validates output. That includes Hub's local-development packaging, which reuses these scripts. The output limits table and description in
hub/docs/github-actions-builds.mdnow list both rules.flowchart LR subgraph Before A1[Prototype build] --> B1[Action checks pass] --> C1[Workflow succeeds<br/>package uploaded] --> D1[Hub import fails<br/>file not named] end subgraph After A2[Prototype build] --> B2[Action rejects the path<br/>and names it] --> C2[Author fixes the build<br/>in the same run] endTwo regression tests cover the change. One checks that a
.replica-internaldirectory is rejected. The other checks the exact length boundary: a 992-byte path is accepted and a 993-byte path is rejected.The limit is deliberately conservative. For small Build IDs, Hub would accept some paths between 993 and about 1,007 bytes that the action now rejects. The action cannot know the Build ID in advance, and paths that long are very unlikely from real bundlers, so I chose a fixed limit that fits every Build. I'm happy to change it if you prefer another trade-off.
The change was verified against the action's scripts and Hub's extractor in containers, not in a live GitHub Actions run with
actions/upload-artifact. The new checks run before upload, so that step is unaffected.