Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .trinity/seals/loop_TriLoopTick.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"built_by": "t27c-bootstrap@0.5.2+c948f4df7",
"closure": [
{
"spec": "specs/tri/lab/receipt.t27",
"spec_hash": "sha256:00d9eec8d7be84dde596c9990b3a5574de24aff9f7a94579fc620eb585712441"
},
{
"spec": "specs/tri/lanes/lanes.t27",
"spec_hash": "sha256:aac192b3e3250196262a9b8467d4a9cef8147438c11c0744c66c3f6b175c9342"
}
],
"config": "gen=c,rust,verilog,zig;tests=zig",
"gen_hash_c": "sha256:181c8af083e0e1b9f0f0d4888449725e38a2733c7865f967bd2f3d474bd26dfe",
"gen_hash_rust": "sha256:5fe0e37e1c4abb409f23e139450588690da57363e0e6cb3738110316105ef117",
"gen_hash_verilog": "sha256:731be2d9897541017a7d89f020ad6193a3948cd48b538754c8773eebcc1dfb69",
"gen_hash_zig": "sha256:ea606271e8b65372944ffc63e5f7ae0a5d217ef10a899c551400f311f60621f8",
"module": "TriLoopTick",
"ring": 12,
"seal_schema": 2,
"sealed_at": "2026-10-19T14:13:27Z",
"sealed_by": "t27c-bootstrap@0.5.2",
"spec_hash": "sha256:5be75aa6ae782c007897b41a42f3ab8dc04b11f68d592c64d61dc7830b7d6ca3",
"spec_path": "specs/tri/loop/tick.t27",
"tests": {
"failed": 0,
"failing": [],
"forced": false,
"passed": 25,
"total": 25,
"vacuous": 0
},
"toolchain": {
"test_runner": "sha256:8512b80da533b79289110fca4a65f3336abd7a059ca4b72ea595d5e33ff8ad10",
"zig": "0.16.0"
}
}
19 changes: 10 additions & 9 deletions .trinity/seals/tri_tool_tri_loop.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
{
"built_by": "t27c-bootstrap@0.5.2+5d5d2cdef",
"built_by": "t27c-bootstrap@0.5.2+c948f4df7",
"closure": [],
"config": "gen=c,rust,verilog,zig;tests=zig",
"gen_hash_c": "sha256:18a368682fe796af4fdeb5c2ca09dbc0eee32ea2bf84fbb7c95a64b8be6b9934",
"gen_hash_rust": "sha256:2f97f928872e00c7ebc08277c6a41aa0851808f092f4db5db4b0552f21c795c8",
"gen_hash_verilog": "sha256:1441f44284c6bb7d214d6e22ac66fb526510da21ad8c3ce78ce50038ed328d05",
"gen_hash_zig": "sha256:802b3ab0893119b2c26b2f26dede4dc1d857522d60fa3b085fae3bd4c5d0025e",
"gen_hash_c": "sha256:487811e236e84acbdb37858860face73b03506cf3b2198b4386f45a16570c53a",
"gen_hash_rust": "sha256:39030192cba3ee8241459eb72ab41553c64fa92bb9f65811b1ef93218c8fb2f6",
"gen_hash_verilog": "sha256:91d63ebbe5d258f392043934e273d0c429ca21e2866c658eeb2f085584b8b6a5",
"gen_hash_zig": "sha256:1b51125055a4193828037fd08ba0f3b8074ab5f2e08608793966f601bec8e91f",
"module": "tool_tri_loop",
"ring": 12,
"seal_schema": 2,
"sealed_at": "2026-10-09T14:55:23Z",
"sealed_at": "2026-10-19T14:13:51Z",
"sealed_by": "t27c-bootstrap@0.5.2",
"spec_hash": "sha256:bc923ea3abad6f05f07a5ab87610391ef027b1d58dfc74bfbce8d4675f287267",
"spec_hash": "sha256:76e4e4caae4f9c9c0777aa8031bb8c250e510a53b5ed2670eea8657f67fb6857",
"spec_path": "specs/tools/tri/loop.t27",
"tests": {
"failed": 0,
"failing": [],
"forced": false,
"passed": 4,
"total": 4
"total": 4,
"vacuous": 0
},
"toolchain": {
"test_runner": "sha256:1982ae948e24d00c5d221ccec12dfce1eb01204b53e37b0f857f93b16d64629d",
"test_runner": "sha256:8512b80da533b79289110fca4a65f3336abd7a059ca4b72ea595d5e33ff8ad10",
"zig": "0.16.0"
}
}
40 changes: 0 additions & 40 deletions bootstrap/src/railway.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,46 +165,6 @@ pub async fn set_service_variables(
Ok(())
}

