chore(node): preserve pre-canonicalization experiment snapshot

Historical working copy retained for audit before consolidation into main. The canonicalized plugin architecture and later fixes already live in main; this snapshot is not a release or a request to restore obsolete source layout.
This commit is contained in:
DCCONSTRUCTIONS
2026-09-21 08:45:34 +03:00
parent 020a878915
commit 1c7dd29d8a
89 changed files with 5026 additions and 487 deletions
+49
View File
@@ -42,6 +42,29 @@ def _request(*, ui_build_id: str | None = None) -> Request:
return Request({"type": "http", "method": "GET", "path": "/", "headers": headers})
def test_scanner_exception_keeps_location_without_private_message_or_locals(
tmp_path: Path,
) -> None:
target = configure_scanner_diagnostics(tmp_path / "logs")
logger = logging.getLogger(f"{SCANNER_LOGGER_NAME}.test")
private_detail = "synthetic-private-runtime-detail"
try:
raise ValueError(private_detail)
except ValueError:
logger.exception("Camera activation failed")
for handler in logging.getLogger(SCANNER_LOGGER_NAME).handlers:
handler.flush()
serialized = target.read_text(encoding="utf-8").splitlines()[-1]
document = json.loads(serialized)
assert document["exception_type"] == "ValueError"
assert document["exception_site"].startswith("test_viewer_diagnostics_api.py:")
assert document["exception_site"].endswith(
":test_scanner_exception_keeps_location_without_private_message_or_locals"
)
assert private_detail not in serialized
assert str(Path(__file__).parent) not in serialized
def test_private_scanner_diagnostics_are_durable_structured_and_bounded(
tmp_path: Path,
) -> None:
@@ -67,6 +90,19 @@ def test_private_scanner_diagnostics_are_durable_structured_and_bounded(
"device_write_confirmed": False,
"ble_att_error_code": 4,
"ble_att_error_name": "INVALID_PDU",
"resolved_write_mode": "with_response",
"max_write_without_response_size": 253,
"mtu_size": 256,
"frame_length": 99,
"write_characteristic_properties": ["read", "write"],
"scan_elapsed_ms": 7300,
"scanner_start_ms": 31,
"initial_window_ms": 6000,
"first_candidate_ms": 7240,
"scan_extended": True,
"candidate_count": 4,
"likely_k1_candidate_count": 1,
"discovery_generation": 2,
"helper_stage": "compile",
"helper_elapsed_ms": 34720,
"camera_source_id": "sensor.camera.right",
@@ -126,6 +162,19 @@ def test_private_scanner_diagnostics_are_durable_structured_and_bounded(
assert document["device_write_confirmed"] is False
assert document["ble_att_error_code"] == 4
assert document["ble_att_error_name"] == "INVALID_PDU"
assert document["resolved_write_mode"] == "with_response"
assert document["max_write_without_response_size"] == 253
assert document["mtu_size"] == 256
assert document["frame_length"] == 99
assert document["write_characteristic_properties"] == ["read", "write"]
assert document["scan_elapsed_ms"] == 7300
assert document["scanner_start_ms"] == 31
assert document["initial_window_ms"] == 6000
assert document["first_candidate_ms"] == 7240
assert document["scan_extended"] is True
assert document["candidate_count"] == 4
assert document["likely_k1_candidate_count"] == 1
assert document["discovery_generation"] == 2
assert document["helper_stage"] == "compile"
assert document["helper_elapsed_ms"] == 34720
assert document["camera_source_id"] == "sensor.camera.right"