|
| 1 | +# ═══════════════════════════════════════════════════════════════════════════════ |
| 2 | +# VIBEE Specification — Batch Pipeline Runner |
| 3 | +# ═══════════════════════════════════════════════════════════════════════════════ |
| 4 | +# φ² + 1/φ² = 3 = TRINITY |
| 5 | +# Issue #77: Parallel spec generation with std.Thread.Pool |
| 6 | +# ═══════════════════════════════════════════════════════════════════════════════ |
| 7 | + |
| 8 | +name: batch_runner |
| 9 | +version: "1.0.0" |
| 10 | +language: zig |
| 11 | +module: batch_runner |
| 12 | + |
| 13 | +description: | |
| 14 | + Batch Pipeline Runner — scans specs/, filters by lint status, |
| 15 | + runs vibee gen + zig ast-check in parallel using std.Thread.Pool. |
| 16 | + Produces JSON report with pass/fail per spec and sacred V-formula. |
| 17 | + |
| 18 | +# ═══════════════════════════════════════════════════════════════════════════════ |
| 19 | +# TYPE SYSTEM |
| 20 | +# ═══════════════════════════════════════════════════════════════════════════════ |
| 21 | + |
| 22 | +types: |
| 23 | + CompileStatus: |
| 24 | + variants: |
| 25 | + - pass |
| 26 | + - ast_fail |
| 27 | + - compile_fail |
| 28 | + - gen_fail |
| 29 | + - lint_fail |
| 30 | + - timeout |
| 31 | + - skipped |
| 32 | + |
| 33 | + FilterMode: |
| 34 | + variants: |
| 35 | + - all |
| 36 | + - lint_pass |
| 37 | + - lint_fail |
| 38 | + - changed_only |
| 39 | + |
| 40 | + PipelineResult: |
| 41 | + fields: |
| 42 | + spec_path: String |
| 43 | + success: Bool |
| 44 | + status: CompileStatus |
| 45 | + duration_ns: Int |
| 46 | + error_msg: String |
| 47 | + |
| 48 | + BatchConfig: |
| 49 | + fields: |
| 50 | + parallel: Int |
| 51 | + filter: FilterMode |
| 52 | + directory: String |
| 53 | + dry_run: Bool |
| 54 | + timeout_seconds: Int |
| 55 | + |
| 56 | + BatchReport: |
| 57 | + fields: |
| 58 | + total_specs: Int |
| 59 | + filtered_specs: Int |
| 60 | + passed: Int |
| 61 | + failed: Int |
| 62 | + skipped: Int |
| 63 | + total_duration_ns: Int |
| 64 | + parallel_workers: Int |
| 65 | + failures: List(FailureEntry) |
| 66 | + |
| 67 | + FailureEntry: |
| 68 | + fields: |
| 69 | + spec: String |
| 70 | + status: CompileStatus |
| 71 | + error_msg: String |
| 72 | + |
| 73 | + ThreadSafeResults: |
| 74 | + fields: |
| 75 | + items: List(PipelineResult) |
| 76 | + lock_active: Bool |
| 77 | + |
| 78 | +# ═══════════════════════════════════════════════════════════════════════════════ |
| 79 | +# BEHAVIORS |
| 80 | +# ═══════════════════════════════════════════════════════════════════════════════ |
| 81 | + |
| 82 | +behaviors: |
| 83 | + scan_specs: |
| 84 | + description: "Walk directory recursively for .tri files, skip archive/" |
| 85 | + inputs: |
| 86 | + - directory: String |
| 87 | + output: List(String) |
| 88 | + steps: |
| 89 | + - Open directory with iterate flag |
| 90 | + - Walk entries, collect .tri files |
| 91 | + - Recurse into subdirectories (skip archive/) |
| 92 | + - Return full paths |
| 93 | + |
| 94 | + filter_specs: |
| 95 | + description: "Apply filter mode to spec list" |
| 96 | + inputs: |
| 97 | + - specs: List(String) |
| 98 | + - mode: FilterMode |
| 99 | + output: List(String) |
| 100 | + steps: |
| 101 | + - If all, return all specs |
| 102 | + - If lint_pass, run vibee validate → keep passing |
| 103 | + - If lint_fail, run vibee validate → keep failing |
| 104 | + - If changed_only, git diff HEAD~1 → keep changed |
| 105 | + |
| 106 | + run_single_pipeline: |
| 107 | + description: "Run lint → gen → ast-check for one spec" |
| 108 | + inputs: |
| 109 | + - spec_path: String |
| 110 | + - filter: FilterMode |
| 111 | + output: PipelineResult |
| 112 | + steps: |
| 113 | + - Run lint check (skip if already filtered) |
| 114 | + - Run vibee gen to /tmp/tri-batch/{stem}.zig |
| 115 | + - Detect verilog specs → skip ast-check |
| 116 | + - Run zig ast-check on generated file |
| 117 | + - Return PipelineResult with timing |
| 118 | + |
| 119 | + run_batch: |
| 120 | + description: "Full batch: scan → filter → parallel run → report" |
| 121 | + inputs: |
| 122 | + - config: BatchConfig |
| 123 | + output: BatchReport |
| 124 | + steps: |
| 125 | + - Scan specs from config.directory |
| 126 | + - Filter by config.filter mode |
| 127 | + - If dry_run, print plan and return |
| 128 | + - Init std.Thread.Pool with config.parallel workers |
| 129 | + - Spawn workers via pool.spawnWg |
| 130 | + - Wait for all workers |
| 131 | + - Aggregate results (pass/fail/skip) |
| 132 | + - Print colored report with V-formula |
| 133 | + - Write protocol JSONL + latest.json |
| 134 | + |
| 135 | + run_batch_command: |
| 136 | + description: "CLI entry: parse flags → run_batch" |
| 137 | + inputs: |
| 138 | + - args: List(String) |
| 139 | + output: Void |
| 140 | + steps: |
| 141 | + - Parse --parallel, --filter, --dry-run, --timeout, --report, --compare |
| 142 | + - Call run_batch with parsed config |
| 143 | + |
| 144 | +# ═══════════════════════════════════════════════════════════════════════════════ |
| 145 | +# CONSTRAINTS |
| 146 | +# ═══════════════════════════════════════════════════════════════════════════════ |
| 147 | + |
| 148 | +constraints: |
| 149 | + - Thread-safe result collection via mutex |
| 150 | + - Per-spec failures do NOT block other specs |
| 151 | + - Verilog specs skip ast-check (no zig output) |
| 152 | + - Output to /tmp/tri-batch/ to avoid polluting generated/ |
| 153 | + - Maximum 20 failure details in report |
| 154 | + - Sacred formula V = phi * (rate/100)^2 in every report |
| 155 | + |
| 156 | +# ═══════════════════════════════════════════════════════════════════════════════ |
| 157 | +# TESTS |
| 158 | +# ═══════════════════════════════════════════════════════════════════════════════ |
| 159 | + |
| 160 | +tests: |
| 161 | + - name: "extractStem from path" |
| 162 | + input: {path: "specs/tri/foo.tri"} |
| 163 | + expected: {stem: "foo"} |
| 164 | + |
| 165 | + - name: "parseFilterMode lint:pass" |
| 166 | + input: {mode_str: "lint:pass"} |
| 167 | + expected: {mode: "lint_pass"} |
| 168 | + |
| 169 | + - name: "scanSpecs finds files" |
| 170 | + input: {directory: "specs/tri"} |
| 171 | + expected: {count_gt: 0} |
| 172 | + |
| 173 | + - name: "ThreadSafeResults append" |
| 174 | + input: {result: {spec_path: "test.tri", success: true}} |
| 175 | + expected: {items_len: 1} |
| 176 | + |
| 177 | + - name: "detectVerilog false for missing file" |
| 178 | + input: {path: "nonexistent.tri"} |
| 179 | + expected: {is_verilog: false} |
0 commit comments