Files
manual_slop/scripts/tier2/artifacts/fix_deprecation_section.py
T
ed 93ccf1b182 chore(tier2): move throw-away scripts to artifacts/ subdir
Tier 2 wrote 23 working scripts to scripts/tier2/ during the
send_result_to_send_20260616 track. These were scaffolding for the
rename work, not part of the codebase.

Move them to scripts/tier2/artifacts/ so the base scripts/tier2/
directory stays clean (it should only contain the production code:
failcount.py, run_track.py, write_report.py, setup_tier2_clone.ps1,
run_tier2_sandboxed.ps1, fetch_tier2_branch.ps1).

Per user feedback 2026-06-17: throw-away scripts are kept (for
archival) but live in a dedicated subdir, not in the production
namespace.
2026-06-17 02:05:10 -04:00

59 lines
2.1 KiB
Python

"""Fix the deprecation section in error_handling.md to reflect historical state.
This uses a marker-based replacement to avoid encoding issues with unicode
characters in PowerShell output.
"""
from __future__ import annotations
import sys
from pathlib import Path
DOC = Path("conductor/code_styleguides/error_handling.md")
# We use the start and end markers that are unique to the deprecation section.
START_MARKER = "## Deprecation: `ai_client."
END_MARKER = "transition; new tests for the new API should\nassert the warning is NOT emitted by `send()`.\n\n"
def main() -> int:
with DOC.open("r", encoding="utf-8", newline="") as f:
content = f.read()
has_crlf = "\r\n" in content
nl = "\r\n" if has_crlf else "\n"
start_marker = START_MARKER.replace("\n", nl)
end_marker = END_MARKER.replace("\n", nl)
i = content.find(start_marker)
if i < 0:
print(f"Start marker not found", file=sys.stderr)
return 1
j = content.find(end_marker, i)
if j < 0:
print(f"End marker not found", file=sys.stderr)
return 1
end_of_section = j + len(end_marker)
section_text = content[i:end_of_section]
replacement = """## Historical deprecation (added 2026-06-15, reverted 2026-06-16)
The public `ai_client.send()` was briefly marked `@deprecated` in favor of
`ai_client.send_result()` on 2026-06-15 by the
`public_api_migration_and_ui_polish_20260615` track. The decision was
reverted on 2026-06-16 by `send_result_to_send_20260616` after the
Tier 2 autonomous sandbox proved capable of doing the rename safely.
`ai_client.send(...) -> Result[str, ErrorInfo]` is the canonical public API.
No deprecation is in effect. For the historical record of the brief
deprecation cycle, see
`conductor/tracks/public_api_migration_and_ui_polish_20260615/spec.md`
and `conductor/tracks/send_result_to_send_20260616/spec.md`.
""".replace("\n", nl)
new_content = content[:i] + replacement + content[end_of_section:]
with DOC.open("w", encoding="utf-8", newline="") as f:
f.write(new_content)
print(f"Replaced {len(section_text)} chars of deprecation section with {len(replacement)} chars of historical note.")
return 0
if __name__ == "__main__":
raise SystemExit(main())