Skip cells marked disabled when building the execute-cells request (#154)#603
Conversation
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
c769c4b to
f63bc4e
Compare
…cells request Cells authored as `@app.cell(disabled=True)` were executed by the VS Code extension, even though marimo's own frontend respects the flag. `extractExecuteCodeRequest` assembles the execute-cells request for both the notebook and sandbox controllers, but its loop only skipped cells without a stable id -- it never consulted the disabled config, which does survive the pipeline as `metadata.options.disabled`. - Add an `isDisabled` getter on MarimoNotebookCell (`metadata.options.disabled`), mirroring the existing `isStale` getter. - Skip disabled cells in `extractExecuteCodeRequest`, fixing both call sites at the single choke point. - Return `Option.none()` from the empty-codes branch (it previously called `Option.none()` without returning), so a selection of only disabled cells no longer produces an empty execute request. Covered by a regression test and an only-disabled edge-case test in `extractExecuteCodeRequest.test.ts`. Closes marimo-team#154
f63bc4e to
cf5a2c7
Compare
|
Hi @manzt — opening this for #154 (disabled cells executing in the extension) as a first contribution. I traced it to One open question in the description: would you prefer this enforced at the extension layer (where I put it) or the LSP server layer? I didn't find a PR template or a PR-format note in CONTRIBUTING.md — happy to follow any convention you'd like. Thanks for taking a look! |
manzt
left a comment
There was a problem hiding this comment.
Sorry, I've been out on jury duty. I think this fix looks great.
In a follow up, we probably want some to reflect the disabled nature of the cells in the UI (and allow for enabling/disabling) but that can be a follow up.
Why
Cells authored as
@app.cell(disabled=True)are executed by the VS Code extension, even though marimo's own frontend respects the flag. @manzt confirmed in #154 that disabled cells "aren't currently supported" in the extension and welcomed a contribution.Root cause:
extension/src/lib/extractExecuteCodeRequest.tsassembles theexecute-cellsrequest for both execution paths (NotebookControllerFactoryandSandboxController), but its loop only skips cells without a stable id — it never consults the disabled config. The flag does survive the pipeline (marimo file → LSP deserialize →NotebookSerializer→ cellmetadata.options.disabled); I confirmed the wire format by running the server's own deserialize path, where a disabled cell arrives asoptions: { "disabled": true }.What
isDisabledgetter onMarimoNotebookCell(metadata.options?.disabled === true), mirroring the existingisStalegetter. No schema change —CellMetadataalready typesoptionsasRecord<string, unknown>.extractExecuteCodeRequest, fixing both call sites at the single choke point (rather than per-call-site, which would let a future call site silently reintroduce the bug).if (codes.length === 0)branch calledOption.none()withoutreturning, so a selection of only-disabled cells would have sent an emptyexecute-cellsrequest. It now returnsOption.none(), which the controller already handles by stopping ("Empty execution request").Evidence
extension/src/lib/__tests__/extractExecuteCodeRequest.test.ts(4 tests):excludes cells disabled via @app.cell(disabled=True) (issue #154)— fails before (expected [...'cell-disabled'] to not include 'cell-disabled'), passes after.returns none when every selected cell is disabled— covers the empty-request branch.Full
just test-tsgreen (466 passed / 1 skipped, +4 from this PR),just lint(ruff +ty+ TS) clean,just test-vscodeintegration suite green.Manual (F5): in the Extension Development Host, a notebook with a normal cell and a
@app.cell(disabled=True)cell, run all → the disabled cell produces no output while the enabled cell runs. Matches marimo's own frontend.Issues
Closes #154.
Open question
Enforce at the extension layer (where the request is assembled, as here) or the LSP server layer? I chose the extension layer since that's where the request is built and this was framed as a missing extension feature — happy to move it if you'd prefer the server side.
Checklist
just test-tsandjust lintpass locallyjust test-vscodeintegration suite passes