Skip to content

test: scenario_bounce + scenario_two_tab_localhost - #111

Merged
joelteply merged 1 commit into
canaryfrom
test/bounce-and-two-tab-localhost
Apr 25, 2026
Merged

joelteply merged 1 commit into
canaryfrom
test/bounce-and-two-tab-localhost

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Two scenarios covering the real-user bugs from today: bounce-orphan accumulation (caught by #110) and multi-address localhost selection (caught by #109). Both use real gh; both pass on this Mac.

Two new integration scenarios catching real user-encountered bugs the
existing tests missed:

scenario_bounce — host → teardown → host. Verifies the teardown gist
cleanup (#110) actually fires, AND that round-2 publishes a fresh gist
without leaving an orphan from round 1. Catches the bounce-orphan
class. Pre-#110: this would have failed with two competing gists.

scenario_two_tab_localhost — A hosts, B joins via discovery, asserts
B picked 127.0.0.1 (multi-address machine_id match) NOT the LAN or
Tailscale IP. Catches multi-address regression. Pre-#109: this would
have failed because B would have used whatever single address A
advertised in the legacy host.address field.

Both require gh + auth, skipped if unavailable. Both run quick
(~10-15s each) since they use real gh round-trips but small data.

Joel: "how are integration tests not actually able to test my
scenario?" — they couldn't, because the existing scenarios all use
--no-gist (sidesteps the actual gh substrate code path) and only
spawn one joiner (no concurrent / lifecycle coverage). These two
scenarios use the real gh path and exercise the lifecycle edges.

Windows parity: still NONE. test/integration.sh is bash-only. A
matching test/integration.ps1 with PS-native commands is needed for
Windows users to verify their install. Tracked but not in this PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings April 25, 2026 22:36
@joelteply
joelteply merged commit 4eb66a1 into canary Apr 25, 2026
@joelteply
joelteply deleted the test/bounce-and-two-tab-localhost branch April 25, 2026 22:36

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

Adds two new end-to-end integration scenarios to test/integration.sh to cover recent real-user regressions around (1) gist orphan accumulation after bounce/teardown and (2) same-machine multi-address selection preferring localhost.

Changes:

  • Add scenario_bounce to verify airc teardown deletes the hosted room gist (no orphan buildup across host restarts).
  • Add scenario_two_tab_localhost to verify gist envelope propagation (host.machine_id, host.addresses[]) and that joiners pick 127.0.0.1 on same-machine joins.
  • Wire both scenarios into the mode dispatcher and include them in the all run.

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

Comment thread test/integration.sh
scenario_bounce() {
section "bounce: teardown deletes hosted gist (no orphan accumulation)"

if ! command -v gh >/dev/null 2>&1 || ! gh auth status >/dev/null 2>&1; then

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

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

The skip guard combines command -v gh and gh auth status but the message only says "gh not authed". If gh isn’t installed, this will report the wrong reason; consider splitting the checks (like scenario_heartbeat) so the skip output is accurate and actionable.

Suggested change
if ! command -v gh >/dev/null 2>&1 || ! gh auth status >/dev/null 2>&1; then
if ! command -v gh >/dev/null 2>&1; then
echo " (skipped — gh not installed)"
return
fi
if ! gh auth status >/dev/null 2>&1; then

Copilot uses AI. Check for mistakes.
Comment thread test/integration.sh
Comment on lines +1643 to +1646
if ! command -v gh >/dev/null 2>&1 || ! gh auth status >/dev/null 2>&1; then
echo " (skipped — gh not authed)"
return
fi

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

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

scenario_two_tab_localhost uses jq to parse the gist envelope, but it doesn’t skip when jq isn’t installed. On machines without jq, this scenario will fail instead of skipping; add a command -v jq guard (and ideally distinguish between "gh missing" vs "gh not authed" in the skip message as well).

Suggested change
if ! command -v gh >/dev/null 2>&1 || ! gh auth status >/dev/null 2>&1; then
echo " (skipped — gh not authed)"
return
fi
if ! command -v gh >/dev/null 2>&1; then
echo " (skipped — gh not installed)"
return
fi
if ! gh auth status >/dev/null 2>&1; then
echo " (skipped — gh not authed)"
return
fi
if ! command -v jq >/dev/null 2>&1; then
echo " (skipped — jq not installed)"
return
fi

Copilot uses AI. Check for mistakes.
Comment thread test/integration.sh
Comment on lines +1696 to +1698
for f in /tmp/airc-it-h/state/airc.pid /tmp/airc-it-j/state/airc.pid; do
[ -f "$f" ] && kill -9 $(cat "$f") 2>/dev/null
done

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

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

The cleanup loop kills only the PID(s) in the pidfile and doesn’t remove the pidfile or kill child processes (contrast with cleanup_procs, which also kills children via pgrep -P and rm -f’s the pidfile). This can leave orphaned subprocesses (e.g., ssh) and makes later cleanup less safe; consider reusing cleanup_procs here instead of duplicating a weaker kill path.

Suggested change
for f in /tmp/airc-it-h/state/airc.pid /tmp/airc-it-j/state/airc.pid; do
[ -f "$f" ] && kill -9 $(cat "$f") 2>/dev/null
done
cleanup_procs

Copilot uses AI. Check for mistakes.
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