Skip to content

Commit 18b54f5

Browse files
committed
Close trace-id test lane and split improvement 9
1 parent 95e01b0 commit 18b54f5

10 files changed

Lines changed: 83 additions & 180 deletions
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Command: trace-id Test Lane — Complete
2+
3+
Status: `complete` (Phases 1-4 done, Phase 5 absorbed into improvement 9)
4+
Date completed: 2026-03-24
5+
Original date: 2026-03-03
6+
7+
## What Was Done
8+
9+
Phased test suite for trace-id, implemented in `julia-tests/runtests.trace-id.jl`.
10+
11+
### Phase 1: CLI Contract — DONE
12+
- `trace-id --help` exposes command and required flags
13+
- Missing required args fail with actionable errors
14+
- Invalid `--format` / guardrail args fail with actionable errors
15+
16+
### Phase 2: Core Heuristic Roles — DONE
17+
- Detect `define` sites for identifier constants
18+
- Detect `produce` publish/send/emit sites
19+
- Detect `consume` subscribe/bind/routing sites
20+
- Detect `trigger` pattern registration sites
21+
22+
### Phase 3: Output Contracts — DONE
23+
- JSON output schema is stable for downstream tooling
24+
- Terminal output includes grouped role sections
25+
- Empty-result behavior is deterministic
26+
27+
### Phase 4: Scope/stdin/Depth Guardrails — DONE
28+
- Scope and extension filtering constraints hold
29+
- stdin-limited file set behavior works
30+
- Depth guardrail and `--force` semantics are consistent
31+
32+
### Phase 5: Cross-Command JSON Pipeline — ABSORBED
33+
Moved to `docs/main.improvement.9.trace-id.todo.current.md`.
34+
The `@test_broken` placeholders in `runtests.trace-id.jl` flip when merge edge-type lands.
35+
36+
## Test Counts (at close)
37+
38+
42 pass, 4 broken (Phase 5 pipeline placeholders)
39+
40+
## Artifacts
41+
42+
- `julia-tests/runtests.trace-id.jl`
43+
- `julia-tests/main.command.trace-id.test.jl`

docs/main.command.trace-id.test.todo.current.md

Lines changed: 0 additions & 53 deletions
This file was deleted.

docs/main.command.trace-id.test.todo.current.reference.md

Lines changed: 0 additions & 28 deletions
This file was deleted.

docs/main.command.trace-id.test.todo.trigger.event.md

Lines changed: 0 additions & 39 deletions
This file was deleted.

docs/main.demo.sudoku.trace-id.todo.current.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# Demo: Sudoku + trace-id (Pure Separation Architecture)
22

3-
Status: `todo.current` (active — Phase 4 complete, Phase 5 next)
4-
Date: 2026-03-13
3+
Status: `todo.current` (active — standalone lane, Phase 5 HTML5 in progress)
4+
Date: 2026-03-24 (standalone since 2026-03-24, originally 2026-03-13)
5+
6+
Note: This lane was formerly Lane 2 of improvement 9. Now standalone because
7+
the Sudoku demo *uses* trace-id but doesn't *change* it. The merge edge-type
8+
pipeline work remains in `docs/main.improvement.9.trace-id.todo.current.md`.
59

610
## Phase 1 Complete (2026-03-13)
711

Lines changed: 17 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,16 @@
1-
# Improvement 9: trace-id Pipeline + Sudoku Demo
1+
# Improvement 9: merge edge-type Pipeline
22

3-
Status: `todo.current` (active — Sudoku Phase 1-3 complete, Phase 4 next)
4-
Date: 2026-03-13
3+
Status: `todo.current` (active — focused on merge edge-type only)
4+
Date: 2026-03-24
55

66
## Focus
77

8-
Two lanes, both trace-id ecosystem:
8+
Single lane: teach `merge --stdin` to retain `edge_type` from trace-id JSON.
99

