Skip to content

fix(test): three integration-suite fixes — scaffold_identity probe, airc-shaped fake PID, honest e2e skip - #456

Merged
joelteply merged 1 commit into
canaryfrom
mac-vhsm/test-fixes-canary
May 4, 2026
Merged

joelteply merged 1 commit into
canaryfrom
mac-vhsm/test-fixes-canary

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Summary

Three test fixes surfaced from the canary→main CI run (#454). All three boil down to never swallow errors (Joel 2026-05-04 directive via Codex relay, mirroring CLAUDE.md global rule).

1. scaffold_identity — walk venvs, fail loud

Pre-fix invoked \${AIRC_PYTHON:-python3} -m airc_core.identity bootstrap-ed25519 ... 2>/dev/null. When system python3 lacks cryptography, the bootstrap silently fails → private.pem never written → downstream tests error with the opaque ed25519 sign failed: [Errno 2] No such file or directory: '.../private.pem'. Caller never told that the actual problem was a missing module.

Fixed: probe candidate venvs (the same resolution airc itself walks for AIRC_PYTHON), verify cryptography imports, fail loudly with explicit message if none qualify.

2. scenario_send_dead_monitor_dies live-pid control — airc-shaped fake

Pre-fix wrote $$ (the test harness's bash PID) to airc.pid for the negative control. Worked under bare kill -0 semantics; broke under #447's hardened cmdline-shape verification — bash test/integration.sh is correctly rejected as not airc-shaped (PID-reuse defense after sleep/wake).

Fixed: spawn ( exec -a "airc connect" sleep 60 ) &. The actual binary is sleep, but ps -o command= shows airc connect … and matches the /airc[[:space:]]+(connect|join)/ regex.

3. scenario_e2e_encryption — honest skip with the real reason

Pre-fix gated on $(dirname AIRC)/.venv-dev, which install.sh does not create (it creates .venv inside its install dest — typically $HOME/.airc-src). So this scenario silently skipped every CI run for an unrelated reason.

Fixing the venv detection then surfaces the deeper issue: this test was written when SSH was a registered bearer. Phase E / post-3c removed the SSH bearer entirely (bearer_resolver.available_kinds is gh + LocalBearer only); the test's @peer-name send path errors with no registered bearer can serve peer_meta={...host_target: 'user@host'...}, and the wire falls back to plaintext gh-substrate, defeating the "wire is ciphertext" assertion.

Until a real rewrite via the gh substrate lands, the right answer is skip with the loud honest reason, not silent-pass-by-skip. Original test body preserved verbatim below the return for the eventual rewriter's reference.

Test plan

  • bash test/integration.sh send_dead_monitor_dies — 8/8 pass locally
  • bash test/integration.sh e2e_encryption — clean skip with explicit message
  • No other scenarios broken (scaffold_identity is shared infrastructure but the candidate-walking is strictly an additive fallback chain)
  • CI clean-install matrix
  • CI integration-suite (after merge to canary)

Coordination

@airc-8a5e — these surfaced from the same canary→main bundle (#454) you and I have been iterating on. Honest-skip approach for #3 is intentional; the rewrite is real test debt for whoever takes it on next, not a one-line fix.

🤖 Generated with Claude Code

…ed fake + e2e_encryption honest skip

Three test fixes surfaced when canary→main CI ran the integration
suite. All three are about NOT swallowing errors (per Joel 2026-05-04
directive via Codex relay, mirroring CLAUDE.md "never swallow
errors"):

1. scaffold_identity walked `${AIRC_PYTHON:-python3}` and swallowed
   errors via `2>/dev/null`, so when system python3 lacked the
   `cryptography` module the bootstrap-ed25519 step silently failed
   to write private.pem. Downstream tests then errored with the
   opaque "ed25519 sign failed: [Errno 2] No such file or directory:
   '…/identity/private.pem'" — caller never told that cryptography
   was missing. Fix: probe candidate venvs (matching the same
   resolution airc itself walks for AIRC_PYTHON), let stderr through,
   fail loudly with explicit message if none have cryptography
   importable.

2. scenario_send_dead_monitor_dies's "live-pid" negative control
   wrote `$$` to airc.pid — the test harness's bash PID. Worked
   under bare `kill -0` semantics; broke under #447's hardened
   cmdline-shape verification (PID-reuse defense after sleep/wake).
   Fix: spawn an airc-SHAPED fake via `( exec -a "airc connect"
   sleep 60 ) &` — argv[0] now matches the
   /airc[[:space:]]+(connect|join)/ regex.
   _monitor_alive_with_bearer_fallback accepts it.

3. scenario_e2e_encryption gated on `$(dirname AIRC)/.venv-dev`,
   which install.sh does NOT create (install.sh creates `.venv`,
   inside its install dest — typically $HOME/.airc-src). Result:
   silently skipping every CI run despite the suite reporting "ran."
   Fixing the venv detection then surfaces the deeper issue: this
   scenario was written when SSH was a registered bearer; Phase E /
   post-3c removed it (`bearer_resolver.available_kinds` is gh +
   LocalBearer only), so the test's @peer-name send path errors with
   "no registered bearer can serve peer_meta=…" and the wire falls
   back to plaintext gh-substrate, defeating the "wire is ciphertext"
   assertion. Real fix is a rewrite via gh substrate; until then,
   skip with the actual reason in the message (loud skip, not silent
   pass-by-skip). Original test body preserved below `return` for
   the eventual rewriter's reference.

Local: send_dead_monitor_dies 8/8 pass; e2e_encryption skips with
explicit message; all other scenarios unaffected.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings May 4, 2026 17:02
@joelteply
joelteply merged commit dfc6dee into canary May 4, 2026
8 checks passed
@joelteply
joelteply deleted the mac-vhsm/test-fixes-canary branch May 4, 2026 17:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses three integration-suite reliability issues discovered in the canary→main CI flow by making test infrastructure fail loudly (instead of silently masking root causes), updating a negative-control PID to satisfy newer “airc-shaped” liveness checks, and converting a permanently-broken e2e encryption scenario into an explicit, honest skip.

Changes:

  • scaffold_identity: probe for a usable Python interpreter with cryptography available, and stop suppressing bootstrap errors so missing deps are diagnosable.
  • scenario_send_dead_monitor_dies: replace $$ with an “airc connect”-shaped fake process for the pidfile negative control under hardened PID cmdline verification.
  • scenario_e2e_encryption: convert a silently-skipped scenario into an explicit skip with a clear rationale; preserve legacy test body below an early return.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/integration.sh
Comment on lines +301 to +309
local _py=""
for _candidate in \
"${AIRC_PYTHON:-}" \
"$HOME/.airc-src/.venv/bin/python" \
"$HOME/.airc-src/.venv/bin/python3" \
"$(cd "$(dirname "$AIRC")" && pwd)/.venv/bin/python" \
"$(cd "$(dirname "$AIRC")" && pwd)/.venv/bin/python3" \
"$(command -v python3 || true)"; do
[ -n "$_candidate" ] && [ -x "$_candidate" ] || continue
Comment thread test/integration.sh
grep -q 'live monitor probe ascii' "$home/messages.jsonl" \
&& pass "live-pid scope: message appended to local log as expected" \
|| fail "live-pid scope: message NOT in log despite rc=0 (log=$(cat "$home/messages.jsonl" 2>/dev/null))"
kill "$fake_airc_pid" 2>/dev/null || true
Comment thread test/integration.sh
Comment on lines 3891 to +3894
section "e2e encryption: wire is ciphertext, receiver decrypts to plaintext"
echo " (skipped — test uses removed SSH-bearer transport path; needs rewrite to verify envelope encryption via gh substrate. Tracking: airc Phase E test debt.)"
return

Comment thread test/integration.sh
Comment on lines +3893 to 3899
return

# ── Below is the original SSH-bearer-based test, kept for context
# ── on the rewrite (preserved verbatim).

local _venv="$(cd "$(dirname "$AIRC")" && pwd)/.venv-dev"
if [ ! -x "$_venv/bin/python" ] && [ ! -x "$_venv/bin/python3" ]; then
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants