• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

source-academy / py-slang / 30146828914
86%

Build:
DEFAULT BRANCH: main
Ran 25 Jul 2026 06:20AM UTC
Jobs 1
Files 116
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

25 Jul 2026 06:03AM UTC coverage: 86.125% (-0.01%) from 86.137%
30146828914

push

github

web-flow
py2js: report set_timeout/clear_all_timeout as pending work to the conductor (#337)

Fixes source-academy/py-slang#329: set_timeout(f, x) fired reliably
under ~46ms, was unreliable right at that boundary, and silently never
fired at 50ms+. Root cause traced to the host (Source Academy's
frontend): BasicEvaluator.startEvaluator reports RunnerStatus.STOPPED
the instant evaluateChunk()'s promise resolves, with no way to know a
real setTimeout is still scheduled inside the runtime -- the frontend
treats STOPPED as "safe to tear down", killing the Worker (and any
pending timer in it) ~50ms later regardless.

Wires Py2JsRuntime's set_timeout/clear_all_timeout to a new
onPendingWorkChange hook (+1 when scheduled, -1 once the callback
settles or is cancelled), threaded through Py2JsSession and
Py2JsEvaluator.ts into BasicEvaluator's own beginPendingWork()/
endPendingWork() -- see source-academy/conductor#52, which makes
startEvaluator withhold STOPPED until pending work reaches zero.

Depends on source-academy/conductor#52 landing and publishing before
this compiles: Py2JsEvaluatorBase.beginPendingWork/endPendingWork don't
exist on the currently-published @sourceacademy/conductor, so tsc and
CI are expected to fail until that PR merges and this branch's
@sourceacademy/conductor dependency is bumped to the new version.
Opening now as a draft, to keep the two PRs linked and the work
visible while conductor's review is in progress -- not yet mergeable.

Verified against a local build of conductor's fix (temporary portal:
dependency, reverted before this commit -- not part of the diff): 3
Jest tests exercising schedule/fire, clear_all_timeout cancellation,
and a self-rescheduling chain all passed against the real
Py2JsSession/Py2JsRuntime wiring. Will re-verify for real, end-to-end,
once conductor publishes and the dependency bump lands here.


Claude-Session: https://claude.ai/code/session_01KrwJGug3rCXijRseRjys9V

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>

4405 of 5506 branches covered (80.0%)

Branch coverage included in aggregate %.

10 of 11 new or added lines in 3 files covered. (90.91%)

9549 of 10696 relevant lines covered (89.28%)

178276.96 hits per line

Uncovered Changes

Lines Coverage ∆ File
1
80.77
-10.54% src/conductor/Py2JsEvaluator.ts
Jobs
ID Job ID Ran Files Coverage
1 30146828914.1 25 Jul 2026 06:20AM UTC 116
86.13
GitHub Action Run
Source Files on build 30146828914
  • Tree
  • List 116
  • Changed 3
  • Source Changed 3
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #30146828914
  • 8dd3ea6c on github
  • Prev Build on main (#30144900029)
  • Next Build on main (#30148900505)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc