Repository navigation
fix(isc): decode \U escapes; duplicate ruleset is a load error (G7) - #51
Merged
Merged
Conversation
…lback) The parser rendered \U as a literal "U" with the digits as raw text — a stale 0.1.x ts hand-parser parity note (ts decodes both spellings since the WO19 G6 fix; ruby/rs always did; grammar/isc.parg esc_uni = "U" (4*8hexd) as unicode, esc_u_lone only the non-hex fallback). Consequence: the three Belarusian maps' uppercase-Ў rules (sub "\U040E" "Ŭ" / "W") never fired, and the golden corpus replay carried a standing exclusion for all rows of gki-bel-Cyrl-Latn-2000, mvd-bel-Cyrl-Latn-2008 and odni-bel-Cyrl-Latn-2015 (py#49's tracked divergence). All 68 rows of those maps now replay byte-identically (16,322/16,322 with no exclusions); exactly the 3 uppercase-Ў rows converge — every other corpus row is unchanged (the only corpus uses of the single-backslash capital escape are these 3 maps; the doubled-backslash \\U040E literal forms elsewhere are untouched). Edge shapes are ruby-measured 4/4: \U00000041 -> A; \U000000410 -> A0 (first 8 hex consumed, a 9th stays raw); \U00e9 -> é; \Uab -> Uab (fewer than 4 hex digits = esc_u_lone literal "U", digits raw). Lowercase \u short forms still reject, as before.
The 0.2.x parser rewrite lost the 0.1.0 check that the WO18 G7 round
cites as canon ("py canon"): the ruleset-table dict comprehension let
the last `ruleset a` silently win, so py accepted maps the trio reject
— measured "xz" -> "x3" on maps docs/parity probe tst-rsdupdef.isc
(ruby MapLogicError #854, ts IscLoadError #138, rs MapLogicError #19,
all current mains). Keep-first/last-wins hides map bugs and makes the
executed body declaration-order dependent; spec section 6 item 4
already makes the adjacent cycle case a load error.
py now raises its named-load-error family class (UnsupportedConstruct,
the same class as its cycle / unknown-ruleset rejections) with the
trio's message shape — ruleset "a" declared more than once in
<systemCode> — at the ruleset-table build, and for dependency
documents in _owner_rulesets (the trio validate every document they
build). Pins both use forms: block-position `use` and stage-level
`use`.
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
Closes the two remaining cross-runtime divergences (uppercase-Ў golden replay exclusion from #49, and the parity-G7 duplicate-ruleset semantics) by converging py on the trio's behavior. Every target behavior is the MAJORITY behavior on fresh origin/main clones of ruby/ts/rs — no new semantics invented.
1. Capital-
\Uescape now decodes (Finding 1: the 3 excluded golden rows)_quoted_stringrendered\Uas a literal"U"with the digits as raw text, so the three Belarusian maps' uppercase-Ў rules (sub "\U040E" "Ŭ"/"W") never fired and the rows passed Ў through:ŬЎŬWЎWWЎWThe old behavior cited a "ts carries the same deviation" parity note from the 0.1.x hand parser — stale since the WO19 G6 fix (ts decodes both spellings; ruby/rs always did; grammar
esc_uni = "U" (4*8hexd) as unicode,esc_u_loneonly the non-hex fallback). Implemented as the grammar's ordered alternatives: 4..8 hex digits decode greedily (9th digit stays raw), fewer than 4 → literalUwith digits raw. Edge shapes verified ruby-identical 4/4 (\U00000041→A,\U000000410→A0,\U00e9→é,\Uab→Uab);\ushort forms still reject 4/4.Convergence: the golden corpus replay (
tests/golden/isc-wf0.jsonl, rs origin/main capture, 16,322 rows) now runs with NO exclusions and is byte-identical 16,322/16,322 — exactly the 3 rows above converge (all rows of the 3 previously-excluded maps now replay; their other rows already matched), zero other rows change (the only corpus uses of the single-backslash capital escape are these 3 maps; the doubled-backslash\\U040Eliteral forms in bgnpcgn-bel-1979 / alalc-bel-1997 / mvd-rus-2008 are untouched and still pass). The replay test's exclusion set and its rationale are removed.Pins:
tests/test_isc.py::test_capital_escape_decodes_and_falls_back(replacestest_capital_escape_stays_literal_u, ruby-measured edges).2. Duplicate ruleset declaration is a named load error (Finding 2: parity-G7)
The 0.2.x parser rewrite lost the 0.1.0 check the WO18 G7 round cites as canon ("py canon"):
doc_rulesets' dict comprehension silently let the lastruleset awin — measuredxz→x3onmapsprobetst-rsdupdef.iscwhere ruby/ts/rs all reject on current mains (ruby MapLogicError ruby#854, ts IscLoadError ts#138, rs MapLogicError rs#19, pins:wf1_semantics_spec.rb/wf1.test.ts/tests/wf1.rs::duplicate_ruleset_is_a_load_error).py now raises its named-load-error family class (
UnsupportedConstruct, same class as its cycle/unknown-ruleset rejections) with the ts-shaped messageruleset "a" declared more than once in <systemCode>— at the ruleset-table build for the loading document, and in_owner_rulesetsfor dependency documents (the trio validate every document they build). Contract recorded upstream on interscript/maps#293.Pins:
tests/test_wf1.py::test_duplicate_ruleset_declaration_is_a_named_load_error(block-useand stage-level-useforms, message shape asserted).Proof
pytest tests/green with both fixes (the 16,322-row replay included, no exclusions).tst-rsdupdef/tst-rsdup2now reject; four-runtime matrix re-probed on fresh clones (ruby/ts/rs reject, py rejects).