Skip to main content

HostState

Struct HostState 

Source
pub struct HostState {
Show 30 fields pub version: u32, pub authenticated_user: String, pub changes: Vec<ChangeRequest>, pub heads: BTreeMap<ChangeId, String>, pub titles: BTreeMap<ChangeId, String>, pub bodies: BTreeMap<ChangeId, String>, pub checks: BTreeMap<ChangeId, Vec<Check>>, pub check_logs: BTreeMap<ChangeId, BTreeMap<String, String>>, pub drafts: BTreeMap<ChangeId, DraftReason>, pub made_ready: Vec<ChangeId>, pub awaiting_checks: BTreeSet<ChangeId>, pub checks_after_lift: BTreeMap<ChangeId, Vec<Check>>, pub required_checks: Option<RequiredChecks>, pub described: Vec<Described>, pub check_sources: Option<BTreeSet<CheckSource>>, pub merges: BTreeMap<ChangeId, MergeOutcome>, pub merge_times: BTreeMap<ChangeId, String>, pub review_comments: BTreeMap<ChangeId, Vec<HostComment>>, pub replies: Vec<Replied>, pub review_charges: Vec<ReadCost>, pub closed: BTreeSet<ChangeId>, pub deleted_branches: BTreeSet<String>, pub head_checks: BTreeMap<Sha, Vec<Check>>, pub ledger: Vec<HostCall>, pub up_to_date_required: bool, pub allow_auto_merge: bool, pub armed: BTreeSet<ChangeId>, pub check_readings: BTreeMap<ChangeId, Vec<Vec<Check>>>, pub check_readings_after_lift: BTreeMap<ChangeId, Vec<Vec<Check>>>, pub head_activity: BTreeMap<ChangeId, Vec<ActivityAnswer>>,
}
Expand description

Everything the remote-host side of a run knows about itself.

Omitted-when-empty and versioned for the same reasons VcsState is.

Fields§

§version: u32

The schema version this state was written at. A document that names none is the one this build writes.

§authenticated_user: String

Who the host says is calling. Empty is refused, exactly as a gh that reports no authenticated user is.

§changes: Vec<ChangeRequest>

Every change request that has been opened or seeded.

§heads: BTreeMap<ChangeId, String>

The head branch each change request was opened from.

Beyond the sketch, and unavoidable: ChangeRequest records only the base it targets, and find_changes matches on the head as well.

§titles: BTreeMap<ChangeId, String>

The title each change request was opened under.

Beyond the sketch, and for the same reason heads is: ChangeRequest records neither, and the title is what a publication’s commit subject becomes — so a journey asserting that the subject it asked for is the one the host was given has nowhere else to read it.

§bodies: BTreeMap<ChangeId, String>

The body each change request was opened with, for the change requests that were opened with one.

Beside titles and for its reason: the body is what a caller passes on the PublishRequest and nothing else records it, so a journey asserting that the body it drafted is the one the host was given has nowhere else to read it. A change request with no entry was opened with no body at all, which is what a publication nobody gave one does — the two are different scenarios, and an empty string is the first rather than the second.

§checks: BTreeMap<ChangeId, Vec<Check>>

The checks the host reports on each change request. A change with no entry has no checks, which is what a repository with no CI reports.

§check_logs: BTreeMap<ChangeId, BTreeMap<String, String>>

The log the host hands over for a check, keyed by change request and then by check name. Beyond the sketch: check_log is one of the six methods, and without this the only log a journey could asssert on is a synthesized one.

§drafts: BTreeMap<ChangeId, DraftReason>

The reason each change request that was opened as a draft was drafted with, for the change requests that were.

Beside bodies and for its reason: the reason is what a caller passes on the PublishRequest and this is where a journey reads back that the host was given it. A change with no entry is not a draft, which is what every change request opened without one is.

Nothing is refused about the reason itself here. Its shape — that every field of it renders as the one line it is printed on — is onevcs’s own rule, and it is applied where a publication takes one in, before any host is asked.

§made_ready: Vec<ChangeId>

Every ready_for_review call this host has taken, in the order it took them — the lifts it was asked to perform, never a request for a reviewer.

A list rather than a set, and beyond the sketch for a reason a set could not serve: lifting a draft is required to be idempotent, so what a journey asserts is that a second publication asked the host for nothing — and only a record of the calls themselves can say that. A change named here is not a draft any more, whatever drafts says it was opened as.

§awaiting_checks: BTreeSet<ChangeId>

The change requests opened as a draft while their required checks run — the lifecycle’s draft, which no caller gave a reason for and so is not in drafts. A change named here is a draft until made_ready names it.

§checks_after_lift: BTreeMap<ChangeId, Vec<Check>>

The checks the host reports on a change request once it has been lifted out of its draft, in place of checks.

What a repository whose workflow skips drafts looks like from outside: the draft’s checks are skipped or absent, and the run the lift triggers registers after it. A change with no entry reports the same checks either side of a lift.

A publication tells the run a lift triggered from the draft’s by the run’s own identity, as it would on a real host: a check named here that the draft also reported is a new run — running or settled — only where its started_at is one no draft-era run of that check reported. So seed a re-run with a start of its own — an entry repeating the draft’s start, or reporting none, is the draft’s run still standing.

§required_checks: Option<RequiredChecks>

What this host answers when asked which checks a merge into a base requires.

Unset is a host whose branch protection names exactly the checks it was seeded as required, on any change request — a complete answer, and an empty one where none is seeded required. Seeded, it is the answer for every base: an empty complete one is a repository declaring no required check, and one naming an unconsulted source is the incomplete answer a narrower credential gets.

§described: Vec<Described>

