Repository navigation
194 lines (170 loc) · 8.4 KB
/
Copy pathcodegen.yml
File metadata and controls
194 lines (170 loc) · 8.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: Codegen Validation
# Managed by apps/website/scripts/ci-triggers-from-spec.mjs from specs/ci/workflow_triggers.t27.
# Do not edit this block: edit the spec, then run npm --prefix apps/website run gen:ci-triggers.
on:
push:
branches: [main, 'ralph/dev-*', vibee-v5-production]
# No schedule: block. The Queen (Inngest app t27-queen) dispatches this workflow
# on '0 0 * * *' UTC from the card specs/crons/trinity-codegen.t27 in gHashTag/t27.
# Codegen consumes specs and the compiler in src/, not prose or the
# website; a docs-only merge regenerates byte-identical output.
paths-ignore:
- 'apps/website/**'
- 'docs/**'
- '**/*.md'
pull_request:
branches: [main]
paths-ignore:
- 'apps/website/**'
- 'docs/**'
- '**/*.md'
workflow_dispatch:
jobs:
validate:
name: Validate VIBEE Codegen
# ubuntu, like the other 116 jobs in this repo. Zig 0.15.2 cannot link
# against the SDK on current macos-latest -- the build dies with undefined
# _abort, _bzero, ___availability_version_check and the rest of libSystem,
# before compiling anything of ours. Same failure appears on a developer
# Mac running macOS 26.
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
# `brew install zig` installs whatever is current, which is 0.16, and this
# tree targets 0.15.2 -- the version the other 28 workflows pin. On 0.16
# build.zig itself fails to compile (linkLibC moved, and the vendored
# raylib package still calls std.mem.trimLeft and std.process.getEnvVarOwned,
# both removed), so the job died before reaching any codegen at all.
- name: Install Zig
uses: mlugg/setup-zig@v2
with:
version: 0.15.2
- name: Build Project
run: |
# -Dci=true skips the GUI targets that linkSystemLibrary("raylib");
# the runner has no raylib and codegen validation does not need one.
zig build -Dci=true
# The "Run Codegen Validation" step that stood here called
# `bash scripts/validate_codegen.sh`, which exists in no commit of this
# repository -- `git log -- scripts/validate_codegen.sh` is empty, so it
# was never tracked, and the step could only ever exit 127. Removed rather
# than recreated: nobody knows what it checked, and inventing a gate and
# calling it the restored one would be worse than not having it. The step
# below is the real codegen validation and always was.
#
# A replacement belongs in `tri` rather than in a shell script, per the
# repository's no-shell-scripts rule, if a gap is found that this does not
# already cover.
- name: Test E2E Specs
run: |
# Each spec is generated and the generated code is then tested.
# Failure of either half fails the job, which is the whole point.
zig build vibee -- gen specs/tri/batch_processing.vibee
zig test generated/batch_processing.zig
zig build vibee -- gen specs/tri/ternary_mathematics.vibee
zig test generated/ternary_mathematics.zig
zig build vibee -- gen specs/tri/flash_attention.vibee
zig test generated/flash_attention.zig
zig build vibee -- gen specs/tri/ternary_embeddings.vibee
zig test generated/ternary_embeddings.zig
# NOT RUN, because the specs are absent from the repository:
# specs/tri/golden_chain.vibee
# specs/tri/llm_full_inference.vibee
# specs/tri/vsa_swarm_agent.vibee
# They were listed here and generated from until someone removed them;
# the step has been failing on the first of them ever since, which was
# invisible while the job died earlier at the build. Left named rather
# than deleted so the gap stays legible: restore a spec, uncomment its
# two lines. Do not quietly shorten this list.
- name: Run Full Tests
run: |
zig build test 2>&1 | tail -20
- name: Check for TODO Stubs
run: |
echo "=== Checking for TODO stub implementations ==="
TODO_COUNT=$(grep -r "TODO: implement" generated/*.zig 2>/dev/null | wc -l | tr -d ' ')
echo "TODO stubs: $TODO_COUNT"
if [ "$TODO_COUNT" -gt 0 ]; then
echo "::warning::Found $TODO_COUNT TODO stub implementations in generated files"
grep -r "TODO: implement" generated/*.zig 2>/dev/null | head -10 || true
else
echo "✅ No TODO stub implementations found!"
fi
count-patterns:
name: Count Pattern Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
# A ratchet, not a target.
#
# This step used to fail unless implementation coverage reached 95%.
# Measured, it is 157/6053 = 2%. A gate 47x from its threshold is not a
# gate: it is red on every commit, for every author, forever, and the only
# thing it teaches is to ignore a red X on this repository. It was also the
# sole honest measurement in the job — the other step printed green for two
# specs that do not exist — so deleting it was not an option either.
#
# What it enforces now is the thing that is actually enforceable today:
# the count of implemented behaviors may not go DOWN. 95% stays printed as
# the goal, and the distance to it is stated in behaviours rather than
# left as a percentage nobody can act on.
#
# Raise FLOOR whenever the real number rises. That is the ratchet.
- name: Count Specs and Behaviors
env:
FLOOR: 157
GOAL_PCT: 95
run: |
echo "=== VIBEE Statistics ==="
# Both numbers below describe the SAME set of files. They did not:
# "Total specs" used `find` (recursive, 522) while the behaviour and
# implementation counts used `specs/tri/*.vibee` (top level only,
# 460), so the printed spec count belonged to a different population
# than the coverage computed under it.
SPECS=$(find specs/tri -maxdepth 1 -name "*.vibee" 2>/dev/null | wc -l | tr -d ' ')
echo "Total specs (specs/tri, top level): $SPECS"
BEHAVIORS=$(grep -rh "^ - name:" specs/tri/*.vibee 2>/dev/null | wc -l | tr -d ' ')
echo "Total behaviors: $BEHAVIORS"
IMPLEMENTATIONS=$(grep -rh "implementation: |" specs/tri/*.vibee 2>/dev/null | wc -l | tr -d ' ')
echo "Behaviors with implementations: $IMPLEMENTATIONS"
if [ -z "$BEHAVIORS" ] || [ "$BEHAVIORS" -eq 0 ]; then
echo "::error::no behaviours found — the glob or the spec layout changed"
exit 1
fi
COVERAGE=$((IMPLEMENTATIONS * 100 / BEHAVIORS))
NEEDED=$(( (BEHAVIORS * GOAL_PCT + 99) / 100 - IMPLEMENTATIONS ))
echo "Implementation coverage: $COVERAGE% (floor $FLOOR, goal ${GOAL_PCT}%)"
echo "To reach ${GOAL_PCT}%: $NEEDED more behaviours would need an implementation."
if [ "$IMPLEMENTATIONS" -lt "$FLOOR" ]; then
echo "::error::implemented behaviours fell from $FLOOR to $IMPLEMENTATIONS"
exit 1
fi
if [ "$IMPLEMENTATIONS" -gt "$FLOOR" ]; then
echo "::notice::floor can be raised: $FLOOR -> $IMPLEMENTATIONS"
fi
echo "✅ no regression"
# This step used to print, unconditionally:
# ✅ llm_full_inference - 14 behaviors, 14 tests
# ✅ vsa_swarm_agent - 17 behaviors, 18 tests
# Both specs are absent from the repository. It was two `echo`s reporting
# green for files that do not exist, in a job whose other step measures
# coverage honestly and fails. Now it looks, and says what it finds.
- name: Production Components Status
run: |
echo "=== Production Components (v5) ==="
missing=0
for s in llm_full_inference vsa_swarm_agent; do
f="specs/tri/$s.vibee"
if [ -f "$f" ]; then
b=$(grep -cE "^ - name:" "$f" || true)
echo "present $s — $b behaviours"
else
echo "MISSING $s — $f is not in the repository"
missing=$((missing + 1))
fi
done
if [ "$missing" -gt 0 ]; then
echo "::warning::$missing production spec(s) named by this workflow do not exist"
fi