Skip to content

Commit 0bc2fa1

Browse files
committed
ci: keep the desktop live gate's skip-only-unrelated rule
1 parent 80848e5 commit 0bc2fa1

3 files changed

Lines changed: 13 additions & 53 deletions

File tree

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,11 @@
11
#!/usr/bin/env bash
2-
# Prints `changed=true` when a pull request touches a path the live desktop suite exercises, or when
3-
# the diff cannot be worked out, and `changed=false` otherwise.
4-
#
5-
# The suite (apps/desktop/e2e/desktop-tools-live-sim.spec.ts) drives the Electron app against a
6-
# local Sim, realtime and Redis through the desktop, mothership, copilot, upload and auth routes and
7-
# the chat page. A change that only breaks Sim boot or an unrelated route fails the build and e2e
8-
# jobs, and every staging and main push runs this suite regardless, so a path missing here can
9-
# delay a failure to the staging push but never lets it deploy.
2+
# Prints `changed=false` only when every file a pull request changes is clearly unrelated to the
3+
# live desktop suite, and `changed=true` otherwise, including when the diff cannot be worked out.
104
#
115
# Usage: desktop-live-changes.sh <base-sha>
126
set -u
137

14-
relevant='^(apps/desktop/|apps/realtime/'\
15-
'|packages/(desktop-bridge|browser-protocol|terminal-protocol|realtime-protocol|db|auth|emcn|utils|logger|security|platform-authz|runtime-secrets)/'\
16-
'|apps/sim/lib/(desktop|mothership|uploads|auth|terminal|browser-agent|workspaces/permissions|api/(client|server))/'\
17-
'|apps/sim/lib/api/contracts/(chats|copilot|desktop-|mothership-|upload-sessions|workspace-file)'\
18-
'|apps/sim/app/api/(desktop|mothership|copilot|files|v2/uploads|auth|users/me)/'\
19-
'|apps/sim/app/api/workspaces/\[id\]/files/'\
20-
'|apps/sim/app/workspace/\[workspaceId\]/(home/|chat/|components/|layout\.tsx)'\
21-
'|apps/sim/app/(layout\.tsx|desktop/)'\
22-
'|apps/sim/stores/(chat|chat-panel|panel|mothership-[a-z-]+|tool-permission|terminal|copilot-terminal|browser-session)/'\
23-
'|apps/sim/hooks/(use-mothership|use-desktop|use-chat|queries/(mothership|desktop|copilot|chats))'\
24-
'|apps/sim/types/sim-desktop'\
25-
'|apps/sim/(proxy\.ts|next\.config\.ts|package\.json|instrumentation)'\
26-
'|bun\.lock$|package\.json$'\
27-
'|\.github/(workflows/(checks|ci)\.yml|scripts/desktop-live-changes\.sh|actions/))'
8+
unrelated='^(apps/docs/|apps/pii/|apps/sim/content/|packages/(python-sdk|ts-sdk)/)|\.mdx?$|(^|/)LICENSE$'
289

