tools capa

tools-work-runner

Step-runner over Part D work items: select ready -> compile context at run time -> invoke the allowlisted worker -> typed done-probe decides -> record actuals -> advance status. The model gets navigated; it never navigates.

Step-runner over Part D work items: select ready -> compile context at run time -> invoke the allowlisted worker -> typed done-probe decides -> record actuals -> advance status. The model gets navigated; it never navigates.

Tiertools
Roleunclassified (baselined)
Pathcrates/tools/work-runner
Edition2021
Targetstools-work-runner, tools_work_runner, watch_integration
Public items36 across 4 modules
Tests44

What it is for

Step-runner core (sprint 4.5): the pure halves of the loop — probe parsing/evaluation and the retry state machine — kept free of DB and model I/O so every decision branch is testable and mutation-provable. The loop's doctrine (harness-design-notes §5): the probe owns "done"; the model's claim owns nothing.

Capabilities

crate root

Step-runner core (sprint 4.5): the pure halves of the loop — probe

Item
pub const DEV_SERVER_EXIT_BOOT_FAILED: u8
pub const DEV_SERVER_EXIT_INFRA: u8
fn http_status_line_valid(line : & str) -> bool
fn boot_verdict(child_alive : bool, http_answered : bool) -> Result <(), String>

FailedProbeRoute

Step-runner core (sprint 4.5): the pure halves of the loop — probe

Item
pub enum FailedProbeRoute
fn route_after_failed_probe(probe_only : bool) -> FailedProbeRoute

watch (other)

work-runner watch (sprint 4.14): poll a run_measurement series, a

Item
pub const INTERVAL_RANGE: (u64, u64)
pub const MAX_TICKS_CAP: u64
pub const STALL_TICKS_RANGE: (u64, u64)
pub const ERROR_TICKS_RANGE: (u64, u64)
pub const OBSERVE_TIMEOUT: Duration
async fn run_watch(cfg : & WatchConfig, dsn : & str) -> LoopEnd

ExitOn

work-runner watch (sprint 4.14): poll a run_measurement series, a

Item
pub enum ExitOn

Format

work-runner watch (sprint 4.14): poll a run_measurement series, a

Item
pub enum Format

LoopEnd

work-runner watch (sprint 4.14): poll a run_measurement series, a

Item
pub enum LoopEnd
fn exit_code(end : LoopEnd) -> i32

MetricOp

work-runner watch (sprint 4.14): poll a run_measurement series, a

Item
pub enum MetricOp
MetricOp :: fn holds(self, actual : f64, wanted : f64) -> bool

ProcessProbe

work-runner watch (sprint 4.14): poll a run_measurement series, a

Item
pub enum ProcessProbe

WatchConfig

work-runner watch (sprint 4.14): poll a run_measurement series, a

Item
pub struct WatchConfig
fn parse_watch_args(args : & String) -> Result <WatchConfig, String>

watch::emit (other)

Tick rendering (sprint 4.14 AC1/AC2). Every DB- or git-sourced field

Item
pub const FIELD_CAP_BYTES: usize
fn sanitize(field : & str) -> String

TickRender

Tick rendering (sprint 4.14 AC1/AC2). Every DB- or git-sourced field

Item
pub struct TickRender<'a>
fn render_text(t : & TickRender) -> String
fn render_json(t : & TickRender) -> String

watch::observe (other)

The three observers (sprint 4.14 AC1/AC6/AC7). Subprocesses are strict

Item
async fn observe_telemetry(pool : & sqlx::PgPool, run_id : & str,) -> Result <Option <(String, String)>, String>
async fn observe_processes(probe : & ProcessProbe) -> Result <u64, String>
async fn observe_head(worktree : & Path) -> Result <String, String>
async fn run_argv_with_timeout(bin : & str, args : & & str, dur : std::time::Duration,) -> Result <std::process::Output, String>

tokio::process::Child

The three observers (sprint 4.14 AC1/AC6/AC7). Subprocesses are strict

