Repository navigation
Expand file tree
/
Copy path.make.lua
More file actions
886 lines (783 loc) · 50.5 KB
/
Copy path.make.lua
File metadata and controls
886 lines (783 loc) · 50.5 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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
-- The four programs, together. Each is a submodule with its own .make.lua; these recipes go into
-- each and call the recipe there, so `make` inside a checkout still means that program alone.
--
-- make build · run · install · test all four, in the order a person meets them
-- make status · update · push where each checkout stands, and moving it
-- make release --type minor a version of each, develop into main, then pinned
local make = oslo.make
local MEMBERS = { "magi", "casper", "melchior", "balthasar" }
-- balthasar's `build` is static against musl and wants a musl compiler its flake provides and a
-- fresh machine does not. `build-host` is the ordinary build its own `install` uses.
local BUILD = { balthasar = "build-host" }
local function sh(command)
assert(oslo.run{ "sh", "-c", command }.ok, command .. " failed")
end
local function captured(command)
local done = oslo.run{ "sh", "-c", command, capture = true }
return done.ok, ((done.out or ""):gsub("%s+$", ""))
end
-- A clone made without --recursive leaves each member an empty directory.
local function checked_out()
for _, name in ipairs(MEMBERS) do
if not oslo.fs.stat(name .. "/.make.lua") then
sh("git submodule update --init")
return
end
end
end
local function each(recipe_for)
checked_out()
for _, name in ipairs(MEMBERS) do
local recipe = recipe_for(name)
print(oslo.ui.title(("%s · make %s"):format(name, recipe)))
sh(("cd %s && oslo make %s"):format(name, recipe))
end
end
make.recipe{ name = "build", desc = "every binary",
run = function() each(function(name) return BUILD[name] or "build" end) end }
make.alias("b", "build")
-- `--args` as the words a shell would split it into, quotes honoured, handed over without one.
local function words(line)
local out, word, quote, started = {}, {}, nil, false
for ch in (line or ""):gmatch(".") do
if quote then
if ch == quote then quote = nil else word[#word + 1] = ch end
elseif ch == "'" or ch == '"' then
quote, started = ch, true
elseif ch:match("%s") then
if started then out[#out + 1], word, started = table.concat(word), {}, false end
else
word[#word + 1], started = ch, true
end
end
assert(not quote, "--args has a quote that is never closed")
if started then out[#out + 1] = table.concat(word) end
return out
end
make.recipe{
name = "run",
desc = "magi, with the other three fresh from their builds rather than installed",
deps = { "build" },
params = { { "--args", desc = "what to hand magi: a prompt, or a subcommand such as doctor" } },
run = function(a)
local bash = os.getenv("NERV_BASH") or (oslo.fs.exists("/bin/bash") and "/bin/bash" or "bash")
local argv = { bash, "scripts/run-family.sh" }
for _, word in ipairs(words(a.args)) do argv[#argv + 1] = word end
assert(oslo.run(argv).ok, "magi exited with a failure")
end,
}
make.alias("r", "run")
make.recipe{ name = "install", desc = "every binary to ~/.local/bin, and each configuration",
run = function() each(function() return "install" end) end }
make.alias("i", "install")
make.recipe{ name = "test", desc = "every suite",
run = function() each(function() return "test" end) end }
make.alias("t", "test")
make.recipe{ name = "test-events", desc = "all four independent local event contracts",
run = function() each(function() return "test-events" end) end }
make.recipe{ name = "test-cache-contract", desc = "actual Magi/Melchior cache request capture with selected family binaries",
run = function()
local ok, root = captured("pwd -P")
assert(ok and root ~= "", "cannot resolve the family runner")
assert(oslo.run{ "sh", "-c", 'cd magi && exec oslo make test-cache-contract --runner="$1"',
"cache-contract", root .. "/scripts/acceptance.sh" }.ok,
"actual family cache contract failed")
end }
local function family_script(script, mode)
local bash = os.getenv("NERV_BASH") or (oslo.fs.exists("/bin/bash") and "/bin/bash" or "bash")
local args
if script == "scripts/family.sh" or script == "scripts/acceptance.sh" or script == "scripts/tests/family.sh" or script == "scripts/acceptance-native-mcp.sh" then
args = { bash, "scripts/test-context.sh", bash, script }
else
args = { bash, script }
end
if mode then args[#args + 1] = mode end
assert(oslo.run(args).ok, script .. " failed")
end
make.recipe{ name = "test-eval-runner", desc = "evaluation manifest contracts and refusal fixtures",
deps = { "test-eval-input", "test-eval-json", "test-eval-provider", "test-eval-provider-release", "test-eval-world", "test-eval-deadline", "test-eval-provider-world", "test-eval-bindings", "test-eval-pack", "test-eval-aggregate", "test-eval-sample-assembly", "test-eval-metrics", "test-eval-usage", "test-eval-request-bytes", "test-eval-prefix", "test-eval-client-attempts", "test-eval-reconcile-usage", "test-eval-ledger-usage", "test-eval-ipc-record", "test-eval-ipc-pack", "test-eval-ipc-usage" },
run = function()
family_script("scripts/tests/evaluation.sh")
family_script("scripts/tests/evaluation-artifact.sh")
family_script("scripts/tests/evaluation-report.sh")
end }
make.recipe{ name = "test-eval-report", desc = "versioned multi-model report and retained evidence contracts",
deps = { "build-eval-input" },
run = function() family_script("scripts/tests/evaluation-report.sh") end }
make.recipe{ name = "test-eval-usage", desc = "scoped transcript usage without recounting restored history or guessing missing counters",
deps = { "build-eval-input" },
params = { { "--retained", desc = "optional retained transcript-usage receipt for the escaped large-journal regression" } },
run = function(a) family_script("scripts/tests/evaluation-usage.sh", a.retained) end }
make.recipe{ name = "test-eval-json", desc = "bounded native JSON grammar, exact counters, duplicate keys and confined file inputs",
deps = { "build-eval-input" },
run = function() family_script("scripts/tests/evaluation-json.sh") end }
make.recipe{ name = "test-eval-request-bytes", desc = "exact captured body bytes without reserializing payloads or inferring client attempts",
deps = { "build-eval-input" },
params = { { "--execution", desc = "optional retained execution test receipt; no workers are started" } },
run = function(a) family_script("scripts/tests/evaluation-request-bytes.sh", a.execution) end }
make.recipe{ name = "test-eval-prefix", desc = "normalized prompt octets without inferring cached tokens or savings",
deps = { "build-eval-input" },
run = function() family_script("scripts/tests/evaluation-prefix.sh") end }
make.recipe{ name = "test-eval-client-attempts", desc = "protected pre-send admission ledger validation",
deps = { "build-eval-input" },
run = function() family_script("scripts/tests/evaluation-client-attempts.sh") end }
make.recipe{ name = "test-eval-sample-assembly", desc = "sample status assembly without inventing missing measurements",
run = function() family_script("scripts/tests/evaluation-sample-assembly.sh") end }
make.recipe{ name = "eval-offline", desc = "run the declared alternating offline samples and retain every result",
deps = { "build-eval-input", "build-eval-world" },
params = { { "--bindings", desc = "reviewed frozen binding root" }, { "--sha256", desc = "binding digest" } },
run = function(a)
assert(a.bindings and a.sha256, "bindings and sha256 required")
local bash = os.getenv("NERV_BASH") or "/bin/bash"
assert(oslo.run{ bash, "scripts/evaluate.sh", a.bindings, a.sha256 }.ok,
"offline evaluation did not pass; inspect retained suite report")
end }
make.recipe{ name = "test-eval-suite", desc = "offline coordinator ordering, retained failures and cancellation",
deps = { "build-eval-input", "build-eval-world" },
params = { { "--bindings", desc = "reviewed frozen binding root" }, { "--sha256", desc = "binding digest" } },
run = function(a)
assert(a.bindings and a.sha256, "bindings and sha256 required")
local bash = os.getenv("NERV_BASH") or "/bin/bash"
assert(oslo.run{ bash, "scripts/tests/evaluation-suite.sh", a.bindings, a.sha256 }.ok,
"offline coordinator tests failed")
end }
make.recipe{ name = "eval-sample", desc = "produce one supervised sample with bounded retained evidence",
deps = { "build-eval-input", "build-eval-world" },
params = { { "--bindings", desc = "frozen binding root" }, { "--sha256", desc = "binding digest" },
{ "--id", desc = "scheduled task:variant:sample id" }, { "--collection", desc = "32-hex collection identity" } },
run = function(a)
assert(a.bindings and a.sha256 and a.id and a.collection, "bindings, sha256, id and collection are required")
local bash = os.getenv("NERV_BASH") or "/bin/bash"
assert(oslo.run{ bash, "scripts/evaluation/run-sample.sh", a.bindings, a.sha256, a.id, a.collection }.ok,
"sample did not pass; inspect the retained sample result")
end }
make.recipe{ name = "test-eval-sample", desc = "retained sample publication, cap failures and outer deadlines",
deps = { "build-eval-input", "build-eval-world", "test-eval-sample-assembly" },
params = { { "--bindings", desc = "reviewed frozen binding root" }, { "--sha256", desc = "binding digest" } },
run = function(a)
assert(a.bindings and a.sha256, "bindings and sha256 required")
local bash = os.getenv("NERV_BASH") or "/bin/bash"
assert(oslo.run{ bash, "scripts/tests/evaluation-sample.sh", a.bindings, a.sha256 }.ok,
"produced sample tests failed")
end }
make.recipe{ name = "eval-reconcile-usage", desc = "reconcile retained synthetic model usage with durable history and helper calls",
deps = { "build-eval-input" },
params = { { "--task", desc = "reviewed workload id" }, { "--root", desc = "retained execution receipt" },
{ "--world", desc = "relative world receipt directory" } },
run = function(a)
assert(a.task and a.root and a.world, "task, root and world are required")
local bash = os.getenv("NERV_BASH") or "/bin/bash"
assert(oslo.run{ bash, "scripts/evaluation/reconcile-usage.sh", a.task, a.root, a.world }.ok,
"synthetic usage reconciliation failed")
end }
make.recipe{ name = "test-eval-reconcile-usage", desc = "synthetic usage attribution and refusal contracts",
deps = { "test-eval-activity" },
run = function() family_script("scripts/tests/evaluation-reconcile-usage.sh") end }
make.recipe{ name = "eval-activity", desc = "observe retained execution activity without assigning report counter definitions",
deps = { "build-eval-input" },
params = { { "--task", desc = "reviewed workload id" }, { "--root", desc = "retained execution receipt" },
{ "--world", desc = "relative world receipt directory" } },
run = function(a)
assert(a.task and a.root and a.world, "task, root and world are required")
local bash = os.getenv("NERV_BASH") or "/bin/bash"
assert(oslo.run{ bash, "scripts/evaluation/activity.sh", a.task, a.root, a.world }.ok,
"activity observation failed")
end }
make.recipe{ name = "test-eval-activity", desc = "execution activity observations and refusal contracts",
run = function() family_script("scripts/tests/evaluation-activity.sh") end }
make.recipe{ name = "test-eval-metrics", desc = "proposed counter mapping, independent of report activation",
deps = { "build-eval-input" },
params = { { "--execution", desc = "optional retained execution receipt; no workers are started" } },
run = function(a) family_script("scripts/tests/evaluation-metrics.sh", a.execution) end }
make.recipe{ name = "eval-prefix", desc = "measure adjacent normalized prompt prefixes in retained captures",
deps = { "build-eval-input" },
params = { { "--root", desc = "retained provider evidence root" } },
run = function(a)
assert(a.root, "evidence root is required")
family_script("scripts/evaluation/normalized-prefix.sh", a.root)
end }
make.recipe{ name = "test-eval-ledger-usage", desc = "captured run charges without recounting child or resumed-session ledgers",
deps = { "build-eval-input" },
params = { { "--execution", desc = "optional retained execution test receipt; no workers are started" } },
run = function(a) family_script("scripts/tests/evaluation-ledger-usage.sh", a.execution) end }
make.recipe{ name = "eval-request-bytes", desc = "measure retained provider body captures without starting workers",
deps = { "build-eval-input" },
params = { { "--root", desc = "retained provider evidence root" } },
run = function(a)
assert(a.root, "evidence root is required")
family_script("scripts/evaluation/request-bytes.sh", a.root)
end }
make.recipe{ name = "test-eval-aggregate", desc = "ordered result collection without discarding failures or inventing missing measurements",
deps = { "build-eval-input" },
run = function() family_script("scripts/tests/evaluation-aggregate.sh") end }
make.recipe{ name = "eval-aggregate", desc = "validate and collect retained sample envelopes without starting workers",
deps = { "build-eval-input" },
params = {
{ "--root", desc = "trusted result root" },
{ "--index", desc = "relative index in execution order" },
{ "--bindings", desc = "frozen bindings root" },
{ "--sha256", desc = "frozen bindings.json identity" },
},
run = function(a)
assert(a.root and a.index and a.bindings and a.sha256, "all collection parameters are required")
local bash = os.getenv("NERV_BASH") or (oslo.fs.exists("/bin/bash") and "/bin/bash" or "bash")
assert(oslo.run{ bash, "scripts/evaluation/aggregate.sh", a.root, a.index, a.bindings, a.sha256 }.ok,
"evaluation collection or a collected sample failed")
end }
make.recipe{ name = "test-eval-pack", desc = "lossless raw evidence archives within the remaining sample byte budget",
deps = { "build-eval-input" },
run = function() family_script("scripts/tests/evaluation-pack.sh") end }
make.recipe{ name = "eval-pack-raw", desc = "package a bounded raw evidence tree without claiming sample success",
deps = { "build-eval-input" },
params = {
{ "--root", desc = "trusted input root" },
{ "--tree", desc = "relative raw tree" },
{ "--reserved", desc = "bytes occupied by other sample evidence" },
},
run = function(a)
assert(a.root and a.tree and a.reserved, "root, tree and reserved bytes are required")
local bash = os.getenv("NERV_BASH") or (oslo.fs.exists("/bin/bash") and "/bin/bash" or "bash")
assert(oslo.run{ bash, "scripts/evaluation/pack-raw.sh", a.root, a.tree, tostring(a.reserved) }.ok,
"raw evidence packaging failed")
end }
make.recipe{ name = "test-eval-bindings", desc = "frozen workload identities and exact effective configuration checks",
deps = { "build-eval-world" },
run = function() family_script("scripts/tests/evaluation-bindings.sh") end }
make.recipe{ name = "eval-check-config", desc = "compare effective workload configuration with its frozen template",
deps = { "build-eval-input" },
params = {
{ "--bindings", desc = "frozen binding receipt directory" },
{ "--sha256", desc = "frozen bindings.json digest" },
{ "--task", desc = "reviewed workload id" },
{ "--variant", desc = "baseline or candidate" },
{ "--world", desc = "isolated world receipt directory" },
},
run = function(a)
assert(a.bindings and a.sha256 and a.task and a.variant and a.world, "all configuration check parameters are required")
local bash = os.getenv("NERV_BASH") or (oslo.fs.exists("/bin/bash") and "/bin/bash" or "bash")
assert(oslo.run{ bash, "scripts/evaluation/check-config.sh", a.bindings, a.sha256, a.task, a.variant, a.world }.ok,
"effective evaluation configuration differs")
end }
make.recipe{ name = "eval-bindings", desc = "freeze paired offline inputs and configuration without starting workers",
deps = { "build-eval-world" },
params = {
{ "--root", desc = "trusted input root, default current directory" },
{ "--manifest", desc = "relative manifest path" },
{ "--baseline", desc = "relative retained baseline descriptor" },
{ "--baseline-sha", desc = "approved baseline identity" },
{ "--candidate", desc = "relative candidate descriptor" },
{ "--candidate-sha", desc = "selected candidate identity" },
{ "--provider", desc = "relative release provider path" },
{ "--provider-sha", desc = "provider binary identity" },
{ "--grammar", desc = "relative Rust grammar path" },
{ "--grammar-sha", desc = "Rust grammar identity" },
{ "--observer", desc = "optional separately captured event observer binary" },
},
run = function(a)
for _, key in ipairs({ "manifest", "baseline", "baseline_sha", "candidate", "candidate_sha", "provider", "provider_sha", "grammar", "grammar_sha" }) do
assert(a[key], key .. " is required")
end
local bash = os.getenv("NERV_BASH") or (oslo.fs.exists("/bin/bash") and "/bin/bash" or "bash")
local args = { bash, "scripts/evaluation/bindings.sh", a.root or ".", a.manifest, a.baseline, a.baseline_sha,
a.candidate, a.candidate_sha, a.provider, a.provider_sha, a.grammar, a.grammar_sha }
if a.observer then args[#args + 1] = a.observer end
assert(oslo.run(args).ok,
"evaluation frozen bindings failed")
end }
make.recipe{ name = "eval-workload", desc = "execute and independently check one frozen workload without claiming complete measurements",
deps = { "build-eval-world" },
params = {
{ "--bindings", desc = "frozen binding receipt directory" },
{ "--sha256", desc = "frozen bindings.json digest" },
{ "--task", desc = "reviewed workload id" },
{ "--variant", desc = "baseline or candidate" },
},
run = function(a)
assert(a.bindings and a.sha256 and a.task and a.variant, "all workload parameters are required")
local bash = os.getenv("NERV_BASH") or (oslo.fs.exists("/bin/bash") and "/bin/bash" or "bash")
assert(oslo.run{ bash, "scripts/evaluation/run-workload.sh", a.bindings, a.sha256, a.task, a.variant }.ok,
"frozen evaluation workload failed")
end }
make.recipe{ name = "test-eval-execution", desc = "frozen workload execution, identity refusals, limits and cancellation",
deps = { "build-eval-world" },
params = {
{ "--bindings", desc = "frozen binding receipt directory" },
{ "--sha256", desc = "frozen bindings.json digest" },
},
run = function(a)
assert(a.bindings and a.sha256, "bindings and sha256 are required")
local bash = os.getenv("NERV_BASH") or (oslo.fs.exists("/bin/bash") and "/bin/bash" or "bash")
assert(oslo.run{ bash, "scripts/tests/evaluation-execution.sh", a.bindings, a.sha256 }.ok,
"frozen evaluation execution tests failed")
end }
make.recipe{ name = "test-eval-provider", desc = "offline provider cumulative admission and process lifecycle",
run = function()
sh("cd melchior && oslo make test-fake-provider && oslo make build-fake-provider")
family_script("scripts/tests/evaluation-provider.sh")
end }
make.recipe{ name = "test-eval-provider-release", desc = "bounded release-provider capture and real process checks",
deps = { "build-eval-input" },
run = function()
sh("cd melchior && oslo make build-fake-provider-release")
family_script("scripts/tests/evaluation-provider.sh", "release")
end }
make.recipe{ name = "test-eval-provider-world", desc = "selected provider handshake, caps and lifecycle inside an isolated world",
deps = { "build-eval-world" },
run = function()
sh("cd melchior && oslo make build-fake-provider-release")
family_script("scripts/tests/evaluation-provider-world.sh")
end }
make.recipe{ name = "test-eval-family-world", desc = "explicit frozen family native-read and durable replay inside an isolated world",
deps = { "build-eval-world" },
params = {
{ "--descriptor", desc = "relative frozen artifact descriptor path" },
{ "--sha256", desc = "approved artifact identity" },
{ "--variant", desc = "baseline or candidate" },
},
run = function(a)
assert(a.descriptor and a.sha256 and a.variant, "descriptor, sha256 and variant are required")
sh("cd melchior && oslo make build-fake-provider-release")
local bash = os.getenv("NERV_BASH") or (oslo.fs.exists("/bin/bash") and "/bin/bash" or "bash")
assert(oslo.run{ bash, "scripts/tests/evaluation-family-world.sh", a.descriptor, a.sha256, a.variant }.ok,
"evaluation family world tests failed")
end }
make.recipe{ name = "test-eval-event-observer", desc = "paired captured observer inside the isolated native evaluation world",
deps = { "build-eval-world" },
params = {
{ "--descriptor", desc = "relative selected family descriptor" },
{ "--sha256", desc = "selected family identity" },
{ "--observer", desc = "relative separately captured observer binary" },
{ "--observer-sha256", desc = "captured observer identity" },
},
run = function(a)
assert(a.descriptor and a.sha256 and a.observer and a.observer_sha256, "family and observer identities are required")
sh("cd melchior && oslo make build-fake-provider-release")
family_script("scripts/tests/evaluation.sh")
local bash = os.getenv("NERV_BASH") or (oslo.fs.exists("/bin/bash") and "/bin/bash" or "bash")
assert(oslo.run{ bash, "scripts/tests/evaluation-event-observer.sh", a.descriptor, a.sha256, a.observer, a.observer_sha256 }.ok,
"isolated event observer verification failed")
end }
make.recipe{ name = "test-eval-mutations", desc = "actual bug-fix and complete large-file mutation workloads",
deps = { "build-eval-world" },
params = {
{ "--descriptor", desc = "relative frozen artifact descriptor path" },
{ "--sha256", desc = "approved artifact identity" },
{ "--variant", desc = "baseline or candidate" },
},
run = function(a)
assert(a.descriptor and a.sha256 and a.variant, "descriptor, sha256 and variant are required")
sh("cd melchior && oslo make build-fake-provider-release")
local bash = os.getenv("NERV_BASH") or (oslo.fs.exists("/bin/bash") and "/bin/bash" or "bash")
assert(oslo.run{ bash, "scripts/tests/evaluation-mutations.sh", a.descriptor, a.sha256, a.variant }.ok,
"evaluation mutation tests failed")
end }
make.recipe{ name = "test-eval-index", desc = "real parser, targeted read and selected-symbol edit workload",
deps = { "build-eval-world" },
params = {
{ "--descriptor", desc = "relative frozen artifact descriptor path" },
{ "--sha256", desc = "approved artifact identity" },
{ "--variant", desc = "baseline or candidate" },
{ "--grammar", desc = "relative retained Rust grammar binary path" },
{ "--grammar-sha256", desc = "selected Rust grammar digest" },
},
run = function(a)
assert(a.descriptor and a.sha256 and a.variant and a.grammar and a.grammar_sha256, "explicit artifact and grammar selection required")
sh("cd melchior && oslo make build-fake-provider-release")
local bash = os.getenv("NERV_BASH") or (oslo.fs.exists("/bin/bash") and "/bin/bash" or "bash")
assert(oslo.run{ bash, "scripts/tests/evaluation-mutations.sh", a.descriptor, a.sha256, a.variant,
a.grammar, a.grammar_sha256 }.ok, "evaluation index tests failed")
end }
make.recipe{ name = "test-eval-concurrent", desc = "concurrent same-revision disjoint edits through two real sessions",
deps = { "build-eval-world" },
params = {
{ "--descriptor", desc = "relative frozen artifact descriptor path" },
{ "--sha256", desc = "approved artifact identity" },
{ "--variant", desc = "baseline or candidate" },
},
run = function(a)
assert(a.descriptor and a.sha256 and a.variant, "explicit artifact selection required")
sh("cd melchior && oslo make build-fake-provider-release")
local bash = os.getenv("NERV_BASH") or (oslo.fs.exists("/bin/bash") and "/bin/bash" or "bash")
assert(oslo.run{ bash, "scripts/tests/evaluation-concurrent.sh", a.descriptor, a.sha256, a.variant }.ok,
"evaluation concurrent tests failed")
end }
make.recipe{ name = "test-eval-live-history", desc = "selected live writer and independent CLI replay visibility",
deps = { "build-eval-world" },
params = {
{ "--descriptor", desc = "relative frozen artifact descriptor path" },
{ "--sha256", desc = "selected artifact identity" },
{ "--variant", desc = "baseline or candidate" },
},
run = function(a)
assert(a.descriptor and a.sha256 and a.variant, "explicit artifact selection required")
sh("cd melchior && oslo make build-fake-provider-release")
local bash = os.getenv("NERV_BASH") or "/bin/bash"
assert(oslo.run{ bash, "scripts/tests/evaluation-live-history.sh", a.descriptor, a.sha256, a.variant }.ok,
"selected live history test failed")
end }
make.recipe{ name = "test-eval-accounting", desc = "both usage dialects and exact persisted synthetic charges",
deps = { "build-eval-world" },
params = {
{ "--descriptor", desc = "relative frozen artifact descriptor path" },
{ "--sha256", desc = "approved artifact identity" },
{ "--variant", desc = "baseline or candidate" },
},
run = function(a)
assert(a.descriptor and a.sha256 and a.variant, "explicit artifact selection required")
sh("cd melchior && oslo make build-fake-provider-release")
local bash = os.getenv("NERV_BASH") or (oslo.fs.exists("/bin/bash") and "/bin/bash" or "bash")
assert(oslo.run{ bash, "scripts/tests/evaluation-accounting.sh", a.descriptor, a.sha256, a.variant }.ok,
"evaluation accounting tests failed")
end }
make.recipe{ name = "test-eval-resume", desc = "selected history without repeated mutations or restored charges",
deps = { "build-eval-world" },
params = {
{ "--descriptor", desc = "relative frozen artifact descriptor path" },
{ "--sha256", desc = "approved artifact identity" },
{ "--variant", desc = "baseline or candidate" },
{ "--legacy", desc = "optional retained Melchior for creating pre-upgrade histories" },
{ "--legacy-sha", desc = "required digest of the retained legacy Melchior" },
},
run = function(a)
assert(a.descriptor and a.sha256 and a.variant, "explicit artifact selection required")
sh("cd melchior && oslo make build-fake-provider-release")
local bash = os.getenv("NERV_BASH") or (oslo.fs.exists("/bin/bash") and "/bin/bash" or "bash")
local args = { bash, "scripts/tests/evaluation-resume.sh", a.descriptor, a.sha256, a.variant }
if a.legacy or a.legacy_sha then
assert(a.legacy and a.legacy_sha and a.variant == "candidate", "legacy resume requires a pinned binary and candidate")
args[#args + 1] = a.legacy
args[#args + 1] = a.legacy_sha
end
assert(oslo.run(args).ok,
"evaluation resume tests failed")
end }
make.recipe{ name = "test-eval-pressure", desc = "real input reduction with required context and paired history",
deps = { "build-eval-world" },
params = {
{ "--descriptor", desc = "relative frozen artifact descriptor path" },
{ "--sha256", desc = "approved artifact identity" },
{ "--variant", desc = "baseline or candidate" },
},
run = function(a)
assert(a.descriptor and a.sha256 and a.variant, "explicit artifact selection required")
sh("cd melchior && oslo make build-fake-provider-release")
local bash = os.getenv("NERV_BASH") or (oslo.fs.exists("/bin/bash") and "/bin/bash" or "bash")
assert(oslo.run{ bash, "scripts/tests/evaluation-pressure.sh", a.descriptor, a.sha256, a.variant }.ok,
"evaluation pressure tests failed")
end }
make.recipe{ name = "test-eval-child", desc = "actual child observations, shared charges and report ownership",
deps = { "build-eval-world" },
params = {
{ "--descriptor", desc = "relative frozen artifact descriptor path" },
{ "--sha256", desc = "approved artifact identity" },
{ "--variant", desc = "baseline or candidate" },
},
run = function(a)
assert(a.descriptor and a.sha256 and a.variant, "explicit artifact selection required")
sh("cd melchior && oslo make build-fake-provider-release")
local bash = os.getenv("NERV_BASH") or (oslo.fs.exists("/bin/bash") and "/bin/bash" or "bash")
assert(oslo.run{ bash, "scripts/tests/evaluation-child.sh", a.descriptor, a.sha256, a.variant }.ok,
"evaluation child tests failed")
end }
make.recipe{ name = "test-eval-controls", desc = "actual repeated-call guard and output-only recovery workloads",
deps = { "build-eval-world" },
params = {
{ "--descriptor", desc = "relative frozen artifact descriptor path" },
{ "--sha256", desc = "approved artifact identity" },
{ "--variant", desc = "baseline or candidate" },
},
run = function(a)
assert(a.descriptor and a.sha256 and a.variant, "descriptor, sha256 and variant are required")
sh("cd melchior && oslo make build-fake-provider-release")
local bash = os.getenv("NERV_BASH") or (oslo.fs.exists("/bin/bash") and "/bin/bash" or "bash")
assert(oslo.run{ bash, "scripts/tests/evaluation-controls.sh", a.descriptor, a.sha256, a.variant }.ok,
"evaluation control tests failed")
end }
make.recipe{ name = "build-eval-world", desc = "isolated evaluation world supervisor and refusal probes",
deps = { "build-eval-input" },
run = function()
for _, source in ipairs({ "world", "world_probe" }) do
local binary = source == "world" and "eval-world" or "eval-world-probe"
assert(oslo.run{ "rustc", "--edition=2024", "-Dwarnings", "-O", "scripts/evaluation/" .. source .. ".rs",
"-o", "target/evaluation/bin/" .. binary }.ok, "evaluation world build failed")
end
end }
make.recipe{ name = "test-eval-ipc-record", desc = "bounded model IPC capture, concurrency, failure and cancellation",
deps = { "build-eval-world" },
run = function() family_script("scripts/tests/evaluation-ipc-record.sh") end }
make.recipe{ name = "test-eval-ipc-bootstrap", desc = "bounded event bootstrap relay and descriptor ownership",
deps = { "build-eval-world" },
run = function()
assert(oslo.run{ "rustfmt", "--edition", "2024", "--check", "scripts/evaluation/world.rs" }.ok,
"evaluation world format failed")
assert(oslo.run{ "rustc", "--edition=2024", "-Dwarnings", "--test", "scripts/evaluation/world.rs",
"-o", "target/evaluation/bin/eval-world-tests" }.ok, "evaluation world test build failed")
assert(oslo.run{ "target/evaluation/bin/eval-world-tests", "ipc_record::bootstrap::" }.ok,
"evaluation bootstrap tests failed")
end }
make.recipe{ name = "test-eval-ipc-native", desc = "selected native model capture with event forwarding",
deps = { "test-eval-ipc-bootstrap" },
run = function()
assert(os.getenv("MELCHIOR_TEST_BINARY"), "explicit MELCHIOR_TEST_BINARY required")
assert(oslo.run{ "target/evaluation/bin/eval-world-tests", "--ignored", "--exact",
"ipc_record::bootstrap::tests::native::selected_model_capture_preserves_bootstrap", "--nocapture" }.ok,
"selected native IPC bootstrap test failed")
end }
make.recipe{ name = "test-eval-ipc-helper", desc = "record retained background and tool-requested helper model streams",
deps = { "build-eval-world" },
params = { { "--descriptor", desc = "retained baseline descriptor" }, { "--sha256", desc = "approved baseline identity" } },
run = function(a)
assert(a.descriptor and a.sha256, "explicit retained baseline required")
sh("cd melchior && oslo make build-fake-provider-release")
local bash = os.getenv("NERV_BASH") or "bash"
assert(oslo.run{ bash, "scripts/tests/evaluation-ipc-helper.sh", a.descriptor, a.sha256 }.ok, "retained helper recorder tests failed")
end }
make.recipe{ name = "test-eval-ipc-pack", desc = "lossless bounded model IPC archives and refusal cases",
deps = { "build-eval-world" },
run = function() family_script("scripts/tests/evaluation-ipc-pack.sh") end }
make.recipe{ name = "test-eval-ipc-usage", desc = "exact cumulative model IPC usage without guessing incomplete counters",
deps = { "build-eval-input" },
params = { { "--retained", desc = "optional retained helper test receipt; no workers" } },
run = function(a) family_script("scripts/tests/evaluation-ipc-usage.sh", a.retained) end }
make.recipe{ name = "eval-ipc-usage", desc = "extract scoped usage from retained model IPC files",
deps = { "build-eval-input" },
params = { { "--root", desc = "retained input root" }, { "--capture", desc = "relative recorder directory" } },
run = function(a)
assert(a.root and a.capture, "input root and relative capture required")
local bash = os.getenv("NERV_BASH") or "bash"
assert(oslo.run{ bash, "scripts/evaluation/ipc-usage.sh", a.root, a.capture }.ok, "IPC usage extraction failed")
end }
make.recipe{ name = "test-eval-admission", desc = "retained runtime client-attempt admission and fail-closed endpoint callbacks",
deps = { "build-eval-world" },
params = {
{ "--descriptor", desc = "relative frozen artifact descriptor path" },
{ "--sha256", desc = "approved artifact identity" },
{ "--variant", desc = "baseline or candidate" },
},
run = function(a)
assert(a.descriptor and a.sha256 and a.variant, "explicit artifact selection required")
sh("cd melchior && oslo make build-fake-provider-release")
local bash = os.getenv("NERV_BASH") or (oslo.fs.exists("/bin/bash") and "/bin/bash" or "bash")
assert(oslo.run{ bash, "scripts/tests/evaluation-admission.sh", a.descriptor, a.sha256, a.variant }.ok,
"client attempt admission tests failed")
end }
make.recipe{ name = "fmt-eval-world", desc = "format the evaluation world supervisor and probes",
run = function()
assert(oslo.run{ "rustfmt", "--edition", "2024", "scripts/evaluation/world.rs", "scripts/evaluation/world_probe.rs" }.ok,
"evaluation world format failed")
end }
make.recipe{ name = "test-eval-world", desc = "isolated world, deadline and leaked-child refusal cases",
deps = { "build-eval-world" },
run = function()
assert(oslo.run{ "rustfmt", "--edition", "2024", "--check", "scripts/evaluation/world.rs", "scripts/evaluation/world_probe.rs" }.ok,
"evaluation world format failed")
assert(oslo.run{ "rustc", "--edition=2024", "-Dwarnings", "--test", "scripts/evaluation/world.rs",
"-o", "target/evaluation/bin/eval-world-tests" }.ok, "evaluation world test build failed")
assert(oslo.run{ "target/evaluation/bin/eval-world-tests" }.ok, "evaluation world tests failed")
family_script("scripts/tests/evaluation-world.sh")
end }
make.recipe{ name = "test-eval-deadline", desc = "whole controller deadline, adopted process cleanup and cancellation",
deps = { "build-eval-world" },
run = function() family_script("scripts/tests/evaluation-deadline.sh") end }
make.recipe{ name = "test-eval-artifact", desc = "explicit evaluation artifact selection and feature refusal checks",
deps = { "build-eval-input" },
run = function()
family_script("scripts/tests/evaluation-artifact.sh")
end }
make.recipe{ name = "eval-artifact", desc = "snapshot an explicit offline artifact selection without executing it",
deps = { "build-eval-input" },
params = {
{ "--root", desc = "trusted selection root, default current directory" },
{ "--descriptor", desc = "relative artifact descriptor path" },
{ "--manifest", desc = "relative evaluation manifest path" },
{ "--variant", desc = "baseline or candidate" },
{ "--source-mode", desc = "retained (default) or explicit build-output capture" },
},
run = function(a)
assert(a.descriptor and a.manifest and a.variant, "descriptor, manifest and variant are required")
local bash = os.getenv("NERV_BASH") or (oslo.fs.exists("/bin/bash") and "/bin/bash" or "bash")
assert(oslo.run{ bash, "scripts/evaluation/artifact.sh", a.root or ".", a.descriptor, a.manifest, a.variant, a.source_mode or "retained" }.ok,
"evaluation artifact preflight failed")
end }
make.recipe{ name = "build-eval-input", desc = "bounded offline evaluation input snapshot helper",
run = function()
sh("mkdir -p target/evaluation/bin")
assert(oslo.run{ "rustc", "--edition=2024", "-Dwarnings", "-O", "scripts/evaluation/input.rs", "-o", "target/evaluation/bin/eval-input" }.ok,
"evaluation input build failed")
end }
make.recipe{ name = "test-eval-input", desc = "descriptor-confined evaluation input fixtures",
deps = { "build-eval-input" },
run = function()
assert(oslo.run{ "rustfmt", "--edition", "2024", "--check", "scripts/evaluation/input.rs" }.ok, "evaluation input format failed")
assert(oslo.run{ "rustc", "--edition=2024", "-Dwarnings", "--test", "scripts/evaluation/input.rs", "-o", "target/evaluation/bin/eval-input-tests" }.ok,
"evaluation input test build failed")
assert(oslo.run{ "target/evaluation/bin/eval-input-tests" }.ok, "evaluation input tests failed")
end }
make.recipe{ name = "fmt-eval-runner", desc = "format evaluation input helper",
run = function()
assert(oslo.run{ "rustfmt", "--edition", "2024", "scripts/evaluation/input.rs" }.ok, "evaluation input format failed")
end }
make.recipe{ name = "eval-preflight", desc = "snapshot and validate offline evaluation inputs without workers",
deps = { "build-eval-input" },
params = { { "--manifest", desc = "reviewed relative manifest path" } },
run = function(a)
family_script("scripts/evaluation/preflight.sh", a.manifest or "manifests/offline.json")
end }
-- Opt-in, and never a dependency of `verify` or CI: each needs a fixture or a Blender of its own.
make.recipe{
name = "test-mcp-blender",
desc = "read-only Magi/Casper MCP round-trip against an existing Blender addon",
deps = { "build" },
run = function()
sh("cd melchior && oslo make build-fake-provider")
family_script("scripts/acceptance-mcp.sh")
end,
}
make.recipe{
name = "test-images",
desc = "native user, read, MCP and resumed image delivery to a local provider fixture",
deps = { "build" },
run = function()
sh("cd melchior && oslo make build-fake-provider")
family_script("scripts/acceptance-images.sh")
end,
}
make.recipe{
name = "test-images-blender",
desc = "image delivery including a read-only screenshot from an existing Blender addon",
deps = { "build" },
run = function()
sh("cd melchior && oslo make build-fake-provider")
family_script("scripts/acceptance-images.sh", "--blender")
end,
}
make.recipe{
name = "test-images-openrouter",
desc = "opt-in capped visual interpretation through Magi, tools and resume",
deps = { "build" },
run = function()
sh("cd melchior && oslo make build-metered-proxy")
family_script("scripts/acceptance-vision-live.sh")
end,
}
make.recipe{ name = "test-receipts", desc = "baseline receipt validation failure fixtures",
run = function() family_script("scripts/tests/receipt.sh") end }
make.recipe{ name = "test-tool-assets", desc = "selected shipped declaration digests and rejection fixtures",
run = function() family_script("scripts/tests/tool-assets.sh") end }
make.recipe{ name = "test-context", desc = "private registry namespace and lifecycle fixtures",
run = function() family_script("scripts/tests/test-context.sh") end }
make.recipe{ name = "prepare-advisories", desc = "prepare pinned audit inputs in workspace-only storage",
run = function() family_script("scripts/prepare-advisories.sh") end }
make.recipe{ name = "test-launch-selection", desc = "authoritative launch selection and argv fixtures",
run = function() family_script("scripts/tests/launch-selection.sh") end }
make.recipe{ name = "test-advisory-inputs", desc = "workspace-only pinned advisory input fixtures",
run = function() family_script("scripts/tests/advisories.sh") end }
make.recipe{ name = "baseline", desc = "record the offline roadmap baseline and command outcomes",
run = function() family_script("scripts/baseline.sh") end }
make.recipe{ name = "test-family-runner", desc = "family runner failure and isolation fixtures",
deps = { "test-receipts", "test-launch-selection", "test-advisory-inputs", "test-tool-assets", "test-context", "test-preserved-binaries" },
run = function() family_script("scripts/tests/family.sh") end }
make.recipe{ name = "test-family-cleanup", desc = "actual TERM-resistant family leak cleanup",
run = function() family_script("scripts/tests/family.sh", "--leak-only") end }
make.recipe{ name = "test-family-selection", desc = "preserved selected artifacts and integrity refusal",
deps = { "test-preserved-binaries" },
run = function() family_script("scripts/tests/family.sh", "--selection-only") end }
make.recipe{ name = "test-preserved-binaries", desc = "selected executable snapshot and integrity contract",
run = function() family_script("scripts/tests/preserve-binary.sh") end }
make.recipe{ name = "test-native-mcp-selected", desc = "nested native MCP through the selected Casper release",
run = function()
sh("cd casper && oslo make build")
family_script("scripts/acceptance-native-mcp.sh")
end }
make.recipe{ name = "test-family", desc = "required integration tests against this family",
deps = { "test-family-runner" },
run = function() family_script("scripts/family.sh", "test") end }
make.recipe{ name = "verify", desc = "member gates and required family integration",
deps = { "test-family-runner" },
run = function() family_script("scripts/family.sh", "verify") end }
make.recipe{ name = "acceptance", desc = "deterministic reliability scenarios, no credentials",
run = function() family_script("scripts/acceptance.sh") end }
-- Opt-in and never a dependency of anything: every choice is the caller's, by name, each run.
make.recipe{ name = "acceptance-live", desc = "live acceptance; needs NERV_LIVE_MODEL, NERV_LIVE_CAP_USD, NERV_LIVE_SEND=yes",
run = function()
local bash = os.getenv("NERV_BASH") or (oslo.fs.exists("/bin/bash") and "/bin/bash" or "bash")
assert(oslo.run({ bash, "scripts/acceptance-live.sh",
"--provider", os.getenv("NERV_LIVE_PROVIDER") or "openrouter",
"--model", os.getenv("NERV_LIVE_MODEL") or "",
"--cap-usd", os.getenv("NERV_LIVE_CAP_USD") or "",
"--small-model", os.getenv("NERV_LIVE_SMALL_MODEL") or "",
"--judge-model", os.getenv("NERV_LIVE_JUDGE_MODEL") or "",
"--send-synthetic", os.getenv("NERV_LIVE_SEND") or "no" }).ok,
"scripts/acceptance-live.sh failed")
end }
local STATUS = [[
for name in MEMBERS; do
git -C "$name" fetch -q origin 2>/dev/null
branch=$(git -C "$name" branch --show-current); [ -n "$branch" ] || branch=detached
printf '%-10s %-9s ahead %-3s behind %-3s changed %s\n' "$name" "$branch" \
"$(git -C "$name" rev-list --count '@{u}..HEAD' 2>/dev/null || echo -)" \
"$(git -C "$name" rev-list --count 'HEAD..@{u}' 2>/dev/null || echo -)" \
"$(git -C "$name" status --porcelain | wc -l)"
done
]]
make.recipe{ name = "status", desc = "each checkout: its branch, commits not pushed, changes not committed",
run = function() sh((STATUS:gsub("MEMBERS", table.concat(MEMBERS, " ")))) end }
make.alias("s", "status")
make.recipe{ name = "update", desc = "every checkout to the tip of develop",
run = function() sh("git submodule update --init --remote --merge") end }
-- Checked for all four before any is touched: a release or push that stops halfway leaves the
-- members disagreeing about what was shipped.
local function ready(what)
for _, name in ipairs(MEMBERS) do
local _, branch = captured(("git -C %s branch --show-current"):format(name))
local _, changed = captured(("git -C %s status --porcelain"):format(name))
assert(branch == "develop", ("%s is not on develop; nothing was %s"):format(name, what))
assert(changed == "", ("%s has uncommitted changes; nothing was %s"):format(name, what))
end
end
-- Pin here whatever the members now point at. Only after they are pushed: a pin to a commit GitHub
-- has never seen is a clone that fails for everybody but you.
local function pin()
local _, moved = captured("git diff --name-only -- " .. table.concat(MEMBERS, " "))
if moved == "" then
print("every pin is already where its checkout is")
return
end
local names = {}
for line in moved:gmatch("[^\n]+") do names[#names + 1] = line end
local listed = table.concat(names, " ")
sh(("git commit -q -m 'chore(pin): %s' -- %s"):format(table.concat(names, ", "), listed))
sh("git push -q origin HEAD")
end
make.recipe{
name = "push",
desc = "push each checkout's develop, then pin what was pushed here",
run = function()
ready("pushed")
for _, name in ipairs(MEMBERS) do
sh(("git -C %s push -q origin develop"):format(name))
end
pin()
end,
}
-- Each member's own `release`: a version, its changelog and tag, develop merged into main, and a
-- GitHub release. One after another, stopping at the first that fails, then pinned here.
make.recipe{
name = "release",
desc = "release every checkout: --type patch | minor | major | M.m.p, then pin",
params = { { "--type", desc = "patch | minor | major | M.m.p" } },
run = function(a)
assert(type(a.type) == "string",
"which release? make release --type patch|minor|major|M.m.p")
assert(a.type:match("^%a+$") or a.type:match("^%d+%.%d+%.%d+$"),
"--type is patch, minor, major or M.m.p")
checked_out()
ready("released")
for _, name in ipairs(MEMBERS) do
print(oslo.ui.title(("%s · make release --type %s"):format(name, a.type)))
assert(oslo.run{ "sh", "-c", ("cd %s && oslo make release --type %s"):format(name, a.type) }.ok,
("%s did not release; the ones before it did, and nothing is pinned yet"):format(name))
end
pin()
end,
}