Re-running setup no longer collapses more than one services host (#891) - #909
Merged
Merged
Conversation
Found reviewing #811's merged change. A blank answer at the services-host prompt showed the first configured host as the default and, on Enter, wrote it back as the ONLY entry: an operator with two hosts configured (home and phone, say) who re-ran configure.py and pressed Enter there had the second one silently drop admin access, to the console and the in-channel commands alike. A blank answer now writes nothing - ADMIN_HOSTMASKS is left exactly as it is, rather than rewritten from the first entry. A host actually typed still replaces the list as before, and now says so first when there was more than one. A smaller oddity in the same prompt is fixed alongside it: a first entry that is itself a wildcard pattern is no longer offered as the default, which used to fail the validator on a value the operator never typed. tests/test_configure.py (3): a blank answer with two hosts configured writes nothing (fails on the old code with the exact reported shape - collapsed to the first entry alone); a typed answer that replaces more than one says so; a wildcarded first entry is not offered as the default. test_the_console_guide_says_what_configure_does.py's anchor updated to check the actual defect (no fallback on the blank answer) rather than an exact source string this change moved. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…does-not-collapse-hosts # Conflicts: # docs/UPDATES.md
chchatzop
reviewed
Sep 23, 2026
chchatzop
left a comment
Collaborator
There was a problem hiding this comment.
This duplicates #903 (Fixes #891, opened yesterday, green) - and #903 is the base of a stacked chain (#904 -> #905 -> #906), so which one lands matters beyond this issue. Both fix the reported case (Enter writes nothing). Two differences, both on the side of losing a host, which is what #891 is about:
- Typing a host that is already configured still wipes the others. With
homeandphoneset, re-running and typing the home host out of habit replaces both with just home - the phone loses admin. The "This replaces the 2 services hosts..." line prints after the host is typed, with no way to back out. #903 treats a host already present as no change, and adds a new host beside several rather than replacing them (one question cannot know which of several a new host replaces). - The comma-separated form is indexed as characters.
adminchat.admin_host_patterns()acceptsADMIN_HOSTMASKSas a string ("*!*@a,*!*@b");current_hostmasks[0]is then"*", andlen(current_hostmasks)would announce "replaces the 13 services hosts". #903 reads the hosts the way the console does (admin_host_patterns()), and shows them (Configured now: ...).
Suggest merging #903 and closing this one - it keeps the chain above it intact, and its tests cover both cases (test_a_rerun_of_configure_keeps_every_admin_host.py, 8). If you prefer this one, it needs those two before it is safe, and I will rebase the chain onto whatever lands.
This was referenced Sep 23, 2026
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.
Fixes #891.
What was wrong
Found reviewing #811's merged change (
ca79f53).configure.py's services-host prompt showed the first configuredADMIN_HOSTMASKSentry as its default and, on a blank answer, fell back to it - then always wrote one entry:An operator with two hosts configured (home and phone, say) who re-runs
configure.pyand presses Enter at that prompt has the list collapsed to the first. The second silently loses admin access to the console and the in-channel commands.A smaller oddity in the same step: if the first existing entry is itself a wildcard pattern (
*!*@*.home.net), the default becomes*.home.net, and pressing Enter printed "That will not do: '*.home.net' has a '*' in it" about a value the operator never typed.What changed
ADMIN_HOSTMASKSis left exactly as it is, rather than rewritten from the first entry.admin_host_problem()- a wildcard first entry is no longer offered, so Enter never runs the validator against a value the operator didn't type.Test
tests/test_configure.py(3): a blank answer with two hosts configured writes nothing (fails on the old code with the exact reported shape - collapsed to the first entry alone); a typed answer that replaces more than one says so, checked against the printed text; a wildcarded first entry is not offered as the default and prints no confusing refusal.test_the_console_guide_says_what_configure_does.py's anchor updated to check the actual defect (no fallback on the blank answer) rather than an exact source string this change moved.Verified
Full suite in a clean clone: 6408 OK (58 skipped).
🤖 Generated with Claude Code