feat: RFC 5.0 Phase 3 — translate-path deprecation#44
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Completes RFC 5.0 Phase 3: one conversion semantics. Every
translatepair now rides parse → universal → convert; the v3 mapping engine survives only as a content-extraction fallback; fidelity metrics are reported per conversion;translateis deprecated on every surface (removed in 5.0).Changes
DEVTB_Translator::translate()— the universal round trip (components_to_document→document_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 gainrouteandfidelity.devtbwrapper —translatedocumented as deprecated, same lossless path; help/version text updated.translateaccepted as a deprecated alias oftransform; 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-phpnever defined theDEVTB_CLIconstant, so the responsive helper's ABSPATH guard silentlyexited the process (exit 0, mid-conversion, no output) for any real CLI translation touching it — e.g. Bricks targets. Also added awp_strip_all_tagsstub 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.🤖 Generated with Claude Code