Repository navigation
Conversation
Two defects the empty-environment acceptance matrix of issue #661 found on macOS arm64. The staged program data tree (#665) sits beside the binary the compile produced, and `stage_bundle` moves that binary into `bin/`. The island bootstrap resolves the tree from the running image (the binary's own directory), so a relocated bundle looked for `bin/pyscriptc-data/<program>` and found nothing: the run died with `FileNotFoundError` on the data file. The tree now travels into `bin/` with the binary. A bundle compile that cannot get its pack (or that carries a native dependency) ended in a Python traceback. It is a user-facing refusal, so `embed.EmbedError` and `sitedeps.SiteError` are caught at the CLI boundary and printed as one line, naming `pyscriptc embed fetch` for the missing pack. The "fetching the runtime pack" notice is skipped when `PYSC_RUNTIME_DIR` points at an unpacked pack, where no fetch happens. The census fence pin moves with the code (3204 to 3177).
Three programs compiled into bundles, relocated to a fresh directory, run under `env -i` (no PATH, no HOME, no PYTHONHOME) and compared with CPython byte for byte (stdout, stderr and exit code): 1. the stdlib-only island fractions program, 2. a program importing a bundled pure-Python dependency (`pathspec`, issue #660, added to the dev group so the interpreter can stage it), 3. a program reading a staged data file (issue #665). Loader assertions: the relative rpath (`@executable_path/../lib` on macOS, `$ORIGIN/../lib` on Linux) is present and no absolute build path survives in the image. Size gates: macOS 40 MB, Linux 60 MB, uncompressed. A pack-less compile refuses with one line naming `pyscriptc embed fetch`, no traceback. The module skips unless the pinned pack is unpacked (cache or `PYSC_RUNTIME_DIR`); the CI cell in `.github/workflows/embed.yml` runs the same matrix on Linux x86_64 and macOS arm64.
The embed job's acceptance step now runs the issue #661 matrix on both cells (Linux x86_64 on ubuntu-24.04, macOS arm64 on macos-14): three programs (stdlib-only island, bundled pure dependency, staged data file) compiled into bundles, relocated, with the pack cache moved away and the source fixtures renamed away, run under `env -i` and compared with CPython's stdout, stderr and exit code; loader and size-gate assertions as in the test module. Issue #662 acceptance, unchanged in kind, now spelled out: - path filter: pull requests run only when the embedding surface changed (the gate step's grep, extended with `packaging/third-party.toml`, `scripts/gen_third_party_notices` and the workflow files); - nightly versus per-PR split: schedule, push to master and the release rehearsal (`workflow_dispatch` with always_run) run unconditionally; - pack cache keyed on the lock hash with a prefix fallback; - runner-minute budget documented in the header: 4 minutes per cell target, 6 hard timeout, about 12 runner minutes per full run, with the `EMBED_PR_SKIP_MACOS` repo variable flipping the macOS PR cell to nightly and rehearsal only. Measured minutes get recorded in issue #662 at close. A missing pack keeps the clean-skip behavior for the pre-#657 world and fails the step clearly once the lock exists.
Contributor
Author
|
Measured runner minutes for the embed jobs, first CI run of PR #717 (branch
So the full two-cell run costs under 2 runner minutes of Linux-equivalent time, well inside the documented budget (4 minutes per cell target, 6 hard timeout, about 12 minutes per full run ceiling). The macOS PR cell stays on pull requests; Acceptance run results (both cells green, same output): Linux x86_64 bundle: 50.4 MB uncompressed, inside the 60 MB gate. macOS arm64: 36.4 MB, inside the 40 MB gate. |
This branch has not been deployed
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.
Closes #661
Closes #662
Stacked on #716 (base
work/emb659).Gap analysis: what #661 and #662 already had, and what was missing
Read from the issues (
gh api repos/sigilco/pyscriptc/issues/661and/662) and compared against the tree after #707 and #716.#661, empty-environment acceptance test on macOS arm64 and Linux x86_64
Already met before this PR:
packaging/runtime.lock.tomlwithmacos-arm64andlinux-x86_64entries, checked bytests/test_embed.py:58(test_lock_pins_the_two_slice_platforms) andtests/test_embed.py:66.pyscriptc embed fetchwith sha256 verification:src/pyscriptc/embed.py:236(fetch),src/pyscriptc/embed.py:146(verify_sha256), pinned bytests/test_embed.py:79(a flipped byte is refused).src/pyscriptc/embed.py:370(link_flags), pinned bytests/test_embed.py:86andtests/test_embed.py:97.name/bin/nameplusname/lib/):src/pyscriptc/embed.py:392(stage_bundle), pinned bytests/test_embed.py:146.tests/test_embed.py:227(test_bundle_runs_without_system_python), which ran one program withenv={}.Missing, and implemented here:
tests/test_sitedeps.pyonly checked the staging against a fake site-packages tree, andtests/test_island_program.py:202checked the data-file relocation for a host-linked island, not for a bundle. Nowtests/test_embed_acceptance.py:96runs all three.tests/test_embed.py:257).otool -L/otool -lon macOS,readelf -don Linux): no absolute build path, only the relative rpath. Nothing asserted this.pyscriptc compile --embed-python=bundlewith a missing pack ended in a Python traceback; it now prints one line namingpyscriptc embed fetch(src/pyscriptc/cli.py:694).stage_bundlemoved the binary intobin/but left thepyscriptc-datatree beside the old binary path, so a relocated bundle died withFileNotFoundErroron the data file. Fixed insrc/pyscriptc/embed.py:443.#662, CI jobs, caches and runner cost budget
Already met before this PR:
ubuntu-24.04and macOS arm64 onmacos-14,.github/workflows/embed.yml:52..github/workflows/embed.yml:78(the grep over the changed files).scheduleat.github/workflows/embed.yml:30and thepush/schedule/always_runcases in the gate step,.github/workflows/embed.yml:74..github/workflows/embed.yml:113, with the prefix fallback at.github/workflows/embed.yml:114.EMBED_PR_SKIP_MACOSswitch, which was already read by the gate step at.github/workflows/embed.yml:69.Missing, and implemented here:
.github/workflows/embed.yml:133before this PR). It now runs the full embed: empty-environment acceptance test on macOS arm64 and Linux x86_64 #661 matrix on both cells: three programs, relocated, with the pack cache moved away and the source fixtures renamed away, run underenv -iand compared with CPython's stdout, stderr and exit code, plus the loader and size-gate assertions.What changed
src/pyscriptc/embed.py: the stagedpyscriptc-datatree moves intobin/with the binary, so a relocated bundle finds its data files; the "fetching the runtime pack" notice is skipped whenPYSC_RUNTIME_DIRalready holds a pack.src/pyscriptc/cli.py:embed.EmbedErrorandsitedeps.SiteErrorare caught at the CLI boundary and printed as one line without a traceback.tests/test_embed_acceptance.py(new): the acceptance matrix, the loader assertions, the size gates and the pack-less refusal.tests/fixtures/embed/island_dependency.py(new) andtests/fixtures/embed/datafile/(new): the two acceptance programs.pathspecmoved into the dev group inpyproject.tomlso the compiler interpreter can stage it..github/workflows/embed.yml: the acceptance step runs the full matrix on both cells; the header documents the nightly-versus-per-PR split and the runner-minute budget.tests/test_census_self.py: the self-host fence pin moves with the code (3204 to 3177).No existing check was weakened.
Tests
Real output of the targeted runs on this machine (macOS arm64,
uv run pytest -n 2on the targeted files only, not the full suite):The CI acceptance step was also run verbatim on this machine (macOS arm64), with the matrix expressions resolved to
macos-14:The bundle size measured locally is 36372 KB (36.4 MB), under the 40 MB macOS gate.
Required checks
embed acceptance (ubuntu-24.04)embed acceptance (macos-14)Both are path-filtered on pull requests and run unconditionally on the nightly schedule, on pushes to master and in the release rehearsal (
workflow_dispatchwithalways_run=true).Not done here
docker infofailed), and the container is aarch64-only, so the Linux run is established by the CI cell, not locally.benchmarks/compat2/probes/IR_HASHES.jsonwas not regenerated (macOS rule); no rebase conflict touchedcompat/data, so the generators were not run either.