Skip to content

id-mail(deploy): duplicate --dry-run is mislabeled 'unrecognized' by #3785's strict-arg guard, and the positional/duplicate/mixed cases are unpinned in deploy.test.mjs #7855

Closed

Description

@dezren39

Finding

PR #3785 added strict argument validation to the id-mail deploy script (#3281): only deploy.mjs [--dry-run] is accepted, anything else aborts with exit 2 before any config/bws/wrangler work. The guard is correct and fails closed, but two residuals shipped with it and are still on main:

  1. The duplicate case is mislabeled. With --dry-run --dry-run, unknownArgs is empty (every arg IS --dry-run), so the error falls back to reporting all args as unrecognized: unrecognized argument(s): --dry-run --dry-run — naming the one recognized argument as unrecognized. The exit code is right; the message teaches the operator the wrong fact about a script whose whole guard exists because a typo'd flag once entered the real deploy sequence.
  2. The claimed cases are unpinned. The PR body says an extra-positional case was verified, but the committed deploy.test.mjs pins only --dry-run, --dry-rnu, --bogus-flag, and no-args. No test covers a stray positional, a duplicate --dry-run, or --dry-run + bogus flag — the exact shapes an operator typo produces. (Related: ci(id-mail): deploy.test.mjs (4 tests pinning the #3281 typo'd-flag deploy guard) run by no workflow — the deploy script can force-delete the live Worker #6082 already tracks that this test file is run by no workflow; this issue is about the missing cases and the message, not the CI wiring.)

Evidence

  • Source PR: fix(id-mail): deploy.mjs strict arg validation — unknown args abort before any external call (#3281) #3785 fix(id-mail): deploy.mjs strict arg validation — unknown args abort before any external call (#3281), commits ac09e82a7566ca61286cfb779fc288a7119ff135, c0c5a85f8f34b826c65d8e6833fb118115d74e35; merge 9bfaa0d27ff744232b0c1a7106f87d1b6ae8bc92 (verified an ancestor of main by the compare API).
  • Current main (verified 2026-11-08, two independent reads via the contents API at ref=main): nixos/services/id-mail/worker/deploy.mjs —
    • const unknownArgs = args.filter((arg) => arg !== "--dry-run");
    • if (args.length > 1 || unknownArgs.length > 0) { const offenders = unknownArgs.length > 0 ? unknownArgs : args; console.error(\unrecognized argument(s): ${offenders.join(" ")}\nusage: deploy.mjs [--dry-run]`); process.exit(2); }`
    • The offenders = args fallback is reachable only when unknownArgs is empty and args.length > 1, i.e. exactly the duplicate --dry-run case.
  • Current main nixos/services/id-mail/worker/deploy.test.mjs test list: --dry-run validates only, --dry-rnu (typo) aborts, --bogus-flag aborts, two config-validation tests (id-mail(deploy): validate() crashes on null config entries instead of reporting them, and a config without retire passes validation then crashes the real deploy #6947), no args runs the real deploy sequence. No positional, duplicate, or mixed case.

Why it matters

This script retires and redeploys the live id-mail Worker and resets its secrets; #3281 exists because unrecognized arguments were silently treated as a request for the real deploy. The guard's error message is the operator's only signal at the moment of a typo — a message that calls the valid flag "unrecognized" invites the operator to retry variations against a destructive script. The unpinned shapes are the ones most likely to regress silently, because the file already has a history of argument-handling surprises (#3252/#3264 class in sibling deploy scripts).

Acceptance criteria

  • deploy.test.mjs gains cases pinning, each with exit 2 and zero external calls (the existing stub harness): a stray positional (e.g. deploy.mjs deploy), duplicate --dry-run --dry-run, and --dry-run --bogus-flag.
  • The duplicate case's error message no longer labels --dry-run as unrecognized (e.g. a distinct "duplicate argument" wording, or listing only genuinely unknown offenders plus a separate duplicate note); the typo/unknown-flag messages are unchanged.
  • All pre-existing deploy.test.mjs cases keep passing.

Filed by pr-diff-review-b (LANE B PR diff review, run 2026-11-08 17:18 CST) from PR #3785. Not #6082 (CI wiring of the same test file) and not #3281 (the original silent-ignore bug, closed by #3785).

Activity

  1. developing-today commented on Nov 8, 2026

    @developing-today
    Contributor
  2. added
    kind/testTest coverage, test infrastructure, or test-only fixes
    task/triageQueue packet kind: verify, reproduce, and route this item
    priority/lowNice to have; do when convenient
    effort/xsTrivial: expected under 30 minutes of work
    app/id-mailpkgs/nixos id-mail service and worker
    on Nov 8, 2026
  3. dezren39 commented on Nov 8, 2026

    @dezren39
    MemberAuthor

    Agent: pr-diff-review-b
    State: filed
    Source PR: #3785 (MERGED; merge 9bfaa0d verified an ancestor of main via the compare API)
    Action requested: triage per the acceptance criteria in the issue body. A repo-task/v1 packet (kind triage) is being enqueued to repo-health-code-pilot in the same run.

  4. dezren39 commented on Nov 9, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  5. added
    queue/claimedQueue worker lifecycle state
    and removed on Nov 9, 2026
  6. 36 remaining items

  7. dezren39 commented on Nov 9, 2026

    @dezren39
    MemberAuthor

    agent-note:v1 — task 14124 picked up by lane code-p (2026-11-09), assigned execution lane opencode (lane row 5554); checkpointed handed_off and parked 1200s for the opencode claimant to launch the bound session. Issue #7855 revalidated OPEN, no hard-stop labels.

  8. dezren39 commented on Nov 9, 2026

    @dezren39
    MemberAuthor

    agent-note:v1 lane=code-f task 14124 stage=handed_off: revalidated fresh — issue #7855 OPEN, no hard-stop labels. Handed off to opencode claimant (lane row 5554, session_id None); parking task 14124 for claimant launch.

  9. dezren39 commented on Nov 9, 2026

    @dezren39
    MemberAuthor

    Agent note: handed off - task 14124 (lane code-j, repo-worker-code) claimed and revalidated 2026-11-09T23:15:45Z: issue #7855 OPEN, no hard-stop labels. Execution lane opencode (row 5554); handed off to opencode claimant. Full agent-note:v1 note file in goal hidden_files lane-j-20261109-1710.

  10. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  11. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off to opencode claimant — Agent: queue worker (repo-worker-code), lane code-j — Session/ID: task 14124, repo-queue-worker-shift-j 2026-11-09 run. Task 14124 (triage) for issue #7855: id-mail deploy.mjs duplicate --dry-run mislabeled + unpinned arg cases; attempts 3/3 AT CAP on this claim. Fresh check: issue #7855 OPEN, no held/user/owned/do-not-merge/do-not-auto-edit labels. Execution lane row 5554 = opencode (repeat handoff). Checkpointed handed_off; parking task 14124 for 20 minutes for the claimant window.

  12. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done (triaged)

  13. removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    work/assignedQueue worker lifecycle state
    on Nov 10, 2026
  14. added a commit that references this issue on Nov 10, 2026
  15. dezren39 commented on Nov 10, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done — Agent: queue worker (repo-worker-code), lane code-j — Session/ID: task 14484, repo-queue-worker-shift-j 2026-11-09 run. Task 14484 (small_fix, direct lane) fixed issue #7855 and it is merged: PR #8106 (merge commit 7951fb1). deploy.mjs's duplicate case now reports "duplicate argument(s): --dry-run" instead of mislabeling it unrecognized (typo/unknown messages byte-identical; exit 2 and fail-closed ordering unchanged), and deploy.test.mjs pins the stray-positional, duplicate, and mixed (--dry-run + bogus flag) shapes — each exit 2 with zero external calls. Oracle: the issue's acceptance criteria; node --test deploy.test.mjs on the laptop passed 9/9 (6 pre-existing + 3 new). Issue auto-closed by the merge.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/id-mailpkgs/nixos id-mail service and workereffort/xsTrivial: expected under 30 minutes of workkind/testTest coverage, test infrastructure, or test-only fixespriority/lowNice to have; do when convenientsource/pr-diff-reviewFiled by the pr-diff-review jobstatus:donetask/triageQueue packet kind: verify, reproduce, and route this item

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions