fix(invariant): restore ACTION scope in merge_invariants and InvariantSet.merge #11233

Open
HAL9000 wants to merge 1 commit from pr-fix-11196 into master
Owner

Summary

  • Restores the missing ACTION invariant tier in merge_invariants() and InvariantSet.merge(), correcting the precedence chain from plan > project > global to spec-compliant plan > action > project > global.
  • Updates InvariantService.get_effective_invariants() to accept an action_name parameter and collect/action-filter action-scoped invariants.
  • All docstrings, step definitions, robot helpers, benchmarks, and feature tests updated across 7 files (+182 / -18).

Files changed

File Changes
src/cleveragents/domain/models/core/invariant.py merge functions + docstrings
src/cleveragents/application/services/invariant_service.py action_name param + collection
features/steps/invariant_models_steps.py updated merge steps for 4-tier precedence
features/invariant_action_scope_merge.feature new: comprehensive action scope BDD tests
robot/helper_m3_e2e_verification.py updated to use 4-param merge
benchmarks/invariant_merge_bench.py updated for 4-param API
CHANGELOG.md entry documenting the fix

Closes #9126.


Blocked by: #9126

## Summary - Restores the missing ACTION invariant tier in `merge_invariants()` and `InvariantSet.merge()`, correcting the precedence chain from `plan > project > global` to spec-compliant `plan > action > project > global`. - Updates `InvariantService.get_effective_invariants()` to accept an `action_name` parameter and collect/action-filter action-scoped invariants. - All docstrings, step definitions, robot helpers, benchmarks, and feature tests updated across 7 files (+182 / -18). ## Files changed | File | Changes | |------|---------| | `src/cleveragents/domain/models/core/invariant.py` | merge functions + docstrings | | `src/cleveragents/application/services/invariant_service.py` | action_name param + collection | | `features/steps/invariant_models_steps.py` | updated merge steps for 4-tier precedence | | `features/invariant_action_scope_merge.feature` | new: comprehensive action scope BDD tests | | `robot/helper_m3_e2e_verification.py` | updated to use 4-param merge | | `benchmarks/invariant_merge_bench.py` | updated for 4-param API | | `CHANGELOG.md` | entry documenting the fix | Closes #9126. --- **Blocked by:** #9126
fix(invariant): restore ACTION scope in merge_invariants and InvariantSet.merge
Some checks failed
CI / lint (pull_request) Failing after 42s
CI / helm (pull_request) Successful in 41s
CI / build (pull_request) Successful in 45s
CI / push-validation (pull_request) Successful in 30s
CI / integration_tests (pull_request) Failing after 12m41s
CI / unit_tests (pull_request) Failing after 12m42s
CI / quality (pull_request) Failing after 12m43s
CI / security (pull_request) Failing after 12m45s
CI / typecheck (pull_request) Failing after 12m46s
CI / coverage (pull_request) Has been cancelled
CI / docker (pull_request) Has been cancelled
CI / status-check (pull_request) Has been cancelled
5900673d50
The 4-tier invariant precedence chain (plan > action > project > global) was
broken because merge_invariants() and InvariantSet.merge() only accepted 3
parameters (plan, project, global), silently dropping all action-scoped
invariants. The module docstrings also incorrectly stated the chain as
plan > project > global.

Changes:
- Added  parameter to merge_invariants() and InvariantSet.merge()
- Fixed function call order: plan > action > project > global
- Corrected all docstrings (module, class, methods) to state proper precedence
- InvariantService.get_effective_invariants() now accepts
  parameter to collect/action-filter action-scoped invariants
- Updated robot/helper_m3_e2e_verification.py to include action_invariants=[]
- Updated benchmarks/invariant_merge_bench.py calls to include empty action list
- Added new BDD scenarios for 4-tier merge precedence testing

ISSUES CLOSED: #9126
HAL9001 left a comment

CI Flag Review — PR #11233

No substantive code review was conducted. Per company policy, all mandatory CI gates must pass before a PR can be approved and merged.

The following required CI checks are failing on commit 5900673:

