pub struct SetupState {Show 15 fields
pub schema_version: u32,
pub steps: BTreeMap<SetupStep, StepEntry>,
pub constitution_choice: ConstitutionChoice,
pub constitution_checkpoint_completed_for: Option<String>,
pub constitution_language: Option<String>,
pub constitution_source: ConstitutionSource,
pub constitution_validity: ConstitutionValidity,
pub constitution_authoring: Option<ConstitutionAuthoring>,
pub constitution_preview_hash: Option<String>,
pub constitution_preview_version: u32,
pub runtime_posture_source: RuntimePostureSource,
pub operate_receipts_verified: bool,
pub inherited: bool,
pub telemetry_notice_decided_for: Option<String>,
pub telemetry_opt_in: bool,
}Expand description
The persisted, per-version setup-state record.
Fields§
§schema_version: u32§steps: BTreeMap<SetupStep, StepEntry>Per-step status entries.
constitution_choice: ConstitutionChoiceThe user’s constitution decision.
constitution_checkpoint_completed_for: Option<String>Lane version (e.g. "0.8.67") whose constitution checkpoint the user has
completed. Drives the once-per-version update checkpoint (#3794).
constitution_language: Option<String>Language the constitution prose was authored/reviewed in.
constitution_source: ConstitutionSourceWhich surface is the active user-global law.
constitution_validity: ConstitutionValidityValidity of the active user-global constitution file.
How the active custom constitution was authored (guided deterministic
vs model-drafted-then-ratified). None for bundled/deferred/inherited.
constitution_preview_hash: Option<String>Stable content hash of the most recently previewed/accepted rendered
constitution (see crate::user_constitution::UserConstitution::preview_hash).
constitution_preview_version: u32Monotonic counter bumped each time a custom constitution is saved, so the
report and /constitution can show which revision is live.
runtime_posture_source: RuntimePostureSourceWhere the current runtime posture came from.
operate_receipts_verified: boolHost-enforced Workflow dispatch and terminal receipts have been proven for this installation. Older records did not carry this proof and must deserialize false even if their Operate/Fleet card was marked Verified.
inherited: boolTrue when this record was derived from existing config rather than
persisted by an explicit setup run. Lets /setup and doctor explain
why an updating user is not treated as a broken fresh install.
telemetry_notice_decided_for: Option<String>TELEMETRY_NOTICE_VERSION whose telemetry notice the user has
answered. None means the notice is still owed.
Never auto-completed and never deferred-completed: unlike the
constitution checkpoint, which records a Deferred completion on the
skip-onboarding path, a telemetry notice that was not rendered and
answered leaves this None. Collection follows the documented default
while the notice remains owed on the next interactive launch.
These are fields rather than a new SetupStep variant on purpose:
an unknown enum variant fails the whole record parse and silently drops
the user back to derived-inherited state — including their constitution
checkpoint — while unknown fields are ignored.
telemetry_opt_in: boolThe user’s answer to the notice. false with any recorded notice
version is a durable opt-out; true records acknowledgment of that
version’s disclosure.
Implementations§
Source§impl SetupState
impl SetupState
Sourcepub fn status(&self, step: SetupStep) -> StepStatus
pub fn status(&self, step: SetupStep) -> StepStatus
Status for a step, defaulting to StepStatus::NotStarted.
Sourcepub fn set_step(&mut self, step: SetupStep, entry: StepEntry) -> &mut Self
pub fn set_step(&mut self, step: SetupStep, entry: StepEntry) -> &mut Self
Record (insert or replace) an entry for step.
Sourcepub fn first_run_ready(&self) -> bool
pub fn first_run_ready(&self) -> bool
First-run “ready”: language verified, provider/model ready-or-needs-action, runtime posture inherited/confirmed, and an explicit constitution choice.
Sourcepub fn operate_ready(&self) -> bool
pub fn operate_ready(&self) -> bool
Operate/Fleet “ready”: provider credentials are verified, runtime
posture has been reviewed, and the user has explicitly reviewed the
Fleet/Operate on-ramp. This is intentionally separate from
first_run_ready: a local-first user can be
ready for ordinary first use before enabling durable multi-worker work.
Sourcepub fn update_ready(&self, version: &str) -> bool
pub fn update_ready(&self, version: &str) -> bool
Update “ready” for version: the constitution checkpoint for that lane is
complete. Everything else is inherited from existing config.
Sourcepub fn needs_constitution_checkpoint(&self, version: &str) -> bool
pub fn needs_constitution_checkpoint(&self, version: &str) -> bool
Whether the once-per-version update checkpoint should still be shown.
Sourcepub fn complete_constitution_checkpoint(
&mut self,
version: impl Into<String>,
choice: ConstitutionChoice,
) -> &mut Self
pub fn complete_constitution_checkpoint( &mut self, version: impl Into<String>, choice: ConstitutionChoice, ) -> &mut Self
Mark the constitution checkpoint complete for version (the bundled /
default path is a valid completion).
Sourcepub fn needs_telemetry_notice(&self, version: &str) -> bool
pub fn needs_telemetry_notice(&self, version: &str) -> bool
True when the telemetry notice for version has not been answered.
A decision recorded against a different notice version does not count: the content changed, so the answer is stale and is owed again.
Sourcepub fn record_telemetry_notice(
&mut self,
version: impl Into<String>,
opt_in: bool,
) -> &mut Self
pub fn record_telemetry_notice( &mut self, version: impl Into<String>, opt_in: bool, ) -> &mut Self
Record the user’s answer to the telemetry notice for version.
Call this only from a path where the notice was actually rendered and the user actually answered. Deferral, skip-onboarding, and any non-interactive surface must leave the record untouched.
Sourcepub fn telemetry_accepted(&self, version: &str) -> bool
pub fn telemetry_accepted(&self, version: &str) -> bool
True when the user was asked the current notice and kept counting on.
Sourcepub fn telemetry_declined(&self, version: &str) -> bool
pub fn telemetry_declined(&self, version: &str) -> bool
True when the user was asked the current notice and said no.
Distinct from “never asked”: only a recorded decline is an opt-out, and only an opt-out may be acted on destructively.
Sourcepub fn telemetry_opted_out(&self) -> bool
pub fn telemetry_opted_out(&self) -> bool
Whether any recorded telemetry notice was explicitly declined.
Declines recorded by the former opt-in notice remain durable opt-outs after telemetry becomes default-on. A notice-version bump may explain a changed policy, but it must never erase a user’s earlier “no”.
Sourcepub fn derive_inherited(facts: &InheritedConfigFacts) -> Self
pub fn derive_inherited(facts: &InheritedConfigFacts) -> Self
Derive a safe inherited state for an existing user with no persisted
setup_state.json. Surfaces they already configured become
StepStatus::Verified; an update never looks like a fresh, broken
setup. The constitution checkpoint is intentionally left incomplete so
updating users still see it once.
Sourcepub fn load() -> Result<Option<Self>>
pub fn load() -> Result<Option<Self>>
Load the persisted setup-state from the home sidecar.
Returns Ok(None) when the file is missing or unreadable/corrupt, so
callers fall back to derive_inherited rather
than forcing a fresh wizard. A corrupt record is logged, never fatal.
Trait Implementations§
Source§impl Clone for SetupState
impl Clone for SetupState
Source§fn clone(&self) -> SetupState
fn clone(&self) -> SetupState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SetupState
impl Debug for SetupState
Source§impl Default for SetupState
impl Default for SetupState
Source§impl<'de> Deserialize<'de> for SetupState
impl<'de> Deserialize<'de> for SetupState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for SetupState
Source§impl PartialEq for SetupState
impl PartialEq for SetupState
Source§impl Serialize for SetupState
impl Serialize for SetupState
impl StructuralPartialEq for SetupState
Auto Trait Implementations§
impl Freeze for SetupState
impl RefUnwindSafe for SetupState
impl Send for SetupState
impl Sync for SetupState
impl Unpin for SetupState
impl UnsafeUnpin for SetupState
impl UnwindSafe for SetupState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.