Repository navigation
feat(ts)!: name the runtime's namespace rs - #578
Conversation
Quest-Claim: 8a39ad44aa08ce6b
Translated code imports the runtime as `rs` from `rs.ts`, and its modules live in `runtime/rs/`. std's own `fmt::rt` and `rt::begin_panic` keep their names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
quest land watch: the merge queue removed this pull request at 5f12b17 because it conflicts with The land fixer works on it in the background, and the watcher re-enqueues it at the back of the queue once it is fixed or judged flaky, or hands it back here with what it needs. (written by quest land watch) |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
|
quest land watch: armed auto-merge on this pull request at ee034da, so it joins the back of the merge queue once its required checks pass, with the land fixer's fix ( (written by quest land watch) |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes: verified end-to-end that the PR's claim of a purely mechanical rt→rs rename holds, not by inspection: I re-extracted the base tree (5ad8ee2, ts/ + quest/), applied the PR's own rename script from the body into a scratch copy, normalized the $hash instance-suffixes that legitimately change (instance names hash printed text containing the namespace), and diff -red the whole ts/ tree against the head. The result: zero non-rename deltas.
- Runtime files renamed:
ts/runtime/rt.tsandts/runtime/rt/becomers.ts/rs/;program.rs'sRUNTIMEtable, each module's references, and the runtime's own imports update in lockstep. - Driver internals renamed:
Expr::Rt→Rs,Type::Rt→Rs,Expr::rt/Expr::rt_of→rs/rs_of,uses_rt→uses_rs; the emitted import isimport * as rs from "./rs.ts". - Collisions flip:
rsis reserved in module scope (ts/src/program.rs), in locals (ts/src/print.rs), and inRESERVED(ts/src/lower/mod.rs);rtis freed. The bind fixture'sRS/held.tsrefusal now reads "RS/held.ts would replace the runtime, rs.ts and rs/". - std untouched as promised: the only remaining word-token
rtints/isfmt::rt::Argument(ts/runtime/rs.rsdoc comment) and("rt", "begin_panic")/["fmt", "rt", "Argument"]ints/src/lower/library.rs:358/1033/2892. - Quests bookkeeping:
quest/m3/ts-rs-rename.mddeleted as complete, its bullet dropped fromquest/m3/README.md, and the stalert.*references in the m2/m3 TS quests updated.
Checks this run:
cargo test --locked --test fixturesints/: all 86 tests pass locally. CI (Queue) had not started at review time, so the merge queue will re-prove it.- The codec fixture's differential harness: 33139 cases, 0 panics, 0 aborts, 0 differences (first run failed only on
bun/esbuildmissing from the ephemeral shell; installing them fixed it). - Repo-wide grep: no stale
import * as rt,./rt.ts, orruntime/rtreferences anywhere outsidets/(theffi/andgo/hits are those projects' own unrelatedrtruntimes; remainingts/hits are substrings likesort.ts).
glm-5.3-flash | 𝕏
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Problem
rust2-ts's runtime was imported and named
rt. The maintainer decided on 2026-11-03 to name itrs, so a translated Rust type reads asrs.Vec,rs.HashMap,rs.u64. Completes quest/m3/ts-rs-rename.md.Approach
A purely mechanical rename, by the script below, over
ts/and the TS quests (quest/*ts-*):ts/runtime/rt.tsandts/runtime/rt/move tots/runtime/rs.tsandts/runtime/rs/.rt,Rt,RTtoken becomesrs,Rs,RS: the emittedimport * as rs from "./rs.ts",Expr::rs/Expr::Rs/Type::Rs/rs_of/uses_rsin the driver, the runtime's own imports, tests, bench, README, quest text, and the bind fixture'sRS/held.tsrefusal.rtmodule keeps its name:fmt::rt::Argumentandrt::begin_panic(ts/src/lower/library.rs).UPDATE_EXPECT=1.Re-applying after merging main
Open TS PRs (#573, #574, the rs.Slice and B-tree quests) merge main, then run this from the repo root and regenerate snapshots (
UPDATE_EXPECT=1 just ts test). It is idempotent, and moves any file a PR added underts/runtime/rt/:Afterwards
git grep -nwP 'rt|Rt|RT' -- tsshould list only the three std paths above.Proof: name only
just ts moqat the pin, before and after): identical once each side's namespace is replaced by a placeholder and the$hashinstance suffixes are renumbered by first appearance. Those suffixes hash each instance's printed text (ts/src/program.rsname_by_text), which contains the namespace, so they change with it; renumbering consistently across both trees shows a one-to-one mapping. Source maps'sourcesandsourcesContentare byte-identical.ts/fixturesonmainagainst this branch differs only on lines that already saidrs("rs"intuples, moq'srs/source paths), which the normalizer itself rewrote.Collisions
rskeeps every guaranteerthad: it is reserved in the module scope (ts/src/program.rs), in each function's locals (ts/src/print.rs), and inRESERVED(ts/src/lower/mod.rs); a top-level module namedrsand a binding underrs/are refused. Verified ad hoc on a scratch crate:pub fn rsprints asrs_, a localrslive across a loop asrs_, andpub mod rsfails with "a top-level module namedrswould replace the runtime, rs.ts and rs/". The existing case-insensitive binding test (ts/fixtures/bind, nowRS/held.ts) carries over; no test existed for the other cases, and none is added so the PR stays mechanical. Neither moq's crates nor main's output had anyrsidentifier before.Impact
rsfrom./rs.ts, with its modules inrs/; everyrt.Xis nowrs.X. Hand-written callers of translated code changeimport * as rt from "./rt.ts"toimport * as rs from "./rs.ts".rt, and may not be namedrs.Alternatives
Follow-ups
None.
Review
mechanical fix by codex / Codex:
Merged base, preserved the rt-to-rs rename and base panic-site additions, and regenerated snapshots; passed in ts/ with pinned nightly: cargo build --locked -p rust2-ts; UPDATE_EXPECT=1 cargo test --locked -p rust2-ts --test fixtures lang::panics -- --exact; cargo test --locked -p rust2-ts (104 tests); cargo clippy --locked -p rust2-ts --all-targets -- -D warnings; cargo fmt --all --check; tsc -p runtime.(head ee034da)quest review --base origin/main), round 1 on12834f4978a27f6063aa8e1ab285963e5ecf093f: 0 findings.5f12b1794since adds only a conflict-free merge oforigin/main(perf(ffi): call the extension's Python methods with no wrapper frame #575, ffi only), on which the script is a no-op.just cipassed on both heads;just ts moqpassed.🤖 Generated with Claude Code