Skip to content

pm-stack(grist/deploy): reject unaccounted CLI arguments before render/restart/deploy work #10441

Closed

Description

@dezren39

Summary

pm-stack/grist/deploy.sh is an operator script that declares a single optional subcommand (deploy default, render, or restart), but it ignores any additional positional arguments after a recognized subcommand and proceeds with its normal work.

Evidence

  • Script: pm-stack/grist/deploy.sh
  • Contract: root AGENTS.md → "Operator script argument contract (Design: unknown means stop — one strict argument contract for the repo's operator scripts #3352)" and doc/agents/operator-script-argument-contract.md: every operator script must declare its whole command line and parse strictly against that declaration before any subprocess, network, file write, lock, or deploy step; anything unaccounted for is a usage error with a non-zero exit.
  • Source: the script dispatches only on ${1:-deploy} (case at :87-114) and never validates $# or rejects extra positional arguments. For a recognized subcommand, extra args are silently ignored:
    • ./deploy.sh render unexpected-arg takes the render branch and runs render() (:88-90), which decrypts secrets via sops --decrypt and writes .env (mode 600) before exiting (:38-85).
    • ./deploy.sh restart unexpected-arg takes the restart branch and runs docker compose restart (:91-93).
    • ./deploy.sh deploy unexpected-arg takes the deploy branch and performs the full deploy (render, pull, recreate, health wait/subprocess/network checks) (:94-110).
      Unknown subcommands are correctly rejected (:111-114), but unaccounted extra arguments alongside a valid subcommand are not.

Why it matters

Silently ignoring extra arguments makes typos, stale invocations, or future interface changes do the wrong thing without feedback. This script decrypts secrets, writes the Grist env file, restarts containers, and performs deploy/health work; argument mistakes should fail fast before any of that work.

Suggested fix / acceptance criteria

  • Declare the script's full command-line contract (at most one positional argument: deploy/render/restart, default deploy) and reject any unaccounted extra positional arguments with a clear usage message to stderr and a non-zero exit, before any subprocess, secret decryption, file write, network, or deploy step.
  • Preserve existing behavior for valid invocations: no args, deploy, render, and restart.
  • Add/update regression coverage asserting that extra positional arguments (e.g. ./deploy.sh render unexpected-arg, ./deploy.sh restart unexpected-arg, ./deploy.sh deploy unexpected-arg, ./deploy.sh unexpected-arg extra) are rejected with non-zero exit and do not start render/restart/deploy side effects in a controlled fixture.

Activity

  1. developing-today commented on Nov 15, 2026

    @developing-today
    Contributor
  2. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    Triage check (task 19268, lane any-d): already done. Fresh verification this shift: issue #10441 is CLOSED (stateReason COMPLETED, closed 2026-11-17T02:18:33Z) — PR #10907 "pm-stack: enforce the argument contract in eleven more operator scripts" merged 2026-11-17T02:18:26Z, which covers the grist deploy.sh argument-contract fix this issue asked for. No further work; task 19268 completes as already_done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions