Repository navigation
fix(test/security): unbreak 3 src.* mock paths in secure_command_executor_test (#6987 part 1/N) - #7146
Closed
mrveiss wants to merge 0 commit into
Closed
fix(test/security): unbreak 3 src.* mock paths in secure_command_executor_test (#6987 part 1/N)#7146mrveiss wants to merge 0 commit into
mrveiss wants to merge 0 commit into
Conversation
Contributor
✅ SSOT Configuration Compliance: Passing🎉 No hardcoded values detected that have SSOT config equivalents! |
This was referenced May 7, 2026
Closed
mrveiss
added a commit
that referenced
this pull request
May 7, 2026
…o canonical (#7202) (#7209) The #6987 sweep (#7146/#7153/#7160/#7176/#7181) missed 7 sites in 3 files where the mock path utils.redis_client was wrong. utils/redis_client does not exist as a module — patch() raises ModuleNotFoundError, hard-failing each test. Per-symbol resolution: - redis_thread_safety_test.py × 4 → autobot_shared.redis_management.connection_manager.datetime (datetime.now() lives in connection_manager.py for idle cleanup) - redis_prometheus_metrics_test.py × 2 → autobot_shared.monitoring.prometheus_metrics.get_metrics_manager (get_metrics_manager is defined there) - config_migration_integration_test.py × 1 → drop the dead `with patch(...)` wrapper (target never existed; assertions don't depend on the mock) Verification: python3 -m py_compile <each file>: PASS grep 'patch.*"utils.redis_client': 0 sites remain Closes #7202 Co-authored-by: t <t@t>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First slice of #6987 (the 48 broken `patch("src.*")` sites across 14 test files). Fixes 3 sites in `secure_command_executor_test.py` — security-critical test file.
Before/after
```
Before:
$ python3 -m pytest secure_command_executor_test.py::test_run_shell_command_timeout
ModuleNotFoundError: No module named 'src'
After:
$ python3 -m pytest \
autobot-backend/secure_command_executor_test.py::TestSecureCommandExecutor::test_run_shell_command_timeout \
autobot-backend/secure_command_executor_test.py::TestSecureCommandExecutor::test_run_shell_command_execution_error \
autobot-backend/secure_command_executor_test.py::TestSecureCommandExecutor::test_run_shell_command_docker_sandbox
3 passed in 1.02s
```
Fix is mechanical: drop the bogus `src.` prefix. `secure_command_executor` is importable directly via `pythonpath = autobot-backend autobot_shared` in pytest.ini.
Discovery surfaced (NOT introduced)
Running the WHOLE file shows 2 pre-existing test failures unrelated to the src.* bug — `TestSecurityPolicy.test_security_policy_initialization` and `TestSecureCommandExecutor.test_check_dangerous_patterns` both fail because `SecurityPolicy` has been refactored. Test-file rot. Filing as separate tracker.
Per #6987 issue body: "if any tests fail after the fix, those are real regressions to address" — these qualify, but separate scope.
Approach for the rest of #6987
Per-file PRs going forward — each test file may surface its own pre-existing rot when the mocks start firing. Per-file isolation lets each PR carry its own discovery follow-ups cleanly.
Closes part 1/N of #6987 (3 of 48 sites cleaned)