fix(jupyter): emit Quarto-canonical cells so captures splice into previews (bd-gthycd33)#360
Merged
Merged
Conversation
…ice into previews (bd-gthycd33) Jupyter's post-engine markdown lacked the Div.cell wrapper that CaptureSpliceStage and the Bootstrap cell CSS key on, so executed output never spliced into hub-client/q2-preview (knitr worked). Emit the knitr/Q1-parity shape, retire the divergent test-only AST path (JupyterTransform/outputs_to_blocks), and pin the contract with a splice regression pair + a 5-case cross-engine output-parity suite. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
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.
Summary
Fixes bd-gthycd33: executed jupyter output never spliced into the hub-client /
q2 previewpreview (the{python}cell kept rendering as raw source), while the identical knitr flow worked.Root cause. The jupyter engine emitted executed cells as bare fences (
```pythonecho +```{.cell-output}), with no::: {.cell}wrapper.derive_cell_outputs(capture splice) requires each engine cell to map to aDiv.cellin the post-engine markdown, so the cell-output map came out empty and the splice fail-softed to raw source. The Bootstrap CSS (.cell .cell-output-* pre code) never matched jupyter output either.Fix (emission-side).
text_execute.rsnow emits the knitr/Q1-parity shape:::: {.cell}wrapper,{.python .cell-code}echo fence,::: {.cell-output .cell-output-{stdout,stderr,display,error}}divs (Q1'soutputTypeCssClassscheme), and Q1-rule fence sizing (max(3, longest leading backtick run + 1)— fixes latent markdown corruption for backtick-bearing content). Also: array-form mime text (nbformat multiline) is no longer silently dropped, and a cell without a preceding blank line can't glue its div fence onto the paragraph.Structural anti-regression. The test-only parallel AST emitter (
JupyterTransform/outputs_to_blocks) is retired — no production consumer; one emission path remains. Two new fences pin the contract:capture_splice_engines.rs— regression pair driving the real engines throughrecord_captureand the exact splice path (jupyter failed with an empty map before this fix; knitr is the control).engine_output_parity.rs— 5 cross-engine shape-parity cases (stream, expression value, error under#| error: true, source-only, dependent cells); block-kind + semantic-class tree equality; runtime-gated on both engines being installed.Verification. Workspace suite 10181 passed; full
cargo xtask verifypassed; clippy/lint/fmt clean. E2E:q2 renderHTML inspected (div.cell,5in.cell-output-display);q2 previewin a real browser after the full WASM chain rebuild shows the spliced capture (5+ stream output in the iframe DOM) — the originally-failing surface.Follow-ups filed (discovered-from bd-gthycd33): bd-ohvl879u (error-policy divergence: jupyter embeds cell errors and continues where knitr fails the render), bd-2me3cslx (pre-existing broken
#[ignore]d full-pipeline tests — nested tokio runtime, reproduced at baseline), bd-u996g8g2 (inline{python} expr), bd-5t6wvu7m (real image outputs), bd-vs7sa0qx (execution_countattrs).Plan with full evidence:
claude-notes/plans/2026-07-01-bd-gthycd33-jupyter-cell-wrapper.md.🤖 Generated with Claude Code