10-
1. **merge edge-type pipeline**`trace-id --json | merge --stdin` retains `edge_type`
11-
2. **Sudoku demo** — full showcase of recur as discoverability engine
10+
The Sudoku demo (formerly Lane 2) is now its own standalone lane:
11+
`docs/main.demo.sudoku.trace-id.todo.current.md`
1212

13-
## Progress (2026-03-13)
14-
15-
**Sudoku demo Phase 1+2+3 complete:** 644 tests green (32 + 20 + 46 + rest of suite).
16-
- Phase 1: file protocol proof — plain .txt, default vocab, config isolation, edge_type
17-
- Phase 2: Recur.jl wrapper + puzzle fixture — full Julia→subprocess→JSON loop
18-
- Phase 3: Generator.jl — Sudoku geometry, flow file authoring, cascades.json generation
19-
- Fixed: box.5 → box.2 (handwritten fixture had wrong box number, Generator computes correctly)
20-
- Proven: 20 unique peers per cell, all subscribe lines reference identifier
21-
- Artifacts: `demos/sudoku/julia/` (Recur.jl, Generator.jl), `julia-tests/runtests.demo.sudoku.phase3.jl`
22-
23-
**Phase 4 next:**
24-
- Phase 1d config isolation (fragile repo config dependency)
25-
- Dogfooding doc validation (speculative vocabulary)
26-
27-
**Lane 1 (merge edge-type) unchanged** — Phase 5 `@test_broken` still waiting.
28-
29-
## Lane 1: merge edge-type
30-
31-
### What's needed
13+
## What's Needed
3214

3315
`merge --stdin` currently extracts file paths from JSON and builds a file-path tree.
3416
It doesn't understand the trace-id JSON shape (`define`/`produce`/`consume`/`trigger` arrays)
@@ -40,7 +22,7 @@ To make `trace-id --json | merge --stdin --json` output include `edge_type`:
4022
2. Track `edge_type` per path through merge
4123
3. Include `edge_type` in merge JSON output
4224

43-
### Test
25+
## Test Gate
4426

4527
`julia-tests/runtests.trace-id.jl` — Phase 5: "trace-id -> merge (full composition placeholder)"
4628

@@ -50,34 +32,25 @@ To make `trace-id --json | merge --stdin --json` output include `edge_type`:
5032

5133
Flip to `@test` when implemented.
5234

35+
Also absorbs the trace-id test lane Phase 5 (cross-command JSON pipeline contracts).
36+
That lane's Phases 1-4 are complete and wired into the suite — see
37+
`docs/main.command.trace-id.test.complete.md` for the record.
38+
5339
### Descoped
5440

5541
`trace -> merge`, `callers -> merge`, `callees -> merge` edge_type tests —
5642
those commands don't produce `edge_type`. Marked `@test_skip` permanently.
5743

58-
## Lane 2: Sudoku Demo
59-
60-
Full planning in `docs/main.demo.sudoku.trace-id.todo.current.md`.
61-
62-
7 phases:
63-
1. File protocol spec + keyword vocabulary
64-
2. Julia CLI prototype — hardcoded puzzle, call recur, verify cascade JSON
65-
3. Julia puzzle package generator — produce all JSON artifacts for one puzzle
66-
4. Julia CLI game loop — playable terminal game
67-
5. HTML5 static game — load puzzle package, full browser game, no recur at runtime
68-
6. Optional: Julia local server mode for live recur queries from HTML5
69-
7. Demo script (`demos/sudoku/demo.ps1`)
70-
7144
## Close-out Criteria
7245

7346
1. Phase 5 trace-id → merge test flips from `@test_broken``@test`
74-
2. Sudoku demo Phase 1-5 complete (Phase 6-7 optional)
75-
3. Create `docs/main.improvement.9.trace-id.complete.md`
76-
4. Delete this `.current.md`
47+
2. Create `docs/main.improvement.9.trace-id.complete.md`
48+
3. Delete this `.current.md`
7749

7850
## References
7951

