Skip to content

Rename/restrict GetDefaultBlobStore() to force explicit read/write intent #355

Description

@friedenberg

Context

Follow-up to dodder#352, which fixed 17 confirmed content-addressed-read call sites pinned to the single-store env_repo.Env.GetDefaultBlobStore() instead of the multi-store-fallback GetReadBlobStore(). That pass deliberately left local_working_copy.Repo.GetBlobStore() (a thin wrapper around GetDefaultBlobStore()) untouched, since it has at least one legitimate write caller and several other callers whose intent wasn't traced. This issue now also covers auditing and resolving that wrapper's callers, not just the rename.

Structural finding (blocks a simple fix)

GetBlobStore() is part of the repo.Repo interface contract
(go/internal/papa/repo/main.go:23):

type Repo interface {
    ...
    GetBlobStore() blob_stores.BlobStoreInitialized
    ...
}

The return type is the concrete struct blob_stores.BlobStoreInitialized (which carries .Path/.Config fields), not the mad_domain_interfaces.BlobStore interface GetReadBlobStore() returns. This means the #352-style fix — swap the accessor call — does not work here. local_working_copy.Repo.GetBlobStore() cannot simply return GetReadBlobStore()'s value; the interface contract requires the struct shape. A real fix needs either:

  1. Wrap the multi-store Multi inside a BlobStoreInitialized-shaped value (its .Path/.Config presumably describing the default store while its embedded blob-store behavior routes through Multi) — requires understanding madder's BlobStoreInitialized struct definition, which isn't in this repo (amarbel-llc/madder module) or cached locally; needs a source read from that repo.
  2. Change the repo.Repo interface's GetBlobStore() signature to return mad_domain_interfaces.BlobStore instead — larger blast radius, touches both known implementations (local_working_copy.Repo, remote_http.client — see below) and every caller that currently relies on .Path/.Config.

Two implementations found, only one is ambiguous

Since GetBlobStore() is called through the repo.Repo interface at most call sites, the same line of code can resolve to either implementation depending on the concrete type passed at runtime. Only call sites where the concrete type is (or can be) local_working_copy.Repo are in scope.

Callers traced so far — READ candidates (not yet fixed, blocked on the structural issue above)

  • go/internal/uniform/commands_dodder/diff.go:104localWorkingCopy.GetBlobStore() fed into object_metadata_fmt_hyphence.Factory.BlobStore for MakeFormatterFamily()'s InlineBlob read path — the exact pattern already fixed in typed_blob_store/text_formatter.go by Audit GetDefaultBlobStore() read call sites; inventory_list_store.Store.blobBlobStore bypasses FDR-0015 multi-store fallback #352.
  • go/internal/romeo/local_working_copy/local_op_pull.go:45remote.GetBlobStore() passed to store.MakeEdgeExplorer(...), used for reference/presence checks while expanding the pull's edge closure.
  • go/internal/sierra/remote_proto/transfer.go:81src.GetBlobStore(), same MakeEdgeExplorer pattern, drtp transport's sender side (sendClosure, used by both fetch-serve and push-send — src is always the local/sending repo per the package's own doc comments).
  • go/internal/uniform/commands_dodder/init_workspace.go:479remoteBlobStore := remote.GetBlobStore(), later calls .MakeBlobReader(blobDigest) directly (line 510) to dereference inventory-list blob contents during workspace init.
  • go/internal/sierra/remote_http/client.go:326remote.GetBlobStore() passed into client.WriteBlobToRemote(localBlobStore, ...), whose first parameter is read (.MakeBlobReader) to stream content the peer requested — despite the local variable being named remote, this reads the local side's own blob content.
  • go/internal/uniform/commands_dodder/clone.go:222,394remote.GetBlobStore() / source.GetBlobStore() used as src in CopyBlobIfNecessary, same class as the above (reading the source repo's own blobs during a copy).

Confirmed correct as-is (config-only, not a content read)

Ask

  1. Read blob_stores.BlobStoreInitialized's definition in amarbel-llc/madder to determine whether option 1 above (wrap Multi in a BlobStoreInitialized-shaped value) is viable.
  2. Decide between option 1 and option 2 (interface signature change) — or some third approach.
  3. Once unblocked, migrate the confirmed READ candidates above.
  4. Fold in the original rename/restrict-GetDefaultBlobStore() ask from this issue's first draft.

:clown: Updated by Clown 0.3.19+f1e3833 (build).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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