Repository navigation
fix(async): support published modules across MoonBit channels - #534
Draft
tonyfettes wants to merge 14 commits into
Draft
tonyfettes wants to merge 14 commits into
tonyfettes wants to merge 14 commits into
Conversation
Pin CI and the publish workflow to MoonBit 0.10.21+f125caab5 (the pre-release channel; `latest` still ships 0.10.20, whose core/async has the old API) and migrate the workspace to the revised core/async API: - power_monitor: core/async/pipe is gone. The Linux completion pipe is now opened by a C stub (pipe(2), close-on-exec, nonblocking read end) and the read end is wrapped in @raw_fd.RawFdStream; the write end is still handed to the native watcher. A whitebox test covers the POSIX pipe and stream EOF. - http: connection-returning get is get_stream (updater, net download); one-shot get/post_binary/put_binary return MessageBody (net request, CDP discovery); flush is flush_partial_data. - fs extension: read_text lost sync_timestamp. The contract field is kept and still honored by reading through File and syncing it. - Read/write failures wrap their cause in TransportError; error details unwrap it so messages are unchanged. - socket Addr port is a UInt16 field (dev readiness probe rejects out-of-range ports); mkdir allow_exist is allow_existing; read_exactly_at is File::at(..).read_exactly; ReaderClosed is UnexpectedEof. - Platform is #non_exhaustive: shell raises ShellError for unknown platforms, config maps them to Linux. - Drop moonbitlang/core/json imports the new compiler reports unused. moon info regenerates derived from_json signatures (JsonPath -> DecodeContext); moon fmt adds trailing commas. Release notes (en/zh) record the toolchain requirement as unreleased. Validation (0.10.21+f125caab5, macOS arm64): - moon check --target native|js|wasm|wasm-gc --deny-warn - moon test --target native --no-parallelize (845 passed) - CI js/wasm test set (proton_client/rabbita/contract, codegen, package, cefsetup store) - moon -C examples build / moon -C e2e build --target native - node scripts/verify_generated.mjs; moon fmt --check; moon info clean
The isomorphic shared contract derives ToJson/FromJson without naming @JSON, and 0.10.21 rejects the import under --deny-warn. This PR merges only after 0.10.21 reaches stable, when template users are on it too.
Keep both Unreleased release-note entries: macOS occluded rendering from main and the MoonBit 0.10.21 toolchain requirement.
Windows CI rejected the Linux completion-pipe helpers and the core/async/types import as unused, because begin_watching had a separate Windows variant. Use one begin_watching on every platform: the pipe path stays gated at runtime on Linux, as it already was for macOS, and the descriptor stub has a HANDLE signature on Windows that the pipe path never reaches.
tonyfettes
marked this pull request as ready for review
November 13, 2026 06:49
tonyfettes
marked this pull request as draft
November 13, 2026 07:27
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OpenSeek's native host and several independently published Proton modules encounter removed async APIs on the pre-release toolchain. Keep all 24 published modules compatible with the current
latestandpre-releasechannels, without raising Proton's toolchain requirement or changing public APIs.The compatibility changes cover:
Create the power monitor's Linux completion pipe in C and wrap its read end with the shared
RawFdStreamAPI. Preserve the readiness/teardown protocol, close the original write descriptor on every exit, and protect read-descriptor ownership transfer from cancellation.Require the published
tonyfettes/xlog@0.5.1, whose explicit public method exports support the newer compiler. Its transitivemoonbitlang/x@0.5.7also builds onlatest; consumers can keep their existing lower xlog version requirements.Match the configuration platform with a fallback that works with both the old enum and the new non-exhaustive enum.
Use the shared
ClientConnectionrequest API for updater streaming, preserving encoded paths and queries, redirect limits, connection cleanup, and body-size limits. Adapt the two existing streaming test fixtures to the shared TCP API; no new tests are added.Keep the Mach-O scanner's positioned reads on the versioned
moonbitlang/async@0.22.7filesystem API. The two bundled core versions have different positioned-read APIs; the versioned dependency preserves bounded reads on native and Wasm. Adapt the existing fixture directory setup to the same API.Replace deprecated backslash escapes in interpolated NSIS templates with explicit character interpolation. Existing installer-script expectations remain unchanged.
Keep the CLI development server probe on the versioned
moonbitlang/async@0.22.7socket API, retaining hostname resolution and the existing port representation across both compiler channels.Use shared HTTP connection APIs in CDP discovery and network extensions, retaining streaming downloads and GET body behavior. Adapt three existing CDP transport tests to
Addr::to_string()instead of the changed port accessor.Preserve the filesystem extension's
sync_timestampoption using explicit open/read/sync/close operations.Handle the non-exhaustive platform enum in shell operations while retaining the existing behavior for Linux, macOS, and Windows.
CI and publication continue to use
latest. Public generated interfaces, templates, and release notes are unchanged from the base branch. Examples and E2E modules are outside the published-module compatibility scope; this does not claim a complete workspace migration.Validation on macOS arm64:
latest:moonc 0.10.20+65efd5b93.pre-release:moonc 0.10.21+cfd6c5d6c.proton/updater,proton/internal/logging,sys/power_monitor, andconfigpassed with the published xlog dependency.proton_packagenative and Wasm checks and executable builds passed; existing package tests passed 45/45 on native and 46/46 on Wasm, without updating expected outputs.moon check --target native,js,wasm,wasm-gcon both channels, using an external workspace listing the published modules and honoring their supported-target declarations. Pre-release reports 20 warnings (unused JSON imports and an existing deprecated conversion), but no errors.moon infoandmoon fmtcompleted with no public interface changes.latest, the full workspacemoon check --target native --deny-warnpassed;moon infoproduced no interface changes relative to the base;moon fmt --checkpassed.0978a3d48, using this Proton source through an isolated workspace override, passed native check and linked its application onlatestwithout consumer source changes.22ef281f3linked with this Proton source on current0.10.21+cfd6c5d6c, using the unmodified publishedxlog@0.5.1selected transitively by Proton. The validation copy still needs an independent two-line fix for the CDP host's removedhttp.get_textcall. That consumer fix is not included here; the unmodified pre-release consumer still fails on it.Linux watcher behavior, Windows runtime behavior, and GUI interaction were not exercised locally. The existing latest-channel CI covers the repository's platform checks; this PR does not claim that the entire Proton workspace builds on pre-release.