Skip to main content

Session

Struct Session 

Source
pub struct Session {
    pub feature: String,
    pub branch: String,
    pub original: Original,
    pub checkout: PathBuf,
    pub project: PathBuf,
    pub tip: String,
    pub manifest: BTreeMap<String, String>,
    pub pid: u32,
    pub started_at: u64,
    pub notes: Vec<String>,
    pub hidden: Vec<String>,
    pub git: String,
}
Expand description

An in-place run in progress: written before the checkout is switched, removed after it is switched back.

Fields§

§feature: String

The feature.

§branch: String

speccoder/<feature>.

§original: Original

Where the person was.

§checkout: PathBuf

The checkout (the repository’s root).

§project: PathBuf

The project root inside it.

§tip: String

The branch’s tip as speccoder last left it.

§manifest: BTreeMap<String, String>

Intent, judge and context files by hash, as the run expects them.

§pid: u32

The running process.

§started_at: u64

Seconds since the epoch.

§notes: Vec<String>

What starting this run did on its own (a resume, work set aside, a tick restored): told with the outcome, never recorded.

§hidden: Vec<String>

What git ignored when the session began (directories end in /): hidden from the model’s file tools, as a worktree would not hold it.

§git: String

The repository’s configuration, hooks, info/ and refs (other than the session’s branch) by hash: nothing a run does may change them.

Implementations§

Source§

impl Session

Source

pub fn path(plane_dir: &Path) -> PathBuf

The record’s path in a project’s state directory.

Source

pub fn load(plane_dir: &Path) -> Option<Self>

The record, if a session exists.

Source

pub fn save(&self, plane_dir: &Path) -> Result<(), String>

Writes the record (temporary file, then rename).

Source

pub fn is_live(&self) -> bool

Whether the process that owns it is running.

Source

pub fn begin( project: &Path, plane_dir: &Path, feature: &str, policy: &Policy, ) -> Result<Self, InPlaceError>

Checks the preconditions, records the session, and switches the checkout to speccoder/<feature>.

Source

pub fn check(&self, policy: &Policy) -> Result<(), InPlaceError>

The checkout guard and the manifest, before every task: HEAD where speccoder left it, nothing changed, the protected files as recorded.

Source

pub fn check_before_tick(&self, policy: &Policy) -> Result<(), InPlaceError>

Session::check before a tick: the attempt’s own writes are in the checkout then, so only HEAD and the protected files are compared.

Source

pub fn advance(&mut self, plane_dir: &Path)

After a speccoder commit: the new tip.

Source

pub fn accept( &mut self, plane_dir: &Path, file: &Path, before: &[u8], accept: impl Fn(&[u8], &[u8]) -> bool, ) -> Result<(), InPlaceError>

After the engine’s tick or append of file (absolute): the manifest takes its new hash — only when the change is exactly that (accept says what the bytes before and after may be).

Source

pub fn finish(&self, plane_dir: &Path) -> Result<(), InPlaceError>

Switches the checkout back to where the person was, when it is as speccoder left it; removes the record after.

Source§

impl Session

Source

pub fn reconcile( &mut self, plane_dir: &Path, tasks_file: &Path, tasks: &ParsedTasks, tick: impl Fn(&Path, &str, &str) -> Result<(), String>, ) -> Vec<String>

A run killed between its verdict commit and the local tick: each open task whose newest commit names its line exactly (Task-Line) is ticked now, the manifest accepting it. Returns what was ticked.

Source§

impl Session

Source

pub fn commit_and_tick( &mut self, plane_dir: &Path, tasks_file: &Path, line_hash: &str, message: &str, intent_digest: &str, tick: impl Fn() -> Result<(), String>, ) -> Committed

Commits a passed (or attested) task and ticks it. The evidence comes first: a tasks_file git ignores is never in a commit, so the commit names the tick as local (Tick: local), and the tick follows it. A tracked one is ticked and committed together, as in a worktree. Every commit says it was made in place, against which intent (intent_digest) and which task line (line_hash, before the tick).

Source§

impl Session

Source

pub fn commit_round( &mut self, plane_dir: &Path, tasks_file: &Path, before: &[u8], message: &str, intent_digest: &str, ) -> Result<String, String>

Commits a convergence round in place: the append to tasks_file (old bytes an exact prefix of the new) is accepted into the manifest, and the commit says it was made in place, against which intent; a git-ignored task list is not in it, so the commit may be empty.

Source

pub fn confine( &self, policy: Policy, runner: Runner, ) -> (Policy, Runner, Option<String>)

The model’s view of this checkout: the policy denies git that moves it and hides what git ignored; the sandbox keeps .git read-only and the ignored secrets unreadable.

Source§

impl Session

Source

pub fn mode_line(&self) -> String

in-place · speccoder/<f> in <checkout> (returns to <original>).

Trait Implementations§

Source§

impl Clone for Session

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 Session

Source§

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

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

impl<'de> Deserialize<'de> for Session

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 Eq for Session

Source§

impl PartialEq for Session

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Session

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
Source§

impl StructuralPartialEq for Session

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more