From 5dca69f0d7e76267197568ec83ecb713701956c9 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Mon, 22 Jun 2026 00:46:00 -0400 Subject: [PATCH] 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. --- src/code_path_audit.py | 45 ++++++++++++++++++++++++++++++++++- tests/test_code_path_audit.py | 39 ++++++++++++++++++++++++------ 2 files changed, 76 insertions(+), 8 deletions(-) diff --git a/src/code_path_audit.py b/src/code_path_audit.py index 8137bb62..b063f82a 100644 --- a/src/code_path_audit.py +++ b/src/code_path_audit.py @@ -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 \ No newline at end of file +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", +] \ No newline at end of file diff --git a/tests/test_code_path_audit.py b/tests/test_code_path_audit.py index e2e446fd..78fe4c77 100644 --- a/tests/test_code_path_audit.py +++ b/tests/test_code_path_audit.py @@ -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 \ No newline at end of file +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 \ No newline at end of file