Item
tokio::process::Child :: async fn wait_with_output_shim(& mut self) -> std::io::Result <std::process::Output>

StallMachine

Pure stall state machine (sprint 4.14 AC4 + Gate 1.5 amendment (a)):

Item
pub struct StallMachine
StallMachine :: fn new(stall_ticks : u64) -> Self
StallMachine :: fn advance(& mut self, obs : & TickObs) -> Verdict

TickObs

Pure stall state machine (sprint 4.14 AC4 + Gate 1.5 amendment (a)):

Item
pub struct TickObs

Verdict

Pure stall state machine (sprint 4.14 AC4 + Gate 1.5 amendment (a)):

Item
pub enum Verdict

How to use it

No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.

Module structure

tools_work_runner

flowchart TD
  n_tools_work_runner["tools_work_runner"]
  n_tools_work_runner --> n_watch["watch"]
  n_watch --> n_watch__emit["emit"]
  n_watch --> n_watch__observe["observe"]
  n_watch --> n_watch__stall["stall"]

Public surface

`crate root`

ItemWhat it is
pub enum FailedProbeRouteWhere a failed rung-0 probe goes (sprint 4.48)
fn route_after_failed_probe(probe_only : bool) -> FailedProbeRoute
pub const DEV_SERVER_EXIT_BOOT_FAILED: u8Dev-server exit codes (sprint 4.9 AC-retry-split, Gate 1.5 adopted redline 5): contractual so the step machine can map them onto its corrective/infra split without parsing prose
pub const DEV_SERVER_EXIT_INFRA: u8
fn http_status_line_valid(line : & str) -> boolThe AC5 readiness predicate, pure: a valid HTTP status line proves the server ANSWERED, whatever the status (a 500 is a booted server; a non-HTTP banner or empty read is not).
fn boot_verdict(child_alive : bool, http_answered : bool) -> Result <(), String>Boot verdict, pure (Gate 1.5 redline 2: a child that exited is a boot failure even if SOMETHING answers the port — false-green class).

`watch`

ItemWhat it is
pub const INTERVAL_RANGE: (u64, u64)
pub const MAX_TICKS_CAP: u64
pub const STALL_TICKS_RANGE: (u64, u64)
pub const ERROR_TICKS_RANGE: (u64, u64)
pub const OBSERVE_TIMEOUT: Duration
pub enum ExitOn
pub enum MetricOp
MetricOp :: fn holds(self, actual : f64, wanted : f64) -> bool
pub enum Format
pub enum ProcessProbe
pub struct WatchConfig
pub enum LoopEndWhy the loop ended, mapped to the exit contract (AC5).
fn exit_code(end : LoopEnd) -> i32
fn parse_watch_args(args : & String) -> Result <WatchConfig, String>Parse and validate every input BEFORE any I/O (AC3)
async fn run_watch(cfg : & WatchConfig, dsn : & str) -> LoopEndThe tick loop

`watch::emit`

ItemWhat it is
pub const FIELD_CAP_BYTES: usize
fn sanitize(field : & str) -> StringNewline/CR become single spaces; result truncated to FIELD_CAP_BYTES without splitting a UTF-8 char.
pub struct TickRender<'a>One tick, ready to render
fn render_text(t : & TickRender) -> StringText mode: STALL ts run_id metric=value processes=N head=<short> with an error=<msg> field appended when an observer failed.
fn render_json(t : & TickRender) -> StringJSON mode: one object per line, all eight keys always present (null where absent)

`watch::observe`

ItemWhat it is
async fn observe_telemetry(pool : & sqlx::PgPool, run_id : & str,) -> Result <Option <(String, String)>, String>Latest telemetry row for the series: metric and value as SEPARATE columns (AC1); value is numeric in the schema — cast to text at the query so rendering never reformats it.
async fn observe_processes(probe : & ProcessProbe) -> Result <u64, String>Process liveness
async fn observe_head(worktree : & Path) -> Result <String, String>Worktree HEAD short line
async fn run_argv_with_timeout(bin : & str, args : & & str, dur : std::time::Duration,) -> Result <std::process::Output, String>Strict-argv subprocess under a deadline
tokio::process::Child :: async fn wait_with_output_shim(& mut self) -> std::io::Result <std::process::Output>

