Skip to main content

EffectCtx

Struct EffectCtx 

Source
pub struct EffectCtx<'a> {
    pub runner: &'a dyn CommandRunner,
    pub clock: &'a dyn Clock,
    pub registry: &'a dyn RegistryQuery,
    pub repo_root: &'a Path,
    pub artifacts: &'a ReleaseArtifacts,
}
Expand description

The injected effect context every ReleaseAdapter method operates through.

Bundles the ADR-0001 ports an adapter is allowed to reach plus the repository root used as the working directory for every command. Holding only trait references keeps adapters testable with recording fakes and away from the real network or clock.

One scoped exception: the homebrew adapter writes the generated .rb directly with std::fs (a formula is a committed file; there is no “add a formula” CLI to route through CommandRunner) — the first-formula create (create-new / O_EXCL semantics) and the tap-write bump (truncating an existing regular file the path first verified via symlink_metadata, never following a symlink or creating). Both writes are confined to a private, unpredictable scratch checkout the path just cloned, and they are the sole direct-fs effects in the layer. A general filesystem port on this context is the cleaner long-term home (tracked as issue homebrew-adapter-fs-port); until then the exception is deliberate and local.

Fields§

§runner: &'a dyn CommandRunner

Runs external commands (package-manager / registry CLIs). The single seam an adapter shells out through.

§clock: &'a dyn Clock

Supplies publish timestamps for PublishReceipt as journaled facts.

§registry: &'a dyn RegistryQuery

Read-only registry lookups backing verify’s remote reconcile.

§repo_root: &'a Path

Repository root — the working directory every command runs in.

§artifacts: &'a ReleaseArtifacts

The concrete release artifacts threaded from build-all into publish-all (ADR-0002 §2) — the asset upload set and the source tarball a distribution adapter repackages. EMPTY_ARTIFACTS during the re-runnable dry-run / build phases (the artifacts are not yet known) and for every non-publish caller; the coordinator swaps in the computed value for the publish phase (via EffectCtx::with_artifacts) so a publish body can read it without re-deriving it.

Implementations§

Source§

impl<'a> EffectCtx<'a>

Source

pub fn with_artifacts(&self, artifacts: &'a ReleaseArtifacts) -> EffectCtx<'a>

The same effect context with artifacts swapped in — how the coordinator hands the computed release artifacts to the publish phase without manually re-threading every port (a new port added to EffectCtx is carried here automatically via the ..*self update).

Source

pub fn with_repo_root<'b>(&self, repo_root: &'b Path) -> EffectCtx<'b>
where 'a: 'b,

The same effect context with repo_root swapped in — how the coordinator makes every adapter effect run against a clean checkout of the sealed commit instead of the live working tree, without cd-ing globally or re-threading every port. Each port reference is a &'a, so it is freely re-borrowed for the shorter lifetime 'b of the (temporary) checkout path ('a: 'b).

This is the single seam behind the reproducible-cut guarantee (release-cut-clean-checkout): all dry_run / build / publish / dist commands run in the swapped-in root, so a mid-cut edit of the operator’s live tree can never change what is published. Cannot reuse the ..*self struct update with_artifacts uses — that would tie the result to 'a, but the checkout path outlives only the enclosing call.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for EffectCtx<'a>

§

impl<'a> !Send for EffectCtx<'a>

§

impl<'a> !Sync for EffectCtx<'a>

§

impl<'a> !UnwindSafe for EffectCtx<'a>

§

impl<'a> Freeze for EffectCtx<'a>

§

impl<'a> Unpin for EffectCtx<'a>

§

impl<'a> UnsafeUnpin for EffectCtx<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.