Repository navigation
Conversation
…s a blank API key The concurrent tfstate execs failed now and then with "an API key needs MESHSTACK_API_KEY and MESHSTACK_API_SECRET together". Each start blanked the key and set it again a moment later, while the execs started before it were already reading their settings. Before: 2 of 49 runs of the concurrent subtest failed this way in meshfed-release CI since 2026-10-07 (jobs 115331305948 and 115838981323). A throwaway test that started 4 commands at once through start(), against internal/testutil/fakemeshstack, 2000 times, saw 1291 of 8000 commands read a blank API key or secret, and 274 a blank MESHSTACK_WORKSPACE. With an os.CopyFS before each start, as the subtest does, the counts were 1454 and 560. After: the same test saw 0 of 8000 commands read a blank value in both variants, and the whole TestAccTfstate passes against the local stack. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nroi
force-pushed
the
fix/testacc-set-env-once
branch
from
October 14, 2026 13:16
61de60f to
264d5f4
Compare
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.
The acceptance suite's
environ()now holds each name once with its last value, so the concurrent tfstate execs no longer read a blankMESHSTACK_API_KEYwhile a laterstartsets up its environment.How flaky it was, and how I measured it
os.CopyFSbefore eachstartas in the subtestMESHSTACK_WORKSPACE(the CLI then answers 404)TestAccTfstateagainst the local stackThe race detector stays silent here: every
os.Getenvandos.Setenvtakes the environment lock, and only the sequence of twoSetenvcalls on one name is not atomic.The throwaway test (not committed)
Put it in
cmd/internal/testacc/and rungo test ./cmd/internal/testacc/ -run TestEnvRaceRepro -vwithoutMESHSTACK_CLI_TEST_ACC. It needs no local stack.🤖 Generated with Claude Code