Skip to content

feat(ts): translate VecDeque::range, str::rsplit_once, and split_terminator - #434

Merged
moq-bot[bot] merged 6 commits into
mainfrom
quest/m2/ts-model/main-std
Nov 2, 2026
Merged

moq-bot[bot] merged 6 commits into
mainfrom
quest/m2/ts-model/main-std

Conversation

@kixelated

@kixelated kixelated commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Moving the translator's moq pin past moq's WASM removal added three std calls to moq-net's model that rust2-ts refused: VecDeque::range (model/group.rs), str::rsplit_once by a char (model/origin.rs), and str::split_terminator by a char (path/mod.rs).

Approach

Each maps as its siblings do, with no config:

  • VecDeque::range becomes rt.dequeRange, a DequeIter over the bounds slice::range checks, as drain reads them, so it panics as std's does and clones, reverses, and reports its length as iter's does. It splits the range into the two slices std's slice_ranges gives, as feat(ts): split a deque's slices where std's are, and translate their Debug #443 splits iter, so its Debug and try_fold match std's.
  • str::rsplit_once becomes rt.strRsplitOnce, the runtime Searcher's first match from the back, as split_once is its first from the front.
  • str::split_terminator becomes rt.strSplitTerminator, the runtime's Split with std's allow_trailing_empty unset: it skips an empty last part from either end exactly as SplitInternal::get_end and next_back do. Its clone is mapped as Split's.

Both str calls take any pattern, as split_once and split do.

Model census (ts/moq/model.toml, moq pin 4b8e37bd):

Refusals Function instances
Before (origin/main) 232 3,742
After 229 3,742

The three refusals named above are the only ones removed, and no refusals were added.

Tests: differential against native wasm32 in the lang fixture:

  • strs::strs reads split_terminator by a char from both ends, and rsplit_once by a char.
  • strs::slices takes rsplit_once by a &str, empty patterns included.
  • The new case collections::deque_ranges covers every form of range over a deque whose front wraps past its buffer's end. It reads from both ends, clones midway, and reverses, and writes the iterator's {:?} after each step, which shows its two slices. A mutant that keeps the range in one slice fails 55 cases.
  • Named cases in caller.ts cover:
    • empty text;
    • a separator alone, doubled, and at either end;
    • empty, full, and backwards ranges, and ranges past the end;
    • empty and wrapped deques.

I mutated each runtime change by hand (the trailing check at the front, the trailing check at the back, rsplit_once searching from the front, and range one short). The differential caught each one, with 7, 2, 18, and 174 differences.

Impact

  • The translator's output: these three calls translate where they were refused.
  • The runtime gains rt.dequeRange, rt.strRsplitOnce, and rt.strSplitTerminator. Nothing breaks.

Alternatives

  • Also mapping VecDeque::range_mut and the rest of str's searches here. I left them out to keep this PR to the model's calls; both are recorded as quests (below).

Follow-ups

  • New quest The rest of str's searches. A census probe found find, strip_prefix, strip_suffix, trim_matches, replace, rsplit, rsplit_terminator, splitn, rsplitn, split_inclusive, matches, rmatches, rmatch_indices, char_indices, lines, and split_whitespace all refused.
  • VecDeque::range_mut of items JS copies is still refused. I added it to The rest of a vector's methods.

Review

