Skip to content

feat: RFC 5.0 Phase 3 — translate-path deprecation#44

Merged
coryhubbell merged 1 commit into
mainfrom
feat/5x-phase3-translate-deprecation
Jul 4, 2026
Merged

feat: RFC 5.0 Phase 3 — translate-path deprecation#44
coryhubbell merged 1 commit into
mainfrom
feat/5x-phase3-translate-deprecation

Conversation

@coryhubbell

Copy link
Copy Markdown
Owner

Summary

Completes RFC 5.0 Phase 3: one conversion semantics. Every translate pair now rides parse → universal → convert; the v3 mapping engine survives only as a content-extraction fallback; fidelity metrics are reported per conversion; translate is deprecated on every surface (removed in 5.0).

Changes

  • DEVTB_Translator::translate() — the universal round trip (components_to_documentdocument_to_components) replaces the fuzzy mapping-engine step. All 182 matrix pairs stay green. A content-survival gate (text-normalized: entities decoded, tags stripped, whitespace collapsed — so markup/JSON escaping never read as loss) falls back to the v3 mapping engine only when the universal route would lose content. Stats gain route and fidelity.
  • PHP CLI — deprecation notice; stats block shows route + fidelity (and no longer reads keys that never existed).
  • devtb wrappertranslate documented as deprecated, same lossless path; help/version text updated.
  • Python CLItranslate accepted as a deprecated alias of transform; unregistered pairs convert through the universal route (any parsed document → any of the 14 converters) behind a runtime fidelity gate (< 50% content survival → honest fallback to content extraction with a pointer to the PHP engine); fidelity printed per conversion with a content-key-aware collector (style enums excluded).

Bug found & fixed along the way

devtb-php never defined the DEVTB_CLI constant, so the responsive helper's ABSPATH guard silently exited the process (exit 0, mid-conversion, no output) for any real CLI translation touching it — e.g. Bricks targets. Also added a wp_strip_all_tags stub for CLI mode.

Test evidence

  • TranslatePathTest (5 PHP tests): universal route by default on both fixtures, fidelity ranges, JSON-target fidelity, full confidence.
  • test_translate_path.py (25 Python tests): converter resolver for all 14 targets, fidelity metric unit tests, alias + gate exercised through the real CLI via subprocess.
  • Suites: PHP 344/5,691 · Python 262 · 3 e2e smokes × 2 engines — all green locally.

🤖 Generated with Claude Code

Every translate pair now rides parse → universal → convert; the v3
mapping engine survives only as the content-extraction fallback; fidelity
is reported per conversion; 'translate' is deprecated everywhere.

- DEVTB_Translator::translate(): universal round trip replaces the fuzzy
  mapping step (all 182 matrix pairs green); v3 mapping runs only when a
  content-survival gate detects loss on the universal route; stats gain
  'route' + 'fidelity' (content strings preserved/total, text-normalized
  comparison so markup and JSON escaping never read as loss)
- PHP CLI: deprecation notice, route + fidelity in the stats block (also
  fixes the block reading keys that never existed)
- devtb wrapper: translate marked deprecated (removed in 5.0), same
  lossless path; help/version text updated
- Python CLI: 'translate' alias of transform with deprecation notice;
  unregistered pairs use the universal route (any parsed doc → any of the
  14 converters via get_converter_for_framework) behind a runtime
  fidelity gate, content extraction as last resort; fidelity printed per
  conversion
- Fix: devtb-php never defined DEVTB_CLI, so CLI translations touching
  the responsive helper (e.g. bricks targets) exited silently; stub added
  for wp_strip_all_tags in CLI mode
- Tests: TranslatePathTest (5 PHP), test_translate_path.py (25 Python)

Suites: PHP 344/5,691 · Python 262 · 3 e2e smokes × 2 engines — green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coryhubbell coryhubbell merged commit 69dbaeb into main Jul 4, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant