Browse Source
The -conflicts and -parsekeymode error vocabulary declared at define time
(0.19.0) is now enforced at parse. A new optionconflict failure class joins the
PUNKARGS VALIDATION errorcode vocabulary, mirroring optionmissing's shape:
{optionconflict <arg_a> <arg_b> received <receivednames>} - it names both
offending received arguments, for both per-arg -conflicts violations (any
pair, cross-group) and -parsekeymode error group co-occurrence (distinct
members of a shared-parsekey group).
The check runs in a single post-resolution site in get_dict_form (after the
optionmissing/valuemissing block), so the ordinary option path and the mash
(short-flag bundling) path share it - both raise identically. Checked against
RECEIVED arguments only (defaults never conflict), after prefix/abbreviation
resolution, on optset identity (a new optsets_received tracker for options,
since flagsreceived collapses shared-parsekey members onto one api_opt). Runs
unconditionally - a received conflict is a hard contradiction in any mode, not
end-of-input exhaustion, so parse_status_classify maps optionconflict to invalid
(not incomplete) and the candidacy/viability probe reports it.
Define-time check added: a group marked -parsekeymode error must also declare a
non-empty -parsekey (the strict mode only applies to a shared-parsekey group).
relations.test extended with 7 enforcement pins (raise cases for -conflicts
and -parsekeymode error, defaults-never-conflict, cross-group conflicts,
one-received-ok, override-legacy last-wins, parse_status invalid). buildversion
0.19.0 -> 0.20.0.
Bug found and fixed during the increment: the group-co-occurrence dedup check
initially used `ni` (not-in) where `in` was meant - `ni` returns true on an
empty list, so it skipped every member and the check never fired. Corrected
to `in`.
Legacy untouched by default: -parsekeymode override is the default and absent
-conflicts means no check runs, so the full existing suite (including the
pinned parsekey_repeat_ordering last-wins / prepend-defaults idiom) passes
unchanged.
Verification: full punk/args suite via canonical tclsh90s - 363 total / 360
passed / 3 skipped (punkargsKnownBug) / 0 failed; punk/ns suite 125/125 clean.
goals_lint clean. No punkproject.toml bump (module API addition, not shell-
level user-visible behaviour yet - the lsearch moduledoc adoption that ships
user-visible behaviour lands in increment 3).
Assisted-by: harness=pi; primary-model=huggingface/zai-org/GLM-5.2; api-location=huggingface.co
master
5 changed files with 222 additions and 14 deletions
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue