Phase 4 โ AI code-check spike evaluation โ
Runbook for issue #210 (follow-up to #171, shipped in PR #205). Walks through the post-deploy evaluation cycle that drives the graduate / iterate / shelve decision.
Prerequisites โ
- PR #205 deployed to DEV (verify:
curl -s https://tutorial-system-dev-tutorials-srv.cfapps.eu10-005.hana.ondemand.com/health). cf loginto thetutorial-system / devspace.- 1-2 pilot authors lined up (each owning a
*-Contributionrepo).
1. Enable the flag in DEV โ
In /admin-ui/#joule-settings, set ChatSettings.codeCheckEnabled = true. (Or via cds query: see PR #205 ยง "Operator runbook" steps 3, 6, 7.)
2. Coordinate pilot tutorials โ
Choose 3+ steps total across 1-2 pilots (acceptance criterion is โฅ3 steps).
Pick code-heavy steps where the author has a clear reference solution.
Author adds
[CODECHECK_N]blocks per the spike spec ยง "rules.vr CODECHECK block".Trigger
rebuild-content.yml(full or per-slug). Confirm the mount div is published:bashcurl -s https://.../tutorials/<pilot-slug>/ | grep step-codecheck-mount
3. Generate JSONL skeleton per step โ
npx cds bind --exec -- node scripts/generate-codecheck-eval-skeleton.cjs \
--slug <pilot-slug> --step <n>The author edits scripts/sample-submissions/<slug>-step-<n>.jsonl to fill in the 30 code strings, using the per-row _hint for coverage guidance.
4. Run the eval harness per step โ
The harness POSTs each submission to /api/codecheck over HTTP โ same path an in-app learner hits. Mint a token first per QA channel bootstrap โ Mint a token (or paste a user JWT pulled from an interactive session).
CODECHECK_TOKEN=<bearer-token> \
CAP_BASE_URL=https://tutorial-system-dev-tutorials-srv.cfapps.eu10-005.hana.ondemand.com \
ALLOW_HYBRID_WRITES=true \
npx cds bind --exec -- node scripts/evaluate-code-check.js \
--slug <pilot-slug> --step <n> \
--submissions scripts/sample-submissions/<slug>-step-<n>.jsonl \
--output verdicts/<slug>-step-<n>.csvToken-cost telemetry (prompt_tokens, completion_tokens columns) is read from CodeCheckSubmissions via raw SQL through the bound HANA โ cds bind is still required even though grading itself runs over HTTP.
5. Author rates the CSV โ
Open verdicts/<slug>-step-<n>.csv in a sheet app. Add an agree column with values TRUE, FALSE, or PARTIAL per row. Save back to the same path.
Rule: treat PARTIAL as agree when either expected or actual is partial โ the spike's primary goal is the pass-vs-fail boundary.
6. Score โ
node scripts/score-codecheck-eval.js \
--csv verdicts/<slug>-step-<n>.csv \
--output verdicts/<slug>-step-<n>-scored.mdPrints a Markdown block with headline %, strict %, and a 3ร3 confusion matrix.
7. Pull telemetry once all steps are graded โ
npx cds bind --exec -- node scripts/pull-codecheck-telemetry.cjs \
--since <date-flag-was-flipped> \
--output verdicts/telemetry-summary.json(One-time, optional) Seed the three canned AnalyticsSavedQuery rows so ad-hoc poking in /analytics-ui/ reuses the same shape:
npx cds bind --exec -- node scripts/seed-codecheck-saved-queries.cjsThe seed script is idempotent on name โ re-running it skips existing rows unless you pass --force. It uses validator-safe aggregates only; real percentile latency stays exclusive to pull-codecheck-telemetry.cjs.
8. Fill the decision doc โ
- Open
docs/superpowers/specs/phase-4-codecheck-evaluation.md. - Paste each
*-scored.mdblock into the per-step section. - Paste
telemetry-summary.json's Markdown into the Cost & latency section. - Check the verdict box (graduate / iterate / shelve) per spec thresholds:
- โฅ80% headline โ graduate
- <80% but salvageable โ iterate (Approach C: RAG-then-grade)
- <60% โ shelve (retain code behind flag)
- Fill rationale in 3-4 sentences.
9. Comment + close โ
- Comment headline numbers + decision link on #171 and #210.
- Close #210 (with link to merged decision-doc PR).
- If the verdict is "graduate", #171 stays open with linked sub-issues.
- If "shelve", close #171 too โ code stays behind the flag.
Troubleshooting โ
- 401 on
/api/codecheckโ token expired; refresh withcf-bearer-token. - 503 on
/api/codecheckโ flag is off; re-checkChatSettings.codeCheckEnabled. - 0 CodeCheckSpecs returned by skeleton generator โ publish-content didn't ship sidecars for that slug; re-trigger
rebuild-content.yml. - HANA error on
PERCENTILE_CONTโ telemetry script targets HANA only. Running it with an in-memory SQLite binding fails. Use a realcf login+cds bind. - "Refusing to overwrite" from skeleton generator โ pass
--forceonly if the existing JSONL is intentionally being regenerated; half-curated content is otherwise destroyed.