Skip to content

chore(nsh): sync rust-preview with upstream 0.6.0 - #6995

Merged
me2seeks merged 12 commits into
rust-previewfrom
codex/sync-nsh-upstream
Nov 19, 2026
Merged

me2seeks merged 12 commits into
rust-previewfrom
codex/sync-nsh-upstream

Conversation

@M4n5ter

@M4n5ter M4n5ter commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Summary

Sync the NSH runtime in rust-preview to longbridge/nsh 0.6.0 at 80b17ee2. Keyed lists now use upstream's ListDiff and sibling placement. AppKit shortcuts use the upstream keyboard monitor, and Windows releases selection shortcuts when the selected text changes.

Long Markdown documents with eligible plugins now parse in chunks, list markers precede item text in selections, and scroll views support scrollbarInset. The runtime also picks up upstream fixes for memo disposal, Web touch events and cross-tab storage.

Web animation frames now send only changed property values. The macOS text test uses the upstream Arc fix.

Earlier updates add button busy state and accent colors, improve scrolling in Dock tabs and fixed-column tables, and fix keyboard focus on Web, Linux and iOS. Keyed-list tests now use the upstream text helper. On macOS, hidden windows now defer a full-screen request until they are shown. On iOS, narrowing a scroll view preserves the latest content height, and press-down is dispatched before keyboard focus moves. The branch includes Maka rust-preview through 65dccb5.

Keep Maka's embedded terminal input and IME handling, Markdown source mapping, and indexed access for large files. The vendored source inventory, Cargo locks and distribution notices track the new revision.

Verification

  • At upstream revision 80b17ee2, all 8 macOS window-state tests passed, and the iOS backend typechecked for the ARM64 simulator with default features disabled. Native window transitions and touch interactions were not exercised.

  • At upstream revision fabe44b2, 66 focused Rust unit tests and 65 integration tests passed, including the covered-input Escape, dock tab scrolling, table scrollbar and Apple text attachment regressions. All 184 Web tests passed, including Chromium touch scrolling.

  • Both Maka shells typechecked with their tests. The iOS simulator backend (ARM64, default features disabled) and Windows backend (ARM64 MSVC, terminal enabled) cross-compiled. The Linux GTK menu test and Android runtime were not run locally.

  • At upstream revision 6da2ea4c, all 112 browser runtime tests passed with the freshly built Wasm fixture. All 180 Web host and scroll tests and the macOS text-cut regression test passed. Distribution notice verification also passed.

  • 3,268 NSH core, base, JS and engine unit tests passed, along with 22 TextView integration tests and 183 Web tests. That earlier run skipped 44 tests that require a Wasm fixture.

  • Five Maka workbench tests passed, covering Markdown parsing and interactive streaming on desktop and terminal.

  • The Maka desktop and terminal shells typechecked with their tests. The Windows backend cross-compiled for ARM64 MSVC with default features disabled, both with and without the terminal feature.

  • Browser bootstrap freshness, source provenance, license headers and distribution notices passed verification.

  • Linux compilation stopped at the missing GTK cross-compilation sysroot. Windows native tests and native GUI interaction remain unverified locally.

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Codex performed the upstream merge, reconciled local patches and ran verification. The commit includes a Generated-by: Codex trailer.

Checklist

  • Tests cover the change and fail without it
  • Format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

Update the vendored source through 71e6c842, adopt upstream list and keyboard handling, and retain the source-aware reader and embedded terminal behavior.

Generated-by: Codex
Refresh the distribution notice checksum after integrating the workspace tree changes.

Generated-by: Codex

@Astro-Han Astro-Han left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update (2026-11-18): the findings below are fixed in current head bda694c137f67ed1551c55686767d6b49726f497. I checked the three formatting changes: Writer::len now has the normal multiline body, and the two extra Windows blank lines are removed. The new tooling job 134790264127 passes. I withdraw the formatting P2 for the current head. The earlier diagnosis is retained below. This does not establish that all CI or the expanded 1,233-file import passes.

P2: the NSH sync fails the required Rust formatting check. At 5946f4de63cd1825b9da189655e64fd442fce70b, third-party/nsh/crates/nsh-base/src/text_view/markdown/mapped.rs:234 adds a single-line Writer::len that cargo fmt --all -- --check requires to be expanded. The same check also removes an extra blank line in third-party/nsh/crates/nsh-platform-windows/src/selectable_view.rs:818 and third-party/nsh/crates/nsh-platform-windows/src/text.rs:3011.

