Primary finding
STATE_FILE updates and git commit occur without any file locking; concurrent runs can clobber state
- scripts/postprocess-admanage-create.sh:113-117
- scripts/postprocess-admanage-create.sh:192-196
- scripts/postprocess-admanage-create.sh:225-230
Multiple instances of the script can run (e.g., triggered by separate queues). Without mutual exclusion, concurrent read-modify-write cycles via jq+mv can interleave, dropping one process’s updates. A concurrent git commit sequence can also race, causing non-fast-forward or lost commit content.
Recommendation
Use flock around all STATE_FILE and git operations, e.g., exec {fd}>"$STATE_FILE"; flock -x "$fd"; then perform jq update and commit. Alternatively, lock a dedicated lockfile in STATE_DIR. Also consider retrying commits on failure or using git rebase/merge with retries.