fix(artifacts): name the rejected segment and reason for unsafe patch paths - #1159
Open
mrthankyou wants to merge 2 commits into
Open
mrthankyou wants to merge 2 commits into
mrthankyou wants to merge 2 commits into
Conversation
… paths normalizeWorkspacePatchPath rejected a path with only "contains an unsafe path segment", naming neither the path, the segment, nor why. A segment over the 128-character cap and one with a disallowed character looked identical, which made failures expensive to diagnose. The error now includes the path, the offending segment, and the reason: its length against the maximum, or the first disallowed character and the allowed set. Validation is unchanged. The 128-character bound stays because it is part of the published ultrafuzz.workspace-patch.v1 schema; a comment now says so. Closes #987 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Count code points with a u-flag match instead of spreading the string, and stringify numbers explicitly in the template literal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
normalizeWorkspacePatchPathrejected unsafe workspace patch paths with only:It named neither the path, the segment, nor the reason, so a segment over the 128-character cap looked identical to one with a disallowed character (#987). It now reports all three:
Lengths are counted in code points, matching the
u-flag regex.What does not change
ultrafuzz.workspace-patch.v1JSON schema (workspace-patch.schema.json), so loosening it needs a schema version change. A comment now names that constraint, which WORKSPACE_PATCH_SEGMENT's 128-character cap makes workspace patches fail based on how deep the run directory sits #987 asked for if the value was deliberate.Context
#987's real-world trigger was a 130-character Claude session directory written into the agent worktree. That came from a reverted local change (see the #986 close-out) and does not occur on
main. What remains is the poor diagnostic when a legitimate target path hits the cap or the character set, which this fixes.Test plan
pnpm --filter @ultrafuzz/artifacts test: 353 pass, including a new test for the 128/129 boundary, a disallowed@, and a spacepnpm --filter @ultrafuzz/artifacts schema:checkprettier --checkandeslinton changed filesCloses #987
🤖 Generated with Claude Code
The PR appears safe to merge.
Summary
The PR makes unsafe workspace patch path errors identify the rejected path, segment, and reason without changing validation. Tests cover the segment-length boundary and disallowed characters.
Reviews (2) · Last reviewed commit: "fix(artifacts): satisfy strict lint in p..."