The original tooling job exits with status 1 at that command and reports those three differences. Its actual checkout is a318cbc19639a542e5b81d8c2d6fb9f7bede9d7a; I checked that all three source blobs match the PR head. The current Rust baseline 60e6ff8e0b44cb7496b3d60ee05fac8677729e36 passes its tooling job. Please format the affected sources before merging.

I checked these changed source sections, their CI checkout identity and the original formatting diagnostics. This is a limited CI finding, not a completed review of the 1,213-file sync. I have not run Cargo, Windows native tests, Linux builds, GUI interactions, or the full upstream provenance and retained-patch validation locally.


Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.

out: Source,
}
impl Writer<'_> {
pub(super) fn len(&self) -> usize { self.out.len() }

@Astro-Han Astro-Han Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update (2026-11-18): the findings below are fixed in current head bda694c137f67ed1551c55686767d6b49726f497. The specific source issue is corrected; I withdraw this finding for the current head. The historical report follows. New Windows runtime and full-import validation remain incomplete.

P2: the original tooling job fails cargo fmt --all -- --check on this new single-line function (and two Windows blank lines). The current baseline tooling passes. Please apply the formatter before merging.


Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.

@Astro-Han Astro-Han left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update (2026-11-18): the findings below are fixed in current head bda694c137f67ed1551c55686767d6b49726f497. I checked the new KeyEvent::synthetic constructor and its use at the reported terminal, input-test and keymap-test sites; it initializes all four fields. The Host::Web match arm now has the same webview guard as the variant. I withdraw both Windows compilation P2 findings for the current head based on these source changes. The new Windows CI job is still running; I have not compiled or tested Windows locally. The historical failures below remain recorded, and the expanded 1,233-file import still needs its full review.

I checked the Windows compilation failures at commit 5946f4de63cd1825b9da189655e64fd442fce70b, in addition to the formatting failure in my earlier review. I read the affected diff, the Windows input/native/terminal consumers, and the original native-windows job log. Its checkout was a318cbc19639a542e5b81d8c2d6fb9f7bede9d7a; the three relevant source blobs match this PR head exactly.

  • P2 — Update every KeyEvent initializer with the new fields. third-party/nsh/crates/nsh-platform-windows/src/input.rs:240–252 adds four required fields, but src/terminal.rs:213 and test constructors in src/input.rs and src/keymap.rs still initialize the old shape. The hosted Windows build reports E0063, so the terminal-enabled backend and affected Windows consumers cannot compile.
  • P2 — Apply the webview feature guard to the remaining match arm. third-party/nsh/crates/nsh-platform-windows/src/native.rs:422 makes Host::Web conditional, while needs_window_composition at line 364 still matches it unconditionally under terminal. The same job reports E0599 when terminal is enabled without webview. Guard that arm consistently with the variant.

The pre-change 99b0dff69b1676af13a4c697c3773af8d526591a Windows job reached desktop test execution rather than these compiler errors. Its runtime test failures are separate from the new compilation regressions. The earlier formatting finding remains open.

This is a scoped compilation follow-up, not a full review of the 1,213-file import. I did not run Windows or Rust locally. The Linux shell timeouts and the Workbench shortcut test failure in this PR's CI still need separate attribution; these findings do not establish their cause. Platform behavior, import provenance, retained patches, licensing and external plugin compatibility remain outside this follow-up.


Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.

pub(crate) repeat: bool,
/// Modifiers held.
pub(crate) modifiers: Modifiers,
/// The scan code the message carries (0 when it carries none: input
/// injected as text, `VK_PACKET`).
pub(crate) scan: u16,

@Astro-Han Astro-Han Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update (2026-11-18): the findings below are fixed in current head bda694c137f67ed1551c55686767d6b49726f497. The specific source issue is corrected; I withdraw this finding for the current head. The historical report follows. New Windows runtime and full-import validation remain incomplete.

P2 — Update the terminal and test constructors for these required fields. The Windows CI job reports E0063 at src/terminal.rs:213, several constructors in src/input.rs, and src/keymap.rs:169: they omit scan, extended, sys and translated. This blocks the terminal-enabled backend and Windows consumers from compiling. Please update all constructors and validate the terminal feature build and tests.

Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.

Video(Rc<video::VideoItem>),
#[cfg(feature = "webview")]

@Astro-Han Astro-Han Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update (2026-11-18): the findings below are fixed in current head bda694c137f67ed1551c55686767d6b49726f497. The specific source issue is corrected; I withdraw this finding for the current head. The historical report follows. New Windows runtime and full-import validation remain incomplete.

