Skip to content

The agent that grows with you

fix(desktop): count apps/shared commits in the bundle-skew detector

Brooklyn Nicholson680ea95123bb
diff --git a/apps/desktop/electron/bundle-skew.test.ts b/apps/desktop/electron/bundle-skew.test.ts
index 46a421d4a80..d08aa970185 100644
--- a/apps/desktop/electron/bundle-skew.test.ts
+++ b/apps/desktop/electron/bundle-skew.test.ts
@@ -261,6 +261,24 @@ describe('detectBundleSkew against a real git repo', () => {
expect(result).toEqual({ desktopCommitsBehind: 1, outOfSync: true })
})
+ // apps/shared/src is compiled into both bundles, so a fix confined to it (a shared gateway client, the
+ // JSON-RPC layer) leaves the installed app just as stale as a renderer change does.
+ it.each([
+ ['apps/shared/src/json-rpc-gateway.ts', { desktopCommitsBehind: 1, outOfSync: true }],
+ ['apps/shared/README.md', { desktopCommitsBehind: 0, outOfSync: false }]
+ ])('counts a commit that only touched %s as it reaches the bundle', async (file, expected) => {
+ const { base, repoRoot } = makeScratchRepo()
+ const git = scratchGit(repoRoot)
+
+ writeFiles(repoRoot, [file])
+ git('add', '.')
+ git('commit', '-q', '-m', 'shared-only change')
+
+ const result = await detectBundleSkew({ commit: base, source: 'local' }, realGitRun(repoRoot), repoRoot)
+
+ expect(result).toEqual(expected)
+ })
+
// The #92233 install, reproduced: the update rewrote the tree onto a fresh
// orphan root, so the stamp resolves but is unreachable. Real git answers
// `rev-list` with a positive count here — ancestry is the only thing that
diff --git a/apps/desktop/electron/bundle-skew.ts b/apps/desktop/electron/bundle-skew.ts
index 9f872008bd7..ecb4cae7a58 100644
--- a/apps/desktop/electron/bundle-skew.ts
+++ b/apps/desktop/electron/bundle-skew.ts
@@ -60,11 +60,13 @@ export type RunGit = (
) => Promise<{ code: number; stderr: string; stdout: string }>
/**
- * The apps/desktop paths that actually reach the user: renderer sources,
- * main-process sources, the HTML entry, the public/ assets Vite copies into
- * the bundle, app icons, and the packaging config. Docs, e2e specs, scratch
- * scripts, and dev tooling never reach the shipped app, so a delta confined
- * to them is not a torn install in any way the user can see.
+ * The paths that actually reach the user: renderer sources, main-process
+ * sources, the HTML entry, the public/ assets Vite copies into the bundle, app
+ * icons, and the packaging config -- plus apps/shared, which both bundles
+ * compile in (the renderer through the `@hermes/shared` alias, the main process
+ * by relative import). Docs, e2e specs, scratch scripts, and dev tooling never
+ * reach the shipped app, so a delta confined to them is not a torn install in
+ * any way the user can see.
*/
export const RUNTIME_PATHS = [
'apps/desktop/src',
@@ -73,7 +75,9 @@ export const RUNTIME_PATHS = [
'apps/desktop/public',
'apps/desktop/assets',
'apps/desktop/package.json',
- 'apps/desktop/vite.config.ts'
+ 'apps/desktop/vite.config.ts',
+ 'apps/shared/src',
+ 'apps/shared/package.json'
] as const
const NOT_STALE: BundleSkewResult = { desktopCommitsBehind: null, outOfSync: false }