Skip to content

armgit / sie

Public Imported from GitHub
0

Open-source inference server and production cluster for all the models your agent needs.

test(server): check the equivalence record for vectors by structure (#929)

Shai Shmueldc1707ae45bf
diff --git a/packages/sie_server/tests/config/test_equivalence.py b/packages/sie_server/tests/config/test_equivalence.py
index 141be6518..33afa2876 100644
--- a/packages/sie_server/tests/config/test_equivalence.py
+++ b/packages/sie_server/tests/config/test_equivalence.py
@@ -282,6 +282,20 @@ def test_a_full_batch_holds_sixteen_items_whatever_the_case() -> None:
assert probe._companions(suite, case, "alone") == ()
+def _float_arrays(node: object) -> list[list[Any]]:
+ """Return every JSON array under ``node`` that holds a float.
+
+ The record's own arrays hold integers, strings and objects, so an array
+ with a float in it is vector contents.
+ """
+ if isinstance(node, dict):
+ return [found for value in node.values() for found in _float_arrays(value)]
+ if not isinstance(node, list):
+ return []
+ found = [node] if any(isinstance(item, float) for item in node) else []
+ return found + [nested for item in node for nested in _float_arrays(item)]
+
+
@pytest.mark.parametrize(
("remote_offset", "contract_mismatch", "instance_mismatch", "remote_execution", "batch_offset"),
[
@@ -304,6 +318,11 @@ def test_full_cli_runs_real_sdk_transport_and_only_writes_evidence(
remote_execution: str | None,
batch_offset: float,
) -> None:
+ """Run the probe CLI against a live local server and check what it records.
+
+ The record must hold the measurements and the request shape, and never
+ the probe texts or the vectors that came back.
+ """
requests: list[tuple[dict[str, Any], bool]] = []
remote_contract: str | None = None
@@ -445,7 +464,9 @@ profiles:
assert "retrieval " not in serialized
assert "Represent this text" not in serialized
assert 'values"' in serialized # Measurement count, never vector contents.
- assert "1.01" not in serialized
+ # Checked on the parsed record: a text search for a vector value also
+ # matches the timestamp whenever its seconds happen to read the same.
+ assert not _float_arrays(json.loads(serialized))
@pytest.mark.parametrize(