Repository navigation
fix: PR #75 Copilot follow-up + 'pure shell' title hyphen - #76
Conversation
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]>
There was a problem hiding this comment.
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_renamesanitization so post-sanitization output cannot start with-(and mirrorsderive_name’s dash normalization/stripping flow). - Strengthen
scenario_kickby failing explicitly ifssh_key.puborauthorized_keysare 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.
| # 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 |
There was a problem hiding this comment.
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.
| # 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 |
| @@ -1,4 +1,4 @@ | |||
| # Agentic Internet Relay Chat | |||
| # Agentic Internet Relay Chat — pure shell | |||
There was a problem hiding this comment.
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.
| # Agentic Internet Relay Chat — pure shell | |
| # Agentic Internet Relay Chat — script-first |
There was a problem hiding this comment.
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]>
Summary
Three changes:
cmd_renameleading-dash regression — the leading-dash check fired BEFORE sanitization, so input like.fooslipped past the case check and emerged as-fooafter[^a-z0-9-]/-/gsubstitution. The resulting nick was unreachable toairc 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.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 withcleanup_all + returnso the kick assertion isn't silently elided.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
airc nick .dottyname→ stored name has no leading dash (verified by new test)