Repository navigation
tri status: read header text from the .t27 spec #13510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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_prefixandformat_skill_active_prefixreturngit:andskill:, sotri statusprints a double blank after the colon and no longer matches the previous output or the spec constants.Additional Locations (1)
cli/tri/src/main.rs#L812-L818Reviewed by Cursor Bugbot for commit 7eaccc7. Configure here.