Private
Public Access
The actual fix for the 4.01e22 combinatoric explosion. Promotes
Metadata: TypeAlias = dict[str, Any] to @dataclass(frozen=True, slots=True)
and migrates all 695 consumer functions + 213 access sites (107 .get +
106 subscript) to direct field access.
TIER-1 READ AGENTS.md + conductor/workflow.md + conductor/edit_workflow.md
+ conductor/code_styleguides/data_oriented_design.md + conductor/code_styleguides/error_handling.md + conductor/code_styleguides/type_aliases.md + docs/reports/SSDL_CAMPAIGN_ABORTED_20260624.md + src/type_aliases.py + scripts/code_path_audit/code_path_audit.py + scripts/code_path_audit/code_path_audit_ssdl.py before this commit.
Why this fixes 4.01e22:
- The combinatoric explosion is from dict[str, Any] type-dispatch at every
entry.get('key', default) site (per SSDL post-mortem)
- Each access has 3 branches: is None, getattr, default
- 695 consumers * ~2 branches each = 1390 branches in the sum
- 2^1390 ≈ 4.01e22 (the measured baseline)
- Promotion to @dataclass with direct field access = 0 branches per access
- Expected drop: 4.014e+22 -> < 1e+20 (>= 2 orders of magnitude)
10 VCs:
- VC1: Metadata is @dataclass(frozen=True, slots=True), not dict[str, Any]
- VC2: 107 .get sites replaced
- VC3: 106 subscript sites replaced
- VC4: 12+ tests pass in tests/test_metadata_dataclass.py
- VC5: 5 sub-aggregate TypeAliases (CommsLogEntry, HistoryMessage, FileItem,
ToolDefinition, ToolCall) all point to the new Metadata
- VC6: Effective codepaths < 1e+20
- VC7: All 7 audit gates pass --strict
- VC8: 10/11 batched test tiers PASS
- VC9: End-of-track report written
- VC10: New regression-guard test file exists
5-phase phased migration (smallest sub-aggregate first):
- Phase 1: CommsLogEntry (~150 sites in session_logger, multi_agent_conductor, app_controller)
- Phase 2: HistoryMessage (~80 sites in ai_client)
- Phase 3: FileItem (~200 sites in aggregate, app_controller, gui_2)
- Phase 4: ToolDefinition+ToolCall (~150 sites in mcp_client, ai_client tool loop)
- Phase 5: Metadata direct usage (~115 sites catch-all)
6 phases total (0 + 5 + verification). 18-21 atomic commits.
blocked_by: code_path_audit_phase_3_provider_state_20260624 (recommended prerequisite;
the two tracks are orthogonal so they can run in parallel; listed as blocked_by
for sequencing preference not strict blocking)
58 lines
4.2 KiB
TOML
58 lines
4.2 KiB
TOML
# Track state for metadata_promotion_20260624
|
|
# Updated by Tier 2 Tech Lead as tasks complete
|
|
|
|
[meta]
|
|
track_id = "metadata_promotion_20260624"
|
|
name = "Metadata Promotion: dict[str, Any] -> @dataclass(frozen=True, slots=True)"
|
|
status = "active"
|
|
current_phase = 0
|
|
last_updated = "2026-06-25"
|
|
|
|
[blocked_by]
|
|
code_path_audit_phase_3_provider_state_20260624 = "pending (not started yet; recommended prerequisite to run in parallel with this track)"
|
|
|
|
[blocks]
|
|
|
|
[phases]
|
|
phase_0 = { status = "pending", checkpointsha = "", name = "Design the dataclass + add regression-guard test" }
|
|
phase_1 = { status = "pending", checkpointsha = "", name = "Migrate CommsLogEntry consumers (3 commits, ~150 sites)" }
|
|
phase_2 = { status = "pending", checkpointsha = "", name = "Migrate HistoryMessage consumers (1 commit, ~80 sites)" }
|
|
phase_3 = { status = "pending", checkpointsha = "", name = "Migrate FileItem consumers (3 commits, ~200 sites)" }
|
|
phase_4 = { status = "pending", checkpointsha = "", name = "Migrate ToolDefinition + ToolCall consumers (2 commits, ~150 sites)" }
|
|
phase_5 = { status = "pending", checkpointsha = "", name = "Migrate remaining Metadata direct usage (N commits, ~115 sites)" }
|
|
phase_6 = { status = "pending", checkpointsha = "", name = "Verification + end-of-track report" }
|
|
|
|
[tasks]
|
|
t0_1 = { status = "pending", commit_sha = "", description = "Design the Metadata @dataclass(frozen=True, slots=True) in src/type_aliases.py" }
|
|
t0_2 = { status = "pending", commit_sha = "", description = "Create tests/test_metadata_dataclass.py with 12+ tests" }
|
|
t1_1 = { status = "pending", commit_sha = "", description = "Migrate src/session_logger.py (~30 access sites)" }
|
|
t1_2 = { status = "pending", commit_sha = "", description = "Migrate src/multi_agent_conductor.py (~70 access sites)" }
|
|
t1_3 = { status = "pending", commit_sha = "", description = "Migrate src/app_controller.py CommsLogEntry section (~50 access sites)" }
|
|
t1_4 = { status = "pending", commit_sha = "", description = "Re-measure effective codepaths after Phase 1; document in metadata_promotion_progress.md" }
|
|
t2_1 = { status = "pending", commit_sha = "", description = "Migrate src/ai_client.py HistoryMessage section (~80 access sites)" }
|
|
t2_2 = { status = "pending", commit_sha = "", description = "Re-measure after Phase 2; document" }
|
|
t3_1 = { status = "pending", commit_sha = "", description = "Migrate src/aggregate.py FileItem section (~50 access sites)" }
|
|
t3_2 = { status = "pending", commit_sha = "", description = "Migrate src/app_controller.py FileItem section (~50 access sites)" }
|
|
t3_3 = { status = "pending", commit_sha = "", description = "Migrate src/gui_2.py FileItem section (~100 access sites)" }
|
|
t3_4 = { status = "pending", commit_sha = "", description = "Re-measure after Phase 3; document" }
|
|
t4_1 = { status = "pending", commit_sha = "", description = "Migrate src/mcp_client.py ToolDefinition + ToolCall section (~94 access sites)" }
|
|
t4_2 = { status = "pending", commit_sha = "", description = "Migrate src/ai_client.py tool loop section (~56 access sites)" }
|
|
t4_3 = { status = "pending", commit_sha = "", description = "Re-measure after Phase 4; document" }
|
|
t5_1 = { status = "pending", commit_sha = "", description = "Audit remaining Metadata direct-usage sites (~115 across 5-8 files)" }
|
|
t5_2_5_N = { status = "pending", commit_sha = "", description = "Migrate per file (1 commit per file, decreasing order of access site count)" }
|
|
t6_1 = { status = "pending", commit_sha = "", description = "Run all 10 VCs; write TRACK_COMPLETION; update state.toml + tracks.md" }
|
|
|
|
[verification]
|
|
phase_0_complete = false
|
|
phase_1_complete = false
|
|
phase_2_complete = false
|
|
phase_3_complete = false
|
|
phase_4_complete = false
|
|
phase_5_complete = false
|
|
phase_6_complete = false
|
|
|
|
[track_specific]
|
|
metric_targets = { baseline_effective_codepaths: "4.014e+22", target_effective_codepaths: "< 1e+20", expected_phase_1_drop: "~4e+19 (CommsLogEntry has the most consumers)", expected_final_drop: ">= 2 orders of magnitude" }
|
|
access_site_targets = { baseline_get_sites: 107, baseline_subscript_sites: 106, target_post_track: "< 20 each (only legitimate non-Metadata uses)" }
|
|
phased_migration_consumer_distribution = { "CommsLogEntry": 150, "HistoryMessage": 80, "FileItem": 200, "ToolDefinition+ToolCall": 150, "Metadata direct": 115 }
|