Skip to content

fix: PR #75 Copilot follow-up + 'pure shell' title hyphen - #76

Merged
joelteply merged 2 commits into
canaryfrom
fix/copilot-review-followup
Apr 25, 2026
Merged

joelteply merged 2 commits into
canaryfrom
fix/copilot-review-followup

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Summary

Three changes:

  1. cmd_rename leading-dash regression — the leading-dash check fired BEFORE sanitization, so input like .foo slipped past the case check and emerged as -foo after [^a-z0-9-]/-/g substitution. The resulting nick was unreachable to airc whois / airc kick (both reject leading-dash via _validate_peer_name). Aligned cmd_rename's pipeline with derive_name's: collapse dash runs, strip leading + trailing dashes after sed AND after the 24-char cap.

  2. scenario_kick guard improvement — the authorized_keys assertions were guarded by if [ -n \"\$kj_ssh_pub\" ] && [ -f auth ], which silently skipped the entire kick-revocation check if either precondition was missing. Both should always be present here (init_identity always generates ssh_key.pub; pair handshake always creates authorized_keys). Now: each precondition is its own pass/fail, and a missing one short-circuits with cleanup_all + return so the kick assertion isn't silently elided.

  3. README title — "pure shell" — H1 hyphen-tagline so the technical pitch (zero compiled binary, zero runtime install, just bash + PowerShell scripts) is the first thing fresh-clone readers see. Per Joel after pulling up the GitHub language breakdown: 64% Shell, 35% PowerShell, 0.1% Batchfile.

Test plan

  • 133/133 integration tests pass (3 new: scenario_kick guard pass/fail decomposition + scenario_identity dash-strip assertion)
  • airc nick .dottyname → stored name has no leading dash (verified by new test)
  • If init_identity ever fails to generate ssh_key.pub, kick scenario now FAILS instead of silently passing

Three changes:

1. **cmd_rename leading-dash regression** — the leading-dash check fired
   BEFORE sanitization, so input like `.foo` slipped past (the case
   check) and emerged as `-foo` after `[^a-z0-9-]/-/g` substitution. The
   resulting nick was unreachable to airc whois / airc kick (both
   reject leading-dash via _validate_peer_name). Fix: align cmd_rename's
   sanitization pipeline with derive_name's — collapse dash runs, strip
   leading and trailing dashes after sed AND after the cap. New test
   in scenario_identity asserts `airc nick .dottyname` produces a
   non-leading-dash result.

2. **scenario_kick guard improvement** — the authorized_keys
   assertions were guarded by `if [ -n "$kj_ssh_pub" ] && [ -f auth ]`,
   which silently skipped the entire kick-revocation check if either
   precondition was missing. Both should always be present here
   (init_identity always generates ssh_key.pub; pair handshake always
   creates authorized_keys). Now: each precondition is its own pass/
   fail, and a missing one short-circuits with cleanup_all + return so
   the kick assertion isn't silently elided.

3. **README title — pure shell** — add a hyphen-tagline to the H1 so
   the technical pitch (no compiled binary, no runtime install, just
   bash + PowerShell scripts) is the first thing fresh-clone readers
   see. Per Joel after pulling up the GitHub language breakdown:
   64% Shell, 35% PowerShell, 0.1% Batchfile.

133/133 integration tests pass (3 new — 2 from scenario_kick guard
expansion, 1 in scenario_identity for the dash strip).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings April 25, 2026 13: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 a rename sanitization edge case that could create unreachable peer names, tightens integration test assertions around SSH key revocation on kick, and updates the README heading to emphasize the project’s script-based distribution.

Changes:

  • Fix cmd_rename sanitization so post-sanitization output cannot start with - (and mirrors derive_name’s dash normalization/stripping flow).
  • Strengthen scenario_kick by failing explicitly if ssh_key.pub or authorized_keys are missing, avoiding silent skips of the revocation assertion.
  • Update README H1 to include a “pure shell” tagline.

Reviewed changes

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

File Description
test/integration.sh Adds a regression test for leading-dash rename output; strengthens kick scenario precondition checks.
airc Adjusts rename sanitization pipeline to prevent leading-dash output and align with derive_name.
README.md Updates the main title to include a short tagline.

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

Comment thread test/integration.sh
Comment on lines +1253 to +1260
# name has no leading dash.
AIRC_HOME="$home/state" "$AIRC" nick ".dottyname" >/dev/null 2>&1 || true
local renamed; renamed=$(python3 -c "import json; print(json.load(open('$home/state/config.json')).get('name',''))" 2>/dev/null)
case "$renamed" in
-*) fail "airc nick produced leading-dash name '$renamed' — sanitization regression" ;;
"") fail "airc nick wrote empty name — sanitization regression" ;;
*) pass "airc nick strips leading dash post-sanitization (got '$renamed')" ;;
esac

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_identity currently runs airc nick ".dottyname" with || true, so this new assertion can still pass if nick fails for an unrelated reason (config.json would keep the previous valid name). To avoid false positives, capture the exit status (and/or resulting name) and fail the test if airc nick returns non-zero or if the stored name didn’t actually update to the expected sanitized value.

