Skip to content

fix: replace moonbitlang/core/strconv with core/string - #32

Merged
oboard merged 1 commit into
oboard:mainfrom
bobzhang:fix/drop-core-strconv
Sep 6, 2026
Merged

fix: replace moonbitlang/core/strconv with core/string#32
oboard merged 1 commit into
oboard:mainfrom
bobzhang:fix/drop-core-strconv

Conversation

@bobzhang

@bobzhang bobzhang commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

moonbitlang/core 0.10.12 removed moonbitlang/core/strconv — only core/internal/strconv remains. Any module depending on mocket now fails package solving before a single file is compiled:

Error: Failed to calculate build plan
Caused by:
    0: Failed to solve package relationship
    1: Cannot find import 'moonbitlang/core/strconv' in oboard/mocket@0.9.1

I hit this from downstream — an example in rabbita that depends on mocket stopped resolving on the nightly toolchain.

core/string carries the same API on both 0.10.11 and 0.10.12, so this builds on current stable and nightly.

Changes

  • moon.pkg (root) imported core/strconv, but nothing in the package references @strconv — the import was dead. The package already imports core/string, so this is just a deletion.
  • benchmarks/mocket, benchmarks/mocket_middleware, examples/route each parse a port. They switch to @string.from_str, which is the same FromStr trait method exposed as a free function (#as_free_fn), so the call sites keep their inferred-type form:
-      let port : Int = @strconv.from_str(port_text) catch { _ => 3000 }
+      let port : Int = @string.from_str(port_text) catch { _ => 3000 }

7 files, +6/−7.

Verification

toolchain state moon check --target native
nightly v0.10.11+9de356786-nightly main exit 255Cannot find import 'moonbitlang/core/strconv'
nightly v0.10.11+9de356786-nightly this branch exit 0
stable v0.10.11+6ff76a5f9 this branch exit 0 (js and native)

moon test --target js,native on this branch: 105 passed (js), 100 passed (native).

Heads-up, unrelated to this PR

While running your CI steps locally on the current stable toolchain (moon 0.1.20260827 / moonc v0.10.11+6ff76a5f9), two of them fail on main itself, with this branch stashed:

  1. moon check --deny-warn — exit 255:
    internal/header/header.mbt:41:13
      let buf = StringBuilder::new()
      Warning (deprecated): Use `StringBuilder()` instead
    
  2. moon fmt + git diff --exit-code — the formatter rewrites a number of files (content_type.mbt, cookie.mbt, dispatch.mbt, middleware.mbt, mocket.js.mbt, …).

Your last green run was 2026-08-22, so I think the toolchain has moved since. I deliberately left both alone to keep this PR reviewable rather than burying a 7-line fix under unrelated reformatting — happy to send either as a separate PR if useful.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AmoyPMELemz5hdNNdXyAkm

`moonbitlang/core` 0.10.12 removed `moonbitlang/core/strconv`; only
`core/internal/strconv` remains. Any module that depends on mocket now
fails package solving before a single file is compiled:

    Cannot find import 'moonbitlang/core/strconv' in oboard/mocket@0.9.1

`core/string` carries the same API on both 0.10.11 and 0.10.12, so this
builds on the current stable toolchain and on nightly.

- root `moon.pkg` imported `core/strconv` but nothing in the package
  referenced `@strconv`; it already imports `core/string`. Dropped.
- the three packages that do parse a port switch to
  `@string.from_str`, which is the same `FromStr` trait method exposed
  as a free function, so the call sites keep their inferred-type form.

Verified with moonc v0.10.11+6ff76a5f9 (stable) and
v0.10.11+9de356786-nightly:

    before, nightly   moon check -> exit 255, cannot find core/strconv
    after,  nightly   moon check -> exit 0
    after,  stable    moon check js and native -> exit 0
    after,  stable    moon test js,native -> 105 and 100 passed

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmoyPMELemz5hdNNdXyAkm
@bobzhang

bobzhang commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

CI on this PR is red, but not because of anything it changes — it fails at step 6 of 10:

internal/header/header.mbt:41:13
  let buf = StringBuilder::new()
  Error Warning (deprecated): Use `StringBuilder()` instead

internal/header/header.mbt isn't touched here. And because moon check fails, steps 7–10 are skipped, so moon test never ran — this PR has no test signal at all through CI.

I confirmed it is pre-existing by stashing this branch and running the same gate against main alone: it fails identically.

I've opened #33 with the two fixes that restore green CI (the StringBuilder deprecation, and a moon fmt pass), kept separate so this stays a 7-line change. With #33 as the base, this PR's change passes all four gates locally — --deny-warn exit 0, fmt --check exit 0, 105 tests (js) and 100 (native).

So this should go green on a rebase once #33 lands, with no changes needed here. Ordering is the only dependency.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AmoyPMELemz5hdNNdXyAkm

@oboard
oboard merged commit 240587b into oboard:main Sep 6, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants