From ca557b4a1707ab0912e1157dd0ffbd84879a3300 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Sun, 21 Jun 2026 20:00:57 -0400 Subject: [PATCH] artifacts(track): throwaway scripts for phase2_4_5_call_site_completion_20260621 Per the Tier 2 convention, throwaway scripts are committed as archival artifacts so future agents can understand what was tried during the track. 7 scripts: - verify_test_format.py: AST + indentation check for new test file - _check_line_endings.py: CRLF vs LF diagnostic - _find_tracks_line.py: locate line 27 entry in tracks.md - _verify_line_66.py: verify new line 66 content - _update_tracks_md.py: programmatic update of line 27 - _update_state_toml.py: programmatic update of state.toml - _fix_state_toml_crlf.py: restore CRLF after edits --- .../_check_line_endings.py | 5 +++++ .../_find_tracks_line.py | 11 ++++++++++ .../_fix_state_toml_crlf.py | 14 ++++++++++++ .../_update_state_toml.py | 22 +++++++++++++++++++ .../_update_tracks_md.py | 15 +++++++++++++ .../_verify_line_66.py | 8 +++++++ .../verify_test_format.py | 18 +++++++++++++++ 7 files changed, 93 insertions(+) create mode 100644 scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/_check_line_endings.py create mode 100644 scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/_find_tracks_line.py create mode 100644 scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/_fix_state_toml_crlf.py create mode 100644 scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/_update_state_toml.py create mode 100644 scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/_update_tracks_md.py create mode 100644 scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/_verify_line_66.py create mode 100644 scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/verify_test_format.py diff --git a/scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/_check_line_endings.py b/scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/_check_line_endings.py new file mode 100644 index 00000000..65a0f315 --- /dev/null +++ b/scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/_check_line_endings.py @@ -0,0 +1,5 @@ +with open('conductor/tracks.md', 'rb') as f: + content = f.read() +crlf = content.count(b'\r\n') +lf_only = content.count(b'\n') - crlf +print(f'CRLF: {crlf}, LF-only: {lf_only}') \ No newline at end of file diff --git a/scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/_find_tracks_line.py b/scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/_find_tracks_line.py new file mode 100644 index 00000000..0963950e --- /dev/null +++ b/scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/_find_tracks_line.py @@ -0,0 +1,11 @@ +import sys +import io +sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') +with open('conductor/tracks.md', 'r', encoding='utf-8') as f: + content = f.read() +lines = content.split('\n') +for i, line in enumerate(lines, 1): + if line.startswith('| 27 |'): + print(f'Line {i}: {line[:200]}...') + print(f'...end: ...{line[-100:]}') + break \ No newline at end of file diff --git a/scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/_fix_state_toml_crlf.py b/scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/_fix_state_toml_crlf.py new file mode 100644 index 00000000..b31b6e2a --- /dev/null +++ b/scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/_fix_state_toml_crlf.py @@ -0,0 +1,14 @@ +with open('conductor/tracks/phase2_4_5_call_site_completion_20260621/state.toml', 'rb') as f: + content = f.read() +# Fix the single LF-only line by adding \r before the \n +lines = content.split(b'\n') +for i, line in enumerate(lines): + if i < len(lines) - 1 and line and not line.endswith(b'\r'): + lines[i] = line + b'\r' + break +content = b'\n'.join(lines) +with open('conductor/tracks/phase2_4_5_call_site_completion_20260621/state.toml', 'wb') as f: + f.write(content) +crlf = content.count(b'\r\n') +lf_only = content.count(b'\n') - crlf +print(f'CRLF: {crlf}, LF-only: {lf_only}') \ No newline at end of file diff --git a/scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/_update_state_toml.py b/scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/_update_state_toml.py new file mode 100644 index 00000000..5e5d8a47 --- /dev/null +++ b/scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/_update_state_toml.py @@ -0,0 +1,22 @@ +import re +with open('conductor/tracks/phase2_4_5_call_site_completion_20260621/state.toml', 'r', encoding='utf-8', newline='') as f: + content = f.read() +content = content.replace('status = "active"', 'status = "completed"') +content = content.replace('current_phase = 0', 'current_phase = 6') +content = re.sub(r'phase_6a = \{ status = "pending", checkpointsha = ""', 'phase_6a = { status = "completed", checkpointsha = "224930d4"', content) +content = re.sub(r'phase_6b = \{ status = "pending", checkpointsha = ""', 'phase_6b = { status = "completed", checkpointsha = "58346281"', content) +content = re.sub(r'phase_6d = \{ status = "pending", checkpointsha = ""', 'phase_6d = { status = "completed", checkpointsha = "224930d4"', content) +content = re.sub(r'phase_6e = \{ status = "pending", checkpointsha = ""', 'phase_6e = { status = "completed", checkpointsha = "fbc5e5aa"', content) +content = re.sub(r'(t6[abcd]\d|tv_\d|t6e_\d) = \{ status = "pending", commit_sha = "",', r'\1 = { status = "completed", commit_sha = "see-phase-sha",', content) +content = content.replace('phase_6a_broadcast_fixed = false', 'phase_6a_broadcast_fixed = true') +content = content.replace('phase_6a_regression_test_passes = false', 'phase_6a_regression_test_passes = true') +content = content.replace('phase_6b_openai_compat_migrated = false', 'phase_6b_openai_compat_migrated = true') +content = content.replace('phase_6d_normalized_response_migrated = false', 'phase_6d_normalized_response_migrated = true') +content = content.replace('phase_6e_tier2_analysis_committed = false', 'phase_6e_tier2_analysis_committed = true') +content = content.replace('audit_weak_types_strict_passes = false', 'audit_weak_types_strict_passes = true') +content = content.replace('audit_dataclass_coverage_strict_passes = false', 'audit_dataclass_coverage_strict_passes = true') +content = content.replace('type_registry_check_passes = false', 'type_registry_check_passes = true') +content = content.replace('last_updated = "2026-06-21"', 'last_updated = "2026-06-21"\n# TRACK COMPLETE 2026-06-21 - all 4 phases shipped') +with open('conductor/tracks/phase2_4_5_call_site_completion_20260621/state.toml', 'w', encoding='utf-8', newline='') as f: + f.write(content) +print('state.toml updated') \ No newline at end of file diff --git a/scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/_update_tracks_md.py b/scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/_update_tracks_md.py new file mode 100644 index 00000000..5b079ec8 --- /dev/null +++ b/scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/_update_tracks_md.py @@ -0,0 +1,15 @@ +with open('conductor/tracks.md', 'r', encoding='utf-8', newline='') as f: + lines = f.readlines() +new_line = '| 27 | A | [Phase 2/4/5 Call-Site Completion (post any_type_componentization)](#track-phase2-4-5-call-site-completion-20260621) | spec \u2713, plan \u2713, metadata \u2713, state \u2713, **SHIPPED 2026-06-21** with all 4 phases complete (6a broadcast fix + 6b ChatMessage + 6d UsageStats no-op + 6e Phase 3 cost analysis); 5 atomic commits on tier2 branch; broadcast() TypeError fixed; 20/20 provider tests pass; all 3 audits --strict pass; unblocks `code_path_audit_20260607`; report at `docs/reports/TRACK_COMPLETION_phase2_4_5_call_site_completion_20260621.md` | any_type_componentization_20260621 (parent; shipped 2026-06-21 with 48/89 sites + 1 runtime bug) | (NEW 2026-06-21; bugfix + refactor + test-infrastructure + Tier 2 cost analysis; **Phase 6a COMPLETE**: fixed 2 broadcast() callers in `src/app_controller.py:1849` + `src/events.py:115` (gui_2.py had no callers, verified by grep); added `tests/test_websocket_broadcast_regression.py` 4/4 pass; **Phase 6b COMPLETE**: migrated `_send_grok` + `_send_minimax` + `_send_llama` to `ChatMessage` API; 20/20 provider tests pass; **Phase 6d NO-OP**: `NormalizedResponse` already uses `UsageStats` throughout `openai_compatible.py`; **Phase 6e COMPLETE**: produced `docs/reports/PHASE3_TIER2_ANALYSIS.md` (253 lines; Tier 2 authoritative version); measured 104 history sites (vs Tier 1 estimate 112); discovered 3 hidden cross-references (_strip_private_keys, _extract_minimax_reasoning, _send_llama_native); refined cost estimates: anthropic 35-65us/turn (Tier 1 said 8-15), grok/qwen/llama ~400ns (Tier 1 said 2-8us); **deferred**: Phase 3 call-site migration (104 sites in ai_client.py) -> separate track post-audit; cross-phase coupling -> separate track; `audit_tier2_leaks.py` sandbox-pollution -> infra track; **does NOT merge `tier2/any_type_componentization_20260621` branch** per Tier 2 reconnaissance framing; **does NOT archive `conductor/tracks/phase2_4_5_call_site_completion_20260621/`** - user handles that) |\r\n' +found = False +for i, line in enumerate(lines): + if line.startswith('| 27 |'): + lines[i] = new_line + found = True + print(f'Replaced line {i+1}') + break +if not found: + print('NOT FOUND') +with open('conductor/tracks.md', 'w', encoding='utf-8', newline='') as f: + f.writelines(lines) +print('File written') \ No newline at end of file diff --git a/scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/_verify_line_66.py b/scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/_verify_line_66.py new file mode 100644 index 00000000..040ef1c3 --- /dev/null +++ b/scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/_verify_line_66.py @@ -0,0 +1,8 @@ +import sys +import io +sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') +with open('conductor/tracks.md', 'r', encoding='utf-8') as f: + lines = f.readlines() +print(lines[65][:300]) +print('...END...') +print(lines[65][-100:]) \ No newline at end of file diff --git a/scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/verify_test_format.py b/scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/verify_test_format.py new file mode 100644 index 00000000..e8294376 --- /dev/null +++ b/scripts/tier2/artifacts/phase2_4_5_call_site_completion_20260621/verify_test_format.py @@ -0,0 +1,18 @@ +"""Verify test file format""" +import ast +with open('tests/test_websocket_broadcast_regression.py', 'rb') as f: + content = f.read() +crlf = content.count(b'\r\n') +lf_only = content.count(b'\n') - crlf +print(f'CRLF lines: {crlf}, LF-only lines: {lf_only}') +tree = ast.parse(content.decode('utf-8')) +funcs = [n.name for n in ast.walk(tree) if isinstance(n, ast.FunctionDef)] +print(f'Functions: {funcs}') +print('First function indent check:') +for n in ast.walk(tree): + if isinstance(n, ast.FunctionDef): + # Get the function body lines + body_line = n.body[0].lineno + first_stmt = n.body[0] + print(f' {n.name}: body[0] starts at line {body_line}, col_offset={first_stmt.col_offset}') + break \ No newline at end of file