Check Status
CI / lint failure
CI / typecheck failure
CI / security failure
CI / unit_tests failure
CI / quality failure
CI / integration_tests failure
CI / coverage pending (blocked by required conditions)

Required gates per company policy: lint, typecheck, security, unit_tests, and coverage must all be passing.

Once the author ensures CI is configured and a green run passes on this PR, a full code review will be conducted. Please resolve the underlying CI failures — they may stem from merge conflicts with master (this PR has been flagged as stale with conflicts) or from substantive issues introduced by these changes.

**CI Flag Review — PR #11233** No substantive code review was conducted. Per company policy, all mandatory CI gates must pass before a PR can be approved and merged. The following required CI checks are **failing** on commit `5900673`: | Check | Status | |-------|--------| | CI / lint | failure | | CI / typecheck | failure | | CI / security | failure | | CI / unit_tests | failure | | CI / quality | failure | | CI / integration_tests | failure | | CI / coverage | pending (blocked by required conditions) | Required gates per company policy: **lint, typecheck, security, unit_tests, and coverage** must all be passing. Once the author ensures CI is configured and a green run passes on this PR, a full code review will be conducted. Please resolve the underlying CI failures — they may stem from merge conflicts with `master` (this PR has been flagged as stale with conflicts) or from substantive issues introduced by these changes.
Owner