P2 — Guard the remaining match arm with the same feature. needs_window_composition() is compiled with terminal and still matches Host::Web(_) at line 364 without a webview guard. After making this variant conditional, a terminal build without webview fails with E0599, as recorded by the Windows CI job. Please guard that arm consistently.

Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.

Adapt long-document plugin parsing and selection order to the source-aware renderer. Use relative layout insets for built-in scrollbar placement and populate native key metadata for synthetic Windows input.

Generated-by: Codex

@Astro-Han Astro-Han left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current hosted-test follow-up (389a2f8). P2: native macOS RichEditor input/composition/copy still fails on the current code. In macos-nsh job 135652136237, focused_rich_editor_yields_copy_to_selected_output, rich_editor_composition_commit_matches_preedit_and_keeps_shortcuts, and rich_editor_to_box_none_input_focus_transition_copies_and_submits time out at third-party/nsh/crates/nsh-platform-macos/tests/terminal/cases.rs:65. This is new evidence for the current head, replacing the prior statement that its recovery had not been tested.

I checked the checkout and Git identities: the tested merge is 9a7247b89496bb7363061f373eae5709ce47498e, whose parents are Rust 103c4d101dd0e571cddefa734f722ba738758c45 and this PR head. Its entire NSH tree and desktop test file match the PR head. The same three cases pass in job 135607408303, whose tested merge 011353d1cc91086ebaf43f517e6bfde4671a977f has exactly the NSH tree of base d0bfb20b44d602b630df8b82fa0019429e9d26bb and current Rust 47a13c74f2aab27b9446289ad6a5b7f6309b1865; the terminal test file is identical to the PR's. That comparison run also fails the retained-image replacement case, so I am not attributing that fourth failure to this PR.

The current PR's native-macos job 135652136213 reports desktop 14 passed / 26 failed, while Rust 47a13c74 job 135663762322 reports 38 passed / 2 failed using the same desktop test file. This establishes a broader failed desktop acceptance result, not a single implementation cause or proof that all 26 failures share the RichEditor cause. I have not run native GUI tests locally.

The six earlier non-merge author commits remain identical in range-diff. The new merge incorporates Rust through d0bfb20 and resolves the generated notice checksum; an actual merge-tree against current Rust 47a13c7 is clean, so the previous notices conflict is no longer current. The Web missing-argument finding remains withdrawn in source. The current Windows NSH job succeeds, but both Windows desktop partitions fail: job 135652136255 reports 3 passed / 16 failed and job 135652136308 reports 8 passed / 11 failed. Together they cover 38 distinct cases, with 11 passed / 27 failed. Both test the same 9a7247b merge. Its actual Rust parent 103c4d1 passes all the same 38 cases in job 135641018654 and job 135641018893, with an identical desktop test file. This is a further current-head P2 desktop acceptance regression; I have not isolated its implementation cause or shown that all Windows and macOS failures share one cause. The import still spans 1,270 files, and complete source provenance, retained patches, platform behavior and external-consumer validation remain outstanding.

Earlier updates below apply only to their named commits and observation times:

Current source follow-up (8b27446). The Web compilation finding is fixed in source: third-party/nsh/crates/nsh-platform-web/tests/text/animated.rs:14 now passes false to outputs, matching the required argument. I withdraw that missing-argument P2 for this head; I have not run Cargo or verified a new hosted Web test result.

This commit also changes menu typeahead to When::NotEditing, preserves empty preedit composition state, adjusts RichEditor selection geometry and the headless text engine, fixes TUI activation ordering and Windows focus filtering, and changes the Linux test policy and headless CI environment. I read this incremental diff. These changes mean the earlier macOS failures below are historical evidence, not proof that the current code still fails. The three native RichEditor input/composition/copy cases and the desktop suites still need current-head verification; I have not established their recovery or isolated a single cause for the old desktop failures. At this update the current head has no reported checks or workflow runs. The old cancelled Windows result does not establish a current pass.

The import now spans 1,270 files. Against rust-preview at a4d18f3e29fe0534744f48d12cc8cd831f445d33, an actual merge-tree still conflicts in products/maka/cli/notices.json. Complete provenance, retained patches, platform and external-consumer verification remains outstanding. This update covers source remediation and integration state, not full validation of the import.

Historical updates below apply only to their named commits:

Current-head CI and integration update (f2655ef). Both reported P2 regressions remain on this head. The current macOS job fails the same three native RichEditor input/composition/copy tests at tests/terminal/cases.rs:65 (11 passed, 3 failed). The exact tested base, 7a0b3ce0220d68338ba6fcd4f2d1fea3ebbee735, passes all 14 native tests, including those three. The native test source is identical between base and head. The current desktop suite has 14 passed and 25 failed; this base passes all 39. I have not established that all 25 desktop failures share one implementation cause or that physical keyboard input behaves identically.

