From 718934243e8c284008b98c6b057db52d9422c81c Mon Sep 17 00:00:00 2001 From: Ed_ Date: Thu, 25 Jun 2026 18:51:11 -0400 Subject: [PATCH] conductor(plan): add hard rules #11 (no-op ban) and #12 (metric revert) after Tier 2 failure --- .../metadata_promotion_20260624/plan.md | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/conductor/tracks/metadata_promotion_20260624/plan.md b/conductor/tracks/metadata_promotion_20260624/plan.md index 83136764..bcd6c2ce 100644 --- a/conductor/tracks/metadata_promotion_20260624/plan.md +++ b/conductor/tracks/metadata_promotion_20260624/plan.md @@ -1872,6 +1872,26 @@ EOF 8. **Do NOT exceed 5 nesting levels** — extract to functions if you hit the limit. 9. **Do NOT modify `src/code_path_audit*.py`** — the audit infrastructure is correct. 10. **Do NOT promote `Metadata: TypeAlias = dict[str, Any]` itself** — it's preserved as the catch-all. +11. **NO-OP CLASSIFICATION BAN (added 2026-06-25 after a Tier 2 failure)** — Do NOT classify any planned task as "no-op" without explicit user authorization in the same session. If a planned migration site exists in the plan's Task table, MIGRATE it. The plan is the contract; FR2 is a rule in the spec; the plan's tasks are what you execute. If FR2 and the plan conflict at a specific site: + - Read the site's variable type via `git grep -B 5 -A 5 ` to determine if it's a dict or a dataclass instance. + - If it's a dataclass instance: migrate to direct field access per the plan. + - If it's a dict at a genuinely collapsed codepath (TOML config, JSON wire, handler-map): migrate anyway by inserting `entry = .from_dict(entry)` (or equivalent) BEFORE the access site, OR classify the SPECIFIC site as collapsed-codepath and document in the per-site commit message (do NOT classify the whole phase). + - If you can't decide: STOP. Write a 1-sentence question. Wait for the user. Do NOT invent a reconciliation. +12. **METRIC REGRESSION REVERT (added 2026-06-25)** — After every consumer-migration phase (Phases 1-10), run: + ```bash + uv run python -c " + import sys + sys.path.insert(0, 'scripts/code_path_audit') + sys.path.insert(0, 'src') + from code_path_audit import build_pcg + from code_path_audit_ssdl import count_branches_in_function + pcg = build_pcg('src').data + metadata_consumers = pcg.consumers.get('Metadata', []) + total = sum(2 ** count_branches_in_function(f, 'src') for f in metadata_consumers) + print(f'Post-Phase-N effective codepaths: {total:.3e}') + " + ``` + If the metric did NOT decrease vs. the previous measurement, `git revert ` IMMEDIATELY. Do NOT add a followup task to "investigate". Do NOT rationalize in the commit message or TRACK_COMPLETION. The 4.014e+22 → < 1e+20 drop is the success criterion; if it's not happening, the implementation is wrong; revert and report. ## Per-phase Tier 2 review checklist @@ -1882,7 +1902,7 @@ Before approving each phase, Tier 2 verifies: 3. The pre-phase git grep counts decreased by the expected amount (e.g., Phase 1 should remove ~50 `.get('id', default)` sites). 4. The audit gates (`audit_weak_types.py --strict`, `audit_main_thread_imports.py`, etc.) still pass. 5. The batched test suite (`scripts/run_tests_batched.py`) still passes 10/11 tiers. -6. The effective codepaths metric decreased (or held steady for design-only phases). +6. The effective codepaths metric decreased (or held steady for design-only phases). **If metric did NOT decrease after a consumer-migration phase (1-10), REVERT that phase commit immediately per Hard Rule #12. Do NOT approve.** If any check fails, Tier 2 REVERTS the phase commit and reports to the user.