Every describe_change call this host has taken, in the order it took them: which change request, the title it was handed when it was handed one, and the body.

The calls themselves, for the reason made_ready is: what a journey asks is what a closeout wrote, call by call, and the current title and body — which each call also writes into titles and bodies, so change_description answers from the same record open_change wrote — can only say where the description ended up.

§check_sources: Option<BTreeSet<CheckSource>>

Which sources this host answers about its checks from, which is what the real implementation reports alongside them.

Unset is a credential allowed to read everything: the whole rollup, exactly what a host with nothing to hide reports. A journey states a narrower set to be the credential the real one meets in CI — a fine-grained token, which cannot read check runs at all and sees GitHub Actions and nothing else — and states an empty one to be a credential that can read no source at all, which is a refusal rather than “no checks”. Unset and empty are therefore different scenarios, which is why this is an Option rather than a set whose emptiness means “not stated”.

§merges: BTreeMap<ChangeId, MergeOutcome>

What merging each change request did.

Both a script and a record: an entry seeded here is what merge answers, whatever the policy asks for — which is how a journey expresses a host that queues or refuses — and a merge the policy decided is written back here.

§merge_times: BTreeMap<ChangeId, String>

When each merged change request reached its base, as this host spells the moment — what merge_time answers.

Written beside merges whenever this host performs a merge, at the moment it performs it, and seedable for a merge a journey seeded: a host that merged on its own clock, earlier than anybody asked, is exactly what a late merge’s record must report the time of. A merged change with no entry is one whose time this host cannot say.

§review_comments: BTreeMap<ChangeId, Vec<HostComment>>

Each change request’s review feedback — review-thread comments, review summaries and conversation comments — in the order it was posted.

Both a script and a record: what a journey seeds here is what review_comments reads, Host::add_comment, Host::edit_comment and Host::set_thread move it as a reviewer would, and every reply reply_to_comment posts is written back here beside them.

§replies: Vec<Replied>

Every reply this host posted, in the order it posted them.

The calls themselves, for the reason described is: what a journey about idempotency asks is how many replies were posted, and the comments a read returns can only say what is there now.

§review_charges: Vec<ReadCost>

What this host charges for each read of review feedback, one entry a read, in order; a read with none left is charged the one GraphQL point a page that spike-review-loop measured, and no REST request.

§closed: BTreeSet<ChangeId>

The change requests closed without merging — by a person on the host, or because the branch they target was deleted from under them.

§deleted_branches: BTreeSet<String>

The branches gone from the origin: a merged change request’s head a person deleted. A closed change request targeting one reads base_deleted, and nothing is retargeted onto one.

§head_checks: BTreeMap<Sha, Vec<Check>>

Each check’s state on one head commit, in place of the change request’s own checks: what a host reports for a head pushed since, and how a journey gives each change request of a stack its own verdict.

§ledger: Vec<HostCall>

Every host call this host answered, in the order it answered them: the method, the change requests it names and what GitHub charges the call the real host sends — which is what a consumer sums over a whole review round.

§up_to_date_required: bool

Whether this host requires a branch to be up to date with its base before it merges one into it — GitHub branch protection’s strict — which is what requires_up_to_date answers. Unset is a host that requires it of no branch.

§allow_auto_merge: bool

Whether the repository lets a change request be armed to merge itself once its required checks pass — GitHub’s allow_auto_merge — which is what allows_auto_merge answers. Unset is a repository that allows it, so a publication whose watch elapses arms the merge; false is one that does not, so it is left as the elapsed watch left it. Only false is written, so allowed has the one spelling.

§armed: BTreeSet<ChangeId>

The change requests whose own merge is armed — by a change-auto publication, or by one whose watch elapsed with no required check red. The host lands one the moment its required checks are green, whoever asks next: a publication watching it, or one asking for its merge again.

§check_readings: BTreeMap<ChangeId, Vec<Vec<Check>>>

The checks each reading of a change request reports, in turn: the first change_checks call about it answers the first entry, the second the second, and the last entry answers every call after it — so a journey scripts each poll of a watch rather than racing a clock. Seeded, it stands in for that change request’s checks, and for its checks_after_lift unless check_readings_after_lift scripts the lift’s side; a merge is judged on the entry the latest reading answered.

§check_readings_after_lift: BTreeMap<ChangeId, Vec<Vec<Check>>>

The same script for the readings after a change request is lifted, counted from its lift: the first change_checks call after ready_for_review answers the first entry. A lift happens on a clock — the grace window — so the readings on each side of it are scripted apart, and neither has to guess on which poll it came.

§head_activity: BTreeMap<ChangeId, Vec<ActivityAnswer>>

What head_activity answers about a change request, in turn: one answer per call, and the last answering every call after it. A change request with none answers, completely, that nothing is running on the commit it was asked about — a host whose checks are the whole of what runs, which is what every journey written before this answer existed describes.

Trait Implementations§

Source§

impl Checked for HostState

A seeded host side is refused if it holds a change nothing could address.

Source§

fn carry_forward(&mut self)

A version 2 document held no bodies, and a version 5 document’s checks named no commit; each reads as what it was — change requests opened with none, and checks whose head that build never recorded. There is nothing to fill in — an absent field is already that answer, and a check’s commit is the one thing that must never be inferred — so this is the version and nothing else. The one carry a version 8 document needs, the kind its draft reasons lack, is done where those are read (drafts_of_any_version), because it is a fact about one value’s shape rather than about the document.

Source§

fn check(&self) -> Result<()>

Refuse this state, naming what is wrong with it.
Source§

impl Clone for HostState

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HostState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for HostState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for HostState

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for HostState

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.