fix(validation): replace positional key=value args with --key value named options in validation attach command #3880

Merged
HAL9000 merged 7 commits from bugfix/validation-attach-named-option-format into master 2026-06-14 21:54:17 +00:00

7 Commits

Author SHA1 Message Date
cleveragents-auto adf12ba7ba chore: worker ruff auto-fix (pre-push lint gate)
CI / lint (pull_request) Successful in 40s
CI / typecheck (pull_request) Successful in 1m8s
CI / helm (pull_request) Successful in 58s
CI / build (pull_request) Successful in 58s
CI / push-validation (pull_request) Successful in 32s
CI / quality (pull_request) Successful in 1m4s
CI / security (pull_request) Successful in 1m17s
CI / unit_tests (pull_request) Successful in 5m18s
CI / integration_tests (pull_request) Successful in 8m40s
CI / docker (pull_request) Successful in 1m39s
CI / coverage (pull_request) Successful in 11m37s
CI / status-check (pull_request) Successful in 3s
2026-06-14 17:33:45 -04:00
HAL9000 edd478c42d test(validation): exclude unreachable bare '--' branch from coverage
Click consumes the bare '--' end-of-options marker before tokens reach
ctx.args, so the `if not key:` defensive branch in `attach` cannot be
exercised from CLI invocation. Mark it `# pragma: no cover` so
diff-coverage stops flagging lines 323/324/326 on this PR.

Verified with a direct CliRunner invocation: passing '--' (alone or
followed by other tokens) never produces a token whose `[2:]` is empty
— Click strips it.

Closes #3684
2026-06-14 17:33:45 -04:00
controller-ci-rerun 2b1a7b2e2b chore: re-trigger CI [controller] 2026-06-14 17:33:45 -04:00
controller-ci-rerun 9157bd7a52 chore: re-trigger CI [controller] 2026-06-14 17:33:45 -04:00
HAL9000 06d6acab94 fix(validation): normalise --key value option keys and reject consecutive flags
Restore the two behaviours that master had but were lost in this branch:

1. Convert hyphens to underscores in named-option keys before forwarding
   to the service layer (--coverage-threshold → coverage_threshold). This
   matches Typer/Click's universal convention and the documented
   attach_validation(args=...) contract, where keys must be Python-
   identifier-style strings.

2. Detect a missing value when the next token starts with -- (e.g.
   "--threshold --strict true" no longer silently sets threshold to the
   literal string "--strict"; it errors with a clear "Missing value for
   option" message).

Update the Behave step definitions and the Robot helper to assert the
underscore-normalised key (coverage_threshold), matching the restored
behaviour. The CLI-level option name (--coverage-threshold) is unchanged
in the feature file and Robot test — only the dict key the service
receives is normalised.
2026-06-14 17:33:45 -04:00
HAL9000 66b0f362d3 fix(tests): remove duplicate "rejection output should contain" step to fix AmbiguousStep
The new step file defined a Then step that collided with the pre-existing
definition in validation_attach_type_guard_steps.py:220, causing behave to
abort step-module loading with AmbiguousStep across every worker and
failing the unit_tests gate with 32 errored features.

Remove the duplicate from the new file and bridge context.last_result =
context.named_opts_result after each invoke so the pre-existing,
context.last_result-based step covers the new feature file's scenarios.

Closes #3684
2026-06-14 17:33:45 -04:00
freemo 58c9760856 fix(validation): replace positional key=value args with --key value named options in validation attach command
Refactors the 'agents validation attach' command to accept extra validation
arguments as named CLI options using '--key value' format (e.g.
'--coverage-threshold 90'), as required by the specification.

Changes:
- validation.py: Replace positional 'key=value' Argument with Typer context
  settings (allow_extra_args=True, ignore_unknown_options=True) to capture
  '--key value' named options from ctx.args. Strips '--' prefix and maps
  tokens to {key: value} dict entries. Rejects bare tokens (not '--key value')
  with a clear error message.
- features/tdd_validation_attach_named_options.feature: New TDD Behave
  scenarios covering single/multiple named options, no-args case, and
  rejection of old positional key=value format.
- features/steps/tdd_validation_attach_named_options_steps.py: Step
  definitions for the new feature.
- robot/validation_attach_named_options.robot: Robot Framework integration
  tests verifying spec-compliant '--key value' option format.
- robot/helper_validation_attach_named_options.py: Helper script for the
  Robot Framework tests.
- features/steps/tdd_cli_incomplete_subcommand_registration_steps.py: Fix
  pre-existing CliRunner(mix_stderr=False) incompatibility with current Typer.
- features/steps/tool_runtime_steps.py: Fix pre-existing AmbiguousStep error
  by converting conflicting parse-based step definitions to regex matchers.
- features/consolidated_tool.feature: Update step text to match renamed step.

Closes #3684
2026-06-14 17:33:45 -04:00