You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pm-stack(kaneo-sync-guard): reject unaccounted CLI arguments before running guard #10428
pm-stack/kaneo-sync-guard.py is an operator script that runs docker exec/psql subprocesses and can heal Kaneo statusTransitions drift in Postgres, but it ignores any command-line arguments and proceeds with its normal work. This violates the operator script argument contract (unexpected/typo'd args must be rejected as a usage error before any subprocess, network, file write, lock, or deploy step).
Evidence
Script: pm-stack/kaneo-sync-guard.py
Declared usage takes no arguments: docstring shows python3 pm-stack/kaneo-sync-guard.py (pm-stack/kaneo-sync-guard.py:19).
main() does not inspect sys.argv and performs guard work immediately (pm-stack/kaneo-sync-guard.py:67-121), then if __name__ == "__main__": sys.exit(main()) (pm-stack/kaneo-sync-guard.py:124-125).
Current callers pass no arguments: pm-stack/deploy.sh:104, pm-stack/systemd/pm-kaneo-sync-guard.service:7 (ExecStart=/bin/sh -lc 'python3 /home/user/pm-stack/kaneo-sync-guard.py').
Repro on main (HEAD observed in this run: 637e29c982, 2026-11-15):
python3 pm-stack/kaneo-sync-guard.py unexpected-arg exits 0 after running the guard and printing conforming integration results.
python3 pm-stack/kaneo-sync-guard.py --help also exits 0 and runs the guard instead of showing usage/rejecting the argument.
In the observed repro there was no drift to heal, but the script still executed its psql reads/subprocesses before any argument validation could reject the invocation.
Why it matters
A typo, stray positional, or forgotten flag is silently treated as a normal run of a guard that can mutate integration config when drift is present. That defeats the strict argument contract for operator scripts and makes accidental misuse harder to detect.
Acceptance criteria / suggested fix
Parse/validate the full command line before any subprocess or DB access.
Reject any unaccounted argument (unknown flag, stray positional, typo) with a usage error naming the offending argument and a non-zero exit (exit code 2 is appropriate here, matching the script's existing usage/error convention).
Either declare and implement -h/--help explicitly or reject it the same way as any other unexpected argument (but do not run the guard first).
Add/update a focused test or script contract check covering unexpected-arg and --help behavior so a future regression fails closed.
Bulk-intake triage packet for #10428 claimed and revalidated fresh (2026-11-17T06:1xZ): the issue is CLOSED (completed, 2026-11-17T02:18:30Z) and the fix is on main — pm-stack/kaneo-sync-guard.py now rejects unexpected arguments before any work (sys.argv check with usage error at lines 147–150, verified on origin/main this shift; landed via PR #6335, merge 8b81e6f). Nothing remains to triage or route; this packet completes as already_done with that evidence.
Agent note — duplicate packet cancelled · lane code-e
Completing task 19264 (already_done) made the broker create follow-on task 20594 (dedupe repo-health:v1:fix:developing-today/code:issue:10428). The work is already fixed and merged (PR #6335) and this issue is closed, so task 20594 was cancelled by repo-worker-code (lane code-e) as a duplicate with the reason recorded on the task.
Activity
developing-today commentedon Nov 15, 2026
CODE-3774
dezren39 commentedon Nov 17, 2026
Agent note — state: already_done (verified) · task 19264, lane code-e
Bulk-intake triage packet for #10428 claimed and revalidated fresh (2026-11-17T06:1xZ): the issue is CLOSED (completed, 2026-11-17T02:18:30Z) and the fix is on main —
pm-stack/kaneo-sync-guard.pynow rejects unexpected arguments before any work (sys.argvcheck with usage error at lines 147–150, verified on origin/main this shift; landed via PR #6335, merge 8b81e6f). Nothing remains to triage or route; this packet completes as already_done with that evidence.dezren39 commentedon Nov 17, 2026
Agent note — duplicate packet cancelled · lane code-e
Completing task 19264 (already_done) made the broker create follow-on task 20594 (dedupe repo-health:v1:fix:developing-today/code:issue:10428). The work is already fixed and merged (PR #6335) and this issue is closed, so task 20594 was cancelled by repo-worker-code (lane code-e) as a duplicate with the reason recorded on the task.