Merge remote-tracking branch 'origin/main' into codex/p0-obs-002-20260715
This commit is contained in:
@@ -90,7 +90,7 @@ async def test_lifecycle_run_persists_baselines_and_fail_closed_terminals() -> N
|
||||
status="ok",
|
||||
source_url=url,
|
||||
http_status=200,
|
||||
body=b'{"version":"1.2.3","content":"not persisted"}',
|
||||
body=b'{"packageVersion":"1.2.3","content":"not persisted"}',
|
||||
)
|
||||
|
||||
result = await run_mcp_version_lifecycle_once(
|
||||
@@ -127,7 +127,7 @@ async def test_lifecycle_run_persists_baselines_and_fail_closed_terminals() -> N
|
||||
|
||||
|
||||
def test_changed_version_stops_before_replay_without_immutable_receipts() -> None:
|
||||
old_body = b'{"version":"1.2.3"}'
|
||||
old_body = b'{"packageVersion":"1.2.3"}'
|
||||
candidate = _catalog()["capabilities"][0]
|
||||
observation = build_candidate_observation(
|
||||
candidate,
|
||||
@@ -135,7 +135,7 @@ def test_changed_version_stops_before_replay_without_immutable_receipts() -> Non
|
||||
status="ok",
|
||||
source_url=candidate["catalog_url"],
|
||||
http_status=200,
|
||||
body=b'{"version":"1.3.0"}',
|
||||
body=b'{"packageVersion":"1.3.0"}',
|
||||
),
|
||||
previous={
|
||||
"observed_version": "1.2.3",
|
||||
@@ -201,13 +201,20 @@ async def test_source_failure_is_durable_partial_degraded_no_write() -> None:
|
||||
|
||||
|
||||
def test_version_parser_rejects_ambiguous_page_versions() -> None:
|
||||
assert _extract_unambiguous_version(b'{"version":"1.2.3"}') == "1.2.3"
|
||||
assert _extract_unambiguous_version(b'{"packageVersion":"1.2.3"}') == "1.2.3"
|
||||
assert (
|
||||
_extract_unambiguous_version(b'{"version":"1.2.3","latestVersion":"2.0.0"}')
|
||||
_extract_unambiguous_version(
|
||||
b'{"packageVersion":"1.2.3","latestVersion":"2.0.0"}'
|
||||
)
|
||||
is None
|
||||
)
|
||||
|
||||
|
||||
def test_version_parser_ignores_cloudflare_beacon_version() -> None:
|
||||
body = b"data-cf-beacon='{\"version\":\"2024.11.0\",\"token\":\"public\"}'"
|
||||
assert _extract_unambiguous_version(body) is None
|
||||
|
||||
|
||||
def test_stable_fingerprint_ignores_randomized_recommendation_sections() -> None:
|
||||
stable_head = b"""
|
||||
<html><head><title>Context7 MCP</title>
|
||||
|
||||
@@ -539,6 +539,40 @@ def test_signal_worker_gracefully_cancels_agent99_reconciler() -> None:
|
||||
assert source.index(await_task) < source.index("await worker.stop()")
|
||||
|
||||
|
||||
def test_signal_worker_is_single_incident_lifecycle_reconciler_owner() -> None:
|
||||
import inspect
|
||||
|
||||
from src import main as api_main
|
||||
from src.workers import signal_worker
|
||||
|
||||
api_source = inspect.getsource(api_main.lifespan)
|
||||
worker_source = inspect.getsource(signal_worker._main)
|
||||
|
||||
assert "run_incident_lifecycle_reconciler_loop" not in api_source
|
||||
assert "incident_lifecycle_reconciler_owner_delegated" in api_source
|
||||
assert worker_source.count("run_incident_lifecycle_reconciler_loop()") == 1
|
||||
assert worker_source.index("if settings.DATABASE_BOOTSTRAP_DDL_ENABLED") < (
|
||||
worker_source.index("run_incident_lifecycle_reconciler_loop()")
|
||||
)
|
||||
assert "signal_worker_incident_lifecycle_reconciler_started" in worker_source
|
||||
assert 'owner="signal_worker"' in worker_source
|
||||
|
||||
|
||||
def test_signal_worker_gracefully_cancels_incident_lifecycle_reconciler() -> None:
|
||||
import inspect
|
||||
|
||||
from src.workers import signal_worker
|
||||
|
||||
source = inspect.getsource(signal_worker._main)
|
||||
cancel = "incident_lifecycle_reconciler_task.cancel()"
|
||||
await_task = "await incident_lifecycle_reconciler_task"
|
||||
|
||||
assert cancel in source
|
||||
assert await_task in source
|
||||
assert source.index(cancel) < source.index(await_task)
|
||||
assert source.index(await_task) < source.index("await worker.stop()")
|
||||
|
||||
|
||||
def test_production_signal_worker_is_single_agent99_reconciler_owner() -> None:
|
||||
import inspect
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ from fastapi.testclient import TestClient
|
||||
from src.api.v1.agents import router
|
||||
from src.services.telegram_alert_ai_automation_matrix import (
|
||||
_inspect_source_contract,
|
||||
_read_source_contract_text,
|
||||
load_latest_telegram_alert_ai_automation_matrix,
|
||||
)
|
||||
|
||||
@@ -210,6 +211,28 @@ def test_telegram_matrix_source_contract_supports_container_layout(tmp_path):
|
||||
assert proof["source_contract_missing_markers"] == []
|
||||
|
||||
|
||||
def test_telegram_matrix_source_contract_uses_embedded_surface_when_web_package_only(
|
||||
tmp_path,
|
||||
):
|
||||
(tmp_path / "apps/web").mkdir(parents=True)
|
||||
(tmp_path / "apps/web/package.json").write_text("{}\n", encoding="utf-8")
|
||||
(tmp_path / "src/services").mkdir(parents=True)
|
||||
embedded_source = (
|
||||
tmp_path / "src/services/telegram_alert_ai_automation_matrix.py"
|
||||
)
|
||||
embedded_source.write_text(
|
||||
'data-testid="telegram-alert-post-apply-verifier-readback"\n',
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
source = _read_source_contract_text(
|
||||
tmp_path,
|
||||
"apps/web/src/components/awooop/autonomous-runtime-receipt-panel.tsx",
|
||||
)
|
||||
|
||||
assert 'data-testid="telegram-alert-post-apply-verifier-readback"' in source
|
||||
|
||||
|
||||
def test_telegram_matrix_source_contract_reports_missing_web_surface_without_raising(
|
||||
tmp_path,
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user