Repository navigation
fix: keep the playground's portable IDE rules free of the citry package - #389
Merged
Merged
Conversation
The docs playground's analysis Worker installs citry-core in Pyodide, writes `portable_ide.py` (generated from `citry/_portable_ide.py`) as the module `citry_portable_ide`, and imports it. The `citry` package is not installed there. #377 made `_portable_ide.py` import `citry._walk`, so a rebuilt copy would fail with ModuleNotFoundError and leave the editor without analysis. The committed copy had not been rebuilt, which the fast gate reports as stale. - `_portable_ide.py` walks nested templates with a plain list of iterators instead of `citry._walk`. It still uses a fixed number of Python frames however deep the templates nest, and records tags in the same order. Its docstring states the import rule and why. - `docs_site/static/playground/portable_ide.py` is rebuilt from it. - `analysis_adapter.py` imports `citry_portable_ide` only. It used to fall back to `citry._portable_ide`, so the docs tests ran the source rather than the generated copy and could not see this break. - The docs tests load the generated copy as the Worker does: the adapter fixture installs it as `citry_portable_ide`, and a new test loads it in a subprocess with `citry` blocked, then runs it and the adapter. That test fails with a copy built from `main`'s source. Co-Authored-By: Claude Opus 5.5 <[email protected]>
JuroOravec
added a commit
that referenced
this pull request
Oct 25, 2026
The minor and patch updates change what esbuild bundles into playground.js and live_code_runtime.js, so docs-check reported both as stale. Rebuilt with `pnpm --dir docs_site/_internal/frontend build` on top of main, which already carries the current portable_ide.py (#389). Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Supersedes #388. The fast gate reports the playground's copy of the portable IDE rules as stale. Rebuilding it as it stands would break the playground's editor analysis, so this PR fixes the source first.
What was wrong
docs_site/_internal/frontend/src/analysis_worker.js). The Worker installs onlycitry-corein Pyodide, writesdocs_site/static/playground/portable_ide.pyas the modulecitry_portable_ide, imports it, then runsanalysis_adapter.py. Thecitrypackage is never installed there.packages/py/citry/citry/_portable_ide.py, the source of that copy, importcitry._walk. A rebuilt copy then fails withModuleNotFoundError: No module named 'citry._walk', and the editor shows no analysis.analysis_adapter.pyfell back tocitry._portable_idewhencitry_portable_idewas missing, so the docs tests ran the source instead of the generated copy.The change
_portable_ide.pywalks nested templates with a list of iterators instead ofcitry._walk. It still uses a fixed number of Python frames however deep the templates nest, and records tags in the same order. Its docstring now says it may import only the standard library andcitry_core, and why.docs_site/static/playground/portable_ide.pyis rebuilt withpnpm --dir docs_site/_internal/frontend build.analysis_adapter.pyimportscitry_portable_ideonly, as the Worker provides it.citry_portable_ide, so every adapter test runs the copy the browser runs.test_generated_portable_rules_load_without_the_citry_package, loads the copy in a subprocess withcitryblocked, runstemplate_tag_useson a nested template, and runs the adapter beside it.main's source (fix(docs): rebuild the playground's copy of the portable IDE helpers #388's file), the new test fails with the error above.Checks
docs_site/tests/test_playground_analysis.py(10 tests),test_analysis.pyandtest_check_depth_frames.py(54 tests) pass.pnpm --dir docs_site/_internal/frontend run check, the protocol Python copies, the VS Code bundle, the citry-ui assets andscripts/validate.pypass.No changelog entry: the docs site is not a published package.
🤖 Generated with Claude Code