mirror of
https://github.com/actualbudget/actual.git
synced 2026-05-21 14:42:14 -05:00
* [AI] Load @actual-app/crdt from source in dev, only bundle for publish @actual-app/crdt's local exports now point at src/index.ts so consumers (sync-server, loot-core, desktop-client) never see a stale Vite bundle. publishConfig keeps the dist/ mapping for npm consumers. crdt's tsconfig switches to bundler module resolution to match the rest of the workspace (no extensions in source imports). Sync-server's existing extension-resolution loader is extended to also handle directory-index imports (./crdt → ./crdt/index.ts), and the standalone `start` / `start-monitor` scripts now invoke Node with --import ./register-loader.mjs so the loader is in place before crdt's source resolves. Electron's utilityProcess.fork accepts execArgv but doesn't actually preload --import modules, so a new packages/sync-server/start.mjs bootstrap entry registers the loader imperatively and then dynamic- imports build/app.js. desktop-electron's startSyncServer() points the fork at start.mjs. sync-server's "files" array now ships start.mjs, register-loader.mjs and loader.mjs so packaged Electron / npm consumers actually receive them. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Add release notes for PR #7702 * [AI] Restructure sync-server to build with Vite Replace the hand-rolled tsgo + add-import-extensions + copy-static-assets + runtime loader pipeline with a single Vite SSR build. Bundles every entry (app, bin/actual-server, scripts/*) and inlines @actual-app/crdt source so Node never has to resolve TS at runtime — the MODULE_TYPELESS_PACKAGE_JSON warning that surfaced via crdt's source exports is gone. Migrations and bank handlers move from readdir-based dynamic imports to import.meta.glob; messages.sql becomes a ?raw import. Drop loader.mjs, register-loader.mjs, start.mjs, and bin/add-import-extensions.mjs. Electron's startSyncServer() forks build/app.js directly. publishConfig.imports goes away (subpath imports are resolved at build time and don't appear in the bundle). In dev (start:server-dev) sync-server proxies to Vite, so loosen the CSP to allow Vite's inline preamble script and HMR websocket — production CSP is unchanged. desktop-client skips registerSW() in dev (and disables vite-plugin-pwa's devOptions) so stale cached assets don't override edits between page loads. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * [AI] Address review feedback - sync-server CSP: drop 'unsafe-eval' from the production script-src; the bundle has no genuine eval/new Function usage (only a defensive branch in setimmediate's polyfill that's never hit). Keep it on the dev branch where Vite's HMR runtime relies on it. Add a comment so it's obvious which branch needs it and why. - bank-factory: widen the loader glob to ./banks/*_*.{ts,js} so TypeScript handlers are discovered too, mirroring migrations.ts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * [AI] Restore 'unsafe-eval' in production CSP for Electron The Electron app needs `'unsafe-eval'` at runtime, so revert the dev-only restriction and keep `'unsafe-eval'` in both branches. Comment updated to record the actual reason instead of marking it as removable. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * [AI] Revert bank-factory glob change Widening the glob to ./banks/*_*.{ts,js} broke the desktop e2e tests in CI even though every current handler is .js and the brace expansion matches no .ts files locally. Reverting to ./banks/*_*.js — the change had no behavioural benefit since there are no TS handlers, so the nitpick isn't worth chasing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * [AI] Strip CSP comment to restore identical state to9513c1e16The desktop e2e has been failing despite my prior commits being a strict revert (only difference was a 2-line comment, which can't change runtime). Removing even the comment so the branch matches 9513c1e16's relevant files exactly, to isolate whether the failure is from the master merge or from CI-environment drift. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * [AI] Make rebuild-electron actually rebuild better-sqlite3 PR #7712 simplified rebuild-electron to just `electron-rebuild -f -o better-sqlite3,bcrypt` from the repo root. Two problems with that: 1. Without `-m`, electron-rebuild scans the root workspace's package.json for native deps. better-sqlite3 isn't a direct root dep — it lives under packages/sync-server/ — so the scan returns no candidates and the rebuild silently no-ops. 2. Without --build-from-source, electron-rebuild defers to prebuild-install, which downloads a stale prebuilt binary keyed off better-sqlite3's package.json (ABI 127) instead of recompiling against Electron 39's bundled Node ABI 140. The download succeeds and "Rebuild Complete" prints, but the resulting `better_sqlite3.node` can't `dlopen` inside Electron's utility process — sync-server crashes immediately on db init, the renderer's startSyncServer IPC never resolves, and the e2e test hangs on "Configure your server". Point -m at packages/desktop-electron (which transitively pulls in better-sqlite3 and bcrypt via @actual-app/sync-server) and force a real compile via --build-from-source. Verified locally: better-sqlite3 rebuilds to darwin-arm64-140 and the desktop e2e onboarding test passes in 6s instead of hanging for 60s. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * [AI] Restore CSP unsafe-eval comment Bring back the explanatory comment that was stripped diagnostically in99682268c. Now that the desktop e2e regression is traced to rebuild-electron and not to anything in this branch, we can keep the documentation noting why 'unsafe-eval' is retained in both CSP branches. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * [AI] Restore bank-factory glob to ./banks/*_*.{ts,js} Re-apply the glob widening originally added in145868f9d. It was reverted in531b1a191because the desktop e2e was failing — that failure is now traced to the rebuild-electron breakage (fixed in6e8ac0784), not to this glob. Mirroring migrations.ts so future TS bank handlers are picked up. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * [AI] Fix applyAppUpdate hanging in dev mode In dev mode browser-preload's updateSW was () => undefined, so applyAppUpdate() — which calls updateSW() and then awaits a deliberately never-resolving promise (waiting for the SW-driven page reload) — hung the renderer instead of refreshing. In prod the page is replaced by the new service worker, so the never-resolving await is fine. The dev path now triggers a plain window.location.reload() so the page reloads and the never-settling await is irrelevant, matching prod's effective behaviour. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * [AI] Revert rebuild-electron to master version * Revert "[AI] Revert rebuild-electron to master version" This reverts commit4b6baab79f. --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Matiss Janis Aboltins <MatissJanis@users.noreply.github.com>