feat(audit): add 5 enums for the v2 data model
AggregateKind (4 values), MemoryDim (7), AccessPattern (5), Frequency (7), RecommendedDirection (4). All Literal types for stable postfix DSL output (string-valued, no enum-name lookup table needed in the parser). 5 unit tests passing. The 9 supporting dataclasses + the AggregateProfile central artifact go in Tasks 1.2-1.10.
This commit is contained in:
+44
-1
@@ -8,4 +8,47 @@ audit scripts, and emits per-aggregate profiles in the v2 custom
|
||||
postfix DSL + markdown + prefix tree text. See
|
||||
conductor/tracks/code_path_audit_20260607/spec_v2.md.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
from __future__ import annotations
|
||||
from typing import Literal
|
||||
|
||||
AggregateKind = Literal[
|
||||
"typealias",
|
||||
"dataclass",
|
||||
"candidate_dataclass",
|
||||
"builtin",
|
||||
]
|
||||
|
||||
MemoryDim = Literal[
|
||||
"curation",
|
||||
"discussion",
|
||||
"rag",
|
||||
"knowledge",
|
||||
"config",
|
||||
"control",
|
||||
"unknown",
|
||||
]
|
||||
|
||||
AccessPattern = Literal[
|
||||
"whole_struct",
|
||||
"field_by_field",
|
||||
"hot_cold_split",
|
||||
"bulk_batched",
|
||||
"mixed",
|
||||
]
|
||||
|
||||
Frequency = Literal[
|
||||
"hot",
|
||||
"per_turn",
|
||||
"per_discussion",
|
||||
"per_request",
|
||||
"cold",
|
||||
"init",
|
||||
"unknown",
|
||||
]
|
||||
|
||||
RecommendedDirection = Literal[
|
||||
"componentize",
|
||||
"unify",
|
||||
"hold",
|
||||
"insufficient_data",
|
||||
]
|
||||
@@ -1,8 +1,33 @@
|
||||
"""Tests for src.code_path_audit v2.
|
||||
"""Tests for src.code_path_audit v2 - Phase 1 (data model)."""
|
||||
from src.code_path_audit import (
|
||||
AggregateKind,
|
||||
MemoryDim,
|
||||
AccessPattern,
|
||||
Frequency,
|
||||
RecommendedDirection,
|
||||
)
|
||||
|
||||
60 unit tests (Phases 1-8) + 7 integration tests (Phase 10) +
|
||||
2 live_gui E2E tests (Phase 11, opt-in via env var
|
||||
CODE_PATH_AUDIT_LIVE_GUI=1) = 69 tests total. See
|
||||
conductor/tracks/code_path_audit_20260607/plan_v2.md.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
def test_aggregate_kind_4_values() -> None:
|
||||
"""AggregateKind is a Literal with 4 values: typealias, dataclass, candidate_dataclass, builtin."""
|
||||
expected = {"typealias", "dataclass", "candidate_dataclass", "builtin"}
|
||||
assert set(AggregateKind.__args__) == expected
|
||||
|
||||
def test_memory_dim_7_values() -> None:
|
||||
"""MemoryDim is a Literal with 7 values: curation, discussion, rag, knowledge, config, control, unknown."""
|
||||
expected = {"curation", "discussion", "rag", "knowledge", "config", "control", "unknown"}
|
||||
assert set(MemoryDim.__args__) == expected
|
||||
|
||||
def test_access_pattern_5_values() -> None:
|
||||
"""AccessPattern is a Literal with 5 values: whole_struct, field_by_field, hot_cold_split, bulk_batched, mixed."""
|
||||
expected = {"whole_struct", "field_by_field", "hot_cold_split", "bulk_batched", "mixed"}
|
||||
assert set(AccessPattern.__args__) == expected
|
||||
|
||||
def test_frequency_7_values() -> None:
|
||||
"""Frequency is a Literal with 7 values: hot, per_turn, per_discussion, per_request, cold, init, unknown."""
|
||||
expected = {"hot", "per_turn", "per_discussion", "per_request", "cold", "init", "unknown"}
|
||||
assert set(Frequency.__args__) == expected
|
||||
|
||||
def test_recommended_direction_4_values() -> None:
|
||||
"""RecommendedDirection is a Literal with 4 values: componentize, unify, hold, insufficient_data."""
|
||||
expected = {"componentize", "unify", "hold", "insufficient_data"}
|
||||
assert set(RecommendedDirection.__args__) == expected
|
||||
Reference in New Issue
Block a user