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: StringThe feature.
branch: Stringspeccoder/<feature>.
original: OriginalWhere the person was.
checkout: PathBufThe checkout (the repository’s root).
project: PathBufThe project root inside it.
tip: StringThe 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: u32The running process.
started_at: u64Seconds 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.
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: StringThe 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
impl Session
Sourcepub fn save(&self, plane_dir: &Path) -> Result<(), String>
pub fn save(&self, plane_dir: &Path) -> Result<(), String>
Writes the record (temporary file, then rename).
Sourcepub fn begin(
project: &Path,
plane_dir: &Path,
feature: &str,
policy: &Policy,
) -> Result<Self, InPlaceError>
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>.
Sourcepub fn check(&self, policy: &Policy) -> Result<(), InPlaceError>
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.
Sourcepub fn check_before_tick(&self, policy: &Policy) -> Result<(), InPlaceError>
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.
Sourcepub fn accept(
&mut self,
plane_dir: &Path,
file: &Path,
before: &[u8],
accept: impl Fn(&[u8], &[u8]) -> bool,
) -> Result<(), InPlaceError>
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§impl Session
impl Session
Sourcepub fn reconcile(
&mut self,
plane_dir: &Path,
tasks_file: &Path,
tasks: &ParsedTasks,
tick: impl Fn(&Path, &str, &str) -> Result<(), String>,
) -> Vec<String>
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
impl Session
Sourcepub 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
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
impl Session
Sourcepub fn commit_round(
&mut self,
plane_dir: &Path,
tasks_file: &Path,
before: &[u8],
message: &str,
intent_digest: &str,
) -> Result<String, String>
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.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Session
impl<'de> Deserialize<'de> for Session
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 Session
impl StructuralPartialEq for Session
Auto Trait Implementations§
impl Freeze for Session
impl RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnsafeUnpin for Session
impl UnwindSafe for Session
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.