Skip to content

Use pre-fixed jigsaw_v2 HTML and expand test coverage#385

Merged
blink1073 merged 2 commits intoCalysto:mainfrom
blink1073:update-jigsaw-html
Mar 15, 2026
Merged

Use pre-fixed jigsaw_v2 HTML and expand test coverage#385
blink1073 merged 2 commits intoCalysto:mainfrom
blink1073:update-jigsaw-html

Conversation

@blink1073
Copy link
Copy Markdown
Contributor

@blink1073 blink1073 commented Mar 15, 2026

References

Follow up to #375

Description

Moves the cross-origin postMessage fixes out of jigsaw_magic.py and into the upstream HTML source files (now served from calysto.github.io/jigsaw_v2/). The magic no longer needs to patch downloaded HTML at runtime — it only fills in the window.__jigsaw_saved_xml__ placeholder that is already baked into the v2 files.

Changes

  • Remove _fix_cross_origin() function from jigsaw_magic.py (~127 lines)
  • Update download URL from jigsaw/ to jigsaw_v2/
  • Replace _fix_cross_origin() call with a single targeted string replacement for the saved-XML placeholder
  • Delete scripts/reproduce_196.py (referenced the now-removed function)
  • Parametrize jigsaw tests across all three languages: Processing, Python, Test
  • Add test_jigsaw_html_content to assert postMessage helpers are present and no window.parent property assignments remain
  • Switch all test file output to pytest tmp_path (no files written to the repo directory)
  • Remove manual teardown() function

Backwards-incompatible changes

None

Testing

just test tests/magics/test_jigsaw_magic.py — 10/10 tests pass across all three languages.

AI usage

  • Some or all of the content of this PR was generated by AI.
  • The human author has carefully reviewed this PR and run this code.
  • AI tools and models used: Claude Sonnet 4.6 (Claude Code)

Moves the cross-origin postMessage fixes out of the magic and into the
upstream HTML files (calysto.github.io/jigsaw_v2), so no runtime patching
is needed. Expands tests to cover all three languages and write to tmp_path.
Use pathlib.Path (not pytest.TempPathFactory) for tmp_path fixture annotation.
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.79%. Comparing base (47b7214) to head (b57d490).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #385      +/-   ##
==========================================
- Coverage   90.86%   90.79%   -0.08%     
==========================================
  Files          51       51              
  Lines        2957     2943      -14     
  Branches      414      414              
==========================================
- Hits         2687     2672      -15     
  Misses        190      190              
- Partials       80       81       +1     
Files with missing lines Coverage Δ
metakernel/magics/jigsaw_magic.py 79.59% <100.00%> (-6.13%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@blink1073 blink1073 merged commit 1edfb6f into Calysto:main Mar 15, 2026
27 checks passed
@blink1073 blink1073 deleted the update-jigsaw-html branch March 15, 2026 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant