Files
ss-tools/backend/tests/scripts/test_investigation_observation_scope.py
busya 323d732199 feat(investigations): add pinned baseline workspace and personal notifications
Add scoped verification and seven-day risk acceptance, a readable sixteen-metric baseline comparison, visual findings, and responsive case actions. Provide personal subscriptions and an in-app inbox with authorized target names.

Retain isolated Docker fixtures and browser audits for normal flows, access and CAS refusals, HTTP500, uncertain VLM results, polling and acceptance expiry. Verify scoped semantic contracts and record independent UX/UI scores of 4/5 and 4.1/5.
2026-10-05 23:00:05 +03:00

21 lines
1.2 KiB
Python

# #region Test.InvestigationObservationScope [C:2] [TYPE Module]
# @TEST_INVARIANT Admitted screenshot scope derives only from the server binding and refuses conflicting saved scope.
from types import SimpleNamespace
import pytest
from src.services.dashboard_testing.execution.metric_start_admission import freeze_observation_targets
def test_missing_scope_uses_admitted_binding_without_rewriting_numeric_or_semantic_steps():
plan = {'steps': [{'tool': 'screenshot', 'action': 'capture_screenshot'}, {'tool': 'agent_evaluation'}]}
freeze_observation_targets(plan, SimpleNamespace(environment_id='isolated-dev', dashboard_id=901))
assert plan['steps'][0] == {'tool': 'screenshot', 'action': 'capture_screenshot', 'environment_id': 'isolated-dev', 'dashboard_id': 901}
assert plan['steps'][1] == {'tool': 'agent_evaluation'}
def test_explicit_foreign_dashboard_is_refused():
plan = {'steps': [{'tool': 'screenshot', 'action': 'capture_screenshot', 'dashboard_id': 902}]}
with pytest.raises(ValueError, match='SCREENSHOT_LIVE_AUTHORITY_MISMATCH'):
freeze_observation_targets(plan, SimpleNamespace(environment_id='isolated-dev', dashboard_id=901))
assert plan['steps'][0]['dashboard_id'] == 902
# #endregion Test.InvestigationObservationScope