@skyramp/testbot-core 0.13.3-v3.548 → 0.13.3-v3.549

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/VERSION.json CHANGED
@@ -1 +1 @@
1
- {"version":"0.13.3-v3.548","commit":"2ebc13c1ff044927b0e05765d0c54a628ca3d1bb"}
1
+ {"version":"0.13.3-v3.549","commit":"03d272a2e2ec746b7fc5e17d9a3ff05ca449cd9a"}
package/dist/main.js CHANGED
@@ -698,7 +698,7 @@ gradle.taskGraph.whenReady { graph ->
698
698
  `;function kzr(e,t,r){let n=Qr.join(t,"testbot-rerun-tests.gradle");return dn.mkdirSync(t,{recursive:!0}),dn.writeFileSync(n,Rzr(r)),[e[0],"--init-script",n,...e.slice(1)]}function QTt(e,t){if(!dn.statSync(e).isDirectory())return gae(dn.readFileSync(e,"utf-8"),t);let r=dn.readdirSync(e,{recursive:!0}).filter(n=>n.endsWith(".xml")).sort();if(!r.length)throw new Error(`the report directory ${Qr.basename(e)} holds no XML file`);return r.flatMap(n=>gae(dn.readFileSync(Qr.join(e,n),"utf-8"),t))}var Tzr=/Please switch from -n\/--name to -i\/--include/;function jTt(e){let t=!1,r=e.map(n=>{if(n==="-n"||n==="--name")return t=!0,n==="-n"?"-i":"--include";let s=n.match(/^(--name=|-n)(.+)$/);return s&&(s[1]==="--name="||/^[/=]/.test(s[2]))?(t=!0,`${s[1]==="--name="?"--include=":"-i"}${s[2]}`):n});return t?r:void 0}var PTt=/^\s*(at\s|from\s|\.\.\.\s*\d+\s+more)/,_Te=/(?<!\b0\s)(error|exception)\b|(?<!\b0\s)\b(fatal|failed|failure|cannot|could not|not found|no such)\b|^[\w./\\-]+\.\w+:\d+(:\d+)?:\s/i,_zr=/^(\[[^\]]*\]|❯)/,Zx=(e,t)=>{let r=l=>l.replace(/\[[^\]]*\]/g,"").trim(),n=Lt(nf(e),t).split(`
699
699
  `).map(l=>l.trim()),s=l=>!!l&&!PTt.test(l)&&!_zr.test(l)&&!_Te.test(l),i=[];for(let l=0;l<n.length;l++){if(!r(n[l])||PTt.test(n[l]))continue;let d=n[l];if(_Te.test(r(d)))for(let p=0;p<5&&s(n[l+1]);p++)d+=` ${n[++l]}`;i.push(d)}let o=[...new Set(i.filter(l=>_Te.test(r(l))))].slice(-2),a=o.length?o:i.slice(-3),c=new Map,u=600-3*(a.length-1);return[...a.keys()].sort((l,d)=>a[l].length-a[d].length).forEach((l,d)=>{c.set(l,Math.min(a[l].length,Math.floor(u/(a.length-d)))),u-=c.get(l)}),a.map((l,d)=>l.slice(0,c.get(d))).join(" | ")};function Fw(e){let{repo:t,declared:r,report:n,recipes:s,env:i}=e,o=e.secrets??[],a=Qr.resolve(t,r.cwd),c={argv:r.argv,exitCode:-1,durationMs:0,reported:!1,cases:[],output:""},u=fh(t,r,o);if(u.length)return{...c,setup:`its run ${u[0]}`};let l=eQ(t,r.cwd,r.argv,s,i),{job:d,ciJob:p,ciEnv:f,tools:h,prerequisiteEnv:g}=l,y=Grt(r,n),m=BTe(t,d,i),A=r.report?.reporter?iTt(r.report.reporter,n,i.assets,{...process.env,...f}):{};if(l.missing)return{...c,ciJob:p,setup:`its run cannot start: ${l.missing}`};let w=y4.test(y[0]??"")?xzr(t,a,i,e.uid):void 0;if(w)return{...c,ciJob:p,setup:`its run cannot start: ${w}`};let E={...f,...m?.env??{},...zrt(r,n),...h.env,...A,...g,...i.overrides??{}};y9(E,l),dn.rmSync(n,{recursive:!0,force:!0}),NTt.test(y[0]??"")&&(y=kzr(y,Qr.dirname(n),n));let C=Q=>Object.keys(E).length?i.run(Q,a,E):i.run(Q,a),x=Date.now(),S=C(y),k=g0(r),N=!mTe(k,n,S.output)&&Tzr.test(S.output)?jTt(y):void 0;N&&(y=N,S=C(y)),NTt.test(y[0]??"")&&dn.statSync(n,{throwIfNoEntry:!1})?.isDirectory()&&!dn.readdirSync(n,{recursive:!0}).some(Q=>Q.endsWith(".xml"))&&dn.rmSync(n,{recursive:!0,force:!0});let B=k==="junit"&&!dn.existsSync(n)&&y4.test(y[0]??"")?LTt(a,x-1e3,n):0,P={argv:y,exitCode:S.status,durationMs:Date.now()-x,reported:mTe(k,n,S.output),cases:[],output:S.output,...B?{readFrom:`${B} report file(s) from the build's own report directory`}:{},...p?{ciJob:p}:{},...m?{services:m}:{},...Che.test(S.output)&&l.jdk()?{jdk:l.jdk()}:{},...h.missing.length?{toolsMissing:`${BTt(h.missing,p,Q=>qTt(Q.tool,Q.version))}, which this runner does not have${l.ranOn?`: its tests ran on ${l.ranOn}`:""}`}:{}};if(!P.reported&&h.missing.length)return{...P,setup:`blocked by the environment: ${BTt(h.missing,p)}, which this runner does not have (${Zx(S.output,o)}). Add it before the Testbot step:
700
700
  ${Dw(h.missing)}`};if(!P.reported)return{...P,note:`the runner wrote no report: ${Zx(S.output,o)}`};try{P.cases=oTt(k,n,S.output,Q=>QTt(Q,o),o)}catch(Q){return P.note=`the report could not be read: ${Q instanceof Error?Q.message:String(Q)}`,P}return S.status!==0&&!P.cases.some(Q=>Q.status==="fail"||Q.status==="error")&&(P.note=`the runner exited ${S.status} with no failing test: ${Zx(S.output,o)}`,P.cases=[]),P}var qTt=(e,t)=>e==="java"?`JDK ${oc(t??"")?.[0]??t}`:`${e} ${t}`;function BTt(e,t,r=n=>`${n.tool} ${n.version}`){return e.map(n=>`${n.declaredBy?`${n.declaredBy} declares`:`${t??"the CI job"} sets up`} ${r(n)}`).join(", ")}var Nzr=["jest","vitest","npm-test","playwright"],Pzr=(e,t)=>e.some(r=>r.tool===t&&r.version);function NTe(e,t,r,n,s){let i=(u,l)=>(!r||u.includes(r))&&!Pzr(n,l),o=i(Nzr,"node")?d9(e,Qr.resolve(e,t),s):[],a=i(["maven","gradle"],"java")?mTt(e,t,s):[],c=i(["minitest","rspec"],"ruby")?gTt(e,t,s):{steps:[]};return{steps:[...n,...o,...a,...c.steps],...c.missing?{missing:c.missing}:{}}}var $Tt=new WeakMap;function eQ(e,t,r,n,s){let i=PTe(n,t,r,s),o=Gd(r.join(" ")),a=i?{...i.env}:KL(n,t,o&&o!=="other"?[o]:[]),c=xN(s.run,Qr.resolve(e,t)),u=vTe.includes(Qr.basename(r[0]??""))&&o!=="rspec",l=NTe(e,t,u?"minitest":o??"other",i?.toolSteps??[],c),d=Jx(l.steps,process.env,void 0,c);for(let S of d.notes)s.notes.includes(S)||s.notes.push(S);let p=d.missing[0],f=p?c(p.tool):void 0,h=p&&f?qTt(p.tool,f):void 0,g=d.env.JAVA_HOME?l.steps.find(S=>S.tool==="java"&&S.version&&!d.missing.includes(S)):void 0,y=()=>oc(g?.version??c("java")??"")?.[0],m={},A=(S,k,N)=>{let B=y9({...d.env,...N??{}},{tools:d,prerequisiteEnv:N??{}});return Object.keys(B).length?s.run(S,k,B):s.run(S,k)},w=$Tt.get(s)??$Tt.set(s,new Map).get(s),E=[Qr.resolve(e,t),r[0],d.env.PATH??""].join("\0"),C=()=>{let S=w.get(E);if(S)return void Object.assign(m,S);let k=yTt(e,t,r,A,s.notes,m,s.assets);return k||w.set(E,{...m}),k},x=ATt(e,t,r,s.run)??l.missing??(s.provision?C():void 0);return{...i?{job:i,ciJob:`${i.workflow} job ${i.job}`}:{},ciEnv:a,tools:d,prerequisiteEnv:m,...x?{missing:x}:{},...h?{ranOn:h}:{},jdk:y}}function PTe(e,t,r,n){let s=vy(e,t,r),i=s?void 0:`provisioning: ${r9(e,t,r)}, so no CI job's services are started for it`;return i&&!n.notes.includes(i)&&(n.notes.push(i),n.log?.(i)),s}function BTe(e,t,r){if(!t||r.services===!1)return;let n=s9({outputsDir:r.outputsDir,provision:r.provision,run:r.run,notes:r.notes,deadlineMs:r.deadlineMs},e,t),{failed:s}=n;return{job:t,env:n.env,...s?r.provision?{failed:s}:{unstarted:s}:{}}}function y9(e,t){return t.tools.bins.length&&t.prerequisiteEnv.PATH&&(e.PATH=[...t.tools.bins,t.prerequisiteEnv.PATH].join(Qr.delimiter)),e}function $Te(e,t,r){let n=QW(e,t,r.repo);if(n&&jW.test(n.message??""))return`could not set up its package here: ${OTe(n)}`;let s=Rb(e,{file:t},r);if("error"in s&&s.named)return s.error;if(!("error"in s?e.length>0:s.length>0||n!==void 0))return`reports none of its tests (it reported ${e.length} test(s))`}var OTe=e=>(e.message??e.name).replace(/\s+/g," ").trim().slice(0,300);var Bzr="write-ci-notes",tQ="ci-collect",GTt=12e4,$zr=5e3,Ozr=5*6e4;function WTt(e){return Kt(e.inputs)?e.inputs.sharedEnvironment?.environmentAddress:void 0}function JTt(e,t){return!!t&&e.change==="added"&&!!e.guardedDelivery}var DTe=e=>e.replace(/\s+/g," ").trim(),zTt=e=>e.split(Wo.sep).join("/"),HTt=e=>e.toLowerCase().split(/\s+/).map(t=>t.replace(/^["'`(]+|["'`),;]+$/g,"").replace(/\/+$/,"")).filter(Boolean).map(t=>t.slice(t.lastIndexOf("/")+1)),Dzr=e=>new Set(e.toLowerCase().split(/[^a-z0-9_-]+/).filter(Boolean));function VTt(e,t){let r=HTt(t),n=HTt(e);return r.length?n.some((s,i)=>r.every((o,a)=>n[i+a]===o))||r.length===1&&Dzr(e).has(r[0]):!1}function Mzr(e,t,r,n,s){let i=zTt(Wo.relative(t,Wo.resolve(t,n))),o=zTt(Wo.relative(Wo.resolve(t,n),Wo.resolve(t,r)));for(let a of e.replace(/\\/g,"/").split(/[\s"'`()<>|,]+/)){let c=a.split(":")[0].replace(/^\.\//,"");if(c&&(c===r||c===o||c.includes("/")&&(r.endsWith(`/${c}`)||o.endsWith(`/${c}`))||wq(r,c,i,s)))return!0}return!1}function YTt(e,t){let r=DTe(t),n=s=>s.endsWith(r)&&(s.length===r.length||/[^\w-]/.test(s[s.length-r.length-1]));return!!r&&e.split(`
701
- `).some(s=>n(DTe(s))||n(DTe(s).replace(/[,;]$/,"")))}function Fzr(e,t,r,n){if(r.length<t.length)return`shows no line of that CI job starting ${t.slice(r.length).join(", ")}`;let s=new Set(n.map(i=>i.file.trim()));for(let i of r){if(!s.has(i.file.trim()))return`ci.starts names ${i.file}, which is not a file of ci.steps: quote the line from the CI job that runs it`;let o=ZTt(e,i.file);if(o===void 0)return`ci.starts names ${i.file}, which is not a file of its checkout`;if(!YTt(o,i.line))return`${i.file} has no line ending ${JSON.stringify(i.line)}`}}function KTt(e,t,r=!1,n){if(JTt(e,n))return{needs:[],errs:[]};let s=e.ci,i=(s.needs??[]).map(l=>l.trim()).filter(Boolean),o=[],a=[...new Set(e.result.cases.flatMap(l=>l.runtimeTargets??[]))];a.length&&!i.length&&o.push(`${e.file}: its run called ${a.join(", ")}, so it needs the running app \u2014 name what it needs running outside its own process under ci.needs`),!s.collected&&i.length&&r&&(!s.steps?.length||!s.list)&&o.push(`${e.file}: it needs ${i.join(", ")}, and ci says the repo's CI does not collect it \u2014 show it: under ci.steps the line in a CI file that starts the repo's tests and each line on the way to the runner, ci.runner, and under ci.list a command that lists what that runner collects; Testbot runs it, and its output must not name this file`);let c=s.collected&&i.length?Fzr(t,i,s.starts??[],s.steps??[]):void 0;if(!c)return{needs:i,errs:o};let u=`${e.file}: the repo's CI runs it, and ${c}`;return o.push(`${u} \u2014 put it in a CI job that starts what it needs and quote those lines under ci.starts; with no such job, move it where the repo's CI does not collect it, say ci.collected false and show it with ci.steps, ci.runner and a ci.list whose output does not name it, and give in ciNotes the CI change that would start them and run it`),{needs:i,errs:o,unprovisioned:u}}function ZTt(e,t){let r=Wo.resolve(e,t.trim());if(!(!r.startsWith(Wo.resolve(e)+Wo.sep)||!_N.statSync(r,{throwIfNoEntry:!1})?.isFile()))return _N.readFileSync(r,"utf-8")}function Uzr(e,t){let r=[],n=[],s=e.ciNotes??"";for(let i of e.tests){if(i.change!=="added"&&i.change!=="updated")continue;let o=i.ci;if(!o){r.push(`${i.file}: say under "ci" whether the repo's CI will run it, and how you know`),n.push({file:i.file,verdict:"unconfirmed",detail:"write did not say whether the repo's CI runs it"});continue}let{root:a,rel:c}=t.place(i.file),u=KTt(i,a,!1,t.testEnvironment),l=u.needs;r.push(...u.errs);let d=l.length?{needs:l}:{},p=JTt(i,t.testEnvironment),f=l.length?`it needs ${l.join(", ")}`:"it is a guarded node:test entry, which only node --test can run",h=!1;if(!o.collected){let P=[i.file,c,Wo.posix.basename(c)].some(Q=>s.includes(Q));if(o.why?.trim()?P||r.push(`${i.file}: ci says the repo's CI will not run it, and ciNotes does not name it \u2014 name it there with the exact change the author must make for CI to run it`):r.push(`${i.file}: ci says the repo's CI will not run it \u2014 say why under ci.why`),!l.length&&!p||!t.ciTests?.(a)){n.push({file:i.file,verdict:"not-collected",detail:o.why?.trim(),...d});continue}if(h=!0,!o.steps?.length||!o.list){let Q=`${i.file}: ${f}, and ci says the repo's CI does not collect it \u2014 show it: under ci.steps the line in a CI file that starts the repo's tests and each line on the way to the runner, ci.runner, and under ci.list a command that lists what that runner collects; Testbot runs it, and its output must not name this file`;r.push(Q),n.push({file:i.file,verdict:"unconfirmed",detail:Q,...d});continue}}let g=o.steps??[];if(u.unprovisioned){n.push({file:i.file,verdict:"unprovisioned",detail:u.unprovisioned,needs:l});continue}let y=r.length;g.length||r.push(`${i.file}: ci.steps is missing \u2014 quote the line in a CI file that starts the tests, then each line it runs on the way to the test runner`);for(let P of g){let Q=ZTt(a,P.file);Q===void 0?r.push(`${i.file}: ci.steps names ${P.file}, which is not a file of its checkout`):YTt(Q,P.line)||r.push(`${i.file}: ${P.file} has no line ending ${JSON.stringify(P.line)} \u2014 quote each line exactly, from where its command starts`)}let m=o.list,A=o.runner?.trim().toLowerCase()??"",w=g[g.length-1];A?w&&!VTt(w.line,A)?r.push(`${i.file}: the last line of ci.steps (${JSON.stringify(w.line)}) does not start ${o.runner} \u2014 follow the lines on until one does`):m&&!VTt(m.argv.join(" "),A)&&r.push(`${i.file}: ci.list does not run ${o.runner} \u2014 list with the runner those lines start`):r.push(`${i.file}: ci.runner is missing \u2014 name the test runner the last of those lines starts`);let E=m?NM(a,m,t.secrets):[];if(m?E.length&&r.push(`${i.file}: ci.list ${E[0]}`):r.push(`${i.file}: ci.list is missing \u2014 give a command that lists the tests that runner collects without running them`),r.length>y||!m){n.push({file:i.file,verdict:"unconfirmed",detail:r[r.length-1]});continue}let C=`\`${m.argv.join(" ")}\` (from ${m.cwd})`,x=t.list(a,m,c);if("skipped"in x){n.push({file:i.file,verdict:"unconfirmed",detail:`${C} ${x.skipped}`}),x.skipped.startsWith("could not start")&&r.push(`${i.file}: ${C} ${x.skipped} \u2014 run it the way you run your tests`);continue}let S=t.files?.(a),k=Mzr(x.output,a,c,m.cwd,S);if(k&&h&&p){let P=`${i.file}: ci says the repo's CI does not collect it, but ${C} names it, and ${f}`;r.push(`${P} \u2014 put it where that runner does not collect it`),n.push({file:i.file,verdict:"unconfirmed",detail:P});continue}if(k&&h){let P=`${i.file}: ci says the repo's CI does not collect it, but ${C} names it, and that job starts none of ${l.join(", ")}`;r.push(`${P} \u2014 put it where that runner does not collect it, and give in ciNotes the CI change that would start them and run it`),n.push({file:i.file,verdict:"unprovisioned",detail:P,needs:l});continue}if(k){n.push({file:i.file,verdict:"confirmed"});continue}let N=Zx(x.output,t.secrets??[]);if(h&&x.status===0){n.push({file:i.file,verdict:"not-collected",detail:o.why?.trim(),...d});continue}if(x.status!==0){let P=`${C} exited ${x.status}: ${N} \u2014 give a command that lists what that runner collects`;r.push(`${i.file}: ${P}`),n.push({file:i.file,verdict:"unconfirmed",detail:P});continue}if(t.files&&!S){n.push({file:i.file,verdict:"unconfirmed",detail:`${C} ran, but the checkout's files could not be listed to match a shorter path it prints: ${N}`});continue}let B=`${C} ran, but its output does not name it: ${N} \u2014 if that runner does not collect it, say so under ci`;r.push(`${i.file}: ${B}`),n.push({file:i.file,verdict:"disproved",detail:B})}return{errs:r,checks:n}}function Uw(e,t){let r=new Set(t.tests.map(n=>n.file));return(le(e,`${tQ}.json`)?.checks??[]).filter(n=>r.has(n.file))}function A9(e){let t=le(e,"write.json");if(!Array.isArray(t?.tests))return new Set;let r=new Set(t.tests.filter(n=>n.change==="added").map(n=>n.file));return new Set(Uw(e,t).filter(n=>n.verdict==="unprovisioned"&&r.has(n.file)).map(n=>n.file))}function XTt(e,t,r,n){let s=ir(e.inputs.repositoryPath,e.inputs.relatedRepos??[]),i=new Map,o=new Map,a=new Map,c=Math.min(Date.now()+Ozr,e.deadlineMs??1/0),u={provision:!!e.inputs.provisionRuntime,notes:[],assets:Wo.join(e.outputsDir,"write-scratch","ci-list"),outputsDir:e.outputsDir,deadlineMs:e.deadlineMs},l=n?.(e,r(GTt)),p=Uzr(t,{place:f=>{let h=s(f);return pr(h)?h:{root:e.inputs.repositoryPath,rel:f}},list:(f,h,g)=>{let y=l?.(f,g)??{},m=`${f}\0${JSON.stringify(h)}\0${JSON.stringify(y)}`,A=a.get(m);if(A)return A;let w=Math.min(GTt,c-Date.now());if(w<$zr)return{skipped:"was not run: the time for these checks was spent"};i.has(f)||i.set(f,_a(f));let E=r(w),C=Object.keys(y).length?(k,N,B)=>E(k,N,{...y,...B??{}}):E,x=eQ(f,h.cwd,h.argv,i.get(f),{...u,run:C}),S;if(x.missing)S={skipped:`could not start: ${x.missing}`};else{let k=C(h.argv,Wo.resolve(f,h.cwd),y9({...x.ciEnv,...y,...h.env??{},...x.tools.env,...x.prerequisiteEnv},x));S=k.timedOut?{skipped:`ran out of its ${Math.round(w/1e3)} s`}:k}return a.set(m,S),S},files:f=>{if(!o.has(f)){let h=Fte(f);h||ze(e).warn(`[write] CI listings: git could not list the files of ${f}; a shorter path a listing prints is left unconfirmed`),o.set(f,h)}return o.get(f)},secrets:e.secretValues??[],ciTests:f=>(i.has(f)||i.set(f,_a(f)),i.get(f).length>0),testEnvironment:WTt(e)});return mn(e,tQ,{checks:p.checks},[]),p}function e0t(e,t,r,n){try{return XTt(e,t,r,n),!0}catch(s){return ze(e).warn(`[write] could not check the salvaged write's CI claims: ${s instanceof Error?s.message:String(s)}`),!1}}var Lzr="write-ci-services";function t0t(e){return{name:Lzr,verify(t,r,n,s){let i=e(t,r);if(!i)return{name:this.name,passed:!0};let o=ir(t.inputs.repositoryPath,t.inputs.relatedRepos??[]),a=i.tests.filter(c=>c.ci&&(c.change==="added"||c.change==="updated")).flatMap(c=>{let u=o(c.file),l=pr(u)?u.root:t.inputs.repositoryPath;return KTt(c,l,_a(l).length>0,WTt(t)).errs});return!a.length||s&&!s.retryLeft?{name:this.name,passed:!0}:{name:this.name,passed:!1,details:a.join("; "),repairable:!0}}}}function r0t(e,t,r){return{name:Bzr,onlyAfterOthersPass:!0,verify(n,s,i,o){_N.rmSync(Wo.join(n.outputsDir,`${tQ}.json`),{force:!0});let a=e(n,s);if(!a)return{name:this.name,passed:!0};let{errs:c}=XTt(n,a,t,r);return c.length?o&&!o.retryLeft?{name:this.name,passed:!0,details:`kept the tests; CI pickup not confirmed: ${c.join("; ")}`}:{name:this.name,passed:!1,details:c.join("; "),repairable:!0}:{name:this.name,passed:!0}}}}var wi=W(require("node:fs")),ri=W(require("node:path")),v9=require("node:child_process");var Lw=W(require("fs")),ac=W(require("path")),Qzr={lf:`
701
+ `).some(s=>n(DTe(s))||n(DTe(s).replace(/[,;]$/,"")))}function Fzr(e,t,r,n){if(r.length<t.length)return`shows no line of that CI job starting ${t.slice(r.length).join(", ")}`;let s=new Set(n.map(i=>i.file.trim()));for(let i of r){if(!s.has(i.file.trim()))return`ci.starts names ${i.file}, which is not a file of ci.steps: quote the line from the CI job that runs it`;let o=ZTt(e,i.file);if(o===void 0)return`ci.starts names ${i.file}, which is not a file of its checkout`;if(!YTt(o,i.line))return`${i.file} has no line ending ${JSON.stringify(i.line)}`}}function KTt(e,t,r=!1,n){if(JTt(e,n))return{needs:[],errs:[]};let s=e.ci,i=(s.needs??[]).map(l=>l.trim()).filter(Boolean),o=[],a=[...new Set(e.result.cases.flatMap(l=>l.runtimeTargets??[]))];a.length&&!i.length&&o.push(`${e.file}: its run called ${a.join(", ")}, so it needs the running app \u2014 name what it needs running outside its own process under ci.needs`),!s.collected&&i.length&&r&&(!s.steps?.length||!s.list)&&o.push(`${e.file}: it needs ${i.join(", ")}, and ci says the repo's CI does not collect it \u2014 show it: under ci.steps the line in a CI file that starts the repo's tests and each line on the way to the runner, ci.runner, and under ci.list a command that lists what that runner collects; Testbot runs it, and its output must not name this file`);let c=s.collected&&i.length?Fzr(t,i,s.starts??[],s.steps??[]):void 0;if(!c)return{needs:i,errs:o};let u=`${e.file}: the repo's CI runs it, and ${c}`;return o.push(`${u} \u2014 put it in a CI job that starts what it needs and quote those lines under ci.starts; with no such job, move it where the repo's CI does not collect it, say ci.collected false and show it with ci.steps, ci.runner and a ci.list whose output does not name it, and give in ciNotes the CI change that would start them and run it`),{needs:i,errs:o,unprovisioned:u}}function ZTt(e,t){let r=Wo.resolve(e,t.trim());if(!(!r.startsWith(Wo.resolve(e)+Wo.sep)||!_N.statSync(r,{throwIfNoEntry:!1})?.isFile()))return _N.readFileSync(r,"utf-8")}function Uzr(e,t){let r=[],n=[],s=e.ciNotes??"";for(let i of e.tests){if(i.change!=="added"&&i.change!=="updated")continue;let o=i.ci;if(!o){r.push(`${i.file}: say under "ci" whether the repo's CI will run it, and how you know`),n.push({file:i.file,verdict:"unconfirmed",detail:"write did not say whether the repo's CI runs it"});continue}let{root:a,rel:c}=t.place(i.file),u=KTt(i,a,!1,t.testEnvironment),l=u.needs;r.push(...u.errs);let d=l.length?{needs:l}:{},p=JTt(i,t.testEnvironment),f=l.length?`it needs ${l.join(", ")}`:"it is a guarded node:test entry, which only node --test can run",h=!1;if(!o.collected){let P=[i.file,c,Wo.posix.basename(c)].some(Q=>s.includes(Q));if(o.why?.trim()?P||r.push(`${i.file}: ci says the repo's CI will not run it, and ciNotes does not name it \u2014 name it there with the exact change the author must make for CI to run it`):r.push(`${i.file}: ci says the repo's CI will not run it \u2014 say why under ci.why`),!l.length&&!p||!t.ciTests?.(a)){n.push({file:i.file,verdict:"not-collected",detail:o.why?.trim(),...d});continue}if(h=!0,!o.steps?.length||!o.list){let Q=`${i.file}: ${f}, and ci says the repo's CI does not collect it \u2014 show it: under ci.steps the line in a CI file that starts the repo's tests and each line on the way to the runner, ci.runner, and under ci.list a command that lists what that runner collects; Testbot runs it, and its output must not name this file`;r.push(Q),n.push({file:i.file,verdict:"unconfirmed",detail:Q,...d});continue}}let g=o.steps??[];if(u.unprovisioned){n.push({file:i.file,verdict:"unprovisioned",detail:u.unprovisioned,needs:l});continue}let y=r.length;g.length||r.push(`${i.file}: ci.steps is missing \u2014 quote the line in a CI file that starts the tests, then each line it runs on the way to the test runner`);for(let P of g){let Q=ZTt(a,P.file);Q===void 0?r.push(`${i.file}: ci.steps names ${P.file}, which is not a file of its checkout`):YTt(Q,P.line)||r.push(`${i.file}: ${P.file} has no line ending ${JSON.stringify(P.line)} \u2014 quote each line exactly, from where its command starts`)}let m=o.list,A=o.runner?.trim().toLowerCase()??"",w=g[g.length-1];A?w&&!VTt(w.line,A)?r.push(`${i.file}: the last line of ci.steps (${JSON.stringify(w.line)}) does not start ${o.runner} \u2014 follow the lines on until one does, or name the runner by the name that line and the list command both use`):m&&!VTt(m.argv.join(" "),A)&&r.push(`${i.file}: ci.list does not run ${o.runner} \u2014 list with the runner those lines start, by the name the last line and the list command both use`):r.push(`${i.file}: ci.runner is missing \u2014 name the test runner the last of those lines starts`);let E=m?NM(a,m,t.secrets):[];if(m?E.length&&r.push(`${i.file}: ci.list ${E[0]}`):r.push(`${i.file}: ci.list is missing \u2014 give a command that lists the tests that runner collects without running them`),r.length>y||!m){n.push({file:i.file,verdict:"unconfirmed",detail:r[r.length-1]});continue}let C=`\`${m.argv.join(" ")}\` (from ${m.cwd})`,x=t.list(a,m,c);if("skipped"in x){n.push({file:i.file,verdict:"unconfirmed",detail:`${C} ${x.skipped}`}),x.skipped.startsWith("could not start")&&r.push(`${i.file}: ${C} ${x.skipped} \u2014 run it the way you run your tests`);continue}let S=t.files?.(a),k=Mzr(x.output,a,c,m.cwd,S);if(k&&h&&p){let P=`${i.file}: ci says the repo's CI does not collect it, but ${C} names it, and ${f}`;r.push(`${P} \u2014 put it where that runner does not collect it`),n.push({file:i.file,verdict:"unconfirmed",detail:P});continue}if(k&&h){let P=`${i.file}: ci says the repo's CI does not collect it, but ${C} names it, and that job starts none of ${l.join(", ")}`;r.push(`${P} \u2014 put it where that runner does not collect it, and give in ciNotes the CI change that would start them and run it`),n.push({file:i.file,verdict:"unprovisioned",detail:P,needs:l});continue}if(k){n.push({file:i.file,verdict:"confirmed"});continue}let N=Zx(x.output,t.secrets??[]);if(h&&x.status===0){n.push({file:i.file,verdict:"not-collected",detail:o.why?.trim(),...d});continue}if(x.status!==0){let P=`${C} exited ${x.status}: ${N} \u2014 give a command that lists what that runner collects`;r.push(`${i.file}: ${P}`),n.push({file:i.file,verdict:"unconfirmed",detail:P});continue}if(t.files&&!S){n.push({file:i.file,verdict:"unconfirmed",detail:`${C} ran, but the checkout's files could not be listed to match a shorter path it prints: ${N}`});continue}let B=`${C} ran, but its output does not name it: ${N} \u2014 if that runner does not collect it, say so under ci`;r.push(`${i.file}: ${B}`),n.push({file:i.file,verdict:"disproved",detail:B})}return{errs:r,checks:n}}function Uw(e,t){let r=new Set(t.tests.map(n=>n.file));return(le(e,`${tQ}.json`)?.checks??[]).filter(n=>r.has(n.file))}function A9(e){let t=le(e,"write.json");if(!Array.isArray(t?.tests))return new Set;let r=new Set(t.tests.filter(n=>n.change==="added").map(n=>n.file));return new Set(Uw(e,t).filter(n=>n.verdict==="unprovisioned"&&r.has(n.file)).map(n=>n.file))}function XTt(e,t,r,n){let s=ir(e.inputs.repositoryPath,e.inputs.relatedRepos??[]),i=new Map,o=new Map,a=new Map,c=Math.min(Date.now()+Ozr,e.deadlineMs??1/0),u={provision:!!e.inputs.provisionRuntime,notes:[],assets:Wo.join(e.outputsDir,"write-scratch","ci-list"),outputsDir:e.outputsDir,deadlineMs:e.deadlineMs},l=n?.(e,r(GTt)),p=Uzr(t,{place:f=>{let h=s(f);return pr(h)?h:{root:e.inputs.repositoryPath,rel:f}},list:(f,h,g)=>{let y=l?.(f,g)??{},m=`${f}\0${JSON.stringify(h)}\0${JSON.stringify(y)}`,A=a.get(m);if(A)return A;let w=Math.min(GTt,c-Date.now());if(w<$zr)return{skipped:"was not run: the time for these checks was spent"};i.has(f)||i.set(f,_a(f));let E=r(w),C=Object.keys(y).length?(k,N,B)=>E(k,N,{...y,...B??{}}):E,x=eQ(f,h.cwd,h.argv,i.get(f),{...u,run:C}),S;if(x.missing)S={skipped:`could not start: ${x.missing}`};else{let k=C(h.argv,Wo.resolve(f,h.cwd),y9({...x.ciEnv,...y,...h.env??{},...x.tools.env,...x.prerequisiteEnv},x));S=k.timedOut?{skipped:`ran out of its ${Math.round(w/1e3)} s`}:k}return a.set(m,S),S},files:f=>{if(!o.has(f)){let h=Fte(f);h||ze(e).warn(`[write] CI listings: git could not list the files of ${f}; a shorter path a listing prints is left unconfirmed`),o.set(f,h)}return o.get(f)},secrets:e.secretValues??[],ciTests:f=>(i.has(f)||i.set(f,_a(f)),i.get(f).length>0),testEnvironment:WTt(e)});return mn(e,tQ,{checks:p.checks},[]),p}function e0t(e,t,r,n){try{return XTt(e,t,r,n),!0}catch(s){return ze(e).warn(`[write] could not check the salvaged write's CI claims: ${s instanceof Error?s.message:String(s)}`),!1}}var Lzr="write-ci-services";function t0t(e){return{name:Lzr,verify(t,r,n,s){let i=e(t,r);if(!i)return{name:this.name,passed:!0};let o=ir(t.inputs.repositoryPath,t.inputs.relatedRepos??[]),a=i.tests.filter(c=>c.ci&&(c.change==="added"||c.change==="updated")).flatMap(c=>{let u=o(c.file),l=pr(u)?u.root:t.inputs.repositoryPath;return KTt(c,l,_a(l).length>0,WTt(t)).errs});return!a.length||s&&!s.retryLeft?{name:this.name,passed:!0}:{name:this.name,passed:!1,details:a.join("; "),repairable:!0}}}}function r0t(e,t,r){return{name:Bzr,onlyAfterOthersPass:!0,verify(n,s,i,o){_N.rmSync(Wo.join(n.outputsDir,`${tQ}.json`),{force:!0});let a=e(n,s);if(!a)return{name:this.name,passed:!0};let{errs:c}=XTt(n,a,t,r);return c.length?o&&!o.retryLeft?{name:this.name,passed:!0,details:`kept the tests; CI pickup not confirmed: ${c.join("; ")}`}:{name:this.name,passed:!1,details:c.join("; "),repairable:!0}:{name:this.name,passed:!0}}}}var wi=W(require("node:fs")),ri=W(require("node:path")),v9=require("node:child_process");var Lw=W(require("fs")),ac=W(require("path")),Qzr={lf:`
702
702
  `,crlf:`\r
703
703
  `,cr:"\r"},s0t=5*1024*1024,n0t=e=>e.replace(/[.+^$()|\\/{}[\]*?]/g,"\\$&");function jzr(e,t){let r=0;for(let n=t;n<e.length;n++)if(e[n]==="\\")n++;else if(e[n]==="{")r++;else if(e[n]==="}"&&--r===0)return n;return-1}function qzr(e){let t=[],r=0,n="";for(let s=0;s<e.length;s++){let i=e[s];if(i==="\\"){n+=i+(e[++s]??"");continue}i==="{"&&r++,i==="}"&&r--,i===","&&!r?(t.push(n),n=""):n+=i}return[...t,n]}function MTe(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="\\")t+=n0t(e[++r]??"\\");else if(n==="*"&&e[r+1]==="*"){let s=(r===0||e[r-1]==="/")&&e[r+2]==="/";t+=s?"(?:.*/)?":".*",r+=s?2:1}else if(n==="*")t+="[^/]*";else if(n==="?")t+="[^/]";else if(n==="["){let s=e.indexOf("]",r+2);if(s<0||e.slice(r,s).includes("/"))t+="\\[";else{let i=e.slice(r+1,s);t+=`[${i.replace(/^!/,"^").replace(/\\(?!\])/g,"\\\\")}]`,r=s}}else if(n==="{"){let s=jzr(e,r),i=s<0?"":e.slice(r+1,s),o=/^(-?\d+)\.\.(-?\d+)$/.exec(i),a=qzr(i);if(o){let[c,u]=[Number(o[1]),Number(o[2])].sort((l,d)=>l-d);t+=`(?:${Array.from({length:Math.min(u-c+1,1e4)},(l,d)=>String(c+d)).join("|")})`,r=s}else a.length>1?(t+=`(?:${a.map(MTe).join("|")})`,r=s):t+="\\{"}else t+=n0t(n)}return t}function Gzr(e){return e.includes("/")?new RegExp(`^${MTe(e.replace(/^\//,""))}$`):new RegExp(`^(?:.*/)?${MTe(e)}$`)}function i0t(e){let t={root:!1,sections:[]},r;for(let n of e.split(/\r\n|\r|\n/)){let s=n.trim();if(!s||s.startsWith("#")||s.startsWith(";"))continue;let i=/^\[(.+)\]$/.exec(s);if(i){r={matches:Gzr(i[1]),props:{}},t.sections.push(r);continue}let o=s.indexOf("=");if(o<0)continue;let a=s.slice(0,o).trim().toLowerCase(),c=s.slice(o+1).trim().toLowerCase();r?r.props[a]=c:a==="root"&&(t.root=c==="true")}return t}function o0t(e,t,r){let n=[];for(let i=ac.dirname(t);;i=ac.dirname(i)){let o=r(i);if(o&&n.unshift({dir:i,config:o}),o?.root||i===e||i===ac.dirname(i))break}let s={};for(let{dir:i,config:o}of n){let a=ac.relative(i,t).split(ac.sep).join("/");for(let c of o.sections)c.matches.test(a)&&Object.assign(s,c.props)}return Object.fromEntries(Object.entries(s).filter(([,i])=>i!=="unset"))}function a0t(e,t){let r=e.startsWith("#!"),n=t.end_of_line?Qzr[t.end_of_line]:void 0,s=n&&!(r&&n!==`
704
704
  `)?n:void 0,i=s?e.replace(/\r\n|\r|\n/g,s):e;return t.insert_final_newline==="true"&&i.length&&!/[\r\n]$/.test(i)&&(i+=s??/\r\n|\r|\n/.exec(i)?.[0]??`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyramp/testbot-core",
3
- "version": "0.13.3-v3.548",
3
+ "version": "0.13.3-v3.549",
4
4
  "description": "Skyramp Testbot engine: AI-powered deterministic test generation, execution and maintenance",
5
5
  "main": "dist/main.js",
6
6
  "//files": "An explicit allowlist, never a glob. `dist/` is gitignored, so without this key npm's .gitignore fallback would publish a package with no engine in it; with a glob it would publish the sourcemaps, whose sourcesContent embeds every src/*.ts verbatim. dist/VERSION.json exists only in a release-engine.yml build.",