fix(config,bundle): empty env vars + atomic bundle re-commit#8
Open
SahilRakhaiya05 wants to merge 2 commits into
Open
fix(config,bundle): empty env vars + atomic bundle re-commit#8SahilRakhaiya05 wants to merge 2 commits into
SahilRakhaiya05 wants to merge 2 commits into
Conversation
Empty or whitespace-only TESTSPRITE_API_URL / TESTSPRITE_API_KEY values (e.g. export TESTSPRITE_API_URL= in a shell profile) no longer short-circuit the resolution chain. Runtime commands now fall through to the credentials file and prod default, matching auth configure behavior. Also normalize the auth whoami dry-run endpoint resolution path.
Replace in-place commitBundle file renames with a directory-level atomic swap. The complete staging tree is moved aside, the prior bundle is only deleted after a successful rename, and failed swaps roll back to the previous meta.json and steps/ contents. Adds commitBundle regression test in bundle.commit.test.ts.
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
1. Empty env vars treated as unset (loadConfig)
When
TESTSPRITE_API_URLorTESTSPRITE_API_KEYis set but empty/whitespace (e.g.export TESTSPRITE_API_URL=in a shell profile), runtime commands no longer resolve to a broken empty endpoint or ignore stored credentials. Matches the normalization already used inauth configure.2. Bundle re-commit preserves prior complete bundle (commitBundle)
Re-running
test failure get --out <dir>used to deletemeta.jsonand wipesteps/before the new bundle landed. A failed mid-commit (expired presigned URL, disk error, etc.) left the directory with no usable bundle.Fix: Build the complete bundle in
<dir>/.tmp/, then atomically swap via directory rename. The prior bundle is moved aside and only deleted after success; failed swaps roll back.Testing
npx vitest run src/lib/config.test.ts- 11 passednpx vitest run src/lib/bundle.commit.test.ts- rollback regressionnpx vitest run src/commands/test.test.ts -t runFailureGet- 13 passednpm run typecheckandnpm run lint- passFiles changed:
src/lib/config.ts,src/lib/config.test.ts,src/commands/auth.tssrc/lib/bundle.ts,src/lib/bundle.commit.test.ts