Gate checkpoint browser tests on an explicit owned instance

Why: Unrelated browser suites should skip this opt-in runtime acceptance instead of importing an absent manifest.

Evidence: Playwright discovers the two tests without an instance; explicit owned-instance replay passed previously.

Impact: Preserves strict manifest verification when invoked.

Refs: fast-slow-u2-u3 Task 7
This commit is contained in:
2026-10-13 03:16:25 +00:00
parent 75a420210d
commit c63f6c7470
+3 -3
View File
@@ -3,9 +3,9 @@ import { readFileSync, readlinkSync } from 'node:fs'
import { createHash } from 'node:crypto'
const manifestPath=process.env.WORK_CHECKPOINT_HTTP_MANIFEST
if(!manifestPath)throw new Error('Explicit task-owned mechanism instance manifest required')
const manifest=JSON.parse(readFileSync(manifestPath,'utf8'))
if(manifest.mode!=='mechanism'||!manifest.dataDir.includes('fast-slow-u2-u3-')||readlinkSync(`/proc/${manifest.pid}/exe`)!==manifest.binary||createHash('sha256').update(readFileSync(manifest.binary)).digest('hex')!==manifest.binarySHA256)throw new Error('Owned mechanism instance verification failed')
test.skip(!manifestPath,'Run explicitly with a task-owned mechanism instance manifest')
const manifest=manifestPath?JSON.parse(readFileSync(manifestPath,'utf8')):null
if(manifest&&(manifest.mode!=='mechanism'||!manifest.dataDir.includes('fast-slow-u2-u3-')||readlinkSync(`/proc/${manifest.pid}/exe`)!==manifest.binary||createHash('sha256').update(readFileSync(manifest.binary)).digest('hex')!==manifest.binarySHA256))throw new Error('Owned mechanism instance verification failed')
async function setup(request:any){
const project=await(await request.post(manifest.base+'/api/projects',{data:{name:'browser-'+Date.now()}})).json()