feat(controller-peers-env-fallback): refuse an env-supplied peers list without the controller's own name (task 2.4)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-10-03 06:29:01 +00:00
parent 64d3429cd8
commit 9018980b08
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
3 changed files with 79 additions and 1 deletions

View file

@ -42,7 +42,7 @@
- Done when, after rebuilding the controller, the controller suite passes and every controller case in the regression script passes
- _Requirements: 1.1, 1.2, 1.3, 1.4, 1.5, 1.7, 1.8_
- [ ] 2.4 Refuse an env-supplied peers list that does not contain the controller's own name
- [x] 2.4 Refuse an env-supplied peers list that does not contain the controller's own name
- Add the cases to the regression script first and see them fail: with a three-candidate variable, a name not in it exits non-zero with the message; a name in it logs "HA mode: 3 controller candidates" with no such message; the same list given as explicit `--peers` with a name not in it prints no such message
- When the list came from the variable and the shared lookup finds no candidate for the controller's own name (its `--myname`, or the host name when not given), print to stderr the controller's name, the variable as the source, the candidates (by name, or hostname when unnamed) and the two remedies (pass `--myname` naming a candidate, or unset the variable); flush the log and exit non-zero before the certificate pre-flight and any network activity
- Leave the explicit-`--peers` path untouched (its later refusal in the listener stays as it is)