legacy: drop python reference oracle (live savings confirmed at 98.7%)

HANDOFF item #4 was "Delete legacy/python/ — but only after #1 confirms
live savings." Item #1 (live cache-rate validation) now passes: over 232
compressed POST /v1/messages calls in a 46-minute real-traffic window,
cache hit rate by tokens is 98.7%, clearing the HANDOFF 60% bar by 38
points. The Python reference has done its job.

Removes (1831 deletions):
  legacy/python/proxy.py        (975)  full Python proxy implementation
  legacy/python/diff_transform.py (213)  body-diff parity oracle
  legacy/python/cli.js          (170)  shim
  legacy/python/visual_compare.py (150) PNG-diff parity oracle
  legacy/python/diff_render.py  (136)  render-only parity oracle
  legacy/python/gen_atlas.py    ( 75)  atlas generator (TS port owns this now
                                       via scripts/gen-atlas.ts)
  legacy/python/install.js      ( 50)  installer shim
  legacy/README.md              ( 35)

Comment / doc updates to remove references:
  README.md            drops the "## Legacy" section
  CLAUDE.md            drops the "## Parity oracle" section + tree entry
  src/core/transform.ts  header comment no longer cites legacy/python
  src/dashboard.ts     header comment notes the formulas were ported,
                       not where from
  docs/TRANSFORM_INFO.md edits land in the separate TRANSFORM_INFO commit

The byte-output determinism the Python oracle existed to guard against
is now pinned by tests/render.test.ts ("renders identical input to byte-
identical output (determinism = cacheability)") and the systemSha8
fingerprint in every JSONL row. If a future change ever breaks
determinism, the test will catch it before merge, and the
production-deployed cache hit rate will catch it within minutes after.

Gates: typecheck clean, 38 tests pass, build clean dist/node.js.
This commit is contained in:
teamchong
2026-05-18 17:56:56 -04:00
parent 96e3422250
commit be372a0c3a
11 changed files with 5 additions and 1814 deletions
+3 -2
View File
@@ -5,8 +5,9 @@
* those images instead — saving 65-73% input tokens on Opus 4.7 while
* preserving 100% reasoning quality.
*
* Matches the public-surface behavior of legacy/python/proxy.py at a
* minimum. Stricter byte-for-byte parity is verified in tests.
* Originally ported from a Python reference implementation; the Python
* has since been removed (live cache-rate validation passed at 98.7% by
* tokens). Byte-output determinism is now verified by tests alone.
*/
import type {
+2 -1
View File
@@ -7,7 +7,8 @@
* GET /proxy-recent → JSON ring buffer of recent requests
* GET /proxy-latest-png[?crop=N] → raw PNG of the latest rendered image
*
* Ported from legacy/python/proxy.py — same metric formulas, same HTML shell.
* Metric formulas and HTML shell originally ported from the Python reference
* implementation (deleted after live cache-rate validation hit 98.7% by tokens).
*
* Node-only by design (uses node:fs for startup replay + node:zlib for the
* preview crop). The Worker host doesn't expose a dashboard; use Workers Logs.