Repository navigation
fix(mcpx): never overwrite same-named exec artifacts (#1605) - #2950
Conversation
applyFrame and fetchArtifacts renamed delivered artifacts onto the bare sanitised name, so a second artifact whose name sanitised to the same file silently destroyed the first - contradicting Store.Export's documented never-overwrite rule. Both paths now resolve the destination through the newly exported artifacts.UniquePath (the same suffixing uniquePath Export uses), and each artifact's Path points at its own file. Regression tests cover both delivery paths, including the sanitise-collision pair from the issue ("my shot.png" / "my-shot.png").
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 27 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 74349e0079
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codex P2 on #2950: uniquePath cleaned the directory to "." and then rejected the joined bare file name with a "."+separator prefix test, so artifacts.dir "." or "./" failed both CLI delivery paths outright. Containment is now checked with filepath.Rel, which answers the real question for every base including "." and the filesystem root. Regression tests cover both delivery paths with a current-directory artifacts dir.
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Fixes #1605.
Problem
The mcpx CLI's two exec artifact-delivery paths renamed incoming artifacts onto the bare sanitised name with no collision handling: a second artifact whose name sanitised to the same file silently overwrote the first, and both artifacts'
Pathfields pointed at the one surviving file — contradictingStore.Export's documented never-overwrite rule.Change
artifacts: exportUniquePath(the exported form of the existinguniquePaththatStore.Exportuses) so every delivery path follows the same suffixing rule (shot.png→shot-1.png, suffix before the extension).cli/exec.goapplyFrame(streaming path): resolve the destination throughartifacts.UniquePathand rename onto it; the matched artifact'sPathgets its own file.cli/exec.gofetchArtifacts(inline/GET path): same resolution beforewriteNew.Tests
TestApplyFrameSameNamedArtifactsNeverOverwrite— drives the real frame flow with the issue's sanitise-collision pair ("my shot.png"/"my-shot.png"→my-shot.png+my-shot-1.png, both bodies intact, distinct Paths).TestFetchArtifactsSameNamedNeverOverwrite— same guarantee for the fetch path.go test ./internal/cli/ ./internal/artifacts/ -count=1— both packages pass;gofmtclean;go vetclean.Queue task 1849 (repo-health-code-pilot).
Need help on this PR? Tag
@codesmith-botwith what you need.