[Init] Initial commit - NetMesh terminal manager
Some checks failed
build-packages / resolve bundled mosh-client (push) Has been cancelled
build-packages / resolve bundled et-client (push) Has been cancelled
build-packages / build-macos (push) Has been cancelled
build-packages / build-windows (push) Has been cancelled
build-packages / build-linux-x64 (push) Has been cancelled
build-packages / build-linux-arm64 (push) Has been cancelled
build-packages / release (push) Has been cancelled
build-packages / update Nix release metadata (push) Has been cancelled
build-packages / bump homebrew tap (push) Has been cancelled
test / lint-and-test (push) Has been cancelled
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
build-et-binaries / build-linux-x64 (push) Has been cancelled
build-et-binaries / build-linux-arm64 (push) Has been cancelled
build-et-binaries / build-macos-universal (push) Has been cancelled
build-et-binaries / build-windows-x64 (push) Has been cancelled
build-et-binaries / release (push) Has been cancelled

This commit is contained in:
2026-09-13 18:24:01 +08:00
commit 3c72efcb7f
3255 changed files with 907009 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
import assert from 'node:assert/strict';
import fs from 'node:fs';
import test from 'node:test';
/**
* useSettingsIpcSync is a React hook (useEffect-driven); without
* react-test-renderer available in this environment we can't mount it and
* assert on live cross-window broadcast behavior. These structural checks
* instead verify the source wiring end-to-end: every other window's
* useSettingsState instance (mounted via AppLockGate, even though the
* auto-launch toggle only ever renders in the Settings window) must consume
* the STORAGE_KEY_AUTO_LAUNCH_ENABLED broadcast, matching the established
* pattern used by every other synchronized boolean setting in this file.
*/
test('settingsIpcSync handles the auto-launch broadcast key like other synced booleans', () => {
const source = fs.readFileSync(new URL('./settingsIpcSync.ts', import.meta.url), 'utf8');
assert.match(
source,
/STORAGE_KEY_AUTO_LAUNCH_ENABLED/,
'must import the storage key',
);
assert.match(
source,
/if \(key === STORAGE_KEY_AUTO_LAUNCH_ENABLED && typeof value === 'boolean'\) \{\s*[\s\S]*?setAutoLaunchEnabled\(/,
'must apply the broadcast value to local state, same as e.g. STORAGE_KEY_GLOBAL_HOTKEY_ENABLED',
);
assert.match(
source,
/setAutoLaunchEnabled: Dispatch<SetStateAction<boolean>>/,
'the setter prop must be declared on the params interface',
);
// The dependency array of the effect must list the setter, or the
// listener could close over a stale setter reference after a re-render.
const effectStart = source.indexOf('useEffect(() => {');
const depsStart = source.indexOf('}, [', effectStart);
assert.ok(effectStart > -1 && depsStart > effectStart, 'expected to find the sync effect and its deps array');
const depsSlice = source.slice(depsStart, source.indexOf(']);', depsStart));
assert.match(depsSlice, /setAutoLaunchEnabled/, 'setAutoLaunchEnabled must be listed in the effect deps array');
});
test('useSettingsState wires the real autoLaunchEnabled setter into useSettingsIpcSync (not a no-op)', () => {
const source = fs.readFileSync(new URL('./useSettingsState.ts', import.meta.url), 'utf8');
const hookCallStart = source.indexOf('useSettingsIpcSync({');
assert.notEqual(hookCallStart, -1, 'expected to find the useSettingsIpcSync(...) call');
const hookCallEnd = source.indexOf('});', hookCallStart);
const callSlice = source.slice(hookCallStart, hookCallEnd);
assert.match(
callSlice,
/setAutoLaunchEnabled,/,
'useSettingsIpcSync must receive the real setAutoLaunchEnabled state setter, ' +
'or a broadcast from another window silently does nothing in this one',
);
});