Repository navigation
Retire the Python REPL and test_runner; keep the LSP with evidence - #987
Merged
Merged
Conversation
This was referenced Sep 27, 2026
The module had no callers. ./flow test dispatches to flow-driver (compiler sweep) or flow.project_test_runner (project mode), and nothing in tests, CI or the drivers imports flow.test_runner.
flow repl now runs tools/repl/main.flow, built by the Stage-A driver on first use and cached in build/tools (or the user cache dir on a read-only install). Each line is wrapped in a program, compiled with flowc and cc, and run under a five second alarm, as before. The session transcript in tests/tools/repl/session.in produces the same bytes as the deleted src/flow/repl.py. One deliberate change: the expression is wrapped in parentheses, so an incomplete line such as '1 +' is a compile error instead of silently absorbing the printf call on the next generated line and printing an uninitialized value. tests/tools/run.sh runs the transcripts without Python.
README, the wiki and the one-hour tutorial document ./flow lsp, but the driver had no lsp case and printed the help text. It now runs the same server as the flow-lsp launcher.
New native-tools job builds flowc from the checked-in C and runs tests/tools/run.sh with python and python3 shadowed by failing stubs. The workflow now also triggers on tools/** and flow-driver, which previously changed without CI noticing.
A stale flowc build prints to stderr on the first run, which made the REPL transcript fail after a pull. stderr is now kept aside and shown when a case fails.
Drops src/flow/repl.py and src/flow/test_runner.py, plus two test files already deleted on main. Limit falls from 130042 to 128844 lines.
godofecht
force-pushed
the
port/retire-python-host-tools
branch
from
September 29, 2026 05:42
90bc88b to
3115091
Compare
godofecht
added a commit
that referenced
this pull request
Sep 29, 2026
./flow lsp is a new CLI command, and doc coverage failed with 'cli:lsp has no documented home'. It is listed in the command reference.
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.
What this does
Checks the claim that native Flow paths cover the LSP, the REPL and project tests, then retires the Python modules where that is now true.
src/flow/test_runner.py(237 lines)src/flow/repl.py(369 lines)flow replran itflow replrunstools/repl/main.flowsrc/flow/lsp_server.py(2,284 lines)REPL
tools/repl/main.flowis the REPL written in Flow, with shared string, buffer, file and process helpers intools/hostlib/text.flow.flow-driverbuilds it with the Stage-A driver on first use (flow_native_tool), caches the binary inbuild/tools(or~/.cache/flow/toolson a read-only install), and rebuilds when a Flow source it can import is newer.Each line is wrapped in a program with the session's structs, functions and variables, compiled with flowc and cc, and run under a five second
alarm, the same model as before.Transcript evidence:
tests/tools/repl/session.in(30 lines: help, let, float and int expressions, one-line and multi-line functions, struct,:vars,:funcs,:type, unknown command, redefinition,:clear, missing initializer,:quit) produces byte-identical output frompython3 -m flow.repland the Flow REPL:A second session with compile errors differs only in the C line numbers inside the cc error text. One deliberate change: the expression is wrapped in parentheses. Before,
1 +absorbed the generatedprintfon the next line and printed an uninitialized value (-129511928); now it is a compile error.tests/tools/run.shruns the transcripts. The new CI jobnative-toolsbuilds flowc from the checked-in C and runs them withpythonandpython3replaced by failing stubs. The workflow now also triggers ontools/**andflow-driver.LSP: kept, and why
There is no native LSP on main.
compiler/src/lsp_intel.flow,lsp_syntax.flow,lsp_dynamics.flow,lsp_ordering.flowandlsp_utils.floware helper ports; nothing serves JSON-RPC in Flow. Every editor path (flow-lspand the VS Code extension) runspython3 -m flow.lsp_server.Diagnostics and symbol extraction come from the Python parser and type checker. The Stage-A driver fails to parse 1,174 of the 1,725
.flowfiles underexamples/,lib/stdlib/andtests/lang/(all 1,054 proof files inexamples/verify, 109 other examples, 10 intests/lang,lib/stdlib/ui_layout.flow). A Flow server that took diagnostics from flowc would flag most of the repo as a syntax error, and flowc also reportssqrt/printfas unbound where the Python checker treats them as built-ins. Details in #693../flow lspis documented in README, the wiki and the one-hour tutorial but printed the help text. It now starts the server.Not changed
project_test_runner.pyis the realflow testrunner for projects and has no Flow port. Tracked in [Self-Hosting Phase 5] Port Test Runner, REPL, and Native CLI Executable #695.package.pyis owned by other work.docs/project/python-in-flow.mdanddocs/project/CHANGELOG.mdare not updated here. The prose hook blocks any commit to either file because of existing em dashes elsewhere in them. Intended edits for python-in-flow.md:lsp_server.pyrow says diagnostics, symbols and hover types come from the Python parser and type checker. Replacetest_runner.py, package.py, repl.pywithproject_test_runner.py, package.py.flow testin a project runspython3 -m flow.project_test_runner.flow replwithtools/repl/main.flowand the transcript test.tools/python_ratchet/baseline.txtis tightened with--updatein this PR.Issues
ptr<Struct>emits.instead of->(found while writing the host helpers).fdopen,strdup).