test(audit): Phase 10 fixtures - synthetic src/ + 6 audit_inputs JSONs
synthetic_src/: - type_aliases.py (3 TypeAliases: Metadata, FileItems, History) - ai_client.py (producer + consumer of Metadata + History) - aggregate.py (producer + consumer of FileItems) - gui_2.py (hot-path consumer of FileItems) - cleanup.py (cold-path consumer of Metadata) - overrides.toml (frequency override for cleanup.do_nothing) audit_inputs/ (6 JSON files): - audit_weak_types.json (4 findings in Metadata + FileItems functions) - audit_exception_handling.json (2 BOUNDARY_SDK findings) - audit_optional_in_3_files.json (0 findings) - audit_no_models_config_io.json (0 findings) - audit_main_thread_imports.json (0 findings) - type_registry.json (3 aggregates' field sets)
This commit is contained in:
@@ -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"}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"findings": []
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"findings": []
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"findings": []
|
||||
}
|
||||
@@ -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"}
|
||||
]
|
||||
}
|
||||
+16
@@ -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}]
|
||||
}
|
||||
}
|
||||
}
|
||||
+17
@@ -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
|
||||
+26
@@ -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
|
||||
+9
@@ -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
|
||||
+10
@@ -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)
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
[memory_dim]
|
||||
# (empty; the canonical mappings cover the 3 aggregates)
|
||||
|
||||
[frequency]
|
||||
"tests.fixtures.synthetic_src.cleanup.do_nothing" = "cold"
|
||||
+13
@@ -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]]
|
||||
Reference in New Issue
Block a user