fix: [nomad-step-0] S0.1-fix — bin/disinto swallows --backend=nomad as repo_url positional (#835) #839
No reviewers
Labels
No labels
action
backlog
blocked
bug-report
cannot-reproduce
in-progress
in-triage
needs-triage
prediction/actioned
prediction/dismissed
prediction/unreviewed
priority
rejected
reproduced
tech-debt
underspecified
vision
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#839
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/issue-835"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #835
Changes
Why: disinto_init() consumed $1 as repo_url before the argparse loop ran, so `disinto init --backend=nomad --empty` had --backend=nomad swallowed into repo_url, backend stayed at its "docker" default, and the --empty validation then produced the nonsense "--empty is only valid with --backend=nomad" error — flagged during S0.1 end-to-end verification on a fresh LXC. nomad backend takes no positional anyway; the LXC already has the repo cloned by the operator. Change: only consume $1 as repo_url if it doesn't start with "--", then defer the "repo URL required" check to after argparse (so the docker path still errors with a helpful message on a missing positional, not "Unknown option: --backend=docker"). Verified acceptance criteria: 1. init --backend=nomad --empty → dispatches to nomad 2. init --backend=nomad --empty --dry-run → 9-step plan, exit 0 3. init <repo-url> → docker path unchanged 4. init → "repo URL required" 5. init --backend=docker → "repo URL required" (not "Unknown option") 6. shellcheck clean Tests: 4 new regression cases in tests/disinto-init-nomad.bats covering flag-first nomad invocation (both --flag=value and --flag value forms), no-args docker default, and --backend=docker missing-positional error path. Full suite: 10/10 pass. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>AI Review
Summary
The bug was a classic eager-consume-before-parse problem:
disinto_initgrabbed$1asrepo_urlunconditionally, sodisinto init --backend=nomad --empty --dry-runsetrepo_url="--backend=nomad", leftbackendat the docker default, then hit the--emptyguard with the misleading error.The fix is exactly right: check
[[ "$1" != --* ]]before consuming the positional, then defer the "repo URL required" guard to after argparse where the backend is known.Checklist
[[ "$1" != --* ]]is bash glob pattern matching — works reliably under[[ ]]. The deferred check at line 753 runs afterbackendis set, so docker-without-URL errors cleanly and nomad-without-URL is silently fine (as intended).disinto init(no args) still errors —$# -gt 0is false sorepo_urlstays empty, docker default triggers the check. ✓--backend=dockerwithout a positional now produces "repo URL required" instead of the misleading "Unknown option: --backend=docker". ✓_disinto_init_nomad(verified against the source). Existing tests withplaceholder/repopositional continue to cover the docker path.Verdict
APPROVE — Fix is minimal and correct: defers repo_url consumption until after argparse; tests cover the exact bug, regression cases, and improved error messaging
Reviewed at
72ed1f1| AGENTS.mdAI Review: APPROVE — Fix is minimal and correct: defers repo_url consumption until after argparse; tests cover the exact bug, regression cases, and improved error messaging