Commit Graph

3428 Commits

Author SHA1 Message Date
controller-ci-rerun bf4da47bdc chore: re-trigger CI [controller]
CI / push-validation (pull_request) Successful in 27s
CI / helm (pull_request) Successful in 43s
CI / lint (pull_request) Successful in 57s
CI / quality (pull_request) Successful in 56s
CI / build (pull_request) Successful in 57s
CI / typecheck (pull_request) Successful in 1m9s
CI / security (pull_request) Successful in 1m12s
CI / unit_tests (pull_request) Failing after 5m8s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / integration_tests (pull_request) Successful in 9m1s
CI / status-check (pull_request) Failing after 3s
2026-06-15 00:43:45 -04:00
HAL9000 a5edf2563b fix(11153): resolve lint failure and revert conflicting registry change
- Format auto_debug.py per ruff to fix CI / lint failure
- Revert registry.py provider/model model-field change that conflicts with TDD test assertions from issue #10926 (models must use bare identifiers without provider prefix)
2026-06-15 00:43:45 -04:00
HAL9000 4422b76266 fix(tests): use provider/model format in actor YAML model field 2026-06-15 00:43:45 -04:00
HAL9000 c491f0e6ea fix(11153): close fail-open security bug and add positive assertions
- _validate_fix exception handler defaults to False (not True),
  preventing crashed LLM validators from passing unvalidated fixes.
- Added positive test assertions verifying returned partial-state dicts
  contain expected keys (messages, current_fix, fix_validated,
  attempted_fixes, result). This closes a coverage blind spot where
  an empty return dict would silently pass immutability tests.

