Repository navigation
fix(gist): select freshest channel envelope - #460
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes gist envelope selection for multi-file gists so that takeover/staleness decisions are based on the freshest envelope relevant to the requested channel, rather than whichever file happens to be “first” in the gist.
Changes:
- Added
gistparse gist_content --channel <name>to select the freshest envelope whosechannels[]includes the requested channel (with legacy first-file fallback when no channel is provided). - Updated
cmd_connect.shand_mesh_age_secsto pass the requested channel into gist-content resolution (including the git-clone fallback preferringairc-room-<channel>.json). - Added regression tests covering multi-file gists with stale sibling files.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
test/test_gistparse.py |
Adds regression tests ensuring channel-aware freshest-envelope selection and preserving legacy fallback behavior. |
lib/airc_core/gistparse.py |
Implements channel-aware gist file selection (--channel) and keeps legacy first-file fallback. |
lib/airc_bash/mesh.sh |
Updates _mesh_age_secs to resolve gist content via gistparse gist_content, optionally channel-scoped. |
lib/airc_bash/cmd_connect.sh |
Passes --channel "$room_name" to gist parsing and prefers channel-named file in git-clone fallback. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gistparse gist_content --channel <name>choose the freshest envelope whosechannels[]contains that channelcmd_connectand_mesh_age_secsRoot Cause
#459 fixed the split-brain resolver path, but live reconnect exposed a second destructive bug: after resolving the right multi-file gist,
gist_contentread the first file. In the live gist, one sibling file was stale while another file in the same gist had a fresh heartbeat. Reading the stale sibling made AIRC conclude the host was stale and delete/take over the whole gist.A takeover decision must be based on the channel-relevant freshest envelope, not an arbitrary first file.
Verification
bash -n airc lib/airc_bash/mesh.sh lib/airc_bash/cmd_connect.shpython3 test/test_gistparse.pyPYTHONPATH=lib python3 test/test_channel_gist.py./test/integration.sh solo_mesh_warnsgit diff --checkNo live reconnect attempt until this lands; canary currently has #459 without this guard, so reconnecting can still make a bad takeover decision on multi-file gists.