Skip to content

Commit 4695d46

Browse files
committed
Keep security auditing focused on the base install
Avoid pulling dev-only optional runtimes into the editable pip-audit job, and make the thread-capability guard match the actual concurrency demand of the affected test. Constraint: pip-audit flagged starlette from the dev editable install, while the lockfile export remains base-install only. Rejected: global thread skip hook | it masked unrelated test regressions. Confidence: high Scope-risk: narrow Directive: keep security jobs on the distributable surface unless a specific optional extra is under review. Tested: git diff --check; pytest tests/test_phase5_context_bus.py::TestContextBus::test_parallel_publish_from_threads tests/test_swarm.py::test_swarm_manager_execute_multiple tests/test_managed_runtime.py tests/test_telemetry.py -q Not-tested: full GitHub Actions run
1 parent f26bf4f commit 4695d46

3 files changed

Lines changed: 13 additions & 8 deletions

File tree

.github/workflows/security.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Install project + audit
2626
run: |
2727
python -m pip install --upgrade pip
28-
pip install -e ".[dev,oauth,telemetry]"
28+
pip install -e .
2929
pip install pip-audit
3030
- name: Run pip-audit (editable install)
3131
run: pip-audit --skip-editable

test_support.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,20 @@ def can_bind_loopback() -> bool:
1717
return True
1818

1919

20-
def can_start_thread() -> bool:
21-
thread = threading.Thread(target=lambda: None)
20+
def can_start_threads(count: int = 1) -> bool:
21+
threads: list[threading.Thread] = []
2222
try:
23-
thread.start()
23+
for _ in range(count):
24+
thread = threading.Thread(target=lambda: None)
25+
thread.start()
26+
threads.append(thread)
2427
except RuntimeError as exc:
2528
if "can't start new thread" in str(exc):
2629
return False
2730
raise
28-
thread.join(timeout=1.0)
31+
finally:
32+
for thread in threads:
33+
thread.join(timeout=1.0)
2934
return True
3035

3136

@@ -36,8 +41,8 @@ def skip_if_socket_bind_is_blocked() -> None:
3641
pytest.skip('sandbox forbids socket.bind() on loopback')
3742

3843

39-
def skip_if_thread_start_is_blocked() -> None:
44+
def skip_if_thread_start_is_blocked(count: int = 1) -> None:
4045
"""Skip tests that require spawning worker threads when the environment forbids it."""
4146

42-
if not can_start_thread():
47+
if not can_start_threads(count):
4348
pytest.skip('environment has thread resource limits')

tests/test_phase5_context_bus.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def test_cleanup_old_deltas_scoped_to_workflow(self):
209209

210210
def test_parallel_publish_from_threads(self):
211211
"""Concurrent publishes use per-thread SQLite connections."""
212-
skip_if_thread_start_is_blocked()
212+
skip_if_thread_start_is_blocked(12)
213213
with tempfile.TemporaryDirectory() as tmpdir:
214214
db_path = Path(tmpdir) / 'context_bus.db'
215215
config = ContextBusConfig(db_path=db_path, workflow_id='test-workflow')

0 commit comments

Comments
 (0)