diff --git a/.github/workflows/shell-tests.yml b/.github/workflows/shell-tests.yml index 9a7b8dd1..b70eb98e 100644 --- a/.github/workflows/shell-tests.yml +++ b/.github/workflows/shell-tests.yml @@ -60,9 +60,12 @@ jobs: # ptrace. Without these the trace file is never produced. options: --cap-add=SYS_PTRACE --security-opt seccomp=unconfined steps: - # base-devel ships neither git (actions/checkout needs it) nor strace. + # base-devel ships none of these: git (actions/checkout needs it), strace + # (execve counting), or jq (the claude_usage block parses its cache with + # it, and without jq that block degrades to "no data" and its assertions + # fail). - name: Install dependencies - run: pacman -Sy --noconfirm --needed git strace + run: pacman -Sy --noconfirm --needed git strace jq - uses: actions/checkout@v4 diff --git a/docs/superpowers/evidence/i3blocks-claude-usage-ci-jq-2026-08-10.json b/docs/superpowers/evidence/i3blocks-claude-usage-ci-jq-2026-08-10.json new file mode 100644 index 00000000..d260b002 --- /dev/null +++ b/docs/superpowers/evidence/i3blocks-claude-usage-ci-jq-2026-08-10.json @@ -0,0 +1,37 @@ +{ + "intent": "Make the claude_usage i3blocks tests pass on CI, where they failed because the Arch container had no jq.", + "scope": [ + ".github/workflows/shell-tests.yml (arch-tests container dependencies)", + "linux_configuration/tests/test_i3blocks_efficiency.sh (dependency probe)", + "Non-goal: changing claude_usage.sh runtime behaviour โ€” degrading to 'no data' without jq is correct" + ], + "changes": [ + "Install jq in the arch-tests container. archlinux:base-devel ships neither git, strace nor jq; the first two were already installed, and claude_usage.sh parses its cache with jq.", + "Guard the claude_usage test section on a working jq. The probe runs `printf '{}' | jq -e .` rather than `command -v jq`, because a jq that exists but cannot execute produces exactly the same 'no data' output as an absent one, and `command -v` would pass in that case." + ], + "verification": [ + { + "command": "bash linux_configuration/tests/test_i3blocks_efficiency.sh", + "result": "pass", + "evidence": "EXIT=0 with jq present." + }, + { + "command": "PATH= bash linux_configuration/tests/test_i3blocks_efficiency.sh", + "result": "pass", + "evidence": "Reports 'FAIL: a working jq is required for the claude_usage tests (pacman -S jq)' instead of the previous misleading \"expected '๐Ÿค– 5h 34% ยท 7d 55%', actual: '๐Ÿค– no data'\" โ€” the failure now names its real cause. Confirmed the earlier `command -v jq` form did NOT catch this case." + }, + { + "command": "reproduce CI failure locally", + "result": "pass", + "evidence": "Running claude_usage.sh with a failing jq on PATH reproduced the exact CI output '๐Ÿค– no data', confirming the missing dependency rather than a logic defect." + } + ], + "risks": [ + "Adds one package to the CI container install step, marginally increasing job setup time.", + "The guard makes a missing dependency a hard failure rather than a skip; that is intended, since silently skipping would hide the block's assertions entirely." + ], + "rollback": [ + "git revert the commit; CI returns to failing on the claude_usage assertions until jq is installed another way.", + "Validate with: gh run list --limit 3 after the next push." + ] +} diff --git a/linux_configuration/tests/test_i3blocks_efficiency.sh b/linux_configuration/tests/test_i3blocks_efficiency.sh index 760be74b..5303d24d 100755 --- a/linux_configuration/tests/test_i3blocks_efficiency.sh +++ b/linux_configuration/tests/test_i3blocks_efficiency.sh @@ -192,6 +192,14 @@ grep -Fq 'iface_path}/device' "$I3BLOCKS_DIR/ethernet.sh" \ || fail 'ethernet script should require a real device to skip virtual interfaces' printf 'Checking Claude usage block behavior and fork count...\n' +# claude_usage.sh parses its cache with jq and degrades to "no data" when jq is +# missing. That is the right runtime behaviour, but it would make every +# assertion below fail with a misleading message about percentages, so name the +# real cause instead of letting a missing tool look like a logic bug. +# Probe by running jq, not with `command -v`: a jq that exists but cannot +# execute produces exactly the same "no data" output as one that is absent. +printf '{}' | jq -e . >/dev/null 2>&1 \ + || fail 'a working jq is required for the claude_usage tests (pacman -S jq)' CLAUDE_STATE_DIR="$TMP_DIR/limit-state" mkdir -p "$CLAUDE_STATE_DIR" claude_now=1786366861