fix(desktop): count apps/shared commits in the bundle-skew detector
Salvaged from #120253 by jonpol01 (Sweep) — the diff applies unchanged onto current main. RUNTIME_PATHS listed only apps/desktop/*, but apps/shared/src is compiled into BOTH bundles: the renderer through the vite alias '@hermes/shared' -> ../shared/src (plus the file: dependency on apps/shared/package.json), and the Electron main process by relative import (bootstrap-runner.ts, hardening.ts, translucency.ts import '../../shared/src/...'). A fix confined to shared code (the JSON-RPC layer, the gateway client) left the installed app just as stale as a renderer change, but the skew detector stayed silent about it. Add apps/shared/src and apps/shared/package.json to RUNTIME_PATHS so shared-only commits count toward desktopCommitsBehind/outOfSync; non-runtime shared content (e.g. README.md) stays excluded, covered by the new it.each regression test. Fixes #120252
This commit is contained in:
committed by
brooklyn!
parent
fa65609351
commit
680ea95123
@@ -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
|
||||
|
||||
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user