The tested merge is 3a87a6f8043606107e8da33e30f24893f99fbbb6, with parents exactly that base and this head. I checked the native terminal, text input, native test, RichEditor controller and desktop test blobs against the raw head; all five match. The current Web job also still reports the missing outputs argument described below. These are original hosted CI results, not a local Rust or macOS reproduction; the implementation root cause of the native failures remains unisolated. The Windows job finished cancelled, which does not establish a pass.

Against the newer rust-preview commit c161b40555643e30b02e5f67fe5096ed3af38150, an actual merge-tree now reports a conflict in products/maka/cli/notices.json. This replaces the earlier conflict-free snapshot. The import remains 1,266 files; provenance, retained patches, external consumers and full platform behavior still need complete verification.

Earlier updates, retained as dated evidence:

Current-head follow-up (f2655ef). The Web test compilation finding below remains reproducible in the current nsh job: animated.rs:14 still calls outputs without its required all: bool, and the job reports E0061. I read the current animation diff and helper and checked that both source blobs in the tested merge 3a87a6f8043606107e8da33e30f24893f99fbbb6 match this head exactly; its parents are 7a0b3ce0220d68338ba6fcd4f2d1fea3ebbee735 and this head. I did not run Cargo locally.

The earlier eight integration conflicts are resolved against that rust-preview base (an actual merge-tree succeeds). This head expands the import to 1,266 files. Its macOS and Windows jobs are still pending at this update, so the earlier three macOS RichEditor failures below are historical results on baac9435d0f0cbf6e0794be65b27bbb4d1e86742, not a claim about the new head and not evidence of a fix. Those input/composition/copy scenarios still need current-head verification. The new Linux and Workbench failures remain separately unattributed. This follow-up checks the specific Web regression and integration state; it does not validate the complete import, provenance, retained patches, external consumers, or all platform behavior.

Earlier evidence, retained for context (baac943):

P2 — Update the host-side animation test caller for the new outputs argument. At third-party/nsh/crates/nsh-platform-web/src/animation.rs:317, the new signature requires all: bool, but the existing helper at tests/text/animated.rs:14 still calls a.outputs(&mut out). The host-side text test includes the production animation module directly, so both its build and execution fail with E0061 before the Web tests can run. The original nsh job records this exact error twice; the base nsh job passes all 44 Web text tests. The animation module and test helper in the tested merge match this head exactly; the helper itself is unchanged from the base. Please update the helper to supply the intended mode, exercise forced batch output and change-only frame output, and rerun cargo nextest run --locked --manifest-path third-party/nsh/Cargo.toml -p nsh-platform-web --no-default-features --test text --no-fail-fast. I verified the source and original CI logs; I did not run Cargo locally.

P2 — Restore the macOS native RichEditor integration checks before treating this sync as validated. The native-macos job now fails three existing nsh-platform-macos::terminal_native tests: focused_rich_editor_yields_copy_to_selected_output, rich_editor_composition_commit_matches_preedit_and_keeps_shortcuts, and rich_editor_to_box_none_input_focus_transition_copies_and_submits. Each reaches third-party/nsh/crates/nsh-platform-macos/tests/terminal/cases.rs:65 with “native app did not settle before deadline”; the suite finishes with 10 passed and 3 failed. The exact same three tests pass on the PR's base, 4b03eb28107e4bf7b509e16aa09dbbb807a80bd9, whose native suite finishes with all 13 passed. The native test source is unchanged between that base and this head.

The same PR job also finishes the desktop suite with 14 passed and 25 failed. Many failures at products/maka/terminal-shell/tests/real_host/desktop_new_session.rs:297 report an admitted, active native text target whose editor remains empty after input. In contrast, the base's desktop suite has 38 passed and one existing Room-reference failure. I am treating the three native RichEditor failures as the concrete integration regression here; I have not established that all 25 desktop failures share one cause, or that physical keyboard input has the same behavior. Please restore these native input/composition/copy checks and rerun the affected macOS integration suites.

I read the relevant import diff and the native terminal paste/composition, text-input and RichEditor controller paths, and compared the original job logs. The PR job checks out a76bf75d99392d5d7c019127bb182246b499f425, a merge of that exact base and this head. Its terminal.rs, text_input.rs, native test cases.rs, RichEditor view/controller.rs, and desktop test source blobs match this head exactly. This finding is scoped to the observed CI regression; I have not isolated its implementation root cause or run Rust/macOS locally.

