Skip to content

fix(qa): 4 real bugs caught by self-QA pass — pre-promote cleanup - #438

Merged
joelteply merged 1 commit into
canaryfrom
fix/qa-pass-bugs-pre-promote
May 2, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fix/qa-pass-bugs-pre-promote

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Self-regression test on canary surfaced 4 real bugs:

# File Bug Fix
1 cmd_status.sh monitor-state read every bearer_state.*.json (incl stale prior subs) → reported 4-hr-old freshness Intersect with subscribed_channels from config (same fix-shape as #428)
2 cmd_rename.sh own historical nick treated as collision → rename-back broken Walk [rename] chain to mark self-history; exclude from collision set
3 cmd_daemon.sh airc daemon stop silently ran full uninstall (broke auto-restart) Remove misleading alias, add clear error + new restart verb
4 test/integration.sh detect_platform test expected macos/windows-bash but impl emits darwin/windows Align test to impl (callers use the impl values consistently)

Verification

  • All 3 bash -n clean
  • airc daemon stop now: ERROR: airc daemon stop is not a verb. Use: uninstall / restart / install
  • airc daemon restart round-trip works
  • airc doctor --tests platform_adapters (with AIRC_DIR=local checkout): 11/11 pass (was 9/11)
  • Self-rename forward + back works after fix; foreign-peer rename still correctly blocks

Pairs with

🤖 Generated with Claude Code

…romote cleanup

Self-regression test against the canary build surfaced 4 real bugs that
were either pre-existing or recently introduced. All shippable in one
focused PR before canary→main promote.

## 1. cmd_status monitor-state reads stale bearer files

Same Codex-class bug Joel asked about for `--health` (fixed in #428),
applied to cmd_status's monitor-state line which has the same shape:

  monitor: likely-alive (14146s via #cambriantech; ...)

Reported nearly-4-hour-old "freshness" because the probe globbed
EVERY bearer_state.*.json on disk (including stale files from prior
subscriptions) and picked the smallest age. The smallest age was 14kS
because all my subscribed bearers ARE actually fresh, but a parted
#cambriantech room's stale bearer_state file was still on disk.

Fix: intersect with `subscribed_channels` from config (legacy scopes
without subs populated fall back to all-files for backward compat).
Same fix-shape as #428.

## 2. cmd_rename own-historical-nick is treated as collision

Self-rename round-trip is broken: rename airc-8a5e → test-foo, then
airc-8a5e → test-foo → airc-8a5e fails with:

  ERROR: name collision: 'airc-8a5e' has been seen as an active peer
         in this room (use 'airc logs' to verify)

The collision check at cmd_rename.sh:88-104 scans tail-200 of
messages.jsonl for any matching `from`, but doesn't filter out
nicks that were US (visible because we sent messages under them
before the last rename).

Fix: walk the [rename] chain inside the same 200-line window,
mark all nicks that were us via that chain (current nick + any
old/new pair containing a known-us nick). Exclude self-history
from the collision set. Original safety property (block
renaming TO another peer's active nick) preserved — the check
only fires now when target is in `seen` AND NOT in `my_history`.

Test: rename forward + back now works; rename to a foreign peer's
active nick still correctly blocks.

## 3. `airc daemon stop` silently uninstalls (UX bug)

Pre-fix dispatch had `uninstall|remove|stop)` as one case → typing
`airc daemon stop` ran the FULL uninstall path: removed launchd
plist, killed the process, broke auto-restart on next login. Users
reasonably expect "stop" to halt the running unit but PRESERVE the
registration (systemctl convention).

Fix: remove the `stop` alias from `uninstall|remove|stop`. Add a
dedicated `stop|start)` case that produces a clear error pointing
at the right verbs (uninstall, restart, install).

Bonus: add `airc daemon restart` as a proper convenience verb
(uninstall + reinstall — picks up new airc binary). Help text
updated to list the new verb. Note used `$action` (the captured
arg) in the die message instead of `$1` — `$1` was shifted to the
next arg in dispatch and would trip set -u.

## 4. integration test detect_platform expected wrong values

Test at integration.sh:2543 expected `macos|linux|wsl|windows-bash`
but `platform_adapters.sh:detect_platform()` actually emits
`darwin|linux|wsl|windows`. Test was either written wrong or the
implementation was renamed without updating the test. Callers in
cmd_daemon.sh consistently use `darwin` and `windows` (line 121
case darwin, line 123 case windows), so the implementation is
canonical.

Fix: update test expectations to match impl. With AIRC_DIR pointing
at this checkout: `airc doctor --tests platform_adapters` now
reports 11/11 pass (was 9/11).

## Verification

- `bash -n` clean on all 3 modified shell files
- `airc daemon stop` now prints clear error + 3 alternatives
- `airc daemon restart` works (uninstall + install round-trip)
- `airc doctor --tests platform_adapters`: 11/11 pass

## Pairs with

- #422 (canary→main — this clears 4 real-world QA findings)
- #428 (cmd_doctor --health stale-channel scope — same fix-shape)
- #435 (5 critical Copilot residuals — companion cleanup)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings May 2, 2026 20:45
@joelteply
joelteply merged commit 2ca8073 into canary May 2, 2026
8 checks passed
@joelteply
joelteply deleted the fix/qa-pass-bugs-pre-promote branch May 2, 2026 20:47

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

Note

Copilot was unable to run its full agentic suite in this review.

Addresses four QA-found regressions in bash commands and integration tests to improve correctness around status freshness, rename collision detection, daemon verbs, and platform detection expectations.

Changes:

  • Scope airc status freshness scanning to subscribed_channels to avoid stale prior-subscription state.
  • Fix self-rename “rename back” collision detection by tracking the local user’s rename history.
  • Remove misleading daemon stop/start aliases, add restart verb, and align platform detection integration test expectations.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
test/integration.sh Aligns detect_platform test expectations to canonical emitter values (darwin, windows, etc.).
lib/airc_bash/cmd_status.sh Filters bearer state freshness computation to current subscriptions.
lib/airc_bash/cmd_rename.sh Excludes the local user’s historical nicknames from collision detection.
lib/airc_bash/cmd_daemon.sh Removes stop/start aliasing to uninstall, adds restart, improves help/usage.

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

install) cmd_daemon_install "$@" ;;
uninstall|remove|stop) cmd_daemon_uninstall "$@" ;;
uninstall|remove) cmd_daemon_uninstall "$@" ;;
restart) shift; cmd_daemon_uninstall "$@" >/dev/null && cmd_daemon_install "$@" ;;
Comment on lines 92 to 102
local _bs_summary; _bs_summary=$("$AIRC_PYTHON" -c "
import json, glob, time
subs = set()
try:
cfg = json.load(open('$CONFIG'))
for c in cfg.get('subscribed_channels') or []:
subs.add(c)
except Exception:
pass
fresh = []
for path in glob.glob('$AIRC_WRITE_DIR/bearer_state.*.json'):
Comment on lines +95 to +100
try:
cfg = json.load(open('$CONFIG'))
for c in cfg.get('subscribed_channels') or []:
subs.add(c)
except Exception:
pass
joelteply added a commit that referenced this pull request May 2, 2026
…utput + send-file silent hang (#439)

fix(qa-deeper): 3 real bugs caught by deeper QA pass — multi-room subscribe + part output + send-file silent hang

Self-QA caught 3 more user-facing bugs after #438 landed. All fixable
in one focused PR.

## B5: airc join --room NEWNAME blocked when monitor already running

Pre-fix the trust-existing-monitor short-circuit in cmd_connect (line
253-260) returned 0 unconditionally when the scope's airc.pid showed a
live monitor. Result: user passes `airc join --room qa-test`, gets back
"this scope's monitor is already running" — but qa-test is NOT in
subscribed_channels. To add a new subscription user had to teardown +
rejoin the scope, losing all running state.

Fix: detect when --room was explicit AND the requested name is NOT in
the existing subscribed_channels. In that case, fall through to
subscribe + resolve-or-create the channel gist + save mapping. Bearer
respawn (per _monitor_multi_channel's outer cycle) picks it up within
~30s.

Verified by reading the diff path: subscribe → channel_gist resolve
--create-if-missing → set_channel_gist mapping. The bearer's outer
cycle re-reads channel_map so the next poll subscribes to the new
gist automatically.

## B6: airc part X prints contradictory "deleted" + "preserving" messages

cmd_part deletes room_gist_id (per-channel mapping) and prints
"✓ Room gist deleted." Then cmd_teardown is invoked under
AIRC_TEARDOWN_PART_ONLY=1, sees host_gist_id (a separate file
tracking host-mode marker), and prints "preserving hosted gist
(bus stability)." User reads both and is confused — looks like
the system both deleted AND preserved the same gist.

Fix: gate cmd_teardown's primary "preserving" message on
AIRC_TEARDOWN_PART_ONLY != 1. When part is the caller, it owns the
gist-disposition messaging; teardown stays silent on that.

## B7: airc send-file silent hang on gh-only peers

Post-Phase-3c (#281), substrate is gh-only. send-file uses scp +
relay_ssh which require the peer's host to have authorized our
identity-key via local TCP pair-handshake. For gh-only peers (joined
via gist substrate, never via TCP handshake), there's NO SSH
authorization in authorized_keys. scp hangs on "Permission denied
(publickey)" for 30+ seconds with no useful surface output, then
times out silently — user sees nothing.

Fix: precheck for empty host_target. If empty, the peer was never
pair-handshaked (gh-only path) → die() with a clear, actionable
error explaining the constraint + suggesting alternatives (use
airc msg for messaging, share a link for file transfer until
gh-substrate file transfer is implemented).

The 1MB gist hard limit makes gh-substrate file transfer impractical
for most files — proper fix is a future bearer that can stream large
payloads. For now, fail loud beats hang silent.

## Verification

- `bash -n` clean on all 3 modified files
- B7 verified: `airc send-file other-mac /tmp/payload` now produces
  the clear error message instead of hanging

## Pairs with

- #422 (canary→main — keep clearing real bugs before promote)
- #428 (--health stale-channel scope — same QA-driven cleanup pattern)
- #438 (4 earlier QA bugs)
- #281 (Phase 3c — what removed the SSH transport that send-file
  still expects)

Joel directive 2026-05-02: "fix till totally reliable" + "great work,
keep repairing and qa as you merge". This is the next batch.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
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