Skip to content

pm-stack(grist/seed): reject unaccounted CLI arguments before doing any work #10440

Closed

Description

@dezren39

Summary

pm-stack/grist/seed.sh is an operator script (run on the host after deploy/bootstrap to seed the Grist roadmap document) that declares no command-line arguments, but it never rejects unaccounted positional arguments and proceeds with its normal work when extras are supplied.

Evidence

  • Script: pm-stack/grist/seed.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 takes no positional parameters and performs no $#/argument validation. It immediately proceeds into work: cd "$(dirname "$0")", a bun availability check and bun run validate-roadmap-seed.ts subprocess (:13-17), decrypts secrets via sops --decrypt (:22), and makes Grist API calls / may create workspace, document, table, and seed rows (api helper and subsequent logic, :27+). Any extra argument (e.g. ./seed.sh unexpected-arg) is silently ignored before these subprocess, secret-access, network, and state-changing steps.

Why it matters

Silently ignoring extra arguments makes typos, stale invocations, or future interface changes do the wrong thing without feedback. This script can decrypt secrets, talk to the Grist API, and create/seed roadmap data; argument mistakes should fail fast before any of that work.

Suggested fix / acceptance criteria

  • Declare the script's full command-line contract (no positional arguments) and reject any unaccounted arguments with a clear usage message to stderr and a non-zero exit, before any subprocess, secret decryption, network, or API/file work (including the early bun run validate-roadmap-seed.ts).
  • Preserve existing behavior for valid invocations with no positional arguments and existing environment-variable handling (PM_STACK_SECRETS, SOPS_AGE_KEY_FILE).
  • Add/update regression coverage (a shell/script test exercising the entrypoint with an extra positional argument in a controlled fixture or with side-effecting steps stubbed/guarded) asserting that an extra argument is rejected with non-zero exit and that no seed/decrypt/network work is started.

Activity

  1. developing-today commented on Nov 15, 2026

    @developing-today
    Contributor
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