fix(apps): stage pulls before replacing destination - #233
Open
Gautam Sharma (GautamSharma99) wants to merge 1 commit into
Open
fix(apps): stage pulls before replacing destination#233Gautam Sharma (GautamSharma99) wants to merge 1 commit into
Gautam Sharma (GautamSharma99) wants to merge 1 commit into
Conversation
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
.langsmith/app.jsonbefore touching the destinationCloses #225.
Problem
apps pullpreviously performed these operations in this order:Any invalid gzip/base64 payload, unsafe archive entry, empty archive, extraction I/O failure, or app-link write failure could therefore destroy a known-good local app and leave no complete replacement.
Implementation
The command now creates a temporary sibling directory named like
.<app>.pull-*and performs all validation/extraction/link writing there. The existing destination remains untouched while these operations run.Once staging is complete,
replaceStagedApp:The staging directory is removed by deferred cleanup whenever ownership has not been transferred to the replacement operation. A failed archive never reaches the replacement phase.
Behavior
With an existing app and an invalid server archive:
The command fails, the old app files remain unchanged, and no temporary staging directory is left behind.
With a valid archive, the destination is still replaced rather than merged: files removed upstream do not remain locally, while the complete new app and
.langsmith/app.jsonare installed together.Tests
Added regression coverage for:
--forcereplacement still removes stale filesThe existing lower-level extraction tests continue to cover path validation, symlink skipping, non-gzip bodies, and push-to-pull archive round trips.
Local verification:
apps pullregression testsgo test ./...go test -race ./...go vet ./...make buildgit diff --checkmake lintwas not available locally becausegolangci-lintis not installed.