pub(crate) fn link_history_if_isolated(
paths: &DataPaths,
dir: &Path,
provider: &ProviderConfig,
entity_id: &str,
log_ctx: &str,
)Expand description
Best-effort: if provider has a linkable native history directory
(ProviderConfig::history_native_subdir, None for providers with
no fixed on-disk history to redirect) and credential isolation is
currently on, ensure dir/<subdir> is linked to the always-global
history location for entity_id (a bundle id or account id — same
namespace, see [DataPaths::identity_dir]). No-op when isolation is
off (dir is already inside the global tree, so dir/<subdir>
already IS the global location) or the provider has no linkable
subdir. Never fails the caller — logs and continues, same philosophy
as every other soft-fail in this module.
Three call sites need this identically: compute_and_ensure_bundle_dir
and compute_and_ensure_account_dir below (both auth.start-time),
and inject::inject_identity_env_with_broker’s OAuth branch (the
ordinary spawn-time path, which reads a previously stored
OAuthConfigDir and — before this shared helper existed — never
re-verified the link at all; reagentx P1 on PR #2605: an account
provisioned before this whole feature shipped, or since its last
auth.start, never got linked until this fix). One function so they
can’t drift on the condition again.