@skyramp/testbot-core 0.13.0-v3.317 → 0.13.0-v3.319
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 +1 -1
- package/dist/main.js +431 -431
- package/dist/post.js +1 -1
- package/dist/runner-client.cjs +1 -1
- package/package.json +1 -1
package/dist/post.js
CHANGED
|
@@ -218,7 +218,7 @@ ${n}`}function d_(e){let t=/\b(claude|anthropic)\b/i;return e.split(`
|
|
|
218
218
|
`).trimEnd(),r=t?`${i}
|
|
219
219
|
${cd}: ${t}`:i;e(["log","-1","--format=%(trailers:key=Signed-off-by,valueonly)"]).split(`
|
|
220
220
|
`).some(o=>o.trim().toLowerCase()===`${ws} <${mo}>`.toLowerCase())&&(r=lv(r,{name:ws,email:mo})),e(["-c",`user.name=${ws}`,"-c",`user.email=${mo}`,"commit","--amend","--allow-empty","-m",r])}var Go=ce(require("fs")),g_=ce(require("path"));function Yi(e){let t=Math.max(0,...(e.match(/`+/g)??[]).map(r=>r.length)),n="`".repeat(t+1),i=e.startsWith("`")||e.endsWith("`")?" ":"";return`${n}${i}${e}${i}${n}`}var dDe=5*6e4,pDe=12*6e4;var yDe=["class TestbotProjectBrowsers {"," onBegin(config) {",' const projects = config.projects.map((p) => ({ browserName: p.use.browserName ?? p.use.defaultBrowserType ?? "chromium", channel: p.use.channel ?? null }));',' process.stdout.write("TESTBOT_PROJECT_BROWSERS " + JSON.stringify(projects) + "\\n");'," }"," printsToStdio() { return true; }","}","module.exports = TestbotProjectBrowsers;",""].join(`
|
|
221
|
-
`);var CDe=[..._S,"AWS_REGION","AWS_DEFAULT_REGION","AWS_ENDPOINT_URL","AWS_ENDPOINT_URL_BEDROCK_RUNTIME","AWS_ENDPOINT_URL_STS","AWS_SHARED_CREDENTIALS_FILE","AWS_CONFIG_FILE","CLAUDE_CODE_USE_BEDROCK","CLAUDE_CODE_USE_VERTEX","ANTHROPIC_BASE_URL","ANTHROPIC_BEDROCK_BASE_URL"].filter((e,t,n)=>n.indexOf(e)===t);var xDe=process.env.RUNNER_TOOL_CACHE||"/opt/hostedtoolcache";var MDe={jest:"jest",vitest:"vitest"};var xNe=5*6e4;function ihe(e){return Xn(ZT,e).errors}function AH(e,t=[]){let{value:n,error:i}=jt(e,t);if(i)return{errors:[i]};let r=ihe(n);return r.length>0?{errors:r}:{analysis:n,errors:[]}}function she(e,t=[]){return AH(e.stdout,t)}var dPe=Gr("analysis-schema",(e,t)=>she(t,e.secretValues));var pUe=zg.rows.notRun(!0);var hA="kept, not "
|
|
221
|
+
`);var CDe=[..._S,"AWS_REGION","AWS_DEFAULT_REGION","AWS_ENDPOINT_URL","AWS_ENDPOINT_URL_BEDROCK_RUNTIME","AWS_ENDPOINT_URL_STS","AWS_SHARED_CREDENTIALS_FILE","AWS_CONFIG_FILE","CLAUDE_CODE_USE_BEDROCK","CLAUDE_CODE_USE_VERTEX","ANTHROPIC_BASE_URL","ANTHROPIC_BEDROCK_BASE_URL"].filter((e,t,n)=>n.indexOf(e)===t);var xDe=process.env.RUNNER_TOOL_CACHE||"/opt/hostedtoolcache";var MDe={jest:"jest",vitest:"vitest"};var xNe=5*6e4;function ihe(e){return Xn(ZT,e).errors}function AH(e,t=[]){let{value:n,error:i}=jt(e,t);if(i)return{errors:[i]};let r=ihe(n);return r.length>0?{errors:r}:{analysis:n,errors:[]}}function she(e,t=[]){return AH(e.stdout,t)}var dPe=Gr("analysis-schema",(e,t)=>she(t,e.secretValues));var pUe=zg.rows.notRun(!0);var hA="kept, not ";var gA="(declined the planned ";function A_(e){if(!e)return[];let t=[],n=0,i=0;for(let r=0;r<e.length;r++){let s=e[r];s==="("?n++:s===")"?n=Math.max(0,n-1):n===0&&s===";"&&e[r+1]===" "&&e[r-1]===")"&&(t.push(e.slice(i,r)),i=r+2)}return t.push(e.slice(i)),t.map(r=>{let s=r.trim();if(!s.endsWith(")"))return{expectation:s};let o=0;for(let a=s.length-1;a>=0;a--)if(s[a]===")")o++;else if(s[a]==="("&&--o===0){let c=s.slice(0,a).trim(),u=s.slice(a+1,-1).trim();return c&&u?{expectation:c,expected:u}:{expectation:s}}return{expectation:s}})}var hH=new Set(["update","regenerate","delete"]);var fUe={update:"updated",regenerate:"regenerated",delete:"deleted",verify:"verified",none:"touched"};var gH=p.string().trim().min(1),h_=p.object({schemaVersion:p.literal(1).optional(),businessCaseAnalysis:gH.describe("1-2 sentences: what this change means for a user, and whether the evidence shows it working"),issuesFound:p.array(p.object({description:gH,severity:p.string().optional().describe("critical | high | medium | low"),category:p.string().optional().describe("bug | lint | type | config"),sourceFile:p.string().optional(),sourceLine:p.number().optional(),findingId:p.string().optional(),requirementIds:p.array(p.string()).optional()})).describe("every real problem this run exposed \u2014 cause, file:line, severity"),nextSteps:p.array(p.string()).describe("concrete follow-ups the author can act on; required non-empty when a disclosure is BLOCKING")});function dhe(e){return Xn(h_,e).errors}function phe(e,t=[]){let{value:n,error:i}=jt(e.stdout,t);if(i)return{errors:[i]};let r=dhe(n);return r.length>0?{errors:r}:{prose:n,errors:[]}}var SUe=Gr("report-schema",(e,t)=>phe(t,e.secretValues));var hhe="report.json",ghe="report-display.json",PUe={en:"English",ja:"Japanese"};function yH(e){let t=g_.join(e,ghe);if(Go.existsSync(t))try{return JSON.parse(Go.readFileSync(t,"utf-8"))}catch{}let n=g_.join(e,hhe);return Go.existsSync(n)?JSON.parse(Go.readFileSync(n,"utf-8")):void 0}var Wi=ce(require("fs")),zo=ce(require("path")),VH=ce(require("crypto")),GH=require("child_process");var y_=require("child_process"),ud=ce(require("fs")),EH=ce(require("os")),Av=ce(require("path"));var mhe={onPath:e=>(0,y_.spawnSync)("sh",["-c",`command -v ${e}`],{stdio:"ignore"}).status===0,run:(e,t)=>(0,y_.spawnSync)(e[0],e.slice(1),{cwd:t,stdio:"ignore",timeout:6e4}).status??1},fv={cleanup:()=>{}},yhe=new Set(["pnpm","yarn"]);function vH(e,t=EH.tmpdir(),n=mhe){if(process.platform==="win32")return fv;try{let i=zS(e);if(!yhe.has(i)||n.onPath(i)||!n.onPath("corepack"))return fv;ud.mkdirSync(t,{recursive:!0});let r=ud.mkdtempSync(Av.join(t,"testbot-pm-")),s=()=>ud.rmSync(r,{recursive:!0,force:!0});return n.run(["corepack","enable","--install-directory",r,i],e)!==0?(s(),fv):{dir:r,cleanup:s}}catch{return fv}}function IH(e,t=process.env){return e.dir?{...t,PATH:[e.dir,t.PATH].filter(Boolean).join(Av.delimiter)}:t}var yA=require("crypto");var Ehe="<!-- skyramp-testbot -->",bH=hH,vhe=new Set(["lint","type","config"]),CH={critical:0,high:1,medium:2,low:3},xH=new Set(["Pass","Fail"]);var v_=e=>Va(ue().statusLabels,e),E_=e=>Va(ue().testTypeCellLabels,e);function Xe(e){return(e??"").replace(/\|/g,"\\|").replace(/\r?\n/g,"<br>").trim()}function wH(e){return e.inferred?" (inferred)":""}function SH(e,t){return!e||!xH.has(e)?"\u2014":t?`${v_(e)} (${Xe(TH(t))})`:v_(e)}function TH(e){let t=i=>{let r=i.indexOf(": ");return r<0?i:Va(ue().staged.maintenanceActions,i.slice(0,r))+i.slice(r)};if(e.startsWith(hA))return ue().staged.keptNot+t(e.slice(hA.length));let n=e.indexOf(gA);return n<0?e:e.slice(0,n)+ue().staged.declinedPlanned+t(e.slice(n+gA.length))}function kH(e){return e.category!==void 0&&vhe.has(e.category.toLowerCase())}function BH(e,t){return(CH[(e.severity??"").toLowerCase()]??4)-(CH[(t.severity??"").toLowerCase()]??4)}function RH(e){return`- ${e.severity?`**[${Va(ue().severityLabels,e.severity.toLowerCase()).toUpperCase()}]** `:""}${e.description.trim()}`}function Ihe(e){let t=e.resultId?.split("#").slice(1).join("#");if(e.testType!=="unit"||!t)return;let n=t;try{n=decodeURIComponent(t)}catch{}let i=/^(.*?)(\[.*\])$/.exec(n);return i?{fn:i[1],kase:i[2]}:{fn:n}}var _H=(e,t)=>e!==void 0&&t!==void 0&&e.replace(/^\.\//,"")===t.replace(/^\.\//,"");function $H(e,t){return(e.testVideos??[]).find(n=>n.url&&t(n))?.url}function I_(e,t){return $H(e,n=>_H(n.fileName,t.fileName)&&(!n.repository||!t.repository||n.repository.toLowerCase()===t.repository.toLowerCase()))}function b_(e,t){return $H(e,n=>_H(n.writtenAs??n.fileName,t))}function bhe(e,t,n){return n?I_(e,{fileName:t,repository:n}):b_(e,t)}function Che(e){let t=[],n=new Map;for(let o of e.newTestsCreated)o.testType==="unit"&&n.set(o.fileName,[...n.get(o.fileName)??[],o.testId.split("::").slice(1).join("::")]);let i=new Map,r=(o,a)=>(n.get(o??"")??[]).find(c=>c!==a&&Xj(a,c)),s=new Map;for(let o of e.testResults){let a=Ihe(o),c=a&&!a.kase?r(o.fileName,a.fn):void 0;if(a&&c&&(a={fn:c,kase:`"${a.fn}"`}),a?.kase&&i.set(o,a.kase),!a){t.push({testId:o.testId,testType:o.testType,endpoint:o.endpoint,status:o.status,details:o.details??"",...o.fileName?{fileName:o.fileName}:{},...o.repository?{repository:o.repository}:{}});continue}let u=`${o.fileName??""}#${a.fn}`,d=s.get(u);d||(d={row:{testId:o.testId,testType:o.testType,endpoint:o.endpoint,status:o.status,details:"",test:a.fn,...o.fileName?{fileName:o.fileName}:{},...o.repository?{repository:o.repository}:{}},cases:[]},s.set(u,d),t.push(d.row)),d.cases.push(o)}for(let{row:o,cases:a}of s.values()){let c=a.filter(h=>h.status==="Fail"),u=a.filter(h=>h.status==="Pass").length,d=a.filter(h=>h.status==="Skipped").length;o.cases=a.length,o.status=c.length?"Fail":d?"Skipped":"Pass";let f=c[0];o.details=a.length===1?a[0].details??"":ue().staged.casesPassed(u,a.length,d)+(f?`; ${i.get(f)??""} ${f.details??""}`.replace(/; +/,"; ").trimEnd():"")}return t}function whe(e){return A_(e).map(t=>t.expected===void 0?t.expectation:`${t.expectation}: ${Yi(t.expected)}`)}function QH(e){return e.newTestsCreated.some(t=>t.testType!=="unit")&&e.testResults.every(t=>t.status==="Skipped")&&e.testResults.some(t=>t.failureCause?.kind==="environment"&&t.failureCause.family==="app_not_started")}function DH(e,t={}){let{audience:n,collapsed:i=!1,existingEvidence:r=[],requestedBy:s,sourcePullRequest:o}=t,a=n!=="testbot-pr",c=n!=="comment",u=n!=="testbot-pr",d=[Ehe];if(o&&d.push(ue().staged.testsSourcePullRequest(Yi(o)),""),s){let S=s.name.replace(/\s+/g," ").trim().replace(/[<>[\]()*_`\\|#]/g,"\\$&").replace(/@/g,"@\u200D");d.push(s.kind==="person"?ue().staged.requestedByPerson(S):ue().staged.requestedByPolicy(S),"")}e.notTranslated&&d.push(Va(ue().staged.notTranslated,e.notTranslated),"");let f=S=>{i?d.push("<details>",`<summary>${S}</summary>`,""):d.push(`### ${S}`)},h=()=>{i&&d.push("","</details>"),d.push("")};if(a){for(let S of e.businessCaseAnalysis.trim().split(/\r?\n/))d.push(`> ${S}`);d.push("")}if(QH(e)&&d.push(ue().staged.noLiveApp(e.newTestsCreated.length),""),c&&e.newTestsCreated.length){let S=new Map;for(let V of e.newTestsCreated){if(V.testType!=="unit")continue;let te=(V.testId.split("::").slice(1).join("::")||V.testId).replace(/\[.*\]$/,""),J=S.get(V.fileName)??{functions:new Set,endpoints:[],descriptions:new Map};V.endpoint&&!J.endpoints.includes(V.endpoint)&&J.endpoints.push(V.endpoint);let be=V.description?.trim()??"",We=J.descriptions.get(te)??[];We.includes(be)||We.push(be),J.functions.add(te),J.descriptions.set(te,We),S.set(V.fileName,J)}let D=e.newTestsCreated.filter(V=>V.testType!=="unit"),F=D.length+[...S.values()].reduce((V,te)=>V+te.functions.size,0);f(ue().testRecommendationsImplementedHeader(F));for(let[V,{functions:te,endpoints:J,descriptions:be}]of S){let We=te.size;d.push(ue().staged.unitTestsInFile(`\`${V}\``,We,J.map(Ye=>`\`${Ye}\``).join(", ")),"");let Fe=new Map;for(let[Ye,Ee]of be){let At=Ee.join("\0"),U=Fe.get(At)??{fns:[],descriptions:Ee};U.fns.push(Ye),Fe.set(At,U)}let He=0;for(let{fns:Ye,descriptions:Ee}of Fe.values()){d.push(`${++He}. ${Ye.map(U=>`\`${U}\``).join(", ")}`);let At=[...new Set(Ee.flatMap(U=>whe(U)))];for(let U of At)d.push(` - ${U}`)}d.push("")}for(let V of D){let te=V.testId?`\`${V.testId}\``:E_(V.testType),J=V.fileName?` (\`${V.fileName}\`)`:"",be=V.endpoint?`
|
|
222
222
|
\`${V.endpoint}\``:"",We=V.description?`
|
|
223
223
|
${V.description.trim()}`:"";d.push(`- ${te}${J}${be}${We}`)}h()}let g=(e.testMaintenance??[]).filter(S=>bH.has(S.action));if(c&&g.length){f(ue().staged.testMaintenanceHeader),d.push(ue().maintenanceTableHeader),d.push("|-----------|----------|------|--------|--------|-------|");for(let S of g)d.push(`| ${Xe(E_(S.testType))} | ${Xe(S.endpoint)} | \`${Xe(S.fileName)}\` | ${Xe(S.description)} | ${SH(S.beforeStatus,S.beforeDetails)} | ${SH(S.afterStatus,S.afterDetails)} |`);h()}let m=S=>S.startsWith(hA)||S.includes(gA),E=(e.testMaintenance??[]).filter(S=>m(S.afterDetails)&&(!bH.has(S.action)||!xH.has(S.afterStatus??"")));if(c&&E.length){f(ue().staged.declinedMaintenanceHeader);for(let S of E)d.push(`- \`${Xe(S.fileName)}\`: ${Xe(TH(S.afterDetails))}`);h()}if(c&&r.length){f(ue().staged.existingEvidenceHeader);let S=new Map;for(let D of r){let F=`${D.check}\0${D.url??""}\0${D.revision??""}`;S.set(F,[...S.get(F)??[],D])}for(let[,[D,...F]]of S){let V=D.url?`[${Yi(D.check)}](${D.url})`:Yi(D.check);d.push(ue().staged.trustedCheckPassed(V,D.revision?Yi(D.revision.slice(0,7)):""),"");for(let te of[D,...F])d.push(`- ${Yi(te.behavior)}`);d.push("")}h()}if(c&&e.testResults.length){f(ue().staged.testResultsHeader);let S=Che(e),D=S.some(J=>J.test),F=S.some(J=>I_(e,J)),V=D?ue().staged.unitResultsTableHeader:ue().staged.resultsTableHeader;d.push(F?`${V} ${ue().columnVideo} |`:V),d.push(`${D?"|---------|-----------|----------|------|-------|--------|---------|":"|---------|-----------|----------|--------|---------|"}${F?"-------|":""}`);for(let J of S){let be=J.details.replace(/(\S+\.(?:py|ts|js|spec\.\w+))/gi,"`$1`"),We=J.testId?`\`${Xe(J.testId)}\``:"\u2014",Fe=D?` ${J.test?`\`${Xe(J.test)}\``:""} | ${J.cases??""} |`:"",He=I_(e,J),Ye=F?` ${He?ue().videoDownloadLink(He):"\u2014"} |`:"";d.push(`| ${We} | ${Xe(E_(J.testType))} | ${Xe(J.endpoint)} |${Fe} ${Xe(v_(J.status))} | ${Xe(be)} |${Ye}`)}let te=(e.testVideos??[]).find(J=>J.artifactsUrl)?.artifactsUrl;!F&&te&&d.push("",ue().videosArtifactFallback(te)),h()}if(e.requirements?.length){let S=e.requirements.flatMap(J=>J.clauses),D=J=>J.status==="Pass"||J.status==="Passed, test not kept",F=S.filter(D).length;f(ue().staged.requirementsHeader(F,S.length));let V=J=>Va(ue().staged.clauseStatuses,J.status),te=J=>(J.status==="Not tested"||J.status==="Passed, test not kept")&&J.notTested?`${V(J)}: ${J.notTested}`:J.findings.length?`${V(J)} \u2014 ${J.findings.join(", ")}`:V(J);if(c){d.push(ue().staged.requirementsTableHeader),d.push("|-------------|--------|-------|--------|");for(let J of e.requirements)J.clauses.forEach((be,We)=>{let Fe=We===0?`**${Xe(J.label)}**${J.statement?` ${Xe(J.statement)}`:""}`:"",He=`\`${Xe(be.id)}\`${wH(be)}${be.text?` ${Xe(be.text)}`:""}`,Ye=new Map;for(let U of be.tests){let It=U.fileName??U.testId,et=Ye.get(It)??{fns:new Set};for(let bn of U.functions)et.fns.add(bn);et.video??=U.fileName?bhe(e,U.fileName,U.repository):void 0,Ye.set(It,et)}let Ee=Ye.size?[...Ye].map(([U,{fns:It,video:et}])=>`\`${Xe(U)}\`${It.size?` \u2014 ${[...It].map(bn=>`\`${Xe(bn)}\``).join(", ")}`:""}${et?` ${ue().videoDownloadLink(et)}`:""}`).join("<br>"):"\u2014",At=J.source==="could-break"&&be.status==="Pass"?ue().staged.regressionGuard:"";d.push(`| ${Fe} | ${He} | ${Ee} | ${Xe(te(be)+At)} |`)})}else{d.push(ue().staged.requirementsSummaryTableHeader),d.push("|-------------|-----------------|-------------|");for(let J of e.requirements){let be=J.clauses.filter(D).length,We=J.clauses.filter(Fe=>!D(Fe)).map(Fe=>`\`${Xe(Fe.id)}\`${wH(Fe)} ${Xe(te(Fe))}`);d.push(`| **${Xe(J.label)}**${J.statement?` ${Xe(J.statement)}`:""} | ${be}/${J.clauses.length} | ${We.join("<br>")||"\u2014"} |`)}}h()}if(c&&e.changes?.length&&!e.requirements?.length){let S=e.executionCoverage,D=S?ue().staged.coverageCaption(S.generated,S.modified,S.verified,S.executed):"";f(`${ue().staged.behaviourCoverageHeader}${D}`),d.push(ue().staged.coverageTableHeader),d.push("|-----------|--------|-----------|----------------|");for(let F of e.changes){let V=F.testedBy.length?F.testedBy.map(J=>`\`${Xe(J)}\``).join(", "):F.writtenBy.length?ue().staged.writtenNotRun:"\u2014",te=F.maintainedBy.length?F.maintainedBy.map(J=>`\`${Xe(J)}\``).join(", "):"\u2014";d.push(`| ${Xe(F.text)} | \`${Xe(F.source)}\` | ${V} | ${te} |`)}h()}if(e.userJourneys?.length){let S=e.userJourneys.filter(F=>F.status==="Pass"&&!F.problems.length).length;f(`\u{1F9ED} User Journeys Covered (${S}/${e.userJourneys.length} walked end to end)`);let D=e.userJourneys.some(F=>b_(e,F.fileName));d.push(`| Journey | Test | Status | Notes |${D?` ${ue().columnVideo} |`:""}`),d.push(`|---------|------|--------|-------|${D?"-------|":""}`);for(let F of e.userJourneys){let V=F.fileName?`\`${Xe(F.fileName)}\`${F.test?` \u2014 ${Xe(F.test)}`:""}`:"\u2014",te=F.source&&F.source!=="inferred"?`; described in the ${F.source==="spec"?"spec":"PR description"}`:"; inferred from the app",J=(F.uncovered?`not covered: ${F.uncovered}`:F.problems.length?`does not walk it end to end: ${F.problems.join("; ")}`:`from ${F.entry}, ${F.steps} steps`)+te,be=D?b_(e,F.fileName):void 0;d.push(`| ${Xe(F.name)} | ${V} | ${Xe(F.status)} | ${Xe(J)} |${D?` ${be?ue().videoDownloadLink(be):"\u2014"} |`:""}`)}h()}if(u){let S=e.issuesFound.filter(F=>!kH(F)).sort(BH),D=e.issuesFound.filter(kH).sort(BH);if(S.length){f(ue().staged.issuesFoundHeader);for(let F of S)d.push(RH(F));h()}if(D.length){d.push(`### ${ue().configErrorsHeader}`);for(let F of D)d.push(RH(F));d.push("")}}let R=e.testPackages??[],w=e.dependencyChanges??[];if(R.length){d.push(ue().staged.testPackagesHeader,"");for(let S of R)d.push(`- ${ue().staged.testPackageLine(S.directory,S.entrypoint)}`);w.length||d.push(`- ${ue().staged.appManifestsUntouched}`),d.push("")}if(w.length){d.push(ue().staged.dependencyChangesHeader,"");for(let S of w)d.push(`- ${ue().staged.dependencyChangeLine(S.package,S.repository?`${S.repository}: ${S.manifest}`:S.manifest,(S.reason??"").replace(/\s+/g," ").trim())}`);d.push("")}let k=(e.caveats??[]).filter(S=>S.kind!=="tests-not-executed"||S.subject==="written-cases"||!QH(e));if(k.length){d.push(ue().staged.caveatsHeader,"");for(let S of k)d.push(`- ${S.text}`);d.push("")}if(u&&e.nextSteps.length){d.push(ue().nextStepsHeader,"");for(let S of e.nextSteps)d.push(`- ${S.trim()}`);d.push("")}return d.join(`
|
|
224
224
|
`).replace(/\n{3,}/g,`
|
package/dist/runner-client.cjs
CHANGED
|
@@ -152,7 +152,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
152
152
|
`),a=s(c=>{let u=o.match(new RegExp(`^\\s*${c}\\s*=\\s*\\[([^\\]]*)\\]`,"m"));return u?[...u[1].matchAll(/["']([^"']+)["']/g)].map(l=>l[1]):[]},"array");return{members:a("members"),exclude:a("exclude")}}s(Uie,"uvWorkspace");function Fie(e){return Mie(Cj(e))}s(Fie,"readJson");function Mie(e){try{return JSON.parse(e)}catch{return}}s(Mie,"parseJson");function Pie(e){try{return xi(e)}catch{return}}s(Pie,"parseYaml");function Lie(e){return Pie(Cj(e))}s(Lie,"readYaml");function Cj(e){try{return uA.readFileSync(e,"utf-8")}catch{return""}}s(Cj,"readText");function sm(e){try{return uA.lstatSync(e).isFile()}catch{return!1}}s(sm,"isFile");var aR="test-package.json";var Oie=["node_modules",".venv","test-results","playwright-report","blob-report","__pycache__",".pytest_cache"];var vj=s(e=>e.split($i.sep).join("/"),"posix");function cR(e,t){let r=vj(e);return t.some(i=>r===i||r.startsWith(`${i}/`))}s(cR,"insidePackage");function bj(e){return vj(e).split("/").some(t=>Oie.includes(t))}s(bj,"producedByPackage");var jie=s(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeRegex"),Bj=/%[psdifjo#]|\$[A-Za-z_][\w.]*/g;var Gie=/ (?:>|›) /;function Vie(e){return e.split(Bj).map(t=>t.split(Gie).map(jie).join("(?: > | \u203A | )")).join(".+?")}s(Vie,"testNamePattern");function Qj(e,t){return new RegExp(Bj.source).test(t)?new RegExp(`^(?:.* )?${Vie(t)}$`).test(e):!1}s(Qj,"isEachCaseOf");function uR(e){return lR(e)&&RS(e).length===0&&$S(e.inputs?.sharedEnvironment).length===0}s(uR,"sutIsHealthy");function lR(e){let t=Xie(e);if(!t&&e.state.stages.deploy?.status!=="passed")return!1;let r=Ke(e,"deploy.json");return r?Kie(r):!t}s(lR,"sutCameUp");function Kie(e){return e?.outcome==="clean"||e?.outcome==="recipe-drift"}s(Kie,"deployCameUp");function Xie(e){let t=e.state.stages.plan,r=e.state.stages.deploy;return!(e.inputs?.pipeline?e.inputs.pipeline==="two-step":!r)||t?.status!=="passed"?!1:!r||r.updatedAt<=t.updatedAt}s(Xie,"broughtUpByPlan");var na=(a=>(a.Place="place",a.Update="update",a.Regenerate="regenerate",a.Delete="delete",a.Verify="verify",a.None="none",a))(na||{}),cr=(i=>(i.Pass="pass",i.Fail="fail",i.Skip="skip",i))(cr||{}),ar=d.string().trim().min(1),Sj=d.object({case:ar.describe("a covers id \u2014 the recommend case this test realizes"),status:d.nativeEnum(cr),fromJourney:d.boolean().optional()}),Rj=d.object({exit:d.number({invalid_type_error:"must be a number or null"}).nullable().describe("process exit of the re-run; null when no SUT was available"),details:d.string().optional().describe("what failed, or why a file was not run \u2014 required on any non-zero exit"),tests:d.array(Sj).optional().describe("ONE ENTRY PER CASE the file covers; must agree with exit (0 \u2192 no fail; non-zero \u2192 at least one)")}),xj=d.object({from:d.string().optional().describe("staged path \u2014 required for placements"),file:ar.describe("final path relative to its repository, inside that checkout, with a source-file extension"),repository:ar.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),action:d.nativeEnum(na),covers:d.array(d.string()).optional().describe("recommend ids a placed test covers"),repro:d.boolean().optional().describe("this test is MEANT to fail \u2014 it reproduces a reported bug"),finding:d.boolean().optional().describe("a non-repro test that failed on a REAL product bug"),placementBroken:d.boolean().optional().describe('placement/harness problem one repair could not fix \u2014 every reran.tests entry is then "skip"'),keptReason:ar.optional().describe("why a planned delete/regenerate was declined and the file kept"),isolatedRun:ar.optional().describe('only for a test marked "runs alone": the command, from its checkout root and without a shell, that runs only this file and writes its JUnit XML into $SKYRAMP_RESULTS_DIR (named by its path: no shell expands it) \u2014 the harness runs it, so leave reran.exit null'),reran:Rj,assertionCount:d.number().int().nonnegative().optional().describe("[derived] assertions reachable from the file, counted at write time")}).refine(e=>e.action!=="place"||typeof e.from=="string"&&e.from.trim().length>0,{message:'is a place but has no "from" staged path',path:[]}),$j=(r=>(r.Junit="junit",r.Converter="converter",r))($j||{}),eoe=ar.optional().describe("the items[].file this test is in \u2014 needed only when two of this suite's files cover the same case id"),toe=d.object({results:ar.describe("the JUnit XML file this run wrote, a plain file name inside $SKYRAMP_RESULTS_DIR (e.g. backend.xml)"),source:d.nativeEnum($j),run:ar.describe("the command you ran that wrote it, exactly as you ran it (with any converter)"),files:d.array(ar).min(1).describe("the items[].file paths this run covered"),cases:d.array(d.object({test:ar.describe("the test's name as the runner reports it, qualified by its class or file (e.g. tests/test_a.py::test_x) when the bare name repeats"),case:ar.describe("the covers id it realizes"),file:eoe})).describe("map each reported test name to the case it covers")}),noe=d.object({suites:d.array(toe).min(1)}),dR=d.object({schemaVersion:d.literal(1),items:d.array(xj),runnerResults:noe.optional().describe("the JUnit XML your test runs wrote into $SKYRAMP_RESULTS_DIR, so the harness reads each test's result from the runner \u2014 omit only when no SUT is available"),ignored:d.array(d.string()).describe("existing tests assessed and deliberately left untouched"),summary:ar.describe("one paragraph")});var Rbe=10*6e4;var cm=(n=>(n.RestApi="rest-api",n.Frontend="frontend",n.FullStack="full-stack",n.Other="other",n))(cm||{}),ra=(n=>(n.Critical="critical",n.High="high",n.Medium="medium",n.Low="low",n))(ra||{}),ia=(i=>(i.Suspected="suspected",i.Latent="latent",i.Refuted="refuted",i))(ia||{}),fR=(i=>(i.Skyramp="skyramp",i.External="external",i.Unknown="unknown",i))(fR||{}),gR=(n=>(n.Cascade="cascade",n.Restrict="restrict",n.Orphan="orphan",n.Unknown="unknown",n))(gR||{}),Zr=(n=>(n.RequirementReference="requirement-reference",n.Spec="spec",n.PrDescription="pr-description",n.CouldBreak="could-break",n))(Zr||{}),Ye=d.string().trim().min(1),Au=Ye.describe("file:line"),Dj=s(e=>Ye.refine(t=>t.length<=400,t=>({message:`is ${t.length} characters, over the 400 cap \u2014 ${e}`})),"cap400"),dA=Ye.optional().describe('multi-repo only: the OTHER checkout this lives in \u2014 its "owner/repo" slug, or the directory name if the run discovered it; omit for the working checkout'),pR=d.object({method:Ye,path:Ye,service:d.string().optional(),evidence:Au,repository:dA}),soe=d.object({id:Ye.describe("short-slug, e.g. R9"),statement:Ye.max(400,"exceeds 400 characters \u2014 state the requirement, do not paste the spec section").describe("a testable obligation, not a summary"),source:d.nativeEnum(Zr).describe("spec outranks pr-description when both state it"),evidence:Ye.describe("spec: file:line or a section locator. pr-description: the quoted phrase it comes from.")}),aoe=d.object({id:Ye.describe("short-slug"),statement:Ye.max(400,"exceeds 400 characters \u2014 state the behaviour, do not paste the code").describe("what the change makes true"),surface:Ye.describe("METHOD /path, or a component/page name"),evidence:Ye.describe("file:line from the diff that introduces it"),repository:dA,satisfies:d.array(Ye).optional().describe("requirement ids (from `requirements`) this behaviour correctly implements \u2014 a requirement met only in part is ALSO named by the finding that shows the rest (conflictsWith)")}),coe=d.object({id:Ye.describe("short-slug"),file:Ye,line:d.number().optional(),claim:Dj("shorten it to the one sentence that states the defect, and move the supporting detail into `evidence`"),severity:d.nativeEnum(ra),evidence:Dj("cite the file:line and the one line that shows it, rather than reproducing the surrounding code").describe("quoted diff/code line"),status:d.nativeEnum(ia),repository:dA,conflictsWith:d.array(Ye).optional().describe("requirement ids (from `requirements`) this defect contradicts or leaves unimplemented \u2014 a lower-precedence source (the diff, or the PR description) lost")}),uoe=d.object({name:Ye,language:d.string().optional(),framework:d.string().optional(),evidence:Au,repository:dA}),loe=d.object({dir:Ye,framework:d.string().optional(),kind:d.nativeEnum(fR),evidence:Au,repository:dA}),doe=d.object({from:Ye,to:Ye,onDelete:d.nativeEnum(gR),evidence:Au}),Aoe=d.object({entity:Ye,field:Ye,values:d.array(d.string()),evidence:Au}),poe=d.object({entities:d.array(d.object({name:Ye,evidence:Au})),references:d.array(doe).describe("INBOUND references \u2014 what still points at an entity when it is deleted"),stateFields:d.array(Aoe)}),hR=d.object({schemaVersion:d.literal(1),repository:d.object({path:Ye.describe("absolute repo path"),currentBranch:Ye,baseBranch:Ye}),project:d.object({type:d.nativeEnum(cm),primaryLanguage:Ye,languages:d.array(d.string()),frameworks:d.array(d.string())}),services:d.array(uoe),infrastructure:d.object({containerized:d.boolean(),hasDockerCompose:d.boolean(),composeFiles:d.array(d.string()),hasCiCd:d.boolean()}),diff:d.object({changedFiles:d.array(d.string()).describe("as git reports them; a file in another checkout may carry that repo's name"),nonApplicationOnly:d.boolean(),summary:Ye.describe("\u2264400 chars")}),endpoints:d.object({new:d.array(pR),modified:d.array(pR),removed:d.array(pR)}),existingTests:d.object({locations:d.array(loe)}),entityMap:poe,requirements:d.array(soe).describe("from a spec (attached or linked) and/or the PR description; empty when neither states a testable obligation"),behaviors:d.array(aoe),findings:d.array(coe),unexamined:d.array(d.string()).describe("files or areas outside this change you did not open"),summary:Ye.describe("one paragraph on what this change does and its test-relevant risk")});var moe=d.object({route:d.string().describe('the page this step happens on, e.g. "/products/:id"'),action:d.string().describe('what the user does there, through the UI, e.g. "clicks Add to cart"'),clauses:d.array(d.string()).optional().describe("the plan clause ids this step exercises"),check:d.string().optional().describe("what the user then sees that shows the step worked; the test asserts it")}),AA=(r=>(r.InProcess="in-process",r.Browser="browser",r))(AA||{}),_j=(i=>(i.Spec="spec",i.PrDescription="pr-description",i.Inferred="inferred",i))(_j||{}),Nj=d.object({id:d.string().describe('e.g. "J1"'),name:d.string().describe(`the flow in a user's words, e.g. "buy a product with a coupon"`),entry:d.string().describe("the route the user starts the flow on: the app's normal starting page for it, never a deep link into its middle"),steps:d.array(moe).describe("every step, in order, from the entry page to the outcome: at least two"),outcome:d.string().describe("what the user sees at the end that shows the flow worked: every part of it"),finishes:d.string().optional().describe('the user action that completes the task, verb first, e.g. "places the order"; the journey walks on to it'),kind:d.nativeEnum(AA).optional().describe("in-process when the repo's in-process tests (components, app routes) can walk the whole flow and check it; else browser"),source:d.nativeEnum(_j).optional().describe("spec or pr-description when one describes this flow (quote it under evidence), else inferred"),evidence:d.string().optional().describe("for spec or pr-description: its words that describe the flow"),testFile:d.string().describe("the browser test file it goes in, beside the repo's existing e2e tests")}),um=d.object({journey:d.string().describe("the plan's journey id"),file:d.string().describe("the browser test file that walks it"),brokeAt:d.object({step:d.number().int().describe("the 1-based step whose check failed first"),expected:d.string(),actual:d.string().describe("what the app did instead, from the runner's output"),notReached:d.array(d.number().int()).optional().describe("later steps the test could not get to")}).optional().describe("only when the journey's test failed on a check: where"),test:d.string().describe("the title of the one test in that file that walks it end to end")});var jbe=["stale_test","open_question"],Gbe=["low","medium","high","critical"];var lm=(r=>(r.Skyramp="skyramp",r.Llm="llm",r))(lm||{}),Ti=d.string().trim().min(1),yoe=d.object({case:Ti.describe("recommend id this assertion enforces"),evidence:Ti.describe("the exact assertion line from the file that checks that case's observable")}),mR=d.object({kind:d.nativeEnum(Mf).describe("seed: data the test creates in the app; runtime_mock: a mock on a Skyramp worker, which other tests reach too; env_override: an env value the app runs with. A stub inside the test's own process, such as a browser page's route, is none of these"),target:Ti.describe("the dependency, endpoint or data it affects"),mechanism:d.nativeEnum(Pf).describe("test_code: the test applies and undoes it; skyramp_mocker: a mock the test applies on a Skyramp worker; recipe_override: the mocker cannot reach the dependency (its URL is fixed in the build)"),detail:Ti.describe("what it sets up"),worker:Ti.optional().describe("skyramp_mocker: host:port of the worker the test applies the mock to (default localhost:35142)"),cleanup:Ti.optional().describe("seed: a command that removes the data when the test does not, run as written and without a shell: give real values, not a placeholder such as <id>, single-quote an argument that holds shell syntax, or put the logic in a script in the repository and run that")}),Eoe=d.object({file:Ti.describe("staged path under .skyramp/staged/"),source:d.nativeEnum(lm),language:Ti,covers:d.array(d.string()).min(1,"must be a non-empty array of recommend ids").describe("recommend ids this test covers"),assertions:d.array(yoe).min(1,"must be a non-empty array").describe("one per case covered, citing the real line"),context:d.array(mR).optional().describe("what the test sets up against the running app, in order: data it seeds, Skyramp mocks it applies, env overrides; omit when none")}),yR=d.object({schemaVersion:d.literal(1),tests:d.array(Eoe),deferredUi:d.array(d.string()).describe("recommend ui ids left for the UI stage (generate) \u2014 [] for generate-ui"),summary:Ti.describe("one paragraph")});var Di=d.string().trim().min(1),To=72,Ioe=d.object({repository:Di.optional().describe("owner/repo of the checkout this lint ran in, when the run has several; omit for the working checkout"),tool:d.string(),command:d.string().describe("the exact command you ran, scoped to the changed files"),clean:d.boolean(),fixed:d.array(d.string()).optional().describe("files you fixed"),uncovered:d.array(d.string()).describe("changed/new files this linter's own config does not match (wrong extension, wrong directory) \u2014 so `clean` never examined them, even though CI may still execute them. Empty array, not omitted, when every changed/new file IS covered.")}),Xbe=d.object({schemaVersion:d.literal(1),lint:d.array(Ioe).min(1).describe("one entry per checkout this run wrote tests in, each run from that checkout"),fileConventions:d.object({ok:d.boolean(),notes:d.string().optional()}),ciReadiness:d.object({covered:d.boolean().describe("will the repo's CI run these tests?"),notes:d.string().optional()}),dependencies:d.object({added:d.array(d.object({package:d.string(),manifest:d.string(),repository:Di.optional().describe("owner/repo of the manifest's checkout; omit for the working checkout"),reason:Di.optional().describe("why the test must run inside the application's own test environment, so its manifest had to change \u2014 required for every entry")})).describe("every package added to an APPLICATION manifest (an exception, surfaced in the report); never the Testbot test package's own")}),support:d.array(d.object({file:Di,repository:Di.optional().describe("owner/repo of the file's checkout; omit for the working checkout")})).optional().describe("the files the tests need besides themselves (helper modules, page objects, fixtures, snapshots), delivered with them"),commit:d.object({message:Di.refine(e=>e.split(`
|
|
153
153
|
`)[0].length<=To,{message:`subject line must be <= ${To} chars`})}),pr:d.object({title:Di.max(To,`must be <= ${To} chars`),body:Di}),ready:d.boolean().describe("a statement of fact: true only if the tests are fit to commit as they stand"),blockers:d.array(d.string()).describe("what blocks the commit \u2014 required non-empty when ready is false"),summary:Di.describe("one paragraph")});var _o=ke(require("fs")),gu=ke(require("path")),Mj=require("child_process");var ur="{junit}",dm=(i=>(i.Junit="junit",i.Trx="trx",i.GoTestJson="go-test-json",i))(dm||{}),ER=(t=>(t.Minitest="minitest",t))(ER||{}),Uj=d.string().trim().min(1),pu=d.object({cwd:Uj.describe('repo-relative directory the command starts in ("." for the root)'),argv:d.array(Uj).min(1).describe(`the command as separate arguments, run without a shell; for a junit or trx report an argument or env value holds ${ur}, where the report is written (not for Maven or Gradle, whose build writes its own)`),env:d.record(d.string(),d.string()).optional().describe("plain test or reporter settings beyond the repository's CI test job (RAILS_ENV=test, PLAYWRIGHT_JUNIT_OUTPUT_FILE={junit}); never a credential, PATH, or a tool's install path"),report:d.object({format:d.nativeEnum(dm).describe(`junit (JUnit XML to ${ur}), trx (to ${ur}), or go-test-json (go test -json on the command's output)`),reporter:d.nativeEnum(ER).optional().describe("a reporter Testbot loads for a runner that writes no report: minitest")}).optional().describe("the report the command writes; junit when omitted")});var fu="a framework other than pytest, jest, vitest and node --test (go test, rails test, mvn, dotnet test), or one the repository's test script runs through another command (ng test, nx test)",rwe=`pytest, Jest, Vitest and node --test tests run as the run already knows them, unless the repository's test script runs them through another command (ng test, nx test), which may be the only one that compiles them. A test in any other framework, or one run that way, also gives "run": the repository's own command for only those tests, from the directory the repository runs it in, as separate arguments without a shell. Its "report" says what the runner writes: junit (JUnit XML to ${ur} in the reporter's argument or env setting), trx (a TRX file to ${ur}, which every dotnet test writes with its built-in logger), or go-test-json (go test -json, read from the command's output). A Maven or Gradle command names no ${ur}: its build writes JUnit XML to its own report directory, which the run reads. Use a reporter the repository already has, or one of those; a reporter or converter the command fetches is the version the repository pins, or else its latest release (an older one may not build with the repository's toolchain). For minitest, which writes none, give report.reporter "minitest" and the run fills ${ur} itself. A setting the tests or reporter read goes in "env" (RAILS_ENV=test, or PLAYWRIGHT_JUNIT_OUTPUT_FILE=${ur} with playwright test --reporter=junit): the run sets it, so never wrap the command in a shell to set one. The run replaces ${ur} in argv and env with its report path, executes the command, and reads that report.`;var oa=(n=>(n.ExistingEvidenceSufficient="existing_evidence_sufficient",n.TargetedUnit="targeted_unit",n.RuntimeRequired="runtime_required",n.BlockedPreflight="blocked_preflight",n))(oa||{}),Do=(o=>(o.ExistingEvidence="existing_evidence",o.Unaffected="unaffected",o.ExistingUnit="existing_unit",o.NewUnit="new_unit",o.Runtime="runtime",o))(Do||{}),IR=(r=>(r.Repository="repository",r.Testbot="testbot",r))(IR||{}),CR=(i=>(i.Identified="identified",i.Passed="passed",i.Failed="failed",i))(CR||{}),vn=d.string().trim().min(1),Coe=d.string().regex(/^[a-z0-9][a-z0-9-]*$/,"must be a short lowercase slug").describe("short-slug");var voe=d.object({id:Coe,source:d.nativeEnum(IR),kind:d.nativeEnum(Ao),outcome:d.nativeEnum(CR),summary:vn.max(400).describe("one line: what it shows"),tests:d.array(vn).optional().describe("source repository: the existing tests, as repo-relative paths, optionally path::test-name"),repository:vn.optional().describe("source repository: owner/repo the tests live in, when the run has several checkouts; omit for the working checkout"),command:vn.optional().describe("source testbot: the exact command you ran, as you ran it"),run:pu.optional().describe(`source repository, for tests in ${fu}: how the run executes only these tests, all of them in one command, with the repository's own runner writing JUnit XML to {junit}. Name each test (path::test-name): a test is credited to a file only by its name or by a report that names the file`)}),boe=d.object({behaviorId:vn.describe("an id from analyze's behaviors"),mechanism:d.nativeEnum(Do),evidenceIds:d.array(vn).default([]).describe("existing_evidence: the ci-<n> or evidence ids that establish it; existing_unit: the evidence id naming the tests to run"),covers:d.string().trim().optional().describe('new_unit / runtime: the missing evidence this obtains, e.g. "the boundary the change moved"; unaffected: why the change cannot reach it, citing path:line')}),vR=(i=>(i.Browser="browser",i.RunningApp="running-app",i.Outside="outside",i))(vR||{}),woe=d.object({behaviorId:d.string().trim().optional().describe("an id from analyze's behaviors, when it is about one"),missing:vn.max(600).describe("the evidence that is required and cannot be obtained in this run"),needs:d.nativeEnum(vR).optional().describe("what that evidence needs: browser (only a real browser shows it), running-app (only the running app or its server shows it: its real requests, sign-in and permissions, what it saves), or outside (something the running app here could not give either: a third-party service it calls, hardware)")}),Boe=d.object({file:vn.describe("the changed file the failure is in"),repository:vn.optional().describe("owner/repo the file is in, when the run has several checkouts; omit for the working checkout"),reason:vn.max(300).describe("what prerequisite the change fails"),evidence:vn.max(400).describe("the error line, quoted")}),Qoe=d.object({behaviorId:vn.describe("an id from analyze's behaviors"),reason:vn.max(600).describe("\u2264600 characters: why this change leaves the behavior's result as it was, citing the unchanged line that decides it (path:line)")}),pA=d.object({schemaVersion:d.literal(1),decision:d.nativeEnum(oa),evidence:d.array(voe).describe("evidence this session found or produced; CI results are the ci-<n> items and are not restated here"),plan:d.array(boe).describe("how each changed behavior's evidence is obtained"),gaps:d.array(woe),outOfScope:d.array(Qoe).optional().describe("behaviors analyze found that this change neither changes nor states"),blocked:Boe.optional().describe("only for blocked_preflight"),rationale:vn.max(1200).describe("\u22641200 characters: why this evidence is enough, or what it still lacks \u2014 the scope you chose and why")});function Am(e){let t=Ke(e,"recommend.json");if(!t||!Array.isArray(t.generate)||!Array.isArray(t.maintenance))return;let r=t;return{...r,maintenance:r.maintenance.map(({repository:i,...n})=>({...n,test:n.test.trim().replace(/^\.\//,""),...i?.trim()?{repository:i.trim()}:{}}))}}s(Am,"readRecommend");function xoe(e){return Ln(yR,e).errors}s(xoe,"validateGenerateOutput");function $oe(e,t=[]){let{value:r,error:i}=Ft(e,t);if(i)return{errors:[i]};let n=xoe(r);return n.length>0?{errors:n}:{generate:r,errors:[]}}s($oe,"parseGenerateText");function pm(e,t=[]){return $oe(e.stdout,t)}s(pm,"parseGenerateFromSession");function Toe(e){return e.generate.filter(t=>t.type!=="ui").map(t=>t.id)}s(Toe,"backendCases");function Pj(e){return e.generate.filter(t=>t.type==="ui").map(t=>t.id)}s(Pj,"uiCases");var fm={backend:{stage:"generate",cases:Toe,noRecommendCoverage:"recommend.json missing or malformed \u2014 cannot check coverage",noRecommendIntent:"recommend.json missing or malformed \u2014 cannot check intent",uncovered:s(e=>`recommend case "${e}" is not covered by any generated test`,"uncovered"),unknownCovered:s(e=>`test covers unknown recommend id "${e}"`,"unknownCovered"),unasserted:s(e=>`case "${e}" has no verified assertion enforcing its expected_observable`,"unasserted"),usedCodegen:p1,codegenHint:"These tests were hand-written. Skyramp codegen (skyramp_contract_test_generation / skyramp_integration_test_generation) was available but not used \u2014 it computes valid sample data and response correlations. Prefer scaffolding with it and then refining, especially for the failures above."},ui:{stage:"generate-ui",cases:Pj,noRecommendCoverage:"recommend.json not found \u2014 cannot check UI coverage",noRecommendIntent:"recommend.json not found \u2014 cannot check UI intent",uncovered:s(e=>`UI case "${e}" is not covered by any generated UI test`,"uncovered"),unknownCovered:s(e=>`test covers "${e}" which is not a recommend UI case`,"unknownCovered"),unasserted:s(e=>`UI case "${e}" has no verified assertion enforcing its expected_observable`,"unasserted"),usedCodegen:f1,codegenHint:"This UI test was hand-authored. Skyramp UI codegen (skyramp_ui_test_generation) was available but not used. Prefer scaffolding with it and then refining, especially for the failures above."}},Pwe=rr("generate-schema",(e,t)=>pm(t,e.secretValues));function Doe(e){let t=fm[e];return{name:`${t.stage}-coverage`,verify(r,i){let{generate:n,errors:o}=pm(i,r.secretValues);if(!n)return Vt(this.name,o);let a=Am(r);if(!a)return Vt(this.name,[t.noRecommendCoverage]);let c=new Set(n.tests.flatMap(p=>p.covers)),u=[],l=t.cases(a);for(let p of l)c.has(p)||u.push(t.uncovered(p));let A=new Set(e==="ui"?l:a.generate.map(p=>p.id));for(let p of c)A.has(p)||u.push(t.unknownCovered(p));if(e==="backend"){let p=new Set(n.deferredUi),g=new Set(Pj(a));for(let h of g)!p.has(h)&&!c.has(h)&&u.push(`UI case "${h}" is neither covered nor deferred to the UI stage`);for(let h of p)g.has(h)||u.push(`deferredUi lists "${h}" which is not a UI case`)}return u.length===0?{name:this.name,passed:!0}:Vt(this.name,u)}}}s(Doe,"generateCoverageGateFor");function _oe(e){let t=fm[e];return{name:`${t.stage}-intent`,verify(r,i){let{generate:n,errors:o}=pm(i,r.secretValues);if(!n)return Vt(this.name,o);let a=Am(r);if(!a)return Vt(this.name,[t.noRecommendIntent]);let{asserted:c,errors:u,badFiles:l}=Ooe(n,r.inputs.repositoryPath),A=u.length;for(let g of t.cases(a))c.has(g)||u.push(t.unasserted(g));if(u.length===0)return{name:this.name,passed:!0};let p=Vt(this.name,u);return A>0&&A===u.length&&l.size>0?{...p,droppable:[...l]}:p}}}s(_oe,"generateIntentGateFor");function Noe(e){let t=fm[e];return r=>{if(!r.inputs.skyrampMcp?.command||e==="backend"&&!uR(r))return;let i=gu.join(r.outputsDir,`${t.stage}-stream.ndjson`);if(!(!_o.existsSync(i)||t.usedCodegen(i)))return g1(i)?t.codegenHint:"Skyramp codegen tools were configured but the MCP server did not connect this session, so they were not available. Hand-authoring was the only option; this is an environment problem, not yours."}}s(Noe,"codegenRetryHintFor");var Lwe=Doe("backend"),Owe=_oe("backend"),jwe=Noe("backend");var Fj=s(e=>e.replace(/\s+/g,""),"squeeze");var bR={python:[/\bassert\s*[({\w"'`]/g,/\bpytest\.raises\s*\(/g,/\bself\.assert\w*\s*\(/g],typescript:[/\bexpect\s*\(/g,/\.should\b/g,/\bassert\s*[.(]/g],go:[/\bt\.(Error|Errorf|Fatal|Fatalf|Fail|FailNow)\s*\(/g,/\b(assert|require)\.\w+\s*\(/g],java:[/\bassert\w*\s*\(/g,/\bassertThat\s*\(/g],ruby:[/\bexpect\s*[({]/g,/\bassert\w*\b/g,/\.should\b/g]};for(let[e,t]of[["javascript","typescript"],["kotlin","java"]])bR[e]=bR[t];function Uoe(e,t){if(e.includes(ed(t))||Fj(e).includes(Fj(t)))return!0;let r=t.split(/\r?\n/).map(i=>i.trim()).filter(i=>i&&!/^(\/\/|#|\*|\/\*)/.test(i));return r.length>0&&r.every(i=>e.includes(ed(i)))?!0:Loe(e,t)}s(Uoe,"evidenceFound");var Foe=/\bassert\w*\b|\bexpect\s*\(|\.should\b|\brequire\s*\(/i,Moe=12,Poe=/,\s*\(\s*#|,\s*f?["'`]|\s+#\s|\s+\/\/|\s*\((?:line|lines|at line)\b|\s*,\s*$/i;function Loe(e,t){let r=t.split(/\s*;\s*|\s*\.\.\.\s*|\r?\n/),i=0;for(let n of r){let o=Foe.exec(n);if(!o)continue;let a=n.slice(o.index),c=Poe.exec(a);if(c&&(a=a.slice(0,c.index)),a=ed(a).replace(/[,\s]+$/,""),a.length<Moe||!e.includes(a))return!1;i++}return i>0}s(Loe,"annotatedAssertionFound");function Ooe(e,t){let r=new Set,i=[],n=new Set;for(let o of e.tests){let a=gu.resolve(t,o.file);if(!_o.existsSync(a))continue;let c=ed(_o.readFileSync(a,"utf-8"));for(let u of o.assertions??[]){if(!Uoe(c,u.evidence)){i.push(`assertion evidence for "${u.case}" not found in ${o.file} \u2014 cite the real assertion line`),n.add(o.file);continue}o.covers.includes(u.case)?r.add(u.case):(i.push(`assertion cites case "${u.case}" not in that test's covers[]`),n.add(o.file))}}return{asserted:r,errors:i,badFiles:n}}s(Ooe,"verifiedAssertions");var joe=/\.(spec|test)\.[cm]?[jt]sx?$/i;function Lj(e){let t;try{t=(0,Mj.execFileSync)("git",[...xo,"status","--porcelain","--untracked-files=all"],{env:Cn(),cwd:e,encoding:"utf-8",stdio:["ignore","pipe","ignore"]})}catch{return}let r=s(n=>/_scaffold/i.test(n)||Xf.test(n),"isTestLitter"),i=[];for(let n of t.split(`
|
|
154
154
|
`)){if(!n.trim()||n.length>1&&n[1]==="D")continue;let o=n.slice(3).trim(),a=o.indexOf(" -> ");if(a!==-1&&(o=o.slice(a+4).trim()),o=o.replace(/^"|"$/g,""),!o)continue;let c=o.replace(/^\.\//,"");c.startsWith(".skyramp/")||!r(c)||i.push(c)}return i}s(Lj,"testLitter");function Goe(e){let t=fm[e],r=e==="ui";return{name:`${t.stage}-no-litter`,verify(i){let n=Lj(i.inputs.repositoryPath);if(n===void 0)return{name:this.name,passed:!0};let o=n.filter(a=>joe.test(a)===r);return o.length===0?{name:this.name,passed:!0}:Vt(this.name,[`${t.stage} left files outside .skyramp/ \u2014 move the staged test into .skyramp/staged/ and delete any codegen draft (e.g. *_scaffold.*): ${o.slice(0,6).join(", ")}`])}}}s(Goe,"noLitterGateFor");var Gwe=Goe("backend");var fA=ke(require("fs")),sa=ke(require("path"));function jj(e){return Ln(dR,e).errors}s(jj,"validateAdaptOutput");function Joe(e,t=[]){let{value:r,error:i}=Ft(e,t);if(i)return{errors:[i]};let n=jj(r);return n.length>0?{errors:n}:{adapt:r,errors:[]}}s(Joe,"parseAdaptText");var qoe="adapt-scratch",Oj=`${qoe}/adapt-result.json`;function Gj(e,t){let r=sa.join(e.outputsDir,Oj),i;try{i=fA.readFileSync(r,"utf-8")}catch{i=void 0}if(i!==void 0&&(e.secretValues??[]).some(a=>i.includes(a)))return{errors:[`${Oj} contains a secret value (token / credential) \u2014 never write it anywhere`]};let n=Joe(t.stdout,e.secretValues);if(n.adapt)return n;let o=i!==void 0?Ns(r):void 0;return o!==void 0&&jj(o).length===0?{adapt:o,errors:[]}:n}s(Gj,"parseAdaptFromSession");var dBe=rr("adapt-schema",Gj);var Vj=require("child_process");function zj(e){return Hoe(e)??[]}s(zj,"statusEntries");function Hoe(e){let t;try{t=(0,Vj.execFileSync)("git",[...xo,"status","--porcelain","-z","--untracked-files=all"],{env:Cn(),cwd:e,encoding:"utf-8",maxBuffer:16*1024*1024})}catch{return}let r=t.split("\0"),i=[];for(let n=0;n<r.length;n++){let o=r[n];if(o.length<4)continue;let a=o.slice(0,2);i.push({code:a,path:o.slice(3)}),(a[0]==="R"||a[0]==="C")&&n++}return i}s(Hoe,"readStatusEntries");var CBe=2*1024*1024;var hm=d.string().trim().min(1),Yoe=d.object({cwd:hm.describe(`directory the command starts in, relative to the test's checkout ("." for its root)`),argv:d.array(hm).min(1).describe("the command as separate arguments, run without a shell"),env:d.record(d.string(),d.string()).optional().describe("plain settings the listing needs beyond the CI step's own; never a credential or PATH")}),Woe=d.object({file:hm.describe("a file of the test's checkout, relative to its root"),line:hm.describe("a line of that file, quoted exactly from where its command starts to its end")}),Jj=d.object({collected:d.boolean().describe("whether the repo's CI runs this test as it is"),steps:d.array(Woe).optional().describe("when collected: the line in a CI file that starts the tests, then each line it runs on the way to the test runner"),runner:d.string().optional().describe("when collected: the test runner the last of those lines starts, by the name that line and the list command both use"),list:Yoe.optional().describe("when collected: a command that lists the tests that runner collects without running them; Testbot runs it, and its output must name this file"),why:d.string().optional().describe("when not collected: why the repo's CI will not run it")});var ie=d.string().trim().min(1),tse=s(e=>{if(!e||typeof e!="object")return e;let t=e;return typeof t.skip=="string"&&t.skip.trim()&&(t.expected===void 0||t.expected===null)?{...t,expected:"(not tested)"}:e},"skippedNeedsNoExpected"),nse=d.preprocess(tse,d.object({id:ie.describe(`its requirement's id plus a letter, e.g. "R1a", "AC-3a"`),clause:ie.describe("one testable part of the requirement"),expected:ie.describe("the outcome the requirement calls for \u2014 taken from the requirement, never from what the code does"),skip:d.string().optional().describe("only when no test can check this clause here: why"),type:d.nativeEnum(Ro).optional().describe("the test that checks this clause: contract / integration (the API, or code called directly in-process: a function, hook or module) or ui (a page)"),target:d.string().optional().describe('its "METHOD /path", or the page / flow'),steps:d.string().optional().describe("what that test does; its expected outcome is this clause's"),finding:d.string().optional().describe("the finding id, when this clause's test also catches that defect (the defect still gets a case of its own)"),code:d.string().optional().describe("path:line of the code that decides this clause, when there is one; in another repo of the change, that repo's directory name then its path"),stated:d.string().optional().describe("the description's or spec's own words that state this clause, copied exactly, when they do"),mutates:d.boolean().optional().describe("true when its test changes state, in the test or its setup: an API POST, PUT, PATCH or DELETE, or a UI flow that submits, creates, edits or deletes"),browserOnly:d.boolean().optional().describe("true when its behaviour happens only in a browser: real clicks or keys driving page script, client-side sorting or filtering, script-driven DOM updates, focus, drag-and-drop, navigation, rendering that depends on CSS or JavaScript"),browserHarness:d.string().optional().describe("browserOnly, off the runtime path: the path of the repo's in-process browser suite its test goes in (e.g. a Django StaticLiveServerTestCase test that drives Selenium)"),quote:d.string().optional().describe("the words of the spec, plan, ticket or PR description that state this clause, copied exactly; a file of the repository: its path:line first. Leave it out when no source states it"),inferred:d.boolean().optional().describe("leave it out: Testbot sets it when no source states this clause (contracts/clause-grounding.ts)")})),Hj=d.object({spec:d.string().optional().describe("file:line of a spec in the repository"),prDescription:d.boolean().optional().describe("or true when a pull request description says otherwise"),reference:d.string().optional().describe("or the key of an item the run was given, as listed"),says:ie.describe("what it says there, in its own words, copied exactly"),criterion:d.number().int().positive().optional().describe("an item's only: leave it out; Testbot numbers it")}).refine(e=>[!!e.prDescription,!!e.spec?.trim(),!!e.reference?.trim()].filter(Boolean).length===1,{message:`names no source, or more than one: give "spec" its file:line or "reference" an item's key, or set "prDescription", one of them; list each source as its own entry`}),rse=d.object({id:ie.describe('the label its source gives it ("AC-3", "REQ-12"; item 4 of a numbered list is "R4"), else "R1", "R2"\u2026 in order'),statement:ie,source:d.nativeEnum(Zr).describe("requirement-reference (an item the run was given), spec, pr-description (also for what the change is evidently meant to do when nothing is written down), or could-break (what the change could break that no requirement mentions)"),reference:d.string().optional().describe('requirement-reference only: the key of its item as listed, e.g. "PAY-184", or a Confluence page id such as "3021"'),evidence:ie.describe("where it is stated: for requirement-reference, the item's own words, copied exactly; else file:line, a doc section, or the quoted phrase"),criterion:d.number().int().positive().optional().describe("requirement-reference only: leave it out; Testbot numbers each criterion by the item's own label (AC2, 2.), else after the item's labels"),notInChange:d.string().optional().describe("requirement-reference only: when the change does not touch this criterion at all (e.g. a later step of a staged rollout), why; give it no clauses"),overrules:d.array(Hj).optional().describe("requirement-reference only: each lower-ranked source that says otherwise, a spec in the repository, a PR description or another item; this requirement wins, so test what it says"),clauses:d.array(nse)}),Yj=(n=>(n.ServerError="server-error",n.DataLost="data-lost",n.FinalState="final-state",n.DerivedValues="derived-values",n))(Yj||{}),ise=d.object({id:ie.describe('e.g. "F1"'),file:ie,line:d.number().optional(),claim:ie.describe("the defect, in one sentence"),severity:d.nativeEnum(ra),evidence:ie.describe("the code line, or the probe request and response, that shows it"),conflictsWith:d.array(ie).optional().describe("requirement or clause ids it violates"),keeps:d.string().optional().describe("for a defect no requirement or clause states: path:line of the code beside the change that keeps the rule it breaks"),rule:d.nativeEnum(Yj).optional().describe("for a defect that breaks a rule every app keeps, which nothing needs to state: which one"),existing:d.string().optional().describe("only when the base already does this, in code the change left as it was: where the base does it (its file:line); such a defect gets no case"),needsApp:d.enum(["browser","live-api"]).optional().describe("only when the running app alone can show this defect and the repo has no in-process test that can: browser (page script, what the user sees after a click or a save) or live-api (code the repo tests only against the running app's API)")}),ose=d.object({id:ie.describe('e.g. "Q1"'),question:ie.describe("what is unsettled, as a question the PR author can answer"),readings:d.array(ie).min(2).describe("each reasonable behaviour, with what points to it (file:line, or the words that suggest it)"),about:d.string().optional().describe("the requirement or clause id it is about, when there is one"),sources:d.array(Hj).optional().describe("when sources of the same rank disagree on it: each of them")}),sse=d.object({id:ie.describe('unique, a short kebab-case name for what the case checks, e.g. "ship-twice-409"'),type:d.nativeEnum(Ro).describe("contract / integration: checks the API, or calls code directly in-process (a function, hook or module); ui: checks what a user sees or does on a page"),target:ie.describe('"METHOD /path", or the page / flow'),clause:d.string().optional().describe("the clause id this case checks"),finding:d.string().optional().describe("the finding id this case catches"),steps:ie.describe("what the test does"),expected:ie.describe("the expected outcome, from the clause"),mutates:d.boolean().optional().describe("true when its test changes state, in the test or its setup: an API POST, PUT, PATCH or DELETE, or a UI flow that submits, creates, edits or deletes")}),ase=d.object({test:ie.describe("existing test file"),action:d.nativeEnum(Ri),reason:ie,mutates:d.boolean().optional().describe("true when the maintained test changes state"),clauses:d.array(ie).optional().describe("the clause ids this test checks")}),qj=d.array(RC).optional(),cse=d.object({components:d.preprocess(e=>qj.safeParse(e).success?e:void 0,qj).describe("when saving a new or changed recipe: every app and backing service actually brought up, its source repository, and whether it is healthy"),outcome:d.nativeEnum(vi).describe("clean | recipe-drift (you had to fix the recipe) | change-broke-bringup (this PR broke start-up) | bringup-failed (the environment, not the PR)"),baseUrls:d.record(d.string()).optional().describe("service \u2192 base URL of the running app"),health:d.object({url:d.string().optional(),command:d.string().optional(),output:d.string().optional()}).optional().describe("the check that shows the app serves real data, and what it returned"),teardown:d.string().optional().describe("command that stops the app"),dependencies:d.record(d.boolean()).optional().describe("every backing service: true = really running, false = mocked"),recipeFixes:d.array(d.string()).optional().describe("what you changed in the recipe"),error:d.string().optional().describe("when it did not come up: the failing command and what it printed"),suspectFiles:d.array(d.string()).optional().describe("change-broke-bringup: the changed files to blame"),login:d.object({username:ie,password:d.string()}).optional().describe("the account the tests sign in as, when they sign in: each a literal value the recipe seeds, or $VARIABLE when a secret in the environment holds it"),revisions:TC.optional()}),tQe=d.object({schemaVersion:d.literal(1),requirements:d.array(rse),findings:d.array(ise),cases:d.array(sse).describe("a second test for a clause, and one case per finding that fails on this branch"),questions:d.array(ose).optional().describe("behaviours the change leaves unsettled; no case asserts any of them"),maintenance:d.array(ase),journeys:d.array(Nj).optional().describe("the user journeys that, together, pass through everything the change alters that a user sees or does; empty when it alters nothing a user sees"),notInJourney:d.array(d.object({clause:ie,why:ie})).optional().describe("a clause a user sees or does that no journey walks, and why: none can reach it through the UI, or it is downstream of this change and not walked here"),unplannedComponents:d.array(d.object({components:d.array(ie).min(1).describe("changed components, as the change lists them"),why:ie})).optional().describe("changed components no clause reaches, and why their change needs no test; several may share one reason"),triage:pA.optional().describe("the validation triage decision, made before the app is started; its behaviorIds are clause ids"),app:cse.optional().describe("omit when no app was needed or none was started"),summary:ie.describe("one paragraph: what the change does and where the risk is")});var mm=(r=>(r.Backend="backend",r.Ui="ui",r))(mm||{});var hu=(n=>(n.Added="added",n.Updated="updated",n.Deleted="deleted",n.Unchanged="unchanged",n))(hu||{}),use=d.object({file:ie.describe("repo-relative path; in another repo of the change, that repo's directory name then its path"),kind:d.nativeEnum(mm),change:d.nativeEnum(hu).describe("added: a file you created; updated / deleted / unchanged: an existing test"),covers:d.array(d.string()).describe("the plan case ids this file tests, each with its own result under result.cases"),defect:d.boolean().optional().describe("true when a case of it fails because the app is wrong and the test is right \u2014 kept failing on purpose"),staleBecause:d.object({requirement:ie.describe("the requirement or clause id the change deliberately alters"),line:ie.describe("path:line (or path) of the application code the change altered that makes this test's old expectation wrong")}).optional().describe("for an existing test you updated: why it is out of date"),result:d.object({exit:d.number().nullable().describe("exit code of your last run of this file; null if it could not be run"),cases:d.array(d.object({case:ie,status:d.nativeEnum(cr),defect:d.boolean().optional().describe("for a failing case: true when the app is wrong and the test is right; false when the test is at fault and you could not fix it"),failure:d.string().optional().describe("for a failing case: the runner's failure for it as printed (the error and the line it was raised at), not a summary"),cause:d.string().optional().describe("for a case you keep as a defect: path:line of the application code that makes it fail"),requires:d.string().optional().describe("for a case you keep as a defect: the words of the PR description, a requirement or clause of the plan, or the code a finding's keeps names, that state what its failing check expects, quoted exactly")})).describe("one entry per covered case, from the runner's own output"),details:d.string().optional().describe("what failed and why, or why it was not run")}),assertions:d.array(d.object({case:ie,evidence:ie})).optional().describe("per covered case, the assertion line that checks its expected outcome"),functions:d.array(d.object({name:ie.describe("the test function as the runner names it within its file, without the file (test_x, TestClass::test_x, TestSuite/TestCase)"),cases:d.array(ie).describe("the plan case ids it checks")})).optional().describe("for a file you added or updated: each test function in it and the plan case ids it checks"),skyramp:d.object({draft:d.union([d.string(),d.array(d.string())]).optional().describe("the draft path the Skyramp helper returned for this test, or each path when the test was made from several drafts"),handWritten:d.string().optional().describe("why it is written by hand: the helper call you made and what it returned")}).optional().describe("only for a test of a case the Skyramp API block lists: where it came from"),context:d.array(mR).optional().describe("what the test sets up outside its own process that another test could run into: data it creates in the app, a Skyramp mock, an env override; omit when none"),isolatedRun:ie.optional().describe("for a test with a context: the command, from its checkout's root and without a shell, that runs only this file"),ci:Jj.optional().describe("for a file you added or updated: whether the repo's CI will run it, and how you know"),run:pu.optional().describe(`for a file in ${fu}, added, updated or re-run: how the run executes only this file's tests, with the repository's own runner and the report it writes (junit or trx to ${ur}, or go-test-json); Testbot runs it before write ends and re-runs the tests with it`)}),lse=s(e=>{if(!e||typeof e!="object")return e;let{test:t,...r}=e;return typeof t=="string"&&t.trim()&&r.tests===void 0?{...r,tests:[t]}:e},"oneTestIsTests"),dse=d.preprocess(lse,d.object({description:ie.describe("what is wrong and how to reproduce it: endpoint or page, input, what you got vs what was expected"),severity:d.nativeEnum(ra).optional(),sourceFile:d.string().optional().describe("the app file at fault"),sourceLine:d.number().optional(),tests:d.array(ie).optional().describe("every test file that fails because of it: a defect several tests show is one issue"),finding:d.string().optional().describe("the plan's finding id, when it is one"),requirements:d.array(ie).optional().describe("the plan's requirement or clause ids it violates")})),nQe=d.object({schemaVersion:d.literal(1),tests:d.array(use),notWritten:d.array(d.object({case:ie,reason:ie,coveredBy:d.object({file:ie.describe("the test file, relative to the working checkout; prefix a related checkout as for tests[].file"),name:ie.describe("the test function as the runner names it within its file, without the file (test_x, TestClass::test_x, TestSuite/TestCase)")}).optional().describe("only for an existing test triage independently linked to this exact case: its exact runner name (including class or describe titles). Testbot must finish re-running it with every result passed. If your own test covers the case, include the case in its covers and function cases instead")})).describe("every plan case no test covers, and why"),journeys:d.array(um).optional().describe("one entry per planned user journey: the browser test that walks it end to end"),lint:d.object({command:d.string(),clean:d.boolean()}).optional().describe("the linter/formatter you ran on your test files, if the repo has one: the exact command, with its file paths (Testbot re-runs it)"),dependenciesAdded:d.array(d.object({package:ie,manifest:ie.describe("the manifest file's path relative to its checkout (e.g. package.json, pom.xml or pyproject.toml), and nothing else; name another checkout in repository"),repository:ie.optional().describe("owner/repo of the manifest's checkout; omit for the repo under test"),reason:ie.optional().describe("why the test must run inside the application's own test environment, so its manifest had to change \u2014 required for every entry")})).optional().describe("every package you added to an APPLICATION manifest (an exception, surfaced in the report); never the Testbot test package's own"),supportFiles:d.array(ie).optional().describe("every file that is not a test you created or changed for your tests, which they need to compile or run (a helper module, page object, fixture, or a snapshot the runner wrote for them), named as you name a test; Testbot delivers only the tests you list and the files under supportFiles"),ciNotes:d.string().optional().describe("for each test whose ci says the repo's CI will not run it: the test, and the exact change the author must make for CI to run it"),commit:d.object({message:ie.describe("subject line at most 72 characters, following the repository's commit-message checks"),prTitle:ie.describe("at most 72 characters, following the repository's PR-title checks"),prBody:ie.describe("what the tests cover and what they found")}),report:d.object({summary:ie.describe("1-2 sentences for the PR author: does the change do what it says?"),issues:d.array(dse).describe("every defect the tests found"),nextSteps:d.array(d.string()),noTests:d.array(d.object({repository:ie,reason:ie.max(4096)})).max(1e3).optional().describe("each Change Set repository where no test was added or updated: its owner/repo and why, naming the other repository when its tests went there")})});var rQe={added:"place",updated:"update",deleted:"delete",unchanged:"verify"};var Zj=(i=>(i.Requirement="requirement",i.PrDescription="pr_description",i.Code="code",i))(Zj||{}),Mt=d.string().trim().min(1),Ase=d.object({expectation:Mt.max(300).describe("the behavior this assertion pins, in words"),source:d.nativeEnum(Zj),expected:Mt.max(200).describe("the exact value or outcome asserted, as the test asserts it")}),pse=d.object({file:Mt.describe("path of the NEW test file you wrote, relative to its repository"),repository:Mt.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),framework:Mt.describe("the framework the repository runs this file with: pytest, jest, vitest, node-test, or the name of any other"),run:pu.optional().describe(`for ${fu}: how the run executes only the tests in names, with the repository's own runner writing JUnit XML to {junit}`),covers:d.array(Mt).length(1).describe("the ONE behavior id, or defect id, from the plan that the tests in names provide evidence for; a file covering several is listed once per id"),names:d.array(Mt).min(1).describe("the test functions/cases in the file that provide evidence for that behavior, as the framework names them"),assertions:d.array(Ase).min(1)}),ym=(r=>(r.Updated="updated",r.Deleted="deleted",r))(ym||{}),Wj=300,fse=d.object({file:Mt.describe("path of the EXISTING test file you updated or deleted, relative to its repository"),repository:Mt.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),change:d.nativeEnum(ym),staleBecause:d.object({requirement:Mt.describe("the requirement or clause id the change deliberately alters"),line:Mt.describe("path:line (or path) of the application code the change altered that makes this test's old expectation wrong")}).optional().describe("for an existing test you updated: why it is out of date"),reason:d.preprocess(e=>typeof e=="string"?e.trim().slice(0,Wj):e,Mt.max(Wj)).describe("what the change deliberately altered that made the test wrong")}),wR=d.object({schemaVersion:d.literal(1),tests:d.array(pse),maintained:d.array(fse).optional().describe("existing tests the change made stale that you updated or deleted; omit when there were none"),defectsNotTested:d.array(d.object({id:Mt,reason:Mt.max(300)})).optional().describe("defects the plan found that no in-process test can reach, each with why; omit when every defect has a test"),journeys:d.array(um).optional().describe("one entry per planned user journey: the in-process test that walks it end to end"),journeysNotWritten:d.array(d.object({journey:Mt,missing:Mt.transform(e=>e.length>300?`${e.slice(0,299)}\u2026`:e)})).optional().describe("a planned journey no in-process test can walk here, with what it needs that is missing; it is reported as not covered"),lint:d.object({command:d.string(),clean:d.boolean()}).optional().describe("the linter/formatter you ran on your test files, if the repository has one you can run; omit otherwise"),commitMessage:Mt.optional().describe("the commit message for your tests: a subject line of at most 72 characters, then what they cover")});var Im="generate-unit.json";function mse(e){let{value:t,error:r}=Ft(e);if(r)return{errors:[r]};let{value:i,errors:n}=Ln(wR,t);return n.length?{errors:n}:{output:i,errors:[]}}s(mse,"parseGenerateUnitText");function yse(e){return mse(e.stdout)}s(yse,"parseGenerateUnitFromSession");var zQe=rr("generate-unit-schema",(e,t)=>yse(t));var Em=String.raw`(?:node:)?(?:http|https|http2|net|tls|dgram)`,JQe=[[/\b(localhost|127\.0\.0\.1|0\.0\.0\.0)\b/,"a local server address"],[/^\s*(import|from)\s+(requests|aiohttp|urllib3|websockets?)\b/m,"an HTTP client"],[/^\s*(?:import|from)\s+(?:urllib\.request|http\.client|http\.server|socket|ssl|ftplib|smtplib|telnetlib)\b|^\s*from\s+urllib\s+import\b[^\n]*\brequest\b|\burlopen\s*\(/m,"a standard-library network client"],[/\bfrom\s+["'](axios|node-fetch|undici|ws)["']|require\(\s*["'](axios|node-fetch|undici|ws)["']\s*\)/,"an HTTP client"],[new RegExp(String.raw`\bfrom\s+["']${Em}["']|\bimport\s+["']${Em}["']|require\(\s*["']${Em}["']\s*\)|\bimport\(\s*["']${Em}["']\s*\)`),"Node's network modules"],[/\bfetch\s*\(|\bnew\s+(XMLHttpRequest|WebSocket)\b/,"a network call (fetch, XMLHttpRequest, WebSocket)"],[/\bskyramp\b/i,"the Skyramp runtime (a runtime mock or client)"]];var yke=new Set(["targeted_unit","existing_evidence_sufficient"]);var Cse="triage.json";var uSe=new Set(["existing_evidence","unaffected","existing_unit","new_unit","runtime"]),lSe={existing_evidence:"existing evidence",unaffected:"showing the change cannot reach it",existing_unit:"running the existing unit tests",new_unit:"a new unit test",runtime:"tests against the running application"};function vse(e){let{value:t,error:r}=Ft(e);if(r)return{errors:[r]};let{value:i,errors:n}=Ln(pA,t);return n.length?{errors:n}:{triage:i,errors:[]}}s(vse,"parseTriageText");function bse(e){return vse(e.stdout)}s(bse,"parseTriageFromSession");var dSe=rr("triage-schema",(e,t)=>bse(t));function wse(e){let t=e.inputs?.pipeline;return t?e.state.stages[t==="two-step"?"plan":"triage"]:e.state.stages.triage??e.state.stages.plan}s(wse,"triageDecider");function BR(e){if(wse(e)?.status==="passed")return Ns(tG.join(e.outputsDir,Cse))}s(BR,"readTriage");function QR(e){return b1(xS(e.inputs,Ke(e,`${oA}.json`),BR(e)?.sutRequired))}s(QR,"revisionBlockReason");var ASe=new Set(["deploy","recommend","generate","generate-ui","adapt","generate-unit","native-run","finalize","deliver"]);var Xr=ke(require("fs")),Uo=ke(require("path")),HG=ke(require("crypto")),YG=require("child_process");var kR=require("child_process"),mu=ke(require("fs")),nG=ke(require("os")),bm=ke(require("path"));var Bse={onPath:s(e=>(0,kR.spawnSync)("sh",["-c",`command -v ${e}`],{stdio:"ignore"}).status===0,"onPath"),run:s((e,t)=>(0,kR.spawnSync)(e[0],e.slice(1),{cwd:t,stdio:"ignore",timeout:6e4}).status??1,"run")},vm={cleanup:s(()=>{},"cleanup")},Qse=new Set(["pnpm","yarn"]);function rG(e,t=nG.tmpdir(),r=Bse){if(process.platform==="win32")return vm;try{let i=iR(e);if(!Qse.has(i)||r.onPath(i)||!r.onPath("corepack"))return vm;mu.mkdirSync(t,{recursive:!0});let n=mu.mkdtempSync(bm.join(t,"testbot-pm-")),o=s(()=>mu.rmSync(n,{recursive:!0,force:!0}),"cleanup");return r.run(["corepack","enable","--install-directory",n,i],e)!==0?(o(),vm):{dir:n,cleanup:o}}catch{return vm}}s(rG,"packageManagerShims");function iG(e,t=process.env){return e.dir?{...t,PATH:[e.dir,t.PATH].filter(Boolean).join(bm.delimiter)}:t}s(iG,"withShims");var yA=require("crypto");function Kr(e){let t=Math.max(0,...(e.match(/`+/g)??[]).map(n=>n.length)),r="`".repeat(t+1),i=e.startsWith("`")||e.endsWith("`")?" ":"";return`${r}${i}${e}${i}${r}`}s(Kr,"codeSpan");oc();IC();oc();var LSe=5*6e4,OSe=12*6e4;var HSe=["class TestbotProjectBrowsers {"," onBegin(config) {",' const projects = config.projects.map((p) => ({ browserName: p.use.browserName ?? p.use.defaultBrowserType ?? "chromium", channel: p.use.channel ?? null }));',' process.stdout.write("TESTBOT_PROJECT_BROWSERS " + JSON.stringify(projects) + "\\n");'," }"," printsToStdio() { return true; }","}","module.exports = TestbotProjectBrowsers;",""].join(`
|
|
155
|
-
`);var tRe=[...kS,"AWS_REGION","AWS_DEFAULT_REGION","AWS_ENDPOINT_URL","AWS_ENDPOINT_URL_BEDROCK_RUNTIME","AWS_ENDPOINT_URL_STS","AWS_SHARED_CREDENTIALS_FILE","AWS_CONFIG_FILE","CLAUDE_CODE_USE_BEDROCK","CLAUDE_CODE_USE_VERTEX","ANTHROPIC_BASE_URL","ANTHROPIC_BEDROCK_BASE_URL"].filter((e,t,r)=>r.indexOf(e)===t);var dRe=process.env.RUNNER_TOOL_CACHE||"/opt/hostedtoolcache";var bRe={jest:"jest",vitest:"vitest"};var gxe=5*6e4;function xse(e){return Ln(hR,e).errors}s(xse,"validateAnalysisOutput");function cG(e,t=[]){let{value:r,error:i}=Ft(e,t);if(i)return{errors:[i]};let n=xse(r);return n.length>0?{errors:n}:{analysis:r,errors:[]}}s(cG,"parseAnalysisText");function $se(e,t=[]){return cG(e.stdout,t)}s($se,"parseAnalysisFromSession");var t$e=rr("analysis-schema",(e,t)=>$se(t,e.secretValues));var o0e=kf.rows.notRun(!0);var gA="kept, not "
|
|
155
|
+
`);var tRe=[...kS,"AWS_REGION","AWS_DEFAULT_REGION","AWS_ENDPOINT_URL","AWS_ENDPOINT_URL_BEDROCK_RUNTIME","AWS_ENDPOINT_URL_STS","AWS_SHARED_CREDENTIALS_FILE","AWS_CONFIG_FILE","CLAUDE_CODE_USE_BEDROCK","CLAUDE_CODE_USE_VERTEX","ANTHROPIC_BASE_URL","ANTHROPIC_BEDROCK_BASE_URL"].filter((e,t,r)=>r.indexOf(e)===t);var dRe=process.env.RUNNER_TOOL_CACHE||"/opt/hostedtoolcache";var bRe={jest:"jest",vitest:"vitest"};var gxe=5*6e4;function xse(e){return Ln(hR,e).errors}s(xse,"validateAnalysisOutput");function cG(e,t=[]){let{value:r,error:i}=Ft(e,t);if(i)return{errors:[i]};let n=xse(r);return n.length>0?{errors:n}:{analysis:r,errors:[]}}s(cG,"parseAnalysisText");function $se(e,t=[]){return cG(e.stdout,t)}s($se,"parseAnalysisFromSession");var t$e=rr("analysis-schema",(e,t)=>$se(t,e.secretValues));var o0e=kf.rows.notRun(!0);var gA="kept, not ";var hA="(declined the planned ";function SR(e){if(!e)return[];let t=[],r=0,i=0;for(let n=0;n<e.length;n++){let o=e[n];o==="("?r++:o===")"?r=Math.max(0,r-1):r===0&&o===";"&&e[n+1]===" "&&e[n-1]===")"&&(t.push(e.slice(i,n)),i=n+2)}return t.push(e.slice(i)),t.map(n=>{let o=n.trim();if(!o.endsWith(")"))return{expectation:o};let a=0;for(let c=o.length-1;c>=0;c--)if(o[c]===")")a++;else if(o[c]==="("&&--a===0){let u=o.slice(0,c).trim(),l=o.slice(c+1,-1).trim();return u&&l?{expectation:u,expected:l}:{expectation:o}}return{expectation:o}})}s(SR,"assertionParts");var uG=new Set(["update","regenerate","delete"]);var s0e={update:"updated",regenerate:"regenerated",delete:"deleted",verify:"verified",none:"touched"};var lG=d.string().trim().min(1),RR=d.object({schemaVersion:d.literal(1).optional(),businessCaseAnalysis:lG.describe("1-2 sentences: what this change means for a user, and whether the evidence shows it working"),issuesFound:d.array(d.object({description:lG,severity:d.string().optional().describe("critical | high | medium | low"),category:d.string().optional().describe("bug | lint | type | config"),sourceFile:d.string().optional(),sourceLine:d.number().optional(),findingId:d.string().optional(),requirementIds:d.array(d.string()).optional()})).describe("every real problem this run exposed \u2014 cause, file:line, severity"),nextSteps:d.array(d.string()).describe("concrete follow-ups the author can act on; required non-empty when a disclosure is BLOCKING")});function Nse(e){return Ln(RR,e).errors}s(Nse,"validateProseOutput");function Use(e,t=[]){let{value:r,error:i}=Ft(e.stdout,t);if(i)return{errors:[i]};let n=Nse(r);return n.length>0?{errors:n}:{prose:r,errors:[]}}s(Use,"parseProseFromSession");var I0e=rr("report-schema",(e,t)=>Use(t,e.secretValues));var Fse="<!-- skyramp-testbot -->",dG=uG,Mse=new Set(["lint","type","config"]),AG={critical:0,high:1,medium:2,low:3},EG=new Set(["Pass","Fail"]);var $R=s(e=>ps(ue().statusLabels,e),"statusLabel"),xR=s(e=>ps(ue().testTypeCellLabels,e),"testTypeLabel");function Fe(e){return(e??"").replace(/\|/g,"\\|").replace(/\r?\n/g,"<br>").trim()}s(Fe,"escCell");function pG(e){return e.inferred?" (inferred)":""}s(pG,"inferredMark");function fG(e,t){return!e||!EG.has(e)?"\u2014":t?`${$R(e)} (${Fe(IG(t))})`:$R(e)}s(fG,"maintStatus");function IG(e){let t=s(i=>{let n=i.indexOf(": ");return n<0?i:ps(ue().staged.maintenanceActions,i.slice(0,n))+i.slice(n)},"action");if(e.startsWith(gA))return ue().staged.keptNot+t(e.slice(gA.length));let r=e.indexOf(hA);return r<0?e:e.slice(0,r)+ue().staged.declinedPlanned+t(e.slice(r+hA.length))}s(IG,"declineNote");function gG(e){return e.category!==void 0&&Mse.has(e.category.toLowerCase())}s(gG,"isTooling");function hG(e,t){return(AG[(e.severity??"").toLowerCase()]??4)-(AG[(t.severity??"").toLowerCase()]??4)}s(hG,"bySeverity");function mG(e){return`- ${e.severity?`**[${ps(ue().severityLabels,e.severity.toLowerCase()).toUpperCase()}]** `:""}${e.description.trim()}`}s(mG,"issueLine");function Pse(e){let t=e.resultId?.split("#").slice(1).join("#");if(e.testType!=="unit"||!t)return;let r=t;try{r=decodeURIComponent(t)}catch{}let i=/^(.*?)(\[.*\])$/.exec(r);return i?{fn:i[1],kase:i[2]}:{fn:r}}s(Pse,"unitTestOf");var CG=s((e,t)=>e!==void 0&&t!==void 0&&e.replace(/^\.\//,"")===t.replace(/^\.\//,""),"samePath");function vG(e,t){return(e.testVideos??[]).find(r=>r.url&&t(r))?.url}s(vG,"videoLink");function TR(e,t){return vG(e,r=>CG(r.fileName,t.fileName)&&(!r.repository||!t.repository||r.repository.toLowerCase()===t.repository.toLowerCase()))}s(TR,"resultVideoLink");function DR(e,t){return vG(e,r=>CG(r.writtenAs??r.fileName,t))}s(DR,"journeyVideoLink");function Lse(e,t,r){return r?TR(e,{fileName:t,repository:r}):DR(e,t)}s(Lse,"requirementVideoLink");function Ose(e){let t=[],r=new Map;for(let a of e.newTestsCreated)a.testType==="unit"&&r.set(a.fileName,[...r.get(a.fileName)??[],a.testId.split("::").slice(1).join("::")]);let i=new Map,n=s((a,c)=>(r.get(a??"")??[]).find(u=>u!==c&&Qj(c,u)),"parentOf"),o=new Map;for(let a of e.testResults){let c=Pse(a),u=c&&!c.kase?n(a.fileName,c.fn):void 0;if(c&&u&&(c={fn:u,kase:`"${c.fn}"`}),c?.kase&&i.set(a,c.kase),!c){t.push({testId:a.testId,testType:a.testType,endpoint:a.endpoint,status:a.status,details:a.details??"",...a.fileName?{fileName:a.fileName}:{},...a.repository?{repository:a.repository}:{}});continue}let l=`${a.fileName??""}#${c.fn}`,A=o.get(l);A||(A={row:{testId:a.testId,testType:a.testType,endpoint:a.endpoint,status:a.status,details:"",test:c.fn,...a.fileName?{fileName:a.fileName}:{},...a.repository?{repository:a.repository}:{}},cases:[]},o.set(l,A),t.push(A.row)),A.cases.push(a)}for(let{row:a,cases:c}of o.values()){let u=c.filter(g=>g.status==="Fail"),l=c.filter(g=>g.status==="Pass").length,A=c.filter(g=>g.status==="Skipped").length;a.cases=c.length,a.status=u.length?"Fail":A?"Skipped":"Pass";let p=u[0];a.details=c.length===1?c[0].details??"":ue().staged.casesPassed(l,c.length,A)+(p?`; ${i.get(p)??""} ${p.details??""}`.replace(/; +/,"; ").trimEnd():"")}return t}s(Ose,"resultRows");function jse(e){return SR(e).map(t=>t.expected===void 0?t.expectation:`${t.expectation}: ${Kr(t.expected)}`)}s(jse,"unitAssertions");function yG(e){return e.newTestsCreated.some(t=>t.testType!=="unit")&&e.testResults.every(t=>t.status==="Skipped")&&e.testResults.some(t=>t.failureCause?.kind==="environment"&&t.failureCause.family==="app_not_started")}s(yG,"nothingExecuted");function bG(e,t={}){let{audience:r,collapsed:i=!1,existingEvidence:n=[],requestedBy:o,sourcePullRequest:a}=t,c=r!=="testbot-pr",u=r!=="comment",l=r!=="testbot-pr",A=[Fse];if(a&&A.push(ue().staged.testsSourcePullRequest(Kr(a)),""),o){let v=o.name.replace(/\s+/g," ").trim().replace(/[<>[\]()*_`\\|#]/g,"\\$&").replace(/@/g,"@\u200D");A.push(o.kind==="person"?ue().staged.requestedByPerson(v):ue().staged.requestedByPolicy(v),"")}e.notTranslated&&A.push(ps(ue().staged.notTranslated,e.notTranslated),"");let p=s(v=>{i?A.push("<details>",`<summary>${v}</summary>`,""):A.push(`### ${v}`)},"sectionStart"),g=s(()=>{i&&A.push("","</details>"),A.push("")},"sectionEnd");if(c){for(let v of e.businessCaseAnalysis.trim().split(/\r?\n/))A.push(`> ${v}`);A.push("")}if(yG(e)&&A.push(ue().staged.noLiveApp(e.newTestsCreated.length),""),u&&e.newTestsCreated.length){let v=new Map;for(let M of e.newTestsCreated){if(M.testType!=="unit")continue;let K=(M.testId.split("::").slice(1).join("::")||M.testId).replace(/\[.*\]$/,""),G=v.get(M.fileName)??{functions:new Set,endpoints:[],descriptions:new Map};M.endpoint&&!G.endpoints.includes(M.endpoint)&&G.endpoints.push(M.endpoint);let Ee=M.description?.trim()??"",Le=G.descriptions.get(K)??[];Le.includes(Ee)||Le.push(Ee),G.functions.add(K),G.descriptions.set(K,Le),v.set(M.fileName,G)}let S=e.newTestsCreated.filter(M=>M.testType!=="unit"),D=S.length+[...v.values()].reduce((M,K)=>M+K.functions.size,0);p(ue().testRecommendationsImplementedHeader(D));for(let[M,{functions:K,endpoints:G,descriptions:Ee}]of v){let Le=K.size;A.push(ue().staged.unitTestsInFile(`\`${M}\``,Le,G.map(Je=>`\`${Je}\``).join(", ")),"");let _e=new Map;for(let[Je,Me]of Ee){let ut=Me.join("\0"),q=_e.get(ut)??{fns:[],descriptions:Me};q.fns.push(Je),_e.set(ut,q)}let Oe=0;for(let{fns:Je,descriptions:Me}of _e.values()){A.push(`${++Oe}. ${Je.map(q=>`\`${q}\``).join(", ")}`);let ut=[...new Set(Me.flatMap(q=>jse(q)))];for(let q of ut)A.push(` - ${q}`)}A.push("")}for(let M of S){let K=M.testId?`\`${M.testId}\``:xR(M.testType),G=M.fileName?` (\`${M.fileName}\`)`:"",Ee=M.endpoint?`
|
|
156
156
|
\`${M.endpoint}\``:"",Le=M.description?`
|
|
157
157
|
${M.description.trim()}`:"";A.push(`- ${K}${G}${Ee}${Le}`)}g()}let h=(e.testMaintenance??[]).filter(v=>dG.has(v.action));if(u&&h.length){p(ue().staged.testMaintenanceHeader),A.push(ue().maintenanceTableHeader),A.push("|-----------|----------|------|--------|--------|-------|");for(let v of h)A.push(`| ${Fe(xR(v.testType))} | ${Fe(v.endpoint)} | \`${Fe(v.fileName)}\` | ${Fe(v.description)} | ${fG(v.beforeStatus,v.beforeDetails)} | ${fG(v.afterStatus,v.afterDetails)} |`);g()}let y=s(v=>v.startsWith(gA)||v.includes(hA),"hasDeclineNote"),E=(e.testMaintenance??[]).filter(v=>y(v.afterDetails)&&(!dG.has(v.action)||!EG.has(v.afterStatus??"")));if(u&&E.length){p(ue().staged.declinedMaintenanceHeader);for(let v of E)A.push(`- \`${Fe(v.fileName)}\`: ${Fe(IG(v.afterDetails))}`);g()}if(u&&n.length){p(ue().staged.existingEvidenceHeader);let v=new Map;for(let S of n){let D=`${S.check}\0${S.url??""}\0${S.revision??""}`;v.set(D,[...v.get(D)??[],S])}for(let[,[S,...D]]of v){let M=S.url?`[${Kr(S.check)}](${S.url})`:Kr(S.check);A.push(ue().staged.trustedCheckPassed(M,S.revision?Kr(S.revision.slice(0,7)):""),"");for(let K of[S,...D])A.push(`- ${Kr(K.behavior)}`);A.push("")}g()}if(u&&e.testResults.length){p(ue().staged.testResultsHeader);let v=Ose(e),S=v.some(G=>G.test),D=v.some(G=>TR(e,G)),M=S?ue().staged.unitResultsTableHeader:ue().staged.resultsTableHeader;A.push(D?`${M} ${ue().columnVideo} |`:M),A.push(`${S?"|---------|-----------|----------|------|-------|--------|---------|":"|---------|-----------|----------|--------|---------|"}${D?"-------|":""}`);for(let G of v){let Ee=G.details.replace(/(\S+\.(?:py|ts|js|spec\.\w+))/gi,"`$1`"),Le=G.testId?`\`${Fe(G.testId)}\``:"\u2014",_e=S?` ${G.test?`\`${Fe(G.test)}\``:""} | ${G.cases??""} |`:"",Oe=TR(e,G),Je=D?` ${Oe?ue().videoDownloadLink(Oe):"\u2014"} |`:"";A.push(`| ${Le} | ${Fe(xR(G.testType))} | ${Fe(G.endpoint)} |${_e} ${Fe($R(G.status))} | ${Fe(Ee)} |${Je}`)}let K=(e.testVideos??[]).find(G=>G.artifactsUrl)?.artifactsUrl;!D&&K&&A.push("",ue().videosArtifactFallback(K)),g()}if(e.requirements?.length){let v=e.requirements.flatMap(G=>G.clauses),S=s(G=>G.status==="Pass"||G.status==="Passed, test not kept","passes"),D=v.filter(S).length;p(ue().staged.requirementsHeader(D,v.length));let M=s(G=>ps(ue().staged.clauseStatuses,G.status),"status"),K=s(G=>(G.status==="Not tested"||G.status==="Passed, test not kept")&&G.notTested?`${M(G)}: ${G.notTested}`:G.findings.length?`${M(G)} \u2014 ${G.findings.join(", ")}`:M(G),"result");if(u){A.push(ue().staged.requirementsTableHeader),A.push("|-------------|--------|-------|--------|");for(let G of e.requirements)G.clauses.forEach((Ee,Le)=>{let _e=Le===0?`**${Fe(G.label)}**${G.statement?` ${Fe(G.statement)}`:""}`:"",Oe=`\`${Fe(Ee.id)}\`${pG(Ee)}${Ee.text?` ${Fe(Ee.text)}`:""}`,Je=new Map;for(let q of Ee.tests){let xt=q.fileName??q.testId,lt=Je.get(xt)??{fns:new Set};for(let lr of q.functions)lt.fns.add(lr);lt.video??=q.fileName?Lse(e,q.fileName,q.repository):void 0,Je.set(xt,lt)}let Me=Je.size?[...Je].map(([q,{fns:xt,video:lt}])=>`\`${Fe(q)}\`${xt.size?` \u2014 ${[...xt].map(lr=>`\`${Fe(lr)}\``).join(", ")}`:""}${lt?` ${ue().videoDownloadLink(lt)}`:""}`).join("<br>"):"\u2014",ut=G.source==="could-break"&&Ee.status==="Pass"?ue().staged.regressionGuard:"";A.push(`| ${_e} | ${Oe} | ${Me} | ${Fe(K(Ee)+ut)} |`)})}else{A.push(ue().staged.requirementsSummaryTableHeader),A.push("|-------------|-----------------|-------------|");for(let G of e.requirements){let Ee=G.clauses.filter(S).length,Le=G.clauses.filter(_e=>!S(_e)).map(_e=>`\`${Fe(_e.id)}\`${pG(_e)} ${Fe(K(_e))}`);A.push(`| **${Fe(G.label)}**${G.statement?` ${Fe(G.statement)}`:""} | ${Ee}/${G.clauses.length} | ${Le.join("<br>")||"\u2014"} |`)}}g()}if(u&&e.changes?.length&&!e.requirements?.length){let v=e.executionCoverage,S=v?ue().staged.coverageCaption(v.generated,v.modified,v.verified,v.executed):"";p(`${ue().staged.behaviourCoverageHeader}${S}`),A.push(ue().staged.coverageTableHeader),A.push("|-----------|--------|-----------|----------------|");for(let D of e.changes){let M=D.testedBy.length?D.testedBy.map(G=>`\`${Fe(G)}\``).join(", "):D.writtenBy.length?ue().staged.writtenNotRun:"\u2014",K=D.maintainedBy.length?D.maintainedBy.map(G=>`\`${Fe(G)}\``).join(", "):"\u2014";A.push(`| ${Fe(D.text)} | \`${Fe(D.source)}\` | ${M} | ${K} |`)}g()}if(e.userJourneys?.length){let v=e.userJourneys.filter(D=>D.status==="Pass"&&!D.problems.length).length;p(`\u{1F9ED} User Journeys Covered (${v}/${e.userJourneys.length} walked end to end)`);let S=e.userJourneys.some(D=>DR(e,D.fileName));A.push(`| Journey | Test | Status | Notes |${S?` ${ue().columnVideo} |`:""}`),A.push(`|---------|------|--------|-------|${S?"-------|":""}`);for(let D of e.userJourneys){let M=D.fileName?`\`${Fe(D.fileName)}\`${D.test?` \u2014 ${Fe(D.test)}`:""}`:"\u2014",K=D.source&&D.source!=="inferred"?`; described in the ${D.source==="spec"?"spec":"PR description"}`:"; inferred from the app",G=(D.uncovered?`not covered: ${D.uncovered}`:D.problems.length?`does not walk it end to end: ${D.problems.join("; ")}`:`from ${D.entry}, ${D.steps} steps`)+K,Ee=S?DR(e,D.fileName):void 0;A.push(`| ${Fe(D.name)} | ${M} | ${Fe(D.status)} | ${Fe(G)} |${S?` ${Ee?ue().videoDownloadLink(Ee):"\u2014"} |`:""}`)}g()}if(l){let v=e.issuesFound.filter(D=>!gG(D)).sort(hG),S=e.issuesFound.filter(gG).sort(hG);if(v.length){p(ue().staged.issuesFoundHeader);for(let D of v)A.push(mG(D));g()}if(S.length){A.push(`### ${ue().configErrorsHeader}`);for(let D of S)A.push(mG(D));A.push("")}}let C=e.testPackages??[],I=e.dependencyChanges??[];if(C.length){A.push(ue().staged.testPackagesHeader,"");for(let v of C)A.push(`- ${ue().staged.testPackageLine(v.directory,v.entrypoint)}`);I.length||A.push(`- ${ue().staged.appManifestsUntouched}`),A.push("")}if(I.length){A.push(ue().staged.dependencyChangesHeader,"");for(let v of I)A.push(`- ${ue().staged.dependencyChangeLine(v.package,v.repository?`${v.repository}: ${v.manifest}`:v.manifest,(v.reason??"").replace(/\s+/g," ").trim())}`);A.push("")}let b=(e.caveats??[]).filter(v=>v.kind!=="tests-not-executed"||v.subject==="written-cases"||!yG(e));if(b.length){A.push(ue().staged.caveatsHeader,"");for(let v of b)A.push(`- ${v.text}`);A.push("")}if(l&&e.nextSteps.length){A.push(ue().nextStepsHeader,"");for(let v of e.nextSteps)A.push(`- ${v.trim()}`);A.push("")}return A.join(`
|
|
158
158
|
`).replace(/\n{3,}/g,`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyramp/testbot-core",
|
|
3
|
-
"version": "0.13.0-v3.
|
|
3
|
+
"version": "0.13.0-v3.319",
|
|
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.",
|