@@ -6,6 +6,8 @@ import { deriveStartupHealth, startupHealthSummary } from "../../src/codex/autos
66import { desktopStartupOwnership , diagnoseDesktopStartup , diagnoseLinuxDesktopStartup } from "../../src/service/desktop-startup" ;
77import type { ServiceOwnershipResolution } from "../../src/service/state" ;
88
9+ // Fixtures use POSIX paths, execute bits and symlinks, and the diagnostic only runs on Linux.
10+ const linuxTest = test . skipIf ( process . platform === "win32" ) ;
911const roots : string [ ] = [ ] ;
1012afterEach ( ( ) => { for ( const root of roots . splice ( 0 ) ) rmSync ( root , { recursive : true , force : true } ) ; } ) ;
1113
@@ -53,7 +55,7 @@ const healthBase = {
5355 serviceConflict : false , serviceSupported : true , shimInstalled : false , shimHealthy : false ,
5456} ;
5557
56- test ( "matching install, XDG login entry and the app supervising its sidecar grant desktop protection on Linux" , ( ) => {
58+ linuxTest ( "matching install, XDG login entry and the app supervising its sidecar grant desktop protection on Linux" , ( ) => {
5759 const { deps } = fixture ( ) ;
5860 const desktop = diagnoseLinuxDesktopStartup ( deps ) ;
5961 expect ( desktop ) . toEqual ( { owned : true , loginEnabled : true , running : true , viable : true } ) ;
@@ -63,7 +65,7 @@ test("matching install, XDG login entry and the app supervising its sidecar gran
6365 expect ( startupHealthSummary ( health ) ) . toBe ( "protected by desktop app at login and its proxy supervisor" ) ;
6466} ) ;
6567
66- test ( "a relocated XDG_CONFIG_HOME is not credited: the HOME-based entry is outside its autostart path" , ( ) => {
68+ linuxTest ( "a relocated XDG_CONFIG_HOME is not credited: the HOME-based entry is outside its autostart path" , ( ) => {
6769 const f = fixture ( ) ;
6870 const moved = join ( f . home , "xdg" ) ;
6971 mkdirSync ( join ( moved , "com.opencodex.desktop" ) , { recursive : true } ) ;
@@ -79,7 +81,7 @@ Exec=${f.app} --autostart
7981} ) ;
8082
8183for ( const field of [ "OnlyShowIn=GNOME;" , "NotShowIn=GNOME;" , "TryExec=/missing" , "OnlyShowIn=" , "NotShowIn=" , "TryExec=" ] ) {
82- test ( `conditional autostart entry is not credited: ${ field } ` , ( ) => {
84+ linuxTest ( `conditional autostart entry is not credited: ${ field } ` , ( ) => {
8385 const f = fixture ( ) ; f . entry ( `${ f . app } --autostart` , `\n${ field } ` ) ;
8486 expect ( diagnoseLinuxDesktopStartup ( f . deps ) ) . toMatchObject ( { owned : true , loginEnabled : false , viable : false } ) ;
8587 } ) ;
@@ -94,7 +96,7 @@ for (const command of [
9496 ( app : string ) => `${ app . replace ( "/usr/" , "/has space/usr/" ) } --autostart` ,
9597 ( app : string ) => `${ app } --autostart extra` ,
9698] ) {
97- test ( `ambiguous Exec is not credited: ${ command ( "/usr/opencodex-desktop" ) } ` , ( ) => {
99+ linuxTest ( `ambiguous Exec is not credited: ${ command ( "/usr/opencodex-desktop" ) } ` , ( ) => {
98100 const f = fixture ( ) ;
99101 // Make the literal path real so rejection tests parsing, not a missing executable.
100102 const exec = command ( f . app ) ;
@@ -111,7 +113,7 @@ for (const command of [
111113 } ) ;
112114}
113115
114- test ( "an opencodex-desktop symlink to another executable cannot grant protection" , ( ) => {
116+ linuxTest ( "an opencodex-desktop symlink to another executable cannot grant protection" , ( ) => {
115117 const f = fixture ( ) ;
116118 const target = join ( f . home , "usr" , "bin" , "sh" ) ;
117119 writeFileSync ( target , "fixture" ) ; chmodSync ( target , 0o700 ) ;
@@ -120,7 +122,7 @@ test("an opencodex-desktop symlink to another executable cannot grant protection
120122 expect ( diagnoseLinuxDesktopStartup ( f . deps ) ) . toMatchObject ( { owned : true , loginEnabled : false , viable : false } ) ;
121123} ) ;
122124
123- test ( "a desktop symlink uses the ocx beside its resolved executable" , ( ) => {
125+ linuxTest ( "a desktop symlink uses the ocx beside its resolved executable" , ( ) => {
124126 const f = fixture ( ) ;
125127 const alias = join ( f . home , "alias" , "opencodex-desktop" ) ;
126128 mkdirSync ( join ( alias , ".." ) ) ; symlinkSync ( f . app , alias ) ; f . entry ( `${ alias } --autostart` ) ;
@@ -131,7 +133,7 @@ test("a desktop symlink uses the ocx beside its resolved executable", () => {
131133 expect ( diagnoseLinuxDesktopStartup ( f . deps ) ) . toMatchObject ( { owned : true , viable : false } ) ;
132134} ) ;
133135
134- test ( "AppImage registration cannot credit the executable running inside its mount" , ( ) => {
136+ linuxTest ( "AppImage registration cannot credit the executable running inside its mount" , ( ) => {
135137 const f = fixture ( ) ;
136138 const image = join ( f . home , "OpenCodex.AppImage" ) ;
137139 writeFileSync ( image , "fixture" ) ; chmodSync ( image , 0o700 ) ; f . entry ( `${ image } --autostart` ) ;
@@ -163,7 +165,7 @@ const changes: [string, (f: F) => void][] = [
163165 [ "ownership" , f => { f . state . owner = { kind : "none" , revision : 2 } ; } ] ,
164166] ;
165167for ( const [ name , mutate ] of changes ) {
166- test ( `final evidence read fails closed after ${ name } changes` , ( ) => {
168+ linuxTest ( `final evidence read fails closed after ${ name } changes` , ( ) => {
167169 const f = fixture ( ) ;
168170 const original = f . deps . ownership ;
169171 let changed = false ;
@@ -178,7 +180,7 @@ for (const [name, mutate] of changes) {
178180 } ) ;
179181}
180182
181- test ( "failed identity, login entry or process evidence retains the durable desktop claim" , ( ) => {
183+ linuxTest ( "failed identity, login entry or process evidence retains the durable desktop claim" , ( ) => {
182184 type F = ReturnType < typeof fixture > ;
183185 const mutations : ( ( f : F ) => void ) [ ] = [
184186 f => writeFileSync ( f . idPath , "different-install" ) ,
@@ -204,7 +206,7 @@ test("failed identity, login entry or process evidence retains the durable deskt
204206 }
205207} ) ;
206208
207- test ( "Linux desktop ownership never recommends the service it superseded" , ( ) => {
209+ linuxTest ( "Linux desktop ownership never recommends the service it superseded" , ( ) => {
208210 const f = fixture ( ) ;
209211 expect ( desktopStartupOwnership ( f . deps ) ) . toEqual ( { owned : true , loginEnabled : false , running : false , viable : false } ) ;
210212 f . state . pid = null ;
@@ -214,7 +216,7 @@ test("Linux desktop ownership never recommends the service it superseded", () =>
214216 expect ( startupHealthSummary ( health ) ) . not . toContain ( "ocx service" ) ;
215217} ) ;
216218
217- test ( "other platforms and absent, CLI or unknown ownership cannot grant Linux desktop protection" , ( ) => {
219+ linuxTest ( "other platforms and absent, CLI or unknown ownership cannot grant Linux desktop protection" , ( ) => {
218220 const f = fixture ( ) ;
219221 expect ( diagnoseLinuxDesktopStartup ( { ...f . deps , platform : "win32" } ) ) . toBeUndefined ( ) ;
220222 expect ( f . state . ownerReads ) . toBe ( 0 ) ;
0 commit comments