Title: Refresh embedded RapydScript-NG (0.7.22 → upstream 0.8.7+) · Issue #217 · vpython/glowscript · GitHub
Open Graph Title: Refresh embedded RapydScript-NG (0.7.22 → upstream 0.8.7+) · Issue #217 · vpython/glowscript
X Title: Refresh embedded RapydScript-NG (0.7.22 → upstream 0.8.7+) · Issue #217 · vpython/glowscript
Description: GlowScript embeds RapydScript-NG 0.7.22. The build's rs_commit_sha is 6dc47bb, which isn't in upstream's history, so it was probably built from a fork. Upstream (kovidgoyal/rapydscript-ng) is at 0.8.7, and since then has merged: 30626e5 ...
Open Graph Description: GlowScript embeds RapydScript-NG 0.7.22. The build's rs_commit_sha is 6dc47bb, which isn't in upstream's history, so it was probably built from a fork. Upstream (kovidgoyal/rapydscript-ng) is at 0....
X Description: GlowScript embeds RapydScript-NG 0.7.22. The build's rs_commit_sha is 6dc47bb, which isn't in upstream's history, so it was probably built from a fork. Upstream (kovidgoyal/rapydscript-...
Opengraph URL: https://github.com/vpython/glowscript/issues/217
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Refresh embedded RapydScript-NG (0.7.22 → upstream 0.8.7+)","articleBody":"GlowScript embeds RapydScript-NG **0.7.22**. The build's `rs_commit_sha` is `6dc47bb`, which isn't in upstream's history, so it was probably built from a fork. Upstream (kovidgoyal/rapydscript-ng) is at **0.8.7**, and since then has merged:\n\n- `30626e5` (#193): randint fixed for negative ranges. We carry this as #215 / `b8a6fa1`.\n- `165020b`: randint now raises `TypeError` for non-integers and `ValueError` when `b \u003c a`, as Python does.\n- `67b56d2`: `randrange()` fixed for ranges larger than 2**31. **We still have this bug.**\n\nThis issue tracks refreshing to current upstream instead of patching one function at a time.\n\n## Who consumes this compiler\n\nThree deployments, two copies:\n\n| Site | Compiler copy | Notes |\n|---|---|---|\n| glowscript.org | `lib/rapydscript/compiler.js` + `package/RScompiler.3.2.min.js` here | also `GlowScriptOffline/` |\n| webvpython.org | vpython/rsWVPRunner (`gs://rswvprunner`) | flaskHost sends every non-`wasm` program to this runner |\n| trinket (Web VPython 3.2.3) | the same rsWVPRunner build | sha256-pinned in trinket's Dockerfile (`RSCOMPILER_SHA256`, `GLOWSCRIPT_PACKAGE_BUILD`) |\n\nrsWVPRunner's `lib/rapydscript/compiler.js` and `lib/compiling/GScompiler.js` are byte-identical to the copies here, so a refresh lands here first and then gets copied over. After that: rebuild rsWVPRunner's package, redeploy, and update trinket's pins (a picup PR).\n\n## What a refresh involves\n\nThe procedure is in the build notes in `lib/compiling/GScompiler.js`. Upstream builds don't include GlowScript's own changes, so each has to be reapplied:\n\n- `vec == vec` / `vec != vec` in `ρσ_equals` / `ρσ_not_equals` (compiler.js ×2 each, runtime.js ×1 each)\n- `.pop` → `.pypop` renames (GScompiler.js rewrites user `.pop` calls)\n- the randrange replacement (possibly obsolete now that upstream has it)\n- anything else carried in the 0.7.22 build that isn't in those notes. Diffing our compiler.js against a clean upstream 0.7.22 build will show this, and that diff should be done first.\n\n## Decisions to make\n\n1. **randint and randrange raising errors.** Matching Python means `randint(0, n/2)` with an odd `n` raises an error where it used to return a value silently. That's more correct, but it can break existing student programs. Options: take it as is, take it with a deprecation period, or keep our one-line version.\n2. **0.7 → 0.8 changes in general.** Review upstream's changelog between 0.7.22 and 0.8.7 for language and runtime changes that affect VPython programs.\n\n## Testing plan\n\n- Compile and run the Demos (and `GlowScriptOffline/Demos`) with the old and new compilers, and compare output and errors.\n- Run randint/randrange histograms over negative, mixed-sign, single-value and > 2**31 ranges. The harness used for #215 drives GlowScriptOffline with Playwright.\n- Before glowscript.org, test on rsWVPRunner with a webvpython.org staging host and on trinket's two trials.\n\nUntil the refresh is done, we could port the randrange > 2**31 fix (`67b56d2`) the same way #215 ported randint.\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n","author":{"url":"https://github.com/sspickle","@type":"Person","name":"sspickle"},"datePublished":"2026-10-31T11:45:22Z","url":"https://github.com/vpython/glowscript/issues/217"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:17019b1d-f436-0ed5-0990-0ac29a5bf07c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A4E6:A4C06:5840AD:7B9449:6B0077BC |
| html-safe-nonce | 53175f792a3c59ca6feac4e109d20c2c6bc0028562a885cdd59508395d84e76b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNEU2OkE0QzA2OjU4NDBBRDo3Qjk0NDk6NkIwMDc3QkMiLCJ2aXNpdG9yX2lkIjoiMjgxODQ2MjMxMTgzOTQ3NzA4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | aa64739e4f0d7e07cf107e61a01c8a2c54651dac9ecc706e683aee5b93795951 |
| hovercard-subject-tag | issue:6134420575 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/vpython/glowscript/217/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e9e8bcf509d80bce3f68f0ae7a4ea6e7c46382454a4688c76e8676d2933adc7f/vpython/glowscript/issues/217 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e9e8bcf509d80bce3f68f0ae7a4ea6e7c46382454a4688c76e8676d2933adc7f/vpython/glowscript/issues/217 |
| og:image:alt | GlowScript embeds RapydScript-NG 0.7.22. The build's rs_commit_sha is 6dc47bb, which isn't in upstream's history, so it was probably built from a fork. Upstream (kovidgoyal/rapydscript-ng) is at 0.... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sspickle |
| hostname | github.com |
| expected-hostname | github.com |
| None | 75c2b65dd205f26961d0c29afed1a8d0bb7cca9f05780571dfd1ef93eb539d16 |
| turbo-cache-control | no-preview |
| go-import | github.com/vpython/glowscript git https://github.com/vpython/glowscript.git |
| octolytics-dimension-user_id | 1280757 |
| octolytics-dimension-user_login | vpython |
| octolytics-dimension-repository_id | 187905631 |
| octolytics-dimension-repository_nwo | vpython/glowscript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 187905631 |
| octolytics-dimension-repository_network_root_nwo | vpython/glowscript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 84e563eb4b55f8fa102f325f117533cee9e3df4a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width