Files
time/.github/workflows/labs-aicharts.yml
T
teahubxyzandClaude 165d499644 labs/aicharts: fix model spelling drift, show the model's answer on failure (#37)
First live run: Workers AI answered specs the validator refused (agg spelling).
normalizeSpec fixes case and common aliases only; on a 422 the response
carries model_said (shown, never run). Smoke now fails on a bad spec.


Claude-Session: https://claude.ai/code/session_01VDkN7ukK1kXkqov8FaZxva

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-13 13:47:49 +00:00

38 lines
1.6 KiB
YAML

name: labs-aicharts
# Deploy the AICharts demo Worker (aicharts.<venture domain>, one D1, Workers AI), then smoke-test it. Manual only.
on: workflow_dispatch
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v5
with:
sparse-checkout: .github/time
- uses: actions/setup-node@v4
with:
node-version: 22
- run: node .github/time/labs/aicharts/test_aicharts.mjs
- id: deploy
run: |
set -o pipefail
python3 .github/time/labs/aicharts/deploy.py | tee out.json
echo "url=$(python3 -c 'import json; print(json.load(open("out.json"))["url"])')" >> "$GITHUB_OUTPUT"
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
TIME_VENTURE_DOMAIN: ${{ vars.TIME_VENTURE_DOMAIN }}
- name: smoke
run: |
set -o pipefail
u="${{ steps.deploy.outputs.url }}"
for i in $(seq 1 18); do curl -fsS "${u}api/health" && break; sleep 10; done
curl -fsS "${u}api/schema?dataset=orders" | python3 -c 'import json,sys; d=json.load(sys.stdin); assert len(d["sample"])==5, d; print("schema ok")'
curl -fsS -X POST "${u}api/spec" -H 'content-type: application/json' \
-d '{"dataset":"orders","prompt":"total revenue by region"}' | tee spec.json
echo
echo "### AICharts: ${u}" >> "$GITHUB_STEP_SUMMARY"
echo '```json' >> "$GITHUB_STEP_SUMMARY"; cat spec.json >> "$GITHUB_STEP_SUMMARY"; echo '```' >> "$GITHUB_STEP_SUMMARY"