Sfoglia il codice sorgente

test(windows): mark platform-only coverage branches

imccyu 2 mesi fa
parent
commit
588f4d948d

+ 1 - 0
packages/context/workspace-context/src/files.ts

@@ -459,6 +459,7 @@ export async function readScopeInstruction(
   signal?: AbortSignal,
 ): Promise<LoadedInstructionFile | undefined> {
   const content = await readBounded(file, maxSourceBytes, fileSystem, signal)
+  /* v8 ignore next -- Windows cannot reproduce a post-probe unreadable file with POSIX mode bits. */
   if (content === undefined) return undefined
   return {
     absolutePath: file.absolutePath,

+ 1 - 0
packages/context/workspace-context/src/state.ts

@@ -437,6 +437,7 @@ export async function reconcileInstructionContext(
     ) continue
 
     const file = await readScopeInstruction(probedFile, resolved.maxSourceBytes, fileSystem, options.signal)
+    /* v8 ignore next -- Windows cannot make the probed file unreadable through POSIX mode bits. */
     if (file === undefined) continue
     const currentDigest = instructionContentSha1(file.content)
     const nextVersion: InstructionVersionState = {

+ 1 - 0
packages/fs/fs-local/src/fsio.ts

@@ -175,6 +175,7 @@ export async function resolveLocalTarget(cwd: string, path: string): Promise<Loc
 function pathType(info: Stats | BigIntStats): PathInfo['type'] {
   if (info.isFile()) return 'file'
   if (info.isDirectory()) return 'directory'
+  /* v8 ignore next -- Windows does not expose Unix-domain socket paths as special filesystem entries. */
   return 'other'
 }
 

+ 1 - 0
packages/sandbox/sandbox/src/index.ts

@@ -110,6 +110,7 @@ declare module 'cordis' {
  */
 export abstract class SandboxProvider extends Service {
   constructor(ctx: Context) {
+    /* v8 ignore next -- Windows has no sandbox backend to instantiate this service. */
     super(ctx, 'sandbox')
   }
 

+ 5 - 0
packages/session-persistence/session-persistence-jsonl/src/index.ts

@@ -180,6 +180,7 @@ export class SessionPersistenceJsonl extends SessionPersistence implements Persi
     return header + '\n' + body + '\n'
   }
 
+  /* v8 ignore start -- Windows uses the Win32 durable-publish path; POSIX coverage exercises this peer. */
   private async materializePosix(dir: string, finalPath: string, id: SessionId, content: string): Promise<void> {
     await mkdir(this.root, { recursive: true, mode: 0o700 })
     await this.syncDirPosix(dirname(this.root))
@@ -213,6 +214,7 @@ export class SessionPersistenceJsonl extends SessionPersistence implements Persi
       /* v8 ignore next -- redundant temp link; publish already durable, rm failure is an unreachable IO edge */
     }
   }
+  /* v8 ignore stop */
 
   /* v8 ignore start -- native Windows coverage exercises this integration path */
   private async materializeWin32(dir: string, finalPath: string, id: SessionId, content: string): Promise<void> {
@@ -254,6 +256,7 @@ export class SessionPersistenceJsonl extends SessionPersistence implements Persi
   }
 
   /** fsync a POSIX directory so a just-created/renamed entry is crash-durable. */
+  /* v8 ignore start -- Windows uses write-through namespace operations; POSIX coverage exercises directory fsync. */
   private async syncDirPosix(dir: string): Promise<void> {
     const handle = await open(dir, 'r')
     try {
@@ -262,6 +265,7 @@ export class SessionPersistenceJsonl extends SessionPersistence implements Persi
       await handle.close()
     }
   }
+  /* v8 ignore stop */
 
   /**
    * Append and fsync event lines. On a partial write or sync failure, restore the
@@ -395,6 +399,7 @@ export class SessionPersistenceJsonl extends SessionPersistence implements Persi
         await this.assertLogParentAllowsAbsence(path)
         return false
       }
+      /* v8 ignore next -- Windows repairs ENOTDIR from ENOENT above; POSIX covers direct ENOTDIR. */
       throw error
     }
   }

+ 1 - 0
packages/skill/skill-local/src/index.ts

@@ -317,6 +317,7 @@ async function nodeEntryKind(fullPath: string, entry: { isDirectory(): boolean;
     const info = await stat(fullPath)
     if (info.isDirectory()) return 'directory'
     if (info.isFile()) return 'file'
+    /* v8 ignore next -- The special-file symlink fixture relies on POSIX /dev/null. */
     return undefined
   } catch (error) {
     ctx.logger.warn(`skill entry ${fullPath} ignored: failed to follow symbolic link: ${errorMessage(error)}`)