GREEN phase for Phase 0. Mirrors scripts/audit_weak_types.py design with
3 additions specific to the any-type componentization track:
1. PROMOTED_SITE_MODULES allowlist: the 3 new src/ modules
(mcp_tool_specs.py, openai_schemas.py, provider_state.py) are exempt
from Any-counting (their new dataclasses intentionally have raw_response: Any
and SDK holder fields that stay as Any per Pattern 3).
2. INLINE_PROMOTED_SITE_MODULES: log_registry.py + api_hooks.py get their
dataclasses added inline in Phase 4 + 5 (not new modules); same exemption.
3. Combined counter: counts both Any AND weak-struct patterns
(dict_str_any, list_of_dict, optional_dict, etc.).
Modes:
- default: informational (exits 0; prints human report)
- --json: machine-readable with by_file, by_category, total_weak
- --strict: CI gate (exits 1 when current > baseline)
- --baseline: path to baseline file (default: scripts/audit_dataclass_coverage.baseline.json)
Baseline: scripts/audit_dataclass_coverage.baseline.json = 207 weak sites
(captured pre-Phase-1; expected to drop to ~118 after 89 sites promoted).
Verification:
uv run python scripts/audit_dataclass_coverage.py --strict
STRICT OK: 207 weak sites <= baseline 207
uv run pytest tests/test_audit_dataclass_coverage.py --timeout=30
7 passed in 5.15s
RED phase for Phase 0. Mirrors tests/test_audit_weak_types.py structure:
- test_audit_script_exists: AUDIT_SCRIPT.is_file() sanity
- test_audit_help_runs: --help exits 0
- test_audit_json_mode_emits_valid_json: --json emits valid JSON with expected fields
- test_audit_default_mode_emits_human_report: default mode prints a report
- test_audit_strict_mode_against_existing_baseline_passes: --strict exits 0 when current <= baseline
- test_audit_strict_mode_fails_when_baseline_is_zero: --strict exits 1 when current > baseline=0
- test_audit_baseline_field_shape: --json output has expected baseline-shape fields
7 tests total. Run with: uv run pytest tests/test_audit_dataclass_coverage.py --timeout=30
NOTE: 6 of 7 tests fail at this commit (audit script not yet implemented).
This is the RED phase; GREEN comes in the next commit.
The spec.md was approved 2026-06-21 without a plan.md (the metadata.json
noted 'plan.md (to be authored by writing-plans skill after spec
approval)'). This plan mirrors the state.toml's per-task ledger and
specifies the TDD protocol, tier-3 delegation conventions, hard bans,
failcount contract, and per-phase verification commands.
Plan structure: 7 phases, 61 tasks, ~50 atomic commits per the spec.
Reads all 13 conductor/code_styleguides/*.md per the agent mandate.
Each child spec is lightweight (~100 lines): references the umbrella, gives video details, specifies the 7 deliverables (transcript.json, frames/, ocr.md, report.md 1000-10000 LOC, summary.md), and the 5-phase pipeline.
Children in execution order:
1. cs229_building_llms (Stanford CS229, Cluster E)
2. probability_logic (Cluster A)
3. entropy_epiplexity (Cluster A)
4. score_dynamics_giorgini (Cluster A)
5. platonic_intelligence_kumar (Cluster B)
6. free_lunches_levin (Cluster B)
7. generic_systems_fields (Cluster C)
8. brain_counterintuitive (Cluster C)
9. neural_dynamics_miller (Cluster C)
10. multiscale_hoffman (Cluster C)
11. cs336_architectures (Stanford CS336, Cluster E)
12. creikey_dl_cv (Cluster D)
Plus 1 synthesis track (video_analysis_synthesis_20260621) blocked_by all 12 children.
Replaces the v1 plan (10 phases, single-stage cross-check) with an 11-phase
plan that executes the v2 spec's git-history classifier + 3-stage cross-check
+ 30% quality gate. Plan Phase 2 = Spec Phase 2 part 1; renumbering shifts
from Plan Phase 4 onwards (per the spec-vs-plan mapping in the summary table).
11 phases, 28 tasks, 4 hard pause points (Plan Phase 6 quality gate, Plan
Phase 7 Tier 1 review, Plan Phase 10 user sign-off, plus the Plan Phase 6
ABORT fallback to manual review). TDD red+green cycles for Phases 2-4 (8
new tests for _classify_status + 4 for extract_summary + 3 for format_markdown
+ 5 for the quality gate).
Test runner: scripts/run_tests_batched.py (per Tier 2 sandbox rule #1).
Throw-away scripts: scripts/tier2/artifacts/chronology_20260619/ (rule #4).
Default branch: master (rule #2). Line endings: preserve existing (rule #3).
The first run shipped chronology.md with a status classifier that read stale
metadata.json.status, marking 167/216 rows with wrong status. This v2 spec
replaces FR1 (5-value status enum + per-row evidence + confidence), FR5
(git-history classifier with the 5-step algorithm from the handover), FR6
(3-stage cross-check), and adds FR7 (classifier quality gate at 30% low
confidence threshold with abort-to-manual-review fallback).
Substantive changes from v1:
- 7 FRs (was 6); FR7 is new
- 14 VCs (was 12); VC10-VC14 are new
- 10 Risks (was 9)
- 5-value status enum: Active / In Progress / Completed / Abandoned / Special
(was 6-value: Shipped/Superseded/etc.)
- Per-row evidence line format documented with worked example
- 'Needs Review' section as a 5th section in chronology.md
- Quality gate hard-codes the user's 'A only if classifier is good, else B'
fallback design from chat 2026-06-21
Out of scope: 24 v1 commits + conductor/chronology.md.broken-v1 remain as the
foundation; this is a continuation, not a re-do. state.toml still shows
current_phase=10 from v1's false completion; the Tier 2 implementing agent
will reset it in Phase 1.4 of the plan.
3 surgical test-side fixes shipped after the result-migration campaign was
claimed '100% complete' (commit 0d11e917). Each failure had a distinct root
cause that bypassed the targeted track-level test sets:
1. test_phase_1_inventory_has_42_rows (tier-1-unit-gui): gitignored artifact
deleted by cruft-removal at b3508f0b (commit 107d902d)
2. test_live_warmup_canaries_endpoint (tier-3-live_gui): race with deferred
warmup in live_gui subprocess (commit 69b7ab67)
3. test_do_generate_uses_context_files (tier-1-unit-core): sandbox violation
via paths.get_logs_dir default (commit e2411e5c)
Full batched test suite: 11/11 tiers PASS. Campaign is now actually 100%
complete. Report documents root causes, fixes, verification, and process
learnings (rounds 6+7 of the false-completion pattern).
Per FR1 of test_sandbox_hardening_20260619 spec, all writes must be under
<project_root>/tests/. Tests that create an AppController + call init_state()
trigger session_logger.open_session() at src/session_logger.py:85 which
writes to paths.get_logs_dir() - by default logs/ at project root, outside
tests/. This was triggered by tests/test_context_composition_decoupled.py
and surfaced in the latest batched test run.
Add a function-scoped autouse fixture in tests/conftest.py that monkeypatches
src.paths.get_logs_dir to return a per-run tests/-allowed path. Per-run
subdirectory prevents log_registry.toml collisions across test runs.
Skips test_paths.py, test_test_sandbox.py, and test_app_controller_offloading.py
which directly assert on paths.get_logs_dir() behavior or set up their own
session via tmp_session_dir (overriding get_logs_dir at the module level
breaks those tests' assertions). No production code is modified.
The live_gui subprocess spawns the desktop GUI, which creates AppController
with defer_warmup=True (src/gui_2.py:318). Warmup is deferred until the first
frame is painted (src/gui_2.py:1076). The previous test queried
/api/warmup_canaries immediately after wait_for_server, racing against the
first frame - canary list was empty until start_warmup() ran.
Replace the immediate assert with a poll-with-retry loop (15s deadline,
0.5s interval) per workflow.md 'Async Setters Need Poll-For-State' rule.
Tests/artifacts/PHASE1_SITE_INVENTORY.md was deleted by the cruft-removal
track at commit b3508f0b (mistaken for sub-track 5's combined doc). The
file is gitignored and cannot be restored from git history. This commit
adds a session-scoped autouse fixture in tests/test_gui_2_result.py that
regenerates the inventory markdown from scripts/audit_exception_handling.py
--json output before the test runs.
The 3 split files (PHASE1_INVENTORY_*.md, no 'SITE') are for sub-track 5
and cover mcp_client/ai_client/rag_engine (not gui_2). They coexist with
this regenerated file per sub-track 4's convention.