|
| 1 | +# Spec Validation Report — 2026-06-29 (07:30 CEST cycle) |
| 2 | + |
| 3 | +**Agent**: spec-validator (Carthos, Domain Architect) |
| 4 | +**Date**: 2026-06-29 07:30 CEST |
| 5 | +**Verdict**: **CONDITIONAL PASS** (tracked gap #2972 re-confirmed; no behavioural regressions) |
| 6 | +**Prior verdict**: CONDITIONAL PASS (06:30 CEST, same day) |
| 7 | + |
| 8 | +--- |
| 9 | + |
| 10 | +## Boundary State This Cycle |
| 11 | + |
| 12 | +The territorial topology is **unchanged since the 06:30 cycle**. No commits have landed against |
| 13 | +the stranded-source directories or the `plans/` relocation: |
| 14 | + |
| 15 | +| Stranded dir | Last commit touching it | Status | |
| 16 | +|---|---|---| |
| 17 | +| `crates/terraphim_orchestrator` | `5c48dabec` 2026-06-14 | stale (predates cycle) | |
| 18 | +| `crates/terraphim_agent` | `5c48dabec` 2026-06-14 | stale | |
| 19 | +| `crates/terraphim_agent_application` | `45c385178` 2026-06-22 | stale | |
| 20 | + |
| 21 | +#2972 remains **open**, assigned to `quality-coordinator`, 23 comments. No remediation owner |
| 22 | +action since the prior recurrence. |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## Plans Validated (6, against true polyrepo home) |
| 27 | + |
| 28 | +All six plans' acceptance criteria are satisfied in the migrated code |
| 29 | +(`/home/alex/projects/terraphim/terraphim-agents`). Behavioural ACs verified: |
| 30 | + |
| 31 | +### Plan 1: `design-gitea82-correction-event.md` — **PASS** |
| 32 | +| AC | Evidence | Status | |
| 33 | +|----|------|--------| |
| 34 | +| `CorrectionEvent` struct | `learnings/capture.rs` | ✅ | |
| 35 | +| `capture_correction()` / `list_all_entries()` / `query_all_entries()` | `learnings/capture.rs` | ✅ | |
| 36 | +| Secret redaction wired | `learnings/redaction.rs` (called in capture paths) | ✅ | |
| 37 | + |
| 38 | +### Plan 2: `d3-session-auto-capture-plan.md` — **PASS** |
| 39 | +| AC | Evidence | Status | |
| 40 | +|----|------|--------| |
| 41 | +| `from_session_commands()` / `extract_bash_commands_from_session()` | `learnings/procedure.rs` | ✅ | |
| 42 | +| Trivial-command filter | present in procedure.rs | ✅ | |
| 43 | + |
| 44 | +### Plan 3: `design-gitea84-trigger-based-retrieval.md` — **PASS** |
| 45 | +| AC | Evidence | Status | |
| 46 | +|----|------|--------| |
| 47 | +| `MarkdownDirectives.trigger` / `.pinned` | registry `terraphim_types` 1.20.x | ✅ | |
| 48 | +| `TriggerIndex` + fallback matching | registry `terraphim_rolegraph` 1.20.2 | ✅ | |
| 49 | + |
| 50 | +### Plan 4: `research-single-agent-listener.md` — **PASS** (research-only, no ACs) |
| 51 | +### Plan 6: `design-single-agent-listener.md` — **PASS** (runtime ACs; `learnings/listener.rs` structurally present) |
| 52 | +### Plan 5: `learning-correction-system-plan.md` — **PASS** (carry-forwards stable) |
| 53 | +| Phase | Issue(s) | Status | Evidence | |
| 54 | +|-------|----------|--------|----------| |
| 55 | +| A–F, H | #480-704 | ✅ | capture/procedure/replay/guard/suggest intact in `terraphim-agents/learnings/` | |
| 56 | +| G (shared CLI) | #727 partial | ✅ DONE | `SharedLearningSub::{List,Promote,Import}` wired; `SharedLearningStore::open` called | |
| 57 | +| I (evolution) | #727-730 | ✅ cleared | Mock LLM factories confined to `#[cfg(test)]`; production paths clean | |
| 58 | +| J (validation) | #515-517,#451 | ✅ present | `terraphim_hooks` 1.20.2 registry crate consumed; compiles green | |
| 59 | + |
| 60 | +--- |
| 61 | + |
| 62 | +## Test Evidence (re-run this cycle) |
| 63 | + |
| 64 | +``` |
| 65 | +cargo test -p terraphim_agent --lib |
| 66 | +test result: ok. 288 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.39s |
| 67 | +``` |
| 68 | + |
| 69 | +Includes `shared_learning::{store,wiki_sync}` tests and `robot::output::proptests`. **Behavioural invariant holds** (stable across the 06:30 and 07:30 cycles). |
| 70 | + |
| 71 | +--- |
| 72 | + |
| 73 | +## Architectural Finding: Two `GuardDecision` Types (refined, not a violation) |
| 74 | + |
| 75 | +The prior report's "coincidental name collision" framing was imprecise. Within `terraphim_agent` |
| 76 | +there are **two distinct `GuardDecision` abstractions**, by deliberate design: |
| 77 | + |
| 78 | +| Type | Location | Shape | Wired? | Role | |
| 79 | +|---|---|---|---|---| |
| 80 | +| `GuardDecision` (**enum**) | `src/guard_patterns.rs` (crate root) | `Allow / Block / Sandbox` | **LIVE** — `listener.rs:1334`, `main.rs:1966-2724` | Production guard (`CommandGuard`) | |
| 81 | +| `GuardDecision` (**struct**) | `src/learnings/guard.rs` | `{ tier, reason, previously_failed }` + `ExecutionTier` | **DEFERRED** — zero external usages | Plan §H graduated-tier design (Phase H, future iteration) | |
| 82 | + |
| 83 | +The deferral is **self-documented and intentional**. `learnings/mod.rs` declares: |
| 84 | + |
| 85 | +```rust |
| 86 | +// Guard API — newly added, will be wired into the binary in a future iteration. |
| 87 | +#[allow(unused_imports)] |
| 88 | +pub use guard::{ExecutionTier, GuardDecision, evaluate_command, evaluate_command_with_learning}; |
| 89 | +``` |
| 90 | + |
| 91 | +This is not dead code from neglect — it is staged foundation work silenced with |
| 92 | +`#[allow(unused_imports)]`, consistent with the learning-plan's Phase H sequencing |
| 93 | +(dependent on Phase D replay + Phase F health monitoring). `DESIGN-guard-patterns-redesign.md` |
| 94 | +confirms intent: the redesign *replaces internals* of `guard_patterns.rs` with thesaurus matching; |
| 95 | +it does not delete it, nor does it merge the two abstractions. |
| 96 | + |
| 97 | +**Verdict on this finding:** Not a spec violation. A deliberate staged-design boundary. Filed |
| 98 | +here for traceability so future runs do not re-flag it as "name collision" or "duplicate dead code". |
| 99 | + |
| 100 | +> Note: prior traceability cited test evidence `git_checkout_double_dash` against |
| 101 | +> `learnings/guard_patterns.rs`. The actual location is `src/guard_patterns.rs:208` |
| 102 | +> (`test_git_checkout_double_dash_blocked`). Filename drift in the prior report — corrected here. |
| 103 | +
|
| 104 | +--- |
| 105 | + |
| 106 | +## The Tracked Gap (#2972) — Unchanged, P2 |
| 107 | + |
| 108 | +### Facet A — Stranded source (re-measured) |
| 109 | + |
| 110 | +Git-tracked Rust source with no workspace build path remains in this repo: |
| 111 | + |
| 112 | +| Directory | Tracked .rs files | LOC | Cargo.toml | |
| 113 | +|-----------|------------------:|----:|------------| |
| 114 | +| `crates/terraphim_orchestrator` | 18 | 16,467 | none (orphaned mod roots) | |
| 115 | +| `crates/terraphim_agent` | 7 | 6,819 | none | |
| 116 | +| `crates/terraphim_agent_application` | 8 | 3,265 | **still present** | |
| 117 | +| **subtotal** | **33** | **26,551** | — | |
| 118 | + |
| 119 | +Hazard: dead-but-tracked code — excluded from build, superseded by registry deps, yet present |
| 120 | +and searchable. Maintenance trap + review noise. Measurement is stable with the 06:30 cycle. |
| 121 | + |
| 122 | +### Facet B — Spec-location drift (unfixed) |
| 123 | + |
| 124 | +All four code-bearing plans still cite pre-extraction paths unresolvable in this repo: |
| 125 | +- `design-gitea82-correction-event.md` → `crates/terraphim_agent/src/learnings/capture.rs` (×2 refs) |
| 126 | +- `d3-session-auto-capture-plan.md` → `crates/terraphim_agent/src/learnings/procedure.rs` |
| 127 | +- `learning-correction-system-plan.md` → `crates/terraphim_agent/src/learnings/{hook,mod,capture}.rs` (×5+ refs) |
| 128 | + |
| 129 | +No `RELOCATED` banners added to any plan. **Facet B drift unfixed.** |
| 130 | + |
| 131 | +### Why CONDITIONAL PASS, not FAIL |
| 132 | + |
| 133 | +No behavioural/acceptance-criterion violation exists. Every specified function is implemented |
| 134 | +and tested in its polyrepo. The gap is **repository hygiene + spec relocation**, already tracked |
| 135 | +as **#2972** (open, assigned `quality-coordinator`, 23 comments). This cycle re-confirms with |
| 136 | +stable measurement. **No new issue filed** — fix owner unchanged; duplicate-noise avoided per cron |
| 137 | +protocol. |
| 138 | + |
| 139 | +**Smallest fix** (owned by whoever closes #2972): |
| 140 | +1. `git rm` stranded `crates/*` source (except genuinely-shared fixtures) |
| 141 | +2. Add `RELOCATED.md` banners to the 4 code-bearing plans pointing to `terraphim-agents` |
| 142 | +3. Replace `plans/` with a `RELOCATED.md` index |
| 143 | + |
| 144 | +--- |
| 145 | + |
| 146 | +## Negative Space (explicitly considered and ruled out) |
| 147 | + |
| 148 | +| Considered | Ruled out | Basis | |
| 149 | +|---|---|---| |
| 150 | +| `terraphim_mcp_search` violates a plan | Net-new, no plan covers it | No `plans/` doc references `mcp_search`/`McpToolIndex`/`SEP-1821` (verified by absence) | |
| 151 | +| New issue #3017 (kiro Task 10) in scope | Out of scope | No `plans/` doc references kiro/OTP — net-new doc-tracking issue | |
| 152 | +| New issue #3014 (session NFR G1) in scope | Out of scope | No `plans/` doc references session benchmark NFR — net-new perf-tracking issue | |
| 153 | +| `learnings/guard.rs` is accidental dead code | Deliberate staging | `mod.rs` comment + `#[allow(unused_imports)]` + Phase H dependency chain | |
| 154 | +| Two `GuardDecision` types = spec conflict | Deliberate boundary | Different modules, different shapes, different lifecycle stage (enum=live, struct=staged) | |
| 155 | +| Workspace membership defect | Not a defect | `members=["crates/*"]` globs; `exclude=[...]` prunes residuals; internally consistent | |
| 156 | +| Carry-forwards #727/Phase-G/I regressed | Stable (06:30→07:30) | Shared CLI wired; mocks confined to `#[cfg(test)]` | |
| 157 | + |
| 158 | +--- |
| 159 | + |
| 160 | +## Traceability Matrix |
| 161 | + |
| 162 | +| Req (plan symbol) | Plan | Impl Location (true) | Test | Status | |
| 163 | +|---|---|---|---|---| |
| 164 | +| CorrectionEvent | design-gitea82 §1 | `terraphim-agents/learnings/capture.rs` | `test_capture_*` (288-suite) | ✅ | |
| 165 | +| ProcedureStore | d3 / learning-plan §B | `terraphim-agents/learnings/procedure.rs` | `from_session_commands` tests | ✅ | |
| 166 | +| `replay_procedure()` | learning-plan §D | `terraphim-agents/learnings/replay.rs` | replay tests | ✅ | |
| 167 | +| GuardDecision (enum, live) | (production guard) | `terraphim-agents/src/guard_patterns.rs` | `test_git_checkout_double_dash_blocked:208` | ✅ | |
| 168 | +| GuardDecision (struct, staged) | learning-plan §H | `terraphim-agents/learnings/guard.rs` | unit tests in-file (10) | ✅ staged | |
| 169 | +| SharedLearningSub CLI | learning-plan §G | `terraphim-agents/main.rs:3964` | `wiki_sync::tests` | ✅ | |
| 170 | +| MarkdownDirectives.trigger | design-gitea84 §1 | `terraphim-core` (registry terraphim_types) | `parses_trigger_directive` | ✅ | |
| 171 | +| TriggerIndex | design-gitea84 §3 | `terraphim-core` (registry terraphim_rolegraph) | tfidf tests | ✅ | |
| 172 | + |
| 173 | +--- |
| 174 | + |
| 175 | +## Verdict |
| 176 | + |
| 177 | +**CONDITIONAL PASS.** No P0/P1 behavioural spec violations. All six plans' acceptance criteria |
| 178 | +satisfied in the code's true home (`terraphim-agents` + `terraphim-core` registry crates); |
| 179 | +`terraphim_agent` lib suite = **288 passed, 0 failed** (re-verified this cycle). Carry-forwards |
| 180 | +from 2026-06-01 remain cleared and stable. |
| 181 | + |
| 182 | +One tracked P2 gap re-confirmed with stable measurement (~26,551 LOC stranded across 3 excluded |
| 183 | +dirs + spec-location drift in 4 plans). Already filed as **#2972** (open). This cycle adds a |
| 184 | +refined architectural finding (the two-`GuardDecision` boundary is deliberate staging, not a |
| 185 | +collision) and corrects a filename drift in prior traceability. **No new issue filed.** |
0 commit comments