forked from AI45Lab/Code
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathjustfile
More file actions
672 lines (570 loc) · 27.5 KB
/
Copy pathjustfile
File metadata and controls
672 lines (570 loc) · 27.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
# A3S Code - Justfile
default:
@just --list
# ============================================================================
# Build
# ============================================================================
# Build the project
build:
cargo build --workspace
# Build release
release:
cargo build --workspace --release
# ============================================================================
# Test (unified command with progress display)
# ============================================================================
# Run all tests with progress display and module breakdown
test:
#!/usr/bin/env bash
set -e
# Colors
BOLD='\033[1m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
YELLOW='\033[0;33m'
RED='\033[0;31m'
DIM='\033[2m'
RESET='\033[0m'
# Counters
TOTAL_PASSED=0
TOTAL_FAILED=0
TOTAL_IGNORED=0
print_header() {
echo ""
echo -e "${BOLD}${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
echo -e "${BOLD} $1${RESET}"
echo -e "${BOLD}${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
}
# Extract module test counts from cargo test output
extract_module_counts() {
local output="$1"
echo "$output" | grep -E "^test .+::.+ \.\.\. ok$" | \
sed 's/^test \([^:]*\)::.*/\1/' | \
sort | uniq -c | sort -rn | \
while read count module; do
printf " ${DIM}%-20s %3d tests${RESET}\n" "$module" "$count"
done
}
run_crate_tests() {
local crate_name="$1"
local display_name="$2"
echo -ne "${CYAN}▶${RESET} ${BOLD}${display_name}${RESET} "
if OUTPUT=$(cargo test -p "$crate_name" 2>&1); then
TEST_EXIT=0
else
TEST_EXIT=1
fi
RESULT_LINES=$(echo "$OUTPUT" | grep -E "^test result:" || true)
if [ -n "$RESULT_LINES" ]; then
PASSED=$(echo "$RESULT_LINES" | grep -oE '[0-9]+ passed' | grep -oE '[0-9]+' | awk '{ total += $1 } END { print total + 0 }')
FAILED=$(echo "$RESULT_LINES" | grep -oE '[0-9]+ failed' | grep -oE '[0-9]+' | awk '{ total += $1 } END { print total + 0 }')
IGNORED=$(echo "$RESULT_LINES" | grep -oE '[0-9]+ ignored' | grep -oE '[0-9]+' | awk '{ total += $1 } END { print total + 0 }')
TOTAL_PASSED=$((TOTAL_PASSED + PASSED))
TOTAL_FAILED=$((TOTAL_FAILED + FAILED))
TOTAL_IGNORED=$((TOTAL_IGNORED + IGNORED))
if [ "$FAILED" -gt 0 ]; then
echo -e "${RED}✗${RESET} ${DIM}$PASSED passed, $FAILED failed${RESET}"
echo "$OUTPUT" | grep -E "^test .* FAILED$" | sed 's/^/ /'
else
echo -e "${GREEN}✓${RESET} ${DIM}$PASSED passed${RESET}"
if [ "$PASSED" -gt 10 ]; then
extract_module_counts "$OUTPUT"
fi
fi
else
if echo "$OUTPUT" | grep -q "error\[E"; then
echo -e "${RED}✗${RESET} ${DIM}compile error${RESET}"
echo "$OUTPUT" | grep -E "^error" | head -3 | sed 's/^/ /'
elif [ "$TEST_EXIT" -ne 0 ]; then
echo -e "${RED}✗${RESET} ${DIM}failed${RESET}"
else
echo -e "${YELLOW}○${RESET} ${DIM}no tests${RESET}"
fi
fi
}
print_header "🧪 A3S Code Test Suite"
echo ""
run_crate_tests "a3s-code-core" "a3s-code-core"
# Summary
echo ""
echo -e "${BOLD}${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
if [ "$TOTAL_FAILED" -gt 0 ]; then
echo -e " ${RED}${BOLD}✗ FAILED${RESET} ${GREEN}$TOTAL_PASSED passed${RESET} ${RED}$TOTAL_FAILED failed${RESET} ${YELLOW}$TOTAL_IGNORED ignored${RESET}"
echo -e "${BOLD}${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
exit 1
else
echo -e " ${GREEN}${BOLD}✓ PASSED${RESET} ${GREEN}$TOTAL_PASSED passed${RESET} ${YELLOW}$TOTAL_IGNORED ignored${RESET}"
echo -e "${BOLD}${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
fi
echo ""
# Run tests without progress (raw cargo output)
test-raw:
cargo test --workspace
# Run tests with verbose output
test-v:
cargo test --workspace -- --nocapture
# ============================================================================
# Test Subsets
# ============================================================================
# Run core tests only
test-core:
cargo test -p a3s-code-core --lib
# Run queue and HITL tests
test-queue:
cargo test -p a3s-code-core --lib -- queue::tests hitl::tests
# Run queue tests only
test-queue-only:
cargo test -p a3s-code-core --lib -- queue::tests
# Run HITL tests only (hitl module)
test-hitl:
cargo test -p a3s-code-core --lib -- hitl::tests
# Run HITL tests in agent loop (agent module)
test-agent-hitl:
cargo test -p a3s-code-core --lib -- agent::tests::test_agent_hitl
# Run all HITL-related tests (hitl + agent)
test-hitl-all:
cargo test -p a3s-code-core --lib -- hitl::tests agent::tests::test_agent_hitl
# Run session tests (includes queue/HITL integration)
test-session:
cargo test -p a3s-code-core --lib -- session::tests
# Run agent tests
test-agent:
cargo test -p a3s-code-core --lib -- agent::tests
# Run context provider tests
test-context:
cargo test -p a3s-code-core --lib -- test_context test_agent_context test_session_context
# ============================================================================
# Coverage (requires: cargo install cargo-llvm-cov, brew install lcov)
# F-table kernel line coverage (integration-bearing). Default gate ≥95%.
# Evidence: $A3S_F_TABLE_EVIDENCE/FINAL.txt → ALL_F_TABLE_KERNELS_GE_95
f-table-cov:
#!/usr/bin/env bash
set -euo pipefail
export A3S_F_TABLE_MIN_LINE_PCT="${A3S_F_TABLE_MIN_LINE_PCT:-95}"
export A3S_F_TABLE_EVIDENCE="${A3S_F_TABLE_EVIDENCE:-/tmp/a3s-llvm-cov-f${A3S_F_TABLE_MIN_LINE_PCT}}"
scripts/f_table_coverage.sh
# ============================================================================
# Test with coverage - shows real-time test progress + module coverage
test-cov:
#!/usr/bin/env bash
set -e
# Colors
BOLD='\033[1m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
YELLOW='\033[0;33m'
RED='\033[0;31m'
DIM='\033[2m'
RESET='\033[0m'
CLEAR_LINE='\033[2K'
print_header() {
echo ""
echo -e "${BOLD}${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
echo -e "${BOLD} $1${RESET}"
echo -e "${BOLD}${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
}
print_header "🧪 A3S Code Test Suite with Coverage"
echo ""
echo -e "${CYAN}▶${RESET} ${BOLD}a3s-code-core${RESET}"
echo ""
tmp_dir="/tmp/test_cov_code_$$"
mkdir -p "$tmp_dir"
touch "$tmp_dir/module_counts"
{
cargo llvm-cov --workspace --lib 2>&1
} | {
total_passed=0
total_failed=0
while IFS= read -r line; do
if [[ "$line" =~ ^test\ ([a-z_]+)::.*\.\.\.\ (ok|FAILED)$ ]]; then
module="${BASH_REMATCH[1]}"
result="${BASH_REMATCH[2]}"
if [ "$result" = "ok" ]; then
total_passed=$((total_passed + 1))
count=$(grep "^${module} " "$tmp_dir/module_counts" 2>/dev/null | awk '{print $2}' || echo "0")
count=$((count + 1))
grep -v "^${module} " "$tmp_dir/module_counts" > "$tmp_dir/module_counts.tmp" 2>/dev/null || true
echo "$module $count" >> "$tmp_dir/module_counts.tmp"
mv "$tmp_dir/module_counts.tmp" "$tmp_dir/module_counts"
else
total_failed=$((total_failed + 1))
fi
echo -ne "\r${CLEAR_LINE} ${DIM}Running:${RESET} ${module}::... ${GREEN}${total_passed}${RESET} passed"
[ "$total_failed" -gt 0 ] && echo -ne " ${RED}${total_failed}${RESET} failed"
elif [[ "$line" =~ ^[[:space:]]*Compiling ]]; then
echo -ne "\r${CLEAR_LINE} ${DIM}Compiling...${RESET}"
elif [[ "$line" =~ ^[[:space:]]*Running ]]; then
echo -ne "\r${CLEAR_LINE} ${DIM}Running tests...${RESET}"
elif [[ "$line" =~ ^[a-z_]+.*\.rs[[:space:]] ]]; then
echo "$line" >> "$tmp_dir/coverage_lines"
elif [[ "$line" =~ ^TOTAL ]]; then
echo "$line" >> "$tmp_dir/total_line"
fi
done
echo "$total_passed" > "$tmp_dir/total_passed"
echo "$total_failed" > "$tmp_dir/total_failed"
}
echo -ne "\r${CLEAR_LINE}"
total_passed=$(cat "$tmp_dir/total_passed" 2>/dev/null || echo "0")
total_failed=$(cat "$tmp_dir/total_failed" 2>/dev/null || echo "0")
if [ "$total_failed" -gt 0 ]; then
echo -e " ${RED}✗${RESET} ${total_passed} passed, ${RED}${total_failed} failed${RESET}"
else
echo -e " ${GREEN}✓${RESET} ${total_passed} tests passed"
fi
echo ""
if [ -f "$tmp_dir/coverage_lines" ]; then
awk '
{
file=$1; lines=$8; missed=$9
n = split(file, parts, "/")
if (n > 1) {
module = parts[1]
} else {
gsub(/\.rs$/, "", file)
module = file
}
total_lines[module] += lines
total_missed[module] += missed
}
END {
for (m in total_lines) {
if (total_lines[m] > 0) {
covered = total_lines[m] - total_missed[m]
pct = (covered / total_lines[m]) * 100
printf "%s %.1f %d\n", m, pct, total_lines[m]
}
}
}' "$tmp_dir/coverage_lines" | sort -t' ' -k2 -rn > "$tmp_dir/cov_agg"
echo -e " ${BOLD}Module Tests Coverage${RESET}"
echo -e " ${DIM}──────────────────────────────────────────────${RESET}"
while read module pct lines; do
tests=$(grep "^${module} " "$tmp_dir/module_counts" 2>/dev/null | awk '{print $2}' || echo "0")
[ -z "$tests" ] && tests=0
num=${pct%.*}
if [ "$num" -ge 90 ]; then
cov_color="${GREEN}${pct}%${RESET}"
elif [ "$num" -ge 70 ]; then
cov_color="${YELLOW}${pct}%${RESET}"
else
cov_color="${RED}${pct}%${RESET}"
fi
echo -e " $(printf '%-18s' "$module") $(printf '%4d' "$tests") ${cov_color} ${DIM}($lines lines)${RESET}"
done < "$tmp_dir/cov_agg"
if [ -f "$tmp_dir/total_line" ]; then
total_cov=$(cat "$tmp_dir/total_line" | awk '{print $4}' | tr -d '%')
total_lines=$(cat "$tmp_dir/total_line" | awk '{print $8}')
echo -e " ${DIM}──────────────────────────────────────────────${RESET}"
num=${total_cov%.*}
if [ "$num" -ge 90 ]; then
cov_color="${GREEN}${BOLD}${total_cov}%${RESET}"
elif [ "$num" -ge 70 ]; then
cov_color="${YELLOW}${BOLD}${total_cov}%${RESET}"
else
cov_color="${RED}${BOLD}${total_cov}%${RESET}"
fi
echo -e " ${BOLD}$(printf '%-18s' "TOTAL") $(printf '%4d' "$total_passed")${RESET} ${cov_color} ${DIM}($total_lines lines)${RESET}"
fi
fi
rm -rf "$tmp_dir"
echo ""
echo -e "${BOLD}${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
echo ""
# Coverage with pretty terminal output
cov:
#!/usr/bin/env bash
set -e
COV_FILE="/tmp/a3s-code-coverage.lcov"
echo "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓"
echo "┃ 🧪 Running Tests with Coverage ┃"
echo "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛"
cargo llvm-cov --workspace --lib --lcov --output-path "$COV_FILE" 2>&1 | grep -E "^test result"
echo ""
echo "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓"
echo "┃ 📊 Coverage Report ┃"
echo "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛"
lcov --summary "$COV_FILE" 2>&1
rm -f "$COV_FILE"
# Coverage for specific module
cov-module MOD:
cargo llvm-cov -p a3s-code-core --lib -- {{MOD}}::
# Coverage with HTML report (opens in browser)
cov-html:
cargo llvm-cov --workspace --lib --html --open
# Coverage with detailed file-by-file table
cov-table:
cargo llvm-cov --workspace --lib
# Coverage for CI (generates lcov.info)
cov-ci:
cargo llvm-cov --workspace --lib --lcov --output-path lcov.info
# ============================================================================
# Code Quality
# ============================================================================
# Format code
fmt:
cargo fmt --all
# Lint (clippy)
lint:
cargo clippy --workspace --all-targets -- -D warnings
# CI checks (fmt + lint + test)
ci:
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace
cargo test --workspace --all-features --lib
# ============================================================================
# Utilities
# ============================================================================
# Clean build artifacts
clean:
cargo clean
# Check project (fast compile check)
check:
cargo check --workspace
# Watch and rebuild
watch:
cargo watch -x 'build --workspace'
# Generate docs
doc:
cargo doc --workspace --no-deps --open
# ============================================================================
# Publish
# ============================================================================
# Publish a3s-code-core to crates.io
publish:
#!/usr/bin/env bash
set -e
BOLD='\033[1m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
RED='\033[0;31m'
DIM='\033[2m'
RESET='\033[0m'
print_step() { echo -e "${BLUE}▶${RESET} ${BOLD}$1${RESET}"; }
print_success() { echo -e "${GREEN}✓${RESET} $1"; }
print_error() { echo -e "${RED}✗${RESET} $1"; exit 1; }
echo ""
echo -e "${BOLD}${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
echo -e "${BOLD} 📦 Publishing a3s-code-core to crates.io${RESET}"
echo -e "${BOLD}${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
echo ""
CORE_VERSION=$(grep '^version' core/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
echo -e " ${DIM}a3s-code-core:${RESET} ${BOLD}${CORE_VERSION}${RESET}"
echo ""
print_step "Checking version sync..."
just check-versions || { print_error "Version mismatch. Run 'just bump-version <version>' to fix."; }
print_step "Checking formatting..."
cargo fmt --all -- --check && print_success "Formatting OK" || print_error "Run 'just fmt' first."
print_step "Running clippy..."
cargo clippy --workspace --all-targets -- -D warnings && print_success "Clippy OK" || print_error "Fix warnings first."
print_step "Running tests..."
cargo test --workspace --lib && print_success "Tests OK" || print_error "Tests failed."
print_step "Publishing a3s-code-core..."
cargo publish -p a3s-code-core && print_success "a3s-code-core published" || print_error "Failed to publish core."
echo ""
echo -e "${BOLD}${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
echo -e " ${GREEN}${BOLD}✓ Published a3s-code-core v${CORE_VERSION}${RESET}"
echo -e "${BOLD}${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
echo ""
# Publish dry-run (verify without publishing)
publish-dry:
cargo publish -p a3s-code-core --dry-run
# Show current version of all packages
version:
#!/usr/bin/env bash
CANONICAL=$(grep '^version' core/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
echo "core/Cargo.toml ${CANONICAL}"
echo "sdk/node/Cargo.toml $(grep '^version' sdk/node/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')"
echo "sdk/node/package.json $(grep '"version"' sdk/node/package.json | head -1 | sed 's/.*"\([0-9.]*\)".*/\1/')"
echo "sdk/python/Cargo.toml $(grep '^version' sdk/python/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')"
echo "sdk/python/pyproject.toml $(grep '^version' sdk/python/pyproject.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')"
# Check all package version files are in sync with core/Cargo.toml
check-versions:
#!/usr/bin/env bash
set -e
GREEN='\033[0;32m'
RED='\033[0;31m'
BOLD='\033[1m'
DIM='\033[2m'
RESET='\033[0m'
CANONICAL=$(grep '^version' core/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
echo ""
echo -e "${BOLD}Version sync check — canonical: ${CANONICAL}${RESET}"
echo ""
FAIL=0
check() {
local label="$1"
local actual="$2"
if [ "$actual" = "$CANONICAL" ]; then
echo -e " ${GREEN}✓${RESET} $(printf '%-35s' "$label") ${DIM}${actual}${RESET}"
else
echo -e " ${RED}✗${RESET} $(printf '%-35s' "$label") ${RED}${actual}${RESET} ← expected ${CANONICAL}"
FAIL=1
fi
}
check "core/Cargo.toml" "$(grep '^version' core/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')"
check "sdk/node/Cargo.toml" "$(grep '^version' sdk/node/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')"
check "sdk/node/package.json" "$(grep '"version"' sdk/node/package.json | head -1 | sed 's/.*"\([0-9.]*\)".*/\1/')"
check "sdk/python/Cargo.toml" "$(grep '^version' sdk/python/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')"
check "sdk/python/pyproject.toml" "$(grep '^version' sdk/python/pyproject.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')"
echo ""
if [ "$FAIL" -ne 0 ]; then
echo -e " ${RED}${BOLD}Version mismatch detected. Run 'just bump-version <version>' to sync all files.${RESET}"
echo ""
exit 1
else
echo -e " ${GREEN}${BOLD}All versions in sync ✓${RESET}"
echo ""
fi
# Bump version across all package files atomically
bump-version VERSION:
#!/usr/bin/env bash
set -e
GREEN='\033[0;32m'
BOLD='\033[1m'
DIM='\033[2m'
RESET='\033[0m'
V="{{VERSION}}"
echo ""
echo -e "${BOLD}Bumping all packages to ${V}${RESET}"
echo ""
bump_toml() {
local file="$1"
sed -i.bak "s/^version = \".*\"/version = \"${V}\"/" "$file" && rm -f "${file}.bak"
echo -e " ${GREEN}✓${RESET} ${DIM}${file}${RESET}"
}
bump_json() {
local file="$1"
sed -i.bak "s/\"version\": \".*\"/\"version\": \"${V}\"/" "$file" && rm -f "${file}.bak"
echo -e " ${GREEN}✓${RESET} ${DIM}${file}${RESET}"
}
bump_toml core/Cargo.toml
bump_toml sdk/node/Cargo.toml
bump_json sdk/node/package.json
bump_toml sdk/python/Cargo.toml
bump_toml sdk/python/pyproject.toml
echo ""
just check-versions
# ============================================================================
# Harness convergence wrap-up
# ============================================================================
# Thin default + local-code CI matrix used by HARNESS-CONV5/CONV7 wrap-up
harness-convergence-check:
#!/usr/bin/env bash
set -euo pipefail
cargo check -p a3s-code-core
if cargo tree -p a3s-code-core -e normal | rg -i 'evaluation|research|chromiumoxide|aws-sdk-s3'; then
echo "default Core tree must not pull Advanced/server stacks" >&2
exit 1
fi
cargo check -p a3s-code-core --no-default-features --features local-code
cargo test -p a3s-code-core --no-default-features --features local-code --lib
cargo test -p a3s-code-core --lib parallel_task -- --nocapture
cargo test -p a3s-code-core --lib candidate_write_stays_inactive -- --nocapture
node scripts/sdk_api_alignment_check.mjs
# Full Layer C live E2E against monorepo `.a3s/config.acl` (serial; quota + network).
# Evidence dir: set A3S_LAYER_C_EVIDENCE or defaults to /tmp/a3s-layer-c-live.
# Pins A3S_TEST_MODEL to boyue/deepseek-v4-flash unless already set.
layer-c-live-e2e:
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
# Prefer monorepo root config when invoked from crates/code submodule.
if [[ -f "${ROOT}/../../.a3s/config.acl" ]]; then
CONFIG="$(cd "${ROOT}/../.." && pwd)/.a3s/config.acl"
elif [[ -f "${ROOT}/.a3s/config.acl" ]]; then
CONFIG="${ROOT}/.a3s/config.acl"
else
CONFIG="${A3S_CONFIG_FILE:?set A3S_CONFIG_FILE to an ACL with boyue Flash}"
fi
EVIDENCE="${A3S_LAYER_C_EVIDENCE:-/tmp/a3s-layer-c-live}"
mkdir -p "${EVIDENCE}"
: >"${EVIDENCE}/summary.txt"
export A3S_CONFIG_FILE="${CONFIG}"
export A3S_TEST_MODEL="${A3S_TEST_MODEL:-boyue/deepseek-v4-flash}"
# Linux native sandbox masks $HOME; nvm/fnm toolchains must be re-allowed
# via NVM_DIR/FNM_DIR (see a3s-sandbox readable_tool_paths) or `node` is
# invisible inside bwrap and long-horizon bash verification stays exit 1.
if [[ -z "${NVM_DIR:-}" && -d "${HOME}/.nvm" ]]; then
export NVM_DIR="${HOME}/.nvm"
fi
if [[ -n "${NVM_DIR:-}" && -d "${NVM_DIR}/versions/node" ]]; then
node_bin="$(ls -d "${NVM_DIR}"/versions/node/*/bin 2>/dev/null | sort -V | tail -n1 || true)"
if [[ -n "${node_bin}" ]]; then
export PATH="${node_bin}:${PATH}"
fi
fi
echo "A3S_CONFIG_FILE=${A3S_CONFIG_FILE}" | tee "${EVIDENCE}/env.txt"
echo "A3S_TEST_MODEL=${A3S_TEST_MODEL}" | tee -a "${EVIDENCE}/env.txt"
echo "NVM_DIR=${NVM_DIR:-}" | tee -a "${EVIDENCE}/env.txt"
rg -n '^default_model' "${A3S_CONFIG_FILE}" | tee -a "${EVIDENCE}/env.txt"
rg -n 'deepseek-v4-flash' "${A3S_CONFIG_FILE}" | head -5 | tee -a "${EVIDENCE}/env.txt"
suites=(
test_native_sandbox_live_e2e
test_issue_fix_live_e2e
test_agent_protocol_live_e2e
test_harness_loop_live_e2e
test_fact_log_real_llm
test_complex_capability_live_e2e
test_harness_capabilities_live_e2e
test_meta_harness_compose_live_e2e
test_deepseek_adversarial_e2e
test_update_plan_live_e2e
test_prompt_capability_real_llm
test_orchestration_real_llm
test_long_horizon_real_llm
test_structured_json_real_llm
test_run_control_real_llm
test_workspace_search_real_llm
test_workspace_retrieval_real_llm
test_context_tools_real_llm
test_workflow_facade_real_llm
test_auto_delegation_real_parallel
test_ultracode_discretion_real_llm
test_real_config_env_integration
test_real_llm_cluster_features
test_memory_store_real_llm
)
fail=0
run_suite() {
local suite="$1" features="$2"
local feature_flags=()
if [[ -n "${features}" ]]; then
feature_flags=(--features "${features}")
fi
echo "=== ${suite} ===" | tee -a "${EVIDENCE}/summary.txt"
if cargo test -p a3s-code-core ${feature_flags[@]+"${feature_flags[@]}"} --test "${suite}" -- --ignored --test-threads=1 --nocapture \
>"${EVIDENCE}/${suite}.log" 2>&1; then
echo "PASS ${suite}" | tee -a "${EVIDENCE}/summary.txt"
return 0
fi
echo "FAIL ${suite}" | tee -a "${EVIDENCE}/summary.txt"
# One bounded retry: a single live-model turn may answer outside the
# shape a suite pins (temperature 0 does not fix model variance). A
# suite that fails twice is a real regression, not variance.
echo "RETRY ${suite} (attempt 2 of 2)" | tee -a "${EVIDENCE}/summary.txt"
if cargo test -p a3s-code-core ${feature_flags[@]+"${feature_flags[@]}"} --test "${suite}" -- --ignored --test-threads=1 --nocapture \
>>"${EVIDENCE}/${suite}.log" 2>&1; then
echo "PASS ${suite} (rerun)" | tee -a "${EVIDENCE}/summary.txt"
return 0
fi
echo "FAIL ${suite} (rerun)" | tee -a "${EVIDENCE}/summary.txt"
return 1
}
for suite in "${suites[@]}"; do
run_suite "${suite}" "" || fail=1
rg -n 'test result:|using default_model=|pinning default_model|RETRY ' "${EVIDENCE}/${suite}.log" | tail -8 | tee -a "${EVIDENCE}/summary.txt" || true
done
# Feature-gated live suites (optional when features compile).
if cargo test -p a3s-code-core --features advanced-harness --test test_extensibility_real_llm -- --list >/dev/null 2>&1; then
run_suite test_extensibility_real_llm advanced-harness || fail=1
rg -n 'test result:|using default_model=|RETRY ' "${EVIDENCE}/test_extensibility_real_llm.log" | tail -8 | tee -a "${EVIDENCE}/summary.txt" || true
fi
if [[ "${fail}" -eq 0 ]]; then
echo "LAYER_C_PASS model=${A3S_TEST_MODEL}" | tee "${EVIDENCE}/FINAL.txt"
else
echo "LAYER_C_FAIL model=${A3S_TEST_MODEL}" | tee "${EVIDENCE}/FINAL.txt"
fi
exit "${fail}"