# Plan: metadata_field_cache_20260624 3 tasks, 3 atomic commits. Same pattern as children 1 and 2. ## Phase 1: Behavioral Test (1 task) - [ ] Task 1.1: Write `tests/test_metadata_field_cache.py`. - WHERE: New file `tests/test_metadata_field_cache.py` - WHAT: 4 tests (per spec FR3) - HOW: Use 1-space indentation - SAFETY: Test imports `MetadataFieldCache` + `MetadataHandle` from their production locations - COMMIT: `test(metadata): behavioral test for field cache (MetadataFieldCache)` - GIT NOTE: 4 tests; will be RED until Phase 2 ships - VERIFY: `uv run pytest tests/test_metadata_field_cache.py -v` shows 4/4 FAIL (expected) ## Phase 2: Implementation (1 task) - [ ] Task 2.1: Add `MetadataFieldCache` + migrate the 123 field-access sites. - WHERE: `src/aggregate.py` (cache type) + the 123 field-access sites across `src/` - WHAT: - Add `class MetadataFieldCache` with `get`, `set`, `invalidate` methods - Migrate the 123 `entry.get('key', default)` and `entry['key']` sites to use the cache - HOW: Use `manual-slop_py_add_def` for the cache type; `manual-slop_edit_file` for the migration sites - SAFETY: Verify with `ast.parse`; run the 4 tests + the child-1 + child-2 tests + the 14 previously-failing tests - COMMIT: `feat(metadata): MetadataFieldCache + 123 field-access site migrations` - GIT NOTE: 123 sites now use cache; cache invalidation on generation bump (child 2's registry) - VERIFY: `uv run pytest tests/test_metadata_field_cache.py tests/test_metadata_generational_handle.py tests/test_metadata_nil_sentinel.py -v` shows all PASS ## Phase 3: Verification + Budget Gate (1 task) - [ ] Task 3.1: Run all 6 VCs; capture the budget gate measurement; write end-of-campaign TRACK_COMPLETION. - WHERE: All audit gates + test suite + SSDL measurement + campaign umbrella - WHAT: - Run VC1-VC6 for the child - Compute the new effective-codepaths number - Compare to post-child-2 measurement; require drop ≥ 30% - Write the child's TRACK_COMPLETION report - Update this track's `state.toml` to `status = "completed"`, all 3 phases completed - Append to campaign_measurements_20260624.md - Update conductor/tracks.md - ALSO: write the campaign's end-of-campaign TRACK_COMPLETION at `docs/reports/TRACK_COMPLETION_metadata_ssdl_defusing_20260624.md` - Update the campaign umbrella's `state.toml` to `status = "completed"`, all 4 phases completed - HOW: Run each VC command, capture output, write the report. - SAFETY: Same as children 1 and 2 - COMMIT: 3 child commits (state, TRACK_COMPLETION, tracks.md) + 3 campaign commits (state, TRACK_COMPLETION, tracks.md) - GIT NOTE: Per workflow.md - VERIFY: All 6 VCs pass; budget gate met; campaign umbrella SHIPPED ## Commit Log (Expected) 1. `test(metadata): behavioral test for field cache` (Task 1.1) 2. `feat(metadata): MetadataFieldCache + 123 field-access site migrations` (Task 2.1) 3. `conductor(state): metadata_field_cache_20260624 SHIPPED` (Task 3.1) 4. `docs(reports): TRACK_COMPLETION for metadata_field_cache_20260624` (Task 3.1) 5. `conductor(tracks): add metadata_field_cache_20260624 row` (Task 3.1) 6. `docs(reports): TRACK_COMPLETION for metadata_ssdl_defusing_20260624` (Task 3.1) 7. `conductor(state): metadata_ssdl_defusing_20260624 SHIPPED` (Task 3.1) 8. `conductor(tracks): add metadata_ssdl_defusing_20260624 row + 3 child rows` (Task 3.1) ## Verification Commands ```bash # VC1: cache type exists grep -rn "class MetadataFieldCache" src/ # VC2: production uses cache grep -rn "field_cache.get\|field_cache.set" src/ # VC3: tests pass uv run pytest tests/test_metadata_field_cache.py -v # VC4: budget gate (final measurement) uv run python -c "from src.code_path_audit_ssdl import compute_effective_codepaths; ...; print(compute_effective_codepaths(metadata_profile, 'src'))" # VC5: full test suite uv run python scripts/run_tests_batched.py # VC6: 4 audit gates uv run python scripts/audit_weak_types.py --strict uv run python scripts/generate_type_registry.py --check uv run python scripts/audit_main_thread_imports.py uv run python scripts/audit_no_models_config_io.py # Campaign-wide cat docs/reports/TRACK_COMPLETION_metadata_ssdl_defusing_20260624.md ```