`watch::stall`

ItemWhat it is
pub struct TickObsOne tick's observations, reduced to what the machine compares.
pub enum Verdict
pub struct StallMachine
StallMachine :: fn new(stall_ticks : u64) -> Self
StallMachine :: fn advance(& mut self, obs : & TickObs) -> Verdict

Re-exports. Exported here, defined elsewhere.

ExportDefined in
{decide,eval_path_exists,parse_probe,Attempts,NextAction,Outcome,PathKind,Probe,ProbeResult,}operations_control_plane::probe::{decide,eval_path_exists,parse_probe,Attempts,NextAction,Outcome,PathKind,Probe,ProbeResult,}

Boundary

Reaches into operations.

Shares tier tools with 84 other crates: tools-advisory-reach, tools-archive-guard, tools-artifact-scaffold, tools-ask-ai-core, tools-ask-ais, tools-ask-gemini, tools-book, tools-book-report, … (84 total).

_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._

Where it sits

Tier (ontology)tools
Architectural role (taxonomy)unclassified (baselined)
Locationcrates/tools/work-runner
Vocabulary in force (lexicon)current

Tier flow. Which tiers this crate's own edges cross.

flowchart LR
  n_tools["tools"] --> n_operations["operations"]

Dependencies

Runtime, in this workspace.

CrateTierOptionalOnly on
`operations-control-plane`operationsnoalways
`tools-packet-compile`toolsnoalways

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
anyhow^1noalways
serde^1derivenoalways
serde_json^1noalways
sqlx^0.8runtime-tokio, postgres, chrono, uuid, json, runtime-tokio, … (10 total)noalways
tokio^1full, rt-multi-thread, macros, timenoalways
uuid^1v4, v7, serde, js, v4, serdenoalways

Development, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
tempfile^3noalways

Build. None.

Depended on by. Nothing in this workspace.

Signal flow — what reaches this crate, and what it reaches.

flowchart LR
  SELF["tools-work-runner"]
  SELF -->|runtime| n_operations_control_plane["operations-control-plane"]
  SELF -->|runtime| n_tools_packet_compile["tools-packet-compile"]
  classDef self fill:#1f883d,stroke:#1f883d,color:#fff;
  class SELF self;

Feature flags

No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.

Targets

KindNameSource
bintools-work-runner`src/main.rs`
libtools_work_runner`src/lib.rs`
testwatch_integration`tests/watch_integration.rs`

Error model

No public error type was detected: no public item declares a type named *Error, and no public signature returns one.

Operational characteristics

PropertyEvidence
async public surfaceyes
async runtimeyes
database accessyes
network I/Onone detected
unsafe codenone detected
environment variablesyes

No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.

Configuration

VariableRead in
CARGO_PKG_VERSIONsrc/main.rs
CORPUS_SOURCECODE_APP_DBsrc/main.rs
WORK_RUNNER_LOCAL_BINsrc/main.rs

No workspace crate depends on this one.

Verification

KindCount
Unit tests32
Integration tests12
Examples0
Doctests0

Evidence by module. How often each public module is named by something executable.

ModuleTestsExamplesConsumers
crate root600
watch1400
watch::emit500
watch::observe400
watch::stall300

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc1636
Public modules with a //! block44
pie showData
    title Public items with rustdoc
    "Documented" : 16
    "No rustdoc detected" : 20

Metrics

MetricValue
Rust source files6
Source lines3193
Code lines2725
Public API items36
Public modules4
Tests44
Examples0
Cargo features0
Direct runtime dependencies8
Workspace reverse dependencies0
pie showData
    title Public API by kind
    "constant" : 8
    "enum" : 7
    "function" : 13
    "method" : 4
    "struct" : 4
pie showData
    title Rust source composition
    "Code" : 2725
    "Blank or comment" : 468

Generation

Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.

Todas las tools · Manual