docs(audit): boundary layer audit + track completion for cruft_elimination_20260627

Phase 9: Boundary layer audit
- Metadata is now the typed fat struct (@dataclass(frozen=True, slots=True)
  with 36 explicit fields) at the wire boundary
- Metadata: TypeAlias = dict[str, Any] is REMOVED
- Dict-compat methods (__getitem__, get, __contains__, __iter__, keys,
  values, items) are TEMPORARY migration aids; will be deprecated in
  follow-up track once all consumers migrated to typed componentized
  dataclasses
- Boundary files documented: api_hooks.py, project_manager.py,
  session_logger.py, mcp_client.py

Phase 8 metrics (after Phases 1 + 3):
- Metadata TypeAlias: 1 -> 0 (-100%)
- hasattr(f, 'path'): 29 -> 19 (-34%)
- -> Optional[T] returns: 30 -> 30 (deferred to Phase 6 follow-up)
- Any params: 59 -> 60 (+1; the Metadata dataclass added content: Any)
- dict[str, Any] params: 10 -> 11 (+1; similar)

Audit gates (all OK):
- audit_weak_types --strict: 107 <= 112 baseline
- generate_type_registry --check: 23 files in sync
- audit_main_thread_imports: OK (17 files)
- audit_no_models_config_io: OK (0 violations)
- audit_optional_in_3_files --strict: OK
- audit_exception_handling --strict: OK
- audit_code_path_audit_coverage --strict: OK (10 profiles)

Track status: PARTIAL COMPLETION
- Phase 1 (Metadata promotion): COMPLETE
- Phase 3 partial (hasattr removal in app_controller.py): COMPLETE
- Phases 2/3 follow-up/4/5/6/7: DEFERRED (5 follow-up tracks documented)

state.toml updated to status = "active", current_phase = 9 with the
5 deferred follow-up tracks enumerated.

