Skip to content

test(e2e): seed the fixture's own master key instead of inheriting CI env - #1270

Open
rigel-mintaka wants to merge 2 commits into
mainfrom
compass-server/rig-3849-stack-podman-key
Open

rigel-mintaka wants to merge 2 commits into
mainfrom
compass-server/rig-3849-stack-podman-key

Conversation

@rigel-mintaka

Copy link
Copy Markdown
Contributor

Every podman-tagged test in cmd/compass-stack booted a compass-server with no
resolvable at-rest master key, so all nine died at boot on
resolve master key: secrets: resolve: No provider backend configured.
buildUserSecretResolver resolves the key unconditionally and fails closed by
design, so a test that boots a server must supply its own.

No production change is needed: the supervisor spawns the child with
os.Environ(), and compass-server already falls back to $COMPASS_SECRET_PROVIDER,
so a t.Setenv in the test process reaches the server. Safe here because the
package has no t.Parallel and no TestMain.

stackEnv seeds it rather than each caller, because stackEnv snapshots the
environment for the subprocess — a provider exported after that call would be
captured too late, which is exactly how the --nats-external leg stayed red.

Refs RIG-3849

Co-authored-by: Matt Wilkinson matt@rigel.build

@trunk-io

trunk-io Bot commented Sep 17, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@linear-code

linear-code Bot commented Sep 17, 2026

Copy link
Copy Markdown

RIG-3849

Every podman-tagged test in cmd/compass-stack booted a compass-server with no
resolvable at-rest master key, so all nine died at boot on
`resolve master key: secrets: resolve: No provider backend configured`.
buildUserSecretResolver resolves the key unconditionally and fails closed by
design, so a test that boots a server must supply its own.

No production change is needed: the supervisor spawns the child with
os.Environ(), and compass-server already falls back to $COMPASS_SECRET_PROVIDER,
so a t.Setenv in the test process reaches the server. Safe here because the
package has no t.Parallel and no TestMain.

stackEnv seeds it rather than each caller, because stackEnv snapshots the
environment for the subprocess — a provider exported after that call would be
captured too late, which is exactly how the --nats-external leg stayed red.

Refs RIG-3849

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@rigel-mintaka
rigel-mintaka force-pushed the compass-server/rig-3849-stack-podman-key branch from 9d35fde to 63d3021 Compare September 17, 2026 02:24
@github-actions

github-actions Bot commented Sep 17, 2026

Copy link
Copy Markdown

Compass engineering docs preview: https://compass-server-rig-3849-stac.compass-eng-docs.pages.dev

Deployed from compass-server/rig-3849-stack-podman-key at 6202ce3.

…o ambient

Review finding on the parent. The idempotence guard read os.Getenv, so it
deferred to a COMPASS_SECRET_PROVIDER already exported in the developer shell —
reinstating the ambient dependency the e2e fix removed, and worse: a real
provider would seal a throwaway test stack under a real at-rest key.

The guard was also unnecessary. t.TempDir returns a unique dir per call
(verified: .../001 vs .../002), so a second seed writes a complete, distinct
dotenv with the same key; and t.Setenv restores on cleanup, so it never fired
across sequential tests either. Its only live effect was the ambient one.

Verified with a hostile export: COMPASS_SECRET_PROVIDER=keyring:// now passes,
where the guard would have honored it and failed boot.

Also drops an invented hazard from the comment (no mechanism could leave an
empty dotenv) and records stackEnv seeding before it snapshots.

Refs RIG-3849

Co-authored-by: Matt Wilkinson <matt@rigel.build>
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