@skyramp/testbot-core 0.13.2-v3.501 → 0.13.2-v3.503

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/post.js CHANGED
@@ -262,7 +262,7 @@ try { runtime = require("@skyramp/testbot-core/dist/shared-environment-test.cjs"
262
262
  if (runtime && typeof runtime.sharedEnvironmentTest === "function") runtime.sharedEnvironmentTest(spec, __filename);
263
263
  else require("node:test").test(spec.name, () => { throw new Error("required shared-environment guard runtime is unavailable"); });
264
264
  `;function Pg(e){return gD+JSON.stringify(qZ.parse(e),null,2)+mD}function Ca(e){if(e.includes("\r")){if(/(?:^|[^\r])\n|\r(?!\n)/.test(e))return;e=e.replace(/\r\n/g,`
265
- `)}if(!(!e.startsWith(gD)||!e.endsWith(mD)))try{let t=qZ.safeParse(JSON.parse(e.slice(gD.length,-mD.length)));return t.success&&Pg(t.data)===e?t.data:void 0}catch{return}}var Og=l.string().trim().min(1),hIe=l.object({cwd:Og.describe(`directory the command starts in, relative to the test's checkout ("." for its root)`),argv:l.array(Og).min(1).describe("the command as separate arguments, run without a shell"),env:l.record(l.string(),l.string()).optional().describe("plain settings the listing needs beyond the CI step's own; never a credential or PATH")}),JZ=l.object({file:Og.describe("a file of the test's checkout, relative to its root"),line:Og.describe("a line of that file, quoted exactly from where its command starts to its end")}),WZ=l.object({collected:l.boolean().describe("whether the repo's CI runs this test as it is"),steps:l.array(JZ).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:l.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:hIe.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:l.string().optional().describe("when not collected: why the repo's CI will not run it"),needs:l.array(Og).optional().describe("what the test needs running outside its own process (the app, a database, another service), one entry each; omit when it needs none"),starts:l.array(JZ).optional().describe("when collected and it needs any: the line that starts each of those in the CI job that runs it, in a file of ci.steps")});var de=l.string().trim().min(1),bIe=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},wIe=l.preprocess(bIe,l.object({id:de.describe(`its requirement's id plus a letter, e.g. "R1a", "AC-3a"`),clause:de.describe("one testable part of the requirement"),expected:de.describe("the outcome the requirement calls for \u2014 taken from the requirement, never from what the code does"),skip:l.string().optional().describe("only when no test can check this clause here: why"),type:l.nativeEnum(Us).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:l.string().optional().describe('its "METHOD /path", or the page / flow'),steps:l.string().optional().describe("what that test does; its expected outcome is this clause's"),finding:l.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:l.string().optional().describe("path:line of the code that decides this clause, when there is one; in another repo of the change, that repo's directory name then its path"),stated:l.string().optional().describe("the description's or spec's own words that state this clause, copied exactly, when they do"),mutates:l.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:l.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:l.string().optional().describe("browserOnly, off the runtime path: the path of the repo's in-process browser suite its test goes in (e.g. a Django StaticLiveServerTestCase test that drives Selenium)"),quote:l.string().optional().describe("the words of the spec, plan, ticket, PR description or a test the change adds or edits that state this clause, copied exactly; a file of the repository: its path:line first. Leave it out when no source states it"),inferred:l.boolean().optional().describe("leave it out: Testbot sets it when no source states this clause (contracts/clause-grounding.ts)")})),ZZ=l.object({spec:l.string().optional().describe("file:line of a spec in the repository"),prDescription:l.boolean().optional().describe("or true when a pull request description says otherwise"),reference:l.string().optional().describe("or the key of an item the run was given, as listed"),says:de.describe("what it says there, in its own words, copied exactly"),criterion:l.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`}),IIe=l.object({id:de.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:de,source:l.nativeEnum(bi).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:l.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:de.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:l.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"),alsoFrom:l.array(l.object({reference:de.regex(Wo).describe("the key of another uploaded document stating the same obligation"),says:de.describe("that document's own words, copied exactly; never infer equivalence from a shared criterion number"),criterion:l.number().int().positive().optional().describe("leave out; Testbot grounds and numbers this source separately")})).optional().describe("equivalent uploaded source criteria sharing this requirement's planned cases; retain every source with its own quote. Different conditions or boundaries need distinct requirements"),notInChange:l.string().optional().describe("requirement-reference only: when the PR description or the item defers this criterion to a later change, the words that defer it, copied exactly; give it no clauses. Never for words that only say what this change covers, or only because no changed file holds its code"),unchanged:l.boolean().optional().describe("true when it asks only that behaviour stay as it was (an update or refactor that must not change how something works), whatever its source"),overrules:l.array(ZZ).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:l.array(wIe)}),KZ=(r=>(r.ServerError="server-error",r.DataLost="data-lost",r.FinalState="final-state",r.DerivedValues="derived-values",r))(KZ||{}),CIe=l.object({id:de.describe('e.g. "F1"'),file:de,line:l.number().optional(),claim:de.describe("the defect, in one sentence"),severity:l.nativeEnum(vu),evidence:de.describe("the code line, or the probe request and response, that shows it"),conflictsWith:l.array(de).optional().describe("requirement or clause ids it violates"),keeps:l.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:l.nativeEnum(KZ).optional().describe("for a defect that breaks a rule every app keeps, which nothing needs to state: which one"),existing:l.string().optional().describe("only when the base already does this, in code the change left as it was, and the change does not say it fixes it: where the base does it (its file:line); such a defect gets no case"),needsApp:l.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)")}),SIe=l.object({id:de.describe('e.g. "Q1"'),question:de.describe("what is unsettled, as a question the PR author can answer"),readings:l.array(de).min(2).describe("each reasonable behaviour, with what points to it (file:line, or the words that suggest it)"),about:l.string().optional().describe("the requirement or clause id it is about, when there is one"),sources:l.array(ZZ).optional().describe("when sources of the same rank disagree on it: each of them")}),kIe=l.object({id:de.describe('unique, a short kebab-case name for what the case checks, e.g. "ship-twice-409"'),type:l.nativeEnum(Us).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:de.describe('"METHOD /path", or the page / flow'),clause:l.string().optional().describe("the clause id this case checks"),finding:l.string().optional().describe("the finding id this case catches"),steps:de.describe("what the test does"),expected:de.describe("the expected outcome, from the clause"),mutates:l.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")}),RIe=l.object({test:de.describe("existing test file"),action:l.nativeEnum(Ei),reason:de,mutates:l.boolean().optional().describe("true when the maintained test changes state"),clauses:l.array(de).optional().describe("the clause ids this test checks"),staleOnBase:l.boolean().optional().describe("true when the test's own expectation was already wrong before this change: it fails the same way on the base branch, where the app does what it should. Not one the base app's own bug fails (that is an existing defect). It is verify, never update: re-run as it is, its failure the test's own. A delete the change justifies stays a delete")}),YZ=l.array(eE).optional(),BIe=l.object({components:l.preprocess(e=>YZ.safeParse(e).success?e:void 0,YZ).describe("when saving a new or changed recipe: every app and backing service actually brought up, its source repository, and whether it is healthy"),outcome:l.nativeEnum(Lr).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:l.record(l.string()).optional().describe("service \u2192 base URL of the running app"),health:l.object({url:l.string().optional(),command:l.string().optional(),output:l.string().optional()}).optional().describe("the check that shows the app serves real data, and what it returned"),teardown:l.string().optional().describe("command that stops the app"),dependencies:l.record(l.boolean()).optional().describe("every backing service: true = really running, false = mocked"),recipeFixes:l.array(l.string()).optional().describe("what you changed in the recipe"),error:l.string().optional().describe("when it did not come up: the failing command and what it printed"),suspectFiles:l.array(l.string()).optional().describe("change-broke-bringup: the changed files to blame"),missingSecrets:l.array(l.string().regex(Tf)).optional().describe("bringup-failed only: each secret, key, token or password the app cannot start without that this run has no value for, by its environment variable name; never a value"),login:l.object({username:de,password:l.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:AR.optional()}),z1e=l.object({schemaVersion:l.literal(1),requirements:l.array(IIe),findings:l.array(CIe),cases:l.array(kIe).describe("a second test for a clause, and one case per finding that fails on this branch"),questions:l.array(SIe).optional().describe("behaviours the change leaves unsettled; no case asserts any of them"),maintenance:l.array(RIe),journeys:l.array($Z).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:l.array(l.object({clause:de,why:de})).optional().describe("a clause a user sees or does that no journey walks, and why: none can reach it through the UI, or it is downstream of this change and not walked here"),browserSuites:l.array(l.object({repository:de.optional().describe("owner/repo, for a checkout other than the working one"),path:de.describe("the folder its browser tests are in, relative to that checkout"),framework:de.describe("what runs them, the way the repo's CI or docs run them")})).default([]).describe("the repository's own browser test suites; empty when it has none"),unplannedComponents:l.array(l.object({components:l.array(de).min(1).describe("changed components, as the change lists them"),why:de})).optional().describe("changed components no clause reaches, and why their change needs no test; several may share one reason"),triage:_g.optional().describe("the validation triage decision, made before the app is started; its behaviorIds are clause ids"),app:BIe.optional().describe("omit when no app was needed or none was started"),summary:de.describe("one paragraph: what the change does and where the risk is")});var Ug=(n=>(n.Backend="backend",n.Ui="ui",n))(Ug||{});var Ms=(r=>(r.Added="added",r.Updated="updated",r.Deleted="deleted",r.Unchanged="unchanged",r))(Ms||{}),xIe=l.object({file:de.describe("repo-relative path; in another repo of the change, that repo's directory name then its path"),kind:l.nativeEnum(Ug),change:l.nativeEnum(Ms).describe("added: a file you created; updated / deleted / unchanged: an existing test"),covers:l.array(l.string()).describe("the plan case or maintenance clause ids this file tests, each with its own result under result.cases"),guardedDelivery:bw.optional().describe("for a new test that calls the shared app: supply equivalent ordered HTTP requests and assertions only for one case and one test function in a .test.cjs file collected by node --test. The destination package must declare the exact released version of @skyramp/testbot-core used by this run. Use only CI variable names for credentials. Omit when the setup or steps cannot preserve the test; Testbot retains the source without a CI entry"),defect:l.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:l.object({requirement:de.describe("the requirement or clause id the change deliberately alters"),line:de.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 or deleted: why it is out of date"),staleOnBase:l.boolean().optional().describe("for an existing test that fails: true when it fails the same way on the base branch because its own expectation is wrong (the app there does what it should), so this change did not make it wrong. Not when the base app's own bug fails it: that is an existing defect. Leave it as it is (unchanged): its failure is the test's own"),failsOnBase:l.array(l.object({test:de.describe("its name, as its framework reports it"),failure:de.describe("the failure message it gave on the base branch")})).optional().describe("for a file that was there before this run, which you left as it was or only added tests to: the tests already in it that fail here and fail the same way on the base branch, so this change did not make them fail. Never a test you wrote or changed"),result:l.object({started:l.boolean().optional().describe("with exit null: true if this file's test command started (it was interrupted or timed out), false if it never started. Left out, Testbot counts it as possibly started, with its cleanup unknown"),exit:l.number().nullable().describe("exit code of your last run of this file; null if it could not be run"),cases:l.array(l.object({case:de,status:l.nativeEnum(Yn),environmentRestriction:de.optional().describe("for a skipped case whose test you wrote and could not run here: what this run lacks to run it (a build, a service, a database, a browser, an app). The test is still written; Testbot reports the case as not run. Never set it on a case that ran or for a time limit."),runtimeTargets:zf.optional().describe("HTTP(S) URLs this case actually exercised in its current run, from its request or browser evidence; omit for local in-process/mocked checks, never list the shared app merely because it is configured"),defect:l.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"),testProblem:pE.optional().describe("for a failing case marked defect: false: what in the test is at fault"),failure:l.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:l.string().optional().describe("for a case you keep as a defect: path:line of the application code that makes it fail"),requires:l.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")}).refine(e=>!e.environmentRestriction||e.status==="skip"&&!e.runtimeTargets?.length,{message:"an environment-restricted case must be skipped and have no runtimeTargets"})).describe("one entry per covered case, from the runner's own output; a case you could not run here has none: record it as skipped with its environmentRestriction"),details:l.string().optional().describe("what failed and why, or why it was not run"),noCases:l.string().optional().describe("for a failed run whose runner reported none of this file's tests (it failed to compile, import or collect): why")}),assertions:l.array(l.object({case:de,evidence:de})).optional().describe("per covered case, the assertion line that checks its expected outcome"),functions:l.array(l.object({name:de.describe("the test function as the runner names it within its file, without the file (test_x, TestClass::test_x, TestSuite/TestCase)"),cases:l.array(de).describe("the plan case or maintenance clause ids it checks"),testProblem:pE.optional().describe("for a function that fails because of the test itself, while another function keeps a case it checks as a defect: what in it is at fault")})).optional().describe("for a file you added or updated, or an existing test to maintain that lists clauses: each test function in it and the plan case or maintenance clause ids it checks"),skyramp:l.object({draft:l.union([l.string(),l.array(l.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:l.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:l.array(Gf).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:de.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:WZ.optional().describe("for a file you added or updated: whether the repo's CI will run it, and how you know"),run:wu.optional().describe(`for a file in ${Hd}, 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, trx or jest-json to ${jn}, or go-test-json); Testbot runs it before write ends and re-runs the tests with it`)}),$Ie=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},QIe=l.preprocess($Ie,l.object({description:de.describe("what is wrong and how to reproduce it: endpoint or page, input, what you got vs what was expected"),severity:l.nativeEnum(vu).optional(),sourceFile:l.string().optional().describe("the app file at fault"),sourceLine:l.number().optional(),tests:l.array(de).optional().describe("every test file that fails because of it: a defect several tests show is one issue"),finding:l.string().optional().describe("the plan's finding id, when it is one"),requirements:l.array(de).optional().describe("the plan's requirement or clause ids it violates")})),H1e=l.object({schemaVersion:l.literal(1),tests:l.array(xIe),notWritten:l.array(l.object({case:de,reason:de,coveredBy:l.object({file:de.describe("the test file, relative to the working checkout; prefix a related checkout as for tests[].file"),name:de.describe("the test function as the runner names it within its file, without the file (test_x, TestClass::test_x, TestSuite/TestCase)")}).optional().describe("only for an existing test triage independently linked to this exact case: its exact runner name (including class or describe titles). Testbot must finish re-running it with every result passed. If your own test covers the case, include the case in its covers and function cases instead")})).describe("every plan case no test covers, and why; also a maintenance clause that no function of its existing test asserts (it stays unproven)"),journeys:l.array(mw).optional().describe("one entry per planned user journey: the browser test that walks it end to end"),lint:l.object({command:l.string(),clean:l.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:l.array(l.object({package:de,manifest:de.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:de.optional().describe("owner/repo of the manifest's checkout; omit for the repo under test"),reason:de.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:l.array(de).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:l.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"),importerRun:wu.optional().describe("when you changed a module other test files import: the repository's own command for running its test files (its runner, its config, its folder); Testbot loads the files that reach your change with it and reports each; omit when you changed none"),commit:l.object({message:de.describe("subject line at most 72 characters, following the repository's commit-message checks"),prTitle:de.describe("at most 72 characters, following the repository's PR-title checks"),prBody:de.describe("what the tests cover and what they found")}),report:l.object({summary:de.describe("1-2 sentences for the PR author: does the change do what it says? No count of tests: the report gives it"),issues:l.array(QIe).describe("every defect the tests found"),nextSteps:l.array(l.string()),noTests:l.array(l.object({repository:de,reason:de.max(4096)})).max(1e3).optional().describe("each Change Set repository where no test was added or updated: its owner/repo and why, naming the other repository when its tests went there"),notesDeviation:l.string().trim().max(4096).optional().describe("when the Target notes say where tests go and a test you added went elsewhere: where it went, and why; omit otherwise")})});var q1e={added:"place",updated:"update",deleted:"delete",unchanged:"verify"};function uo(e){return e.rel!==""&&!e.rel.startsWith("..")&&!un.isAbsolute(e.rel)}function wi(e,t,n=jZ){let s=t.map(d=>({name:XR(d),root:un.resolve(d.path),slug:d.slug})),r=new Map([...s].reverse().map(d=>[d.name,d])),i=t.length?[{real:QE(un.resolve(e))},...s.map(d=>({...d,real:QE(d.root)}))].sort((d,p)=>p.real.length-d.real.length):[],o=new Map,a=d=>o.get(d)??o.set(d,new Set(n(d))).get(d),c=d=>{let p=un.resolve(e,d),h=Fg.existsSync(p),g=C=>({root:e,rel:Yi(e,d),ambiguous:C,exists:h});if(!t.length)return g(!1);let m=!1,y=d.replace(/^\.\//,""),E=y.split("/")[0],v=r.get(E);if(v){let C=y.slice(E.length+1),I=Fg.existsSync(un.join(v.root,C)),x=!Fg.existsSync(un.join(e,E))||!h&&I;if(I&&h&&un.join(v.root,C)!==p){let S=a(v.root).has(Yi(v.root,C)),J=a(e).has(Yi(e,d));S&&!J?x=!0:S===J&&(m=!0)}if(x)return{root:v.root,rel:Yi(v.root,C),repository:v.slug,dir:v.name,ambiguous:m,exists:I}}let b=un.join(QE(un.dirname(p)),un.basename(p)),w=i.find(C=>uo({rel:un.relative(C.real,b)}));return w?"slug"in w?{root:w.root,rel:un.relative(w.real,b),repository:w.slug,dir:w.name,ambiguous:m,exists:h}:{...g(m),rel:un.relative(w.real,b)}:g(m)},u=new Map;return d=>u.get(d)??u.set(d,c(d)).get(d)}var tK=(s=>(s.Requirement="requirement",s.PrDescription="pr_description",s.Code="code",s))(tK||{}),Bn=l.string().trim().min(1),_Ie=l.object({expectation:Bn.max(300).describe("the behavior this assertion pins, in words"),source:l.nativeEnum(tK),expected:Bn.max(200).describe("the exact value or outcome asserted, as the test asserts it")}),DIe=l.object({file:Bn.describe("path of the NEW test file you wrote, relative to its repository"),repository:Bn.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),framework:Bn.describe("the framework the repository runs this file with: pytest, jest, vitest, node-test, or the name of any other"),run:wu.optional().describe(`for ${Hd}: how the run executes only the tests in names, with the repository's own runner writing JUnit XML to {junit}`),covers:l.array(Bn).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:l.array(Bn).min(1).describe("the test functions/cases in the file that provide evidence for that behavior, as the framework names them"),assertions:l.array(_Ie).min(1)}),Mg=(n=>(n.Updated="updated",n.Deleted="deleted",n))(Mg||{}),eK=300,NIe=l.object({file:Bn.describe("path of the EXISTING test file you updated or deleted, relative to its repository"),repository:Bn.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),change:l.nativeEnum(Mg),staleBecause:l.object({requirement:Bn.describe("the requirement or clause id the change deliberately alters"),line:Bn.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:l.preprocess(e=>typeof e=="string"?e.trim().slice(0,eK):e,Bn.max(eK)).describe("what the change deliberately altered that made the test wrong")}),AD=l.object({schemaVersion:l.literal(1),tests:l.array(DIe),maintained:l.array(NIe).optional().describe("existing tests the change made stale that you updated or deleted; omit when there were none"),defectsNotTested:l.array(l.object({id:Bn,reason:Bn.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:l.array(mw).optional().describe("one entry per planned user journey: the in-process test that walks it end to end"),journeysNotWritten:l.array(l.object({journey:Bn,missing:Bn.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:l.object({command:l.string(),clean:l.boolean()}).optional().describe("the linter/formatter you ran on your test files, if the repository has one you can run; omit otherwise"),commitMessage:Bn.optional().describe("the commit message for your tests: a subject line of at most 72 characters, then what they cover")});var Lg="generate-unit.json";function FIe(e){let{value:t,error:n}=Jt(e);if(n)return{errors:[n]};let{value:s,errors:r}=Fn(AD,t);return r.length?{errors:r}:{output:s,errors:[]}}function UIe(e){return FIe(e.stdout)}var LVe=yr("generate-unit-schema",(e,t)=>UIe(t));var ww=String.raw`(?:node:)?(?:http|https|http2|net|tls|dgram)`,jVe=[[/\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+["']${ww}["']|\bimport\s+["']${ww}["']|require\(\s*["']${ww}["']\s*\)|\bimport\(\s*["']${ww}["']\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 uGe=new Set(["targeted_unit","existing_evidence_sufficient"]);var Sa=Y(require("path"));var CGe={"application/pdf":"PDF","text/csv":"CSV","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"};var yD=e=>new Map((e??[]).flatMap(t=>t.file?[[Uf(t.key),t.file.name]]:[])),jIe=10*1024*1024,VIe=e=>e?.mediaType==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"||e?.mediaType==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",aK=(e,t)=>Sa.join(Sa.dirname(e),`${Sa.basename(e,Sa.extname(e))}${t}`),GIe=e=>aK(e,".extracted.txt");var zIe=e=>aK(e,".quotes.txt");function cK(e){return VIe(e.file)?GIe(e.path):e.file?.mediaType==="application/pdf"?zIe(e.path):e.path}var YIe="triage.json";var Sze=new Set(["existing_evidence","unaffected","existing_unit","new_unit","runtime"]),kze={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 ZIe(e){let{value:t,error:n}=Jt(e);if(n)return{errors:[n]};let{value:s,errors:r}=Fn(_g,t);return r.length?{errors:r}:{triage:s,errors:[]}}function KIe(e){return ZIe(e.stdout)}var Rze=yr("triage-schema",(e,t)=>KIe(t));function XIe(e){let t=e.inputs?.pipeline;return t?e.state.stages[t==="two-step"?"plan":"triage"]:e.state.stages.triage??e.state.stages.plan}function ED(e){if(XIe(e)?.status==="passed")return pi(lK.join(e.outputsDir,YIe))}function vD(e){return aZ(q_(e.inputs,Ce(e,`${Gd}.json`),ED(e)?.sutRequired))}var Bze=new Set(["deploy","recommend","generate","generate-ui","adapt","generate-unit","native-run","finalize","deliver"]);_n();_n();function dK(e,t){return t?`<!-- skyramp-testbot-run: ${t} -->
265
+ `)}if(!(!e.startsWith(gD)||!e.endsWith(mD)))try{let t=qZ.safeParse(JSON.parse(e.slice(gD.length,-mD.length)));return t.success&&Pg(t.data)===e?t.data:void 0}catch{return}}var Og=l.string().trim().min(1),hIe=l.object({cwd:Og.describe(`directory the command starts in, relative to the test's checkout ("." for its root)`),argv:l.array(Og).min(1).describe("the command as separate arguments, run without a shell"),env:l.record(l.string(),l.string()).optional().describe("plain settings the listing needs beyond the CI step's own; never a credential or PATH")}),JZ=l.object({file:Og.describe("a file of the test's checkout, relative to its root"),line:Og.describe("a line of that file, quoted exactly from where its command starts to its end")}),WZ=l.object({collected:l.boolean().describe("whether the repo's CI runs this test as it is"),steps:l.array(JZ).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:l.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:hIe.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:l.string().optional().describe("when not collected: why the repo's CI will not run it"),needs:l.array(Og).optional().describe("what the test needs running outside its own process (the app, a database, another service), one entry each; omit when it needs none"),starts:l.array(JZ).optional().describe("when collected and it needs any: the line that starts each of those in the CI job that runs it, in a file of ci.steps")});var de=l.string().trim().min(1),bIe=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},wIe=l.preprocess(bIe,l.object({id:de.describe(`its requirement's id plus a letter, e.g. "R1a", "AC-3a"`),clause:de.describe("one testable part of the requirement"),expected:de.describe("the outcome the requirement calls for \u2014 taken from the requirement, never from what the code does"),skip:l.string().optional().describe("only when no test can check this clause here: why"),type:l.nativeEnum(Us).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:l.string().optional().describe('its "METHOD /path", or the page / flow'),steps:l.string().optional().describe("what that test does; its expected outcome is this clause's"),finding:l.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:l.string().optional().describe("path:line of the code that decides this clause, when there is one; in another repo of the change, that repo's directory name then its path"),stated:l.string().optional().describe("the description's or spec's own words that state this clause, copied exactly, when they do"),mutates:l.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:l.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:l.string().optional().describe("browserOnly, off the runtime path: the path of the repo's in-process browser suite its test goes in (e.g. a Django StaticLiveServerTestCase test that drives Selenium)"),quote:l.string().optional().describe("the words of the spec, plan, ticket, PR description or a test the change adds or edits that state this clause, copied exactly; a file of the repository: its path:line first. Leave it out when no source states it"),inferred:l.boolean().optional().describe("leave it out: Testbot sets it when no source states this clause (contracts/clause-grounding.ts)")})),ZZ=l.object({spec:l.string().optional().describe("file:line of a spec in the repository"),prDescription:l.boolean().optional().describe("or true when a pull request description says otherwise"),reference:l.string().optional().describe("or the key of an item the run was given, as listed"),says:de.describe("what it says there, in its own words, copied exactly"),criterion:l.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`}),IIe=l.object({id:de.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:de,source:l.nativeEnum(bi).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:l.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:de.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:l.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"),alsoFrom:l.array(l.object({reference:de.regex(Wo).describe("the key of another uploaded document stating the same obligation"),says:de.describe("that document's own words, copied exactly; never infer equivalence from a shared criterion number"),criterion:l.number().int().positive().optional().describe("leave out; Testbot grounds and numbers this source separately")})).optional().describe("equivalent uploaded source criteria sharing this requirement's planned cases; retain every source with its own quote. Different conditions or boundaries need distinct requirements"),notInChange:l.string().optional().describe("requirement-reference only: when the PR description or the item defers this criterion to a later change, the words that defer it, copied exactly; give it no clauses. Never for words that only say what this change covers, or only because no changed file holds its code"),unchanged:l.boolean().optional().describe("true when it asks only that behaviour stay as it was (an update or refactor that must not change how something works), whatever its source"),overrules:l.array(ZZ).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:l.array(wIe)}),KZ=(r=>(r.ServerError="server-error",r.DataLost="data-lost",r.FinalState="final-state",r.DerivedValues="derived-values",r))(KZ||{}),CIe=l.object({id:de.describe('e.g. "F1"'),file:de,line:l.number().optional(),claim:de.describe("the defect, in one sentence"),severity:l.nativeEnum(vu),evidence:de.describe("the code line, or the probe request and response, that shows it"),conflictsWith:l.array(de).optional().describe("requirement or clause ids it violates"),keeps:l.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:l.nativeEnum(KZ).optional().describe("for a defect that breaks a rule every app keeps, which nothing needs to state: which one"),existing:l.string().optional().describe("only when the base already does this, in code the change left as it was, and the change does not say it fixes it: where the base does it (its file:line); such a defect gets no case"),needsApp:l.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)")}),SIe=l.object({id:de.describe('e.g. "Q1"'),question:de.describe("what is unsettled, as a question the PR author can answer"),readings:l.array(de).min(2).describe("each reasonable behaviour, with what points to it (file:line, or the words that suggest it)"),about:l.string().optional().describe("the requirement or clause id it is about, when there is one"),sources:l.array(ZZ).optional().describe("when sources of the same rank disagree on it: each of them")}),kIe=l.object({id:de.describe('unique, a short kebab-case name for what the case checks, e.g. "ship-twice-409"'),type:l.nativeEnum(Us).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:de.describe('"METHOD /path", or the page / flow'),clause:l.string().optional().describe("the clause id this case checks"),finding:l.string().optional().describe("the finding id this case catches"),steps:de.describe("what the test does"),expected:de.describe("the expected outcome, from the clause"),mutates:l.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")}),RIe=l.object({test:de.describe("existing test file"),action:l.nativeEnum(Ei),reason:de,mutates:l.boolean().optional().describe("true when the maintained test changes state"),clauses:l.array(de).optional().describe("the clause ids this test checks"),staleOnBase:l.boolean().optional().describe("true when the test's own expectation was already wrong before this change: it fails the same way on the base branch, where the app does what it should. Not one the base app's own bug fails (that is an existing defect). It is verify, never update: re-run as it is, its failure the test's own. A delete the change justifies stays a delete")}),YZ=l.array(eE).optional(),BIe=l.object({components:l.preprocess(e=>YZ.safeParse(e).success?e:void 0,YZ).describe("when saving a new or changed recipe: every app and backing service actually brought up, its source repository, and whether it is healthy"),outcome:l.nativeEnum(Lr).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:l.record(l.string()).optional().describe("service \u2192 base URL of the running app"),health:l.object({url:l.string().optional(),command:l.string().optional(),output:l.string().optional()}).optional().describe("the check that shows the app serves real data, and what it returned"),teardown:l.string().optional().describe("command that stops the app"),dependencies:l.record(l.boolean()).optional().describe("every backing service: true = really running, false = mocked"),recipeFixes:l.array(l.string()).optional().describe("what you changed in the recipe"),error:l.string().optional().describe("when it did not come up: the failing command and what it printed"),suspectFiles:l.array(l.string()).optional().describe("change-broke-bringup: the changed files to blame"),missingSecrets:l.array(l.string().regex(Tf)).optional().describe("bringup-failed only: each secret, key, token or password the app cannot start without that this run has no value for, by its environment variable name; never a value"),login:l.object({username:de,password:l.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:AR.optional()}),z1e=l.object({schemaVersion:l.literal(1),requirements:l.array(IIe),findings:l.array(CIe),cases:l.array(kIe).describe("a second test for a clause, and one case per finding that fails on this branch"),questions:l.array(SIe).optional().describe("behaviours the change leaves unsettled; no case asserts any of them"),maintenance:l.array(RIe),journeys:l.array($Z).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:l.array(l.object({clause:de,why:de})).optional().describe("a clause a user sees or does that no journey walks, and why: none can reach it through the UI, or it is downstream of this change and not walked here"),browserSuites:l.array(l.object({repository:de.optional().describe("owner/repo, for a checkout other than the working one"),path:de.describe("the folder its browser tests are in, relative to that checkout"),framework:de.describe("what runs them, the way the repo's CI or docs run them")})).default([]).describe("the repository's own browser test suites; empty when it has none"),unplannedComponents:l.array(l.object({components:l.array(de).min(1).describe("changed components, as the change lists them"),why:de})).optional().describe("changed components no clause reaches, and why their change needs no test; several may share one reason"),triage:_g.optional().describe("the validation triage decision, made before the app is started; its behaviorIds are clause ids"),app:BIe.optional().describe("omit when no app was needed or none was started"),summary:de.describe("one paragraph: what the change does and where the risk is")});var Ug=(n=>(n.Backend="backend",n.Ui="ui",n))(Ug||{});var Ms=(r=>(r.Added="added",r.Updated="updated",r.Deleted="deleted",r.Unchanged="unchanged",r))(Ms||{}),xIe=l.object({file:de.describe("repo-relative path; in another repo of the change, that repo's directory name then its path"),kind:l.nativeEnum(Ug),change:l.nativeEnum(Ms).describe("added: a file you created; updated / deleted / unchanged: an existing test"),covers:l.array(l.string()).describe("the plan case or maintenance clause ids this file tests, each with its own result under result.cases"),guardedDelivery:bw.optional().describe("for a new test that calls the shared app: supply equivalent ordered HTTP requests and assertions only for one case and one test function in a .test.cjs file collected by node --test. The destination package must declare the exact released version of @skyramp/testbot-core used by this run. Use only CI variable names for credentials. Omit when the setup or steps cannot preserve the test; Testbot retains the source without a CI entry"),defect:l.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:l.object({requirement:de.describe("the requirement or clause id the change deliberately alters"),line:de.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 or deleted: why it is out of date"),staleOnBase:l.boolean().optional().describe("for an existing test that fails: true when it fails the same way on the base branch because its own expectation is wrong (the app there does what it should), so this change did not make it wrong. Not when the base app's own bug fails it: that is an existing defect. Leave it as it is (unchanged): its failure is the test's own"),failsOnBase:l.array(l.object({test:de.describe("its name, as its framework reports it"),failure:de.describe("the failure message it gave on the base branch")})).optional().describe("for a file that was there before this run, which you left as it was or only added tests to: the tests already in it that fail here and fail the same way on the base branch, so this change did not make them fail. Never a test you wrote or changed"),result:l.object({started:l.boolean().optional().describe("with exit null: true if this file's test command started (it was interrupted or timed out), false if it never started. Left out, Testbot counts it as possibly started, with its cleanup unknown"),exit:l.number().nullable().describe("exit code of your last run of this file; null if it could not be run"),cases:l.array(l.object({case:de,status:l.nativeEnum(Yn),environmentRestriction:de.optional().describe("for a skipped case whose test you wrote and could not run here: what this run lacks to run it (a build, a service, a database, a browser, an app). The test is still written; Testbot reports the case as not run. Never set it on a case that ran or for a time limit."),runtimeTargets:zf.optional().describe("HTTP(S) URLs this case actually exercised in its current run, from its request or browser evidence; omit for local in-process/mocked checks, never list the shared app merely because it is configured"),defect:l.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"),testProblem:pE.optional().describe("for a failing case marked defect: false: what in the test is at fault"),failure:l.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:l.string().optional().describe("for a case you keep as a defect: path:line of the application code that makes it fail"),requires:l.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")}).refine(e=>!e.environmentRestriction||e.status==="skip"&&!e.runtimeTargets?.length,{message:"an environment-restricted case must be skipped and have no runtimeTargets"})).describe("one entry per covered case, from the runner's own output; a case you could not run here has none: record it as skipped with its environmentRestriction"),details:l.string().optional().describe("what failed and why, or why it was not run"),noCases:l.string().optional().describe("for a failed run whose runner reported none of this file's tests (it failed to compile, import or collect): why")}),assertions:l.array(l.object({case:de,evidence:de})).optional().describe("per covered case, the assertion line that checks its expected outcome"),functions:l.array(l.object({name:de.describe("the test function as the runner names it within its file, without the file (test_x, TestClass::test_x, TestSuite/TestCase)"),cases:l.array(de).describe("the plan case or maintenance clause ids it checks"),testProblem:pE.optional().describe("for a function that fails because of the test itself, while another function keeps a case it checks as a defect: what in it is at fault")})).optional().describe("for a file you added or updated, or an existing test to maintain that lists clauses: each test function in it and the plan case or maintenance clause ids it checks"),skyramp:l.object({draft:l.union([l.string(),l.array(l.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:l.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:l.array(Gf).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:de.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:WZ.optional().describe("for a file you added or updated: whether the repo's CI will run it, and how you know"),run:wu.optional().describe(`for a file in ${Hd}, 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, trx or jest-json to ${jn}, or go-test-json); Testbot runs it before write ends and re-runs the tests with it`)}),$Ie=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},QIe=l.preprocess($Ie,l.object({description:de.describe("what is wrong and how to reproduce it: endpoint or page, input, what you got vs what was expected"),severity:l.nativeEnum(vu).optional(),sourceFile:l.string().optional().describe("the app file at fault"),sourceLine:l.number().optional(),tests:l.array(de).optional().describe("every test file that fails because of it: a defect several tests show is one issue"),finding:l.string().optional().describe("the plan's finding id, when it is one"),requirements:l.array(de).optional().describe("the plan's requirement or clause ids it violates")})),H1e=l.object({schemaVersion:l.literal(1),tests:l.array(xIe),notWritten:l.array(l.object({case:de,reason:de,coveredBy:l.object({file:de.describe("the test file, relative to the working checkout; prefix a related checkout as for tests[].file"),name:de.describe("the test function as the runner names it within its file, without the file (test_x, TestClass::test_x, TestSuite/TestCase)")}).optional().describe("only for an existing test triage independently linked to this exact case: its exact runner name (including class or describe titles). Testbot must finish re-running it with every result passed. If your own test covers the case, include the case in its covers and function cases instead")})).describe("every plan case no test covers, and why; also a maintenance clause that no function of its existing test asserts (it stays unproven)"),journeys:l.array(mw).optional().describe("one entry per planned user journey: the browser test that walks it end to end"),checks:l.array(l.object({command:l.string().describe("the exact command you ran on your files, with their paths, as run from the repository root: cd <folder> && first when you ran it in a folder"),source:l.string().describe("where the repository runs or configures this check: path:line, then its words copied exactly"),clean:l.boolean().describe("false when it still reports something in your files, or stopped before checking any")})).optional().describe("each lint, format or type check the repository runs or keeps a config for on files like yours; Testbot runs each again"),dependenciesAdded:l.array(l.object({package:de,manifest:de.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:de.optional().describe("owner/repo of the manifest's checkout; omit for the repo under test"),reason:de.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:l.array(de).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:l.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"),importerRun:wu.optional().describe("when you changed a module other test files import: the repository's own command for running its test files (its runner, its config, its folder); Testbot loads the files that reach your change with it and reports each; omit when you changed none"),commit:l.object({message:de.describe("subject line at most 72 characters, following the repository's commit-message checks"),prTitle:de.describe("at most 72 characters, following the repository's PR-title checks"),prBody:de.describe("what the tests cover and what they found")}),report:l.object({summary:de.describe("1-2 sentences for the PR author: does the change do what it says? No count of tests: the report gives it"),issues:l.array(QIe).describe("every defect the tests found"),nextSteps:l.array(l.string()),noTests:l.array(l.object({repository:de,reason:de.max(4096)})).max(1e3).optional().describe("each Change Set repository where no test was added or updated: its owner/repo and why, naming the other repository when its tests went there"),notesDeviation:l.string().trim().max(4096).optional().describe("when the Target notes say where tests go and a test you added went elsewhere: where it went, and why; omit otherwise")})});var q1e={added:"place",updated:"update",deleted:"delete",unchanged:"verify"};function uo(e){return e.rel!==""&&!e.rel.startsWith("..")&&!un.isAbsolute(e.rel)}function wi(e,t,n=jZ){let s=t.map(d=>({name:XR(d),root:un.resolve(d.path),slug:d.slug})),r=new Map([...s].reverse().map(d=>[d.name,d])),i=t.length?[{real:QE(un.resolve(e))},...s.map(d=>({...d,real:QE(d.root)}))].sort((d,p)=>p.real.length-d.real.length):[],o=new Map,a=d=>o.get(d)??o.set(d,new Set(n(d))).get(d),c=d=>{let p=un.resolve(e,d),h=Fg.existsSync(p),g=C=>({root:e,rel:Yi(e,d),ambiguous:C,exists:h});if(!t.length)return g(!1);let m=!1,y=d.replace(/^\.\//,""),E=y.split("/")[0],v=r.get(E);if(v){let C=y.slice(E.length+1),I=Fg.existsSync(un.join(v.root,C)),x=!Fg.existsSync(un.join(e,E))||!h&&I;if(I&&h&&un.join(v.root,C)!==p){let S=a(v.root).has(Yi(v.root,C)),J=a(e).has(Yi(e,d));S&&!J?x=!0:S===J&&(m=!0)}if(x)return{root:v.root,rel:Yi(v.root,C),repository:v.slug,dir:v.name,ambiguous:m,exists:I}}let b=un.join(QE(un.dirname(p)),un.basename(p)),w=i.find(C=>uo({rel:un.relative(C.real,b)}));return w?"slug"in w?{root:w.root,rel:un.relative(w.real,b),repository:w.slug,dir:w.name,ambiguous:m,exists:h}:{...g(m),rel:un.relative(w.real,b)}:g(m)},u=new Map;return d=>u.get(d)??u.set(d,c(d)).get(d)}var tK=(s=>(s.Requirement="requirement",s.PrDescription="pr_description",s.Code="code",s))(tK||{}),Bn=l.string().trim().min(1),_Ie=l.object({expectation:Bn.max(300).describe("the behavior this assertion pins, in words"),source:l.nativeEnum(tK),expected:Bn.max(200).describe("the exact value or outcome asserted, as the test asserts it")}),DIe=l.object({file:Bn.describe("path of the NEW test file you wrote, relative to its repository"),repository:Bn.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),framework:Bn.describe("the framework the repository runs this file with: pytest, jest, vitest, node-test, or the name of any other"),run:wu.optional().describe(`for ${Hd}: how the run executes only the tests in names, with the repository's own runner writing JUnit XML to {junit}`),covers:l.array(Bn).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:l.array(Bn).min(1).describe("the test functions/cases in the file that provide evidence for that behavior, as the framework names them"),assertions:l.array(_Ie).min(1)}),Mg=(n=>(n.Updated="updated",n.Deleted="deleted",n))(Mg||{}),eK=300,NIe=l.object({file:Bn.describe("path of the EXISTING test file you updated or deleted, relative to its repository"),repository:Bn.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),change:l.nativeEnum(Mg),staleBecause:l.object({requirement:Bn.describe("the requirement or clause id the change deliberately alters"),line:Bn.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:l.preprocess(e=>typeof e=="string"?e.trim().slice(0,eK):e,Bn.max(eK)).describe("what the change deliberately altered that made the test wrong")}),AD=l.object({schemaVersion:l.literal(1),tests:l.array(DIe),maintained:l.array(NIe).optional().describe("existing tests the change made stale that you updated or deleted; omit when there were none"),defectsNotTested:l.array(l.object({id:Bn,reason:Bn.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:l.array(mw).optional().describe("one entry per planned user journey: the in-process test that walks it end to end"),journeysNotWritten:l.array(l.object({journey:Bn,missing:Bn.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:l.object({command:l.string(),clean:l.boolean()}).optional().describe("the linter/formatter you ran on your test files, if the repository has one you can run; omit otherwise"),commitMessage:Bn.optional().describe("the commit message for your tests: a subject line of at most 72 characters, then what they cover")});var Lg="generate-unit.json";function FIe(e){let{value:t,error:n}=Jt(e);if(n)return{errors:[n]};let{value:s,errors:r}=Fn(AD,t);return r.length?{errors:r}:{output:s,errors:[]}}function UIe(e){return FIe(e.stdout)}var LVe=yr("generate-unit-schema",(e,t)=>UIe(t));var ww=String.raw`(?:node:)?(?:http|https|http2|net|tls|dgram)`,jVe=[[/\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+["']${ww}["']|\bimport\s+["']${ww}["']|require\(\s*["']${ww}["']\s*\)|\bimport\(\s*["']${ww}["']\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 uGe=new Set(["targeted_unit","existing_evidence_sufficient"]);var Sa=Y(require("path"));var CGe={"application/pdf":"PDF","text/csv":"CSV","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"};var yD=e=>new Map((e??[]).flatMap(t=>t.file?[[Uf(t.key),t.file.name]]:[])),jIe=10*1024*1024,VIe=e=>e?.mediaType==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"||e?.mediaType==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",aK=(e,t)=>Sa.join(Sa.dirname(e),`${Sa.basename(e,Sa.extname(e))}${t}`),GIe=e=>aK(e,".extracted.txt");var zIe=e=>aK(e,".quotes.txt");function cK(e){return VIe(e.file)?GIe(e.path):e.file?.mediaType==="application/pdf"?zIe(e.path):e.path}var YIe="triage.json";var Sze=new Set(["existing_evidence","unaffected","existing_unit","new_unit","runtime"]),kze={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 ZIe(e){let{value:t,error:n}=Jt(e);if(n)return{errors:[n]};let{value:s,errors:r}=Fn(_g,t);return r.length?{errors:r}:{triage:s,errors:[]}}function KIe(e){return ZIe(e.stdout)}var Rze=yr("triage-schema",(e,t)=>KIe(t));function XIe(e){let t=e.inputs?.pipeline;return t?e.state.stages[t==="two-step"?"plan":"triage"]:e.state.stages.triage??e.state.stages.plan}function ED(e){if(XIe(e)?.status==="passed")return pi(lK.join(e.outputsDir,YIe))}function vD(e){return aZ(q_(e.inputs,Ce(e,`${Gd}.json`),ED(e)?.sutRequired))}var Bze=new Set(["deploy","recommend","generate","generate-ui","adapt","generate-unit","native-run","finalize","deliver"]);_n();_n();function dK(e,t){return t?`<!-- skyramp-testbot-run: ${t} -->
266
266
  ${e}`:e}var fK=600,Cw=300;function pK(e){return typeof e=="string"?e.trim():e instanceof Buffer?e.toString("utf-8").trim():""}function tCe(e){let t=e,n=(typeof t?.message=="string"?t.message:String(e)).trim(),s=[pK(t?.stderr),pK(t?.stdout)].filter(Boolean);return s.length?[n.split(`
267
267
  `)[0],...s].join(`
268
268
  `):n}function hK(e,t,n,s=0){let r=e.join(t);if(r.length<=n)return r;let[i="",...o]=e;if(!o.length)return`${i.slice(0,n-1)}\u2026`;let a=i.length<=s?i:i.slice(0,Math.floor(n/3)),c=n-a.length-t.length-1;return`${a}${t}\u2026${o.join(t).slice(-c)}`}function gK(e,t){return hK(e.trim().split(`
@@ -254,7 +254,7 @@ try { runtime = require("@skyramp/testbot-core/dist/shared-environment-test.cjs"
254
254
  if (runtime && typeof runtime.sharedEnvironmentTest === "function") runtime.sharedEnvironmentTest(spec, __filename);
255
255
  else require("node:test").test(spec.name, () => { throw new Error("required shared-environment guard runtime is unavailable"); });
256
256
  `;function Wf(e){return fT+JSON.stringify(LH.parse(e),null,2)+AT}o(Wf,"renderDeliveredSharedTest");function Ro(e){if(e.includes("\r")){if(/(?:^|[^\r])\n|\r(?!\n)/.test(e))return;e=e.replace(/\r\n/g,`
257
- `)}if(!(!e.startsWith(fT)||!e.endsWith(AT)))try{let t=LH.safeParse(JSON.parse(e.slice(fT.length,-AT.length)));return t.success&&Wf(t.data)===e?t.data:void 0}catch{return}}o(Ro,"parseDeliveredSharedTest");var Zf=d.string().trim().min(1),Ime=d.object({cwd:Zf.describe(`directory the command starts in, relative to the test's checkout ("." for its root)`),argv:d.array(Zf).min(1).describe("the command as separate arguments, run without a shell"),env:d.record(d.string(),d.string()).optional().describe("plain settings the listing needs beyond the CI step's own; never a credential or PATH")}),jH=d.object({file:Zf.describe("a file of the test's checkout, relative to its root"),line:Zf.describe("a line of that file, quoted exactly from where its command starts to its end")}),GH=d.object({collected:d.boolean().describe("whether the repo's CI runs this test as it is"),steps:d.array(jH).optional().describe("when collected: the line in a CI file that starts the tests, then each line it runs on the way to the test runner"),runner:d.string().optional().describe("when collected: the test runner the last of those lines starts, by the name that line and the list command both use"),list:Ime.optional().describe("when collected: a command that lists the tests that runner collects without running them; Testbot runs it, and its output must name this file"),why:d.string().optional().describe("when not collected: why the repo's CI will not run it"),needs:d.array(Zf).optional().describe("what the test needs running outside its own process (the app, a database, another service), one entry each; omit when it needs none"),starts:d.array(jH).optional().describe("when collected and it needs any: the line that starts each of those in the CI job that runs it, in a file of ci.steps")});var wme=d.object({route:d.string().describe('the page this step happens on, e.g. "/products/:id"'),action:d.string().describe('what the user does there, through the UI, e.g. "clicks Add to cart"'),clauses:d.array(d.string()).optional().describe("the plan clause ids this step exercises"),check:d.string().optional().describe("what the user then sees that shows the step worked; the test asserts it")}),Kf=(n=>(n.InProcess="in-process",n.Browser="browser",n))(Kf||{}),zH=(i=>(i.Spec="spec",i.PrDescription="pr-description",i.Inferred="inferred",i))(zH||{}),qH=d.object({id:d.string().describe('e.g. "J1"'),name:d.string().describe(`the flow in a user's words, e.g. "buy a product with a coupon"`),entry:d.string().describe("the route the user starts the flow on: the app's normal starting page for it, never a deep link into its middle"),steps:d.array(wme).describe("every step, in order, from the entry page to the outcome: at least two"),outcome:d.string().describe("what the user sees at the end that shows the flow worked: every part of it"),finishes:d.string().optional().describe('the user action that completes the task, verb first, e.g. "places the order"; the journey walks on to it'),kind:d.nativeEnum(Kf).optional().describe("in-process when the repo's in-process tests (components, app routes) can walk the whole flow and check it; else browser"),source:d.nativeEnum(zH).optional().describe("spec or pr-description when one describes this flow (quote it under evidence), else inferred"),evidence:d.string().optional().describe("for spec or pr-description: its words that describe the flow"),testFile:d.string().describe("the browser test file it goes in, beside the repo's existing e2e tests")}),VE=d.object({journey:d.string().describe("the plan's journey id"),file:d.string().describe("the browser test file that walks it"),brokeAt:d.object({step:d.number().int().describe("the 1-based step whose check failed first"),expected:d.string(),actual:d.string().describe("what the app did instead, from the runner's output"),notReached:d.array(d.number().int()).optional().describe("later steps the test could not get to")}).optional().describe("only when the journey's test failed on a check: where"),test:d.string().describe("the title of the one test in that file that walks it end to end")});var MLe=Object.fromEntries([...["ts","tsx","mts","cts","js","jsx","mjs","cjs"].map(e=>[e,"node"]),...["java","kt","kts","groovy","scala"].map(e=>[e,"jvm"]),["py","python"],["go","go"]]);var LLe=["stale_test","open_question"],jLe=["low","medium","high","critical"];var ue=d.string().trim().min(1),Qme=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"),$me=d.preprocess(Qme,d.object({id:ue.describe(`its requirement's id plus a letter, e.g. "R1a", "AC-3a"`),clause:ue.describe("one testable part of the requirement"),expected:ue.describe("the outcome the requirement calls for \u2014 taken from the requirement, never from what the code does"),skip:d.string().optional().describe("only when no test can check this clause here: why"),type:d.nativeEnum(ii).optional().describe("the test that checks this clause: contract / integration (the API, or code called directly in-process: a function, hook or module) or ui (a page)"),target:d.string().optional().describe('its "METHOD /path", or the page / flow'),steps:d.string().optional().describe("what that test does; its expected outcome is this clause's"),finding:d.string().optional().describe("the finding id, when this clause's test also catches that defect (the defect still gets a case of its own)"),code:d.string().optional().describe("path:line of the code that decides this clause, when there is one; in another repo of the change, that repo's directory name then its path"),stated:d.string().optional().describe("the description's or spec's own words that state this clause, copied exactly, when they do"),mutates:d.boolean().optional().describe("true when its test changes state, in the test or its setup: an API POST, PUT, PATCH or DELETE, or a UI flow that submits, creates, edits or deletes"),browserOnly:d.boolean().optional().describe("true when its behaviour happens only in a browser: real clicks or keys driving page script, client-side sorting or filtering, script-driven DOM updates, focus, drag-and-drop, navigation, rendering that depends on CSS or JavaScript"),browserHarness:d.string().optional().describe("browserOnly, off the runtime path: the path of the repo's in-process browser suite its test goes in (e.g. a Django StaticLiveServerTestCase test that drives Selenium)"),quote:d.string().optional().describe("the words of the spec, plan, ticket, PR description or a test the change adds or edits that state this clause, copied exactly; a file of the repository: its path:line first. Leave it out when no source states it"),inferred:d.boolean().optional().describe("leave it out: Testbot sets it when no source states this clause (contracts/clause-grounding.ts)")})),HH=d.object({spec:d.string().optional().describe("file:line of a spec in the repository"),prDescription:d.boolean().optional().describe("or true when a pull request description says otherwise"),reference:d.string().optional().describe("or the key of an item the run was given, as listed"),says:ue.describe("what it says there, in its own words, copied exactly"),criterion:d.number().int().positive().optional().describe("an item's only: leave it out; Testbot numbers it")}).refine(e=>[!!e.prDescription,!!e.spec?.trim(),!!e.reference?.trim()].filter(Boolean).length===1,{message:`names no source, or more than one: give "spec" its file:line or "reference" an item's key, or set "prDescription", one of them; list each source as its own entry`}),Tme=d.object({id:ue.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:ue,source:d.nativeEnum(_i).describe("requirement-reference (an item the run was given), spec, pr-description (also for what the change is evidently meant to do when nothing is written down), or could-break (what the change could break that no requirement mentions)"),reference:d.string().optional().describe('requirement-reference only: the key of its item as listed, e.g. "PAY-184", or a Confluence page id such as "3021"'),evidence:ue.describe("where it is stated: for requirement-reference, the item's own words, copied exactly; else file:line, a doc section, or the quoted phrase"),criterion:d.number().int().positive().optional().describe("requirement-reference only: leave it out; Testbot numbers each criterion by the item's own label (AC2, 2.), else after the item's labels"),alsoFrom:d.array(d.object({reference:ue.regex(eo).describe("the key of another uploaded document stating the same obligation"),says:ue.describe("that document's own words, copied exactly; never infer equivalence from a shared criterion number"),criterion:d.number().int().positive().optional().describe("leave out; Testbot grounds and numbers this source separately")})).optional().describe("equivalent uploaded source criteria sharing this requirement's planned cases; retain every source with its own quote. Different conditions or boundaries need distinct requirements"),notInChange:d.string().optional().describe("requirement-reference only: when the PR description or the item defers this criterion to a later change, the words that defer it, copied exactly; give it no clauses. Never for words that only say what this change covers, or only because no changed file holds its code"),unchanged:d.boolean().optional().describe("true when it asks only that behaviour stay as it was (an update or refactor that must not change how something works), whatever its source"),overrules:d.array(HH).optional().describe("requirement-reference only: each lower-ranked source that says otherwise, a spec in the repository, a PR description or another item; this requirement wins, so test what it says"),clauses:d.array($me)}),YH=(r=>(r.ServerError="server-error",r.DataLost="data-lost",r.FinalState="final-state",r.DerivedValues="derived-values",r))(YH||{}),Dme=d.object({id:ue.describe('e.g. "F1"'),file:ue,line:d.number().optional(),claim:ue.describe("the defect, in one sentence"),severity:d.nativeEnum(_a),evidence:ue.describe("the code line, or the probe request and response, that shows it"),conflictsWith:d.array(ue).optional().describe("requirement or clause ids it violates"),keeps:d.string().optional().describe("for a defect no requirement or clause states: path:line of the code beside the change that keeps the rule it breaks"),rule:d.nativeEnum(YH).optional().describe("for a defect that breaks a rule every app keeps, which nothing needs to state: which one"),existing:d.string().optional().describe("only when the base already does this, in code the change left as it was, and the change does not say it fixes it: where the base does it (its file:line); such a defect gets no case"),needsApp:d.enum(["browser","live-api"]).optional().describe("only when the running app alone can show this defect and the repo has no in-process test that can: browser (page script, what the user sees after a click or a save) or live-api (code the repo tests only against the running app's API)")}),_me=d.object({id:ue.describe('e.g. "Q1"'),question:ue.describe("what is unsettled, as a question the PR author can answer"),readings:d.array(ue).min(2).describe("each reasonable behaviour, with what points to it (file:line, or the words that suggest it)"),about:d.string().optional().describe("the requirement or clause id it is about, when there is one"),sources:d.array(HH).optional().describe("when sources of the same rank disagree on it: each of them")}),Nme=d.object({id:ue.describe('unique, a short kebab-case name for what the case checks, e.g. "ship-twice-409"'),type:d.nativeEnum(ii).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:ue.describe('"METHOD /path", or the page / flow'),clause:d.string().optional().describe("the clause id this case checks"),finding:d.string().optional().describe("the finding id this case catches"),steps:ue.describe("what the test does"),expected:ue.describe("the expected outcome, from the clause"),mutates:d.boolean().optional().describe("true when its test changes state, in the test or its setup: an API POST, PUT, PATCH or DELETE, or a UI flow that submits, creates, edits or deletes")}),Pme=d.object({test:ue.describe("existing test file"),action:d.nativeEnum(Ni),reason:ue,mutates:d.boolean().optional().describe("true when the maintained test changes state"),clauses:d.array(ue).optional().describe("the clause ids this test checks"),staleOnBase:d.boolean().optional().describe("true when the test's own expectation was already wrong before this change: it fails the same way on the base branch, where the app does what it should. Not one the base app's own bug fails (that is an existing defect). It is verify, never update: re-run as it is, its failure the test's own. A delete the change justifies stays a delete")}),JH=d.array(fC).optional(),Fme=d.object({components:d.preprocess(e=>JH.safeParse(e).success?e:void 0,JH).describe("when saving a new or changed recipe: every app and backing service actually brought up, its source repository, and whether it is healthy"),outcome:d.nativeEnum(Ri).describe("clean | recipe-drift (you had to fix the recipe) | change-broke-bringup (this PR broke start-up) | bringup-failed (the environment, not the PR)"),baseUrls:d.record(d.string()).optional().describe("service \u2192 base URL of the running app"),health:d.object({url:d.string().optional(),command:d.string().optional(),output:d.string().optional()}).optional().describe("the check that shows the app serves real data, and what it returned"),teardown:d.string().optional().describe("command that stops the app"),dependencies:d.record(d.boolean()).optional().describe("every backing service: true = really running, false = mocked"),recipeFixes:d.array(d.string()).optional().describe("what you changed in the recipe"),error:d.string().optional().describe("when it did not come up: the failing command and what it printed"),suspectFiles:d.array(d.string()).optional().describe("change-broke-bringup: the changed files to blame"),missingSecrets:d.array(d.string().regex(Zd)).optional().describe("bringup-failed only: each secret, key, token or password the app cannot start without that this run has no value for, by its environment variable name; never a value"),login:d.object({username:ue,password:d.string()}).optional().describe("the account the tests sign in as, when they sign in: each a literal value the recipe seeds, or $VARIABLE when a secret in the environment holds it"),revisions:hC.optional()}),vje=d.object({schemaVersion:d.literal(1),requirements:d.array(Tme),findings:d.array(Dme),cases:d.array(Nme).describe("a second test for a clause, and one case per finding that fails on this branch"),questions:d.array(_me).optional().describe("behaviours the change leaves unsettled; no case asserts any of them"),maintenance:d.array(Pme),journeys:d.array(qH).optional().describe("the user journeys that, together, pass through everything the change alters that a user sees or does; empty when it alters nothing a user sees"),notInJourney:d.array(d.object({clause:ue,why:ue})).optional().describe("a clause a user sees or does that no journey walks, and why: none can reach it through the UI, or it is downstream of this change and not walked here"),browserSuites:d.array(d.object({repository:ue.optional().describe("owner/repo, for a checkout other than the working one"),path:ue.describe("the folder its browser tests are in, relative to that checkout"),framework:ue.describe("what runs them, the way the repo's CI or docs run them")})).default([]).describe("the repository's own browser test suites; empty when it has none"),unplannedComponents:d.array(d.object({components:d.array(ue).min(1).describe("changed components, as the change lists them"),why:ue})).optional().describe("changed components no clause reaches, and why their change needs no test; several may share one reason"),triage:Bp.optional().describe("the validation triage decision, made before the app is started; its behaviorIds are clause ids"),app:Fme.optional().describe("omit when no app was needed or none was started"),summary:ue.describe("one paragraph: what the change does and where the risk is")});var eA=(n=>(n.Backend="backend",n.Ui="ui",n))(eA||{});var ui=(r=>(r.Added="added",r.Updated="updated",r.Deleted="deleted",r.Unchanged="unchanged",r))(ui||{}),Ume=d.object({file:ue.describe("repo-relative path; in another repo of the change, that repo's directory name then its path"),kind:d.nativeEnum(eA),change:d.nativeEnum(ui).describe("added: a file you created; updated / deleted / unchanged: an existing test"),covers:d.array(d.string()).describe("the plan case or maintenance clause ids this file tests, each with its own result under result.cases"),guardedDelivery:GE.optional().describe("for a new test that calls the shared app: supply equivalent ordered HTTP requests and assertions only for one case and one test function in a .test.cjs file collected by node --test. The destination package must declare the exact released version of @skyramp/testbot-core used by this run. Use only CI variable names for credentials. Omit when the setup or steps cannot preserve the test; Testbot retains the source without a CI entry"),defect:d.boolean().optional().describe("true when a case of it fails because the app is wrong and the test is right \u2014 kept failing on purpose"),staleBecause:d.object({requirement:ue.describe("the requirement or clause id the change deliberately alters"),line:ue.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 or deleted: why it is out of date"),staleOnBase:d.boolean().optional().describe("for an existing test that fails: true when it fails the same way on the base branch because its own expectation is wrong (the app there does what it should), so this change did not make it wrong. Not when the base app's own bug fails it: that is an existing defect. Leave it as it is (unchanged): its failure is the test's own"),failsOnBase:d.array(d.object({test:ue.describe("its name, as its framework reports it"),failure:ue.describe("the failure message it gave on the base branch")})).optional().describe("for a file that was there before this run, which you left as it was or only added tests to: the tests already in it that fail here and fail the same way on the base branch, so this change did not make them fail. Never a test you wrote or changed"),result:d.object({started:d.boolean().optional().describe("with exit null: true if this file's test command started (it was interrupted or timed out), false if it never started. Left out, Testbot counts it as possibly started, with its cleanup unknown"),exit:d.number().nullable().describe("exit code of your last run of this file; null if it could not be run"),cases:d.array(d.object({case:ue,status:d.nativeEnum(Qn),environmentRestriction:ue.optional().describe("for a skipped case whose test you wrote and could not run here: what this run lacks to run it (a build, a service, a database, a browser, an app). The test is still written; Testbot reports the case as not run. Never set it on a case that ran or for a time limit."),runtimeTargets:op.optional().describe("HTTP(S) URLs this case actually exercised in its current run, from its request or browser evidence; omit for local in-process/mocked checks, never list the shared app merely because it is configured"),defect:d.boolean().optional().describe("for a failing case: true when the app is wrong and the test is right; false when the test is at fault and you could not fix it"),testProblem:Jh.optional().describe("for a failing case marked defect: false: what in the test is at fault"),failure:d.string().optional().describe("for a failing case: the runner's failure for it as printed (the error and the line it was raised at), not a summary"),cause:d.string().optional().describe("for a case you keep as a defect: path:line of the application code that makes it fail"),requires:d.string().optional().describe("for a case you keep as a defect: the words of the PR description, a requirement or clause of the plan, or the code a finding's keeps names, that state what its failing check expects, quoted exactly")}).refine(e=>!e.environmentRestriction||e.status==="skip"&&!e.runtimeTargets?.length,{message:"an environment-restricted case must be skipped and have no runtimeTargets"})).describe("one entry per covered case, from the runner's own output; a case you could not run here has none: record it as skipped with its environmentRestriction"),details:d.string().optional().describe("what failed and why, or why it was not run"),noCases:d.string().optional().describe("for a failed run whose runner reported none of this file's tests (it failed to compile, import or collect): why")}),assertions:d.array(d.object({case:ue,evidence:ue})).optional().describe("per covered case, the assertion line that checks its expected outcome"),functions:d.array(d.object({name:ue.describe("the test function as the runner names it within its file, without the file (test_x, TestClass::test_x, TestSuite/TestCase)"),cases:d.array(ue).describe("the plan case or maintenance clause ids it checks"),testProblem:Jh.optional().describe("for a function that fails because of the test itself, while another function keeps a case it checks as a defect: what in it is at fault")})).optional().describe("for a file you added or updated, or an existing test to maintain that lists clauses: each test function in it and the plan case or maintenance clause ids it checks"),skyramp:d.object({draft:d.union([d.string(),d.array(d.string())]).optional().describe("the draft path the Skyramp helper returned for this test, or each path when the test was made from several drafts"),handWritten:d.string().optional().describe("why it is written by hand: the helper call you made and what it returned")}).optional().describe("only for a test of a case the Skyramp API block lists: where it came from"),context:d.array(sp).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:ue.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:GH.optional().describe("for a file you added or updated: whether the repo's CI will run it, and how you know"),run:Pa.optional().describe(`for a file in ${Ru}, 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, trx or jest-json to ${bn}, or go-test-json); Testbot runs it before write ends and re-runs the tests with it`)}),Ome=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"),Mme=d.preprocess(Ome,d.object({description:ue.describe("what is wrong and how to reproduce it: endpoint or page, input, what you got vs what was expected"),severity:d.nativeEnum(_a).optional(),sourceFile:d.string().optional().describe("the app file at fault"),sourceLine:d.number().optional(),tests:d.array(ue).optional().describe("every test file that fails because of it: a defect several tests show is one issue"),finding:d.string().optional().describe("the plan's finding id, when it is one"),requirements:d.array(ue).optional().describe("the plan's requirement or clause ids it violates")})),wje=d.object({schemaVersion:d.literal(1),tests:d.array(Ume),notWritten:d.array(d.object({case:ue,reason:ue,coveredBy:d.object({file:ue.describe("the test file, relative to the working checkout; prefix a related checkout as for tests[].file"),name:ue.describe("the test function as the runner names it within its file, without the file (test_x, TestClass::test_x, TestSuite/TestCase)")}).optional().describe("only for an existing test triage independently linked to this exact case: its exact runner name (including class or describe titles). Testbot must finish re-running it with every result passed. If your own test covers the case, include the case in its covers and function cases instead")})).describe("every plan case no test covers, and why; also a maintenance clause that no function of its existing test asserts (it stays unproven)"),journeys:d.array(VE).optional().describe("one entry per planned user journey: the browser test that walks it end to end"),lint:d.object({command:d.string(),clean:d.boolean()}).optional().describe("the linter/formatter you ran on your test files, if the repo has one: the exact command, with its file paths (Testbot re-runs it)"),dependenciesAdded:d.array(d.object({package:ue,manifest:ue.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:ue.optional().describe("owner/repo of the manifest's checkout; omit for the repo under test"),reason:ue.optional().describe("why the test must run inside the application's own test environment, so its manifest had to change \u2014 required for every entry")})).optional().describe("every package you added to an APPLICATION manifest (an exception, surfaced in the report); never the Testbot test package's own"),supportFiles:d.array(ue).optional().describe("every file that is not a test you created or changed for your tests, which they need to compile or run (a helper module, page object, fixture, or a snapshot the runner wrote for them), named as you name a test; Testbot delivers only the tests you list and the files under supportFiles"),ciNotes:d.string().optional().describe("for each test whose ci says the repo's CI will not run it: the test, and the exact change the author must make for CI to run it"),importerRun:Pa.optional().describe("when you changed a module other test files import: the repository's own command for running its test files (its runner, its config, its folder); Testbot loads the files that reach your change with it and reports each; omit when you changed none"),commit:d.object({message:ue.describe("subject line at most 72 characters, following the repository's commit-message checks"),prTitle:ue.describe("at most 72 characters, following the repository's PR-title checks"),prBody:ue.describe("what the tests cover and what they found")}),report:d.object({summary:ue.describe("1-2 sentences for the PR author: does the change do what it says? No count of tests: the report gives it"),issues:d.array(Mme).describe("every defect the tests found"),nextSteps:d.array(d.string()),noTests:d.array(d.object({repository:ue,reason:ue.max(4096)})).max(1e3).optional().describe("each Change Set repository where no test was added or updated: its owner/repo and why, naming the other repository when its tests went there"),notesDeviation:d.string().trim().max(4096).optional().describe("when the Target notes say where tests go and a test you added went elsewhere: where it went, and why; omit otherwise")})});var Cje={added:"place",updated:"update",deleted:"delete",unchanged:"verify"};function bs(e){return e.rel!==""&&!e.rel.startsWith("..")&&!Yt.isAbsolute(e.rel)}o(bs,"insideCheckout");function ji(e,t,n=PH){let i=t.map(p=>({name:zC(p),root:Yt.resolve(p.path),slug:p.slug})),r=new Map([...i].reverse().map(p=>[p.name,p])),s=t.length?[{real:dm(Yt.resolve(e))},...i.map(p=>({...p,real:dm(p.root)}))].sort((p,f)=>f.real.length-p.real.length):[],a=new Map,c=o(p=>a.get(p)??a.set(p,new Set(n(p))).get(p),"touched"),u=o(p=>{let f=Yt.resolve(e,p),g=Xf.existsSync(f),h=o(x=>({root:e,rel:us(e,p),ambiguous:x,exists:g}),"working");if(!t.length)return h(!1);let m=!1,I=p.replace(/^\.\//,""),E=I.split("/")[0],b=r.get(E);if(b){let x=I.slice(E.length+1),w=Xf.existsSync(Yt.join(b.root,x)),T=!Xf.existsSync(Yt.join(e,E))||!g&&w;if(w&&g&&Yt.join(b.root,x)!==f){let B=c(b.root).has(us(b.root,x)),Y=c(e).has(us(e,p));B&&!Y?T=!0:B===Y&&(m=!0)}if(T)return{root:b.root,rel:us(b.root,x),repository:b.slug,dir:b.name,ambiguous:m,exists:w}}let v=Yt.join(dm(Yt.dirname(f)),Yt.basename(f)),C=s.find(x=>bs({rel:Yt.relative(x.real,v)}));return C?"slug"in C?{root:C.root,rel:Yt.relative(C.real,v),repository:C.slug,dir:C.name,ambiguous:m,exists:g}:{...h(m),rel:Yt.relative(C.real,v)}:h(m)},"place"),l=new Map;return p=>l.get(p)??l.set(p,u(p)).get(p)}o(ji,"checkoutPlacer");uu();var Lje=5*6e4,jje=12*6e4,Gje=2*6e4;var Wje=["class TestbotProjectBrowsers {"," onBegin(config) {",' const projects = config.projects.map((p) => ({ browserName: p.use.browserName ?? p.use.defaultBrowserType ?? "chromium", channel: p.use.channel ?? null }));',' process.stdout.write("TESTBOT_PROJECT_BROWSERS " + JSON.stringify(projects) + "\\n");'," }"," printsToStdio() { return true; }","}","module.exports = TestbotProjectBrowsers;",""].join(`
257
+ `)}if(!(!e.startsWith(fT)||!e.endsWith(AT)))try{let t=LH.safeParse(JSON.parse(e.slice(fT.length,-AT.length)));return t.success&&Wf(t.data)===e?t.data:void 0}catch{return}}o(Ro,"parseDeliveredSharedTest");var Zf=d.string().trim().min(1),Ime=d.object({cwd:Zf.describe(`directory the command starts in, relative to the test's checkout ("." for its root)`),argv:d.array(Zf).min(1).describe("the command as separate arguments, run without a shell"),env:d.record(d.string(),d.string()).optional().describe("plain settings the listing needs beyond the CI step's own; never a credential or PATH")}),jH=d.object({file:Zf.describe("a file of the test's checkout, relative to its root"),line:Zf.describe("a line of that file, quoted exactly from where its command starts to its end")}),GH=d.object({collected:d.boolean().describe("whether the repo's CI runs this test as it is"),steps:d.array(jH).optional().describe("when collected: the line in a CI file that starts the tests, then each line it runs on the way to the test runner"),runner:d.string().optional().describe("when collected: the test runner the last of those lines starts, by the name that line and the list command both use"),list:Ime.optional().describe("when collected: a command that lists the tests that runner collects without running them; Testbot runs it, and its output must name this file"),why:d.string().optional().describe("when not collected: why the repo's CI will not run it"),needs:d.array(Zf).optional().describe("what the test needs running outside its own process (the app, a database, another service), one entry each; omit when it needs none"),starts:d.array(jH).optional().describe("when collected and it needs any: the line that starts each of those in the CI job that runs it, in a file of ci.steps")});var wme=d.object({route:d.string().describe('the page this step happens on, e.g. "/products/:id"'),action:d.string().describe('what the user does there, through the UI, e.g. "clicks Add to cart"'),clauses:d.array(d.string()).optional().describe("the plan clause ids this step exercises"),check:d.string().optional().describe("what the user then sees that shows the step worked; the test asserts it")}),Kf=(n=>(n.InProcess="in-process",n.Browser="browser",n))(Kf||{}),zH=(i=>(i.Spec="spec",i.PrDescription="pr-description",i.Inferred="inferred",i))(zH||{}),qH=d.object({id:d.string().describe('e.g. "J1"'),name:d.string().describe(`the flow in a user's words, e.g. "buy a product with a coupon"`),entry:d.string().describe("the route the user starts the flow on: the app's normal starting page for it, never a deep link into its middle"),steps:d.array(wme).describe("every step, in order, from the entry page to the outcome: at least two"),outcome:d.string().describe("what the user sees at the end that shows the flow worked: every part of it"),finishes:d.string().optional().describe('the user action that completes the task, verb first, e.g. "places the order"; the journey walks on to it'),kind:d.nativeEnum(Kf).optional().describe("in-process when the repo's in-process tests (components, app routes) can walk the whole flow and check it; else browser"),source:d.nativeEnum(zH).optional().describe("spec or pr-description when one describes this flow (quote it under evidence), else inferred"),evidence:d.string().optional().describe("for spec or pr-description: its words that describe the flow"),testFile:d.string().describe("the browser test file it goes in, beside the repo's existing e2e tests")}),VE=d.object({journey:d.string().describe("the plan's journey id"),file:d.string().describe("the browser test file that walks it"),brokeAt:d.object({step:d.number().int().describe("the 1-based step whose check failed first"),expected:d.string(),actual:d.string().describe("what the app did instead, from the runner's output"),notReached:d.array(d.number().int()).optional().describe("later steps the test could not get to")}).optional().describe("only when the journey's test failed on a check: where"),test:d.string().describe("the title of the one test in that file that walks it end to end")});var MLe=Object.fromEntries([...["ts","tsx","mts","cts","js","jsx","mjs","cjs"].map(e=>[e,"node"]),...["java","kt","kts","groovy","scala"].map(e=>[e,"jvm"]),["py","python"],["go","go"]]);var LLe=["stale_test","open_question"],jLe=["low","medium","high","critical"];var ue=d.string().trim().min(1),Qme=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"),$me=d.preprocess(Qme,d.object({id:ue.describe(`its requirement's id plus a letter, e.g. "R1a", "AC-3a"`),clause:ue.describe("one testable part of the requirement"),expected:ue.describe("the outcome the requirement calls for \u2014 taken from the requirement, never from what the code does"),skip:d.string().optional().describe("only when no test can check this clause here: why"),type:d.nativeEnum(ii).optional().describe("the test that checks this clause: contract / integration (the API, or code called directly in-process: a function, hook or module) or ui (a page)"),target:d.string().optional().describe('its "METHOD /path", or the page / flow'),steps:d.string().optional().describe("what that test does; its expected outcome is this clause's"),finding:d.string().optional().describe("the finding id, when this clause's test also catches that defect (the defect still gets a case of its own)"),code:d.string().optional().describe("path:line of the code that decides this clause, when there is one; in another repo of the change, that repo's directory name then its path"),stated:d.string().optional().describe("the description's or spec's own words that state this clause, copied exactly, when they do"),mutates:d.boolean().optional().describe("true when its test changes state, in the test or its setup: an API POST, PUT, PATCH or DELETE, or a UI flow that submits, creates, edits or deletes"),browserOnly:d.boolean().optional().describe("true when its behaviour happens only in a browser: real clicks or keys driving page script, client-side sorting or filtering, script-driven DOM updates, focus, drag-and-drop, navigation, rendering that depends on CSS or JavaScript"),browserHarness:d.string().optional().describe("browserOnly, off the runtime path: the path of the repo's in-process browser suite its test goes in (e.g. a Django StaticLiveServerTestCase test that drives Selenium)"),quote:d.string().optional().describe("the words of the spec, plan, ticket, PR description or a test the change adds or edits that state this clause, copied exactly; a file of the repository: its path:line first. Leave it out when no source states it"),inferred:d.boolean().optional().describe("leave it out: Testbot sets it when no source states this clause (contracts/clause-grounding.ts)")})),HH=d.object({spec:d.string().optional().describe("file:line of a spec in the repository"),prDescription:d.boolean().optional().describe("or true when a pull request description says otherwise"),reference:d.string().optional().describe("or the key of an item the run was given, as listed"),says:ue.describe("what it says there, in its own words, copied exactly"),criterion:d.number().int().positive().optional().describe("an item's only: leave it out; Testbot numbers it")}).refine(e=>[!!e.prDescription,!!e.spec?.trim(),!!e.reference?.trim()].filter(Boolean).length===1,{message:`names no source, or more than one: give "spec" its file:line or "reference" an item's key, or set "prDescription", one of them; list each source as its own entry`}),Tme=d.object({id:ue.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:ue,source:d.nativeEnum(_i).describe("requirement-reference (an item the run was given), spec, pr-description (also for what the change is evidently meant to do when nothing is written down), or could-break (what the change could break that no requirement mentions)"),reference:d.string().optional().describe('requirement-reference only: the key of its item as listed, e.g. "PAY-184", or a Confluence page id such as "3021"'),evidence:ue.describe("where it is stated: for requirement-reference, the item's own words, copied exactly; else file:line, a doc section, or the quoted phrase"),criterion:d.number().int().positive().optional().describe("requirement-reference only: leave it out; Testbot numbers each criterion by the item's own label (AC2, 2.), else after the item's labels"),alsoFrom:d.array(d.object({reference:ue.regex(eo).describe("the key of another uploaded document stating the same obligation"),says:ue.describe("that document's own words, copied exactly; never infer equivalence from a shared criterion number"),criterion:d.number().int().positive().optional().describe("leave out; Testbot grounds and numbers this source separately")})).optional().describe("equivalent uploaded source criteria sharing this requirement's planned cases; retain every source with its own quote. Different conditions or boundaries need distinct requirements"),notInChange:d.string().optional().describe("requirement-reference only: when the PR description or the item defers this criterion to a later change, the words that defer it, copied exactly; give it no clauses. Never for words that only say what this change covers, or only because no changed file holds its code"),unchanged:d.boolean().optional().describe("true when it asks only that behaviour stay as it was (an update or refactor that must not change how something works), whatever its source"),overrules:d.array(HH).optional().describe("requirement-reference only: each lower-ranked source that says otherwise, a spec in the repository, a PR description or another item; this requirement wins, so test what it says"),clauses:d.array($me)}),YH=(r=>(r.ServerError="server-error",r.DataLost="data-lost",r.FinalState="final-state",r.DerivedValues="derived-values",r))(YH||{}),Dme=d.object({id:ue.describe('e.g. "F1"'),file:ue,line:d.number().optional(),claim:ue.describe("the defect, in one sentence"),severity:d.nativeEnum(_a),evidence:ue.describe("the code line, or the probe request and response, that shows it"),conflictsWith:d.array(ue).optional().describe("requirement or clause ids it violates"),keeps:d.string().optional().describe("for a defect no requirement or clause states: path:line of the code beside the change that keeps the rule it breaks"),rule:d.nativeEnum(YH).optional().describe("for a defect that breaks a rule every app keeps, which nothing needs to state: which one"),existing:d.string().optional().describe("only when the base already does this, in code the change left as it was, and the change does not say it fixes it: where the base does it (its file:line); such a defect gets no case"),needsApp:d.enum(["browser","live-api"]).optional().describe("only when the running app alone can show this defect and the repo has no in-process test that can: browser (page script, what the user sees after a click or a save) or live-api (code the repo tests only against the running app's API)")}),_me=d.object({id:ue.describe('e.g. "Q1"'),question:ue.describe("what is unsettled, as a question the PR author can answer"),readings:d.array(ue).min(2).describe("each reasonable behaviour, with what points to it (file:line, or the words that suggest it)"),about:d.string().optional().describe("the requirement or clause id it is about, when there is one"),sources:d.array(HH).optional().describe("when sources of the same rank disagree on it: each of them")}),Nme=d.object({id:ue.describe('unique, a short kebab-case name for what the case checks, e.g. "ship-twice-409"'),type:d.nativeEnum(ii).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:ue.describe('"METHOD /path", or the page / flow'),clause:d.string().optional().describe("the clause id this case checks"),finding:d.string().optional().describe("the finding id this case catches"),steps:ue.describe("what the test does"),expected:ue.describe("the expected outcome, from the clause"),mutates:d.boolean().optional().describe("true when its test changes state, in the test or its setup: an API POST, PUT, PATCH or DELETE, or a UI flow that submits, creates, edits or deletes")}),Pme=d.object({test:ue.describe("existing test file"),action:d.nativeEnum(Ni),reason:ue,mutates:d.boolean().optional().describe("true when the maintained test changes state"),clauses:d.array(ue).optional().describe("the clause ids this test checks"),staleOnBase:d.boolean().optional().describe("true when the test's own expectation was already wrong before this change: it fails the same way on the base branch, where the app does what it should. Not one the base app's own bug fails (that is an existing defect). It is verify, never update: re-run as it is, its failure the test's own. A delete the change justifies stays a delete")}),JH=d.array(fC).optional(),Fme=d.object({components:d.preprocess(e=>JH.safeParse(e).success?e:void 0,JH).describe("when saving a new or changed recipe: every app and backing service actually brought up, its source repository, and whether it is healthy"),outcome:d.nativeEnum(Ri).describe("clean | recipe-drift (you had to fix the recipe) | change-broke-bringup (this PR broke start-up) | bringup-failed (the environment, not the PR)"),baseUrls:d.record(d.string()).optional().describe("service \u2192 base URL of the running app"),health:d.object({url:d.string().optional(),command:d.string().optional(),output:d.string().optional()}).optional().describe("the check that shows the app serves real data, and what it returned"),teardown:d.string().optional().describe("command that stops the app"),dependencies:d.record(d.boolean()).optional().describe("every backing service: true = really running, false = mocked"),recipeFixes:d.array(d.string()).optional().describe("what you changed in the recipe"),error:d.string().optional().describe("when it did not come up: the failing command and what it printed"),suspectFiles:d.array(d.string()).optional().describe("change-broke-bringup: the changed files to blame"),missingSecrets:d.array(d.string().regex(Zd)).optional().describe("bringup-failed only: each secret, key, token or password the app cannot start without that this run has no value for, by its environment variable name; never a value"),login:d.object({username:ue,password:d.string()}).optional().describe("the account the tests sign in as, when they sign in: each a literal value the recipe seeds, or $VARIABLE when a secret in the environment holds it"),revisions:hC.optional()}),vje=d.object({schemaVersion:d.literal(1),requirements:d.array(Tme),findings:d.array(Dme),cases:d.array(Nme).describe("a second test for a clause, and one case per finding that fails on this branch"),questions:d.array(_me).optional().describe("behaviours the change leaves unsettled; no case asserts any of them"),maintenance:d.array(Pme),journeys:d.array(qH).optional().describe("the user journeys that, together, pass through everything the change alters that a user sees or does; empty when it alters nothing a user sees"),notInJourney:d.array(d.object({clause:ue,why:ue})).optional().describe("a clause a user sees or does that no journey walks, and why: none can reach it through the UI, or it is downstream of this change and not walked here"),browserSuites:d.array(d.object({repository:ue.optional().describe("owner/repo, for a checkout other than the working one"),path:ue.describe("the folder its browser tests are in, relative to that checkout"),framework:ue.describe("what runs them, the way the repo's CI or docs run them")})).default([]).describe("the repository's own browser test suites; empty when it has none"),unplannedComponents:d.array(d.object({components:d.array(ue).min(1).describe("changed components, as the change lists them"),why:ue})).optional().describe("changed components no clause reaches, and why their change needs no test; several may share one reason"),triage:Bp.optional().describe("the validation triage decision, made before the app is started; its behaviorIds are clause ids"),app:Fme.optional().describe("omit when no app was needed or none was started"),summary:ue.describe("one paragraph: what the change does and where the risk is")});var eA=(n=>(n.Backend="backend",n.Ui="ui",n))(eA||{});var ui=(r=>(r.Added="added",r.Updated="updated",r.Deleted="deleted",r.Unchanged="unchanged",r))(ui||{}),Ume=d.object({file:ue.describe("repo-relative path; in another repo of the change, that repo's directory name then its path"),kind:d.nativeEnum(eA),change:d.nativeEnum(ui).describe("added: a file you created; updated / deleted / unchanged: an existing test"),covers:d.array(d.string()).describe("the plan case or maintenance clause ids this file tests, each with its own result under result.cases"),guardedDelivery:GE.optional().describe("for a new test that calls the shared app: supply equivalent ordered HTTP requests and assertions only for one case and one test function in a .test.cjs file collected by node --test. The destination package must declare the exact released version of @skyramp/testbot-core used by this run. Use only CI variable names for credentials. Omit when the setup or steps cannot preserve the test; Testbot retains the source without a CI entry"),defect:d.boolean().optional().describe("true when a case of it fails because the app is wrong and the test is right \u2014 kept failing on purpose"),staleBecause:d.object({requirement:ue.describe("the requirement or clause id the change deliberately alters"),line:ue.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 or deleted: why it is out of date"),staleOnBase:d.boolean().optional().describe("for an existing test that fails: true when it fails the same way on the base branch because its own expectation is wrong (the app there does what it should), so this change did not make it wrong. Not when the base app's own bug fails it: that is an existing defect. Leave it as it is (unchanged): its failure is the test's own"),failsOnBase:d.array(d.object({test:ue.describe("its name, as its framework reports it"),failure:ue.describe("the failure message it gave on the base branch")})).optional().describe("for a file that was there before this run, which you left as it was or only added tests to: the tests already in it that fail here and fail the same way on the base branch, so this change did not make them fail. Never a test you wrote or changed"),result:d.object({started:d.boolean().optional().describe("with exit null: true if this file's test command started (it was interrupted or timed out), false if it never started. Left out, Testbot counts it as possibly started, with its cleanup unknown"),exit:d.number().nullable().describe("exit code of your last run of this file; null if it could not be run"),cases:d.array(d.object({case:ue,status:d.nativeEnum(Qn),environmentRestriction:ue.optional().describe("for a skipped case whose test you wrote and could not run here: what this run lacks to run it (a build, a service, a database, a browser, an app). The test is still written; Testbot reports the case as not run. Never set it on a case that ran or for a time limit."),runtimeTargets:op.optional().describe("HTTP(S) URLs this case actually exercised in its current run, from its request or browser evidence; omit for local in-process/mocked checks, never list the shared app merely because it is configured"),defect:d.boolean().optional().describe("for a failing case: true when the app is wrong and the test is right; false when the test is at fault and you could not fix it"),testProblem:Jh.optional().describe("for a failing case marked defect: false: what in the test is at fault"),failure:d.string().optional().describe("for a failing case: the runner's failure for it as printed (the error and the line it was raised at), not a summary"),cause:d.string().optional().describe("for a case you keep as a defect: path:line of the application code that makes it fail"),requires:d.string().optional().describe("for a case you keep as a defect: the words of the PR description, a requirement or clause of the plan, or the code a finding's keeps names, that state what its failing check expects, quoted exactly")}).refine(e=>!e.environmentRestriction||e.status==="skip"&&!e.runtimeTargets?.length,{message:"an environment-restricted case must be skipped and have no runtimeTargets"})).describe("one entry per covered case, from the runner's own output; a case you could not run here has none: record it as skipped with its environmentRestriction"),details:d.string().optional().describe("what failed and why, or why it was not run"),noCases:d.string().optional().describe("for a failed run whose runner reported none of this file's tests (it failed to compile, import or collect): why")}),assertions:d.array(d.object({case:ue,evidence:ue})).optional().describe("per covered case, the assertion line that checks its expected outcome"),functions:d.array(d.object({name:ue.describe("the test function as the runner names it within its file, without the file (test_x, TestClass::test_x, TestSuite/TestCase)"),cases:d.array(ue).describe("the plan case or maintenance clause ids it checks"),testProblem:Jh.optional().describe("for a function that fails because of the test itself, while another function keeps a case it checks as a defect: what in it is at fault")})).optional().describe("for a file you added or updated, or an existing test to maintain that lists clauses: each test function in it and the plan case or maintenance clause ids it checks"),skyramp:d.object({draft:d.union([d.string(),d.array(d.string())]).optional().describe("the draft path the Skyramp helper returned for this test, or each path when the test was made from several drafts"),handWritten:d.string().optional().describe("why it is written by hand: the helper call you made and what it returned")}).optional().describe("only for a test of a case the Skyramp API block lists: where it came from"),context:d.array(sp).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:ue.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:GH.optional().describe("for a file you added or updated: whether the repo's CI will run it, and how you know"),run:Pa.optional().describe(`for a file in ${Ru}, 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, trx or jest-json to ${bn}, or go-test-json); Testbot runs it before write ends and re-runs the tests with it`)}),Ome=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"),Mme=d.preprocess(Ome,d.object({description:ue.describe("what is wrong and how to reproduce it: endpoint or page, input, what you got vs what was expected"),severity:d.nativeEnum(_a).optional(),sourceFile:d.string().optional().describe("the app file at fault"),sourceLine:d.number().optional(),tests:d.array(ue).optional().describe("every test file that fails because of it: a defect several tests show is one issue"),finding:d.string().optional().describe("the plan's finding id, when it is one"),requirements:d.array(ue).optional().describe("the plan's requirement or clause ids it violates")})),wje=d.object({schemaVersion:d.literal(1),tests:d.array(Ume),notWritten:d.array(d.object({case:ue,reason:ue,coveredBy:d.object({file:ue.describe("the test file, relative to the working checkout; prefix a related checkout as for tests[].file"),name:ue.describe("the test function as the runner names it within its file, without the file (test_x, TestClass::test_x, TestSuite/TestCase)")}).optional().describe("only for an existing test triage independently linked to this exact case: its exact runner name (including class or describe titles). Testbot must finish re-running it with every result passed. If your own test covers the case, include the case in its covers and function cases instead")})).describe("every plan case no test covers, and why; also a maintenance clause that no function of its existing test asserts (it stays unproven)"),journeys:d.array(VE).optional().describe("one entry per planned user journey: the browser test that walks it end to end"),checks:d.array(d.object({command:d.string().describe("the exact command you ran on your files, with their paths, as run from the repository root: cd <folder> && first when you ran it in a folder"),source:d.string().describe("where the repository runs or configures this check: path:line, then its words copied exactly"),clean:d.boolean().describe("false when it still reports something in your files, or stopped before checking any")})).optional().describe("each lint, format or type check the repository runs or keeps a config for on files like yours; Testbot runs each again"),dependenciesAdded:d.array(d.object({package:ue,manifest:ue.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:ue.optional().describe("owner/repo of the manifest's checkout; omit for the repo under test"),reason:ue.optional().describe("why the test must run inside the application's own test environment, so its manifest had to change \u2014 required for every entry")})).optional().describe("every package you added to an APPLICATION manifest (an exception, surfaced in the report); never the Testbot test package's own"),supportFiles:d.array(ue).optional().describe("every file that is not a test you created or changed for your tests, which they need to compile or run (a helper module, page object, fixture, or a snapshot the runner wrote for them), named as you name a test; Testbot delivers only the tests you list and the files under supportFiles"),ciNotes:d.string().optional().describe("for each test whose ci says the repo's CI will not run it: the test, and the exact change the author must make for CI to run it"),importerRun:Pa.optional().describe("when you changed a module other test files import: the repository's own command for running its test files (its runner, its config, its folder); Testbot loads the files that reach your change with it and reports each; omit when you changed none"),commit:d.object({message:ue.describe("subject line at most 72 characters, following the repository's commit-message checks"),prTitle:ue.describe("at most 72 characters, following the repository's PR-title checks"),prBody:ue.describe("what the tests cover and what they found")}),report:d.object({summary:ue.describe("1-2 sentences for the PR author: does the change do what it says? No count of tests: the report gives it"),issues:d.array(Mme).describe("every defect the tests found"),nextSteps:d.array(d.string()),noTests:d.array(d.object({repository:ue,reason:ue.max(4096)})).max(1e3).optional().describe("each Change Set repository where no test was added or updated: its owner/repo and why, naming the other repository when its tests went there"),notesDeviation:d.string().trim().max(4096).optional().describe("when the Target notes say where tests go and a test you added went elsewhere: where it went, and why; omit otherwise")})});var Cje={added:"place",updated:"update",deleted:"delete",unchanged:"verify"};function bs(e){return e.rel!==""&&!e.rel.startsWith("..")&&!Yt.isAbsolute(e.rel)}o(bs,"insideCheckout");function ji(e,t,n=PH){let i=t.map(p=>({name:zC(p),root:Yt.resolve(p.path),slug:p.slug})),r=new Map([...i].reverse().map(p=>[p.name,p])),s=t.length?[{real:dm(Yt.resolve(e))},...i.map(p=>({...p,real:dm(p.root)}))].sort((p,f)=>f.real.length-p.real.length):[],a=new Map,c=o(p=>a.get(p)??a.set(p,new Set(n(p))).get(p),"touched"),u=o(p=>{let f=Yt.resolve(e,p),g=Xf.existsSync(f),h=o(x=>({root:e,rel:us(e,p),ambiguous:x,exists:g}),"working");if(!t.length)return h(!1);let m=!1,I=p.replace(/^\.\//,""),E=I.split("/")[0],b=r.get(E);if(b){let x=I.slice(E.length+1),w=Xf.existsSync(Yt.join(b.root,x)),T=!Xf.existsSync(Yt.join(e,E))||!g&&w;if(w&&g&&Yt.join(b.root,x)!==f){let B=c(b.root).has(us(b.root,x)),Y=c(e).has(us(e,p));B&&!Y?T=!0:B===Y&&(m=!0)}if(T)return{root:b.root,rel:us(b.root,x),repository:b.slug,dir:b.name,ambiguous:m,exists:w}}let v=Yt.join(dm(Yt.dirname(f)),Yt.basename(f)),C=s.find(x=>bs({rel:Yt.relative(x.real,v)}));return C?"slug"in C?{root:C.root,rel:Yt.relative(C.real,v),repository:C.slug,dir:C.name,ambiguous:m,exists:g}:{...h(m),rel:Yt.relative(C.real,v)}:h(m)},"place"),l=new Map;return p=>l.get(p)??l.set(p,u(p)).get(p)}o(ji,"checkoutPlacer");uu();var Lje=5*6e4,jje=12*6e4,Gje=2*6e4;var Wje=["class TestbotProjectBrowsers {"," onBegin(config) {",' const projects = config.projects.map((p) => ({ browserName: p.use.browserName ?? p.use.defaultBrowserType ?? "chromium", channel: p.use.channel ?? null }));',' process.stdout.write("TESTBOT_PROJECT_BROWSERS " + JSON.stringify(projects) + "\\n");'," }"," printsToStdio() { return true; }","}","module.exports = TestbotProjectBrowsers;",""].join(`
258
258
  `);var l1e=[...Nl,"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 xo=re(V0());var M1e={jest:"jest",vitest:"vitest"};var Vme=[["target","surefire-reports"],["target","failsafe-reports"],["build","test-results"]],KGe=new Set(Vme.map(([e])=>e));var XGe=new Set(["jest","vitest","npm-test","playwright"]);var Jme="ci-collect";var fVe=5*6e4;function XH(e,t){let n=new Set(t.tests.map(i=>i.file));return(Re(e,`${Jme}.json`)?.checks??[]).filter(i=>n.has(i.file))}o(XH,"currentCiChecks");function hT(e){let t=Re(e,"write.json");if(!Array.isArray(t?.tests))return new Set;let n=new Set(t.tests.filter(i=>i.change==="added").map(i=>i.file));return new Set(XH(e,t).filter(i=>i.verdict==="unprovisioned"&&n.has(i.file)).map(i=>i.file))}o(hT,"withheldTests");var nr=re(require("fs")),vs=re(require("path"));var Qo=re(require("fs")),zE=re(require("path"));var Yme="change-inputs",Wme=o((e,t)=>`${t}-${e.replace(/[^\w.-]+/g,n=>n==="/"?"__":"-")}.md`,"fileName");function Zme(e){return[...(e.pullRequests??[]).map(t=>({label:`${t.repository}#${t.number}`,body:t.body?.trim()??""})),...(e.relatedRepos??[]).map(t=>({label:t.slug,body:t.prDescription?.trim()??""}))].map((t,n)=>({...t,file:Wme(t.label,n)})).filter(t=>t.body.length>W1)}o(Zme,"longDescriptions");function tY(e,t,n){let i=zE.join(t,Yme);Qo.rmSync(i,{recursive:!0,force:!0}),Qo.mkdirSync(i,{recursive:!0}),Qo.writeFileSync(zE.join(i,Qa),n,{mode:292});for(let r of Zme(e))Qo.writeFileSync(zE.join(i,r.file),`${r.body}
259
259
  `,{mode:292})}o(tY,"writeChangeInputs");var Kme=[/^\.github\//,/^\.gitlab(-ci)?/,/^\.circleci\//,/(^|\/)Jenkinsfile$/,/^docs?\//,/\.(md|mdx|rst)$/i,/(^|\/)LICENSE([._-].*)?$/i,/(^|\/)CODEOWNERS$/,/(^|\/)\.gitignore$/,/(^|\/)\.gitattributes$/,/(^|\/)\.editorconfig$/,/(^|\/)\.prettierrc[^/]*$/,/(^|\/)\.eslintrc[^/]*$/,/(^|\/)eslint\.config\.[^/]+$/,/(^|\/)package-lock\.json$/,/(^|\/)yarn\.lock$/,/(^|\/)pnpm-lock\.yaml$/,/(^|\/)poetry\.lock$/,/(^|\/)Pipfile\.lock$/,/(^|\/)Cargo\.lock$/,/(^|\/)go\.sum$/,/(^|\/)composer\.lock$/,/(^|\/)Gemfile\.lock$/,/\.(png|jpe?g|gif|svg|ico|webp)$/i];function nY(e){return Kme.some(t=>t.test(e))}o(nY,"isNonApplicationFile");function Xme(e){let t=[],n=e.inputs.repositoryPath;return!n||!nr.existsSync(n)?t.push(`repository path does not exist: ${n}`):X$(n)?_f(n,e.inputs.baseBranch)||t.push(e.inputs.baseBranch?`base branch "${e.inputs.baseBranch}" does not resolve`:"could not auto-detect a base branch (origin/HEAD, main, master)"):t.push(`not a git repository: ${n}`),{ok:t.length===0,reasons:t}}o(Xme,"validatePreflightInput");function eye(e){return(e.inputs.relatedRepos??[]).map(t=>{let n=nr.existsSync(t.path)?vE(t.path,t.base):void 0;return n?{repository:t.slug,changedFiles:n.changedFiles}:{repository:t.slug,changedFiles:[],note:`could not read the change in ${t.path}`}})}o(eye,"collectRelatedChanges");function tye(e){nr.rmSync(vs.join(e.runDir,jC),{recursive:!0,force:!0});for(let t of e.inputs.relatedRepos??[]){let n=nr.existsSync(t.path)?e0(t.path,t.base):void 0;if(!n)continue;let i=vs.join(e.runDir,GC(t.slug));nr.mkdirSync(vs.dirname(i),{recursive:!0}),nr.writeFileSync(i,n.diffContent)}}o(tye,"writeRelatedDiffs");function nye(e){let{repositoryPath:t,baseBranch:n}=e.inputs;nr.rmSync(vs.join(t,J$),{recursive:!0,force:!0});let i=vE(t,n);if(!i)throw new Error(`could not compute git facts for ${t}`);let r=e0(t,n);if(!r)throw new Error(`could not compute the PR diff for ${t}`);let s=eye(e),a=[i.changedFiles,...s.map(f=>f.changedFiles)].flat(),c=a.map(f=>f.path).filter(nY),u=!ku(e)&&a.length>0&&c.length===a.length,l={schemaVersion:1,repository:{path:t,currentBranch:i.currentBranch,baseBranch:i.baseBranch},changedFiles:i.changedFiles,...s.length?{relatedChanges:s}:{},newFiles:r.newFiles,deletedFiles:r.deletedFiles,diffStat:r.diffStat,diffBytes:r.diffContent.length,nonApplicationFiles:c,nonApplicationOnly:u,sutRequired:!u};nr.writeFileSync(vs.join(e.runDir,Qa),r.diffContent),tY(e.inputs,e.runDir,r.diffContent),tye(e);let p=vs.join(e.runDir,LC);return nr.mkdirSync(vs.dirname(p),{recursive:!0}),nr.writeFileSync(p,JSON.stringify(l,null,2)+`
260
260
  `),e.prepared={preflight:l},{preflight:LC,diff:Qa}}o(nye,"executePreflight");var yze={name:"preflight",timeoutMinutes:1,requires:[],validateInput:Xme,execute:nye};var ic=re(require("path"));var Qze={python:"pytest",typescript:"playwright",javascript:"playwright"},$ze={pytest:"pytest",playwright:"playwright"};var aye=new Set(["package.json","package-lock.json","npm-shrinkwrap.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb","pyproject.toml","poetry.lock","uv.lock","pdm.lock","Pipfile","Pipfile.lock","setup.py","setup.cfg","go.mod","go.sum","Gemfile","Gemfile.lock","pom.xml","build.gradle","build.gradle.kts"]);function iY(e){let t=ic.basename(e);return aye.has(t)||/^requirements[^/\\]*\.(txt|in)$/.test(t)}o(iY,"isDependencyFile");var rA=re(require("path"));var oY=(i=>(i.Requirement="requirement",i.PrDescription="pr_description",i.Code="code",i))(oY||{}),An=d.string().trim().min(1),lye=d.object({expectation:An.max(300).describe("the behavior this assertion pins, in words"),source:d.nativeEnum(oY),expected:An.max(200).describe("the exact value or outcome asserted, as the test asserts it")}),dye=d.object({file:An.describe("path of the NEW test file you wrote, relative to its repository"),repository:An.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),framework:An.describe("the framework the repository runs this file with: pytest, jest, vitest, node-test, or the name of any other"),run:Pa.optional().describe(`for ${Ru}: how the run executes only the tests in names, with the repository's own runner writing JUnit XML to {junit}`),covers:d.array(An).length(1).describe("the ONE behavior id, or defect id, from the plan that the tests in names provide evidence for; a file covering several is listed once per id"),names:d.array(An).min(1).describe("the test functions/cases in the file that provide evidence for that behavior, as the framework names them"),assertions:d.array(lye).min(1)}),tA=(n=>(n.Updated="updated",n.Deleted="deleted",n))(tA||{}),sY=300,pye=d.object({file:An.describe("path of the EXISTING test file you updated or deleted, relative to its repository"),repository:An.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),change:d.nativeEnum(tA),staleBecause:d.object({requirement:An.describe("the requirement or clause id the change deliberately alters"),line:An.describe("path:line (or path) of the application code the change altered that makes this test's old expectation wrong")}).optional().describe("for an existing test you updated: why it is out of date"),reason:d.preprocess(e=>typeof e=="string"?e.trim().slice(0,sY):e,An.max(sY)).describe("what the change deliberately altered that made the test wrong")}),mT=d.object({schemaVersion:d.literal(1),tests:d.array(dye),maintained:d.array(pye).optional().describe("existing tests the change made stale that you updated or deleted; omit when there were none"),defectsNotTested:d.array(d.object({id:An,reason:An.max(300)})).optional().describe("defects the plan found that no in-process test can reach, each with why; omit when every defect has a test"),journeys:d.array(VE).optional().describe("one entry per planned user journey: the in-process test that walks it end to end"),journeysNotWritten:d.array(d.object({journey:An,missing:An.transform(e=>e.length>300?`${e.slice(0,299)}\u2026`:e)})).optional().describe("a planned journey no in-process test can walk here, with what it needs that is missing; it is reported as not covered"),lint:d.object({command:d.string(),clean:d.boolean()}).optional().describe("the linter/formatter you ran on your test files, if the repository has one you can run; omit otherwise"),commitMessage:An.optional().describe("the commit message for your tests: a subject line of at most 72 characters, then what they cover")});var nA="generate-unit.json";function Aye(e){let{value:t,error:n}=Vt(e);if(n)return{errors:[n]};let{value:i,errors:r}=Tn(mT,t);return r.length?{errors:r}:{output:i,errors:[]}}o(Aye,"parseGenerateUnitText");function gye(e){return Aye(e.stdout)}o(gye,"parseGenerateUnitFromSession");var Wqe=Hn("generate-unit-schema",(e,t)=>gye(t));var qE=String.raw`(?:node:)?(?:http|https|http2|net|tls|dgram)`,Zqe=[[/\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+["']${qE}["']|\bimport\s+["']${qE}["']|require\(\s*["']${qE}["']\s*\)|\bimport\(\s*["']${qE}["']\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)"]];function hye(e){return Tn(KC,e).errors}o(hye,"validateFinalizeOutput");function mye(e,t=[]){let{value:n,error:i}=Vt(e,t);if(i)return{errors:[i]};let r=hye(n);return r.length>0?{errors:r}:{finalize:n,errors:[]}}o(mye,"parseFinalizeText");var yye="finalize-scratch";function Eye(e,t){let n=mye(e.stdout,t?.secretValues);if(!n.finalize||!t?.outputsDir)return n;let i=o((r,s)=>r.trim()&&AI(r.trim(),rA.join(t.outputsDir,yye,s),"finalize")||r,"script");return{...n,finalize:{...n.finalize,lint:n.finalize.lint.map((r,s)=>({...r,command:i(r.command??"",`lint-${s+1}.sh`)}))}}}o(Eye,"parseFinalizeFromSession");var yJe=Hn("finalize-schema",(e,t)=>Eye(t,e));var uY=re(require("path"));var WJe=new Set(["targeted_unit","existing_evidence_sufficient"]);var Sye="triage.json";var AYe=new Set(["existing_evidence","unaffected","existing_unit","new_unit","runtime"]),gYe={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 kye(e){let{value:t,error:n}=Vt(e);if(n)return{errors:[n]};let{value:i,errors:r}=Tn(Bp,t);return r.length?{errors:r}:{triage:i,errors:[]}}o(kye,"parseTriageText");function Bye(e){return kye(e.stdout)}o(Bye,"parseTriageFromSession");var hYe=Hn("triage-schema",(e,t)=>Bye(t));function Rye(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(Rye,"triageDecider");function ET(e){if(Rye(e)?.status==="passed")return cs(uY.join(e.outputsDir,Sye))}o(ET,"readTriage");function IT(e){return g2(j$(e.inputs,Re(e,`${Df}.json`),ET(e)?.sutRequired))}o(IT,"revisionBlockReason");var mYe=new Set(["deploy","recommend","generate","generate-ui","adapt","generate-unit","native-run","finalize","deliver"]);function bT(e){return e.functions?.length?e.functions:[(e.testType==="unit"?e.testId.split("::").slice(1).join("::").replace(/\[.*\]$/,""):"")||e.testId]}o(bT,"rowFunctions");function Il(e){return new Set(e.flatMap(t=>bT(t).map(n=>`${t.repository??""}\0${t.fileName}\0${n}`))).size}o(Il,"testCount");function xye(e){return Tn(WC,e).errors}o(xye,"validateAnalysisOutput");function lY(e,t=[]){let{value:n,error:i}=Vt(e,t);if(i)return{errors:[i]};let r=xye(n);return r.length>0?{errors:r}:{analysis:n,errors:[]}}o(lY,"parseAnalysisText");function Qye(e,t=[]){return lY(e.stdout,t)}o(Qye,"parseAnalysisFromSession");var UYe=Hn("analysis-schema",(e,t)=>Qye(t,e.secretValues));var Q4e=Ph.rows.notRun(!0);var iA="kept, not ";var sA="(declined the planned ";function vT(e){if(!e)return[];let t=[],n=0,i=0;for(let r=0;r<e.length;r++){let s=e[r];s==="("?n++:s===")"?n=Math.max(0,n-1):n===0&&s===";"&&e[r+1]===" "&&e[r-1]===")"&&(t.push(e.slice(i,r)),i=r+2)}return t.push(e.slice(i)),t.map(r=>{let s=r.trim();if(!s.endsWith(")"))return{expectation:s};let a=0;for(let c=s.length-1;c>=0;c--)if(s[c]===")")a++;else if(s[c]==="("&&--a===0){let u=s.slice(0,c).trim(),l=s.slice(c+1,-1).trim();return u&&l?{expectation:u,expected:l}:{expectation:s}}return{expectation:s}})}o(vT,"assertionParts");var wT=new Set(["update","regenerate","delete"]);var $4e={update:"updated",regenerate:"regenerated",delete:"deleted",verify:"verified",none:"touched"};var ht=re(require("node:fs")),Ue=re(require("node:path")),eI=require("node:crypto"),BT=require("node:child_process");var KE=re(require("fs")),gn=re(require("path"));var Tt=re(require("node:fs")),tn=re(require("node:path")),WE=require("node:child_process");var HE=re(require("fs")),wr=re(require("path"));var Dye={lf:`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyramp/testbot-core",
3
- "version": "0.13.2-v3.501",
3
+ "version": "0.13.2-v3.503",
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.",