See TRACK_COMPLETION_cruft_elimination_20260627.md for full report.
This commit is contained in:
ed
2026-06-26 04:41:43 -04:00
parent 0d0b433a2e
commit 0635f15ceb
3 changed files with 408 additions and 14 deletions
@@ -2,25 +2,63 @@
track_id = "cruft_elimination_20260627"
name = "C11/Python Type Promotion Mandate - Cruft Elimination"
status = "active"
current_phase = 0
current_phase = 9
last_updated = "2026-06-27"
[blocked_by]
# None - independent track; metadata_promotion_20260624 + type_alias_unfuck_20260626 are SHIPPED
[phases]
phase_0 = { status = "in_progress", checkpointsha = "", name = "Pre-flight baseline + audit verification" }
phase_1 = { status = "pending", checkpointsha = "", name = "Promote Metadata from TypeAlias to typed fat struct" }
phase_2 = { status = "pending", checkpointsha = "", name = "Add ProjectContext dataclass for flat_config" }
phase_3 = { status = "pending", checkpointsha = "", name = "Fix self.files in app_controller.py" }
phase_4 = { status = "pending", checkpointsha = "", name = "Fix _do_generate return type" }
phase_5 = { status = "pending", checkpointsha = "", name = "Fix rag_engine.search() return type" }
phase_6 = { status = "pending", checkpointsha = "", name = "Eliminate Optional[T] returns" }
phase_7 = { status = "pending", checkpointsha = "", name = "Eliminate Any and dict[str, Any] from internal signatures" }
phase_8 = { status = "pending", checkpointsha = "", name = "Re-measure + verification" }
phase_9 = { status = "pending", checkpointsha = "", name = "Boundary layer audit + documentation" }
phase_0 = { status = "completed", checkpointsha = "2a768893", name = "Pre-flight baseline + audit verification" }
phase_1 = { status = "completed", checkpointsha = "75eb6dbb", name = "Promote Metadata from TypeAlias to typed fat struct" }
phase_2 = { status = "deferred", checkpointsha = "", name = "Add ProjectContext dataclass for flat_config (spec mismatch)" }
phase_3 = { status = "completed", checkpointsha = "0d0b433a", name = "Fix self.files in app_controller.py (13 hasattr checks removed; 18 in gui_2.py deferred)" }
phase_4 = { status = "deferred", checkpointsha = "", name = "Fix _do_generate return type" }
phase_5 = { status = "deferred", checkpointsha = "", name = "Fix rag_engine.search() return type" }
phase_6 = { status = "deferred", checkpointsha = "", name = "Eliminate Optional[T] returns (30 sites across 14 files)" }
phase_7 = { status = "deferred", checkpointsha = "", name = "Eliminate Any and dict[str, Any] from internal signatures (69 sites)" }
phase_8 = { status = "completed", checkpointsha = "0d0b433a", name = "Re-measure + verification" }
phase_9 = { status = "completed", checkpointsha = "PENDING", name = "Boundary layer audit + documentation" }
[tasks]
t0_1 = { status = "in_progress", commit_sha = "", description = "Pre-flight: capture baseline counts (hasattr, Optional, Metadata, Any, dict[str, Any])" }
t0_2 = { status = "pending", commit_sha = "", description = "Pre-flight: verify 7 audit gates pass --strict" }
t0_3 = { status = "pending", commit_sha = "", description = "Pre-flight: verify 12 per-aggregate dataclasses have from_dict()" }
t0_1 = { status = "completed", commit_sha = "2a768893", description = "Pre-flight: capture baseline counts" }
t0_2 = { status = "completed", commit_sha = "2a768893", description = "Pre-flight: verify 7 audit gates pass --strict" }
t0_3 = { status = "completed", commit_sha = "2a768893", description = "Pre-flight: verify 18 per-aggregate dataclasses (17/18 have from_dict(); NormalizedResponse is output type)" }
t1_1 = { status = "completed", commit_sha = "75eb6dbb", description = "Phase 1: replace Metadata TypeAlias with @dataclass(frozen=True, slots=True) having 36 fields" }
t3_1 = { status = "completed", commit_sha = "0d0b433a", description = "Phase 3 partial: remove 13 hasattr(f, ...) checks in src/app_controller.py" }
[verification]
phase_0_complete = true
phase_1_complete = true
phase_3_partial_complete = true
phase_8_complete = true
phase_9_complete = true
[boundary_audit]
metadata_typed_fat_struct = true
metadata_typealias_removed = true
metadata_field_count = 36
dict_compat_methods_added = ["__getitem__", "get", "__contains__", "__iter__", "keys", "values", "items"]
boundary_files = ["src/api_hooks.py", "src/project_manager.py", "src/session_logger.py", "src/mcp_client.py"]
[metric_summary]
baseline = { metadata_typealias = 1, hasattr_f_path = 29, optional_returns = 30, any_params = 59, dict_str_any_params = 10 }
after_phases_1_3 = { metadata_typealias = 0, hasattr_f_path = 19, optional_returns = 30, any_params = 60, dict_str_any_params = 11 }
deltas = { metadata_typealias = -1, hasattr_f_path = -10, optional_returns = 0, any_params = 1, dict_str_any_params = 1 }
[deferred_to_followup_tracks]
# Items deferred from this track for follow-up tracks
{ id = "F1", title = "cruft_elimination_gui_2_followup", description = "Remove 18 hasattr(f, 'path') checks in src/gui_2.py", scope = "1 source file; 18 sites" }
{ id = "F2", title = "cruft_elimination_phase_4_5", description = "Phase 4 + Phase 5: fix _do_generate and rag_engine.search return types", scope = "2 source files; ~5 sites" }
{ id = "F3", title = "cruft_elimination_phase_6", description = "Phase 6: eliminate Optional[T] returns", scope = "14 files; 30 sites" }
{ id = "F4", title = "cruft_elimination_phase_7", description = "Phase 7: eliminate Any + dict[str, Any] in internal signatures", scope = "8+ files; 69 sites" }
{ id = "F5", title = "metadata_dict_compat_deprecation", description = "Remove dict-compat methods on Metadata once all consumers migrated", scope = "1 file; methods: __getitem__, get, __contains__, __iter__, keys, values, items" }
[audit_gate_results]
audit_weak_types = "STRICT OK (107 <= 112 baseline)"
generate_type_registry = "Registry in sync (23 files checked)"
audit_main_thread_imports = "OK (17 files)"
audit_no_models_config_io = "OK (0 violations)"
audit_optional_in_3_files = "OK (0 return-type violations)"
audit_exception_handling = "OK"
audit_code_path_audit_coverage = "OK (0 violations, 10 profiles)"