Skip to content

fix(registry): stop dropping the first native arg on NoId commands, and disambiguate optional-id vs. passthrough args after "--" (#159) - #163

Merged
sawka-harness merged 1 commit into
mainfrom
naman/har-fix#159
Aug 27, 2026
Merged

Conversation

@BlueLabelscotch

Copy link
Copy Markdown
Collaborator

Description:

buildCtx's HasArgs/BuiltinFlags.Set logic decided whether to strip args[0] (assuming it was a leftover ) by re-checking vspec.RequiresId || vspec.AllowsId, instead of tracking whether an id was actually assigned. This caused two bugs:

  1. NoId commands lost their first arg. For RequiresId verbs with no_id: true and no allows_id (e.g. execute artifact:pip_install), the id-assignment branch correctly skips consuming args[0] — but the stripping logic still assumed it had, silently dropping the first native arg. harness execute artifact:pip_install -- -r requirements.txt invoked pip with just requirements.txt, not -r requirements.txt.
  2. Optional-id + native-args ambiguity. For a verb where the id is optional (AllowsId) alongside has_args: true, args[0] could be a passthrough token from after -- (e.g. -r) that only looks like a flag, indistinguishable by position alone from a real id.

Fix: introduce consumedIdArg, set to true only at the exact point ctx.Id is actually assigned from args[0], and use it (instead of re-deriving the condition) for the downstream stripping logic. For the optional-id branch, resolve the ambiguity with cmd.Flags().ArgsLenAtDash() — the id is only real if it precedes a literal -- (or there's no -- at all); if -- is the very first token, nothing was given as an id, regardless of how many flags preceded it.

Fixes#159

@sawka-harness
sawka-harness merged commit a81bb14 into mainAug 27, 2026
1 check passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flags after "--" are silently swallowed by noun-canonicalization arg scanner (indexNextPositional)

2 participants

@BlueLabelscotch@sawka-harness