2910
base=${1:-}
3011
run() {
@@ -36,7 +17,8 @@ run() {
3617
git fetch --quiet --depth=1 origin "$base" || run "could not fetch $base"
3718
names=$(git diff --no-renames --name-only "$base" HEAD) || run "could not diff against $base"
3819
[ -n "$names" ] || run 'no changed files listed'
39-
printf 'Changed files:\n%s\n' "$names" >&2
40-
match=$(printf '%s\n' "$names" | grep -E -m 1 "$relevant") && run "a change touches a path it exercises: $match"
20+
if printf '%s\n' "$names" | grep -qvE "$unrelated"; then
21+
run 'a change may affect it'
22+
fi
4123
echo "changed=false"
42-
echo 'Skipping the live desktop suite: no change touches a path it exercises' >&2
24+
echo 'Skipping the live desktop suite: every change is unrelated to it' >&2

‎.github/workflows/checks.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,9 @@ jobs:
224224
if-no-files-found: ignore
225225
retention-days: 7
226226

227-
# Pull requests run the live desktop suite only when they touch a path it exercises (listed in
228-
# desktop-live-changes.sh), or when the diff cannot be worked out. Pushes always run it, so a
229-
# pull request that skipped it wrongly would first fail on staging, before anything deploys.
227+
# Pull requests skip the live desktop suite only when every change is clearly unrelated to the
228+
# app it drives (docs, other apps, published content). Anything else, and any failure to work
229+
# out the diff, runs it: a pull request that skipped it wrongly would first fail on staging.
230230
desktop-changes:
231231
name: desktop-changes
232232
runs-on: &runner-2vcpu ${{ (vars.CI_PROVIDER == '' || vars.CI_PROVIDER == 'blacksmith') && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }}

‎scripts/desktop-live-changes.test.ts‎

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function write(repo: string, file: string, content: string) {
1919
writeFileSync(join(repo, file), content)
2020
}
2121

22-
/** Builds a clone whose base commit holds `apps/desktop/x.ts` and whose origin is a local bare repo. */
22+
/** Builds a clone whose base commit holds `apps/sim/x.ts` and whose origin is a local bare repo. */
2323
function fixture() {
2424
const root = mkdtempSync(join(tmpdir(), 'desktop-live-changes-'))
2525
fixtures.push(root)
@@ -31,7 +31,7 @@ function fixture() {
3131
git(repo, 'config', 'user.name', 'Test')
3232
git(repo, 'config', 'commit.gpgsign', 'false')
3333
git(repo, 'remote', 'add', 'origin', origin)
34-
write(repo, 'apps/desktop/x.ts', 'export const x = 1\n'.repeat(20))
34+
write(repo, 'apps/sim/x.ts', 'export const x = 1\n'.repeat(20))
3535
git(repo, 'add', '-A')
3636
git(repo, 'commit', '--quiet', '-m', 'base')
3737
const base = git(repo, 'rev-parse', 'HEAD')
@@ -51,7 +51,7 @@ describe('desktop live change gate', () => {
5151
it('runs the suite when a live file moves into a skipped path', () => {
5252
const { repo, base } = fixture()
5353
mkdirSync(join(repo, 'apps/docs'), { recursive: true })
54-
git(repo, 'mv', 'apps/desktop/x.ts', 'apps/docs/x.ts')
54+
git(repo, 'mv', 'apps/sim/x.ts', 'apps/docs/x.ts')
5555
git(repo, 'commit', '--quiet', '-m', 'move')
5656

5757
const result = detect(repo, base)
@@ -70,28 +70,6 @@ describe('desktop live change gate', () => {
7070
expect(result.stdout.trim()).toBe('changed=false')
7171
})
7272

73-
it('skips the suite when an app change is outside every path it exercises', () => {
74-
const { repo, base } = fixture()
75-
write(repo, 'apps/sim/app/api/schedules/execute/route.ts', 'export const GET = () => null\n')
76-
git(repo, 'add', '-A')
77-
git(repo, 'commit', '--quiet', '-m', 'schedules')
78-
79-
const result = detect(repo, base)
80-
expect(result.status, result.stderr).toBe(0)
81-
expect(result.stdout.trim()).toBe('changed=false')
82-
})
83-
84-
it('runs the suite when a change touches the chat page', () => {
85-
const { repo, base } = fixture()
86-
write(repo, 'apps/sim/app/workspace/[workspaceId]/home/page.tsx', 'export default null\n')
87-
git(repo, 'add', '-A')
88-
git(repo, 'commit', '--quiet', '-m', 'chat page')
89-
90-
const result = detect(repo, base)
91-
expect(result.status, result.stderr).toBe(0)
92-
expect(result.stdout.trim()).toBe('changed=true')
93-
})
94-
9573
it('runs the suite when the base commit cannot be fetched', () => {
9674
const { repo } = fixture()
9775
const result = detect(repo, '0'.repeat(40))

0 commit comments

Comments
 (0)