-
Notifications
You must be signed in to change notification settings - Fork 0
chore(deps): upgrade moonbitlang/async 0.19.1 → 0.19.4 #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,135 @@ | ||
| # Upgrade moonbitlang/async 0.19.1 -> 0.19.4 | ||
|
|
||
| ## Goal | ||
|
|
||
| Move every workspace module from `moonbitlang/async@0.19.1` to | ||
| `moonbitlang/async@0.19.4`, working around the Windows console-open regression | ||
| that the bump exposes, and confirm the upgrade is safe on all CI platforms | ||
| (notably windows-latest). | ||
|
|
||
| ## Status | ||
|
|
||
| In progress. Root cause of the windows-latest regression is identified and a | ||
| workaround is implemented (open the console devices directly instead of through | ||
| `@async/fs.open`). Pending windows-latest CI confirmation. | ||
|
|
||
| ## Context And Decisions | ||
|
|
||
| - The output write lock (TTY-23, | ||
| `docs/plans/2026-06-15-output-write-lock.md`) only needs `Semaphore`, which | ||
| exists in `0.19.1`, so it intentionally stayed on `0.19.1`. This task does the | ||
| dependency bump on its own so the two concerns stay reviewable in isolation. | ||
| - Bump all six manifests that pin async so the workspace resolves to a single | ||
| version and declared deps match what is actually used: | ||
| root, `tests`, `tests/isatty`, `tests/resize`, `tests/open`, `examples`. | ||
|
|
||
| ### Root cause of the windows-latest regression | ||
|
|
||
| - `Tty::open` on Windows opened `CONIN$` / `CONOUT$` through | ||
| `@async/fs.open(..., mode=ReadWrite)`. | ||
| - In async `0.19.2` (carried into `0.19.4`), the Windows file-open worker changed | ||
| how it detects the file kind. `0.19.1` used `GetFileType()` | ||
| (`moonbitlang_async_kind_of_fd`), which classifies a console as `CharDevice` | ||
| and always succeeds. `0.19.2+` instead calls `GetFileInformationByHandle()` | ||
| (then `kind_from_attr`) to also obtain `dev_id` / `file_id` for the new | ||
| `FileIdentity` / `fs.watch` feature. | ||
| - `GetFileInformationByHandle` is a disk-file API; it fails on console | ||
| (character) devices. On failure the open worker sets `job->err` and closes the | ||
| handle, so `@async/fs.open("CONIN$"/"CONOUT$")` now fails. That broke the | ||
| entire Windows `Tty::open` path and showed up as the `tests/open` pty test | ||
| failing on windows-latest. | ||
| - The regression is upstream and was introduced in `0.19.2`, not `0.19.4`. | ||
|
|
||
| ### Workaround | ||
|
|
||
| - `CONIN$` / `CONOUT$` are console devices, not filesystem files, so they should | ||
| not go through `@async/fs.open`. Open them directly with `CreateFileW` | ||
| (synchronous, non-overlapped) in `tty_open.c`, then wrap each handle with | ||
| `@async/raw_fd.RawFdStream`. `RawFdStream` detects the kind with `GetFileType` | ||
| (`CharDevice`) and never registers the handle for overlapped IO | ||
| (`is_async=false`), which exactly reproduces the working `0.19.1` console | ||
| read/write path. | ||
| - Unify the controlling-terminal handling: the unix path previously hand-rolled | ||
| a `ControllingTerminal` struct around `@async/raw_fd.RawFd` with six manual | ||
| trait impls. `RawFdStream` provides the same buffered `@io.Reader`/`@io.Writer` | ||
| behavior, so `ControllingTerminal` is removed and both platforms now wrap their | ||
| terminal fd in `RawFdStream`. The unix change is exercised by the pty-backed | ||
| `Tty::open` test on macOS/Linux. | ||
|
|
||
| ## Target Files | ||
|
|
||
| - `moon.mod`, `tests/moon.mod`, `tests/isatty/moon.mod`, | ||
| `tests/resize/moon.mod`, `tests/open/moon.mod`, `examples/moon.mod` | ||
| - `tty_open.c` (Windows `CONIN$` / `CONOUT$` open + handle-valid helper) | ||
| - `tty_win32.mbt` (new: Windows `Tty::open` via `RawFdStream`) | ||
| - `tty_unix.mbt` (drop `ControllingTerminal`; open `/dev/tty` and wrap in | ||
| `RawFdStream`) | ||
| - `io.mbt` (`Reader` / `Writer` impls for `RawFdStream`) | ||
| - `isatty.mbt` (`Fd` impl for `RawFdStream`) | ||
| - `docs/plan.md` | ||
| - generated `.mbti` files from `moon info` | ||
|
|
||
| ## Public API Changes | ||
|
|
||
| - New public impls on all platforms: `Fd`, `Reader`, and `Writer` for | ||
| `@async/raw_fd.RawFdStream`. This lets raw fd streams be used with `Tty::new` | ||
| the same way `@async/fs.File`, pipes, and stdio already can. | ||
| - `Tty` public shape, `Tty::open`, `Tty::write`, and `Tty::write_string` | ||
| signatures are unchanged. | ||
|
|
||
| ## Invariants | ||
|
|
||
| - `Tty::open` produces a coordinated handle whose output write path is the | ||
| non-overlapped worker path on Windows (`CharDevice`, `is_async=false`), | ||
| identical to the `0.19.1` behavior. | ||
| - Console devices are never opened through `@async/fs.open`. | ||
| - Workspace resolves to exactly one `moonbitlang/async` version (`0.19.4`). | ||
| - Unix and Windows share one terminal-stream wrapper (`RawFdStream`). | ||
|
|
||
| ## Acceptance Criteria | ||
|
|
||
| - All six manifests pin `0.19.4`. | ||
| - `moon check`, `moon check --deny-warn`, and the full test suite pass locally, | ||
| including the pty-backed `Tty::open` test. | ||
| - CI passes on ubuntu-latest, macos-latest, and windows-latest (the windows | ||
| pty `Tty::open` test in particular). | ||
| - Generated `.mbti` reflects only the intended `RawFdStream` impl additions. | ||
|
|
||
| ## Validation Commands | ||
|
|
||
| - `moon fmt --check` | ||
| - `moon check --deny-warn` | ||
| - `moon test --deny-warn` (root module) | ||
| - `moon test` in `tests/` (pty-backed module) | ||
| - `moon info` | ||
| - review generated `.mbti` diff | ||
| - `git diff --check` | ||
|
|
||
| ## Public API Audit | ||
|
|
||
| - Added `pub impl Fd`, `pub impl Reader`, and `pub impl Writer` for | ||
| `@async/raw_fd.RawFdStream`, plus the `moonbitlang/async/raw_fd` import in the | ||
| generated `.mbti`. These are intentional, consistent with the existing | ||
| `File`/`Pipe`/`stdio` impls, and let callers wrap raw fd streams. | ||
| - No new public type, mutable field, parser state, input event, platform handle, | ||
| backend selection, or capability query. | ||
| - The dependency change is the async version (`0.19.1` -> `0.19.4`). | ||
|
|
||
| ## Validation Results | ||
|
|
||
| - `moon fmt --check` passed. | ||
| - `moon check --deny-warn` passed. | ||
| - `moon test --deny-warn` (root) passed: 165 tests. | ||
| - `moon test` (`tests/`) passed: 133 tests, including the pty-backed `Tty::open` | ||
| test that drives `Tty::open` -> `RawFdStream` -> a real terminal write. | ||
| - `moon info` produced only the intended `RawFdStream` impl additions. | ||
| - `git diff --check` passed. | ||
| - windows-latest CI: pending. | ||
|
|
||
| ## Open Questions | ||
|
|
||
| - Report the upstream `GetFileInformationByHandle`-on-console regression to | ||
| `moonbitlang/async` (the open worker should fall back to `GetFileType` / | ||
| `kind_of_fd` when `GetFileInformationByHandle` fails, instead of erroring). | ||
| - The Windows-only `Tty::open` path cannot be compiled or run locally on macOS; | ||
| it relies on windows-latest CI for verification. |
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.