@skyramp/testbot-core 0.13.0-v3.258 → 0.13.0-v3.259
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 +304 -304
- package/dist/post.js +1 -1
- package/dist/runner-client.cjs +1 -1
- package/package.json +1 -1
package/dist/post.js
CHANGED
|
@@ -119,7 +119,7 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``)}fun
|
|
|
119
119
|
`)){let n=e.trim();if(n)try{let r=JSON.parse(n);if(r.type==="system"&&r.subtype==="init"&&Array.isArray(r.mcp_servers))return Object.fromEntries(r.mcp_servers.filter(s=>typeof s.name=="string").map(s=>[s.name,typeof s.status=="string"?s.status:"unknown"]))}catch{}}return{}}function _D(t){let e=p9(t).skyramp;return e===void 0||e==="connected"}function f9(t){if(!Mo.existsSync(t))return[];let e=[];for(let n of Mo.readFileSync(t,"utf-8").split(`
|
|
120
120
|
`)){let r=n.trim();if(!r)continue;let s;try{s=JSON.parse(r)}catch{continue}let i=s.message?.content;Array.isArray(i)&&e.push(...i)}return e}var Np=(s=>(s.RestApi="rest-api",s.Frontend="frontend",s.FullStack="full-stack",s.Other="other",s))(Np||{}),_o=(s=>(s.Critical="critical",s.High="high",s.Medium="medium",s.Low="low",s))(_o||{}),Uo=(r=>(r.Suspected="suspected",r.Latent="latent",r.Refuted="refuted",r))(Uo||{}),YE=(r=>(r.Skyramp="skyramp",r.External="external",r.Unknown="unknown",r))(YE||{}),JE=(s=>(s.Cascade="cascade",s.Restrict="restrict",s.Orphan="orphan",s.Unknown="unknown",s))(JE||{}),ms=(s=>(s.RequirementReference="requirement-reference",s.Spec="spec",s.PrDescription="pr-description",s.CouldBreak="could-break",s))(ms||{}),He=u.string().trim().min(1),hc=He.describe("file:line"),UD=t=>He.refine(e=>e.length<=400,e=>({message:`is ${e.length} characters, over the 400 cap \u2014 ${t}`})),pl=He.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'),HE=u.object({method:He,path:He,service:u.string().optional(),evidence:hc,repository:pl}),h9=u.object({id:He.describe("short-slug, e.g. R9"),statement:He.max(400,"exceeds 400 characters \u2014 state the requirement, do not paste the spec section").describe("a testable obligation, not a summary"),source:u.nativeEnum(ms).describe("spec outranks pr-description when both state it"),evidence:He.describe("spec: file:line or a section locator. pr-description: the quoted phrase it comes from.")}),g9=u.object({id:He.describe("short-slug"),statement:He.max(400,"exceeds 400 characters \u2014 state the behaviour, do not paste the code").describe("what the change makes true"),surface:He.describe("METHOD /path, or a component/page name"),evidence:He.describe("file:line from the diff that introduces it"),repository:pl,satisfies:u.array(He).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)")}),m9=u.object({id:He.describe("short-slug"),file:He,line:u.number().optional(),claim:UD("shorten it to the one sentence that states the defect, and move the supporting detail into `evidence`"),severity:u.nativeEnum(_o),evidence:UD("cite the file:line and the one line that shows it, rather than reproducing the surrounding code").describe("quoted diff/code line"),status:u.nativeEnum(Uo),repository:pl,conflictsWith:u.array(He).optional().describe("requirement ids (from `requirements`) this defect contradicts or leaves unimplemented \u2014 a lower-precedence source (the diff, or the PR description) lost")}),y9=u.object({name:He,language:u.string().optional(),framework:u.string().optional(),evidence:hc,repository:pl}),E9=u.object({dir:He,framework:u.string().optional(),kind:u.nativeEnum(YE),evidence:hc,repository:pl}),C9=u.object({from:He,to:He,onDelete:u.nativeEnum(JE),evidence:hc}),I9=u.object({entity:He,field:He,values:u.array(u.string()),evidence:hc}),w9=u.object({entities:u.array(u.object({name:He,evidence:hc})),references:u.array(C9).describe("INBOUND references \u2014 what still points at an entity when it is deleted"),stateFields:u.array(I9)}),WE=u.object({schemaVersion:u.literal(1),repository:u.object({path:He.describe("absolute repo path"),currentBranch:He,baseBranch:He}),project:u.object({type:u.nativeEnum(Np),primaryLanguage:He,languages:u.array(u.string()),frameworks:u.array(u.string())}),services:u.array(y9),infrastructure:u.object({containerized:u.boolean(),hasDockerCompose:u.boolean(),composeFiles:u.array(u.string()),hasCiCd:u.boolean()}),diff:u.object({changedFiles:u.array(u.string()).describe("as git reports them; a file in another checkout may carry that repo's name"),nonApplicationOnly:u.boolean(),summary:He.describe("\u2264400 chars")}),endpoints:u.object({new:u.array(HE),modified:u.array(HE),removed:u.array(HE)}),existingTests:u.object({locations:u.array(E9)}),entityMap:w9,requirements:u.array(h9).describe("from a spec (attached or linked) and/or the PR description; empty when neither states a testable obligation"),behaviors:u.array(g9),findings:u.array(m9),unexamined:u.array(u.string()).describe("files or areas outside this change you did not open"),summary:He.describe("one paragraph on what this change does and its test-relevant risk")});var v9=u.object({route:u.string().describe('the page this step happens on, e.g. "/products/:id"'),action:u.string().describe('what the user does there, through the UI, e.g. "clicks Add to cart"'),clauses:u.array(u.string()).optional().describe("the plan clause ids this step exercises"),check:u.string().optional().describe("what the user then sees that shows the step worked; the test asserts it")}),fl=(n=>(n.InProcess="in-process",n.Browser="browser",n))(fl||{}),PD=(r=>(r.Spec="spec",r.PrDescription="pr-description",r.Inferred="inferred",r))(PD||{}),LD=u.object({id:u.string().describe('e.g. "J1"'),name:u.string().describe(`the flow in a user's words, e.g. "buy a product with a coupon"`),entry:u.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:u.array(v9).describe("every step, in order, from the entry page to the outcome: at least two"),outcome:u.string().describe("what the user sees at the end that shows the flow worked: every part of it"),finishes:u.string().optional().describe('the user action that completes the task, verb first, e.g. "places the order"; the journey walks on to it'),kind:u.nativeEnum(fl).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:u.nativeEnum(PD).optional().describe("spec or pr-description when one describes this flow (quote it under evidence), else inferred"),evidence:u.string().optional().describe("for spec or pr-description: its words that describe the flow"),testFile:u.string().describe("the browser test file it goes in, beside the repo's existing e2e tests")}),Fp=u.object({journey:u.string().describe("the plan's journey id"),file:u.string().describe("the browser test file that walks it"),brokeAt:u.object({step:u.number().int().describe("the 1-based step whose check failed first"),expected:u.string(),actual:u.string().describe("what the app did instead, from the runner's output"),notReached:u.array(u.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:u.string().describe("the title of the one test in that file that walks it end to end")});var zte=["stale_test","open_question"],Kte=["low","medium","high","critical"];var Mp=(n=>(n.Skyramp="skyramp",n.Llm="llm",n))(Mp||{}),ys=u.string().trim().min(1),S9=u.object({case:ys.describe("recommend id this assertion enforces"),evidence:ys.describe("the exact assertion line from the file that checks that case's observable")}),zE=u.object({kind:u.nativeEnum(rp).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:ys.describe("the dependency, endpoint or data it affects"),mechanism:u.nativeEnum(sp).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:ys.describe("what it sets up"),worker:ys.optional().describe("skyramp_mocker: host:port of the worker the test applies the mock to (default localhost:35142)"),cleanup:ys.optional().describe("seed: a command, without a shell, that removes the data when the test does not")}),R9=u.object({file:ys.describe("staged path under .skyramp/staged/"),source:u.nativeEnum(Mp),language:ys,covers:u.array(u.string()).min(1,"must be a non-empty array of recommend ids").describe("recommend ids this test covers"),assertions:u.array(S9).min(1,"must be a non-empty array").describe("one per case covered, citing the real line"),context:u.array(zE).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")}),KE=u.object({schemaVersion:u.literal(1),tests:u.array(R9),deferredUi:u.array(u.string()).describe("recommend ui ids left for the UI stage (generate) \u2014 [] for generate-ui"),summary:ys.describe("one paragraph")});var Es=u.string().trim().min(1),hl=72,k9=u.object({repository:Es.optional().describe("owner/repo of the checkout this lint ran in, when the run has several; omit for the working checkout"),tool:u.string(),command:u.string().describe("the exact command you ran, scoped to the changed files"),clean:u.boolean(),fixed:u.array(u.string()).optional().describe("files you fixed"),uncovered:u.array(u.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.")}),ine=u.object({schemaVersion:u.literal(1),lint:u.array(k9).min(1).describe("one entry per checkout this run wrote tests in, each run from that checkout"),fileConventions:u.object({ok:u.boolean(),notes:u.string().optional()}),ciReadiness:u.object({covered:u.boolean().describe("will the repo's CI run these tests?"),notes:u.string().optional()}),dependencies:u.object({added:u.array(u.object({package:u.string(),manifest:u.string(),repository:Es.optional().describe("owner/repo of the manifest's checkout; omit for the working checkout"),reason:Es.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:u.array(u.object({file:Es,repository:Es.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:u.object({message:Es.refine(t=>t.split(`
|
|
121
121
|
`)[0].length<=hl,{message:`subject line must be <= ${hl} chars`})}),pr:u.object({title:Es.max(hl,`must be <= ${hl} chars`),body:Es}),ready:u.boolean().describe("a statement of fact: true only if the tests are fit to commit as they stand"),blockers:u.array(u.string()).describe("what blocks the commit \u2014 required non-empty when ready is false"),summary:Es.describe("one paragraph")});var ri=ye(require("fs")),yc=ye(require("path")),VD=require("child_process");var pr="{junit}",_p=(r=>(r.Junit="junit",r.Trx="trx",r.GoTestJson="go-test-json",r))(_p||{}),ZE=(e=>(e.Minitest="minitest",e))(ZE||{}),$D=u.string().trim().min(1),gc=u.object({cwd:$D.describe('repo-relative directory the command starts in ("." for the root)'),argv:u.array($D).min(1).describe(`the command as separate arguments, run without a shell; for a junit or trx report an argument or env value holds ${pr}, where the report is written (not for Maven or Gradle, whose build writes its own)`),env:u.record(u.string(),u.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:u.object({format:u.nativeEnum(_p).describe(`junit (JUnit XML to ${pr}), trx (to ${pr}), or go-test-json (go test -json on the command's output)`),reporter:u.nativeEnum(ZE).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 mc="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)",une=`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 ${pr} in the reporter's argument or env setting), trx (a TRX file to ${pr}, 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 ${pr}: 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 ${pr} itself. A setting the tests or reporter read goes in "env" (RAILS_ENV=test, or PLAYWRIGHT_JUNIT_OUTPUT_FILE=${pr} with playwright test --reporter=junit): the run sets it, so never wrap the command in a shell to set one. The run replaces ${pr} in argv and env with its report path, executes the command, and reads that report.`;var Po=(s=>(s.ExistingEvidenceSufficient="existing_evidence_sufficient",s.TargetedUnit="targeted_unit",s.RuntimeRequired="runtime_required",s.BlockedPreflight="blocked_preflight",s))(Po||{}),ni=(i=>(i.ExistingEvidence="existing_evidence",i.Unaffected="unaffected",i.ExistingUnit="existing_unit",i.NewUnit="new_unit",i.Runtime="runtime",i))(ni||{}),XE=(n=>(n.Repository="repository",n.Testbot="testbot",n))(XE||{}),eC=(r=>(r.Identified="identified",r.Passed="passed",r.Failed="failed",r))(eC||{}),on=u.string().trim().min(1),x9=u.string().regex(/^[a-z0-9][a-z0-9-]*$/,"must be a short lowercase slug").describe("short-slug");var T9=u.object({id:x9,source:u.nativeEnum(XE),kind:u.nativeEnum(Ys),outcome:u.nativeEnum(eC),summary:on.max(400).describe("one line: what it shows"),tests:u.array(on).optional().describe("source repository: the existing tests, as repo-relative paths, optionally path::test-name"),repository:on.optional().describe("source repository: owner/repo the tests live in, when the run has several checkouts; omit for the working checkout"),command:on.optional().describe("source testbot: the exact command you ran, as you ran it"),run:gc.optional().describe(`source repository, for tests in ${mc}: 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`)}),D9=u.object({behaviorId:on.describe("an id from analyze's behaviors"),mechanism:u.nativeEnum(ni),evidenceIds:u.array(on).default([]).describe("existing_evidence: the ci-<n> or evidence ids that establish it; existing_unit: the evidence id naming the tests to run"),covers:u.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')}),tC=(r=>(r.Browser="browser",r.RunningApp="running-app",r.Outside="outside",r))(tC||{}),N9=u.object({behaviorId:u.string().trim().optional().describe("an id from analyze's behaviors, when it is about one"),missing:on.max(600).describe("the evidence that is required and cannot be obtained in this run"),needs:u.nativeEnum(tC).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)")}),F9=u.object({file:on.describe("the changed file the failure is in"),repository:on.optional().describe("owner/repo the file is in, when the run has several checkouts; omit for the working checkout"),reason:on.max(300).describe("what prerequisite the change fails"),evidence:on.max(400).describe("the error line, quoted")}),M9=u.object({behaviorId:on.describe("an id from analyze's behaviors"),reason:on.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)")}),gl=u.object({schemaVersion:u.literal(1),decision:u.nativeEnum(Po),evidence:u.array(T9).describe("evidence this session found or produced; CI results are the ci-<n> items and are not restated here"),plan:u.array(D9).describe("how each changed behavior's evidence is obtained"),gaps:u.array(N9),outOfScope:u.array(M9).optional().describe("behaviors analyze found that this change neither changes nor states"),blocked:F9.optional().describe("only for blocked_preflight"),rationale:on.max(1200).describe("\u22641200 characters: why this evidence is enough, or what it still lacks \u2014 the scope you chose and why")});function Up(t){let e=Ke(t,"recommend.json");if(!e||!Array.isArray(e.generate)||!Array.isArray(e.maintenance))return;let n=e;return{...n,maintenance:n.maintenance.map(({repository:r,...s})=>({...s,test:s.test.trim().replace(/^\.\//,""),...r?.trim()?{repository:r.trim()}:{}}))}}function L9(t){return In(KE,t).errors}function $9(t,e=[]){let{value:n,error:r}=ft(t,e);if(r)return{errors:[r]};let s=L9(n);return s.length>0?{errors:s}:{generate:n,errors:[]}}function Pp(t,e=[]){return $9(t.stdout,e)}function O9(t){return t.generate.filter(e=>e.type!=="ui").map(e=>e.id)}function GD(t){return t.generate.filter(e=>e.type==="ui").map(e=>e.id)}var Lp={backend:{stage:"generate",cases:O9,noRecommendCoverage:"recommend.json missing or malformed \u2014 cannot check coverage",noRecommendIntent:"recommend.json missing or malformed \u2014 cannot check intent",uncovered:t=>`recommend case "${t}" is not covered by any generated test`,unknownCovered:t=>`test covers unknown recommend id "${t}"`,unasserted:t=>`case "${t}" has no verified assertion enforcing its expected_observable`,usedCodegen:FD,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:GD,noRecommendCoverage:"recommend.json not found \u2014 cannot check UI coverage",noRecommendIntent:"recommend.json not found \u2014 cannot check UI intent",uncovered:t=>`UI case "${t}" is not covered by any generated UI test`,unknownCovered:t=>`test covers "${t}" which is not a recommend UI case`,unasserted:t=>`UI case "${t}" has no verified assertion enforcing its expected_observable`,usedCodegen:MD,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."}},Gne=Mn("generate-schema",(t,e)=>Pp(e,t.secretValues));function V9(t){let e=Lp[t];return{name:`${e.stage}-coverage`,verify(n,r){let{generate:s,errors:i}=Pp(r,n.secretValues);if(!s)return Qt(this.name,i);let a=Up(n);if(!a)return Qt(this.name,[e.noRecommendCoverage]);let c=new Set(s.tests.flatMap(f=>f.covers)),l=[],d=e.cases(a);for(let f of d)c.has(f)||l.push(e.uncovered(f));let A=new Set(t==="ui"?d:a.generate.map(f=>f.id));for(let f of c)A.has(f)||l.push(e.unknownCovered(f));if(t==="backend"){let f=new Set(s.deferredUi),h=new Set(GD(a));for(let y of h)!f.has(y)&&!c.has(y)&&l.push(`UI case "${y}" is neither covered nor deferred to the UI stage`);for(let y of f)h.has(y)||l.push(`deferredUi lists "${y}" which is not a UI case`)}return l.length===0?{name:this.name,passed:!0}:Qt(this.name,l)}}}function G9(t){let e=Lp[t];return{name:`${e.stage}-intent`,verify(n,r){let{generate:s,errors:i}=Pp(r,n.secretValues);if(!s)return Qt(this.name,i);let a=Up(n);if(!a)return Qt(this.name,[e.noRecommendIntent]);let{asserted:c,errors:l,badFiles:d}=z9(s,n.inputs.repositoryPath),A=l.length;for(let h of e.cases(a))c.has(h)||l.push(e.unasserted(h));if(l.length===0)return{name:this.name,passed:!0};let f=Qt(this.name,l);return A>0&&A===l.length&&d.size>0?{...f,droppable:[...d]}:f}}}function j9(t){let e=Lp[t];return n=>{if(!n.inputs.skyrampMcp?.command||t==="backend"&&!VE(n))return;let r=yc.join(n.outputsDir,`${e.stage}-stream.ndjson`);if(!(!ri.existsSync(r)||e.usedCodegen(r)))return _D(r)?e.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."}}var jne=V9("backend"),qne=G9("backend"),Hne=j9("backend");var OD=t=>t.replace(/\s+/g,"");var nC={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[t,e]of[["javascript","typescript"],["kotlin","java"]])nC[t]=nC[e];function q9(t,e){if(t.includes(Yu(e))||OD(t).includes(OD(e)))return!0;let n=e.split(/\r?\n/).map(r=>r.trim()).filter(r=>r&&!/^(\/\/|#|\*|\/\*)/.test(r));return n.length>0&&n.every(r=>t.includes(Yu(r)))?!0:W9(t,e)}var H9=/\bassert\w*\b|\bexpect\s*\(|\.should\b|\brequire\s*\(/i,Y9=12,J9=/,\s*\(\s*#|,\s*f?["'`]|\s+#\s|\s+\/\/|\s*\((?:line|lines|at line)\b|\s*,\s*$/i;function W9(t,e){let n=e.split(/\s*;\s*|\s*\.\.\.\s*|\r?\n/),r=0;for(let s of n){let i=H9.exec(s);if(!i)continue;let a=s.slice(i.index),c=J9.exec(a);if(c&&(a=a.slice(0,c.index)),a=Yu(a).replace(/[,\s]+$/,""),a.length<Y9||!t.includes(a))return!1;r++}return r>0}function z9(t,e){let n=new Set,r=[],s=new Set;for(let i of t.tests){let a=yc.resolve(e,i.file);if(!ri.existsSync(a))continue;let c=Yu(ri.readFileSync(a,"utf-8"));for(let l of i.assertions??[]){if(!q9(c,l.evidence)){r.push(`assertion evidence for "${l.case}" not found in ${i.file} \u2014 cite the real assertion line`),s.add(i.file);continue}i.covers.includes(l.case)?n.add(l.case):(r.push(`assertion cites case "${l.case}" not in that test's covers[]`),s.add(i.file))}}return{asserted:n,errors:r,badFiles:s}}var K9=/\.(spec|test)\.[cm]?[jt]sx?$/i;function jD(t){let e;try{e=(0,VD.execFileSync)("git",[...To,"status","--porcelain","--untracked-files=all"],{env:rn(),cwd:t,encoding:"utf-8",stdio:["ignore","pipe","ignore"]})}catch{return}let n=s=>/_scaffold/i.test(s)||up.test(s),r=[];for(let s of e.split(`
|
|
122
|
-
`)){if(!s.trim()||s.length>1&&s[1]==="D")continue;let i=s.slice(3).trim(),a=i.indexOf(" -> ");if(a!==-1&&(i=i.slice(a+4).trim()),i=i.replace(/^"|"$/g,""),!i)continue;let c=i.replace(/^\.\//,"");c.startsWith(".skyramp/")||!n(c)||r.push(c)}return r}function Z9(t){let e=Lp[t],n=t==="ui";return{name:`${e.stage}-no-litter`,verify(r){let s=jD(r.inputs.repositoryPath);if(s===void 0)return{name:this.name,passed:!0};let i=s.filter(a=>K9.test(a)===n);return i.length===0?{name:this.name,passed:!0}:Qt(this.name,[`${e.stage} left files outside .skyramp/ \u2014 move the staged test into .skyramp/staged/ and delete any codegen draft (e.g. *_scaffold.*): ${i.slice(0,6).join(", ")}`])}}}var Yne=Z9("backend");var ml=ye(require("fs")),Lo=ye(require("path"));function HD(t){return In(jE,t).errors}function t3(t,e=[]){let{value:n,error:r}=ft(t,e);if(r)return{errors:[r]};let s=HD(n);return s.length>0?{errors:s}:{adapt:n,errors:[]}}var n3="adapt-scratch",qD=`${n3}/adapt-result.json`;function YD(t,e){let n=Lo.join(t.outputsDir,qD),r;try{r=ml.readFileSync(n,"utf-8")}catch{r=void 0}if(r!==void 0&&(t.secretValues??[]).some(a=>r.includes(a)))return{errors:[`${qD} contains a secret value (token / credential) \u2014 never write it anywhere`]};let s=t3(e.stdout,t.secretValues);if(s.adapt)return s;let i=r!==void 0?po(n):void 0;return i!==void 0&&HD(i).length===0?{adapt:i,errors:[]}:s}var hre=Mn("adapt-schema",YD);var JD=require("child_process");function WD(t){let e;try{e=(0,JD.execFileSync)("git",[...To,"status","--porcelain","-z","--untracked-files=all"],{env:rn(),cwd:t,encoding:"utf-8",maxBuffer:16*1024*1024})}catch{return[]}let n=e.split("\0"),r=[];for(let s=0;s<n.length;s++){let i=n[s];if(i.length<4)continue;let a=i.slice(0,2);r.push({code:a,path:i.slice(3)}),(a[0]==="R"||a[0]==="C")&&s++}return r}var bre=2*1024*1024;var $p=u.string().trim().min(1),r3=u.object({cwd:$p.describe(`directory the command starts in, relative to the test's checkout ("." for its root)`),argv:u.array($p).min(1).describe("the command as separate arguments, run without a shell"),env:u.record(u.string(),u.string()).optional().describe("plain settings the listing needs beyond the CI step's own; never a credential or PATH")}),s3=u.object({file:$p.describe("a file of the test's checkout, relative to its root"),line:$p.describe("a line of that file, quoted exactly from where its command starts to its end")}),zD=u.object({collected:u.boolean().describe("whether the repo's CI runs this test as it is"),steps:u.array(s3).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:u.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:r3.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:u.string().optional().describe("when not collected: why the repo's CI will not run it")});var ge=u.string().trim().min(1),u3=t=>{if(!t||typeof t!="object")return t;let e=t;return typeof e.skip=="string"&&e.skip.trim()&&(e.expected===void 0||e.expected===null)?{...e,expected:"(not tested)"}:t},l3=u.preprocess(u3,u.object({id:ge.describe(`its requirement's id plus a letter, e.g. "R1a", "AC-3a"`),clause:ge.describe("one testable part of the requirement"),expected:ge.describe("the outcome the requirement calls for \u2014 taken from the requirement, never from what the code does"),skip:u.string().optional().describe("only when no test can check this clause here: why"),type:u.nativeEnum(ei).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:u.string().optional().describe('its "METHOD /path", or the page / flow'),steps:u.string().optional().describe("what that test does; its expected outcome is this clause's"),finding:u.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:u.string().optional().describe("path:line of the code that decides this clause, when there is one"),mutates:u.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:u.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:u.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)")})),KD=u.object({spec:u.string().optional().describe("file:line of a spec in the repository"),prDescription:u.boolean().optional().describe("or true when a pull request description says otherwise"),reference:u.string().optional().describe("or the key of an item the run was given, as listed"),says:ge.describe("what it says there, in its own words, copied exactly"),criterion:u.number().int().positive().optional().describe("an item's only: leave it out; Testbot numbers it")}).refine(t=>[!!t.prDescription,!!t.spec?.trim(),!!t.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`}),d3=u.object({id:ge.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:ge,source:u.nativeEnum(ms).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:u.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:ge.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:u.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:u.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:u.array(KD).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:u.array(l3)}),ZD=(s=>(s.ServerError="server-error",s.DataLost="data-lost",s.FinalState="final-state",s.DerivedValues="derived-values",s))(ZD||{}),A3=u.object({id:ge.describe('e.g. "F1"'),file:ge,line:u.number().optional(),claim:ge.describe("the defect, in one sentence"),severity:u.nativeEnum(_o),evidence:ge.describe("the code line, or the probe request and response, that shows it"),conflictsWith:u.array(ge).optional().describe("requirement or clause ids it violates"),keeps:u.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:u.nativeEnum(ZD).optional().describe("for a defect that breaks a rule every app keeps, which nothing needs to state: which one"),existing:u.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:u.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)")}),p3=u.object({id:ge.describe('e.g. "Q1"'),question:ge.describe("what is unsettled, as a question the PR author can answer"),readings:u.array(ge).min(2).describe("each reasonable behaviour, with what points to it (file:line, or the words that suggest it)"),about:u.string().optional().describe("the requirement or clause id it is about, when there is one"),sources:u.array(KD).optional().describe("when sources of the same rank disagree on it: each of them")}),f3=u.object({id:ge.describe('unique, a short kebab-case name for what the case checks, e.g. "ship-twice-409"'),type:u.nativeEnum(ei).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:ge.describe('"METHOD /path", or the page / flow'),clause:u.string().optional().describe("the clause id this case checks"),finding:u.string().optional().describe("the finding id this case catches"),steps:ge.describe("what the test does"),expected:ge.describe("the expected outcome, from the clause"),mutates:u.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")}),h3=u.object({test:ge.describe("existing test file"),action:u.nativeEnum(ti),reason:ge,mutates:u.boolean().optional().describe("true when the maintained test changes state"),clauses:u.array(ge).optional().describe("the clause ids this test checks")}),g3=u.object({outcome:u.nativeEnum(fs).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:u.record(u.string()).optional().describe("service \u2192 base URL of the running app"),health:u.object({url:u.string().optional(),command:u.string().optional(),output:u.string().optional()}).optional().describe("the check that shows the app serves real data, and what it returned"),teardown:u.string().optional().describe("command that stops the app"),dependencies:u.record(u.boolean()).optional().describe("every backing service: true = really running, false = mocked"),recipeFixes:u.array(u.string()).optional().describe("what you changed in the recipe"),error:u.string().optional().describe("when it did not come up: the failing command and what it printed"),suspectFiles:u.array(u.string()).optional().describe("change-broke-bringup: the changed files to blame"),login:u.object({username:ge,password:u.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:gE.optional()}),nse=u.object({schemaVersion:u.literal(1),requirements:u.array(d3),findings:u.array(A3),cases:u.array(f3).describe("a second test for a clause, and one case per finding that fails on this branch"),questions:u.array(p3).optional().describe("behaviours the change leaves unsettled; no case asserts any of them"),maintenance:u.array(h3),journeys:u.array(LD).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:u.array(u.object({clause:ge,why:ge})).optional().describe("a clause a user sees or does that no journey can reach through the UI, and why"),triage:gl.optional().describe("the validation triage decision, made before the app is started; its behaviorIds are clause ids"),app:g3.optional().describe("omit when no app was needed or none was started"),summary:ge.describe("one paragraph: what the change does and where the risk is")});var XD=(n=>(n.Backend="backend",n.Ui="ui",n))(XD||{});var Op=(s=>(s.Added="added",s.Updated="updated",s.Deleted="deleted",s.Unchanged="unchanged",s))(Op||{}),m3=u.object({file:ge.describe("repo-relative path; in another repo of the change, that repo's directory name then its path"),kind:u.nativeEnum(XD),change:u.nativeEnum(Op).describe("added: a file you created; updated / deleted / unchanged: an existing test"),covers:u.array(u.string()).describe("the plan case ids this file tests"),defect:u.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:u.object({requirement:ge.describe("the requirement or clause id the change deliberately alters"),line:ge.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:u.object({exit:u.number().nullable().describe("exit code of your last run of this file; null if it could not be run"),cases:u.array(u.object({case:ge,status:u.nativeEnum(jn),defect:u.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:u.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:u.string().optional().describe("for a case you keep as a defect: path:line of the application code that makes it fail"),requires:u.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:u.string().optional().describe("what failed and why, or why it was not run")}),assertions:u.array(u.object({case:ge,evidence:ge})).optional().describe("per covered case, the assertion line that checks its expected outcome"),functions:u.array(u.object({name:ge.describe("the test function as the runner names it within its file, without the file (test_x, TestClass::test_x, TestSuite/TestCase)"),cases:u.array(ge).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:u.object({draft:u.union([u.string(),u.array(u.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:u.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:u.array(zE).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:ge.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:zD.optional().describe("for a file you added or updated: whether the repo's CI will run it, and how you know"),run:gc.optional().describe(`for a file in ${mc}, 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 ${pr}, or go-test-json); Testbot runs it before write ends and re-runs the tests with it`)}),y3=t=>{if(!t||typeof t!="object")return t;let{test:e,...n}=t;return typeof e=="string"&&e.trim()&&n.tests===void 0?{...n,tests:[e]}:t},E3=u.preprocess(y3,u.object({description:ge.describe("what is wrong and how to reproduce it: endpoint or page, input, what you got vs what was expected"),severity:u.nativeEnum(_o).optional(),sourceFile:u.string().optional().describe("the app file at fault"),sourceLine:u.number().optional(),tests:u.array(ge).optional().describe("every test file that fails because of it: a defect several tests show is one issue"),finding:u.string().optional().describe("the plan's finding id, when it is one"),requirements:u.array(ge).optional().describe("the plan's requirement or clause ids it violates")})),rse=u.object({schemaVersion:u.literal(1),tests:u.array(m3),notWritten:u.array(u.object({case:ge,reason:ge})).describe("every plan case no test covers, and why"),journeys:u.array(Fp).optional().describe("one entry per planned user journey: the browser test that walks it end to end"),lint:u.object({command:u.string(),clean:u.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:u.array(u.object({package:ge,manifest:ge.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:ge.optional().describe("owner/repo of the manifest's checkout; omit for the repo under test"),reason:ge.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:u.array(ge).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:u.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:u.object({message:ge.describe('"Skyramp Testbot: \u2026", subject line at most 72 characters'),prTitle:ge.describe("at most 72 characters"),prBody:ge.describe("what the tests cover and what they found")}),report:u.object({summary:ge.describe("1-2 sentences for the PR author: does the change do what it says?"),issues:u.array(E3).describe("every defect the tests found"),nextSteps:u.array(u.string())})});var sse={added:"place",updated:"update",deleted:"delete",unchanged:"verify"};var tN=(r=>(r.Requirement="requirement",r.PrDescription="pr_description",r.Code="code",r))(tN||{}),Rt=u.string().trim().min(1),C3=u.object({expectation:Rt.max(300).describe("the behavior this assertion pins, in words"),source:u.nativeEnum(tN),expected:Rt.max(200).describe("the exact value or outcome asserted, as the test asserts it")}),I3=u.object({file:Rt.describe("path of the NEW test file you wrote, relative to its repository"),repository:Rt.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),framework:Rt.describe("the framework the repository runs this file with: pytest, jest, vitest, node-test, or the name of any other"),run:gc.optional().describe(`for ${mc}: how the run executes only the tests in names, with the repository's own runner writing JUnit XML to {junit}`),covers:u.array(Rt).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:u.array(Rt).min(1).describe("the test functions/cases in the file that provide evidence for that behavior, as the framework names them"),assertions:u.array(C3).min(1)}),Vp=(n=>(n.Updated="updated",n.Deleted="deleted",n))(Vp||{}),eN=300,w3=u.object({file:Rt.describe("path of the EXISTING test file you updated or deleted, relative to its repository"),repository:Rt.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),change:u.nativeEnum(Vp),staleBecause:u.object({requirement:Rt.describe("the requirement or clause id the change deliberately alters"),line:Rt.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:u.preprocess(t=>typeof t=="string"?t.trim().slice(0,eN):t,Rt.max(eN)).describe("what the change deliberately altered that made the test wrong")}),sC=u.object({schemaVersion:u.literal(1),tests:u.array(I3),maintained:u.array(w3).optional().describe("existing tests the change made stale that you updated or deleted; omit when there were none"),defectsNotTested:u.array(u.object({id:Rt,reason:Rt.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:u.array(Fp).optional().describe("one entry per planned user journey: the in-process test that walks it end to end"),journeysNotWritten:u.array(u.object({journey:Rt,missing:Rt.transform(t=>t.length>300?`${t.slice(0,299)}\u2026`:t)})).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:u.object({command:u.string(),clean:u.boolean()}).optional().describe("the linter/formatter you ran on your test files, if the repository has one you can run; omit otherwise"),commitMessage:Rt.optional().describe("the commit message for your tests: a subject line of at most 72 characters, then what they cover")});var jp="generate-unit.json";function Q3(t){let{value:e,error:n}=ft(t);if(n)return{errors:[n]};let{value:r,errors:s}=In(sC,e);return s.length?{errors:s}:{output:r,errors:[]}}function v3(t){return Q3(t.stdout)}var Gse=Mn("generate-unit-schema",(t,e)=>v3(e));var Gp=String.raw`(?:node:)?(?:http|https|http2|net|tls|dgram)`,jse=[[/\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+["']${Gp}["']|\bimport\s+["']${Gp}["']|require\(\s*["']${Gp}["']\s*\)|\bimport\(\s*["']${Gp}["']\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 si=ye(require("path"));var eie={"application/pdf":"PDF","text/csv":"CSV","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"};var iC=t=>new Map((t??[]).flatMap(e=>e.file?[[ju(e.key),e.file.name]]:[])),R3=10*1024*1024,k3=t=>t?.mediaType==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"||t?.mediaType==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",iN=(t,e)=>si.join(si.dirname(t),`${si.basename(t,si.extname(t))}${e}`),x3=t=>iN(t,".extracted.txt");var T3=t=>iN(t,".quotes.txt");function oN(t){return k3(t.file)?x3(t.path):t.file?.mediaType==="application/pdf"?T3(t.path):t.path}var die=new Set(["targeted_unit","existing_evidence_sufficient"]);var N3="triage.json",Zie=new Set(["existing_evidence","unaffected","existing_unit","new_unit","runtime"]),Xie={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 F3(t){let{value:e,error:n}=ft(t);if(n)return{errors:[n]};let{value:r,errors:s}=In(gl,e);return s.length?{errors:s}:{triage:r,errors:[]}}function M3(t){return F3(t.stdout)}var eoe=Mn("triage-schema",(t,e)=>M3(e));function _3(t){let e=t.inputs?.pipeline;return e?t.state.stages[e==="two-step"?"plan":"triage"]:t.state.stages.triage??t.state.stages.plan}function oC(t){if(_3(t)?.status==="passed")return po(cN.join(t.outputsDir,N3))}function aC(t){return bD($E(t.inputs,Ke(t,`${Al}.json`),oC(t)?.sutRequired))}var toe=new Set(["deploy","recommend","generate","generate-ui","adapt","generate-unit","native-run","finalize","deliver"]);Ot();Ot();function uN(t,e){return e?`<!-- skyramp-testbot-run: ${e} -->
|
|
122
|
+
`)){if(!s.trim()||s.length>1&&s[1]==="D")continue;let i=s.slice(3).trim(),a=i.indexOf(" -> ");if(a!==-1&&(i=i.slice(a+4).trim()),i=i.replace(/^"|"$/g,""),!i)continue;let c=i.replace(/^\.\//,"");c.startsWith(".skyramp/")||!n(c)||r.push(c)}return r}function Z9(t){let e=Lp[t],n=t==="ui";return{name:`${e.stage}-no-litter`,verify(r){let s=jD(r.inputs.repositoryPath);if(s===void 0)return{name:this.name,passed:!0};let i=s.filter(a=>K9.test(a)===n);return i.length===0?{name:this.name,passed:!0}:Qt(this.name,[`${e.stage} left files outside .skyramp/ \u2014 move the staged test into .skyramp/staged/ and delete any codegen draft (e.g. *_scaffold.*): ${i.slice(0,6).join(", ")}`])}}}var Yne=Z9("backend");var ml=ye(require("fs")),Lo=ye(require("path"));function HD(t){return In(jE,t).errors}function t3(t,e=[]){let{value:n,error:r}=ft(t,e);if(r)return{errors:[r]};let s=HD(n);return s.length>0?{errors:s}:{adapt:n,errors:[]}}var n3="adapt-scratch",qD=`${n3}/adapt-result.json`;function YD(t,e){let n=Lo.join(t.outputsDir,qD),r;try{r=ml.readFileSync(n,"utf-8")}catch{r=void 0}if(r!==void 0&&(t.secretValues??[]).some(a=>r.includes(a)))return{errors:[`${qD} contains a secret value (token / credential) \u2014 never write it anywhere`]};let s=t3(e.stdout,t.secretValues);if(s.adapt)return s;let i=r!==void 0?po(n):void 0;return i!==void 0&&HD(i).length===0?{adapt:i,errors:[]}:s}var hre=Mn("adapt-schema",YD);var JD=require("child_process");function WD(t){let e;try{e=(0,JD.execFileSync)("git",[...To,"status","--porcelain","-z","--untracked-files=all"],{env:rn(),cwd:t,encoding:"utf-8",maxBuffer:16*1024*1024})}catch{return[]}let n=e.split("\0"),r=[];for(let s=0;s<n.length;s++){let i=n[s];if(i.length<4)continue;let a=i.slice(0,2);r.push({code:a,path:i.slice(3)}),(a[0]==="R"||a[0]==="C")&&s++}return r}var bre=2*1024*1024;var $p=u.string().trim().min(1),r3=u.object({cwd:$p.describe(`directory the command starts in, relative to the test's checkout ("." for its root)`),argv:u.array($p).min(1).describe("the command as separate arguments, run without a shell"),env:u.record(u.string(),u.string()).optional().describe("plain settings the listing needs beyond the CI step's own; never a credential or PATH")}),s3=u.object({file:$p.describe("a file of the test's checkout, relative to its root"),line:$p.describe("a line of that file, quoted exactly from where its command starts to its end")}),zD=u.object({collected:u.boolean().describe("whether the repo's CI runs this test as it is"),steps:u.array(s3).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:u.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:r3.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:u.string().optional().describe("when not collected: why the repo's CI will not run it")});var ge=u.string().trim().min(1),u3=t=>{if(!t||typeof t!="object")return t;let e=t;return typeof e.skip=="string"&&e.skip.trim()&&(e.expected===void 0||e.expected===null)?{...e,expected:"(not tested)"}:t},l3=u.preprocess(u3,u.object({id:ge.describe(`its requirement's id plus a letter, e.g. "R1a", "AC-3a"`),clause:ge.describe("one testable part of the requirement"),expected:ge.describe("the outcome the requirement calls for \u2014 taken from the requirement, never from what the code does"),skip:u.string().optional().describe("only when no test can check this clause here: why"),type:u.nativeEnum(ei).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:u.string().optional().describe('its "METHOD /path", or the page / flow'),steps:u.string().optional().describe("what that test does; its expected outcome is this clause's"),finding:u.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:u.string().optional().describe("path:line of the code that decides this clause, when there is one"),stated:u.string().optional().describe("the description's or spec's own words that state this clause, copied exactly, when they do"),mutates:u.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:u.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:u.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)")})),KD=u.object({spec:u.string().optional().describe("file:line of a spec in the repository"),prDescription:u.boolean().optional().describe("or true when a pull request description says otherwise"),reference:u.string().optional().describe("or the key of an item the run was given, as listed"),says:ge.describe("what it says there, in its own words, copied exactly"),criterion:u.number().int().positive().optional().describe("an item's only: leave it out; Testbot numbers it")}).refine(t=>[!!t.prDescription,!!t.spec?.trim(),!!t.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`}),d3=u.object({id:ge.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:ge,source:u.nativeEnum(ms).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:u.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:ge.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:u.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:u.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:u.array(KD).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:u.array(l3)}),ZD=(s=>(s.ServerError="server-error",s.DataLost="data-lost",s.FinalState="final-state",s.DerivedValues="derived-values",s))(ZD||{}),A3=u.object({id:ge.describe('e.g. "F1"'),file:ge,line:u.number().optional(),claim:ge.describe("the defect, in one sentence"),severity:u.nativeEnum(_o),evidence:ge.describe("the code line, or the probe request and response, that shows it"),conflictsWith:u.array(ge).optional().describe("requirement or clause ids it violates"),keeps:u.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:u.nativeEnum(ZD).optional().describe("for a defect that breaks a rule every app keeps, which nothing needs to state: which one"),existing:u.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:u.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)")}),p3=u.object({id:ge.describe('e.g. "Q1"'),question:ge.describe("what is unsettled, as a question the PR author can answer"),readings:u.array(ge).min(2).describe("each reasonable behaviour, with what points to it (file:line, or the words that suggest it)"),about:u.string().optional().describe("the requirement or clause id it is about, when there is one"),sources:u.array(KD).optional().describe("when sources of the same rank disagree on it: each of them")}),f3=u.object({id:ge.describe('unique, a short kebab-case name for what the case checks, e.g. "ship-twice-409"'),type:u.nativeEnum(ei).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:ge.describe('"METHOD /path", or the page / flow'),clause:u.string().optional().describe("the clause id this case checks"),finding:u.string().optional().describe("the finding id this case catches"),steps:ge.describe("what the test does"),expected:ge.describe("the expected outcome, from the clause"),mutates:u.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")}),h3=u.object({test:ge.describe("existing test file"),action:u.nativeEnum(ti),reason:ge,mutates:u.boolean().optional().describe("true when the maintained test changes state"),clauses:u.array(ge).optional().describe("the clause ids this test checks")}),g3=u.object({outcome:u.nativeEnum(fs).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:u.record(u.string()).optional().describe("service \u2192 base URL of the running app"),health:u.object({url:u.string().optional(),command:u.string().optional(),output:u.string().optional()}).optional().describe("the check that shows the app serves real data, and what it returned"),teardown:u.string().optional().describe("command that stops the app"),dependencies:u.record(u.boolean()).optional().describe("every backing service: true = really running, false = mocked"),recipeFixes:u.array(u.string()).optional().describe("what you changed in the recipe"),error:u.string().optional().describe("when it did not come up: the failing command and what it printed"),suspectFiles:u.array(u.string()).optional().describe("change-broke-bringup: the changed files to blame"),login:u.object({username:ge,password:u.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:gE.optional()}),nse=u.object({schemaVersion:u.literal(1),requirements:u.array(d3),findings:u.array(A3),cases:u.array(f3).describe("a second test for a clause, and one case per finding that fails on this branch"),questions:u.array(p3).optional().describe("behaviours the change leaves unsettled; no case asserts any of them"),maintenance:u.array(h3),journeys:u.array(LD).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:u.array(u.object({clause:ge,why:ge})).optional().describe("a clause a user sees or does that no journey can reach through the UI, and why"),triage:gl.optional().describe("the validation triage decision, made before the app is started; its behaviorIds are clause ids"),app:g3.optional().describe("omit when no app was needed or none was started"),summary:ge.describe("one paragraph: what the change does and where the risk is")});var XD=(n=>(n.Backend="backend",n.Ui="ui",n))(XD||{});var Op=(s=>(s.Added="added",s.Updated="updated",s.Deleted="deleted",s.Unchanged="unchanged",s))(Op||{}),m3=u.object({file:ge.describe("repo-relative path; in another repo of the change, that repo's directory name then its path"),kind:u.nativeEnum(XD),change:u.nativeEnum(Op).describe("added: a file you created; updated / deleted / unchanged: an existing test"),covers:u.array(u.string()).describe("the plan case ids this file tests"),defect:u.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:u.object({requirement:ge.describe("the requirement or clause id the change deliberately alters"),line:ge.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:u.object({exit:u.number().nullable().describe("exit code of your last run of this file; null if it could not be run"),cases:u.array(u.object({case:ge,status:u.nativeEnum(jn),defect:u.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:u.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:u.string().optional().describe("for a case you keep as a defect: path:line of the application code that makes it fail"),requires:u.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:u.string().optional().describe("what failed and why, or why it was not run")}),assertions:u.array(u.object({case:ge,evidence:ge})).optional().describe("per covered case, the assertion line that checks its expected outcome"),functions:u.array(u.object({name:ge.describe("the test function as the runner names it within its file, without the file (test_x, TestClass::test_x, TestSuite/TestCase)"),cases:u.array(ge).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:u.object({draft:u.union([u.string(),u.array(u.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:u.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:u.array(zE).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:ge.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:zD.optional().describe("for a file you added or updated: whether the repo's CI will run it, and how you know"),run:gc.optional().describe(`for a file in ${mc}, 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 ${pr}, or go-test-json); Testbot runs it before write ends and re-runs the tests with it`)}),y3=t=>{if(!t||typeof t!="object")return t;let{test:e,...n}=t;return typeof e=="string"&&e.trim()&&n.tests===void 0?{...n,tests:[e]}:t},E3=u.preprocess(y3,u.object({description:ge.describe("what is wrong and how to reproduce it: endpoint or page, input, what you got vs what was expected"),severity:u.nativeEnum(_o).optional(),sourceFile:u.string().optional().describe("the app file at fault"),sourceLine:u.number().optional(),tests:u.array(ge).optional().describe("every test file that fails because of it: a defect several tests show is one issue"),finding:u.string().optional().describe("the plan's finding id, when it is one"),requirements:u.array(ge).optional().describe("the plan's requirement or clause ids it violates")})),rse=u.object({schemaVersion:u.literal(1),tests:u.array(m3),notWritten:u.array(u.object({case:ge,reason:ge})).describe("every plan case no test covers, and why"),journeys:u.array(Fp).optional().describe("one entry per planned user journey: the browser test that walks it end to end"),lint:u.object({command:u.string(),clean:u.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:u.array(u.object({package:ge,manifest:ge.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:ge.optional().describe("owner/repo of the manifest's checkout; omit for the repo under test"),reason:ge.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:u.array(ge).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:u.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:u.object({message:ge.describe('"Skyramp Testbot: \u2026", subject line at most 72 characters'),prTitle:ge.describe("at most 72 characters"),prBody:ge.describe("what the tests cover and what they found")}),report:u.object({summary:ge.describe("1-2 sentences for the PR author: does the change do what it says?"),issues:u.array(E3).describe("every defect the tests found"),nextSteps:u.array(u.string())})});var sse={added:"place",updated:"update",deleted:"delete",unchanged:"verify"};var tN=(r=>(r.Requirement="requirement",r.PrDescription="pr_description",r.Code="code",r))(tN||{}),Rt=u.string().trim().min(1),C3=u.object({expectation:Rt.max(300).describe("the behavior this assertion pins, in words"),source:u.nativeEnum(tN),expected:Rt.max(200).describe("the exact value or outcome asserted, as the test asserts it")}),I3=u.object({file:Rt.describe("path of the NEW test file you wrote, relative to its repository"),repository:Rt.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),framework:Rt.describe("the framework the repository runs this file with: pytest, jest, vitest, node-test, or the name of any other"),run:gc.optional().describe(`for ${mc}: how the run executes only the tests in names, with the repository's own runner writing JUnit XML to {junit}`),covers:u.array(Rt).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:u.array(Rt).min(1).describe("the test functions/cases in the file that provide evidence for that behavior, as the framework names them"),assertions:u.array(C3).min(1)}),Vp=(n=>(n.Updated="updated",n.Deleted="deleted",n))(Vp||{}),eN=300,w3=u.object({file:Rt.describe("path of the EXISTING test file you updated or deleted, relative to its repository"),repository:Rt.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),change:u.nativeEnum(Vp),staleBecause:u.object({requirement:Rt.describe("the requirement or clause id the change deliberately alters"),line:Rt.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:u.preprocess(t=>typeof t=="string"?t.trim().slice(0,eN):t,Rt.max(eN)).describe("what the change deliberately altered that made the test wrong")}),sC=u.object({schemaVersion:u.literal(1),tests:u.array(I3),maintained:u.array(w3).optional().describe("existing tests the change made stale that you updated or deleted; omit when there were none"),defectsNotTested:u.array(u.object({id:Rt,reason:Rt.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:u.array(Fp).optional().describe("one entry per planned user journey: the in-process test that walks it end to end"),journeysNotWritten:u.array(u.object({journey:Rt,missing:Rt.transform(t=>t.length>300?`${t.slice(0,299)}\u2026`:t)})).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:u.object({command:u.string(),clean:u.boolean()}).optional().describe("the linter/formatter you ran on your test files, if the repository has one you can run; omit otherwise"),commitMessage:Rt.optional().describe("the commit message for your tests: a subject line of at most 72 characters, then what they cover")});var jp="generate-unit.json";function Q3(t){let{value:e,error:n}=ft(t);if(n)return{errors:[n]};let{value:r,errors:s}=In(sC,e);return s.length?{errors:s}:{output:r,errors:[]}}function v3(t){return Q3(t.stdout)}var Gse=Mn("generate-unit-schema",(t,e)=>v3(e));var Gp=String.raw`(?:node:)?(?:http|https|http2|net|tls|dgram)`,jse=[[/\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+["']${Gp}["']|\bimport\s+["']${Gp}["']|require\(\s*["']${Gp}["']\s*\)|\bimport\(\s*["']${Gp}["']\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 si=ye(require("path"));var eie={"application/pdf":"PDF","text/csv":"CSV","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"};var iC=t=>new Map((t??[]).flatMap(e=>e.file?[[ju(e.key),e.file.name]]:[])),R3=10*1024*1024,k3=t=>t?.mediaType==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"||t?.mediaType==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",iN=(t,e)=>si.join(si.dirname(t),`${si.basename(t,si.extname(t))}${e}`),x3=t=>iN(t,".extracted.txt");var T3=t=>iN(t,".quotes.txt");function oN(t){return k3(t.file)?x3(t.path):t.file?.mediaType==="application/pdf"?T3(t.path):t.path}var die=new Set(["targeted_unit","existing_evidence_sufficient"]);var N3="triage.json",Zie=new Set(["existing_evidence","unaffected","existing_unit","new_unit","runtime"]),Xie={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 F3(t){let{value:e,error:n}=ft(t);if(n)return{errors:[n]};let{value:r,errors:s}=In(gl,e);return s.length?{errors:s}:{triage:r,errors:[]}}function M3(t){return F3(t.stdout)}var eoe=Mn("triage-schema",(t,e)=>M3(e));function _3(t){let e=t.inputs?.pipeline;return e?t.state.stages[e==="two-step"?"plan":"triage"]:t.state.stages.triage??t.state.stages.plan}function oC(t){if(_3(t)?.status==="passed")return po(cN.join(t.outputsDir,N3))}function aC(t){return bD($E(t.inputs,Ke(t,`${Al}.json`),oC(t)?.sutRequired))}var toe=new Set(["deploy","recommend","generate","generate-ui","adapt","generate-unit","native-run","finalize","deliver"]);Ot();Ot();function uN(t,e){return e?`<!-- skyramp-testbot-run: ${e} -->
|
|
123
123
|
${t}`:t}var dN=600,Hp=300;function lN(t){return typeof t=="string"?t.trim():t instanceof Buffer?t.toString("utf-8").trim():""}function U3(t){let e=t,n=(typeof e?.message=="string"?e.message:String(t)).trim(),r=[lN(e?.stderr),lN(e?.stdout)].filter(Boolean);return r.length?[n.split(`
|
|
124
124
|
`)[0],...r].join(`
|
|
125
125
|
`):n}function AN(t,e,n,r=0){let s=t.join(e);if(s.length<=n)return s;let[i="",...a]=t;if(!a.length)return`${i.slice(0,n-1)}\u2026`;let c=i.length<=r?i:i.slice(0,Math.floor(n/3)),l=n-c.length-e.length-1;return`${c}${e}\u2026${a.join(e).slice(-l)}`}function pN(t,e){return AN(t.trim().split(`
|
package/dist/runner-client.cjs
CHANGED
|
@@ -90,7 +90,7 @@ ${u}`,this.dataLineCount++;return}if(Su(t,s,c1)){d1(t,i)&&(this.setEventFieldSiz
|
|
|
90
90
|
`)){let n=t.trim();if(n)try{let r=JSON.parse(n);if(r.type==="system"&&r.subtype==="init"&&Array.isArray(r.mcp_servers))return Object.fromEntries(r.mcp_servers.filter(s=>typeof s.name=="string").map(s=>[s.name,typeof s.status=="string"?s.status:"unknown"]))}catch{}}return{}}o(sH,"mcpServerStatuses");function Yv(e){let t=sH(e).skyramp;return t===void 0||t==="connected"}o(Yv,"skyrampConnected");function iH(e){if(!Ks.existsSync(e))return[];let t=[];for(let n of Ks.readFileSync(e,"utf-8").split(`
|
|
91
91
|
`)){let r=n.trim();if(!r)continue;let s;try{s=JSON.parse(r)}catch{continue}let i=s.message?.content;Array.isArray(i)&&t.push(...i)}return t}o(iH,"contentBlocks");var El=(s=>(s.RestApi="rest-api",s.Frontend="frontend",s.FullStack="full-stack",s.Other="other",s))(El||{}),Zs=(s=>(s.Critical="critical",s.High="high",s.Medium="medium",s.Low="low",s))(Zs||{}),Xs=(r=>(r.Suspected="suspected",r.Latent="latent",r.Refuted="refuted",r))(Xs||{}),Pf=(r=>(r.Skyramp="skyramp",r.External="external",r.Unknown="unknown",r))(Pf||{}),Of=(s=>(s.Cascade="cascade",s.Restrict="restrict",s.Orphan="orphan",s.Unknown="unknown",s))(Of||{}),lr=(s=>(s.RequirementReference="requirement-reference",s.Spec="spec",s.PrDescription="pr-description",s.CouldBreak="could-break",s))(lr||{}),Te=c.string().trim().min(1),Bo=Te.describe("file:line"),jv=o(e=>Te.refine(t=>t.length<=400,t=>({message:`is ${t.length} characters, over the 400 cap \u2014 ${e}`})),"cap400"),mc=Te.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'),$f=c.object({method:Te,path:Te,service:c.string().optional(),evidence:Bo,repository:mc}),oH=c.object({id:Te.describe("short-slug, e.g. R9"),statement:Te.max(400,"exceeds 400 characters \u2014 state the requirement, do not paste the spec section").describe("a testable obligation, not a summary"),source:c.nativeEnum(lr).describe("spec outranks pr-description when both state it"),evidence:Te.describe("spec: file:line or a section locator. pr-description: the quoted phrase it comes from.")}),aH=c.object({id:Te.describe("short-slug"),statement:Te.max(400,"exceeds 400 characters \u2014 state the behaviour, do not paste the code").describe("what the change makes true"),surface:Te.describe("METHOD /path, or a component/page name"),evidence:Te.describe("file:line from the diff that introduces it"),repository:mc,satisfies:c.array(Te).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)")}),cH=c.object({id:Te.describe("short-slug"),file:Te,line:c.number().optional(),claim:jv("shorten it to the one sentence that states the defect, and move the supporting detail into `evidence`"),severity:c.nativeEnum(Zs),evidence:jv("cite the file:line and the one line that shows it, rather than reproducing the surrounding code").describe("quoted diff/code line"),status:c.nativeEnum(Xs),repository:mc,conflictsWith:c.array(Te).optional().describe("requirement ids (from `requirements`) this defect contradicts or leaves unimplemented \u2014 a lower-precedence source (the diff, or the PR description) lost")}),AH=c.object({name:Te,language:c.string().optional(),framework:c.string().optional(),evidence:Bo,repository:mc}),uH=c.object({dir:Te,framework:c.string().optional(),kind:c.nativeEnum(Pf),evidence:Bo,repository:mc}),lH=c.object({from:Te,to:Te,onDelete:c.nativeEnum(Of),evidence:Bo}),dH=c.object({entity:Te,field:Te,values:c.array(c.string()),evidence:Bo}),pH=c.object({entities:c.array(c.object({name:Te,evidence:Bo})),references:c.array(lH).describe("INBOUND references \u2014 what still points at an entity when it is deleted"),stateFields:c.array(dH)}),Gf=c.object({schemaVersion:c.literal(1),repository:c.object({path:Te.describe("absolute repo path"),currentBranch:Te,baseBranch:Te}),project:c.object({type:c.nativeEnum(El),primaryLanguage:Te,languages:c.array(c.string()),frameworks:c.array(c.string())}),services:c.array(AH),infrastructure:c.object({containerized:c.boolean(),hasDockerCompose:c.boolean(),composeFiles:c.array(c.string()),hasCiCd:c.boolean()}),diff:c.object({changedFiles:c.array(c.string()).describe("as git reports them; a file in another checkout may carry that repo's name"),nonApplicationOnly:c.boolean(),summary:Te.describe("\u2264400 chars")}),endpoints:c.object({new:c.array($f),modified:c.array($f),removed:c.array($f)}),existingTests:c.object({locations:c.array(uH)}),entityMap:pH,requirements:c.array(oH).describe("from a spec (attached or linked) and/or the PR description; empty when neither states a testable obligation"),behaviors:c.array(aH),findings:c.array(cH),unexamined:c.array(c.string()).describe("files or areas outside this change you did not open"),summary:Te.describe("one paragraph on what this change does and its test-relevant risk")});var mH=c.object({route:c.string().describe('the page this step happens on, e.g. "/products/:id"'),action:c.string().describe('what the user does there, through the UI, e.g. "clicks Add to cart"'),clauses:c.array(c.string()).optional().describe("the plan clause ids this step exercises"),check:c.string().optional().describe("what the user then sees that shows the step worked; the test asserts it")}),Ec=(n=>(n.InProcess="in-process",n.Browser="browser",n))(Ec||{}),Wv=(r=>(r.Spec="spec",r.PrDescription="pr-description",r.Inferred="inferred",r))(Wv||{}),zv=c.object({id:c.string().describe('e.g. "J1"'),name:c.string().describe(`the flow in a user's words, e.g. "buy a product with a coupon"`),entry:c.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:c.array(mH).describe("every step, in order, from the entry page to the outcome: at least two"),outcome:c.string().describe("what the user sees at the end that shows the flow worked: every part of it"),finishes:c.string().optional().describe('the user action that completes the task, verb first, e.g. "places the order"; the journey walks on to it'),kind:c.nativeEnum(Ec).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:c.nativeEnum(Wv).optional().describe("spec or pr-description when one describes this flow (quote it under evidence), else inferred"),evidence:c.string().optional().describe("for spec or pr-description: its words that describe the flow"),testFile:c.string().describe("the browser test file it goes in, beside the repo's existing e2e tests")}),yl=c.object({journey:c.string().describe("the plan's journey id"),file:c.string().describe("the browser test file that walks it"),brokeAt:c.object({step:c.number().int().describe("the 1-based step whose check failed first"),expected:c.string(),actual:c.string().describe("what the app did instead, from the runner's output"),notReached:c.array(c.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:c.string().describe("the title of the one test in that file that walks it end to end")});var y5=["stale_test","open_question"],C5=["low","medium","high","critical"];var Cl=(n=>(n.Skyramp="skyramp",n.Llm="llm",n))(Cl||{}),dr=c.string().trim().min(1),EH=c.object({case:dr.describe("recommend id this assertion enforces"),evidence:dr.describe("the exact assertion line from the file that checks that case's observable")}),Vf=c.object({kind:c.nativeEnum(Zu).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:dr.describe("the dependency, endpoint or data it affects"),mechanism:c.nativeEnum(Xu).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:dr.describe("what it sets up"),worker:dr.optional().describe("skyramp_mocker: host:port of the worker the test applies the mock to (default localhost:35142)"),cleanup:dr.optional().describe("seed: a command, without a shell, that removes the data when the test does not")}),yH=c.object({file:dr.describe("staged path under .skyramp/staged/"),source:c.nativeEnum(Cl),language:dr,covers:c.array(c.string()).min(1,"must be a non-empty array of recommend ids").describe("recommend ids this test covers"),assertions:c.array(EH).min(1,"must be a non-empty array").describe("one per case covered, citing the real line"),context:c.array(Vf).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")}),qf=c.object({schemaVersion:c.literal(1),tests:c.array(yH),deferredUi:c.array(c.string()).describe("recommend ui ids left for the UI stage (generate) \u2014 [] for generate-ui"),summary:dr.describe("one paragraph")});var pr=c.string().trim().min(1),yc=72,CH=c.object({repository:pr.optional().describe("owner/repo of the checkout this lint ran in, when the run has several; omit for the working checkout"),tool:c.string(),command:c.string().describe("the exact command you ran, scoped to the changed files"),clean:c.boolean(),fixed:c.array(c.string()).optional().describe("files you fixed"),uncovered:c.array(c.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.")}),x5=c.object({schemaVersion:c.literal(1),lint:c.array(CH).min(1).describe("one entry per checkout this run wrote tests in, each run from that checkout"),fileConventions:c.object({ok:c.boolean(),notes:c.string().optional()}),ciReadiness:c.object({covered:c.boolean().describe("will the repo's CI run these tests?"),notes:c.string().optional()}),dependencies:c.object({added:c.array(c.object({package:c.string(),manifest:c.string(),repository:pr.optional().describe("owner/repo of the manifest's checkout; omit for the working checkout"),reason:pr.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:c.array(c.object({file:pr,repository:pr.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:c.object({message:pr.refine(e=>e.split(`
|
|
92
92
|
`)[0].length<=yc,{message:`subject line must be <= ${yc} chars`})}),pr:c.object({title:pr.max(yc,`must be <= ${yc} chars`),body:pr}),ready:c.boolean().describe("a statement of fact: true only if the tests are fit to commit as they stand"),blockers:c.array(c.string()).describe("what blocks the commit \u2014 required non-empty when ready is false"),summary:pr.describe("one paragraph")});var Wr=ke(require("fs")),bo=ke(require("path")),Xv=require("child_process");var Cn="{junit}",Il=(r=>(r.Junit="junit",r.Trx="trx",r.GoTestJson="go-test-json",r))(Il||{}),Hf=(t=>(t.Minitest="minitest",t))(Hf||{}),Kv=c.string().trim().min(1),Qo=c.object({cwd:Kv.describe('repo-relative directory the command starts in ("." for the root)'),argv:c.array(Kv).min(1).describe(`the command as separate arguments, run without a shell; for a junit or trx report an argument or env value holds ${Cn}, where the report is written (not for Maven or Gradle, whose build writes its own)`),env:c.record(c.string(),c.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:c.object({format:c.nativeEnum(Il).describe(`junit (JUnit XML to ${Cn}), trx (to ${Cn}), or go-test-json (go test -json on the command's output)`),reporter:c.nativeEnum(Hf).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 wo="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)",F5=`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 ${Cn} in the reporter's argument or env setting), trx (a TRX file to ${Cn}, 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 ${Cn}: 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 ${Cn} itself. A setting the tests or reporter read goes in "env" (RAILS_ENV=test, or PLAYWRIGHT_JUNIT_OUTPUT_FILE=${Cn} with playwright test --reporter=junit): the run sets it, so never wrap the command in a shell to set one. The run replaces ${Cn} in argv and env with its report path, executes the command, and reads that report.`;var ei=(s=>(s.ExistingEvidenceSufficient="existing_evidence_sufficient",s.TargetedUnit="targeted_unit",s.RuntimeRequired="runtime_required",s.BlockedPreflight="blocked_preflight",s))(ei||{}),jr=(i=>(i.ExistingEvidence="existing_evidence",i.Unaffected="unaffected",i.ExistingUnit="existing_unit",i.NewUnit="new_unit",i.Runtime="runtime",i))(jr||{}),Jf=(n=>(n.Repository="repository",n.Testbot="testbot",n))(Jf||{}),Yf=(r=>(r.Identified="identified",r.Passed="passed",r.Failed="failed",r))(Yf||{}),St=c.string().trim().min(1),IH=c.string().regex(/^[a-z0-9][a-z0-9-]*$/,"must be a short lowercase slug").describe("short-slug");var BH=c.object({id:IH,source:c.nativeEnum(Jf),kind:c.nativeEnum(Gr),outcome:c.nativeEnum(Yf),summary:St.max(400).describe("one line: what it shows"),tests:c.array(St).optional().describe("source repository: the existing tests, as repo-relative paths, optionally path::test-name"),repository:St.optional().describe("source repository: owner/repo the tests live in, when the run has several checkouts; omit for the working checkout"),command:St.optional().describe("source testbot: the exact command you ran, as you ran it"),run:Qo.optional().describe(`source repository, for tests in ${wo}: 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`)}),QH=c.object({behaviorId:St.describe("an id from analyze's behaviors"),mechanism:c.nativeEnum(jr),evidenceIds:c.array(St).default([]).describe("existing_evidence: the ci-<n> or evidence ids that establish it; existing_unit: the evidence id naming the tests to run"),covers:c.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')}),jf=(r=>(r.Browser="browser",r.RunningApp="running-app",r.Outside="outside",r))(jf||{}),wH=c.object({behaviorId:c.string().trim().optional().describe("an id from analyze's behaviors, when it is about one"),missing:St.max(600).describe("the evidence that is required and cannot be obtained in this run"),needs:c.nativeEnum(jf).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)")}),bH=c.object({file:St.describe("the changed file the failure is in"),repository:St.optional().describe("owner/repo the file is in, when the run has several checkouts; omit for the working checkout"),reason:St.max(300).describe("what prerequisite the change fails"),evidence:St.max(400).describe("the error line, quoted")}),RH=c.object({behaviorId:St.describe("an id from analyze's behaviors"),reason:St.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)")}),Cc=c.object({schemaVersion:c.literal(1),decision:c.nativeEnum(ei),evidence:c.array(BH).describe("evidence this session found or produced; CI results are the ci-<n> items and are not restated here"),plan:c.array(QH).describe("how each changed behavior's evidence is obtained"),gaps:c.array(wH),outOfScope:c.array(RH).optional().describe("behaviors analyze found that this change neither changes nor states"),blocked:bH.optional().describe("only for blocked_preflight"),rationale:St.max(1200).describe("\u22641200 characters: why this evidence is enough, or what it still lacks \u2014 the scope you chose and why")});function Bl(e){let t=Oe(e,"recommend.json");if(!t||!Array.isArray(t.generate)||!Array.isArray(t.maintenance))return;let n=t;return{...n,maintenance:n.maintenance.map(({repository:r,...s})=>({...s,test:s.test.trim().replace(/^\.\//,""),...r?.trim()?{repository:r.trim()}:{}}))}}o(Bl,"readRecommend");function xH(e){return Vt(qf,e).errors}o(xH,"validateGenerateOutput");function TH(e,t=[]){let{value:n,error:r}=ot(e,t);if(r)return{errors:[r]};let s=xH(n);return s.length>0?{errors:s}:{generate:n,errors:[]}}o(TH,"parseGenerateText");function Ql(e,t=[]){return TH(e.stdout,t)}o(Ql,"parseGenerateFromSession");function DH(e){return e.generate.filter(t=>t.type!=="ui").map(t=>t.id)}o(DH,"backendCases");function eS(e){return e.generate.filter(t=>t.type==="ui").map(t=>t.id)}o(eS,"uiCases");var wl={backend:{stage:"generate",cases:DH,noRecommendCoverage:"recommend.json missing or malformed \u2014 cannot check coverage",noRecommendIntent:"recommend.json missing or malformed \u2014 cannot check intent",uncovered:o(e=>`recommend case "${e}" is not covered by any generated test`,"uncovered"),unknownCovered:o(e=>`test covers unknown recommend id "${e}"`,"unknownCovered"),unasserted:o(e=>`case "${e}" has no verified assertion enforcing its expected_observable`,"unasserted"),usedCodegen:Hv,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:eS,noRecommendCoverage:"recommend.json not found \u2014 cannot check UI coverage",noRecommendIntent:"recommend.json not found \u2014 cannot check UI intent",uncovered:o(e=>`UI case "${e}" is not covered by any generated UI test`,"uncovered"),unknownCovered:o(e=>`test covers "${e}" which is not a recommend UI case`,"unknownCovered"),unasserted:o(e=>`UI case "${e}" has no verified assertion enforcing its expected_observable`,"unasserted"),usedCodegen:Jv,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."}},fX=rn("generate-schema",(e,t)=>Ql(t,e.secretValues));function NH(e){let t=wl[e];return{name:`${t.stage}-coverage`,verify(n,r){let{generate:s,errors:i}=Ql(r,n.secretValues);if(!s)return lt(this.name,i);let a=Bl(n);if(!a)return lt(this.name,[t.noRecommendCoverage]);let A=new Set(s.tests.flatMap(g=>g.covers)),u=[],d=t.cases(a);for(let g of d)A.has(g)||u.push(t.uncovered(g));let p=new Set(e==="ui"?d:a.generate.map(g=>g.id));for(let g of A)p.has(g)||u.push(t.unknownCovered(g));if(e==="backend"){let g=new Set(s.deferredUi),f=new Set(eS(a));for(let m of f)!g.has(m)&&!A.has(m)&&u.push(`UI case "${m}" is neither covered nor deferred to the UI stage`);for(let m of g)f.has(m)||u.push(`deferredUi lists "${m}" which is not a UI case`)}return u.length===0?{name:this.name,passed:!0}:lt(this.name,u)}}}o(NH,"generateCoverageGateFor");function FH(e){let t=wl[e];return{name:`${t.stage}-intent`,verify(n,r){let{generate:s,errors:i}=Ql(r,n.secretValues);if(!s)return lt(this.name,i);let a=Bl(n);if(!a)return lt(this.name,[t.noRecommendIntent]);let{asserted:A,errors:u,badFiles:d}=OH(s,n.inputs.repositoryPath),p=u.length;for(let f of t.cases(a))A.has(f)||u.push(t.unasserted(f));if(u.length===0)return{name:this.name,passed:!0};let g=lt(this.name,u);return p>0&&p===u.length&&d.size>0?{...g,droppable:[...d]}:g}}}o(FH,"generateIntentGateFor");function MH(e){let t=wl[e];return n=>{if(!n.inputs.skyrampMcp?.command||e==="backend"&&!Mf(n))return;let r=bo.join(n.outputsDir,`${t.stage}-stream.ndjson`);if(!(!Wr.existsSync(r)||t.usedCodegen(r)))return Yv(r)?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."}}o(MH,"codegenRetryHintFor");var mX=NH("backend"),EX=FH("backend"),yX=MH("backend");var Zv=o(e=>e.replace(/\s+/g,""),"squeeze");var Wf={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"]])Wf[e]=Wf[t];function UH(e,t){if(e.includes(ac(t))||Zv(e).includes(Zv(t)))return!0;let n=t.split(/\r?\n/).map(r=>r.trim()).filter(r=>r&&!/^(\/\/|#|\*|\/\*)/.test(r));return n.length>0&&n.every(r=>e.includes(ac(r)))?!0:PH(e,t)}o(UH,"evidenceFound");var LH=/\bassert\w*\b|\bexpect\s*\(|\.should\b|\brequire\s*\(/i,_H=12,$H=/,\s*\(\s*#|,\s*f?["'`]|\s+#\s|\s+\/\/|\s*\((?:line|lines|at line)\b|\s*,\s*$/i;function PH(e,t){let n=t.split(/\s*;\s*|\s*\.\.\.\s*|\r?\n/),r=0;for(let s of n){let i=LH.exec(s);if(!i)continue;let a=s.slice(i.index),A=$H.exec(a);if(A&&(a=a.slice(0,A.index)),a=ac(a).replace(/[,\s]+$/,""),a.length<_H||!e.includes(a))return!1;r++}return r>0}o(PH,"annotatedAssertionFound");function OH(e,t){let n=new Set,r=[],s=new Set;for(let i of e.tests){let a=bo.resolve(t,i.file);if(!Wr.existsSync(a))continue;let A=ac(Wr.readFileSync(a,"utf-8"));for(let u of i.assertions??[]){if(!UH(A,u.evidence)){r.push(`assertion evidence for "${u.case}" not found in ${i.file} \u2014 cite the real assertion line`),s.add(i.file);continue}i.covers.includes(u.case)?n.add(u.case):(r.push(`assertion cites case "${u.case}" not in that test's covers[]`),s.add(i.file))}}return{asserted:n,errors:r,badFiles:s}}o(OH,"verifiedAssertions");var GH=/\.(spec|test)\.[cm]?[jt]sx?$/i;function tS(e){let t;try{t=(0,Xv.execFileSync)("git",[...Ws,"status","--porcelain","--untracked-files=all"],{env:sn(),cwd:e,encoding:"utf-8",stdio:["ignore","pipe","ignore"]})}catch{return}let n=o(s=>/_scaffold/i.test(s)||pl.test(s),"isTestLitter"),r=[];for(let s of t.split(`
|
|
93
|
-
`)){if(!s.trim()||s.length>1&&s[1]==="D")continue;let i=s.slice(3).trim(),a=i.indexOf(" -> ");if(a!==-1&&(i=i.slice(a+4).trim()),i=i.replace(/^"|"$/g,""),!i)continue;let A=i.replace(/^\.\//,"");A.startsWith(".skyramp/")||!n(A)||r.push(A)}return r}o(tS,"testLitter");function VH(e){let t=wl[e],n=e==="ui";return{name:`${t.stage}-no-litter`,verify(r){let s=tS(r.inputs.repositoryPath);if(s===void 0)return{name:this.name,passed:!0};let i=s.filter(a=>GH.test(a)===n);return i.length===0?{name:this.name,passed:!0}:lt(this.name,[`${t.stage} left files outside .skyramp/ \u2014 move the staged test into .skyramp/staged/ and delete any codegen draft (e.g. *_scaffold.*): ${i.slice(0,6).join(", ")}`])}}}o(VH,"noLitterGateFor");var CX=VH("backend");var Ic=ke(require("fs")),ti=ke(require("path"));function rS(e){return Vt(Lf,e).errors}o(rS,"validateAdaptOutput");function JH(e,t=[]){let{value:n,error:r}=ot(e,t);if(r)return{errors:[r]};let s=rS(n);return s.length>0?{errors:s}:{adapt:n,errors:[]}}o(JH,"parseAdaptText");var YH="adapt-scratch",nS=`${YH}/adapt-result.json`;function sS(e,t){let n=ti.join(e.outputsDir,nS),r;try{r=Ic.readFileSync(n,"utf-8")}catch{r=void 0}if(r!==void 0&&(e.secretValues??[]).some(a=>r.includes(a)))return{errors:[`${nS} contains a secret value (token / credential) \u2014 never write it anywhere`]};let s=JH(t.stdout,e.secretValues);if(s.adapt)return s;let i=r!==void 0?Ys(n):void 0;return i!==void 0&&rS(i).length===0?{adapt:i,errors:[]}:s}o(sS,"parseAdaptFromSession");var VX=rn("adapt-schema",sS);var iS=require("child_process");function oS(e){let t;try{t=(0,iS.execFileSync)("git",[...Ws,"status","--porcelain","-z","--untracked-files=all"],{env:sn(),cwd:e,encoding:"utf-8",maxBuffer:16*1024*1024})}catch{return[]}let n=t.split("\0"),r=[];for(let s=0;s<n.length;s++){let i=n[s];if(i.length<4)continue;let a=i.slice(0,2);r.push({code:a,path:i.slice(3)}),(a[0]==="R"||a[0]==="C")&&s++}return r}o(oS,"statusEntries");var XX=2*1024*1024;var bl=c.string().trim().min(1),jH=c.object({cwd:bl.describe(`directory the command starts in, relative to the test's checkout ("." for its root)`),argv:c.array(bl).min(1).describe("the command as separate arguments, run without a shell"),env:c.record(c.string(),c.string()).optional().describe("plain settings the listing needs beyond the CI step's own; never a credential or PATH")}),WH=c.object({file:bl.describe("a file of the test's checkout, relative to its root"),line:bl.describe("a line of that file, quoted exactly from where its command starts to its end")}),aS=c.object({collected:c.boolean().describe("whether the repo's CI runs this test as it is"),steps:c.array(WH).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:c.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:jH.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:c.string().optional().describe("when not collected: why the repo's CI will not run it")});var ae=c.string().trim().min(1),eJ=o(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"),tJ=c.preprocess(eJ,c.object({id:ae.describe(`its requirement's id plus a letter, e.g. "R1a", "AC-3a"`),clause:ae.describe("one testable part of the requirement"),expected:ae.describe("the outcome the requirement calls for \u2014 taken from the requirement, never from what the code does"),skip:c.string().optional().describe("only when no test can check this clause here: why"),type:c.nativeEnum(Hr).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:c.string().optional().describe('its "METHOD /path", or the page / flow'),steps:c.string().optional().describe("what that test does; its expected outcome is this clause's"),finding:c.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:c.string().optional().describe("path:line of the code that decides this clause, when there is one"),mutates:c.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:c.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:c.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)")})),cS=c.object({spec:c.string().optional().describe("file:line of a spec in the repository"),prDescription:c.boolean().optional().describe("or true when a pull request description says otherwise"),reference:c.string().optional().describe("or the key of an item the run was given, as listed"),says:ae.describe("what it says there, in its own words, copied exactly"),criterion:c.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`}),nJ=c.object({id:ae.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:ae,source:c.nativeEnum(lr).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:c.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:ae.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:c.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:c.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:c.array(cS).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:c.array(tJ)}),AS=(s=>(s.ServerError="server-error",s.DataLost="data-lost",s.FinalState="final-state",s.DerivedValues="derived-values",s))(AS||{}),rJ=c.object({id:ae.describe('e.g. "F1"'),file:ae,line:c.number().optional(),claim:ae.describe("the defect, in one sentence"),severity:c.nativeEnum(Zs),evidence:ae.describe("the code line, or the probe request and response, that shows it"),conflictsWith:c.array(ae).optional().describe("requirement or clause ids it violates"),keeps:c.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:c.nativeEnum(AS).optional().describe("for a defect that breaks a rule every app keeps, which nothing needs to state: which one"),existing:c.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:c.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)")}),sJ=c.object({id:ae.describe('e.g. "Q1"'),question:ae.describe("what is unsettled, as a question the PR author can answer"),readings:c.array(ae).min(2).describe("each reasonable behaviour, with what points to it (file:line, or the words that suggest it)"),about:c.string().optional().describe("the requirement or clause id it is about, when there is one"),sources:c.array(cS).optional().describe("when sources of the same rank disagree on it: each of them")}),iJ=c.object({id:ae.describe('unique, a short kebab-case name for what the case checks, e.g. "ship-twice-409"'),type:c.nativeEnum(Hr).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:ae.describe('"METHOD /path", or the page / flow'),clause:c.string().optional().describe("the clause id this case checks"),finding:c.string().optional().describe("the finding id this case catches"),steps:ae.describe("what the test does"),expected:ae.describe("the expected outcome, from the clause"),mutates:c.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")}),oJ=c.object({test:ae.describe("existing test file"),action:c.nativeEnum(Jr),reason:ae,mutates:c.boolean().optional().describe("true when the maintained test changes state"),clauses:c.array(ae).optional().describe("the clause ids this test checks")}),aJ=c.object({outcome:c.nativeEnum(or).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:c.record(c.string()).optional().describe("service \u2192 base URL of the running app"),health:c.object({url:c.string().optional(),command:c.string().optional(),output:c.string().optional()}).optional().describe("the check that shows the app serves real data, and what it returned"),teardown:c.string().optional().describe("command that stops the app"),dependencies:c.record(c.boolean()).optional().describe("every backing service: true = really running, false = mocked"),recipeFixes:c.array(c.string()).optional().describe("what you changed in the recipe"),error:c.string().optional().describe("when it did not come up: the failing command and what it printed"),suspectFiles:c.array(c.string()).optional().describe("change-broke-bringup: the changed files to blame"),login:c.object({username:ae,password:c.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:Fh.optional()}),D6=c.object({schemaVersion:c.literal(1),requirements:c.array(nJ),findings:c.array(rJ),cases:c.array(iJ).describe("a second test for a clause, and one case per finding that fails on this branch"),questions:c.array(sJ).optional().describe("behaviours the change leaves unsettled; no case asserts any of them"),maintenance:c.array(oJ),journeys:c.array(zv).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:c.array(c.object({clause:ae,why:ae})).optional().describe("a clause a user sees or does that no journey can reach through the UI, and why"),triage:Cc.optional().describe("the validation triage decision, made before the app is started; its behaviorIds are clause ids"),app:aJ.optional().describe("omit when no app was needed or none was started"),summary:ae.describe("one paragraph: what the change does and where the risk is")});var uS=(n=>(n.Backend="backend",n.Ui="ui",n))(uS||{});var Rl=(s=>(s.Added="added",s.Updated="updated",s.Deleted="deleted",s.Unchanged="unchanged",s))(Rl||{}),cJ=c.object({file:ae.describe("repo-relative path; in another repo of the change, that repo's directory name then its path"),kind:c.nativeEnum(uS),change:c.nativeEnum(Rl).describe("added: a file you created; updated / deleted / unchanged: an existing test"),covers:c.array(c.string()).describe("the plan case ids this file tests"),defect:c.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:c.object({requirement:ae.describe("the requirement or clause id the change deliberately alters"),line:ae.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:c.object({exit:c.number().nullable().describe("exit code of your last run of this file; null if it could not be run"),cases:c.array(c.object({case:ae,status:c.nativeEnum(an),defect:c.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:c.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:c.string().optional().describe("for a case you keep as a defect: path:line of the application code that makes it fail"),requires:c.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:c.string().optional().describe("what failed and why, or why it was not run")}),assertions:c.array(c.object({case:ae,evidence:ae})).optional().describe("per covered case, the assertion line that checks its expected outcome"),functions:c.array(c.object({name:ae.describe("the test function as the runner names it within its file, without the file (test_x, TestClass::test_x, TestSuite/TestCase)"),cases:c.array(ae).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:c.object({draft:c.union([c.string(),c.array(c.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:c.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:c.array(Vf).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:ae.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:aS.optional().describe("for a file you added or updated: whether the repo's CI will run it, and how you know"),run:Qo.optional().describe(`for a file in ${wo}, 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 ${Cn}, or go-test-json); Testbot runs it before write ends and re-runs the tests with it`)}),AJ=o(e=>{if(!e||typeof e!="object")return e;let{test:t,...n}=e;return typeof t=="string"&&t.trim()&&n.tests===void 0?{...n,tests:[t]}:e},"oneTestIsTests"),uJ=c.preprocess(AJ,c.object({description:ae.describe("what is wrong and how to reproduce it: endpoint or page, input, what you got vs what was expected"),severity:c.nativeEnum(Zs).optional(),sourceFile:c.string().optional().describe("the app file at fault"),sourceLine:c.number().optional(),tests:c.array(ae).optional().describe("every test file that fails because of it: a defect several tests show is one issue"),finding:c.string().optional().describe("the plan's finding id, when it is one"),requirements:c.array(ae).optional().describe("the plan's requirement or clause ids it violates")})),N6=c.object({schemaVersion:c.literal(1),tests:c.array(cJ),notWritten:c.array(c.object({case:ae,reason:ae})).describe("every plan case no test covers, and why"),journeys:c.array(yl).optional().describe("one entry per planned user journey: the browser test that walks it end to end"),lint:c.object({command:c.string(),clean:c.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:c.array(c.object({package:ae,manifest:ae.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:ae.optional().describe("owner/repo of the manifest's checkout; omit for the repo under test"),reason:ae.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:c.array(ae).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:c.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:c.object({message:ae.describe('"Skyramp Testbot: \u2026", subject line at most 72 characters'),prTitle:ae.describe("at most 72 characters"),prBody:ae.describe("what the tests cover and what they found")}),report:c.object({summary:ae.describe("1-2 sentences for the PR author: does the change do what it says?"),issues:c.array(uJ).describe("every defect the tests found"),nextSteps:c.array(c.string())})});var F6={added:"place",updated:"update",deleted:"delete",unchanged:"verify"};var dS=(r=>(r.Requirement="requirement",r.PrDescription="pr_description",r.Code="code",r))(dS||{}),at=c.string().trim().min(1),lJ=c.object({expectation:at.max(300).describe("the behavior this assertion pins, in words"),source:c.nativeEnum(dS),expected:at.max(200).describe("the exact value or outcome asserted, as the test asserts it")}),dJ=c.object({file:at.describe("path of the NEW test file you wrote, relative to its repository"),repository:at.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),framework:at.describe("the framework the repository runs this file with: pytest, jest, vitest, node-test, or the name of any other"),run:Qo.optional().describe(`for ${wo}: how the run executes only the tests in names, with the repository's own runner writing JUnit XML to {junit}`),covers:c.array(at).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:c.array(at).min(1).describe("the test functions/cases in the file that provide evidence for that behavior, as the framework names them"),assertions:c.array(lJ).min(1)}),kl=(n=>(n.Updated="updated",n.Deleted="deleted",n))(kl||{}),lS=300,pJ=c.object({file:at.describe("path of the EXISTING test file you updated or deleted, relative to its repository"),repository:at.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),change:c.nativeEnum(kl),staleBecause:c.object({requirement:at.describe("the requirement or clause id the change deliberately alters"),line:at.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:c.preprocess(e=>typeof e=="string"?e.trim().slice(0,lS):e,at.max(lS)).describe("what the change deliberately altered that made the test wrong")}),Kf=c.object({schemaVersion:c.literal(1),tests:c.array(dJ),maintained:c.array(pJ).optional().describe("existing tests the change made stale that you updated or deleted; omit when there were none"),defectsNotTested:c.array(c.object({id:at,reason:at.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:c.array(yl).optional().describe("one entry per planned user journey: the in-process test that walks it end to end"),journeysNotWritten:c.array(c.object({journey:at,missing:at.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:c.object({command:c.string(),clean:c.boolean()}).optional().describe("the linter/formatter you ran on your test files, if the repository has one you can run; omit otherwise"),commitMessage:at.optional().describe("the commit message for your tests: a subject line of at most 72 characters, then what they cover")});var Sl="generate-unit.json";function fJ(e){let{value:t,error:n}=ot(e);if(n)return{errors:[n]};let{value:r,errors:s}=Vt(Kf,t);return s.length?{errors:s}:{output:r,errors:[]}}o(fJ,"parseGenerateUnitText");function mJ(e){return fJ(e.stdout)}o(mJ,"parseGenerateUnitFromSession");var B7=rn("generate-unit-schema",(e,t)=>mJ(t));var vl=String.raw`(?:node:)?(?:http|https|http2|net|tls|dgram)`,Q7=[[/\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+["']${vl}["']|\bimport\s+["']${vl}["']|require\(\s*["']${vl}["']\s*\)|\bimport\(\s*["']${vl}["']\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 q7=new Set(["targeted_unit","existing_evidence_sufficient"]);var IJ="triage.json",Dee=new Set(["existing_evidence","unaffected","existing_unit","new_unit","runtime"]),Nee={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 BJ(e){let{value:t,error:n}=ot(e);if(n)return{errors:[n]};let{value:r,errors:s}=Vt(Cc,t);return s.length?{errors:s}:{triage:r,errors:[]}}o(BJ,"parseTriageText");function QJ(e){return BJ(e.stdout)}o(QJ,"parseTriageFromSession");var Fee=rn("triage-schema",(e,t)=>QJ(t));function wJ(e){let t=e.inputs?.pipeline;return t?e.state.stages[t==="two-step"?"plan":"triage"]:e.state.stages.triage??e.state.stages.plan}o(wJ,"triageDecider");function Zf(e){if(wJ(e)?.status==="passed")return Ys(hS.join(e.outputsDir,IJ))}o(Zf,"readTriage");function Xf(e){return Fk(ef(e.inputs,Oe(e,`${dc}.json`),Zf(e)?.sutRequired))}o(Xf,"revisionBlockReason");var Mee=new Set(["deploy","recommend","generate","generate-ui","adapt","generate-unit","native-run","finalize","deliver"]);var Xr=ke(require("fs")),Zr=ke(require("path")),HS=require("child_process"),Fl=require("crypto");var qee=[...zh,"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 ete=process.env.RUNNER_TOOL_CACHE||"/opt/hostedtoolcache";var pte={jest:"jest",vitest:"vitest"};var sne=5*6e4;function RJ(e){return Vt(Gf,e).errors}o(RJ,"validateAnalysisOutput");function ES(e,t=[]){let{value:n,error:r}=ot(e,t);if(r)return{errors:[r]};let s=RJ(n);return s.length>0?{errors:s}:{analysis:n,errors:[]}}o(ES,"parseAnalysisText");function kJ(e,t=[]){return ES(e.stdout,t)}o(kJ,"parseAnalysisFromSession");var kne=rn("analysis-schema",(e,t)=>kJ(t,e.secretValues));var yre=_u.rows.notRun(!0);var Bc="kept, not ",Qc="(declined the planned ";function em(e){if(!e)return[];let t=[],n=0,r=0;for(let s=0;s<e.length;s++){let i=e[s];i==="("?n++:i===")"?n=Math.max(0,n-1):n===0&&i===";"&&e[s+1]===" "&&e[s-1]===")"&&(t.push(e.slice(r,s)),r=s+2)}return t.push(e.slice(r)),t.map(s=>{let i=s.trim();if(!i.endsWith(")"))return{expectation:i};let a=0;for(let A=i.length-1;A>=0;A--)if(i[A]===")")a++;else if(i[A]==="("&&--a===0){let u=i.slice(0,A).trim(),d=i.slice(A+1,-1).trim();return u&&d?{expectation:u,expected:d}:{expectation:i}}return{expectation:i}})}o(em,"assertionParts");var yS=new Set(["update","regenerate","delete"]);var Cre={update:"updated",regenerate:"regenerated",delete:"deleted",verify:"verified",none:"touched"};var CS=c.string().trim().min(1),tm=c.object({schemaVersion:c.literal(1).optional(),businessCaseAnalysis:CS.describe("1-2 sentences: what this change means for a user, and whether the evidence shows it working"),issuesFound:c.array(c.object({description:CS,severity:c.string().optional().describe("critical | high | medium | low"),category:c.string().optional().describe("bug | lint | type | config"),sourceFile:c.string().optional(),sourceLine:c.number().optional(),findingId:c.string().optional(),requirementIds:c.array(c.string()).optional()})).describe("every real problem this run exposed \u2014 cause, file:line, severity"),nextSteps:c.array(c.string()).describe("concrete follow-ups the author can act on; required non-empty when a disclosure is BLOCKING")});function xJ(e){return Vt(tm,e).errors}o(xJ,"validateProseOutput");function TJ(e,t=[]){let{value:n,error:r}=ot(e.stdout,t);if(r)return{errors:[r]};let s=xJ(n);return s.length>0?{errors:s}:{prose:n,errors:[]}}o(TJ,"parseProseFromSession");var Fre=rn("report-schema",(e,t)=>TJ(t,e.secretValues));var DJ="<!-- skyramp-testbot -->",IS=yS,NJ=new Set(["lint","type","config"]),BS={critical:0,high:1,medium:2,low:3},vS=new Set(["Pass","Fail"]);var rm=o(e=>vs(ee().statusLabels,e),"statusLabel"),nm=o(e=>vs(ee().testTypeCellLabels,e),"testTypeLabel");function Qe(e){return(e??"").replace(/\|/g,"\\|").replace(/\r?\n/g,"<br>").trim()}o(Qe,"escCell");function QS(e,t){return!e||!vS.has(e)?"\u2014":t?`${rm(e)} (${Qe(SS(t))})`:rm(e)}o(QS,"maintStatus");function SS(e){let t=o(r=>{let s=r.indexOf(": ");return s<0?r:vs(ee().staged.maintenanceActions,r.slice(0,s))+r.slice(s)},"action");if(e.startsWith(Bc))return ee().staged.keptNot+t(e.slice(Bc.length));let n=e.indexOf(Qc);return n<0?e:e.slice(0,n)+ee().staged.declinedPlanned+t(e.slice(n+Qc.length))}o(SS,"declineNote");function wS(e){return e.category!==void 0&&NJ.has(e.category.toLowerCase())}o(wS,"isTooling");function bS(e,t){return(BS[(e.severity??"").toLowerCase()]??4)-(BS[(t.severity??"").toLowerCase()]??4)}o(bS,"bySeverity");function RS(e){return`- ${e.severity?`**[${vs(ee().severityLabels,e.severity.toLowerCase()).toUpperCase()}]** `:""}${e.description.trim()}`}o(RS,"issueLine");function FJ(e){let t=e.resultId?.split("#").slice(1).join("#");if(e.testType!=="unit"||!t)return;let n=t;try{n=decodeURIComponent(t)}catch{}let r=/^(.*?)(\[.*\])$/.exec(n);return r?{fn:r[1],kase:r[2]}:{fn:n}}o(FJ,"unitTestOf");var xS=o((e,t)=>e!==void 0&&t!==void 0&&e.replace(/^\.\//,"")===t.replace(/^\.\//,""),"samePath");function TS(e,t){return(e.testVideos??[]).find(n=>n.url&&t(n))?.url}o(TS,"videoLink");function sm(e,t){return TS(e,n=>xS(n.fileName,t.fileName)&&(!n.repository||!t.repository||n.repository.toLowerCase()===t.repository.toLowerCase()))}o(sm,"resultVideoLink");function im(e,t){return TS(e,n=>xS(n.writtenAs??n.fileName,t))}o(im,"journeyVideoLink");function MJ(e,t,n){return n?sm(e,{fileName:t,repository:n}):im(e,t)}o(MJ,"requirementVideoLink");function UJ(e){let t=[],n=new Map;for(let a of e.newTestsCreated)a.testType==="unit"&&n.set(a.fileName,[...n.get(a.fileName)??[],a.testId.split("::").slice(1).join("::")]);let r=new Map,s=o((a,A)=>(n.get(a??"")??[]).find(u=>u!==A&&Lv(A,u)),"parentOf"),i=new Map;for(let a of e.testResults){let A=FJ(a),u=A&&!A.kase?s(a.fileName,A.fn):void 0;if(A&&u&&(A={fn:u,kase:`"${A.fn}"`}),A?.kase&&r.set(a,A.kase),!A){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 d=`${a.fileName??""}#${A.fn}`,p=i.get(d);p||(p={row:{testId:a.testId,testType:a.testType,endpoint:a.endpoint,status:a.status,details:"",test:A.fn,...a.fileName?{fileName:a.fileName}:{},...a.repository?{repository:a.repository}:{}},cases:[]},i.set(d,p),t.push(p.row)),p.cases.push(a)}for(let{row:a,cases:A}of i.values()){let u=A.filter(f=>f.status==="Fail"),d=A.filter(f=>f.status==="Pass").length,p=A.filter(f=>f.status==="Skipped").length;a.cases=A.length,a.status=u.length?"Fail":p?"Skipped":"Pass";let g=u[0];a.details=A.length===1?A[0].details??"":ee().staged.casesPassed(d,A.length,p)+(g?`; ${r.get(g)??""} ${g.details??""}`.replace(/; +/,"; ").trimEnd():"")}return t}o(UJ,"resultRows");function LJ(e){return em(e).map(t=>t.expected===void 0?t.expectation:`${t.expectation}: ${zr(t.expected)}`)}o(LJ,"unitAssertions");function zr(e){let t=Math.max(0,...(e.match(/`+/g)??[]).map(s=>s.length)),n="`".repeat(t+1),r=e.startsWith("`")||e.endsWith("`")?" ":"";return`${n}${r}${e}${r}${n}`}o(zr,"codeSpan");function kS(e){return e.newTestsCreated.some(t=>t.testType!=="unit")&&e.testResults.every(t=>t.status==="Skipped")}o(kS,"nothingExecuted");function DS(e,t={}){let{audience:n,collapsed:r=!1,existingEvidence:s=[],requestedBy:i,sourcePullRequest:a}=t,A=n!=="testbot-pr",u=n!=="comment",d=n!=="testbot-pr",p=[DJ];if(a&&p.push(ee().staged.testsSourcePullRequest(zr(a)),""),i){let Q=i.name.replace(/\s+/g," ").trim().replace(/[<>[\]()*_`\\|#]/g,"\\$&").replace(/@/g,"@\u200D");p.push(i.kind==="person"?ee().staged.requestedByPerson(Q):ee().staged.requestedByPolicy(Q),"")}e.notTranslated&&p.push(vs(ee().staged.notTranslated,e.notTranslated),"");let g=o(Q=>{r?p.push("<details>",`<summary>${Q}</summary>`,""):p.push(`### ${Q}`)},"sectionStart"),f=o(()=>{r&&p.push("","</details>"),p.push("")},"sectionEnd");if(A){for(let Q of e.businessCaseAnalysis.trim().split(/\r?\n/))p.push(`> ${Q}`);p.push("")}if(kS(e)&&p.push(ee().staged.noLiveApp(e.newTestsCreated.length),""),u&&e.newTestsCreated.length){let Q=new Map;for(let q of e.newTestsCreated){if(q.testType!=="unit")continue;let W=(q.testId.split("::").slice(1).join("::")||q.testId).replace(/\[.*\]$/,""),$=Q.get(q.fileName)??{functions:new Set,endpoints:[],descriptions:new Map};q.endpoint&&!$.endpoints.includes(q.endpoint)&&$.endpoints.push(q.endpoint);let ge=q.description?.trim()??"",Me=$.descriptions.get(W)??[];Me.includes(ge)||Me.push(ge),$.functions.add(W),$.descriptions.set(W,Me),Q.set(q.fileName,$)}let k=e.newTestsCreated.filter(q=>q.testType!=="unit"),F=k.length+[...Q.values()].reduce((q,W)=>q+W.functions.size,0);g(ee().testRecommendationsImplementedHeader(F));for(let[q,{functions:W,endpoints:$,descriptions:ge}]of Q){let Me=W.size;p.push(ee().staged.unitTestsInFile(`\`${q}\``,Me,$.map(Re=>`\`${Re}\``).join(", ")),"");let we=new Map;for(let[Re,Ce]of ge){let _e=Ce.join("\0"),P=we.get(_e)??{fns:[],descriptions:Ce};P.fns.push(Re),we.set(_e,P)}let De=0;for(let{fns:Re,descriptions:Ce}of we.values()){p.push(`${++De}. ${Re.map(P=>`\`${P}\``).join(", ")}`);let _e=[...new Set(Ce.flatMap(P=>LJ(P)))];for(let P of _e)p.push(` - ${P}`)}p.push("")}for(let q of k){let W=q.testId?`\`${q.testId}\``:nm(q.testType),$=q.fileName?` (\`${q.fileName}\`)`:"",ge=q.endpoint?`
|
|
93
|
+
`)){if(!s.trim()||s.length>1&&s[1]==="D")continue;let i=s.slice(3).trim(),a=i.indexOf(" -> ");if(a!==-1&&(i=i.slice(a+4).trim()),i=i.replace(/^"|"$/g,""),!i)continue;let A=i.replace(/^\.\//,"");A.startsWith(".skyramp/")||!n(A)||r.push(A)}return r}o(tS,"testLitter");function VH(e){let t=wl[e],n=e==="ui";return{name:`${t.stage}-no-litter`,verify(r){let s=tS(r.inputs.repositoryPath);if(s===void 0)return{name:this.name,passed:!0};let i=s.filter(a=>GH.test(a)===n);return i.length===0?{name:this.name,passed:!0}:lt(this.name,[`${t.stage} left files outside .skyramp/ \u2014 move the staged test into .skyramp/staged/ and delete any codegen draft (e.g. *_scaffold.*): ${i.slice(0,6).join(", ")}`])}}}o(VH,"noLitterGateFor");var CX=VH("backend");var Ic=ke(require("fs")),ti=ke(require("path"));function rS(e){return Vt(Lf,e).errors}o(rS,"validateAdaptOutput");function JH(e,t=[]){let{value:n,error:r}=ot(e,t);if(r)return{errors:[r]};let s=rS(n);return s.length>0?{errors:s}:{adapt:n,errors:[]}}o(JH,"parseAdaptText");var YH="adapt-scratch",nS=`${YH}/adapt-result.json`;function sS(e,t){let n=ti.join(e.outputsDir,nS),r;try{r=Ic.readFileSync(n,"utf-8")}catch{r=void 0}if(r!==void 0&&(e.secretValues??[]).some(a=>r.includes(a)))return{errors:[`${nS} contains a secret value (token / credential) \u2014 never write it anywhere`]};let s=JH(t.stdout,e.secretValues);if(s.adapt)return s;let i=r!==void 0?Ys(n):void 0;return i!==void 0&&rS(i).length===0?{adapt:i,errors:[]}:s}o(sS,"parseAdaptFromSession");var VX=rn("adapt-schema",sS);var iS=require("child_process");function oS(e){let t;try{t=(0,iS.execFileSync)("git",[...Ws,"status","--porcelain","-z","--untracked-files=all"],{env:sn(),cwd:e,encoding:"utf-8",maxBuffer:16*1024*1024})}catch{return[]}let n=t.split("\0"),r=[];for(let s=0;s<n.length;s++){let i=n[s];if(i.length<4)continue;let a=i.slice(0,2);r.push({code:a,path:i.slice(3)}),(a[0]==="R"||a[0]==="C")&&s++}return r}o(oS,"statusEntries");var XX=2*1024*1024;var bl=c.string().trim().min(1),jH=c.object({cwd:bl.describe(`directory the command starts in, relative to the test's checkout ("." for its root)`),argv:c.array(bl).min(1).describe("the command as separate arguments, run without a shell"),env:c.record(c.string(),c.string()).optional().describe("plain settings the listing needs beyond the CI step's own; never a credential or PATH")}),WH=c.object({file:bl.describe("a file of the test's checkout, relative to its root"),line:bl.describe("a line of that file, quoted exactly from where its command starts to its end")}),aS=c.object({collected:c.boolean().describe("whether the repo's CI runs this test as it is"),steps:c.array(WH).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:c.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:jH.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:c.string().optional().describe("when not collected: why the repo's CI will not run it")});var ae=c.string().trim().min(1),eJ=o(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"),tJ=c.preprocess(eJ,c.object({id:ae.describe(`its requirement's id plus a letter, e.g. "R1a", "AC-3a"`),clause:ae.describe("one testable part of the requirement"),expected:ae.describe("the outcome the requirement calls for \u2014 taken from the requirement, never from what the code does"),skip:c.string().optional().describe("only when no test can check this clause here: why"),type:c.nativeEnum(Hr).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:c.string().optional().describe('its "METHOD /path", or the page / flow'),steps:c.string().optional().describe("what that test does; its expected outcome is this clause's"),finding:c.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:c.string().optional().describe("path:line of the code that decides this clause, when there is one"),stated:c.string().optional().describe("the description's or spec's own words that state this clause, copied exactly, when they do"),mutates:c.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:c.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:c.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)")})),cS=c.object({spec:c.string().optional().describe("file:line of a spec in the repository"),prDescription:c.boolean().optional().describe("or true when a pull request description says otherwise"),reference:c.string().optional().describe("or the key of an item the run was given, as listed"),says:ae.describe("what it says there, in its own words, copied exactly"),criterion:c.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`}),nJ=c.object({id:ae.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:ae,source:c.nativeEnum(lr).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:c.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:ae.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:c.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:c.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:c.array(cS).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:c.array(tJ)}),AS=(s=>(s.ServerError="server-error",s.DataLost="data-lost",s.FinalState="final-state",s.DerivedValues="derived-values",s))(AS||{}),rJ=c.object({id:ae.describe('e.g. "F1"'),file:ae,line:c.number().optional(),claim:ae.describe("the defect, in one sentence"),severity:c.nativeEnum(Zs),evidence:ae.describe("the code line, or the probe request and response, that shows it"),conflictsWith:c.array(ae).optional().describe("requirement or clause ids it violates"),keeps:c.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:c.nativeEnum(AS).optional().describe("for a defect that breaks a rule every app keeps, which nothing needs to state: which one"),existing:c.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:c.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)")}),sJ=c.object({id:ae.describe('e.g. "Q1"'),question:ae.describe("what is unsettled, as a question the PR author can answer"),readings:c.array(ae).min(2).describe("each reasonable behaviour, with what points to it (file:line, or the words that suggest it)"),about:c.string().optional().describe("the requirement or clause id it is about, when there is one"),sources:c.array(cS).optional().describe("when sources of the same rank disagree on it: each of them")}),iJ=c.object({id:ae.describe('unique, a short kebab-case name for what the case checks, e.g. "ship-twice-409"'),type:c.nativeEnum(Hr).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:ae.describe('"METHOD /path", or the page / flow'),clause:c.string().optional().describe("the clause id this case checks"),finding:c.string().optional().describe("the finding id this case catches"),steps:ae.describe("what the test does"),expected:ae.describe("the expected outcome, from the clause"),mutates:c.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")}),oJ=c.object({test:ae.describe("existing test file"),action:c.nativeEnum(Jr),reason:ae,mutates:c.boolean().optional().describe("true when the maintained test changes state"),clauses:c.array(ae).optional().describe("the clause ids this test checks")}),aJ=c.object({outcome:c.nativeEnum(or).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:c.record(c.string()).optional().describe("service \u2192 base URL of the running app"),health:c.object({url:c.string().optional(),command:c.string().optional(),output:c.string().optional()}).optional().describe("the check that shows the app serves real data, and what it returned"),teardown:c.string().optional().describe("command that stops the app"),dependencies:c.record(c.boolean()).optional().describe("every backing service: true = really running, false = mocked"),recipeFixes:c.array(c.string()).optional().describe("what you changed in the recipe"),error:c.string().optional().describe("when it did not come up: the failing command and what it printed"),suspectFiles:c.array(c.string()).optional().describe("change-broke-bringup: the changed files to blame"),login:c.object({username:ae,password:c.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:Fh.optional()}),D6=c.object({schemaVersion:c.literal(1),requirements:c.array(nJ),findings:c.array(rJ),cases:c.array(iJ).describe("a second test for a clause, and one case per finding that fails on this branch"),questions:c.array(sJ).optional().describe("behaviours the change leaves unsettled; no case asserts any of them"),maintenance:c.array(oJ),journeys:c.array(zv).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:c.array(c.object({clause:ae,why:ae})).optional().describe("a clause a user sees or does that no journey can reach through the UI, and why"),triage:Cc.optional().describe("the validation triage decision, made before the app is started; its behaviorIds are clause ids"),app:aJ.optional().describe("omit when no app was needed or none was started"),summary:ae.describe("one paragraph: what the change does and where the risk is")});var uS=(n=>(n.Backend="backend",n.Ui="ui",n))(uS||{});var Rl=(s=>(s.Added="added",s.Updated="updated",s.Deleted="deleted",s.Unchanged="unchanged",s))(Rl||{}),cJ=c.object({file:ae.describe("repo-relative path; in another repo of the change, that repo's directory name then its path"),kind:c.nativeEnum(uS),change:c.nativeEnum(Rl).describe("added: a file you created; updated / deleted / unchanged: an existing test"),covers:c.array(c.string()).describe("the plan case ids this file tests"),defect:c.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:c.object({requirement:ae.describe("the requirement or clause id the change deliberately alters"),line:ae.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:c.object({exit:c.number().nullable().describe("exit code of your last run of this file; null if it could not be run"),cases:c.array(c.object({case:ae,status:c.nativeEnum(an),defect:c.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:c.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:c.string().optional().describe("for a case you keep as a defect: path:line of the application code that makes it fail"),requires:c.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:c.string().optional().describe("what failed and why, or why it was not run")}),assertions:c.array(c.object({case:ae,evidence:ae})).optional().describe("per covered case, the assertion line that checks its expected outcome"),functions:c.array(c.object({name:ae.describe("the test function as the runner names it within its file, without the file (test_x, TestClass::test_x, TestSuite/TestCase)"),cases:c.array(ae).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:c.object({draft:c.union([c.string(),c.array(c.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:c.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:c.array(Vf).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:ae.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:aS.optional().describe("for a file you added or updated: whether the repo's CI will run it, and how you know"),run:Qo.optional().describe(`for a file in ${wo}, 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 ${Cn}, or go-test-json); Testbot runs it before write ends and re-runs the tests with it`)}),AJ=o(e=>{if(!e||typeof e!="object")return e;let{test:t,...n}=e;return typeof t=="string"&&t.trim()&&n.tests===void 0?{...n,tests:[t]}:e},"oneTestIsTests"),uJ=c.preprocess(AJ,c.object({description:ae.describe("what is wrong and how to reproduce it: endpoint or page, input, what you got vs what was expected"),severity:c.nativeEnum(Zs).optional(),sourceFile:c.string().optional().describe("the app file at fault"),sourceLine:c.number().optional(),tests:c.array(ae).optional().describe("every test file that fails because of it: a defect several tests show is one issue"),finding:c.string().optional().describe("the plan's finding id, when it is one"),requirements:c.array(ae).optional().describe("the plan's requirement or clause ids it violates")})),N6=c.object({schemaVersion:c.literal(1),tests:c.array(cJ),notWritten:c.array(c.object({case:ae,reason:ae})).describe("every plan case no test covers, and why"),journeys:c.array(yl).optional().describe("one entry per planned user journey: the browser test that walks it end to end"),lint:c.object({command:c.string(),clean:c.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:c.array(c.object({package:ae,manifest:ae.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:ae.optional().describe("owner/repo of the manifest's checkout; omit for the repo under test"),reason:ae.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:c.array(ae).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:c.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:c.object({message:ae.describe('"Skyramp Testbot: \u2026", subject line at most 72 characters'),prTitle:ae.describe("at most 72 characters"),prBody:ae.describe("what the tests cover and what they found")}),report:c.object({summary:ae.describe("1-2 sentences for the PR author: does the change do what it says?"),issues:c.array(uJ).describe("every defect the tests found"),nextSteps:c.array(c.string())})});var F6={added:"place",updated:"update",deleted:"delete",unchanged:"verify"};var dS=(r=>(r.Requirement="requirement",r.PrDescription="pr_description",r.Code="code",r))(dS||{}),at=c.string().trim().min(1),lJ=c.object({expectation:at.max(300).describe("the behavior this assertion pins, in words"),source:c.nativeEnum(dS),expected:at.max(200).describe("the exact value or outcome asserted, as the test asserts it")}),dJ=c.object({file:at.describe("path of the NEW test file you wrote, relative to its repository"),repository:at.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),framework:at.describe("the framework the repository runs this file with: pytest, jest, vitest, node-test, or the name of any other"),run:Qo.optional().describe(`for ${wo}: how the run executes only the tests in names, with the repository's own runner writing JUnit XML to {junit}`),covers:c.array(at).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:c.array(at).min(1).describe("the test functions/cases in the file that provide evidence for that behavior, as the framework names them"),assertions:c.array(lJ).min(1)}),kl=(n=>(n.Updated="updated",n.Deleted="deleted",n))(kl||{}),lS=300,pJ=c.object({file:at.describe("path of the EXISTING test file you updated or deleted, relative to its repository"),repository:at.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),change:c.nativeEnum(kl),staleBecause:c.object({requirement:at.describe("the requirement or clause id the change deliberately alters"),line:at.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:c.preprocess(e=>typeof e=="string"?e.trim().slice(0,lS):e,at.max(lS)).describe("what the change deliberately altered that made the test wrong")}),Kf=c.object({schemaVersion:c.literal(1),tests:c.array(dJ),maintained:c.array(pJ).optional().describe("existing tests the change made stale that you updated or deleted; omit when there were none"),defectsNotTested:c.array(c.object({id:at,reason:at.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:c.array(yl).optional().describe("one entry per planned user journey: the in-process test that walks it end to end"),journeysNotWritten:c.array(c.object({journey:at,missing:at.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:c.object({command:c.string(),clean:c.boolean()}).optional().describe("the linter/formatter you ran on your test files, if the repository has one you can run; omit otherwise"),commitMessage:at.optional().describe("the commit message for your tests: a subject line of at most 72 characters, then what they cover")});var Sl="generate-unit.json";function fJ(e){let{value:t,error:n}=ot(e);if(n)return{errors:[n]};let{value:r,errors:s}=Vt(Kf,t);return s.length?{errors:s}:{output:r,errors:[]}}o(fJ,"parseGenerateUnitText");function mJ(e){return fJ(e.stdout)}o(mJ,"parseGenerateUnitFromSession");var B7=rn("generate-unit-schema",(e,t)=>mJ(t));var vl=String.raw`(?:node:)?(?:http|https|http2|net|tls|dgram)`,Q7=[[/\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+["']${vl}["']|\bimport\s+["']${vl}["']|require\(\s*["']${vl}["']\s*\)|\bimport\(\s*["']${vl}["']\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 q7=new Set(["targeted_unit","existing_evidence_sufficient"]);var IJ="triage.json",Dee=new Set(["existing_evidence","unaffected","existing_unit","new_unit","runtime"]),Nee={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 BJ(e){let{value:t,error:n}=ot(e);if(n)return{errors:[n]};let{value:r,errors:s}=Vt(Cc,t);return s.length?{errors:s}:{triage:r,errors:[]}}o(BJ,"parseTriageText");function QJ(e){return BJ(e.stdout)}o(QJ,"parseTriageFromSession");var Fee=rn("triage-schema",(e,t)=>QJ(t));function wJ(e){let t=e.inputs?.pipeline;return t?e.state.stages[t==="two-step"?"plan":"triage"]:e.state.stages.triage??e.state.stages.plan}o(wJ,"triageDecider");function Zf(e){if(wJ(e)?.status==="passed")return Ys(hS.join(e.outputsDir,IJ))}o(Zf,"readTriage");function Xf(e){return Fk(ef(e.inputs,Oe(e,`${dc}.json`),Zf(e)?.sutRequired))}o(Xf,"revisionBlockReason");var Mee=new Set(["deploy","recommend","generate","generate-ui","adapt","generate-unit","native-run","finalize","deliver"]);var Xr=ke(require("fs")),Zr=ke(require("path")),HS=require("child_process"),Fl=require("crypto");var qee=[...zh,"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 ete=process.env.RUNNER_TOOL_CACHE||"/opt/hostedtoolcache";var pte={jest:"jest",vitest:"vitest"};var sne=5*6e4;function RJ(e){return Vt(Gf,e).errors}o(RJ,"validateAnalysisOutput");function ES(e,t=[]){let{value:n,error:r}=ot(e,t);if(r)return{errors:[r]};let s=RJ(n);return s.length>0?{errors:s}:{analysis:n,errors:[]}}o(ES,"parseAnalysisText");function kJ(e,t=[]){return ES(e.stdout,t)}o(kJ,"parseAnalysisFromSession");var kne=rn("analysis-schema",(e,t)=>kJ(t,e.secretValues));var yre=_u.rows.notRun(!0);var Bc="kept, not ",Qc="(declined the planned ";function em(e){if(!e)return[];let t=[],n=0,r=0;for(let s=0;s<e.length;s++){let i=e[s];i==="("?n++:i===")"?n=Math.max(0,n-1):n===0&&i===";"&&e[s+1]===" "&&e[s-1]===")"&&(t.push(e.slice(r,s)),r=s+2)}return t.push(e.slice(r)),t.map(s=>{let i=s.trim();if(!i.endsWith(")"))return{expectation:i};let a=0;for(let A=i.length-1;A>=0;A--)if(i[A]===")")a++;else if(i[A]==="("&&--a===0){let u=i.slice(0,A).trim(),d=i.slice(A+1,-1).trim();return u&&d?{expectation:u,expected:d}:{expectation:i}}return{expectation:i}})}o(em,"assertionParts");var yS=new Set(["update","regenerate","delete"]);var Cre={update:"updated",regenerate:"regenerated",delete:"deleted",verify:"verified",none:"touched"};var CS=c.string().trim().min(1),tm=c.object({schemaVersion:c.literal(1).optional(),businessCaseAnalysis:CS.describe("1-2 sentences: what this change means for a user, and whether the evidence shows it working"),issuesFound:c.array(c.object({description:CS,severity:c.string().optional().describe("critical | high | medium | low"),category:c.string().optional().describe("bug | lint | type | config"),sourceFile:c.string().optional(),sourceLine:c.number().optional(),findingId:c.string().optional(),requirementIds:c.array(c.string()).optional()})).describe("every real problem this run exposed \u2014 cause, file:line, severity"),nextSteps:c.array(c.string()).describe("concrete follow-ups the author can act on; required non-empty when a disclosure is BLOCKING")});function xJ(e){return Vt(tm,e).errors}o(xJ,"validateProseOutput");function TJ(e,t=[]){let{value:n,error:r}=ot(e.stdout,t);if(r)return{errors:[r]};let s=xJ(n);return s.length>0?{errors:s}:{prose:n,errors:[]}}o(TJ,"parseProseFromSession");var Fre=rn("report-schema",(e,t)=>TJ(t,e.secretValues));var DJ="<!-- skyramp-testbot -->",IS=yS,NJ=new Set(["lint","type","config"]),BS={critical:0,high:1,medium:2,low:3},vS=new Set(["Pass","Fail"]);var rm=o(e=>vs(ee().statusLabels,e),"statusLabel"),nm=o(e=>vs(ee().testTypeCellLabels,e),"testTypeLabel");function Qe(e){return(e??"").replace(/\|/g,"\\|").replace(/\r?\n/g,"<br>").trim()}o(Qe,"escCell");function QS(e,t){return!e||!vS.has(e)?"\u2014":t?`${rm(e)} (${Qe(SS(t))})`:rm(e)}o(QS,"maintStatus");function SS(e){let t=o(r=>{let s=r.indexOf(": ");return s<0?r:vs(ee().staged.maintenanceActions,r.slice(0,s))+r.slice(s)},"action");if(e.startsWith(Bc))return ee().staged.keptNot+t(e.slice(Bc.length));let n=e.indexOf(Qc);return n<0?e:e.slice(0,n)+ee().staged.declinedPlanned+t(e.slice(n+Qc.length))}o(SS,"declineNote");function wS(e){return e.category!==void 0&&NJ.has(e.category.toLowerCase())}o(wS,"isTooling");function bS(e,t){return(BS[(e.severity??"").toLowerCase()]??4)-(BS[(t.severity??"").toLowerCase()]??4)}o(bS,"bySeverity");function RS(e){return`- ${e.severity?`**[${vs(ee().severityLabels,e.severity.toLowerCase()).toUpperCase()}]** `:""}${e.description.trim()}`}o(RS,"issueLine");function FJ(e){let t=e.resultId?.split("#").slice(1).join("#");if(e.testType!=="unit"||!t)return;let n=t;try{n=decodeURIComponent(t)}catch{}let r=/^(.*?)(\[.*\])$/.exec(n);return r?{fn:r[1],kase:r[2]}:{fn:n}}o(FJ,"unitTestOf");var xS=o((e,t)=>e!==void 0&&t!==void 0&&e.replace(/^\.\//,"")===t.replace(/^\.\//,""),"samePath");function TS(e,t){return(e.testVideos??[]).find(n=>n.url&&t(n))?.url}o(TS,"videoLink");function sm(e,t){return TS(e,n=>xS(n.fileName,t.fileName)&&(!n.repository||!t.repository||n.repository.toLowerCase()===t.repository.toLowerCase()))}o(sm,"resultVideoLink");function im(e,t){return TS(e,n=>xS(n.writtenAs??n.fileName,t))}o(im,"journeyVideoLink");function MJ(e,t,n){return n?sm(e,{fileName:t,repository:n}):im(e,t)}o(MJ,"requirementVideoLink");function UJ(e){let t=[],n=new Map;for(let a of e.newTestsCreated)a.testType==="unit"&&n.set(a.fileName,[...n.get(a.fileName)??[],a.testId.split("::").slice(1).join("::")]);let r=new Map,s=o((a,A)=>(n.get(a??"")??[]).find(u=>u!==A&&Lv(A,u)),"parentOf"),i=new Map;for(let a of e.testResults){let A=FJ(a),u=A&&!A.kase?s(a.fileName,A.fn):void 0;if(A&&u&&(A={fn:u,kase:`"${A.fn}"`}),A?.kase&&r.set(a,A.kase),!A){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 d=`${a.fileName??""}#${A.fn}`,p=i.get(d);p||(p={row:{testId:a.testId,testType:a.testType,endpoint:a.endpoint,status:a.status,details:"",test:A.fn,...a.fileName?{fileName:a.fileName}:{},...a.repository?{repository:a.repository}:{}},cases:[]},i.set(d,p),t.push(p.row)),p.cases.push(a)}for(let{row:a,cases:A}of i.values()){let u=A.filter(f=>f.status==="Fail"),d=A.filter(f=>f.status==="Pass").length,p=A.filter(f=>f.status==="Skipped").length;a.cases=A.length,a.status=u.length?"Fail":p?"Skipped":"Pass";let g=u[0];a.details=A.length===1?A[0].details??"":ee().staged.casesPassed(d,A.length,p)+(g?`; ${r.get(g)??""} ${g.details??""}`.replace(/; +/,"; ").trimEnd():"")}return t}o(UJ,"resultRows");function LJ(e){return em(e).map(t=>t.expected===void 0?t.expectation:`${t.expectation}: ${zr(t.expected)}`)}o(LJ,"unitAssertions");function zr(e){let t=Math.max(0,...(e.match(/`+/g)??[]).map(s=>s.length)),n="`".repeat(t+1),r=e.startsWith("`")||e.endsWith("`")?" ":"";return`${n}${r}${e}${r}${n}`}o(zr,"codeSpan");function kS(e){return e.newTestsCreated.some(t=>t.testType!=="unit")&&e.testResults.every(t=>t.status==="Skipped")}o(kS,"nothingExecuted");function DS(e,t={}){let{audience:n,collapsed:r=!1,existingEvidence:s=[],requestedBy:i,sourcePullRequest:a}=t,A=n!=="testbot-pr",u=n!=="comment",d=n!=="testbot-pr",p=[DJ];if(a&&p.push(ee().staged.testsSourcePullRequest(zr(a)),""),i){let Q=i.name.replace(/\s+/g," ").trim().replace(/[<>[\]()*_`\\|#]/g,"\\$&").replace(/@/g,"@\u200D");p.push(i.kind==="person"?ee().staged.requestedByPerson(Q):ee().staged.requestedByPolicy(Q),"")}e.notTranslated&&p.push(vs(ee().staged.notTranslated,e.notTranslated),"");let g=o(Q=>{r?p.push("<details>",`<summary>${Q}</summary>`,""):p.push(`### ${Q}`)},"sectionStart"),f=o(()=>{r&&p.push("","</details>"),p.push("")},"sectionEnd");if(A){for(let Q of e.businessCaseAnalysis.trim().split(/\r?\n/))p.push(`> ${Q}`);p.push("")}if(kS(e)&&p.push(ee().staged.noLiveApp(e.newTestsCreated.length),""),u&&e.newTestsCreated.length){let Q=new Map;for(let q of e.newTestsCreated){if(q.testType!=="unit")continue;let W=(q.testId.split("::").slice(1).join("::")||q.testId).replace(/\[.*\]$/,""),$=Q.get(q.fileName)??{functions:new Set,endpoints:[],descriptions:new Map};q.endpoint&&!$.endpoints.includes(q.endpoint)&&$.endpoints.push(q.endpoint);let ge=q.description?.trim()??"",Me=$.descriptions.get(W)??[];Me.includes(ge)||Me.push(ge),$.functions.add(W),$.descriptions.set(W,Me),Q.set(q.fileName,$)}let k=e.newTestsCreated.filter(q=>q.testType!=="unit"),F=k.length+[...Q.values()].reduce((q,W)=>q+W.functions.size,0);g(ee().testRecommendationsImplementedHeader(F));for(let[q,{functions:W,endpoints:$,descriptions:ge}]of Q){let Me=W.size;p.push(ee().staged.unitTestsInFile(`\`${q}\``,Me,$.map(Re=>`\`${Re}\``).join(", ")),"");let we=new Map;for(let[Re,Ce]of ge){let _e=Ce.join("\0"),P=we.get(_e)??{fns:[],descriptions:Ce};P.fns.push(Re),we.set(_e,P)}let De=0;for(let{fns:Re,descriptions:Ce}of we.values()){p.push(`${++De}. ${Re.map(P=>`\`${P}\``).join(", ")}`);let _e=[...new Set(Ce.flatMap(P=>LJ(P)))];for(let P of _e)p.push(` - ${P}`)}p.push("")}for(let q of k){let W=q.testId?`\`${q.testId}\``:nm(q.testType),$=q.fileName?` (\`${q.fileName}\`)`:"",ge=q.endpoint?`
|
|
94
94
|
\`${q.endpoint}\``:"",Me=q.description?`
|
|
95
95
|
${q.description.trim()}`:"";p.push(`- ${W}${$}${ge}${Me}`)}f()}let m=(e.testMaintenance??[]).filter(Q=>IS.has(Q.action));if(u&&m.length){g(ee().staged.testMaintenanceHeader),p.push(ee().maintenanceTableHeader),p.push("|-----------|----------|------|--------|--------|-------|");for(let Q of m)p.push(`| ${Qe(nm(Q.testType))} | ${Qe(Q.endpoint)} | \`${Qe(Q.fileName)}\` | ${Qe(Q.description)} | ${QS(Q.beforeStatus,Q.beforeDetails)} | ${QS(Q.afterStatus,Q.afterDetails)} |`);f()}let E=o(Q=>Q.startsWith(Bc)||Q.includes(Qc),"hasDeclineNote"),I=(e.testMaintenance??[]).filter(Q=>E(Q.afterDetails)&&(!IS.has(Q.action)||!vS.has(Q.afterStatus??"")));if(u&&I.length){g(ee().staged.declinedMaintenanceHeader);for(let Q of I)p.push(`- \`${Qe(Q.fileName)}\`: ${Qe(SS(Q.afterDetails))}`);f()}if(u&&s.length){g(ee().staged.existingEvidenceHeader);let Q=new Map;for(let k of s){let F=`${k.check}\0${k.url??""}\0${k.revision??""}`;Q.set(F,[...Q.get(F)??[],k])}for(let[,[k,...F]]of Q){let q=k.url?`[${zr(k.check)}](${k.url})`:zr(k.check);p.push(ee().staged.trustedCheckPassed(q,k.revision?zr(k.revision.slice(0,7)):""),"");for(let W of[k,...F])p.push(`- ${zr(W.behavior)}`);p.push("")}f()}if(u&&e.testResults.length){g(ee().staged.testResultsHeader);let Q=UJ(e),k=Q.some($=>$.test),F=Q.some($=>sm(e,$)),q=k?ee().staged.unitResultsTableHeader:ee().staged.resultsTableHeader;p.push(F?`${q} ${ee().columnVideo} |`:q),p.push(`${k?"|---------|-----------|----------|------|-------|--------|---------|":"|---------|-----------|----------|--------|---------|"}${F?"-------|":""}`);for(let $ of Q){let ge=$.details.replace(/(\S+\.(?:py|ts|js|spec\.\w+))/gi,"`$1`"),Me=$.testId?`\`${Qe($.testId)}\``:"\u2014",we=k?` ${$.test?`\`${Qe($.test)}\``:""} | ${$.cases??""} |`:"",De=sm(e,$),Re=F?` ${De?ee().videoDownloadLink(De):"\u2014"} |`:"";p.push(`| ${Me} | ${Qe(nm($.testType))} | ${Qe($.endpoint)} |${we} ${Qe(rm($.status))} | ${Qe(ge)} |${Re}`)}let W=(e.testVideos??[]).find($=>$.artifactsUrl)?.artifactsUrl;!F&&W&&p.push("",ee().videosArtifactFallback(W)),f()}if(e.requirements?.length){let Q=e.requirements.flatMap($=>$.clauses),k=o($=>$.status==="Pass"||$.status==="Passed, test not kept","passes"),F=Q.filter(k).length;g(ee().staged.requirementsHeader(F,Q.length));let q=o($=>vs(ee().staged.clauseStatuses,$.status),"status"),W=o($=>($.status==="Not tested"||$.status==="Passed, test not kept")&&$.notTested?`${q($)}: ${$.notTested}`:$.findings.length?`${q($)} \u2014 ${$.findings.join(", ")}`:q($),"result");if(u){p.push(ee().staged.requirementsTableHeader),p.push("|-------------|--------|-------|--------|");for(let $ of e.requirements)$.clauses.forEach((ge,Me)=>{let we=Me===0?`**${Qe($.label)}**${$.statement?` ${Qe($.statement)}`:""}`:"",De=`\`${Qe(ge.id)}\`${ge.text?` ${Qe(ge.text)}`:""}`,Re=new Map;for(let P of ge.tests){let Se=P.fileName??P.testId,ye=Re.get(Se)??{fns:new Set};for(let Ht of P.functions)ye.fns.add(Ht);ye.video??=P.fileName?MJ(e,P.fileName,P.repository):void 0,Re.set(Se,ye)}let Ce=Re.size?[...Re].map(([P,{fns:Se,video:ye}])=>`\`${Qe(P)}\`${Se.size?` \u2014 ${[...Se].map(Ht=>`\`${Qe(Ht)}\``).join(", ")}`:""}${ye?` ${ee().videoDownloadLink(ye)}`:""}`).join("<br>"):"\u2014",_e=$.source==="could-break"&&ge.status==="Pass"?ee().staged.regressionGuard:"";p.push(`| ${we} | ${De} | ${Ce} | ${Qe(W(ge)+_e)} |`)})}else{p.push(ee().staged.requirementsSummaryTableHeader),p.push("|-------------|-----------------|-------------|");for(let $ of e.requirements){let ge=$.clauses.filter(k).length,Me=$.clauses.filter(we=>!k(we)).map(we=>`\`${Qe(we.id)}\` ${Qe(W(we))}`);p.push(`| **${Qe($.label)}**${$.statement?` ${Qe($.statement)}`:""} | ${ge}/${$.clauses.length} | ${Me.join("<br>")||"\u2014"} |`)}}f()}if(u&&e.changes?.length&&!e.requirements?.length){let Q=e.executionCoverage,k=Q?ee().staged.coverageCaption(Q.generated,Q.modified,Q.verified,Q.executed):"";g(`${ee().staged.behaviourCoverageHeader}${k}`),p.push(ee().staged.coverageTableHeader),p.push("|-----------|--------|-----------|----------------|");for(let F of e.changes){let q=F.testedBy.length?F.testedBy.map($=>`\`${Qe($)}\``).join(", "):F.writtenBy.length?ee().staged.writtenNotRun:"\u2014",W=F.maintainedBy.length?F.maintainedBy.map($=>`\`${Qe($)}\``).join(", "):"\u2014";p.push(`| ${Qe(F.text)} | \`${Qe(F.source)}\` | ${q} | ${W} |`)}f()}if(e.userJourneys?.length){let Q=e.userJourneys.filter(F=>F.status==="Pass"&&!F.problems.length).length;g(`\u{1F9ED} User Journeys Covered (${Q}/${e.userJourneys.length} walked end to end)`);let k=e.userJourneys.some(F=>im(e,F.fileName));p.push(`| Journey | Test | Status | Notes |${k?` ${ee().columnVideo} |`:""}`),p.push(`|---------|------|--------|-------|${k?"-------|":""}`);for(let F of e.userJourneys){let q=F.fileName?`\`${Qe(F.fileName)}\`${F.test?` \u2014 ${Qe(F.test)}`:""}`:"\u2014",W=F.source&&F.source!=="inferred"?`; described in the ${F.source==="spec"?"spec":"PR description"}`:"; inferred from the app",$=(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`)+W,ge=k?im(e,F.fileName):void 0;p.push(`| ${Qe(F.name)} | ${q} | ${Qe(F.status)} | ${Qe($)} |${k?` ${ge?ee().videoDownloadLink(ge):"\u2014"} |`:""}`)}f()}if(d){let Q=e.issuesFound.filter(F=>!wS(F)).sort(bS),k=e.issuesFound.filter(wS).sort(bS);if(Q.length){g(ee().staged.issuesFoundHeader);for(let F of Q)p.push(RS(F));f()}if(k.length){p.push(`### ${ee().configErrorsHeader}`);for(let F of k)p.push(RS(F));p.push("")}}let S=e.testPackages??[],C=e.dependencyChanges??[];if(S.length){p.push(ee().staged.testPackagesHeader,"");for(let Q of S)p.push(`- ${ee().staged.testPackageLine(Q.directory,Q.entrypoint)}`);C.length||p.push(`- ${ee().staged.appManifestsUntouched}`),p.push("")}if(C.length){p.push(ee().staged.dependencyChangesHeader,"");for(let Q of C)p.push(`- ${ee().staged.dependencyChangeLine(Q.package,Q.repository?`${Q.repository}: ${Q.manifest}`:Q.manifest,(Q.reason??"").replace(/\s+/g," ").trim())}`);p.push("")}let T=(e.caveats??[]).filter(Q=>Q.kind!=="tests-not-executed"||!kS(e));if(T.length){p.push(ee().staged.caveatsHeader,"");for(let Q of T)p.push(`- ${Q.text}`);p.push("")}if(d&&e.nextSteps.length){p.push(ee().nextStepsHeader,"");for(let Q of e.nextSteps)p.push(`- ${Q.trim()}`);p.push("")}return p.join(`
|
|
96
96
|
`).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.259",
|
|
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.",
|