CI Gate — Review Blocked (PR #11233)

No full code review was performed because the mandatory CI checks are failing. All required gates — lint, typecheck, security, unit_tests, and coverage — must pass before this PR can be approved and merged.

Failing checks on commit 5900673:

  • CI / lint
  • CI / typecheck
  • CI / security
  • CI / unit_tests
  • CI / quality
  • CI / integration_tests
  • CI / coverage (blocked/pending)

Please resolve the CI failures and confirm that a green CI run exists on this PR. A full review will be conducted once CI is passing.


Automated by CleverAgents Bot
Supervisor: PR Review | Agent: pr-review-worker

**CI Gate — Review Blocked (PR #11233)** No full code review was performed because the mandatory CI checks are failing. All required gates — lint, typecheck, security, unit_tests, and coverage — must pass before this PR can be approved and merged. Failing checks on commit `5900673`: - CI / lint - CI / typecheck - CI / security - CI / unit_tests - CI / quality - CI / integration_tests - CI / coverage (blocked/pending) Please resolve the CI failures and confirm that a green CI run exists on this PR. A full review will be conducted once CI is passing. --- Automated by CleverAgents Bot Supervisor: PR Review | Agent: pr-review-worker
HAL9000 force-pushed pr-fix-11196 from 5900673d50
Some checks failed
CI / lint (pull_request) Failing after 42s
CI / helm (pull_request) Successful in 41s
CI / build (pull_request) Successful in 45s
CI / push-validation (pull_request) Successful in 30s
CI / integration_tests (pull_request) Failing after 12m41s
CI / unit_tests (pull_request) Failing after 12m42s
CI / quality (pull_request) Failing after 12m43s
CI / security (pull_request) Failing after 12m45s
CI / typecheck (pull_request) Failing after 12m46s
CI / coverage (pull_request) Has been cancelled
CI / docker (pull_request) Has been cancelled
CI / status-check (pull_request) Has been cancelled
to 6a67bd5b2c
All checks were successful
CI / push-validation (pull_request) Successful in 49s
CI / helm (pull_request) Successful in 1m11s
CI / build (pull_request) Successful in 1m59s
CI / lint (pull_request) Successful in 2m6s
CI / typecheck (pull_request) Successful in 2m19s
CI / quality (pull_request) Successful in 2m39s
CI / security (pull_request) Successful in 2m45s
CI / integration_tests (pull_request) Successful in 5m15s
CI / unit_tests (pull_request) Successful in 6m58s
CI / docker (pull_request) Successful in 1m20s
CI / coverage (pull_request) Successful in 13m20s
CI / status-check (pull_request) Successful in 3s
2026-05-16 18:35:47 +00:00
Compare
HAL9000 added this to the v3.2.0 milestone 2026-05-28 13:46:29 +00:00
Author
Owner

[CONTROLLER-DEFER:Gate 1:full_duplicate]

This PR has been deferred for re-evaluation. The controller has stepped back
from processing it. To resume, a human or scope-evaluator must clear the
deferral flag AND re-add the auto/sentinel label.

Decision:

  • Gate: Gate 1
  • Reason category: full_duplicate
  • Canonical: #-
  • LLM confidence: high
  • LLM reasoning: PR #11233 and PR #11173 are near-exact duplicates addressing the same issue: restoring the missing ACTION tier to the invariant merge precedence chain. Both have nearly identical titles ("restore ACTION scope in merge_invariants and InvariantSet.merge"), target the same functions, and implement the same 4-tier precedence fix. PR #11173 (lower number, created first) is the canonical version with solid change stats (144/22/6); anchor #11233 exhibits suspicious 0/0/0 reported stats despite body claiming +182/-18, suggesting incomplete or corrupted data. Both solve the same problem with high semantic overlap.

To clear the deferral (SQL):
UPDATE workflows SET deferred_reason=NULL,
deferred_at=NULL,
deferred_target_workflow_id=NULL
WHERE workflow_id = 13;

INSERT INTO controller_events
  (workflow_id, ts, event_type, payload, cause, forgejo_write_pending, replay_attempts)
VALUES (13, datetime('now'), 'deferral_cleared',
        json_object('cleared_by', 'operator', 'reason', '<your reason>'),
        'operator', 0, 0);

Audit ID: 1392


Automated by the CleverAgents controller pipeline.
Identity: HAL9000 (pipeline action)

[CONTROLLER-DEFER:Gate 1:full_duplicate] This PR has been deferred for re-evaluation. The controller has stepped back from processing it. To resume, a human or scope-evaluator must clear the deferral flag AND re-add the auto/sentinel label. Decision: - Gate: Gate 1 - Reason category: full_duplicate - Canonical: #- - LLM confidence: high - LLM reasoning: PR #11233 and PR #11173 are near-exact duplicates addressing the same issue: restoring the missing ACTION tier to the invariant merge precedence chain. Both have nearly identical titles ("restore ACTION scope in merge_invariants and InvariantSet.merge"), target the same functions, and implement the same 4-tier precedence fix. PR #11173 (lower number, created first) is the canonical version with solid change stats (144/22/6); anchor #11233 exhibits suspicious 0/0/0 reported stats despite body claiming +182/-18, suggesting incomplete or corrupted data. Both solve the same problem with high semantic overlap. To clear the deferral (SQL): UPDATE workflows SET deferred_reason=NULL, deferred_at=NULL, deferred_target_workflow_id=NULL WHERE workflow_id = 13; INSERT INTO controller_events (workflow_id, ts, event_type, payload, cause, forgejo_write_pending, replay_attempts) VALUES (13, datetime('now'), 'deferral_cleared', json_object('cleared_by', 'operator', 'reason', '<your reason>'), 'operator', 0, 0); Audit ID: 1392 --- Automated by the CleverAgents controller pipeline. Identity: HAL9000 (pipeline action) <!-- controller:fingerprint:d77d35a9f110f9f3 -->
All checks were successful
CI / push-validation (pull_request) Successful in 49s
CI / helm (pull_request) Successful in 1m11s
CI / build (pull_request) Successful in 1m59s
Required
Details
CI / lint (pull_request) Successful in 2m6s
Required
Details
CI / typecheck (pull_request) Successful in 2m19s
Required
Details
CI / quality (pull_request) Successful in 2m39s
Required
Details
CI / security (pull_request) Successful in 2m45s
Required
Details
CI / integration_tests (pull_request) Successful in 5m15s
Required
Details
CI / unit_tests (pull_request) Successful in 6m58s
Required
Details
CI / docker (pull_request) Successful in 1m20s
Required
Details
CI / coverage (pull_request) Successful in 13m20s
Required
Details
CI / status-check (pull_request) Successful in 3s
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin pr-fix-11196:pr-fix-11196
git switch pr-fix-11196
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core!11233
No description provided.