@skyramp/testbot-core 0.13.2-v3.496 → 0.13.2-v3.497
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 +404 -404
- package/dist/post.js +1 -1
- package/package.json +1 -1
package/dist/post.js
CHANGED
|
@@ -337,7 +337,7 @@ STALENESS WARNING: this PR changed recipe/infra files (${t.staleFiles.join(", ")
|
|
|
337
337
|
The recorded recipe may no longer match. If bring-up fails, first decide
|
|
338
338
|
WHY: recipe drift (infra moved, recipe is behind) vs the change itself
|
|
339
339
|
breaking bring-up. Do NOT paper over a PR that broke the app.`:"","",...r?Hke(r.address,t):["Tasks:","1. Replay the recipe: run .skyramp/sut/setup.sh (or the workspace bring-up)"," even when the SUT already answers: never skip it because something is running."," Bring up every dependency you can; mock one only when deploying it here"," is genuinely infeasible. If the recipe has drifted, correct it so it works"," and update the recipe files to what actually worked. teardown.sh exits 0"," when nothing runs.","2. Seed or reset state per the recipe. Acquire the auth token the way the"," recipe records (.skyramp/sut/get-auth-token.sh) \u2014 never echo it.",...o.length?[` Leave the shared components ${o.join(", ")} unchanged: do not seed or reset them.`]:[],"3. Health-check: confirm application logic answers with real data (seeded",' data readable via a real endpoint) \u2014 NOT "port open", NOT "any HTTP',' status". Record the exact url/command and what it returned.',...t.healthHint?[" Recommended health check (recorded by onboarding \u2014 prefer it, and",` record its real output): ${JSON.stringify(t.healthHint)}`]:[],'4. Record the outcome honestly (see the schema): "change-broke-bringup" is',' published to the author as "your change broke the app" and needs evidence'," \u2014 bringupError plus suspectFiles that THIS PR changed; without a changed",' file to point at, it is "bringup-failed".'],...zke(e),...qke(e),"","Output: end with one JSON object matching:","",kz(Nf)," // health.output is evidence, not narration: the exact bytes, with NOTHING"," // appended \u2014 no gloss on what the response proves, no list of the other probes"," // you ran. This gate RE-RUNS the check and matches the fresh output against this"," // field, so a sentence added here describes a run nobody can reproduce. Say what"," // it means in your prose answer instead."," // On a failed bring-up, baseUrls/health may be omitted \u2014 never invent a URL for an app that didn't start."].filter(a=>a!==void 0).join(`
|
|
340
|
-
`)}function P6(e){let t=sm.join(e.outputsDir,"deploy.txt");if(Jw.existsSync(t)){let{deploy:s}=yu({exitCode:0,stdout:Jw.readFileSync(t,"utf-8"),stderr:"",timedOut:!1,durationMs:0});if(s?.teardown)return{argv:["sh","-c",s.teardown],label:"deploy.json's teardown"}}let{teardownScript:n}=_a(e.inputs.repositoryPath);if(n)return{argv:["bash",n],label:sm.join(".skyramp","sut","teardown.sh")}}function O6(e,t){return Gw(t,e.inputs.repositoryPath,{env:ht(),secretValues:e.secretValues})}async function N6(e){let t=P6(e);if(t){let n=await O6(e,t);if(n&&y4(e))throw new Error(`SUT teardown failed: ${n}`)}}async function Wke(e,t){let n=t.passed?void 0:F6(e);if(!n)return;let s=await O6(e,n);return s&&`${s} (if nothing was running, a teardown must exit 0)`}function F6(e){return zD(e)?void 0:P6(e)}function Zke(e){if(F6(e))return"Testbot tore down the SUT the previous attempt started. Bring it up again from the start: run .skyramp/sut/setup.sh (or the workspace bring-up), even if something still answers. Never reuse what is running."}function Kke(e,t){let{deploy:n}=yu(t,e.inputs.repositoryPath,e.secretValues);if(!n)return;if(n.outcome==="bringup-failed"){let r=sn(n.bringupError?.output?.trim()??"",e.secretValues??[]);return`bring-up failed (environment) \u2014 no live app for later stages${r?`: ${r.slice(0,160)}`:""}`}if(n.outcome==="change-broke-bringup")return"this PR broke bring-up \u2014 recorded as a finding, no live app for later stages";let s=Bg(e).map(r=>r.name);if(s.length)return`the shared environment's ${s.join(", ")} does not verifiably run the revision under validation \u2014 no runtime test runs against it`}var U6=D6({name:"deploy",model:"opus",timeoutMinutes:25,requires:["preflight"],softRequires:["onboard"],startsApp:e=>!e.inputs.appRunning&&!(e.inputs.testEnvironment&&zD(e)),triageBranch:"runtime",validateInput:Lke,prepare:Vke,scaleTimeout:jke,buildPrompt:Yke,allowedTools:Mke,buildSessionEnv:()=>({...k6}),selfVerification:["dependencies lists every backing service, true only if really deployed \u2014 a mocked one is false, never omitted.","Your final message is one JSON object matching the schema."],exitGates:[fw(),hZ()],onPassed:async(e,t)=>({...mZ(e,t),...await gZ(e,t)}),passReason:Kke,afterAttempt:Wke,retryNote:Zke,onAbort:N6,teardown:N6});_n();_n();var gXe=20*1024*1024;var L6=Z(require("path"));var SXe=L6.join(".skyramp","sut","get-auth-token.sh");var HD="\\$([A-Z][A-Z0-9_]{0,99})",kXe=new RegExp(`^${HD}$`),RXe=new RegExp(`^${HD}:${HD}$`);var B5e=3*6e4;var x5e=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;var W5e=new RegExp(Zl.source,"g");var rRe="https://testbot.skyramp.dev",po={attemptId:"v3AttemptId",deadlineAt:"v3DeadlineAt",reportUploaded:"v3ReportUploaded",recipeUploaded:"v3RecipeUploaded",recipeStatus:"v3RecipeStatus",revisionsUploaded:"v3RevisionsUploaded",cause:"v3Cause",conflict:"v3Conflict",githubWrites:"v3GithubWrites"};function sRe(e,t,n){return{origin:e,idToken:t,sourceToken:n,mask:s=>Fi(s),log:s=>Bs(s),onTokenRefused:(s,r)=>{oRe(s)&&j6.set(r,s)},onTokenGranted:s=>{j6.delete(s)}}}var j6=new Map;var
|
|
340
|
+
`)}function P6(e){let t=sm.join(e.outputsDir,"deploy.txt");if(Jw.existsSync(t)){let{deploy:s}=yu({exitCode:0,stdout:Jw.readFileSync(t,"utf-8"),stderr:"",timedOut:!1,durationMs:0});if(s?.teardown)return{argv:["sh","-c",s.teardown],label:"deploy.json's teardown"}}let{teardownScript:n}=_a(e.inputs.repositoryPath);if(n)return{argv:["bash",n],label:sm.join(".skyramp","sut","teardown.sh")}}function O6(e,t){return Gw(t,e.inputs.repositoryPath,{env:ht(),secretValues:e.secretValues})}async function N6(e){let t=P6(e);if(t){let n=await O6(e,t);if(n&&y4(e))throw new Error(`SUT teardown failed: ${n}`)}}async function Wke(e,t){let n=t.passed?void 0:F6(e);if(!n)return;let s=await O6(e,n);return s&&`${s} (if nothing was running, a teardown must exit 0)`}function F6(e){return zD(e)?void 0:P6(e)}function Zke(e){if(F6(e))return"Testbot tore down the SUT the previous attempt started. Bring it up again from the start: run .skyramp/sut/setup.sh (or the workspace bring-up), even if something still answers. Never reuse what is running."}function Kke(e,t){let{deploy:n}=yu(t,e.inputs.repositoryPath,e.secretValues);if(!n)return;if(n.outcome==="bringup-failed"){let r=sn(n.bringupError?.output?.trim()??"",e.secretValues??[]);return`bring-up failed (environment) \u2014 no live app for later stages${r?`: ${r.slice(0,160)}`:""}`}if(n.outcome==="change-broke-bringup")return"this PR broke bring-up \u2014 recorded as a finding, no live app for later stages";let s=Bg(e).map(r=>r.name);if(s.length)return`the shared environment's ${s.join(", ")} does not verifiably run the revision under validation \u2014 no runtime test runs against it`}var U6=D6({name:"deploy",model:"opus",timeoutMinutes:25,requires:["preflight"],softRequires:["onboard"],startsApp:e=>!e.inputs.appRunning&&!(e.inputs.testEnvironment&&zD(e)),triageBranch:"runtime",validateInput:Lke,prepare:Vke,scaleTimeout:jke,buildPrompt:Yke,allowedTools:Mke,buildSessionEnv:()=>({...k6}),selfVerification:["dependencies lists every backing service, true only if really deployed \u2014 a mocked one is false, never omitted.","Your final message is one JSON object matching the schema."],exitGates:[fw(),hZ()],onPassed:async(e,t)=>({...mZ(e,t),...await gZ(e,t)}),passReason:Kke,afterAttempt:Wke,retryNote:Zke,onAbort:N6,teardown:N6});_n();_n();var gXe=20*1024*1024;var L6=Z(require("path"));var SXe=L6.join(".skyramp","sut","get-auth-token.sh");var HD="\\$([A-Z][A-Z0-9_]{0,99})",kXe=new RegExp(`^${HD}$`),RXe=new RegExp(`^${HD}:${HD}$`);var B5e=3*6e4;var x5e=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;var W5e=new RegExp(Zl.source,"g");var rRe="https://testbot.skyramp.dev",po={attemptId:"v3AttemptId",deadlineAt:"v3DeadlineAt",reportUploaded:"v3ReportUploaded",recipeUploaded:"v3RecipeUploaded",recipeStatus:"v3RecipeStatus",revisionsUploaded:"v3RevisionsUploaded",cause:"v3Cause",conflict:"v3Conflict",githubWrites:"v3GithubWrites"};function sRe(e,t,n){return{origin:e,idToken:t,sourceToken:n,mask:s=>Fi(s),log:s=>Bs(s),onTokenRefused:(s,r)=>{oRe(s)&&j6.set(r,s)},onTokenGranted:s=>{j6.delete(s)}}}var j6=new Map;var Qtt=["setup_failed","checkout_failed","environment_unverified"];function iRe(e,t){return t.getTime()>=e.getTime()}function oRe(e){return e instanceof wi||e instanceof Ta&&e.code!=="CREDENTIALS_UNAVAILABLE"}var Ttt={cancelled:"Skyramp cancelled this run",expired:"this attempt passed its deadline in Skyramp",ended:"Skyramp already ended this attempt"},_tt={cancelled:"attempt-cancelled",expired:"attempt-closed",ended:"attempt-closed"},Dtt={cancelled:"cancelled",expired:"timed_out",ended:"agent_failed"};var Ntt={analyze:"analyze",triage:"analyze",recommend:"recommend",generate:"generate","generate-ui":"generate","generate-unit":"generate",adapt:"generate",write:"generate",onboard:"execute",deploy:"execute","native-run":"execute",deliver:"deliver"},Ptt={analyze:"change analysis",recommend:"test recommendations",generate:"test generation",execute:"test execution",deliver:"opening a pull request with the tests"};function aRe(){return je("skyrampAppOrigin").trim()||rRe}var Ott=10*6e4;var Ftt={onboard:"onboard",deploy:"deploy"},Utt={plan:{stage:"validation_plan",text:"Working out what to validate, and bringing up what it needs"},write:{stage:"tests",text:"Writing and running the tests"},"generate-unit":{stage:"tests",text:"Writing unit tests"},"native-run":{stage:"tests",text:"Running the unit tests"}},Mtt=new Set(["write","native-run"]);function cRe(){let e=ei(po.conflict);if(!e)return;let t;try{t=Ez.safeParse(JSON.parse(e))}catch(n){Lt(`Testbot V3: the saved merge conflict is not JSON (${n instanceof Error?n.message:String(n)})`);return}if(t.success)return t.data;Lt(`Testbot V3: the saved merge conflict breaks the contract (${t.error.issues.map(n=>`${n.path.join(".")}: ${n.message}`).join("; ")})`)}function uRe(){let e=ei(po.githubWrites);if(!e)return[];let t;try{t=JSON.parse(e)}catch(n){return Lt(`Testbot V3: the saved GitHub writes are not JSON (${n instanceof Error?n.message:String(n)})`),[]}return Array.isArray(t)?t.flatMap(n=>{let s=SE.safeParse(n);return s.success?[s.data]:[]}).slice(0,CE):[]}async function V6(){let e=ei(po.attemptId);if(!e)return;let t=ei(po.reportUploaded)==="true",n=ei(po.recipeUploaded)==="true",s=ei(po.revisionsUploaded)==="true",r=ei(po.deadlineAt),i=ei(po.cause)||void 0;!i&&!t&&!n&&!s&&r&&iRe(new Date(r),new Date)&&(i="timed_out");let o=Vd().takeIdToken(),a=cRe(),c=await w6({attemptId:e,reportUploaded:t,recipeUploaded:n,revisionsUploaded:s,cause:i,...a?{conflict:a}:{},githubWrites:uRe()},sRe(aRe(),o)),u=ei(po.recipeStatus);n&&u?Bs(`Testbot V3: attempt ended; the setup ended ${u==="ready"?"Ready":"blocked (Needs input)"}.`):Bs(`Testbot V3: attempt ended; the run's outcome in Skyramp is ${c.outcome??"not final yet"}.`)}var G6=require("child_process"),Ci=Z(require("fs")),JD=Z(require("path")),YD=require("string_decoder");var lRe="skyramp-testbot-state",dRe=/^\$\([^)]*\)$/;function pRe(e){for(let[t,n]of Object.entries(e))n!==void 0&&dRe.test(n)&&delete e[t]}function fRe(e){let t={},n=Ci.existsSync(e)?Ci.readFileSync(e,"utf-8"):"",s=/^([^\r\n<]+)<<(\S+)\r?\n([\s\S]*?)\r?\n\2\r?$/gm;for(let r=s.exec(n);r;r=s.exec(n))t[r[1]]=r[3];return t}function z6(e,t={}){let n=t.env??process.env;if(!va(n))return!1;pRe(n),T4(n);let s=n.AGENT_TEMPDIRECTORY||n.RUNNER_TEMP;if(s){n.RUNNER_TEMP??=s;let o=JD.join(s,lRe);if(e==="main")Ci.writeFileSync(o,"",{mode:384});else for(let[a,c]of Object.entries(fRe(o)))n[`STATE_${a}`]=c;n.GITHUB_STATE=o;for(let[a,c]of[["GITHUB_OUTPUT","output"],["GITHUB_ENV","env"],["GITHUB_PATH","path"],["GITHUB_STEP_SUMMARY",`summary-${e}.md`]])n[a]=JD.join(s,`skyramp-testbot-${c}`),Ci.writeFileSync(n[a],"",{mode:384})}let r=t.stdout??n===process.env;r&&hRe(n,t.write);let i=n.GITHUB_STEP_SUMMARY;if(r&&i){let o=t.write??(a=>I_(a.replace(/\n$/,"")));process.once("exit",()=>{Ci.existsSync(i)&&Ci.statSync(i).size>0&&o(`${Xb("task.uploadsummary",{},i)}
|
|
341
341
|
`)})}return!0}function hRe(e,t){let n=process.stdout.write.bind(process.stdout),s=o=>e[yg]==="1"?w_(o,e):void n(o.command!==void 0?`${o.command}
|
|
342
342
|
`:o.text??""),r=t??(o=>s({command:o.replace(/\n$/,"")})),i=t??(o=>s({text:o}));process.stdout.write=((o,...a)=>{let c=typeof o=="string"?o:Buffer.from(o).toString("utf-8"),u="";for(let p of c.split(/(?<=\n)/)){let h=p.startsWith("::")?S4(p):void 0;if(!h){u+=p;continue}u&&i(u),u="";for(let g of h)r(`${g}
|
|
343
343
|
`)}return u&&i(u),a.find(p=>typeof p=="function")?.(),!0})}var gRe=64*1024;function qD(e){let t=new YD.StringDecoder("utf8"),n="",s=r=>e(Kb(r));return{push(r){n+=typeof r=="string"?r:t.write(r);let i=n.lastIndexOf(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyramp/testbot-core",
|
|
3
|
-
"version": "0.13.2-v3.
|
|
3
|
+
"version": "0.13.2-v3.497",
|
|
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.",
|