Suggested change
# name has no leading dash.
AIRC_HOME="$home/state" "$AIRC" nick ".dottyname" >/dev/null 2>&1 || true
local renamed; renamed=$(python3 -c "import json; print(json.load(open('$home/state/config.json')).get('name',''))" 2>/dev/null)
case "$renamed" in
-*) fail "airc nick produced leading-dash name '$renamed' — sanitization regression" ;;
"") fail "airc nick wrote empty name — sanitization regression" ;;
*) pass "airc nick strips leading dash post-sanitization (got '$renamed')" ;;
esac
# name updates to the expected sanitized value.
local expected_renamed nick_out nick_status renamed
expected_renamed="dottyname"
nick_out=$(AIRC_HOME="$home/state" "$AIRC" nick ".dottyname" 2>&1)
nick_status=$?
renamed=$(python3 -c "import json; print(json.load(open('$home/state/config.json')).get('name',''))" 2>/dev/null)
if [ "$nick_status" -ne 0 ]; then
fail "airc nick failed for sanitized input '.dottyname' (exit $nick_status): $nick_out"
elif [ "$renamed" != "$expected_renamed" ]; then
fail "airc nick stored '$renamed' after '.dottyname' — expected '$expected_renamed'"
else
pass "airc nick strips leading dash post-sanitization (got '$renamed')"
fi

Copilot uses AI. Check for mistakes.
Comment thread README.md Outdated
@@ -1,4 +1,4 @@
# Agentic Internet Relay Chat
# Agentic Internet Relay Chat — pure shell

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 new H1 tagline “pure shell” is potentially misleading given the repo/tooling explicitly requires Python at runtime (e.g., airc hard-fails if python3/python isn’t present, and README later lists python3 as a prereq). Consider adjusting the tagline to something like “script-first” / “no compiled binary” to avoid contradicting the documented Python dependency.

Suggested change
# Agentic Internet Relay Chat — pure shell
# Agentic Internet Relay Chat — script-first

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we altered this as a subheading because the claim was wrong without explanation, so better to explain exactly what this really is. Originally I did have the intention of pure shell, but Python was necessary and an accepted trade off with all modern shells providing it (except inferior ones like windows probably). For this project we are expecting devs or tech enthusiasts of all kinds, who always have git (prerequisite) and python, or if absent have no problem installing it with their agent at the helm. It's really more, no real changes to your system as it is - you have/need gh and python anyway - so the project isn't some dependency nightmare.

Per Copilot's nit on PR #76 + Joel's call: "pure shell" in the title
overstated since python3 is a system dep (used for inline JSON parsing
throughout airc). Pull the hyphen out of the H1 and fold the
shell-scripts-only claim into the existing descriptive tagline so it
lands as part of "what this is" rather than as a misleading title
suffix. Title is back to the plain project name.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@joelteply
joelteply merged commit 4aa9d3c into canary Apr 25, 2026
1 check passed
@joelteply
joelteply deleted the fix/copilot-review-followup branch April 25, 2026 13:16
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