Skip to content

feat(boxed): per-module plane split, clean modules stay native beside a fenced module - #793

Draft
espetro wants to merge 13 commits into
work/ytnativefrom
work/planesplit
Draft

espetro wants to merge 13 commits into
work/ytnativefrom
work/planesplit

Conversation

@espetro

@espetro espetro commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Per-module plane split for the island tier, stacked on #792. A fenced module rides its own island floor while clean modules lower native, meeting at the existing boxed boundary seam (ps_island_mod_* per-module namespaces in ps_island.c; the legacy single-namespace ABI is untouched). Design note: .agents/notes/2026-10-30-plane-split.md.

On the shape it covers (a program of plain sibling modules), clean.add and __main__.main are native and dirty.broken is island, with output byte-identical to CPython. tests/test_plane_split.py has 8 tests: same-named fenced definitions in separate namespaces, one fenced and one clean definition in a module, island exceptions reaching a native caller, the island-to-native cross-module refusal (PS2002), and the binary running away from the source tree. Affected island suites pass (70 passed, 1 skipped).

Honest result on yt-dlp: the executed native fraction does not move (0%), because yt-dlp never reaches the split. Of 1,042 units, 1,031 have an island top level (a module-level import outside the closed stdlib table fences the whole top level, then the #620 cascade pulls the definitions along), leaving 472 planned definitions of which 3 are native. Package-shaped programs (16 __init__.py units) still run whole-program island, since the per-module seed has no finder bootstrap, and three circular imports are refused before the plans are computed.

Boxed ledger (mise run boxed:cost, window 1708c74d..e3ad1caa): code 5.3%, churn 7.7%, bugs 0.0%, tax 0.0%, drop_flag false.

Next wall: the closed stdlib import table, or routing only the definition that needs an unsupported import island-side.

Agent added 5 commits October 30, 2026 14:07
…and-side and keeps clean modules native

A program with a fenced unit no longer runs whole island-side: the
fenced module keeps its own island floor seed and the clean modules
lower native, with a cross-module call crossing the boundary through
the boxed seam (ps_island_mod_fn_invoke, one namespace per program
module). The entry's top level and a package-shaped program still run
whole island-side, where the per-module seed cannot reproduce the
module semantics.
The eight cases cover the split itself (a native lane beside an island
lane), the per-module island namespaces (two modules with the same
definition name stay apart), the boundary call in the LLVM, the two
refusals the split makes sound (an island definition calling a native
one of another module, and a package-shaped program that cannot use
the per-module seed), and an exception crossing the boundary back to
a native caller.

The island-to-native refusal lives in the lowerer: an island definition
of one module calling a compiled definition of another module has no
seam to cross, the same way a compiled sibling has none.
The split needs the program's modules to be plain siblings, because the
per-module seed cannot reproduce the package semantics. Relaxing the
rule to allow package units runs, but the island seed re-executes the
package __init__ (its prints double) and an island function reading
__file__ finds no value: the per-module seed has no finder bootstrap
that serves the program's own modules.
The split does not engage on yt-dlp: every module top level fences on
unlowered stdlib imports, which routes the whole top level island-side
and cascades the definitions with it (1031 of 1042 modules island,
3 of 472 planned definitions native). The package shape (16 package
units, no per-module finder bootstrap) and the three circular imports
block the split on top of that. The next wall for a native fraction on
yt-dlp is the stdlib import table, not the boundary seam.
@espetro espetro added this to the v0.8.0 milestone Oct 30, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Deploying pyscriptc with  Cloudflare Pages  Cloudflare Pages

Latest commit: 91630a0
Status: ✅  Deploy successful!
Preview URL: https://53d81c3a.pyscriptc.pages.dev
Branch Preview URL: https://work-planesplit.pyscriptc.pages.dev

View logs

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant