Skip to content
Closed
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
28 changes: 28 additions & 0 deletions .trinity/seals/tri_tri_status.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"built_by": "t27c-bootstrap@0.5.2+f1fb27891",
"closure": [],
"config": "gen=c,rust,verilog,zig;tests=zig",
"gen_hash_c": "sha256:30487e2cd204306140d967dc523d40a4a0e819996e88195b5ba1b90af5a96d87",
"gen_hash_rust": "sha256:7c4c2dc1419d00950ea6cc8b3c9569d3991eda85cb38df4b5ce9eab608776ebd",
"gen_hash_verilog": "sha256:cf96c5004597b33675731622c17a6b8066dd09e2b4a2b10ce07aea3c24f1c0b4",
"gen_hash_zig": "sha256:144199b7dc304e6c3634a8020fc3d85aa648928b1e62a33d2f5646dcb0762bf4",
"module": "tri_status",
"ring": 12,
"seal_schema": 2,
"sealed_at": "2026-11-09T03:41:54Z",
"sealed_by": "t27c-bootstrap@0.5.2",
"spec_hash": "sha256:8bbbc242f26801111e3534085dcd184a306235e709837f5fc2a7904d0c539095",
"spec_path": "specs/tri/status.t27",
"tests": {
"failed": 0,
"failing": [],
"forced": false,
"passed": 5,
"total": 5,
"vacuous": 0
},
"toolchain": {
"test_runner": "sha256:1a50286d6170ef41c779d26385a1be59823925d7131497c93d84194144ba93b3",
"zig": "0.16.0"
}
}
22 changes: 11 additions & 11 deletions cli/tri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ mod renum;
mod reseal;
mod rtl;
mod scratch;
#[path = "../../../gen/rust/tri/status/status.rs"] #[allow(dead_code, unused_parens, unused_mut, unused_variables, non_snake_case, clippy::all)] pub mod status_rules; // t27c gen-rust of specs/tri/status.t27
pub use crate::status_rules::*;
mod seals;
mod skillnum;
mod sweep;
Expand Down Expand Up @@ -799,26 +801,24 @@ fn cmd_status(root: &Path) -> Result<()> {
let reg = load_registry(root)?;
let git = git_short_hash();

println!("=== PHI LOOP STATUS ===");
println!(
"git: {}",
if git.is_empty() {
"unknown".into()
} else {
git
}
);
println!("{}", format_header());
if git.is_empty() {
println!("{}", format_git_unknown());
} else {
println!("{} {}", format_git_prefix(), git);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Status lines print extra space

Medium Severity

The git and skill lines insert a format-string space after prefixes that already end with a space. format_git_prefix and format_skill_active_prefix return git: and skill: , so tri status prints a double blank after the colon and no longer matches the previous output or the spec constants.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7eaccc7. Configure here.

}

match skill.status.as_str() {
"active" => {
println!(
"skill: {} ({})",
"{} {} ({})",
format_skill_active_prefix(),
skill.skill_id.as_deref().unwrap_or("?"),
skill.description.as_deref().unwrap_or("?")
);
}
_ => {
println!("skill: none");
println!("{}", format_skill_none());
}
}

Expand Down
116 changes: 116 additions & 0 deletions specs/tri/status.t27
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
// SPDX-License-Identifier: Apache-2.0
// specs/tri/status.t27 -- the `tri status` command: PHI LOOP status report
// Reads .trinity/state/active-skill.json, .trinity/cells/registry.json,
// .trinity/state/queen-health.json and `git rev-parse --short HEAD`;
// prints a one-page report. The glue reads the files and runs git;
// this spec defines the output format, verdict codes and string constants.
// ASCII only (L3); phi^2 + 1/phi^2 = 3 | TRINITY

module tri_status;

// --- paths -----------------------------------------------------------------

pub const STATE_DIR : str = ".trinity/state";
pub const CELLS_DIR : str = ".trinity/cells";
pub const ACTIVE_SKILL : str = "active-skill.json";
pub const REGISTRY : str = "registry.json";
pub const QUEEN_HEALTH : str = "queen-health.json";
pub const GIT_SHORT : str = "git rev-parse --short HEAD";

// --- output ----------------------------------------------------------------

pub const HEADER : str = "=== PHI LOOP STATUS ===";
pub const SKILL_ACTIVE : str = "active";
pub const SKILL_NONE : str = "none";
pub const SKILL_UNKNOWN : str = "?";

// --- verdict codes ---------------------------------------------------------

pub const V_OK : u32 = 0;
pub const V_UNREAD : u32 = 1;
pub const EXIT_OK : u32 = 0;
pub const EXIT_UNREAD : u32 = 2;

// --- string helpers --------------------------------------------------------

/// Byte-wise equality of two strings.
pub fn str_eq(a: string, b: string) -> bool {
if (a.len != b.len) { return false; }
var i : usize = 0;
while (i < a.len) {
if (a[i] != b[i]) { return false; }
i = i + 1;
}
return true;
}

// --- format output (no string concatenation; glue assembles) --------------

pub fn format_header() -> string {
return HEADER;
}

pub fn format_git_prefix() -> string {
return "git: ";
}

pub fn format_git_unknown() -> string {
return "git: unknown";
}

pub fn format_skill_none() -> string {
return "skill: none";
}

pub fn format_skill_active_prefix() -> string {
return "skill: ";
}

// --- verdicts -------------------------------------------------------------

pub fn verdict_ok() -> u32 {
return V_OK;
}

pub fn verdict_unread() -> u32 {
return V_UNREAD;
}

// --- tests ----------------------------------------------------------------

test format_header_constant {
assert str_eq(format_header(), "=== PHI LOOP STATUS ===");
}

test format_git_prefix_constant {
assert str_eq(format_git_prefix(), "git: ");
}

test format_git_unknown_constant {
assert str_eq(format_git_unknown(), "git: unknown");
}

test format_skill_none_constant {
assert str_eq(format_skill_none(), "skill: none");
}

test format_skill_active_prefix_constant {
assert str_eq(format_skill_active_prefix(), "skill: ");
}

// --- invariants -----------------------------------------------------------

invariant exit_codes_are_numbered {
assert EXIT_OK == 0;
assert EXIT_UNREAD > EXIT_OK;
}

invariant verdicts_are_numbered {
assert V_OK == 0;
assert V_UNREAD > V_OK;
}

invariant skill_constants_distinct {
assert str_eq(SKILL_ACTIVE, SKILL_NONE) == false;
assert str_eq(SKILL_NONE, SKILL_UNKNOWN) == false;
}
Loading