ISSUES CLOSED: #10496
2026-06-15 00:43:45 -04:00
HAL9000 a177f0d6ea fix(11153): address peer review findings for PR #11153
- Fix CHANGELOG entry: replace non-existent update_node()/set_active_node() with
  actual method names (_analyze_error, _generate_fix, _validate_fix, _finalize)
  and clarify LangGraph node contract reference (HAL9000 observation #1).

- Add inline comment explaining shallow-copy semantics in _analyze_error's
  immutability pattern (HAL9000 observation #2): list is new but inner dicts
  are shared refs — safe because messages are immutable-after-creation.

- Document return-asymmetry in _validate_fix docstring: both fix_validated and
  attempted_fixes keys when invalid, only fix_validated when valid. This is
  intentional LangGraph behavior (omitted keys are not reset) (HAL9000 obs #4).

Addresses review comments from peer review #8822 (HAL9000).
2026-06-15 00:43:45 -04:00
HAL9000 ad58efcbe1 test(auto_debug): add missing @tdd_issue tags per CI quality gate (issue #10496)
The feature file for auto-debug state mutation tests was missing required
TDD tags (@tdd_issue, @tdd_issue_10496). This caused CI / tdd_quality_gate
to fail the tag validation check. Added minimal tagging to pass CI while
keeping the fix PR's scenarios passing (no @tdd_expected_fail needed since
the underlying bug is being fixed).
2026-06-15 00:42:16 -04:00
freemo 6353c54b85 fix(agents/graphs/auto_debug): return update dicts from node functions instead of mutating state in-place
ISSUES CLOSED: #10494
2026-06-15 00:42:16 -04:00
HAL9000 bfa29df400 Merge pull request 'docs: add showcase example for CLI version/info/diagnostics basics' (#11108) from fix-pr-4211 into master
CI / lint (push) Successful in 49s
CI / build (push) Successful in 51s
CI / quality (push) Successful in 53s
CI / typecheck (push) Successful in 57s
CI / security (push) Successful in 1m18s
CI / helm (push) Successful in 45s
CI / push-validation (push) Successful in 23s
CI / unit_tests (push) Successful in 4m42s
CI / docker (push) Successful in 1m29s
CI / integration_tests (push) Successful in 8m26s
CI / coverage (push) Successful in 9m14s
CI / status-check (push) Successful in 3s
CI / benchmark-publish (push) Has been cancelled
CI / benchmark-regression (push) Has been cancelled
2026-06-15 04:14:35 +00:00
controller-ci-rerun 61acc6fff5 chore: re-trigger CI [controller]
CI / push-validation (pull_request) Successful in 28s
CI / build (pull_request) Successful in 39s
CI / helm (pull_request) Successful in 43s
CI / quality (pull_request) Successful in 56s
CI / lint (pull_request) Successful in 1m7s
CI / typecheck (pull_request) Successful in 1m13s
CI / security (pull_request) Successful in 1m14s
CI / unit_tests (pull_request) Successful in 4m34s
CI / docker (pull_request) Successful in 1m45s
CI / integration_tests (pull_request) Successful in 11m32s
CI / coverage (pull_request) Successful in 9m13s
CI / status-check (pull_request) Successful in 3s
2026-06-14 23:57:38 -04:00
HAL9000 9edee2d7d5 docs: fix inaccurate fast-path claim in CLI basics documentation
The version, info, and diagnostics commands were incorrectly stated as being on the fast-path. Only --help and --version are eager exit options that skip subcommand module loading.

ISSUES CLOSED: #7592
2026-06-14 23:57:38 -04:00
HAL9000 f38491e5a6 docs: add showcase example for CLI version/info/diagnostics basics
Add a verified CLI showcase for the version, info, and diagnostics commands,
register in examples.json and update CHANGELOG/CONTRIBUTORS.

ISSUES CLOSED: #7592
2026-06-14 23:57:38 -04:00
HAL9000 5fab7395ce Merge pull request 'fix(providers): add ProviderType.GEMINI to ProviderRegistry.FALLBACK_ORDER' (#11003) from fix/gemini-fallback-order-10906 into master
CI / lint (push) Successful in 42s
CI / build (push) Successful in 50s
CI / helm (push) Successful in 43s
CI / typecheck (push) Successful in 1m11s
CI / quality (push) Successful in 1m16s
CI / security (push) Successful in 1m22s
CI / push-validation (push) Successful in 28s
CI / unit_tests (push) Successful in 5m26s
CI / docker (push) Successful in 1m31s
CI / integration_tests (push) Successful in 11m6s
CI / coverage (push) Successful in 10m36s
CI / status-check (push) Has been cancelled
CI / benchmark-publish (push) Has been cancelled
CI / benchmark-regression (push) Has been cancelled
2026-06-15 03:52:44 +00:00
HAL9000 6eb9c41407 fix(providers): resolve gemini fallback test/lint failures
CI / build (pull_request) Successful in 44s
CI / helm (pull_request) Successful in 53s
CI / lint (pull_request) Successful in 59s
CI / quality (pull_request) Successful in 1m0s
CI / push-validation (pull_request) Successful in 44s
CI / typecheck (pull_request) Successful in 1m9s
CI / security (pull_request) Successful in 1m10s
CI / unit_tests (pull_request) Successful in 5m47s
CI / docker (pull_request) Successful in 1m34s
CI / integration_tests (pull_request) Successful in 8m33s
CI / coverage (pull_request) Successful in 9m9s
CI / status-check (pull_request) Successful in 4s
Address reviewer blocking issues on PR #11003:

1. Remove unused `import os` and inner `MagicMock` re-import from the
   gemini fallback step definitions (ruff F401).
2. Remove `@tdd_expected_fail` from the TDD feature now that the
   registry fix makes the scenario pass; keep `@tdd_issue` /
   `@tdd_issue_4750` as permanent regression markers.
3. Rewrite three feature step texts to use the env-var step defs that
   already exist in `provider_registry_steps.py` instead of duplicating
   them (drops the `env var` phrasing the original feature used and that
   had no matching step def).
4. Add `"gemini"` to `FallbackSelector.DEFAULT_FALLBACK_ORDER` after
   `"google"` so the actor-configured fallback chain mirrors the
   registry-level fix.
5. Rename three of the new feature/step pairs to avoid ambiguous-step
   collisions that crashed every behave-parallel worker at module-load
   time (the root cause of the "8 features errored, 0 scenarios"
   pattern):
   - `the result should be ProviderType "GEMINI"` collided with
     `cli_steps.py:138`'s `@then("the result should be {expected}")`;
     renamed to `the gemini fallback default should be
     ProviderType "GEMINI"`.
   - `the result should be None` had the same collision; renamed to
     `the clean gemini registry default should be None`.
   - `@given("I have the ProviderRegistry class")` was duplicated in
     `provider_registry_steps.py:186`; the duplicate is removed and the
     existing definition is reused.

ISSUES CLOSED: #10906
2026-06-14 23:37:20 -04:00
controller-ci-rerun 8be9372991 chore: re-trigger CI [controller] 2026-06-14 23:37:20 -04:00
controller-ci-rerun 84386d4707 chore: re-trigger CI [controller] 2026-06-14 23:37:20 -04:00
HAL9000 854dd2aada fix(providers): add ProviderType.GEMINI to FALLBACK_ORDER
The provider registry's FALLBACK_ORDER was missing ProviderType.GEMINI,
which meant Gemini-only configured installations could not select the
Gemini provider as default via the fallback chain.

This fix adds GEMINI right after GOOGLE in the priority order, consistent
with how it appears in DEFAULT_CAPABILITIES, DEFAULT_MODELS, and
PROVIDER_KEY_ATTRS - all of which already support Gemini.

Includes BDD regression coverage in features/fallback_gemini_provider.feature.

ISSUES CLOSED: #10906

Signed-off-by: HAL 9000 <hal9000@cleverthis.com>
2026-06-14 23:37:20 -04:00
HAL9000 740313b9b1 Merge pull request 'fix(agents/graphs/plan_generation): _validate always passes for code longer than 10 characters, making LLM validation ineffective' (#10876) from pr-fix-10746 into master
CI / quality (push) Successful in 50s
CI / build (push) Successful in 50s
CI / lint (push) Successful in 1m2s
CI / typecheck (push) Successful in 1m3s
CI / helm (push) Successful in 43s
CI / security (push) Successful in 1m12s
CI / push-validation (push) Successful in 30s
CI / unit_tests (push) Successful in 4m39s
CI / docker (push) Successful in 1m30s
CI / integration_tests (push) Successful in 8m51s
CI / coverage (push) Successful in 9m36s
CI / status-check (push) Successful in 4s
CI / benchmark-publish (push) Has been cancelled
CI / benchmark-regression (push) Has been cancelled
2026-06-15 03:24:21 +00:00
controller-ci-rerun df3aa5636b chore: re-trigger CI [controller]
CI / helm (pull_request) Successful in 42s
CI / lint (pull_request) Successful in 44s
CI / build (pull_request) Successful in 53s
CI / push-validation (pull_request) Successful in 30s
CI / quality (pull_request) Successful in 1m5s
CI / typecheck (pull_request) Successful in 1m11s
CI / security (pull_request) Successful in 1m12s
CI / unit_tests (pull_request) Successful in 5m34s
CI / integration_tests (pull_request) Successful in 8m42s
CI / docker (pull_request) Successful in 1m41s
CI / coverage (pull_request) Successful in 10m13s
CI / status-check (pull_request) Successful in 3s
2026-06-14 22:53:22 -04:00
HAL9000 df298f3a3b fix(agents/graphs/plan_generation): fix Behave step definitions to use FakeListLLM and patch.object
- Replace MagicMock() LLM with FakeListLLM (a proper LangChain Runnable)
  to avoid TypeError when PromptTemplate.__or__ evaluates the chain expression
- Use patch.object() context manager to mock _chain_with_retry cleanly
- Fix type annotations from lowercase any to typing.Any
- Separate validation response setup from chain mocking for cleaner test flow

ISSUES CLOSED: #10746
2026-06-14 22:53:22 -04:00
HAL9000 008684737e fix(agents/graphs/plan_generation): _validate always passes for code longer than 10 characters, making LLM validation ineffective
Fix duplicate step_impl function names in Behave test steps that caused
only the last-defined step to be registered with Behave, making all
scenarios fail with undefined step errors. Each step now has a unique
function name following the step_given/step_when/step_then convention.

Also fix the step parameter handling: Gherkin passes quoted string
parameters with their surrounding quotes included, so strip quotes from
the response and status parameters before comparison.

Remove the redundant if/else branch in the validation node step that
called the same code path in both branches.

Add CHANGELOG entry for the fix.

ISSUES CLOSED: #10746
2026-06-14 22:53:22 -04:00
HAL9000 e8e76702a9 fix(agents/graphs/plan_generation): _validate always passes for code longer than 10 characters, making LLM validation ineffective
Remove the len(all_code) > 10 fallback in the _validate method that
was overriding the LLM validation response. Previously, any code longer
than 10 characters would cause validation to automatically pass regardless
of the LLM's assessment, making the validation check ineffective.

The fix ensures validation status is determined solely by whether the LLM
response contains 'PASS', making the validation meaningful.

A regression test was added to verify that FAIL/REJECTED LLM responses
are properly handled even for long code blocks.

ISSUES CLOSED: #10746
2026-06-14 22:50:43 -04:00
HAL9000 59d462b74a Merge pull request 'fix(providers): add ProviderType.GEMINI to FALLBACK_ORDER' (#11064) from fix/gemini-fallback-order-fix-3 into master
CI / lint (push) Successful in 54s
CI / typecheck (push) Successful in 1m1s
CI / build (push) Successful in 48s
CI / quality (push) Successful in 54s
CI / push-validation (push) Successful in 35s
CI / security (push) Successful in 1m11s
CI / helm (push) Successful in 50s
CI / unit_tests (push) Successful in 4m59s
CI / docker (push) Successful in 1m29s
CI / integration_tests (push) Successful in 8m42s
CI / coverage (push) Successful in 13m37s
CI / status-check (push) Successful in 3s
CI / benchmark-publish (push) Has been cancelled
CI / benchmark-regression (push) Has been cancelled
2026-06-15 02:43:55 +00:00
controller-ci-rerun 6a5c5c4a42 chore: re-trigger CI [controller]
CI / build (pull_request) Successful in 47s
CI / lint (pull_request) Successful in 49s
CI / helm (pull_request) Successful in 1m4s
CI / typecheck (pull_request) Successful in 1m7s
CI / quality (pull_request) Successful in 1m7s
CI / security (pull_request) Successful in 1m13s
CI / push-validation (pull_request) Successful in 24s
CI / unit_tests (pull_request) Successful in 5m58s
CI / docker (pull_request) Successful in 1m45s
CI / integration_tests (pull_request) Successful in 8m27s
CI / coverage (pull_request) Successful in 11m25s
CI / status-check (pull_request) Successful in 2s
2026-06-14 21:28:31 -04:00
HAL9000 579a99d8b6 docs: update CHANGELOG and CONTRIBUTORS for ProviderType.GEMINI fix
Updated CHANGELOG.md with entry under [Unreleased] > Fixed section,
and ensured CONTRIBUTORS.md includes the bot contributor.

ISSUES CLOSED: #10906
2026-06-14 21:28:31 -04:00
HAL9000 0fd503226b fix(providers): add ProviderType.GEMINI to FALLBACK_ORDER
Add ProviderType.GEMINI to both ProviderRegistry.FALL_BACK_ORDER and
FallbackSelector.DEFAULT_FALLBACK_ORDER, ensuring Gemini is included
in provider fallback chains for auto-discovery. Also remove the
@tdd_expected_fail tag from the TDD regression test since the bug
is now fixed.

ISSUES CLOSED: #10906
2026-06-14 21:28:31 -04:00
HAL9000 39921a5868 Merge pull request 'fix(cli): wrap plan apply --format json output in spec-required JSON envelope' (#11018) from pr-9817-plan-apply-json into master
CI / lint (push) Successful in 48s
CI / quality (push) Successful in 1m16s
CI / typecheck (push) Successful in 1m21s
CI / security (push) Successful in 1m21s
CI / build (push) Successful in 43s
CI / push-validation (push) Successful in 36s
CI / helm (push) Successful in 53s
CI / unit_tests (push) Successful in 7m0s
CI / docker (push) Successful in 1m31s
CI / integration_tests (push) Successful in 10m44s
CI / coverage (push) Successful in 9m7s
CI / status-check (push) Successful in 3s
CI / benchmark-publish (push) Has been cancelled
CI / benchmark-regression (push) Has been cancelled
2026-06-15 01:23:45 +00:00
HAL9000 372ef09153 fix(cli): add _apply_output_dict and fix robot/behave tests for plan apply JSON envelope
CI / push-validation (pull_request) Successful in 24s
CI / helm (pull_request) Successful in 51s
CI / build (pull_request) Successful in 51s
CI / lint (pull_request) Successful in 1m8s
CI / typecheck (pull_request) Successful in 1m9s
CI / quality (pull_request) Successful in 1m9s
CI / security (pull_request) Successful in 1m26s
CI / unit_tests (pull_request) Successful in 6m21s
CI / integration_tests (pull_request) Successful in 8m34s
CI / docker (pull_request) Successful in 1m38s
CI / coverage (pull_request) Successful in 9m16s
CI / status-check (pull_request) Successful in 5s
- Add _apply_output_dict() building the spec-required JSON envelope
- Update lifecycle_apply_plan to use _apply_output_dict for --format json
- Rewrite robot file to use Run Process + helper dispatch pattern
- Rewrite robot helper to use real LifecyclePlan domain objects
- Apply ruff format to plan_apply_json_envelope_steps.py
2026-06-14 21:07:19 -04:00
controller-ci-rerun 27f2fa7dc8 chore: re-trigger CI [controller] 2026-06-14 21:07:19 -04:00
controller-ci-rerun 32bfe5b84a chore: re-trigger CI [controller] 2026-06-14 21:07:19 -04:00
controller-ci-rerun d24a1ab4fe chore: re-trigger CI [controller] 2026-06-14 21:07:19 -04:00
HAL9000 b4a7f26d7c bug(cli): plan apply --format json returns raw plan dict instead of spec-required JSON envelope
The `agents plan apply --format json` command was returning a raw
plan dictionary instead of the spec-required JSON envelope. This fix
introduces a dedicated `_apply_output_dict()` helper that wraps the
non-rich format output in the proper envelope structure with
`command`, `status`, `exit_code`, `data`, `timing`, and `messages`
fields.

The `data` field contains structured information about artifacts,
changes, project, applied_at, validation (test/lint/type_check),
sandbox_cleanup, and lifecycle metrics. Other commands (plan status,
plan cancel, plan use) remain unaffected — they continue using
`_plan_spec_dict`.

Tests: 16 Behave scenarios + 15 Robot Framework integration tests
added covering envelope structure, field presence, sandbox cleanup
state derivation from actual plan state, legacy fallback, cost
metadata, and command isolation.

ISSUES CLOSED: #9449
2026-06-14 21:07:19 -04:00
HAL9000 76182b891f Merge pull request 'fix(lsp): prevent resource exhaustion DoS in language discovery directory traversal' (#10632) from bugfix/m3.6.0-lsp-discovery-resource-exhaustion-dos into master
CI / build (push) Successful in 33s
CI / lint (push) Successful in 42s
CI / quality (push) Successful in 48s
CI / helm (push) Successful in 47s
CI / typecheck (push) Successful in 59s
CI / security (push) Successful in 1m16s
CI / push-validation (push) Successful in 23s
CI / unit_tests (push) Successful in 5m0s
CI / docker (push) Successful in 1m31s
CI / integration_tests (push) Successful in 8m32s
CI / coverage (push) Successful in 13m16s
CI / status-check (push) Successful in 3s
CI / benchmark-publish (push) Has been cancelled
CI / benchmark-regression (push) Has been cancelled
2026-06-15 00:57:06 +00:00
HAL9000 f8f5f2f3f4 test(lsp): cover timeout branches in detect_directory_languages
CI / lint (pull_request) Successful in 59s
CI / typecheck (pull_request) Successful in 1m8s
CI / push-validation (pull_request) Successful in 38s
CI / build (pull_request) Successful in 52s
CI / helm (pull_request) Successful in 56s
CI / security (pull_request) Successful in 1m18s
CI / quality (pull_request) Successful in 1m14s
CI / unit_tests (pull_request) Successful in 5m40s
CI / docker (pull_request) Successful in 1m36s
CI / integration_tests (pull_request) Successful in 8m59s
CI / coverage (pull_request) Successful in 9m27s
CI / status-check (pull_request) Successful in 4s
Add two BDD scenarios that mock os.walk and the time module so the
outer-loop and inner-file-loop timeout-exceeded branches in
detect_directory_languages() are deterministically exercised. Closes
the diff-coverage gap on src/cleveragents/lsp/discovery.py lines
250-257 (outer-loop timeout warning + break) and 284-291 (inner-loop
timeout warning + break) which the previous DoS protection scenarios
did not reach.

Refs: #7161
2026-06-14 20:39:38 -04:00
controller-ci-rerun 728f42cbd0 chore: re-trigger CI [controller] 2026-06-14 20:39:38 -04:00
HAL9000 c4024146b1 fix(lsp): move tdd_issue tags before Feature keyword in dos protection feature
The @tdd_issue and @tdd_issue_7161 tags were placed inside the Feature
description body (indented after Feature:), where Behave treats them as
free-text, not tags. The parser fails at the plain-text description line
that follows ("Prevent resource exhaustion...") because it entered the
taggable_statement state after seeing the @-prefixed lines.

Moving both tags to before the Feature: line makes them proper
feature-level tags. All 9 scenarios inherit @tdd_issue via effective_tags,
satisfying the validate_tdd_tags() rule that every @tdd_issue_N scenario
must also carry @tdd_issue. All 9 scenarios now pass.

Refs: #7161
2026-06-14 20:39:38 -04:00
HAL9000 9297b283e4 fix(10632): address PR review blocking issues
Resolved three blocking review items from pr-review-worker:

1. Added @tdd_issue tag at Feature level to fix unit_tests CI failure
   (each scenario has @tdd_issue_7161 which requires @tdd_issue present)

2. Assigned milestone v3.6.0 to align with linked issue #7161

3. Applied ruff format to resolve lint/format violations in discovery.py
2026-06-14 20:39:38 -04:00
HAL9000 07469f55a5 fix(lsp): add depth/file/timeout limits to detect_directory_languages() to prevent DoS
Added robust guards to detect_directory_languages() by introducing depth, file count, and timeout controls. Defaults and validations are implemented to prevent resource exhaustion during LSP discovery.

- Added max_depth parameter (default: 50) with validation to ensure a positive integer.
- Added max_files parameter (default: 10,000) with validation to ensure a positive integer.
- Added timeout parameter (default: 30.0 seconds) with validation to ensure a positive float.
- Pass followlinks=False to os.walk() to prevent symlink-based DoS via recursive loops.
- Implemented depth tracking in the traversal loop with early break when max_depth is exceeded.
- Implemented file count tracking with early break when max_files is exceeded.
- Implemented periodic timeout checks during traversal to enforce the overall time limit.
- Added warning logging when traversal is terminated early due to any limit.
- Updated the function docstring to document the new parameters and their defaults.
- Created comprehensive BDD tests in features/lsp_discovery_dos_protection.feature to validate the protections.

ISSUES CLOSED: #7161
2026-06-14 20:39:38 -04:00
HAL9000 4d303b09c6 Merge pull request 'test-infra: Add Semgrep guard for broad exception suppression' (#9185) from chore/test-infra-broad-exception-lint into master
CI / push-validation (push) Successful in 35s
CI / helm (push) Successful in 57s
CI / build (push) Successful in 58s
CI / typecheck (push) Successful in 1m12s
CI / lint (push) Successful in 1m21s
CI / quality (push) Successful in 1m21s
CI / security (push) Successful in 1m30s
CI / unit_tests (push) Successful in 5m26s
CI / integration_tests (push) Successful in 8m31s
CI / docker (push) Successful in 1m47s
CI / coverage (push) Successful in 9m19s
CI / status-check (push) Successful in 3s
CI / benchmark-publish (push) Has been cancelled
CI / benchmark-regression (push) Has been cancelled
2026-06-14 23:43:55 +00:00
controller-ci-rerun 5ad316f19d chore: re-trigger CI [controller]
CI / push-validation (pull_request) Successful in 37s
CI / build (pull_request) Successful in 52s
CI / helm (pull_request) Successful in 53s
CI / lint (pull_request) Successful in 1m18s
CI / typecheck (pull_request) Successful in 1m18s
CI / quality (pull_request) Successful in 1m18s
CI / security (pull_request) Successful in 1m37s
CI / unit_tests (pull_request) Successful in 5m44s
CI / docker (pull_request) Successful in 1m44s
CI / integration_tests (pull_request) Successful in 9m7s
CI / coverage (pull_request) Successful in 9m44s
CI / status-check (pull_request) Successful in 3s
2026-06-14 19:05:21 -04:00
controller-ci-rerun 196c6f3a43 chore: re-trigger CI [controller] 2026-06-14 19:05:21 -04:00
HAL9000 81e0d52a73 fix(lint): apply ruff format to security_scan_hooks_steps.py 2026-06-14 19:05:21 -04:00
HAL9000 aa2a18e145 fix(test-steps): correct YAML structure handling in bare re-raise check
The Semgrep patterns node is a YAML list (not dict), so the previous
implementation's .get() call on patterns would fail with AttributeError.

Fix: properly handle 'patterns' as a list of alternation groups, each
containing pattern-either -> patterns -> pattern-not entries. This
ensures the BDD assertion robustly finds bare raise pattern-nots in
the xml-no-suppressed-exception rule's nested structure.

Issues Closed: #9103
2026-06-14 19:05:21 -04:00
HAL9000 1d5cff117c docs(contributors): add Semgrep guard contribution entry for PR #9185
Document HAL 9000's contribution of the broad exception suppression
Semgrep guard (PR #9185, issue #9103) in CONTRIBUTORS.md per the
PR compliance checklist requirement.
2026-06-14 19:05:21 -04:00
HAL9000 a9156ee8e6 test(test-infra): fix Semgrep CI lint failures and strengthen BDD assertions
Address blocking issues from PR review by HAL9001 (review #7080):

1. Add success_codes=[0, 1] to noxfile.py semgrep invocation so
   the lint session runs in proper audit mode without failing CI on
   the ~337 existing violations during phased rollout.

2. Strengthen BDD bare re-raise assertion: replace weak string search
   for 'raise' with structured parsing of YAML pattern-not entries to
   specifically verify bare raise patterns exist within the rule's
   pattern-not configurations.

3. Add CHANGELOG.md entry under [Unreleased] documenting the Semgrep
   guard implementation and its audit-mode migration strategy.

Issues Closed: #9103
2026-06-14 19:05:21 -04:00
HAL9000 020874536c test(test-infra): add BDD scenarios for Semgrep exception suppression rules
Add 12 new Behave BDD scenarios to features/security_scan_hooks.feature
to automatically validate the Semgrep broad exception suppression rules
and their escape hatch behavior, as suggested by reviewer HAL9001.

New scenarios verify:
- python-no-suppressed-exception rule exists and targets src/
- python-no-suppress-exception rule exists and targets src/
- Both rules document the nosemgrep escape hatch in their messages
- Both rules document the error-propagation: allow annotation
- python-no-suppressed-exception has pattern-not for bare re-raise
- python-no-suppressed-exception has pattern-not for exception chaining
- Nox lint session integrates Semgrep and references .semgrep.yml

All 25 scenarios pass (13 original + 12 new).

ISSUES CLOSED: #9103
2026-06-14 19:05:21 -04:00
HAL9000 747513bc59 chore(testing): enforce semgrep gate for suppressed exceptions
Fix broken escape hatch mechanism and address reviewer feedback:

- Replace non-functional comment-based pattern-not clauses with Semgrep's native # nosemgrep mechanism for the escape hatch. Semgrep strips comments from the AST so pattern-not clauses matching inline comments never fire; # nosemgrep is the only reliable per-line suppression mechanism.

- Require both # nosemgrep: <rule-id> AND # error-propagation: allow on the same line: the former is the actual suppression, the latter is the mandatory human-readable audit annotation.

- Add raise $EXC from $CAUSE pattern-not entries for both Exception and BaseException variants to prevent false positives on legitimate exception chaining (raise ServiceError from e).

- Switch nox -s lint Semgrep invocation to audit mode (no --error) for the phased rollout: the codebase has ~337 existing suppressions that must be triaged before enforcement mode is enabled. A comment in noxfile.py documents the migration path and references #9103.

- Update CONTRIBUTING.md examples and enforcement description to reflect the dual-comment requirement.
2026-06-14 19:05:21 -04:00
HAL9000 d79a1c6988 test-infra: fix Semgrep escape hatch and add exception chaining pattern 2026-06-14 19:01:47 -04:00
HAL9000 7210183c29 test-infra: fix Semgrep escape hatch and add exception chaining pattern
Fixed two critical issues with the Semgrep rules for broad exception suppression:

1. **Escape hatch mechanism**: Replaced the broken `# error-propagation: allow` comment-based escape hatch with Semgrep's native `# nosemgrep` comment support. Semgrep strips comments from the AST, so pattern-not clauses looking for inline comments never match. The native `# nosemgrep` comment is properly supported by Semgrep and provides a reliable override mechanism.

2. **Missing exception chaining pattern**: Added `raise $EXC from $CAUSE` pattern-not entries for both `Exception` and `BaseException` variants. This prevents false positives when legitimate exception chaining is used (e.g., `raise ServiceError("context") from e`), which is an allowed pattern per CONTRIBUTING.md.

Updated both `python-no-suppressed-exception` and `python-no-suppress-exception` rules with these fixes. The escape hatch now works reliably and exception chaining is properly recognized as an allowed pattern.

ISSUES CLOSED: #9103
2026-06-14 19:01:47 -04:00
HAL9000 153acf0861 chore(testing): enforce semgrep gate for suppressed exceptions
Added two new Semgrep rules to enforce the CONTRIBUTING.md guideline against broad exception suppression:
- python-no-suppressed-exception: Detects except Exception/BaseException blocks without re-raising
- python-no-suppress-exception: Detects contextlib.suppress(Exception/BaseException) usage

Both rules support an escape hatch annotation '# error-propagation: allow' for documented recovery logic.

Integrated Semgrep into the nox lint session to run alongside Ruff checks.
Updated CONTRIBUTING.md to document the escape hatch policy and automated enforcement.
Pre-commit hook already configured to run these rules.

ISSUES CLOSED: #9103
2026-06-14 19:01:47 -04:00
HAL9000 ad1af58d12 Merge pull request 'feat(budget): add cost reporting to plan status and session show CLI output' (#10616) from feat/v3.6.0/cost-reporting-cli into master
CI / push-validation (push) Successful in 28s
CI / lint (push) Successful in 37s
CI / build (push) Successful in 47s
CI / helm (push) Successful in 51s
CI / typecheck (push) Successful in 1m3s
CI / quality (push) Successful in 1m1s
CI / security (push) Successful in 1m22s
CI / unit_tests (push) Successful in 5m45s
CI / docker (push) Successful in 1m35s
CI / integration_tests (push) Successful in 10m1s
CI / coverage (push) Successful in 9m15s
CI / status-check (push) Successful in 3s
CI / benchmark-publish (push) Has been cancelled
CI / benchmark-regression (push) Has been cancelled
2026-06-14 22:34:01 +00:00