Buckets:
| # Full pipeline E2E test using real corpus data. | |
| # Runs inside Docker container. Tests all 10 verification items. | |
| set -euo pipefail | |
| ROOT="/app" | |
| PROJECTS="/home/testuser/Projects" | |
| SCANNER="${ROOT}/src/scanner.sh" | |
| SCORER="${ROOT}/src/scorer.js" | |
| PLAN_GEN="${ROOT}/src/plan-generator.js" | |
| FIXER="${ROOT}/src/fixer.js" | |
| REPORTER="${ROOT}/src/reporter.js" | |
| pass=0 | |
| fail=0 | |
| total=0 | |
| check() { | |
| total=$((total + 1)) | |
| if eval "$2"; then | |
| pass=$((pass + 1)) | |
| printf 'PASS: %s\n' "$1" | |
| else | |
| fail=$((fail + 1)) | |
| printf 'FAIL: %s\n' "$1" | |
| fi | |
| } | |
| echo "=== AgentLint Docker E2E — Real Corpus Data ===" | |
| echo "" | |
| # 1. Prerequisites | |
| echo "--- 1. Prerequisites ---" | |
| check "jq available" "jq --version >/dev/null 2>&1" | |
| check "node available" "node --version >/dev/null 2>&1" | |
| check "git available" "git --version >/dev/null 2>&1" | |
| echo "" | |
| # 2. Scanner per-repo — all 15 repos produce valid JSONL, 0 crash | |
| echo "--- 2. Scanner: per-repo ---" | |
| scan_pass=0 | |
| scan_fail=0 | |
| for repo_dir in "${PROJECTS}"/*/; do | |
| [ -d "$repo_dir" ] || continue | |
| name="$(basename "$repo_dir")" | |
| output="$(bash "$SCANNER" --project-dir "$repo_dir" 2>/dev/null)" | |
| lines="$(printf '%s' "$output" | wc -l | tr -d '[:space:]')" | |
| # Verify valid JSONL | |
| valid=true | |
| while IFS= read -r line; do | |
| [ -z "$line" ] && continue | |
| if ! printf '%s' "$line" | jq -e . >/dev/null 2>&1; then | |
| valid=false | |
| break | |
| fi | |
| done <<< "$output" | |
| if [ "$valid" = true ] && [ "$lines" -ge 20 ]; then | |
| scan_pass=$((scan_pass + 1)) | |
| else | |
| scan_fail=$((scan_fail + 1)) | |
| printf ' FAIL: %s (%s lines, valid=%s)\n' "$name" "$lines" "$valid" | |
| fi | |
| # Save for later | |
| printf '%s' "$output" > "/tmp/scan-${name}.jsonl" | |
| done | |
| check "scanner: ${scan_pass} repos pass, 0 fail" "[ $scan_fail -eq 0 ]" | |
| echo "" | |
| # 3. Scorer — all produce valid JSON with total_score | |
| echo "--- 3. Scorer ---" | |
| score_pass=0 | |
| for repo_dir in "${PROJECTS}"/*/; do | |
| name="$(basename "$repo_dir")" | |
| [ -f "/tmp/scan-${name}.jsonl" ] || continue | |
| scored="$(node "$SCORER" "/tmp/scan-${name}.jsonl" 2>/dev/null)" | |
| ts="$(printf '%s' "$scored" | jq -r '.total_score' 2>/dev/null)" | |
| if [ -n "$ts" ] && [ "$ts" != "null" ]; then | |
| score_pass=$((score_pass + 1)) | |
| printf '%s' "$scored" > "/tmp/score-${name}.json" | |
| else | |
| printf ' FAIL: scorer on %s\n' "$name" | |
| fi | |
| done | |
| check "scorer: ${score_pass} repos scored" "[ $score_pass -ge 10 ]" | |
| echo "" | |
| # 4. Tier verification — A avg > B avg > C avg | |
| echo "--- 4. Tier verification ---" | |
| tier_result="$(node -e " | |
| const fs = require('fs'); | |
| const sel = JSON.parse(fs.readFileSync('${ROOT}/tests/docker-e2e/selected-repos.json')); | |
| const tiers = { A: [], B: [], C: [] }; | |
| for (const r of sel.repos) { | |
| const name = r.name.split('__').pop(); | |
| const scorePath = '/tmp/score-' + name + '.json'; | |
| if (!fs.existsSync(scorePath)) continue; | |
| const s = JSON.parse(fs.readFileSync(scorePath)); | |
| tiers[r.tier].push(s.total_score); | |
| } | |
| const avg = arr => arr.length ? arr.reduce((a,b)=>a+b,0)/arr.length : 0; | |
| const aAvg = avg(tiers.A), bAvg = avg(tiers.B), cAvg = avg(tiers.C); | |
| console.log('A=' + aAvg.toFixed(1) + ' B=' + bAvg.toFixed(1) + ' C=' + cAvg.toFixed(1)); | |
| // Key criterion: A+B clearly above C (gap > 20), not strict A > B | |
| // A vs B separation is inherently weak (both have entry files) | |
| const abAvg = (aAvg + bAvg) / 2; | |
| process.exit(abAvg > cAvg + 20 ? 0 : 1); | |
| " 2>&1)" | |
| tier_exit=$? | |
| check "tier separation (A+B)/2 vs C gap > 20: ${tier_result}" "[ $tier_exit -eq 0 ]" | |
| echo "" | |
| # 5. Plan generator — produces items | |
| echo "--- 5. Plan generator ---" | |
| # Use a Tier C repo (most fix items) | |
| tier_c_repo="" | |
| for repo_dir in "${PROJECTS}"/*/; do | |
| name="$(basename "$repo_dir")" | |
| [ -f "/tmp/score-${name}.json" ] || continue | |
| ts="$(jq '.total_score' "/tmp/score-${name}.json")" | |
| if [ "${ts:-100}" -lt 40 ]; then | |
| tier_c_repo="$name" | |
| break | |
| fi | |
| done | |
| if [ -n "$tier_c_repo" ]; then | |
| plan="$(node "$PLAN_GEN" "/tmp/score-${tier_c_repo}.json" 2>/dev/null)" | |
| items="$(printf '%s' "$plan" | jq '.total_items' 2>/dev/null)" | |
| check "plan generator: ${items} items for ${tier_c_repo}" "[ \"${items:-0}\" -ge 1 ]" | |
| printf '%s' "$plan" > "/tmp/plan-${tier_c_repo}.json" | |
| else | |
| printf 'SKIP: no Tier C repo for plan test\n' | |
| fi | |
| echo "" | |
| # 6. Fixer — create CLAUDE.md on a repo without one | |
| echo "--- 6. Fixer ---" | |
| fix_target="" | |
| for repo_dir in "${PROJECTS}"/*/; do | |
| [ ! -f "${repo_dir}/CLAUDE.md" ] && [ ! -f "${repo_dir}/AGENTS.md" ] && fix_target="$(basename "$repo_dir")" && break | |
| done | |
| if [ -n "$fix_target" ] && [ -f "/tmp/plan-${fix_target}.json" ]; then | |
| # Find F1 item in plan | |
| f1_id="$(jq -r '.items[] | select(.check_id=="F1") | .id // .check_id' "/tmp/plan-${fix_target}.json" 2>/dev/null | head -1)" | |
| if [ -n "$f1_id" ] && [ "$f1_id" != "null" ]; then | |
| node "$FIXER" "/tmp/plan-${fix_target}.json" --project-dir "${PROJECTS}/${fix_target}" --items "$f1_id" >/dev/null 2>&1 | |
| check "fixer: F1 created CLAUDE.md for ${fix_target}" "[ -f '${PROJECTS}/${fix_target}/CLAUDE.md' ]" | |
| else | |
| printf 'SKIP: no F1 item in plan for %s\n' "$fix_target" | |
| fi | |
| elif [ -n "$fix_target" ]; then | |
| # Generate plan for this repo | |
| plan="$(bash "$SCANNER" --project-dir "${PROJECTS}/${fix_target}" 2>/dev/null | node "$SCORER" 2>/dev/null | node "$PLAN_GEN" 2>/dev/null)" | |
| f1_id="$(printf '%s' "$plan" | jq -r '.items[] | select(.check_id=="F1") | .id // .check_id' 2>/dev/null | head -1)" | |
| if [ -n "$f1_id" ] && [ "$f1_id" != "null" ]; then | |
| printf '%s' "$plan" | node "$FIXER" --project-dir "${PROJECTS}/${fix_target}" --items "$f1_id" >/dev/null 2>&1 | |
| check "fixer: F1 created CLAUDE.md for ${fix_target}" "[ -f '${PROJECTS}/${fix_target}/CLAUDE.md' ]" | |
| else | |
| printf 'SKIP: no F1 fix item for %s\n' "$fix_target" | |
| fi | |
| else | |
| printf 'SKIP: all repos already have entry files\n' | |
| fi | |
| echo "" | |
| # 7. Fixer safety — only markdown files changed | |
| echo "--- 7. Fixer safety ---" | |
| if [ -n "$fix_target" ]; then | |
| non_md="$(git -C "${PROJECTS}/${fix_target}" diff --name-only 2>/dev/null | grep -cv '\.md$' | tr -d '[:space:]' || echo 0)" | |
| check "fixer safety: 0 non-markdown changes" "[ \"${non_md:-0}\" -eq 0 ]" | |
| else | |
| printf 'SKIP: no fixer test ran\n' | |
| fi | |
| echo "" | |
| # 8. Re-scan shows score improvement | |
| echo "--- 8. Post-fix rescan ---" | |
| if [ -n "$fix_target" ]; then | |
| old_score="$(jq '.total_score' "/tmp/score-${fix_target}.json" 2>/dev/null)" | |
| new_score="$(bash "$SCANNER" --project-dir "${PROJECTS}/${fix_target}" 2>/dev/null | node "$SCORER" 2>/dev/null | jq '.total_score')" | |
| check "rescan: score improved (${old_score} → ${new_score})" "[ \"${new_score:-0}\" -ge \"${old_score:-999}\" ]" | |
| else | |
| printf 'SKIP: no fix target\n' | |
| fi | |
| echo "" | |
| # 9. Reporter — 4 formats | |
| echo "--- 9. Reporter ---" | |
| # Pick any scored repo | |
| any_repo="" | |
| for f in /tmp/score-*.json; do [ -f "$f" ] && any_repo="$f" && break; done | |
| if [ -n "$any_repo" ]; then | |
| mkdir -p /tmp/reports | |
| node "$REPORTER" "$any_repo" --format terminal 2>/dev/null | head -3 >/dev/null | |
| check "reporter: terminal format" "node '$REPORTER' '$any_repo' --format terminal 2>/dev/null | head -1 | grep -q ''" | |
| node "$REPORTER" "$any_repo" --format md --output-dir /tmp/reports 2>/dev/null | |
| check "reporter: markdown format" "ls /tmp/reports/*.md >/dev/null 2>&1" | |
| node "$REPORTER" "$any_repo" --format jsonl --output-dir /tmp/reports 2>/dev/null | |
| check "reporter: jsonl format" "ls /tmp/reports/*.jsonl >/dev/null 2>&1" | |
| node "$REPORTER" "$any_repo" --format html --output-dir /tmp/reports 2>/dev/null | |
| check "reporter: html format" "ls /tmp/reports/*.html >/dev/null 2>&1" | |
| else | |
| printf 'SKIP: no scored repo for reporter\n' | |
| fi | |
| echo "" | |
| # 10. Error handling | |
| echo "--- 10. Error handling ---" | |
| check "error: nonexistent dir" "! bash '$SCANNER' --project-dir /nonexistent 2>/dev/null" | |
| check "error: empty input to scorer" "echo '' | node '$SCORER' 2>/dev/null | jq -e '.total_score == 0' >/dev/null" | |
| echo "" | |
| # Summary | |
| echo "=== Summary ===" | |
| echo "Total: ${total} Pass: ${pass} Fail: ${fail}" | |
| if [ "$fail" -gt 0 ]; then | |
| echo "RESULT: FAILED" | |
| exit 1 | |
| else | |
| echo "RESULT: ALL PASSED" | |
| exit 0 | |
| fi | |
Xet Storage Details
- Size:
- 8.12 kB
- Xet hash:
- 139ea6e5bbbb46d2f4efabeea4ba6e8283bfa6ccf05a108cb924b076bf365797
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.