Private
Public Access
0
0
Files
manual_slop/scripts/tier2/fix_deprecation_section.py
T
ed 9b5011231c docs(ai_client): rename send_result to send in 3 current docs
Doc consistency: guide_ai_client.md, guide_app_controller.md, and
the error_handling styleguide now reference the new symbol name.

Also fixes two consistency issues in error_handling.md introduced by
the mechanical rename:
1. The 'Deprecation: send -> send_result' section (lines 623-642) was
   rewritten as a 'Historical deprecation (added 2026-06-15, reverted
   2026-06-16)' note that points to the relevant track specs.
2. Line 204 (the 'Current State Audit' summary for src/ai_client.py)
   had a self-contradictory claim ('send() is the new public API;
   send() is @deprecated') after the rename. Updated to describe
   the canonical public API.

Historical archives (conductor/tracks/*/spec.md, conductor/tracks/*/plan.md,
docs/reports/*) are NOT modified - they document the 2026-06-15
public_api_migration decision and stay as historical record.
2026-06-17 00:50:36 -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())