Skip to content

Fix deinit + init loop ergonomics (idempotency, madder-store isolation) #263

@sfriedenberg-etsy

Description

@sfriedenberg-etsy

Observed (init not idempotent against partial leftovers)

During a store recreate, after manually clearing the dodder store, der init -blob_store-id default etsy failed in sequence on residual files, each requiring a separate manual rm -rf:

  1. ~/.local/share/madder/blob_stores/default/blob_store-config: file exists — plain der init etsy with no -blob_store-id tried to create the default store config that already existed → CreateExclusiveWriteOnly failure.
  2. ~/.local/share/dodder/inventory_lists_log: file exists
  3. ~/.config/dodder/config-mutable already exists, not overwritinginvalid argument

Only after rm -rf ~/.local/share/dodder and rm -rf ~/.config/dodder did init succeed.

Requirements / fixes

  1. deinit MUST NOT touch the madder blob store at all. The madder default store (~/.local/share/madder/blob_stores/default) holds blob bodies that must survive a dodder repo recreate. Verify deinit's GetXDGPaths() (internal/uniform/commands_dodder/deinit.go:90) does not include the madder namespace — it lives in a sibling ~/.local/share/madder/ dir, so it likely already is excluded — confirm and add a regression test pinning that deinit leaves the madder store intact.
  2. der init with no -blob_store-id should gracefully reuse a pre-existing default blob-store config instead of failing with blob_store-config: file exists. writeBlobStoreConfigIfNecessary already early-returns when the path exists (internal/foxtrot/env_repo/genesis.go:187-196) for the default path — but the plain init etsy path still errored, so the exclusive-create is happening somewhere else. Trace and make it idempotent/skip-if-exists.
  3. init should fail cleanly OR be idempotent against leftover dodder XDG files (inventory_lists_log, config-mutable). Right now a partially-present store yields cryptic per-file file exists / invalid argument errors across multiple runs. Either (a) detect an existing repo and refuse with one clear "repo already initialized, run deinit first" message, or (b) make init idempotent.

Context

Surfaced while recreating a v14 store to work around the tommy-strict konfig decode bug (#259). The recreate flow was: rm dodder store (keep madder), init -blob_store-id default, import full-history export.

Verify

BATS in the nix sandbox (deterministic): partial-leftover init scenarios + a deinit-preserves-madder-store assertion.


:clown: filed by Clown (0.4.0+cd38c2d) — built from cd38c2d

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions