mirror of
https://github.com/NeuralNomadsAI/CodeNomad.git
synced 2026-11-17 05:49:28 +00:00
## Summary Updates the Tauri desktop host from 2.10 to the current 2.12 release. The crate family (tauri, tauri-build, tauri-runtime-wry, wry, tao and the plugins) and `@tauri-apps/*` are aligned; the exact versions are in `packages/tauri-app/Cargo.toml`, `Cargo.lock` and the `package.json` files. `Cargo.toml` minimums now equal the qualified versions. Crates that follow the updated family also move: webview2-com (was pinned exactly) and windows-core with Wry, rfd with the dialog plugin. A Dependabot `cargo` entry for `/packages/tauri-app` now proposes Tauri crate updates weekly against `dev`. It allows `tauri`, `tauri-build`, `tauri-plugin-*`, `tauri-runtime*` (including the refcount test fixture's direct requirements) and `wry` (lock-only); minor and patch updates arrive grouped, each major separately. Tao is excluded, because it is vendored and patched. A new check fails a PR whose lock no longer resolves a vendored copy, so an update can't silently drop the local fixes. ## Changes that apply - **tauri-macros 2.7, second hidden macro per command:** `client_state.rs` re-exports commands explicitly and now also re-exports the new names. - **Tao 0.37, logout exit:** Tao calls `std::process::exit(0)` when its hidden window receives `WM_ENDSESSION`. Windows can deliver it there before our window, which would skip the logout flush. Session-end handling moved to `windows_session_end.rs` and is installed on Tao's hidden window too, so client state is flushed and the backend stopped before Tao exits. - **Tauri 2.12.2, macOS restart through `open -n`:** that path drops the environment, so a launch pinned with `CODENOMAD_PROFILE` or `CLI_CONFIG` would restart in another profile after a developer-mode, profile or update restart. The macOS restart now launches the bundle's executable directly at the same point (`macos_relaunch.rs`), keeping the environment. Like Tauri's own fallback, it takes the executable name from `Info.plist` (`CFBundleExecutable`), so an update that renames the executable still restarts. It uses the current binary outside a bundle or when that value is missing or unsafe. - **Tao 0.36, IME rewrite:** the IME scenario of the input-deadlock regression no longer applies and is removed. - **Tauri 2.11, macOS renderer termination:** when the app registers no `on_web_content_process_terminate` hook, as here, the runtime reloads a crashed macOS renderer itself. The reload goes through the page-load path, which resets the badge count; `NOTIFICATION_BADGES.md` and `notification_badge_lifetime.rs` describe this. The notification plugin's Windows permission fix needs no change here. The other 2.11–2.12 changes (ACL and scope fixes, `on_new_window` threading, window creation from other threads, asset protocol, updater `allowDowngrades` and stricter signature checks, fs plugin fixes) were checked and don't affect this code. ## Vendored crates - **tao:** the upstream releases now include the input-deadlock fix (tao#1215) and the macOS zoom fix (tao#1182), so those backports are gone. The Windows runner refcount correction is still needed (tauri#15408 open, tao#1290/#1334 declined), so it is re-applied to the new Tao with its SHA-256 and patch. Its negative control still crashes; the corrected build passes 5/5. - **tauri-plugin-updater:** the new release still releases client state before `ShellExecuteW`, so the success-only handoff is re-applied. Cargo can't test a patched crate with dev-dependencies, so CI's `cargo test -p tauri-plugin-updater` step is replaced by `scripts/test-tauri-updater-handoff.mjs`, which tests a temporary copy with the crate's own lockfile. - `packages/tauri-app/scripts/vendored-patches.test.mjs` (CI Linux job) fails when `Cargo.lock` no longer resolves a vendored copy. The regression scripts read the vendored Tao version from `cargo metadata`. The input-deadlock and macOS window negative controls pin the last unfixed Tao; the runner-refcount negative control reverts the counter in a temporary copy of the vendored Tao. ## Docs `dev-docs/RUNTIME_MAINTENANCE.md` (Dependabot for the Tauri crates, re-qualifying vendored crates, system-managed WebView2/WKWebView/WebKitGTK, `@tauri-apps/*` kept on the crates' minor), `TAURI_UPDATER.md`, `DESKTOP_DATA_PROFILES.md`, `NOTIFICATION_BADGES.md` and `vendor/README.md`. `docs/help` is unchanged; nothing user-facing changes. ## Validation - **Windows:** - `cargo check --workspace --all-targets`, and `cargo test --locked -- --test-threads=1` in `src-tauri`: 313 pass, including the CLI-signed updater download and tamper rejection. - Input deadlock: 4/4 reproduced on the old Tao, 4/4 pass on the new one. Refcount: reproduced, then 5/5 pass. Updater handoff and zoom (17/17) pass. - Packaging invariants 27/27; UI and root typechecks clean. - The release `npm run build` produces the NSIS installer, and `smoke:resources` passes. - Hidden smoke: the release executable ran on a separate, never-shown desktop with its own profile. It reached ready, and a simulated logout flushed client state, stopped the backend and exited 0. - **Ubuntu 24.04 VM:** `cargo test` 303 pass. The CI-style AppImage launches, renders the UI, and on close stops the backend and unmounts cleanly. - **macOS Intel VM:** `cargo test` 302 pass, including the `Info.plist` relaunch resolution tests; the window regression and its negative control pass. - **Not run end to end:** a real Windows logout, a signed-installer update, and a packaged macOS restart (the restart is unit-tested). Apple Silicon is covered by CI only.
64 lines
3.7 KiB
JavaScript
64 lines
3.7 KiB
JavaScript
// Real Win32/Tao input reentrancy. No CodeNomad profile, backend or shared daemon.
|
|
import assert from "node:assert/strict"
|
|
import { spawnSync } from "node:child_process"
|
|
import { mkdtemp, mkdir, readFile, writeFile, cp, rm } from "node:fs/promises"
|
|
import os from "node:os"
|
|
import path from "node:path"
|
|
import { fileURLToPath } from "node:url"
|
|
|
|
assert.equal(process.platform, "win32", "Run this native regression on Windows")
|
|
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..")
|
|
const workspace = path.join(root, "packages/tauri-app")
|
|
const fixture = path.join(workspace, "tests/windows-input")
|
|
const target = path.resolve(process.env.CARGO_TARGET_DIR || path.join(workspace, "target"))
|
|
const env = { ...process.env, CARGO_TARGET_DIR: target }
|
|
delete env.NODE_OPTIONS
|
|
delete env.CODENOMAD_NATIVE_PARENT
|
|
function cargo(args, cwd = workspace) {
|
|
const result = spawnSync("cargo", args, { cwd, env, encoding: "utf8", timeout: 300_000, maxBuffer: 4 * 1024 * 1024, windowsHide: true })
|
|
assert.equal(result.error, undefined, String(result.error))
|
|
assert.equal(result.status, 0, result.stdout + result.stderr)
|
|
return result.stdout
|
|
}
|
|
const binary = path.join(target, "debug/codenomad-windows-input-fixture.exe")
|
|
const UNFIXED_TAO = "0.34.6"
|
|
// Tao reads committed IME text with ImmGetCompositionStringW on
|
|
// WM_IME_ENDCOMPOSITION without peeking messages: IME input has no reentrancy point.
|
|
const cases = ["keydown", "keyup", "char", "syschar"]
|
|
function check(expected, scenarios = cases) {
|
|
for (const scenario of scenarios) {
|
|
const result = spawnSync(binary, [scenario], { cwd: fixture, env, encoding: "utf8", timeout: 15_000, windowsHide: true })
|
|
assert.equal(result.error, undefined, `${scenario}: ${result.error}`)
|
|
assert.match(result.stdout, /nested focus queued before Tao input processing/, `${scenario}: ${result.stdout}${result.stderr}`)
|
|
assert.equal(result.status, expected, `${scenario}: ${result.stdout}${result.stderr}`)
|
|
if (expected === 0) assert.match(result.stdout, /PASS:/)
|
|
else assert.match(result.stderr, /input callback watchdog/)
|
|
console.log(`${expected === 0 ? "fixed PASS" : "negative control deadlock reproduced"}: ${scenario}`)
|
|
}
|
|
}
|
|
|
|
// The application must resolve the checked-in Tao copy, whatever its version.
|
|
const metadata = JSON.parse(cargo(["metadata", "--locked", "--format-version", "1"]))
|
|
const tao = metadata.packages.filter(item => item.name === "tao")
|
|
assert.equal(tao.length, 1, "Tauri and the regression must share one Tao implementation")
|
|
assert.equal(path.resolve(tao[0].manifest_path), path.join(workspace, `vendor/tao-${tao[0].version}/Cargo.toml`))
|
|
|
|
// Optional negative control: the last published Tao before the upstream input
|
|
// fix (tao#1215), downloaded through Cargo into a separate temporary workspace.
|
|
if (process.argv.includes("--baseline")) {
|
|
const temporaryRoot = path.join(os.tmpdir(), "opencode")
|
|
await mkdir(temporaryRoot, { recursive: true })
|
|
const baseline = await mkdtemp(path.join(temporaryRoot, "tao-input-baseline-"))
|
|
try {
|
|
await cp(path.join(fixture, "src"), path.join(baseline, "src"), { recursive: true })
|
|
const manifest = await readFile(path.join(fixture, "Cargo.toml"), "utf8")
|
|
const requirement = `tao = "=${tao[0].version}"`
|
|
assert.equal(manifest.split(requirement).length, 2, `The fixture must pin ${requirement}`)
|
|
await writeFile(path.join(baseline, "Cargo.toml"), manifest.replace(requirement, `tao = "=${UNFIXED_TAO}"`) + "\n[workspace]\n")
|
|
cargo(["build", "--manifest-path", path.join(baseline, "Cargo.toml")], baseline)
|
|
check(2)
|
|
} finally { await rm(baseline, { recursive: true, force: true }) }
|
|
}
|
|
|
|
cargo(["build", "--locked", "-p", "codenomad-windows-input-fixture"])
|
|
check(0)
|