80-
- `julia-tests/runtests.trace-id.jl` — Phase 5 (Lane 1)
52+
- `julia-tests/runtests.trace-id.jl` — Phase 5 tests
8153
- `src/main_command_merge_impl.rs` — merge stdin implementation
82-
- `docs/main.demo.sudoku.trace-id.todo.current.md` — Sudoku demo (Lane 2)
54+
- `docs/main.command.trace-id.test.complete.md` — test lane record (Phases 1-4 done)
55+
- `docs/main.demo.sudoku.trace-id.todo.current.md` — Sudoku demo (standalone)
8356
- `docs/main.improvement.9.trace-id.todo.future-plan.md` — original future-plan

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ mod main_command_merge_impl;
2828
mod main_command_related_impl;
2929
mod main_command_stats_impl;
3030
mod main_command_stats_stdin;
31-
mod main_command_trait_impl;
3231
mod main_command_trace_id_impl;
3332
mod main_command_trace_impl;
3433
mod main_command_trace_stats_impl;
34+
mod main_command_trait_impl;
3535
mod main_command_tree_impl;
3636

3737
#[derive(Parser)]

src/main_command_children_impl.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,3 @@ pub fn execute(
4848

4949
Ok(())
5050
}
51-

src/main_command_related_impl.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,3 @@ pub fn execute(
6868

6969
Ok(())
7070
}
71-

src/main_command_trait_impl.rs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ fn ensure_config_exists(root: &Path) -> anyhow::Result<PathBuf> {
6464
}
6565

6666
fn load_config_table(path: &Path) -> anyhow::Result<toml::value::Table> {
67-
let text = fs::read_to_string(path)
68-
.with_context(|| format!("Failed to read {}", path.display()))?;
69-
let value: TomlValue = toml::from_str(&text)
70-
.with_context(|| format!("Failed to parse {}", path.display()))?;
67+
let text =
68+
fs::read_to_string(path).with_context(|| format!("Failed to read {}", path.display()))?;
69+
let value: TomlValue =
70+
toml::from_str(&text).with_context(|| format!("Failed to parse {}", path.display()))?;
7171

7272
match value {
7373
TomlValue::Table(table) => Ok(table),
@@ -134,8 +134,13 @@ fn get_trait_value(root: &Path, key: &str, json_output: bool) -> anyhow::Result<
134134
let path = ensure_config_exists(root)?;
135135
let table = load_config_table(&path)?;
136136
let key_path = normalize_trait_key_path(key, false)?;
137-
let value = get_value_at_path(&table, &key_path)
138-
.with_context(|| format!("Key '{}' not found in {}", key_path.join("."), path.display()))?;
137+
let value = get_value_at_path(&table, &key_path).with_context(|| {
138+
format!(
139+
"Key '{}' not found in {}",
140+
key_path.join("."),
141+
path.display()
142+
)
143+
})?;
139144

140145
if json_output {
141146
let payload = json!({
@@ -242,10 +247,7 @@ fn set_value_at_path(
242247
.expect("entry should be table after table check");
243248
}
244249

245-
current.insert(
246-
path.last().expect("path must not be empty").clone(),
247-
value,
248-
);
250+
current.insert(path.last().expect("path must not be empty").clone(), value);
249251
Ok(())
250252
}
251253

@@ -314,7 +316,10 @@ mod tests {
314316
fn parse_cli_value_infers_common_scalar_types() {
315317
assert_eq!(parse_cli_value("true"), TomlValue::Boolean(true));
316318
assert_eq!(parse_cli_value("42"), TomlValue::Integer(42));
317-
assert_eq!(parse_cli_value("\"hello\""), TomlValue::String("hello".to_string()));
319+
assert_eq!(
320+
parse_cli_value("\"hello\""),
321+
TomlValue::String("hello".to_string())
322+
);
318323
assert_eq!(parse_cli_value("raw"), TomlValue::String("raw".to_string()));
319324
}
320325

0 commit comments

Comments
 (0)