The earlier formatting and Windows compilation findings remain fixed; this is a separate finding. The Windows job for this head finished cancelled, which does not establish a Windows test pass; and the Linux shell timeouts remain separately unattributed. This follow-up does not validate the full 1,234-file import, provenance and retained patches, external plugin compatibility, or the other platform behaviors. The current branch also has integration conflicts with newer rust-preview commits.


Follow-up on 2026-11-20: the subsequent clipboard/test fix in #7042 has merged as 0a7b9834300afa814666123045f2decc51c4104b. Its final run 44658723578 passed the three RichEditor terminal cases, all 40 macOS and 38 selected Windows desktop cases, terminal retained-image replacement, and the recovery test. Those are later code/test changes; they do not alter the historical fixed-SHA #6995 failures described above or establish their original root causes. Current Rust contains the follow-up, so the older statement that the repair is only an open PR is no longer current. I have not completed the full upstream synchronization acceptance.

Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.

/// only the values that changed since they last went: a page whose
/// views hold many bound values, most of them still, costs the frame
/// only what moves.
pub(crate) fn outputs(&mut self, out: &mut Out, all: bool) {

@Astro-Han Astro-Han Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in source at 8b27446b85870a6ed456a99c24d4feea0346215f: the helper now calls a.outputs(&mut out, false). I withdraw the missing-argument P2 for that head. A current-head Web test run remains unverified.

Historical finding on the earlier commit:

P2: This adds a required all argument, but tests/text/animated.rs:14 still calls a.outputs(&mut out). That host test directly includes this module, so the nsh job cannot compile the Web text test (E0061); the unchanged helper passed on the base. Please update the caller and cover both forced batch and change-only output modes. Original failure: https://github.com/apache/maka/actions/runs/44312595394/job/134831157365

Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.

@github-actions github-actions Bot added the effort/XXL Over 2500 readable lines label Nov 19, 2026

@me2seeks me2seeks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows IME spot review for 8b27446: I reproduced longbridge/nsh#1985 on Windows 11 x64 with Microsoft Pinyin and a standalone RichEditor, no Maka Host involved. On the current Maka NSH pin, nihao + Space left the document at First; pressing 1 then produced First你好1. With the exact upstream #1994 patch applied to that pin, Space alone produced First你好, then 1 appended once. All three upstream RichEdit regression tests passed on Windows. This PR carries the upstream deferred notification delivery, so I don't see a reason to add a parallel Maka IME workaround. This is targeted verification, not native dogfood of the whole sync head.

Merge blockers at review time: GitHub reports this head conflicts with rust-preview, there are no checks on this SHA, and the preceding sync head failed CI. Please resolve against current rust-preview and run CI on the resulting head before merging.

Resolve the generated notice manifest checksum against the merged notice document. Preserve the reviewed components and the NSH sync unchanged.

Generated-by: Maka
@me2seeks
me2seeks merged commit b0d3989 into rust-preview Nov 19, 2026
16 of 21 checks passed
@me2seeks
me2seeks deleted the codex/sync-nsh-upstream branch November 19, 2026 16:14
@M4n5ter

M4n5ter commented Nov 19, 2026

Copy link
Copy Markdown
Member Author

@me2seeks Heads-up: our local macOS, Windows VM, and Linux (Omarchy) CI runs just finished, after the merge. We tested 8b27446b8, not the final merged tree, so these aren't results for the merge commit.

  • macOS: desktop 14 passed / 25 failed; surface 11 passed / 3 failed. Most failures are clipboard readback: rich copy writes to the OS clipboard but bypasses the terminal surface's clipboard tracking. One room-mention test pasted into the old composer during a session switch.
  • Windows: desktop 9 passed / 28 failed. 25 hit the same clipboard readback path, one couldn't get a text-input target in the Rename room dialog, and two aborted with Tokio worker stack overflows. Both pixel tests passed.
  • Linux: the root suite had three timeouts on the first run; all three passed in targeted replays. The rest of the Linux plan passed after removing the runner's temp-env override.

The next useful check is a targeted rerun on the merged tree to see which failures still reproduce.

M4n5ter added a commit that referenced this pull request Nov 20, 2026
Route rich-editor text through the terminal clipboard on macOS and Windows while preserving native rich clipboard formats for standalone windows. Preserve scoped AppKit shortcuts when a field editor has focus.

Keep the desktop, retained-image, and interrupted-run assertions synchronized with the existing input, layout, and work readiness boundaries. Exercise minimized and normal Browser presentation in the same Host scenario.

Refs #6995.

Generated-by: Codex
Generated-by: Maka
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/XXL Over 2500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants