GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — pm-stack: add old-writer fence check for failover promotion (#3989) by dezren39 · Pull Request #13410 · developing-today/code Conversation
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 39 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Here are some automated review suggestions for this pull request.
Reviewed commit: b5650a6559
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| set -uo pipefail | ||
|
|
||
| WRITER_CONTAINERS="pm-stack-kaneo-1 pm-stack-postgres-1 pm-grist pm-pad" | ||
| WRITER_UNITS="docker-pm-grist.service docker-pm-pad.service" |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Include Kaneo's service and restart timer in the fence check
On the NixOS deployment, Kaneo also has user units pm-kaneo.service and pm-kaneo.timer (nixos/services/pm-stack/default.nix:603–622,705–712), but neither is inspected here. If the service is still activating and pulling images when Docker is sampled, or an operator stops the service while its timer has a pending activation, this checker can report FENCED before pm-stack/deploy.sh:103–105 recreates the old writer containers. Check these user-unit activation sources and require them to be fenced before approving promotion; absence of the containers at one instant is insufficient.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| [ "$#" -ge 2 ] || { echo "fence-check: $opt requires a value" >&2; exit 2; } | ||
| val="$2" | ||
| [ -n "$val" ] || { echo "fence-check: $opt requires a non-empty value" >&2; exit 2; } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Reject missing option values before evaluating fencing
When a value option is followed by another flag, the parser consumes that flag as a fixture path instead of rejecting the missing value. For example, bash pm-stack/scripts/fence-check.sh --unreachable --units-dir --bogus prints FENCED and exits 0, silently accepting an unknown flag. Reject option tokens where a value is required so malformed invocations exit 2 before any fencing decision, as required by the operator-script argument contract.
AGENTS.md reference: AGENTS.md:L44-L47
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| state="$(tr -d '[:space:]' <"$UNITS_DIR/$unit")" | ||
| if [ "$state" = "active" ]; then |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fail closed when fixture state cannot be read
In fixture mode, a readable path does not guarantee usable state: making DIR/docker-pm-pad.service a directory passes the preceding -r check, then tr reports a read error, but its failure is ignored and the checker prints FENCED with exit 0 when the remaining fixtures are clean. An empty unit file likewise counts as safely inactive despite containing no state. The container fixture reader also accepts a directory as empty evidence. Require regular fixture files, successful reads, and recognized unit states before authorizing promotion; otherwise malformed or incomplete captures bypass the advertised fail-closed behavior.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| exit 1 | ||
| fi | ||
| for want in $WRITER_CONTAINERS; do | ||
| if printf '%s\n' "$ps_out" | awk '{print $1}' | grep -Fxq -- "$want"; then |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Consume the full container listing when matching writers
With a sufficiently long container listing and a writer near the beginning, grep -q exits successfully before its producers finish, causing awk or printf to receive SIGPIPE. Because pipefail is enabled, the whole condition then evaluates false: Bash's help set defines its result as the “status of the last command to exit with a non-zero status.” A mocked live listing containing pm-grist running followed by 2,000 unrelated containers reproduced FENCED with exit 0 when both units were inactive. Use matching that consumes the complete stream so an early successful match cannot be discarded as a pipeline failure.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.