diff --git a/tests/fixtures/audit_inputs/audit_exception_handling.json b/tests/fixtures/audit_inputs/audit_exception_handling.json new file mode 100644 index 00000000..37825185 --- /dev/null +++ b/tests/fixtures/audit_inputs/audit_exception_handling.json @@ -0,0 +1,6 @@ +{ + "findings": [ + {"file": "tests/fixtures/synthetic_src/ai_client.py", "line": 14, "category": "BOUNDARY_SDK", "function": "send_result", "class": null, "body_summary": "try/except + Result conversion"}, + {"file": "tests/fixtures/synthetic_src/aggregate.py", "line": 11, "category": "BOUNDARY_SDK", "function": "build_file_items", "class": null, "body_summary": "try/except + Result conversion"} + ] +} \ No newline at end of file diff --git a/tests/fixtures/audit_inputs/audit_main_thread_imports.json b/tests/fixtures/audit_inputs/audit_main_thread_imports.json new file mode 100644 index 00000000..d02ed893 --- /dev/null +++ b/tests/fixtures/audit_inputs/audit_main_thread_imports.json @@ -0,0 +1,3 @@ +{ + "findings": [] +} \ No newline at end of file diff --git a/tests/fixtures/audit_inputs/audit_no_models_config_io.json b/tests/fixtures/audit_inputs/audit_no_models_config_io.json new file mode 100644 index 00000000..d02ed893 --- /dev/null +++ b/tests/fixtures/audit_inputs/audit_no_models_config_io.json @@ -0,0 +1,3 @@ +{ + "findings": [] +} \ No newline at end of file diff --git a/tests/fixtures/audit_inputs/audit_optional_in_3_files.json b/tests/fixtures/audit_inputs/audit_optional_in_3_files.json new file mode 100644 index 00000000..d02ed893 --- /dev/null +++ b/tests/fixtures/audit_inputs/audit_optional_in_3_files.json @@ -0,0 +1,3 @@ +{ + "findings": [] +} \ No newline at end of file diff --git a/tests/fixtures/audit_inputs/audit_weak_types.json b/tests/fixtures/audit_inputs/audit_weak_types.json new file mode 100644 index 00000000..510c2066 --- /dev/null +++ b/tests/fixtures/audit_inputs/audit_weak_types.json @@ -0,0 +1,8 @@ +{ + "findings": [ + {"file": "tests/fixtures/synthetic_src/ai_client.py", "line": 14, "type_string": "dict[str, Any]", "category": "untyped_dict"}, + {"file": "tests/fixtures/synthetic_src/ai_client.py", "line": 18, "type_string": "dict[str, Any]", "category": "untyped_dict"}, + {"file": "tests/fixtures/synthetic_src/aggregate.py", "line": 11, "type_string": "list[dict[str, Any]]", "category": "untyped_list"}, + {"file": "tests/fixtures/synthetic_src/aggregate.py", "line": 17, "type_string": "dict[str, Any]", "category": "untyped_dict"} + ] +} \ No newline at end of file diff --git a/tests/fixtures/audit_inputs/type_registry.json b/tests/fixtures/audit_inputs/type_registry.json new file mode 100644 index 00000000..203dba7c --- /dev/null +++ b/tests/fixtures/audit_inputs/type_registry.json @@ -0,0 +1,16 @@ +{ + "types": { + "Metadata": { + "file": "src/type_aliases.py", + "fields": [{"name": "role", "type": "str", "optional": false}, {"name": "content", "type": "str", "optional": false}] + }, + "FileItems": { + "file": "src/type_aliases.py", + "fields": [{"name": "path", "type": "str", "optional": false}, {"name": "view_mode", "type": "str", "optional": false}] + }, + "History": { + "file": "src/type_aliases.py", + "fields": [{"name": "role", "type": "str", "optional": false}, {"name": "content", "type": "str", "optional": false}] + } + } +} \ No newline at end of file diff --git a/tests/fixtures/synthetic_src/aggregate.py b/tests/fixtures/synthetic_src/aggregate.py new file mode 100644 index 00000000..5bb55800 --- /dev/null +++ b/tests/fixtures/synthetic_src/aggregate.py @@ -0,0 +1,17 @@ +"""Synthetic aggregate module for the v2 audit integration tests.""" +from __future__ import annotations +from typing import Any + +FileItems = list[dict[str, Any]] + +def build_file_items() -> list[dict[str, Any]]: + data: FileItems = [{"path": "a.py", "view_mode": "full"}, {"path": "b.py", "view_mode": "summary"}] + return data + +def format_paths(items: FileItems) -> list[str]: + out: list[str] = [] + for item in items: + path = item["path"] + view_mode = item["view_mode"] + out.append(f"{path}:{view_mode}") + return out \ No newline at end of file diff --git a/tests/fixtures/synthetic_src/ai_client.py b/tests/fixtures/synthetic_src/ai_client.py new file mode 100644 index 00000000..fc3d6029 --- /dev/null +++ b/tests/fixtures/synthetic_src/ai_client.py @@ -0,0 +1,26 @@ +"""Synthetic AI client for the v2 audit integration tests.""" +from __future__ import annotations +from typing import Any + +Metadata = dict[str, Any] +History = list[dict[str, Any]] + +def send_result() -> dict[str, Any]: + data: Metadata = {"role": "user", "content": "hello"} + return data + +def append_history() -> list[dict[str, Any]]: + data: History = [] + return data + +def to_list(history: History) -> History: + out: History = [] + for entry in history: + role = entry["role"] + content = entry["content"] + out.append({"role": role, "content": content}) + return out + +def process(metadata: Metadata) -> str: + role = metadata["role"] + return role \ No newline at end of file diff --git a/tests/fixtures/synthetic_src/cleanup.py b/tests/fixtures/synthetic_src/cleanup.py new file mode 100644 index 00000000..44e30759 --- /dev/null +++ b/tests/fixtures/synthetic_src/cleanup.py @@ -0,0 +1,9 @@ +"""Synthetic cleanup module for the v2 audit integration tests.""" +from __future__ import annotations +from typing import Any + +Metadata = dict[str, Any] + +def do_nothing(metadata: Metadata) -> None: + role = metadata["role"] + _ = role \ No newline at end of file diff --git a/tests/fixtures/synthetic_src/gui_2.py b/tests/fixtures/synthetic_src/gui_2.py new file mode 100644 index 00000000..8b0ba376 --- /dev/null +++ b/tests/fixtures/synthetic_src/gui_2.py @@ -0,0 +1,10 @@ +"""Synthetic GUI module for the v2 audit integration tests.""" +from __future__ import annotations +from typing import Any + +FileItems = list[dict[str, Any]] + +def render_file_list(items: FileItems) -> None: + for item in items: + path = item["path"] + print(path) \ No newline at end of file diff --git a/tests/fixtures/synthetic_src/overrides.toml b/tests/fixtures/synthetic_src/overrides.toml new file mode 100644 index 00000000..e474b46b --- /dev/null +++ b/tests/fixtures/synthetic_src/overrides.toml @@ -0,0 +1,5 @@ +[memory_dim] +# (empty; the canonical mappings cover the 3 aggregates) + +[frequency] +"tests.fixtures.synthetic_src.cleanup.do_nothing" = "cold" \ No newline at end of file diff --git a/tests/fixtures/synthetic_src/type_aliases.py b/tests/fixtures/synthetic_src/type_aliases.py new file mode 100644 index 00000000..f45b28af --- /dev/null +++ b/tests/fixtures/synthetic_src/type_aliases.py @@ -0,0 +1,13 @@ +"""Synthetic type aliases for the v2 audit integration tests. + +Defines 3 TypeAliases: Metadata, FileItems, History. These are +the same names as in src/type_aliases.py (canonical TypeAliases) +but live in the test fixture so the integration tests can run +without depending on the real src/. +""" +from __future__ import annotations +from typing import Any, TypeAlias + +Metadata: TypeAlias = dict[str, Any] +FileItems: TypeAlias = list[dict[str, Any]] +History: TypeAlias = list[dict[str, Any]] \ No newline at end of file