Skip to content

Fix/pilot stdout and test isolation#299

Merged
v0lkan merged 2 commits into
mainfrom
fix/pilot-stdout-and-test-isolation
Jul 17, 2026
Merged

Fix/pilot stdout and test isolation#299
v0lkan merged 2 commits into
mainfrom
fix/pilot-stdout-and-test-isolation

Conversation

@v0lkan

@v0lkan v0lkan commented Jul 17, 2026

Copy link
Copy Markdown
Member

No description provided.

v0lkan added 2 commits July 16, 2026 22:17
Cobra's Print family writes to OutOrStderr, and the root command never
set an output writer, so every piece of normal output, secret values
included, went to stderr. Shell redirection silently misbehaved:
`spike secret get db/creds > creds.txt` produced an empty file while
the secret splashed onto the terminal, and piping data into another
tool required merging the streams first.

Set the root command's output writer to stdout; subcommands inherit it.
The PrintErr family keeps writing to stderr, so errors remain
separable from data, which is what shell users and scripts expect. The
bare-metal harness scripts already capture both streams (2>&1), so
their behavior does not change.

Spec: TBD
Signed-off-by: Volkan Özçelik <volkan.ozcelik@broadcom.com>
The sqlite-backed tests in state/base, state/persist, and
backend/sqlite/persist operated on the real ~/.spike/data/spike.db and
deleted it as part of their setup, which destroyed the database out
from under a live bare-metal dev environment whenever `make test` ran
alongside one. It bit three gate runs this week.

fs.NexusDataFolder memoizes its result with sync.Once, so a per-test
t.Setenv cannot redirect it once the first test has resolved the path.
Instead, each affected package now sets SPIKE_NEXUS_DATA_DIR to a
per-run temporary directory in TestMain, before anything resolves the
folder, and removes the directory afterward. A full run of the three
packages leaves ~/.spike untouched, and the temp-dir removal also
cleans up the spike_test_*.db files the suite used to leave behind.

TASKS.md: closes this task and the Pilot stdout task delivered by the
previous commit.

Spec: TBD
Signed-off-by: Volkan Özçelik <volkan.ozcelik@broadcom.com>
@v0lkan v0lkan self-assigned this Jul 17, 2026
@v0lkan
v0lkan merged commit 67c88f4 into main Jul 17, 2026
14 checks passed
@v0lkan
v0lkan deleted the fix/pilot-stdout-and-test-isolation branch July 17, 2026 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant