@skyramp/testbot-core 0.13.1-v3.461 → 0.13.1-v3.462
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 +436 -436
- package/dist/post.js +1 -1
- package/package.json +1 -1
package/dist/post.js
CHANGED
|
@@ -254,7 +254,7 @@ STALENESS WARNING: this PR changed recipe/infra files (${t.staleFiles.join(", ")
|
|
|
254
254
|
The recorded recipe may no longer match. If bring-up fails, first decide
|
|
255
255
|
WHY: recipe drift (infra moved, recipe is behind) vs the change itself
|
|
256
256
|
breaking bring-up. Do NOT paper over a PR that broke the app.`:"","",...r?eke(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".'],...XSe(e),...tke(e),"","Output: end with one JSON object matching:","",ez(Df)," // 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(`
|
|
257
|
-
`)}function a6(e){let t=Zg.join(e.outputsDir,"deploy.txt");if(_w.existsSync(t)){let{deploy:s}=mu({exitCode:0,stdout:_w.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}=ku(e.inputs.repositoryPath);if(n)return{argv:["bash",n],label:Zg.join(".skyramp","sut","teardown.sh")}}function c6(e,t){return Qw(t,e.inputs.repositoryPath,{env:ht(),secretValues:e.secretValues})}async function i6(e){let t=a6(e);if(t){let n=await c6(e,t);if(n&&zY(e))throw new Error(`SUT teardown failed: ${n}`)}}async function ske(e,t){let n=t.passed?void 0:u6(e);if(!n)return;let s=await c6(e,n);return s&&`${s} (if nothing was running, a teardown must exit 0)`}function u6(e){return o6(e)?void 0:a6(e)}function ike(e){if(u6(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 oke(e,t){let{deploy:n}=mu(t,e.inputs.repositoryPath,e.secretValues);if(!n)return;if(n.outcome==="bringup-failed"){let r=nn(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=wg(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 l6=s6({name:"deploy",model:"opus",timeoutMinutes:25,requires:["preflight"],softRequires:["onboard"],startsApp:e=>!e.inputs.appRunning,triageBranch:"runtime",validateInput:WSe,prepare:ZSe,scaleTimeout:YSe,buildPrompt:rke,allowedTools:JSe,buildSessionEnv:()=>({...e6}),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:[ew(),M4()],onPassed:async(e,t)=>({...j4(e,t),...await L4(e,t)}),passReason:oke,afterAttempt:ske,retryNote:ike,onAbort:i6,teardown:i6});Qn();Qn();var B3e=20*1024*1024;var p6=Z(require("path"));var U3e=p6.join(".skyramp","sut","get-auth-token.sh");var $D="\\$([A-Z][A-Z0-9_]{0,99})",F3e=new RegExp(`^${$D}$`),M3e=new RegExp(`^${$D}:${$D}$`);var O8e=3*6e4;var U8e=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;var dke={discover:"reading the repositories",start:"starting the components",check:"checking that the components answer"};var q8e={running:"up",healthy:"up",ready:"up",started:"up",building:"starting",pending:"starting",installing:"starting",skipped:"out_of_scope",excluded:"out_of_scope","out-of-scope":"out_of_scope"};var J8e=new RegExp(Wl.source,"g");var gXe=new RegExp(Wl.source,"g");var hke="https://testbot.skyramp.dev",lo={attemptId:"v3AttemptId",deadlineAt:"v3DeadlineAt",reportUploaded:"v3ReportUploaded",recipeUploaded:"v3RecipeUploaded",recipeStatus:"v3RecipeStatus",revisionsUploaded:"v3RevisionsUploaded",cause:"v3Cause",conflict:"v3Conflict",githubWrites:"v3GithubWrites"};function gke(e,t,n){return{origin:e,idToken:t,sourceToken:n,mask:s=>Pi(s),log:s=>ks(s),onTokenRefused:(s,r)=>{Ake(s)&&f6.set(r,s)},onTokenGranted:s=>{f6.delete(s)}}}var f6=new Map;var
|
|
257
|
+
`)}function a6(e){let t=Zg.join(e.outputsDir,"deploy.txt");if(_w.existsSync(t)){let{deploy:s}=mu({exitCode:0,stdout:_w.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}=ku(e.inputs.repositoryPath);if(n)return{argv:["bash",n],label:Zg.join(".skyramp","sut","teardown.sh")}}function c6(e,t){return Qw(t,e.inputs.repositoryPath,{env:ht(),secretValues:e.secretValues})}async function i6(e){let t=a6(e);if(t){let n=await c6(e,t);if(n&&zY(e))throw new Error(`SUT teardown failed: ${n}`)}}async function ske(e,t){let n=t.passed?void 0:u6(e);if(!n)return;let s=await c6(e,n);return s&&`${s} (if nothing was running, a teardown must exit 0)`}function u6(e){return o6(e)?void 0:a6(e)}function ike(e){if(u6(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 oke(e,t){let{deploy:n}=mu(t,e.inputs.repositoryPath,e.secretValues);if(!n)return;if(n.outcome==="bringup-failed"){let r=nn(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=wg(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 l6=s6({name:"deploy",model:"opus",timeoutMinutes:25,requires:["preflight"],softRequires:["onboard"],startsApp:e=>!e.inputs.appRunning,triageBranch:"runtime",validateInput:WSe,prepare:ZSe,scaleTimeout:YSe,buildPrompt:rke,allowedTools:JSe,buildSessionEnv:()=>({...e6}),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:[ew(),M4()],onPassed:async(e,t)=>({...j4(e,t),...await L4(e,t)}),passReason:oke,afterAttempt:ske,retryNote:ike,onAbort:i6,teardown:i6});Qn();Qn();var B3e=20*1024*1024;var p6=Z(require("path"));var U3e=p6.join(".skyramp","sut","get-auth-token.sh");var $D="\\$([A-Z][A-Z0-9_]{0,99})",F3e=new RegExp(`^${$D}$`),M3e=new RegExp(`^${$D}:${$D}$`);var O8e=3*6e4;var U8e=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;var dke={discover:"reading the repositories",start:"starting the components",check:"checking that the components answer"};var q8e={running:"up",healthy:"up",ready:"up",started:"up",building:"starting",pending:"starting",installing:"starting",skipped:"out_of_scope",excluded:"out_of_scope","out-of-scope":"out_of_scope"};var J8e=new RegExp(Wl.source,"g");var gXe=new RegExp(Wl.source,"g");var hke="https://testbot.skyramp.dev",lo={attemptId:"v3AttemptId",deadlineAt:"v3DeadlineAt",reportUploaded:"v3ReportUploaded",recipeUploaded:"v3RecipeUploaded",recipeStatus:"v3RecipeStatus",revisionsUploaded:"v3RevisionsUploaded",cause:"v3Cause",conflict:"v3Conflict",githubWrites:"v3GithubWrites"};function gke(e,t,n){return{origin:e,idToken:t,sourceToken:n,mask:s=>Pi(s),log:s=>ks(s),onTokenRefused:(s,r)=>{Ake(s)&&f6.set(r,s)},onTokenGranted:s=>{f6.delete(s)}}}var f6=new Map;var V7e=["setup_failed","checkout_failed","environment_unverified"];function mke(e,t){return t.getTime()>=e.getTime()}function Ake(e){return e instanceof vi||e instanceof xa&&e.code!=="CREDENTIALS_UNAVAILABLE"}var G7e={cancelled:"Skyramp cancelled this run",expired:"this attempt passed its deadline in Skyramp",ended:"Skyramp already ended this attempt"},z7e={cancelled:"attempt-cancelled",expired:"attempt-closed",ended:"attempt-closed"},H7e={cancelled:"cancelled",expired:"timed_out",ended:"agent_failed"};var q7e={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"},J7e={analyze:"change analysis",recommend:"test recommendations",generate:"test generation",execute:"test execution",deliver:"opening a pull request with the tests"};function yke(){return Le("skyrampAppOrigin").trim()||hke}var W7e=10*6e4;var Y7e={onboard:"onboard",deploy:"deploy"},Z7e={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"}},K7e=new Set(["write","native-run"]);function Eke(){let e=Xs(lo.conflict);if(!e)return;let t;try{t=qG.safeParse(JSON.parse(e))}catch(n){Ot(`Testbot V3: the saved merge conflict is not JSON (${n instanceof Error?n.message:String(n)})`);return}if(t.success)return t.data;Ot(`Testbot V3: the saved merge conflict breaks the contract (${t.error.issues.map(n=>`${n.path.join(".")}: ${n.message}`).join("; ")})`)}function vke(){let e=Xs(lo.githubWrites);if(!e)return[];let t;try{t=JSON.parse(e)}catch(n){return Ot(`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=gE.safeParse(n);return s.success?[s.data]:[]}).slice(0,hE):[]}async function h6(){let e=Xs(lo.attemptId);if(!e)return;let t=Xs(lo.reportUploaded)==="true",n=Xs(lo.recipeUploaded)==="true",s=Xs(lo.revisionsUploaded)==="true",r=Xs(lo.deadlineAt),i=Xs(lo.cause)||void 0;!i&&!t&&!n&&!s&&r&&mke(new Date(r),new Date)&&(i="timed_out");let o=Ld().takeIdToken(),a=Eke(),c=await WK({attemptId:e,reportUploaded:t,recipeUploaded:n,revisionsUploaded:s,cause:i,...a?{conflict:a}:{},githubWrites:vke()},gke(yke(),o)),u=Xs(lo.recipeStatus);n&&u?ks(`Testbot V3: attempt ended; the setup ended ${u==="ready"?"Ready":"blocked (Needs input)"}.`):ks(`Testbot V3: attempt ended; the run's outcome in Skyramp is ${c.outcome??"not final yet"}.`)}var g6=require("child_process"),wi=Z(require("fs")),_D=Z(require("path")),DD=require("string_decoder");var bke="skyramp-testbot-state",wke=/^\$\([^)]*\)$/;function Ike(e){for(let[t,n]of Object.entries(e))n!==void 0&&wke.test(n)&&delete e[t]}function Cke(e){let t={},n=wi.existsSync(e)?wi.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 m6(e,t={}){let n=t.env??process.env;if(!ya(n))return!1;Ike(n),i4(n);let s=n.AGENT_TEMPDIRECTORY||n.RUNNER_TEMP;if(s){n.RUNNER_TEMP??=s;let o=_D.join(s,bke);if(e==="main")wi.writeFileSync(o,"",{mode:384});else for(let[a,c]of Object.entries(Cke(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]=_D.join(s,`skyramp-testbot-${c}`),wi.writeFileSync(n[a],"",{mode:384})}let r=t.stdout??n===process.env;r&&Ske(n,t.write);let i=n.GITHUB_STEP_SUMMARY;if(r&&i){let o=t.write??(a=>a_(a.replace(/\n$/,"")));process.once("exit",()=>{wi.existsSync(i)&&wi.statSync(i).size>0&&o(`${jb("task.uploadsummary",{},i)}
|
|
258
258
|
`)})}return!0}function Ske(e,t){let n=process.stdout.write.bind(process.stdout),s=o=>e[pg]==="1"?o_(o,e):void n(o.command!==void 0?`${o.command}
|
|
259
259
|
`: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("::")?KY(p):void 0;if(!h){u+=p;continue}u&&i(u),u="";for(let g of h)r(`${g}
|
|
260
260
|
`)}return u&&i(u),a.find(p=>typeof p=="function")?.(),!0})}var kke=64*1024;function TD(e){let t=new DD.StringDecoder("utf8"),n="",s=r=>e(Lb(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.1-v3.
|
|
3
|
+
"version": "0.13.1-v3.462",
|
|
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.",
|