row331 r3: enable fixture pi and measure gate priority
This commit is contained in:
1 parent
0dd764d366
commit
e0578794ce
3 files changed
+107
No files matched your search
@@ -390,3 +390,36 @@ The driver explicitly set itself19 at startup and each child19 after spawn, but
|
||||
measured parent nice was19 on2 steps and16 on53 after host renicing. The raw log
|
||||
nice=19 header was a fixed string and is not measured evidence. No claim of
|
||||
continuous nice19. Preserve those raw bytes; fix instrumentation only for next run.
|
||||
|
||||
## 2026-10-25 — r3 fixture and receipts-tooling ruling (sage-4439)
|
||||
|
||||
Fixture-only repair: bootBusiness sets `doc.plugins = { ...doc.plugins, harness: ['pi'] }`
|
||||
before publishing its temporary business document. No assertion, timeout, other test
|
||||
file or product source changed. The original mkdir0700 remains. No test run.
|
||||
|
||||
No new invalid-harness test per Sage's ruling: it is an existing refusal, covered in
|
||||
packages/bus/tests/routes-verb.test.mjs:68, test 'row 65: a new launch binds only on a
|
||||
switched-on harness with a module name, and a run an earlier broker bound binds again
|
||||
after its harness is switched off'. Lines73/75/84 assert invalid-harness for disabled
|
||||
and malformed harnesses, including a new pi run when the second broker enables none.
|
||||
The same file:129 tests runtime's real harnessOn path against disabled cursor. These
|
||||
are existing code-named refusal assertions, not a claim they ran in r2 (which stopped
|
||||
earlier). Their file is in the frozen262 import list.
|
||||
|
||||
R3 runner is r3-gate.mjs; r2 tooling/raw logs stay unchanged as historical evidence.
|
||||
It writes os.getPriority measurements in the raw headers (driverNice and actual
|
||||
spawned-child nice), resets absolute19 for each step/child and records both measured
|
||||
values in receipts. Start/end uptime remains on every step. No fixed nice19 header;
|
||||
no assertion/timeout changes. Continuous priority after spawn is not claimed.
|
||||
|
||||
R3 plan: whole model-keys.test.mjs first as the authorized probe. Stop immediately
|
||||
if RED, with no patch/rerun. Only on a green probe, start all262 whole files again
|
||||
from file1, then test-config, then4mutants each restored with a whole-file positive
|
||||
control. This file's six integration assertions remain unreached after r2's setup
|
||||
refusal; another RED is possible in the probe. Await CLEAR after288 diagnostic and
|
||||
Poe330 diagnostic; no slot held now.
|
||||
|
||||
Frozen manifests unchanged: import-manifest SHA256
|
||||
a026f5637caf13bfac121b3fd6637e7052d1f90fa1a4114a94e59edf60344875;
|
||||
262-file run-list SHA256
|
||||
512d0c1c8823ff32a1c3308bd08950595e19ac87668fef3569be9c7aac3db674.
|
||||
@@ -0,0 +1,73 @@
|
||||
// sage-4439: whole-file r3 probe, then full gate; measured priority/load, unchanged test flags/timeouts.
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import os from 'node:os';
|
||||
import vm from 'node:vm';
|
||||
import { createHash } from 'node:crypto';
|
||||
import { execFileSync, spawn } from 'node:child_process';
|
||||
const root=process.cwd(),home=path.join(root,'agents/magica/work/queue-331');
|
||||
os.setPriority(0,19);
|
||||
const archive=execFileSync('mktemp',['-d','/mnt/storage/scratch/tmp/XXXXXX'],{encoding:'utf8'}).trim();
|
||||
const events=path.join(home,'r3-events.jsonl'),receipt=path.join(home,'r3-receipts.json');
|
||||
const candidate=execFileSync('git',['rev-parse','HEAD'],{encoding:'utf8'}).trim();
|
||||
fs.writeFileSync(events,'',{flag:'wx'});
|
||||
const rows=[];
|
||||
const uptime=()=>execFileSync('uptime',[],{encoding:'utf8'}).trim();
|
||||
const logEvent=e=>fs.appendFileSync(events,JSON.stringify(e)+'\n');
|
||||
const hash=b=>createHash('sha256').update(b).digest('hex');
|
||||
async function step(name,command,args,timeout=0){
|
||||
const temp=execFileSync('mktemp',['-d','/mnt/storage/scratch/tmp/XXXXXX'],{encoding:'utf8'}).trim();
|
||||
fs.mkdirSync(path.join(temp,'home'));fs.mkdirSync(path.join(temp,'config'));
|
||||
const env={...process.env,TMPDIR:temp,HOME:path.join(temp,'home'),MOSAIC_CONFIG:path.join(temp,'config/config.json')};
|
||||
for(const key of ['OPENAI_API_KEY','ANTHROPIC_API_KEY','ANTHROPIC_AUTH_TOKEN','CLAUDE_CODE_OAUTH_TOKEN','OPENROUTER_API_KEY','ZAI_API_KEY','MOSAIC_BUS_CAP'])delete env[key];
|
||||
os.setPriority(0,19);
|
||||
const before={name,event:'start',at:new Date().toISOString(),uptime:uptime(),TMPDIR:temp,nice:os.getPriority(0)};
|
||||
logEvent(before);
|
||||
const file=path.join(archive,String(rows.length+1).padStart(3,'0')+'-'+name.replaceAll('/','_')+'.log');
|
||||
const fd=fs.openSync(file,'wx',0o600);
|
||||
const measuredDriverNice=os.getPriority(0);fs.writeSync(fd,'driverNice='+measuredDriverNice+'\n');
|
||||
let timer,timedOut=false;
|
||||
const child=spawn(command,args,{cwd:root,env,stdio:['ignore',fd,fd]});
|
||||
let measuredChildNice=null;
|
||||
if(child.pid){os.setPriority(child.pid,19);measuredChildNice=os.getPriority(child.pid);}
|
||||
fs.writeSync(fd,'nice='+String(measuredChildNice)+'\n');fs.closeSync(fd);
|
||||
if(timeout)timer=setTimeout(()=>{timedOut=true;child.kill('SIGTERM');},timeout);
|
||||
const outcome=await new Promise(resolve=>{child.once('error',error=>resolve({rc:1,error:error.code}));child.once('close',(code,signal)=>resolve({rc:code??1,signal}));});
|
||||
clearTimeout(timer);
|
||||
const endLoad=uptime(),bytes=fs.readFileSync(file),text=bytes.toString();
|
||||
const count=key=>Number(new RegExp('^# '+key+' (\\d+)$','m').exec(text)?.[1]??0);
|
||||
const shell=/selftest: (\d+) passed, (\d+) failed/.exec(text);
|
||||
const row={...before,measuredDriverNice,measuredChildNice,event:'end',endAt:new Date().toISOString(),endUptime:endLoad,...outcome,timedOut,
|
||||
tests:shell?Number(shell[1])+Number(shell[2]):count('tests'),pass:shell?Number(shell[1]):count('pass'),fail:shell?Number(shell[2]):count('fail'),skipped:count('skipped'),cancelled:count('cancelled'),
|
||||
failedNames:text.split('\n').filter(s=>s.startsWith('not ok ')).map(s=>s.replace(/^not ok \d+ - /,'')),log:{path:file,sha256:hash(bytes),bytes:bytes.length}};
|
||||
rows.push(row);logEvent(row);fs.writeFileSync(receipt,JSON.stringify({clear:'r3 CLEAR pending',candidate,archive,rows},null,2)+'\n');
|
||||
process.stdout.write(`${name} rc=${row.rc} pass=${row.pass} fail=${row.fail} skip=${row.skipped} start=[${row.uptime}] end=[${endLoad}]\n`);
|
||||
return row;
|
||||
}
|
||||
const testArgs=file=>['--test','--test-reporter=tap',path.join(root,file)];
|
||||
const sourceFile=path.join(root,'packages/bus/src/model-keys.mjs'),original=fs.readFileSync(sourceFile,'utf8');
|
||||
try{
|
||||
const probe=await step('probe-model-keys',process.execPath,testArgs('packages/bus/tests/model-keys.test.mjs'));
|
||||
if(probe.rc!==0)throw Error('RED whole-file model-keys probe; full gate not started');
|
||||
const list=fs.readFileSync(path.join(home,'green-files.txt'),'utf8').trim().split('\n');
|
||||
if(list.length!==262||list.includes('packages/cli/tests/case1-accept.test.mjs'))throw Error('frozen list mismatch');
|
||||
for(const file of list){const row=await step(file,process.execPath,testArgs(file));if(row.rc!==0)throw Error('RED '+file);}
|
||||
const shell=await step('scripts/test-config.sh','timeout',['-k','10','1800',path.join(root,'scripts/test-config.sh')]);
|
||||
if(shell.rc!==0)throw Error('RED scripts/test-config.sh');
|
||||
const helper=fs.readFileSync(path.join(home,'mutants.mjs'),'utf8');
|
||||
const start=helper.indexOf('const cases = ')+14,end=helper.indexOf('\nos.setPriority',start);
|
||||
const cases=vm.runInNewContext('('+helper.slice(start,end).trim().replace(/;$/,'')+')');
|
||||
for(const m of cases){
|
||||
if(original.split(m.from).length!==2)throw Error('mutation anchor not unique '+m.name);
|
||||
let result;
|
||||
try{fs.writeFileSync(sourceFile,original.replace(m.from,m.to));result=await step('mutant-'+m.name,process.execPath,testArgs('packages/bus/tests/model-keys.test.mjs'),180000);}
|
||||
finally{fs.writeFileSync(sourceFile,original);}
|
||||
const killed=result.rc!==0&&!result.timedOut&&result.failedNames.some(name=>name===m.failure);
|
||||
logEvent({event:'mutant-result',name:m.name,killed,restoredSha256:hash(fs.readFileSync(sourceFile))});
|
||||
if(!killed)throw Error('mutant not killed by named behavior '+m.name);
|
||||
const positive=await step('positive-'+m.name,process.execPath,testArgs('packages/bus/tests/model-keys.test.mjs'),180000);
|
||||
if(positive.rc!==0)throw Error('RED positive control '+m.name);
|
||||
}
|
||||
logEvent({event:'complete',at:new Date().toISOString(),uptime:uptime()});
|
||||
}catch(error){logEvent({event:'stopped',reason:error.message,at:new Date().toISOString(),uptime:uptime()});process.stdout.write(error.message+'\n');process.exitCode=1;}
|
||||
finally{if(fs.readFileSync(sourceFile,'utf8')!==original)fs.writeFileSync(sourceFile,original);}
|
||||
@@ -174,6 +174,7 @@ test('proxy-stop-failed: old proxy key and retiring record survive a failed grac
|
||||
|
||||
async function bootBusiness(f) {
|
||||
const rolesDir = rolesCopy(f.root), system = systemFor(f.root), doc = businessDoc(f.root, 'demo');
|
||||
doc.plugins = { ...doc.plugins, harness: ['pi'] };
|
||||
doc.roles['sec-1'] = { definition: 'security-reviewer' }; doc.launch.instances.push('sec-1');
|
||||
const file = writeJson(join(f.configDir, 'businesses', 'demo.json'), doc);
|
||||
fs.writeFileSync(join(f.configDir, 'secrets', 'proxy-management.key'), 'fx331-manage', { mode: 0o600 });
|
||||
|
||||
Reference in new issue
Block a user