Codex gpt-6.1-sol, medium effort, via quest review --base origin/main, round 1 on head 0dd4034bc7b04e6539891459fcc10f60fd17f68d (merged with main through #451, range split as #443's iter): no findings. Head a5c28e15185202d7d24e7ae57407ed14d178342c adds only a conflict-free merge of main (#453).

🤖 Generated with Claude Code

kixelated and others added 2 commits November 2, 2026 03:32
…inator

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title The std calls moq's main added to the model feat(ts): translate VecDeque::range, str::rsplit_once, and split_terminator Nov 2, 2026
@kixelated
kixelated marked this pull request as ready for review November 2, 2026 12:25
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 48 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: de7a601c-78b3-40c0-950d-955fa9720f48
Commits

Reviewing files that changed from the base of the PR and between 9246218 and a5c28e1.

Files selected for processing: 17
  • quest/m2/ts-model/README.md
  • quest/m2/ts-model/main-std.md
  • quest/m3/README.md
  • quest/m3/ts-str-searches.md
  • quest/m3/ts-vec-rest.md
  • ts/fixtures/lang/caller.ts
  • ts/fixtures/lang/expected/collections.ts
  • ts/fixtures/lang/expected/harness.ts
  • ts/fixtures/lang/expected/strs.ts
  • ts/fixtures/lang/src/collections.rs
  • ts/fixtures/lang/src/harness.rs
  • ts/fixtures/lang/src/strs.rs
  • ts/runtime/rt/collections.ts
  • ts/runtime/rt/str.ts
  • ts/src/lower/collections.rs
  • ts/src/lower/iter.rs
  • ts/src/lower/library.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@moq-bot
moq-bot Bot disabled auto-merge November 2, 2026 17:43
@moq-bot
moq-bot Bot enabled auto-merge (squash) November 2, 2026 17:43
@moq-bot

moq-bot Bot commented Nov 2, 2026

Copy link
Copy Markdown

codex / Codex land fixer note:

Failure log line 1:

Conflicts with the base: ts/fixtures/lang/expected/harness.ts

A trial merge of base followed by snapshot regeneration preserved both collections::deque_ranges and fmt::objects. All 375 generated language snapshots matched. With the pinned nightly, cd ts && UPDATE_EXPECT=1 cargo test --locked --test fixtures lang -- --exact then failed:

709931 cases, 84614 panics, 125 aborts, 1 differences

The differing input was a6c09700bfff8568ff4f2c3440ff6311ffa818ff9f1fbf2ff710668f43bcffbade79a200e7ff0aff, selecting floats::mul_adds. The Rust and TypeScript outputs differ numerically; resolving that requires review beyond the permitted mechanical changes. This does not establish that this PR introduced the numeric implementation issue. Blame records the original merge conflict.

cargo test --locked --bin rust2-ts passed all seven tests; cargo fmt --all --check and tsc -p runtime also passed. The trial merge was aborted and the PR branch remains at its pinned head.

(written by codex / Codex)

@moq-bot
moq-bot Bot disabled auto-merge November 2, 2026 18:28
@moq-bot

moq-bot Bot commented Nov 2, 2026

Copy link
Copy Markdown

codex / Codex land fixer: After mechanically merging base and regenerating the harness, cd ts && UPDATE_EXPECT=1 cargo test --locked --test fixtures lang -- --exact failed: "709931 cases, 84614 panics, 125 aborts, 1 difference. Recommendation: Merge base and regenerate the language harness to preserve both fixture additions; investigate the floats::mul_adds numerical mismatch before retrying landing.

Conflicts with the base: ts/fixtures/lang/expected/harness.ts

(written by codex / Codex)

kixelated and others added 2 commits November 2, 2026 13:07
Split VecDeque::range's iterator into std's two slices, as #443 splits iter's,
and write its Debug in the deque_ranges differential.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	ts/fixtures/lang/expected/harness.ts
@kixelated
kixelated enabled auto-merge (squash) November 2, 2026 21:25
@moq-bot
moq-bot Bot disabled auto-merge November 2, 2026 21:32
@moq-bot

moq-bot Bot commented Nov 2, 2026

Copy link
Copy Markdown

quest land removed this pull request from the queue: its head moved from 0dd4034 to a5c28e1 after it was queued.

@kixelated
kixelated enabled auto-merge (squash) November 2, 2026 21:33
@moq-bot
moq-bot Bot merged commit 0d0596c into main Nov 2, 2026
1 check passed
@moq-bot
moq-bot Bot deleted the quest/m2/ts-model/main-std branch November 2, 2026 21:42
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