/// Delete a Railway service
///
/// # Arguments
/// * `service_id` - ID of the Railway service to delete
/// * `railway_token` - Railway API token for authentication
pub async fn delete_railway_service(
service_id: &str,
railway_token: &str,
) -> Result<()> {
let client = Client::new();

let mutation = format!(
r#"mutation {{
serviceDelete(input: {{ id: "{}" }}) {{
id
}}
}}"#,
service_id
);

let resp = client.post(RAILWAY_GRAPHQL)
.header("Authorization", format!("Bearer {}", railway_token))
.header("Content-Type", "application/json")
.json(&serde_json::json!({"query": mutation}))
.send()
.await?;

if !resp.status().is_success() {
let status = resp.status();
let body = resp.text().await.unwrap_or_else(|_| "Unable to read body".to_string());
return Err(anyhow::anyhow!(
"Failed to delete Railway service: {} - {}",
status,
body
));
}

Ok(())
}

/// Get the health status of a Railway service
///
/// # Arguments
Expand Down
23 changes: 23 additions & 0 deletions cli/tri/src/loopclaim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
use anyhow::{Context, Result};
use clap::Subcommand;
use std::process::Command;
#[path = "../../../gen/rust/tri/loop/tick.rs"] #[allow(dead_code, unused_parens)]
mod tick; // t27c gen-rust of specs/tri/loop/tick.t27: every rule of `tri loop plan`

#[derive(Subcommand)]
pub enum LoopCmd {
Expand All @@ -37,6 +39,11 @@ pub enum LoopCmd {
#[arg(long)]
who: bool,
},
/// The next actions of the overnight loop, one `ACTION key reason` line each, from a snapshot of its state (ledger rows, wanted lanes, pull requests, agents, crons, requests out) read from FILE or stdin. Rules: specs/tri/loop/tick.t27. Runs no command, contacts no network or machine. The same snapshot prints the same lines; the last line, `HASH n`, goes into the next snapshot as `last n`, and a tick whose state and plan it matches prints NOOP.
Plan {
/// The snapshot file; stdin when absent or `-`.
file: Option<std::path::PathBuf>,
},
}

fn git(args: &[&str]) -> Result<(i32, String)> {
Expand Down Expand Up @@ -83,7 +90,23 @@ fn holder(name: &str) -> Option<String> {
pub fn run(cmd: &LoopCmd) -> Result<()> {
match cmd {
LoopCmd::Claim { name, release, who } => claim(name, *release, *who),
LoopCmd::Plan { file } => plan(file.as_deref()),
}
}

/// `tri loop plan`: the generated rules judge the snapshot, this prints what they return.
fn plan(file: Option<&std::path::Path>) -> Result<()> {
let text = match file.filter(|f| f.to_str() != Some("-")) { Some(f) => std::fs::read_to_string(f).with_context(|| f.display().to_string())?, None => std::io::read_to_string(std::io::stdin())? };
let s: &'static str = text.leak();
let (mut at, noop) = (tick::next_record(s, 0), tick::is_noop(s));
if noop { println!("{} {}", tick::action_name(tick::A_NOOP), tick::why(tick::A_NOOP)); }
while !noop && at < s.len() {
let a = tick::action(s, at);
if a != tick::A_NONE { println!("{} {} {}", tick::action_name(a), &s[tick::key_from(s, at)..tick::key_to(s, at)], tick::why(a)); }
at = tick::next_record(s, tick::line_end(s, at) + 1);
}
println!("HASH {}", tick::plan_hash(s));
Ok(())
}

fn claim(name: &str, release: bool, who: bool) -> Result<()> {
Expand Down
Loading
Loading