Skip to content

Fix dry-run to look up mapping files by secret ID, not name#28

Merged
jdoss merged 1 commit intomasterfrom
fix/dry-run-secret-id-lookup
Apr 10, 2026
Merged

Fix dry-run to look up mapping files by secret ID, not name#28
jdoss merged 1 commit intomasterfrom
fix/dry-run-secret-id-lookup

Conversation

@jdoss
Copy link
Copy Markdown
Contributor

@jdoss jdoss commented Apr 10, 2026

Summary

Podman's shell driver stores mapping files at state_dir/{SECRET_ID} (hex identifier), not state_dir/{name}. The dry-run classification was checking state_dir/{name}, which never matched — every secret was reported as orphaned even when mapping files existed on disk.

Discovered when running psi setup --dry-run on a test server: 519 mapping files existed but all 514 shell-driver secrets were classified as orphaned.

Fix: read the ID field from the Podman API response and use it for the state_dir lookup.

Test plan

  • pytest tests/test_dry_run_setup.py — all tests updated to use secret_id for mapping file names.
  • ruff check / ruff format --check / ty check — clean.
  • Manual verification on test server after deploy.

Podman's shell driver stores mapping files at state_dir/{SECRET_ID}
where SECRET_ID is the hex identifier, not the human-readable name.
The dry-run classification was checking state_dir/{name} which never
matched, causing every secret to be reported as orphaned even when
mapping files existed.

Discovered when running psi setup --dry-run on a production host:
519 mapping files existed on disk but all 514 shell-driver secrets
were classified as orphaned because the filename is a hex ID like
00e33d7a267c46aea501654b0, not atuin--ATUIN_DB_URI.

Read the ID field from the Podman API response and use it for the
state_dir lookup.
@jdoss jdoss merged commit 0a8a453 into master Apr 10, 2026
2 checks passed
jdoss added a commit that referenced this pull request Apr 16, 2026
Setup populated the encrypted cache with keys like
"atuin--POSTGRES_PASSWORD" but the serve lookup path receives the
Podman hex secret ID in $SECRET_ID (e.g. "40ba10c50224daba166308fbc").
The cache.get() call in serve never matched, so the cache never served
a single hit — every lookup always went to the live provider.

This is the same class of bug as the dry-run fix in PR #28: Podman
identifies secrets by hex ID internally, not by human-readable name.

The cache exists specifically to serve secrets when the upstream
provider is down. In its first real-world test (Infisical down during
a container restart cascade), it failed silently — every Infisical-
backed lookup returned a provider error instead of the cached value.

Fix: _register_secrets now returns a {key: hex_id} map from the Podman
API's create response. The caller uses hex IDs as cache keys so
serve's cache.get(secret_id) finds the right entry.
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