|
| 1 | +# Compiler compatibility matrix: compiler-parity/1 |
| 2 | + |
| 3 | +The development compiler runs the same approved source corpus under CPython |
| 4 | +3.14.7 and as identical emitted ES modules in Node 24.19.0 and a Chromium module |
| 5 | +worker. This is a bounded ahead-of-time Python profile. The independent source |
| 6 | +interpreter is a separate pocket-python implementation. Published 0.1.0 predates |
| 7 | +this compiler. |
| 8 | + |
| 9 | +| Area | Adopted behavior and evidence | Boundary | |
| 10 | +| --- | --- | --- | |
| 11 | +| Values | Typed None, bool, arbitrary-size int, code-point str and immutable tuple returns | Mutable containers, floats and arbitrary host values are deferred | |
| 12 | +| Evaluation | Output order, short-circuiting, default tuple identity, imported function aliases and source initialization order match CPython | Integer/string interning identity is not adopted; indirect local callable invocation is rejected | |
| 13 | +| Unicode/numbers | Integers beyond 2^53, signed floor/modulo, combining marks, supplementary characters and explicit surrogate pairs | Native JS strings count UTF-16 units; Python strings count code points | |
| 14 | +| Exceptions | Error class, adopted message, original filename/line/code-point column and output before failure match the reference | Argument-count wording and recursion resource limits are profile-specific | |
| 15 | +| Source maps | Actual Node and browser error stacks map back to original explicit raise, division, indexing and module callback source lines | These are mapped JS frames, not complete Python traceback objects; source-map columns identify emitted statements | |
| 16 | +| Async | Lazy/single-use coroutines, Promise callback side effects, rejected values and previously raised error origins | Microtask scheduling can differ from CPython; async generators/iteration and Promise.all are not adopted | |
| 17 | +| Browser host | Real-worker shared computation, DOM callbacks/release, Fetch grants/limits, cancellation and stop/restart are checked separately by compiler_browser_smoke.py | Host errors carry original spans; workers provide responsiveness isolation, not a general security boundary | |
| 18 | +| Imports | Explicit source allowlist and shared module/runtime identity; module callback origins preserved | Dynamic imports, undeclared sources and arbitrary installed-package execution are rejected | |
| 19 | +| Diagnostics | Every rejected/deferred corpus entry must fail with its declared compiler diagnostic | A failed supported case fails the suite; no Python execution fallback in either target | |
| 20 | + |
| 21 | +The schema-1 corpus consists of compiler_contract.json plus compiler_parity.json. |
| 22 | +The initial matrix has 24 supported cases and 10 explicit boundary cases. Its |
| 23 | +report also records three native observations in both JavaScript targets: |
| 24 | +Array.of length, Promise callback ordering and UTF-16 string length. These are |
| 25 | +native API observations, not CPython-language assertions. Compiler Promise cases |
| 26 | +compare the adopted Python wrapper with emitted modules separately. |
| 27 | + |
| 28 | +The reference runs only trusted test fixtures in fresh isolated Python processes. |
| 29 | +The browser fixture server serves static assets; the browser worker performs the |
| 30 | +computation. Both targets import the same artifact bytes. Tagged comparison |
| 31 | +preserves integer precision, Unicode surrogate distinctions and tuple structure. |
| 32 | +Output and original error spans are compared independently. Source-map checks |
| 33 | +feed actual target stack frames to Node's SourceMap consumer. An unraised |
| 34 | +exception rejected through a Promise reports its first source await; its native |
| 35 | +JS stack can retain the construction site. Only explicitly raised errors in the |
| 36 | +traceback subset require the first mapped frame to identify the error origin. |
| 37 | + |
| 38 | +Run the complete suite from a development checkout with the declared browser |
| 39 | +test group and its Chromium installation: |
| 40 | + |
| 41 | +```sh |
| 42 | +uv sync --locked --group browser-tests |
| 43 | +uv run --no-sync python -m playwright install chromium |
| 44 | +uv run --no-sync python scripts/compiler_conformance.py --browser --report build/compiler-parity-report.json |
| 45 | +uv run --no-sync python scripts/compiler_browser_smoke.py --report build/compiler-browser-report.json |
| 46 | +``` |
| 47 | + |
| 48 | +Omit --browser for the Node/reference gate; --channel chrome selects an installed |
| 49 | +Chrome for local verification. CI pins the reference and Node versions, uses the |
| 50 | +locked Playwright package and retains both reports with the actual browser |
| 51 | +version. The ordinary installed-wheel/sdist suite runs the Node/reference gate |
| 52 | +on Linux, macOS and Windows. Reports contain every compared result, original and |
| 53 | +mapped error locations, profile classifications, corpus SHA-256 and artifact |
| 54 | +manifest identities. A corpus change updates its digest; incompatible report |
| 55 | +schema/comparison semantics require a new suite version. A report describes its |
| 56 | +tested versions and selected cases, not universal CPython compatibility. |
| 57 | + |
| 58 | +The shared reduced text-metrics computation originates in Shimify's fixture |
| 59 | +package. The attribution entry in compiler_parity.json pins the source revision; |
| 60 | +tests/fixtures/licenses/SHIMIFY-LICENSE.txt retains its exact MIT notice. Emitted |
| 61 | +shared-computation artifacts, the host smoke fixture and the runnable browser |
| 62 | +example include that notice in LICENSES/shimify.txt with manifest hashes. Other |
| 63 | +cases are original regression examples; no upstream Python test suite is copied. |
| 64 | +This attribution does not choose a license for the compiler itself. |
0 commit comments