@skyramp/testbot-core 0.13.2-v3.482 → 0.13.2-v3.483
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/VERSION.json +1 -1
- package/dist/main.js +531 -531
- package/dist/post.js +76 -76
- package/dist/runner-client.cjs +7 -7
- package/dist/runner-client.d.cts +2 -2
- package/package.json +1 -1
package/dist/runner-client.cjs
CHANGED
|
@@ -173,18 +173,18 @@ try { runtime = require("@skyramp/testbot-core/dist/shared-environment-test.cjs"
|
|
|
173
173
|
if (runtime && typeof runtime.sharedEnvironmentTest === "function") runtime.sharedEnvironmentTest(spec, __filename);
|
|
174
174
|
else require("node:test").test(spec.name, () => { throw new Error("required shared-environment guard runtime is unavailable"); });
|
|
175
175
|
`;function Yf(e){return lT+JSON.stringify($H.parse(e),null,2)+dT}o(Yf,"renderDeliveredSharedTest");function Bo(e){if(e.includes("\r")){if(/(?:^|[^\r])\n|\r(?!\n)/.test(e))return;e=e.replace(/\r\n/g,`
|
|
176
|
-
`)}if(!(!e.startsWith(lT)||!e.endsWith(dT)))try{let t=$H.safeParse(JSON.parse(e.slice(lT.length,-dT.length)));return t.success&&Yf(t.data)===e?t.data:void 0}catch{return}}o(Bo,"parseDeliveredSharedTest");var Wf=d.string().trim().min(1),nme=d.object({cwd:Wf.describe(`directory the command starts in, relative to the test's checkout ("." for its root)`),argv:d.array(Wf).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")}),TH=d.object({file:Wf.describe("a file of the test's checkout, relative to its root"),line:Wf.describe("a line of that file, quoted exactly from where its command starts to its end")}),DH=d.object({collected:d.boolean().describe("whether the repo's CI runs this test as it is"),steps:d.array(TH).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:nme.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(Wf).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(TH).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 sme=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")}),Zf=(n=>(n.InProcess="in-process",n.Browser="browser",n))(Zf||{}),NH=(i=>(i.Spec="spec",i.PrDescription="pr-description",i.Inferred="inferred",i))(NH||{}),PH=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(sme).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(Zf).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(NH).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 sLe=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 oLe=["stale_test","open_question"],aLe=["low","medium","high","critical"];var de=d.string().trim().min(1),dme=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"),pme=d.preprocess(dme,d.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:d.string().optional().describe("only when no test can check this clause here: why"),type:d.nativeEnum(ri).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)")})),UH=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:de.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`}),fme=d.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: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: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: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:de.regex(Ks).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: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 change does not touch this criterion at all (e.g. a later step of a staged rollout), why; give it no clauses"),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(UH).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(pme)}),OH=(r=>(r.ServerError="server-error",r.DataLost="data-lost",r.FinalState="final-state",r.DerivedValues="derived-values",r))(OH||{}),Ame=d.object({id:de.describe('e.g. "F1"'),file:de,line:d.number().optional(),claim:de.describe("the defect, in one sentence"),severity:d.nativeEnum(_a),evidence:de.describe("the code line, or the probe request and response, that shows it"),conflictsWith:d.array(de).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(OH).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)")}),gme=d.object({id:de.describe('e.g. "Q1"'),question:de.describe("what is unsettled, as a question the PR author can answer"),readings:d.array(de).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(UH).optional().describe("when sources of the same rank disagree on it: each of them")}),hme=d.object({id:de.describe('unique, a short kebab-case name for what the case checks, e.g. "ship-twice-409"'),type:d.nativeEnum(ri).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:d.string().optional().describe("the clause id this case checks"),finding:d.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: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")}),mme=d.object({test:de.describe("existing test file"),action:d.nativeEnum(Ni),reason:de,mutates:d.boolean().optional().describe("true when the maintained test changes state"),clauses:d.array(de).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")}),FH=d.array(fC).optional(),yme=d.object({components:d.preprocess(e=>FH.safeParse(e).success?e:void 0,FH).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:de,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()}),jLe=d.object({schemaVersion:d.literal(1),requirements:d.array(fme),findings:d.array(Ame),cases:d.array(hme).describe("a second test for a clause, and one case per finding that fails on this branch"),questions:d.array(gme).optional().describe("behaviours the change leaves unsettled; no case asserts any of them"),maintenance:d.array(mme),journeys:d.array(PH).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: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:d.array(d.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:d.array(d.object({components:d.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:kp.optional().describe("the validation triage decision, made before the app is started; its behaviorIds are clause ids"),app:yme.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 Xf=(n=>(n.Backend="backend",n.Ui="ui",n))(Xf||{});var ci=(r=>(r.Added="added",r.Updated="updated",r.Deleted="deleted",r.Unchanged="unchanged",r))(ci||{}),Eme=d.object({file:de.describe("repo-relative path; in another repo of the change, that repo's directory name then its path"),kind:d.nativeEnum(Xf),change:d.nativeEnum(ci).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: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: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"),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:de,status:d.nativeEnum(Jn),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: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:qh.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:de,evidence:de})).optional().describe("per covered case, the assertion line that checks its expected outcome"),functions:d.array(d.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:d.array(de).describe("the plan case or maintenance clause ids it checks"),testProblem:qh.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: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:DH.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 ${vn}, or go-test-json); Testbot runs it before write ends and re-runs the tests with it`)}),Ime=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"),vme=d.preprocess(Ime,d.object({description:de.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(de).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(de).optional().describe("the plan's requirement or clause ids it violates")})),GLe=d.object({schemaVersion:d.literal(1),tests:d.array(Eme),notWritten:d.array(d.object({case:de,reason:de,coveredBy:d.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: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: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:d.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: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: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:d.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:d.array(vme).describe("every defect the tests found"),nextSteps:d.array(d.string()),noTests:d.array(d.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: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 VLe={added:"place",updated:"update",deleted:"delete",unchanged:"verify"};function Is(e){return e.rel!==""&&!e.rel.startsWith("..")&&!Zt.isAbsolute(e.rel)}o(Is,"insideCheckout");function ji(e,t,n=kH){let i=t.map(p=>({name:zC(p),root:Zt.resolve(p.path),slug:p.slug})),r=new Map([...i].reverse().map(p=>[p.name,p])),s=t.length?[{real:dm(Zt.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=Zt.resolve(e,p),g=Kf.existsSync(f),h=o(Q=>({root:e,rel:cs(e,p),ambiguous:Q,exists:g}),"working");if(!t.length)return h(!1);let m=!1,E=p.replace(/^\.\//,""),I=E.split("/")[0],v=r.get(I);if(v){let Q=E.slice(I.length+1),C=Kf.existsSync(Zt.join(v.root,Q)),T=!Kf.existsSync(Zt.join(e,I))||!g&&C;if(C&&g&&Zt.join(v.root,Q)!==f){let k=c(v.root).has(cs(v.root,Q)),Z=c(e).has(cs(e,p));k&&!Z?T=!0:k===Z&&(m=!0)}if(T)return{root:v.root,rel:cs(v.root,Q),repository:v.slug,dir:v.name,ambiguous:m,exists:C}}let b=Zt.join(dm(Zt.dirname(f)),Zt.basename(f)),w=s.find(Q=>Is({rel:Zt.relative(Q.real,b)}));return w?"slug"in w?{root:w.root,rel:Zt.relative(w.real,b),repository:w.slug,dir:w.name,ambiguous:m,exists:g}:{...h(m),rel:Zt.relative(w.real,b)}:h(m)},"place"),l=new Map;return p=>l.get(p)??l.set(p,u(p)).get(p)}o(ji,"checkoutPlacer");uu();var aje=5*6e4,cje=12*6e4,uje=2*6e4;var hje=["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(`
|
|
176
|
+
`)}if(!(!e.startsWith(lT)||!e.endsWith(dT)))try{let t=$H.safeParse(JSON.parse(e.slice(lT.length,-dT.length)));return t.success&&Yf(t.data)===e?t.data:void 0}catch{return}}o(Bo,"parseDeliveredSharedTest");var Wf=d.string().trim().min(1),nme=d.object({cwd:Wf.describe(`directory the command starts in, relative to the test's checkout ("." for its root)`),argv:d.array(Wf).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")}),TH=d.object({file:Wf.describe("a file of the test's checkout, relative to its root"),line:Wf.describe("a line of that file, quoted exactly from where its command starts to its end")}),DH=d.object({collected:d.boolean().describe("whether the repo's CI runs this test as it is"),steps:d.array(TH).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:nme.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(Wf).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(TH).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 sme=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")}),Zf=(n=>(n.InProcess="in-process",n.Browser="browser",n))(Zf||{}),NH=(i=>(i.Spec="spec",i.PrDescription="pr-description",i.Inferred="inferred",i))(NH||{}),PH=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(sme).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(Zf).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(NH).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 sLe=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 oLe=["stale_test","open_question"],aLe=["low","medium","high","critical"];var de=d.string().trim().min(1),dme=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"),pme=d.preprocess(dme,d.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:d.string().optional().describe("only when no test can check this clause here: why"),type:d.nativeEnum(ri).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)")})),UH=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:de.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`}),fme=d.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: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: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: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:de.regex(Ks).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: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(UH).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(pme)}),OH=(r=>(r.ServerError="server-error",r.DataLost="data-lost",r.FinalState="final-state",r.DerivedValues="derived-values",r))(OH||{}),Ame=d.object({id:de.describe('e.g. "F1"'),file:de,line:d.number().optional(),claim:de.describe("the defect, in one sentence"),severity:d.nativeEnum(_a),evidence:de.describe("the code line, or the probe request and response, that shows it"),conflictsWith:d.array(de).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(OH).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)")}),gme=d.object({id:de.describe('e.g. "Q1"'),question:de.describe("what is unsettled, as a question the PR author can answer"),readings:d.array(de).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(UH).optional().describe("when sources of the same rank disagree on it: each of them")}),hme=d.object({id:de.describe('unique, a short kebab-case name for what the case checks, e.g. "ship-twice-409"'),type:d.nativeEnum(ri).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:d.string().optional().describe("the clause id this case checks"),finding:d.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: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")}),mme=d.object({test:de.describe("existing test file"),action:d.nativeEnum(Ni),reason:de,mutates:d.boolean().optional().describe("true when the maintained test changes state"),clauses:d.array(de).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")}),FH=d.array(fC).optional(),yme=d.object({components:d.preprocess(e=>FH.safeParse(e).success?e:void 0,FH).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:de,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()}),jLe=d.object({schemaVersion:d.literal(1),requirements:d.array(fme),findings:d.array(Ame),cases:d.array(hme).describe("a second test for a clause, and one case per finding that fails on this branch"),questions:d.array(gme).optional().describe("behaviours the change leaves unsettled; no case asserts any of them"),maintenance:d.array(mme),journeys:d.array(PH).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: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:d.array(d.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:d.array(d.object({components:d.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:kp.optional().describe("the validation triage decision, made before the app is started; its behaviorIds are clause ids"),app:yme.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 Xf=(n=>(n.Backend="backend",n.Ui="ui",n))(Xf||{});var ci=(r=>(r.Added="added",r.Updated="updated",r.Deleted="deleted",r.Unchanged="unchanged",r))(ci||{}),Eme=d.object({file:de.describe("repo-relative path; in another repo of the change, that repo's directory name then its path"),kind:d.nativeEnum(Xf),change:d.nativeEnum(ci).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: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: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"),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:de,status:d.nativeEnum(Jn),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: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:qh.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:de,evidence:de})).optional().describe("per covered case, the assertion line that checks its expected outcome"),functions:d.array(d.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:d.array(de).describe("the plan case or maintenance clause ids it checks"),testProblem:qh.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: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:DH.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 ${vn}, or go-test-json); Testbot runs it before write ends and re-runs the tests with it`)}),Ime=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"),vme=d.preprocess(Ime,d.object({description:de.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(de).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(de).optional().describe("the plan's requirement or clause ids it violates")})),GLe=d.object({schemaVersion:d.literal(1),tests:d.array(Eme),notWritten:d.array(d.object({case:de,reason:de,coveredBy:d.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: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: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:d.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: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: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:d.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:d.array(vme).describe("every defect the tests found"),nextSteps:d.array(d.string()),noTests:d.array(d.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: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 VLe={added:"place",updated:"update",deleted:"delete",unchanged:"verify"};function Is(e){return e.rel!==""&&!e.rel.startsWith("..")&&!Zt.isAbsolute(e.rel)}o(Is,"insideCheckout");function ji(e,t,n=kH){let i=t.map(p=>({name:zC(p),root:Zt.resolve(p.path),slug:p.slug})),r=new Map([...i].reverse().map(p=>[p.name,p])),s=t.length?[{real:dm(Zt.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=Zt.resolve(e,p),g=Kf.existsSync(f),h=o(Q=>({root:e,rel:cs(e,p),ambiguous:Q,exists:g}),"working");if(!t.length)return h(!1);let m=!1,E=p.replace(/^\.\//,""),I=E.split("/")[0],v=r.get(I);if(v){let Q=E.slice(I.length+1),C=Kf.existsSync(Zt.join(v.root,Q)),T=!Kf.existsSync(Zt.join(e,I))||!g&&C;if(C&&g&&Zt.join(v.root,Q)!==f){let k=c(v.root).has(cs(v.root,Q)),Z=c(e).has(cs(e,p));k&&!Z?T=!0:k===Z&&(m=!0)}if(T)return{root:v.root,rel:cs(v.root,Q),repository:v.slug,dir:v.name,ambiguous:m,exists:C}}let b=Zt.join(dm(Zt.dirname(f)),Zt.basename(f)),w=s.find(Q=>Is({rel:Zt.relative(Q.real,b)}));return w?"slug"in w?{root:w.root,rel:Zt.relative(w.real,b),repository:w.slug,dir:w.name,ambiguous:m,exists:g}:{...h(m),rel:Zt.relative(w.real,b)}:h(m)},"place"),l=new Map;return p=>l.get(p)??l.set(p,u(p)).get(p)}o(ji,"checkoutPlacer");uu();var aje=5*6e4,cje=12*6e4,uje=2*6e4;var hje=["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(`
|
|
177
177
|
`);var xje=[...Dl,"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 Ro=re(V0());var o1e={jest:"jest",vitest:"vitest"};var Sme=[["target","surefire-reports"],["target","failsafe-reports"],["build","test-results"]],hGe=new Set(Sme.map(([e])=>e));var mGe=new Set(["jest","vitest","npm-test","playwright"]);var Rme="ci-collect";var $Ge=5*6e4;function GH(e,t){let n=new Set(t.tests.map(i=>i.file));return(Se(e,`${Rme}.json`)?.checks??[]).filter(i=>n.has(i.file))}o(GH,"currentCiChecks");function fT(e){let t=Se(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(GH(e,t).filter(i=>i.verdict==="unprovisioned"&&n.has(i.file)).map(i=>i.file))}o(fT,"withheldTests");var nr=re(require("fs")),vs=re(require("path"));var Qo=re(require("fs")),zE=re(require("path"));var xme="change-inputs",$me=o((e,t)=>`${t}-${e.replace(/[^\w.-]+/g,n=>n==="/"?"__":"-")}.md`,"fileName");function Tme(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:$me(t.label,n)})).filter(t=>t.body.length>j1)}o(Tme,"longDescriptions");function VH(e,t,n){let i=zE.join(t,xme);Qo.rmSync(i,{recursive:!0,force:!0}),Qo.mkdirSync(i,{recursive:!0}),Qo.writeFileSync(zE.join(i,xa),n,{mode:292});for(let r of Tme(e))Qo.writeFileSync(zE.join(i,r.file),`${r.body}
|
|
178
178
|
`,{mode:292})}o(VH,"writeChangeInputs");var Dme=[/^\.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 zH(e){return Dme.some(t=>t.test(e))}o(zH,"isNonApplicationFile");function _me(e){let t=[],n=e.inputs.repositoryPath;return!n||!nr.existsSync(n)?t.push(`repository path does not exist: ${n}`):X$(n)?Df(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(_me,"validatePreflightInput");function Nme(e){return(e.inputs.relatedRepos??[]).map(t=>{let n=nr.existsSync(t.path)?bE(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(Nme,"collectRelatedChanges");function Pme(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(Pme,"writeRelatedDiffs");function Fme(e){let{repositoryPath:t,baseBranch:n}=e.inputs;nr.rmSync(vs.join(t,J$),{recursive:!0,force:!0});let i=bE(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=Nme(e),a=[i.changedFiles,...s.map(f=>f.changedFiles)].flat(),c=a.map(f=>f.path).filter(zH),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,xa),r.diffContent),VH(e.inputs,e.runDir,r.diffContent),Pme(e);let p=vs.join(e.runDir,LC);return nr.mkdirSync(vs.dirname(p),{recursive:!0}),nr.writeFileSync(p,JSON.stringify(l,null,2)+`
|
|
179
|
-
`),e.prepared={preflight:l},{preflight:LC,diff:xa}}o(Fme,"executePreflight");var FVe={name:"preflight",timeoutMinutes:1,requires:[],validateInput:_me,execute:Fme};var ic=re(require("path"));var YVe={python:"pytest",typescript:"playwright",javascript:"playwright"},WVe={pytest:"pytest",playwright:"playwright"};var jme=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 JH(e){let t=ic.basename(e);return jme.has(t)||/^requirements[^/\\]*\.(txt|in)$/.test(t)}o(JH,"isDependencyFile");var nA=re(require("path"));var YH=(i=>(i.Requirement="requirement",i.PrDescription="pr_description",i.Code="code",i))(YH||{}),An=d.string().trim().min(1),zme=d.object({expectation:An.max(300).describe("the behavior this assertion pins, in words"),source:d.nativeEnum(YH),expected:An.max(200).describe("the exact value or outcome asserted, as the test asserts it")}),qme=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(zme).min(1)}),eA=(n=>(n.Updated="updated",n.Deleted="deleted",n))(eA||{}),HH=300,Jme=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(eA),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,HH):e,An.max(HH)).describe("what the change deliberately altered that made the test wrong")}),AT=d.object({schemaVersion:d.literal(1),tests:d.array(qme),maintained:d.array(Jme).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 tA="generate-unit.json";function Yme(e){let{value:t,error:n}=qt(e);if(n)return{errors:[n]};let{value:i,errors:r}=$n(AT,t);return r.length?{errors:r}:{output:i,errors:[]}}o(Yme,"parseGenerateUnitText");function Wme(e){return Yme(e.stdout)}o(Wme,"parseGenerateUnitFromSession");var Aqe=Hn("generate-unit-schema",(e,t)=>Wme(t));var qE=String.raw`(?:node:)?(?:http|https|http2|net|tls|dgram)`,gqe=[[/\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 Zme(e){return $n(KC,e).errors}o(Zme,"validateFinalizeOutput");function Kme(e,t=[]){let{value:n,error:i}=qt(e,t);if(i)return{errors:[i]};let r=Zme(n);return r.length>0?{errors:r}:{finalize:n,errors:[]}}o(Kme,"parseFinalizeText");var Xme="finalize-scratch";function eye(e,t){let n=Kme(e.stdout,t?.secretValues);if(!n.finalize||!t?.outputsDir)return n;let i=o((r,s)=>r.trim()&&gI(r.trim(),nA.join(t.outputsDir,Xme,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 Pqe=Hn("finalize-schema",(e,t)=>eye(t,e));var KH=re(require("path"));var AJe=new Set(["targeted_unit","existing_evidence_sufficient"]);var oye="triage.json";var
|
|
179
|
+
`),e.prepared={preflight:l},{preflight:LC,diff:xa}}o(Fme,"executePreflight");var FVe={name:"preflight",timeoutMinutes:1,requires:[],validateInput:_me,execute:Fme};var ic=re(require("path"));var YVe={python:"pytest",typescript:"playwright",javascript:"playwright"},WVe={pytest:"pytest",playwright:"playwright"};var jme=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 JH(e){let t=ic.basename(e);return jme.has(t)||/^requirements[^/\\]*\.(txt|in)$/.test(t)}o(JH,"isDependencyFile");var nA=re(require("path"));var YH=(i=>(i.Requirement="requirement",i.PrDescription="pr_description",i.Code="code",i))(YH||{}),An=d.string().trim().min(1),zme=d.object({expectation:An.max(300).describe("the behavior this assertion pins, in words"),source:d.nativeEnum(YH),expected:An.max(200).describe("the exact value or outcome asserted, as the test asserts it")}),qme=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(zme).min(1)}),eA=(n=>(n.Updated="updated",n.Deleted="deleted",n))(eA||{}),HH=300,Jme=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(eA),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,HH):e,An.max(HH)).describe("what the change deliberately altered that made the test wrong")}),AT=d.object({schemaVersion:d.literal(1),tests:d.array(qme),maintained:d.array(Jme).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 tA="generate-unit.json";function Yme(e){let{value:t,error:n}=qt(e);if(n)return{errors:[n]};let{value:i,errors:r}=$n(AT,t);return r.length?{errors:r}:{output:i,errors:[]}}o(Yme,"parseGenerateUnitText");function Wme(e){return Yme(e.stdout)}o(Wme,"parseGenerateUnitFromSession");var Aqe=Hn("generate-unit-schema",(e,t)=>Wme(t));var qE=String.raw`(?:node:)?(?:http|https|http2|net|tls|dgram)`,gqe=[[/\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 Zme(e){return $n(KC,e).errors}o(Zme,"validateFinalizeOutput");function Kme(e,t=[]){let{value:n,error:i}=qt(e,t);if(i)return{errors:[i]};let r=Zme(n);return r.length>0?{errors:r}:{finalize:n,errors:[]}}o(Kme,"parseFinalizeText");var Xme="finalize-scratch";function eye(e,t){let n=Kme(e.stdout,t?.secretValues);if(!n.finalize||!t?.outputsDir)return n;let i=o((r,s)=>r.trim()&&gI(r.trim(),nA.join(t.outputsDir,Xme,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 Pqe=Hn("finalize-schema",(e,t)=>eye(t,e));var KH=re(require("path"));var AJe=new Set(["targeted_unit","existing_evidence_sufficient"]);var oye="triage.json";var xHe=new Set(["existing_evidence","unaffected","existing_unit","new_unit","runtime"]),$He={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 aye(e){let{value:t,error:n}=qt(e);if(n)return{errors:[n]};let{value:i,errors:r}=$n(kp,t);return r.length?{errors:r}:{triage:i,errors:[]}}o(aye,"parseTriageText");function cye(e){return aye(e.stdout)}o(cye,"parseTriageFromSession");var THe=Hn("triage-schema",(e,t)=>cye(t));function uye(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(uye,"triageDecider");function hT(e){if(uye(e)?.status==="passed")return no(KH.join(e.outputsDir,oye))}o(hT,"readTriage");function mT(e){return a2(j$(e.inputs,Se(e,`${Tf}.json`),hT(e)?.sutRequired))}o(mT,"revisionBlockReason");var DHe=new Set(["deploy","recommend","generate","generate-ui","adapt","generate-unit","native-run","finalize","deliver"]);function yT(e){return e.functions?.length?e.functions:[(e.testType==="unit"?e.testId.split("::").slice(1).join("::").replace(/\[.*\]$/,""):"")||e.testId]}o(yT,"rowFunctions");function Il(e){return new Set(e.flatMap(t=>yT(t).map(n=>`${t.repository??""}\0${t.fileName}\0${n}`))).size}o(Il,"testCount");function lye(e){return $n(WC,e).errors}o(lye,"validateAnalysisOutput");function XH(e,t=[]){let{value:n,error:i}=qt(e,t);if(i)return{errors:[i]};let r=lye(n);return r.length>0?{errors:r}:{analysis:n,errors:[]}}o(XH,"parseAnalysisText");function dye(e,t=[]){return XH(e.stdout,t)}o(dye,"parseAnalysisFromSession");var eYe=Hn("analysis-schema",(e,t)=>dye(t,e.secretValues));var VWe=Nh.rows.notRun(!0);var rA="kept, not ";var iA="(declined the planned ";function ET(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(ET,"assertionParts");var IT=new Set(["update","regenerate","delete"]);var zWe={update:"updated",regenerate:"regenerated",delete:"deleted",verify:"verified",none:"touched"};var mt=re(require("node:fs")),Oe=re(require("node:path")),eI=require("node:crypto"),CT=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")),br=re(require("path"));var Aye={lf:`
|
|
180
180
|
`,crlf:`\r
|
|
181
181
|
`,cr:"\r"},gye=5*1024*1024,eY=o(e=>e.replace(/[.+^$()|\\/{}[\]*?]/g,"\\$&"),"escaped");function hye(e,t){let n=0;for(let i=t;i<e.length;i++)if(e[i]==="\\")i++;else if(e[i]==="{")n++;else if(e[i]==="}"&&--n===0)return i;return-1}o(hye,"closingBrace");function mye(e){let t=[],n=0,i="";for(let r=0;r<e.length;r++){let s=e[r];if(s==="\\"){i+=s+(e[++r]??"");continue}s==="{"&&n++,s==="}"&&n--,s===","&&!n?(t.push(i),i=""):i+=s}return[...t,i]}o(mye,"braceParts");function vT(e){let t="";for(let n=0;n<e.length;n++){let i=e[n];if(i==="\\")t+=eY(e[++n]??"\\");else if(i==="*"&&e[n+1]==="*"){let r=(n===0||e[n-1]==="/")&&e[n+2]==="/";t+=r?"(?:.*/)?":".*",n+=r?2:1}else if(i==="*")t+="[^/]*";else if(i==="?")t+="[^/]";else if(i==="["){let r=e.indexOf("]",n+2);if(r<0||e.slice(n,r).includes("/"))t+="\\[";else{let s=e.slice(n+1,r);t+=`[${s.replace(/^!/,"^").replace(/\\(?!\])/g,"\\\\")}]`,n=r}}else if(i==="{"){let r=hye(e,n),s=r<0?"":e.slice(n+1,r),a=/^(-?\d+)\.\.(-?\d+)$/.exec(s),c=mye(s);if(a){let[u,l]=[Number(a[1]),Number(a[2])].sort((p,f)=>p-f);t+=`(?:${Array.from({length:Math.min(l-u+1,1e4)},(p,f)=>String(u+f)).join("|")})`,n=r}else c.length>1?(t+=`(?:${c.map(vT).join("|")})`,n=r):t+="\\{"}else t+=eY(i)}return t}o(vT,"globSource");function yye(e){return e.includes("/")?new RegExp(`^${vT(e.replace(/^\//,""))}$`):new RegExp(`^(?:.*/)?${vT(e)}$`)}o(yye,"sectionMatcher");function Eye(e){let t={root:!1,sections:[]},n;for(let i of e.split(/\r\n|\r|\n/)){let r=i.trim();if(!r||r.startsWith("#")||r.startsWith(";"))continue;let s=/^\[(.+)\]$/.exec(r);if(s){n={matches:yye(s[1]),props:{}},t.sections.push(n);continue}let a=r.indexOf("=");if(a<0)continue;let c=r.slice(0,a).trim().toLowerCase(),u=r.slice(a+1).trim().toLowerCase();n?n.props[c]=u:c==="root"&&(t.root=u==="true")}return t}o(Eye,"parseEditorConfig");function Iye(e,t,n){let i=[];for(let s=br.dirname(t);;s=br.dirname(s)){let a=n(s);if(a&&i.unshift({dir:s,config:a}),a?.root||s===e||s===br.dirname(s))break}let r={};for(let{dir:s,config:a}of i){let c=br.relative(s,t).split(br.sep).join("/");for(let u of a.sections)u.matches.test(c)&&Object.assign(r,u.props)}return Object.fromEntries(Object.entries(r).filter(([,s])=>s!=="unset"))}o(Iye,"conventionsFor");function vye(e,t){let n=e.startsWith("#!"),i=t.end_of_line?Aye[t.end_of_line]:void 0,r=i&&!(n&&i!==`
|
|
182
182
|
`)?i:void 0,s=r?e.replace(/\r\n|\r|\n/g,r):e;return t.insert_final_newline==="true"&&s.length&&!/[\r\n]$/.test(s)&&(s+=r??/\r\n|\r|\n/.exec(s)?.[0]??`
|
|
183
183
|
`),s}o(vye,"conformed");function vl(e,t,n){if(n.length>gye||n.includes(0))return n;let i=br.resolve(e),r=Iye(i,br.resolve(i,t),s=>{try{return Eye(HE.readFileSync(br.join(s,".editorconfig"),"utf-8"))}catch{return}});return Buffer.from(vye(n.toString("latin1"),r),"latin1")}o(vl,"conformDeliveredBytes");var tY=re(require("fs")),nY=re(require("path"));function bl(e=__dirname){try{let t=tY.readFileSync(nY.join(e,"VERSION.json"),"utf-8"),n=JSON.parse(t);if(typeof n.version=="string"&&typeof n.commit=="string")return{version:n.version,commit:n.commit}}catch{}return{version:"unknown",commit:"unknown"}}o(bl,"getTestbotVersion");function rY(e){let t=Se(e,"recommend.json"),n=new Map((t?.withheld??[]).map(({id:i,reason:r})=>[i,`off-limits execution (${r??"environment policy"})`]));if(Se(e,`${t2}.json`)?.browserWithheld)for(let i of t?.generate??[])i.type==="ui"&&!n.has(i.id)&&n.set(i.id,"the shared-environment browser guard is unavailable");return n}o(rY,"writeExecutionRestrictions");function iY(e,t){let n=new Set((e.covers??[]).flatMap(i=>{let r=t.get(i);return r?[r]:[]}));return n.size?`environment restriction: ${[...n].join("; ")}`:void 0}o(iY,"writtenRestriction");var oY=re(require("fs"));var aY=2*1024*1024;function bye(e){let t=[];for(let n of e??[])if(n.state==="read")try{t.push({item:n,text:oY.readFileSync(O1(n),"utf-8")})}catch{}return t}o(bye,"readItemTexts");var sA=6,wye=/[\p{L}\p{N}]+/gu,Cye=new RegExp("(?<=\\p{Ll})(?=\\p{Lu})|(?<=\\p{Lu})(?=\\p{Lu}\\p{Ll})","u");function bT(e){let t=[];for(let n of e.matchAll(wye)){let i=n.index;for(let r of n[0].split(Cye))t.push({word:r.toLowerCase(),start:i,end:i+r.length}),i+=r.length}return t}o(bT,"wordsOf");var cY=o((e,t)=>e.slice(t,t+sA).map(n=>n.word).join(" "),"runAt");function sY(e){let t=bT(e),n=new Set;for(let i=0;i+sA<=t.length;i++)n.add(cY(t,i));return n}o(sY,"runsOf");function uY(e,t=[]){let n=new Set(t.flatMap(i=>[...sY(i)]));return bye(e).map(({item:i,text:r})=>{let s=i.source==="other"?r:r.slice(r.indexOf(`
|
|
184
|
-
`)+1||r.length),a=sY(s);for(let c of n)a.delete(c);return{name:kj(i.key,MC([i])),key:i.key,runs:a,words:bT(s).map(c=>c.word)}})}o(uY,"requirementTexts");var
|
|
184
|
+
`)+1||r.length),a=sY(s);for(let c of n)a.delete(c);return{name:kj(i.key,MC([i])),key:i.key,runs:a,words:bT(s).map(c=>c.word)}})}o(uY,"requirementTexts");var c4e=sA/2;var Sye=o(e=>e.criteria.size?`${e.text.name} ${[...e.criteria].sort((t,n)=>t-n).map(t=>`AC${t}`).join(", ")}`:e.text.name,"copyName");function kye(e,t){if(t.length===0)return[];let n=bT(e),i=[];for(let r=0;r+sA<=n.length;r++){let s=cY(n,r),a=t.find(f=>f.runs.has(s));if(!a)continue;let c=n[r].start,u=n[r+sA-1].end,l=a.criteria?.get(s)??[],p=i.at(-1);if(p&&c<=p.end){if(p.end=Math.max(p.end,u),p.text===a)for(let f of l)p.criteria.add(f)}else i.push({start:c,end:u,text:a,criteria:new Set(l)})}return i.map(r=>({start:r.start,end:r.end,name:Sye(r)}))}o(kye,"copies");function wl(e,t,n=!1){let i=e;for(let r of kye(e,t).reverse()){let s=i.slice(0,r.start).trimEnd(),a=s===""||/[.!?\n]$/.test(i.slice(0,r.start).replace(/[ \t]+$/,"")),u=n&&(a||/[:;—–-]$/.test(s))&&/^\s+[\p{L}\d]/u.test(i.slice(r.end))?`${a?"The":"the"} case (see ${r.name})`:`(see ${r.name})`;i=`${i.slice(0,r.start)}${u}${i.slice(r.end)}`}return i}o(wl,"withoutRequirementText");function Bye(e,t,n){for(let i=t+1;i<e.length;i++){let r=e[i];if(r==="\\")i++;else{if(r===n)return i+1;if(r===`
|
|
185
185
|
`&&n!=="`")return i}}return e.length}o(Bye,"stringEnd");function Rye(e,t){let n=e.lastIndexOf(`
|
|
186
186
|
`,t-1)+1;if(e.slice(n,t).trim()!=="")return!1;let i=e.slice(0,n).trimEnd();return i===""||i.endsWith(":")}o(Rye,"isDocstring");function Qye(e){let t=[],n=o(r=>(e.indexOf(`
|
|
187
|
-
`,r)+1||e.length+1)-1,"lineEnd"),i=0;for(;i<e.length;){let r=e[i],s=e[i+1],a=i+1;if(r==="/"&&s==="*")a=e.indexOf("*/",i+2)<0?e.length:e.indexOf("*/",i+2)+2,t.push({start:i,end:a});else if(r==="/"&&s==="/"&&!/[:\w]/.test(e[i-1]??"")||r==="#"&&/^\s?$/.test(e[i-1]??"")&&!/[!{[]/.test(s??""))a=n(i),t.push({start:i,end:a});else if((r==='"'||r==="'")&&e.startsWith(r.repeat(3),i)){let c=e.indexOf(r.repeat(3),i+3);a=c<0?e.length:c+3,Rye(e,i)&&t.push({start:i,end:a})}else(r==='"'||r==="'"||r==="`")&&(a=Bye(e,i,r));i=a}return t}o(Qye,"commentRanges");var xye=/\b(?:test|it|describe|context|suite|scenario|specify|Run|DisplayName)(?:\.\w+)*(?:\.each\s*(?:\((?:[^()]|\([^()]*\))*\)|`[^`]*`))?\s*\(\s*("(?:[^"\\\n]|\\.)*"|'(?:[^'\\\n]|\\.)*'|`(?:[^`\\]|\\.)*`)/g;function $ye(e,t){return[...e.matchAll(xye)].flatMap(n=>{if(t.some(r=>n.index>=r.start&&n.index<r.end))return[];let i=n.index+n[0].length;return[{start:i-n[1].length,end:i}]})}o($ye,"titleRanges");function sc(e,t){if(t.length===0)return{content:e,cleaned:!1};let n=Qye(e),i=[];for(let c of n){let u=e.slice(c.start,c.end),l=wl(u,t);l!==u&&i.push({...c,text:l})}let r=$ye(e,n),s=new Set(r.map(c=>e.slice(c.start+1,c.end-1)));for(let c of r){let u=e[c.start],l=e.slice(c.start+1,c.end-1),p=wl(l,t);if(p===l)continue;let f=p;for(let g=2;s.has(f);g++)f=`${p} (${g})`;s.add(f),i.push({...c,text:`${u}${f}${u}`})}let a=e;for(let c of i.sort((u,l)=>l.start-u.start))a=`${a.slice(0,c.start)}${c.text}${a.slice(c.end)}`;return{content:a,cleaned:a!==e}}o(sc,"withoutRequirementTextInTestFile");function Tye(e){return!!e.guardedDelivery||!!e.context?.some(t=>t.safety?.route==="persistence")}o(Tye,"keepsSharedData");function aA(e,t){let n=e.inputs.sharedEnvironment?.environmentAddress;return!!n&&(t.result?.cases??[]).some(i=>i.runtimeTargets?.some(r=>eo(n,r)))}o(aA,"usesSharedRuntime");function ZE(e,t,n=bl().version){if(!ai(e.inputs))return[];let i=e.inputs.sharedEnvironment,r=i?.environmentAddress,s=Se(e,wC),a=Nj.safeParse(s),c=a.success&&a.data.environmentId===i?.environmentId&&a.data.environmentAddress===r?a.data:void 0,u=Pj.safeParse(s),l=u.success?dp(u.data.refusal):a.success?dp("changed"):dp("unavailable"),p=rY(e),f=Se(e,"recommend.json"),g=new Map((f?.generate??[]).map(({id:E,target:I})=>[E,I])),h=ji(e.inputs.repositoryPath,e.inputs.relatedRepos??[]),m=new Map;for(let E of t.tests){if(E.change==="deleted")continue;let I=h(E.file);if(!Is(I)||Da(I.rel))continue;let v=io(e.inputs,I.repository);if("error"in v)continue;let b=v.source,w=tn.resolve(b.path,I.rel),Q=iY(E,p),C=Tye(E),T=aA(e,E),k;if(!Q&&!T&&!C){if(!w.endsWith(".test.cjs"))continue;try{if(!oA(b.path,w))continue;k=Bo(Tt.readFileSync(w,"utf8"))}catch{continue}if(!k||"restriction"in k)continue}let Z=(E.covers??[]).flatMap(it=>{let Ke=g.get(it)?.match(/^(GET|HEAD|OPTIONS|POST|PUT|PATCH|DELETE)\s+(\S+)/i);return!Ke||!r?[]:Ke[2].startsWith("/")||eo(r,Ke[2])?[{method:Ke[1].toUpperCase(),route:Ke[2]}]:[]}),oe=Fye(e,b.path,I.rel);if(!Q&&E.change!=="added"&&(oe===!1||oe===void 0&&!e.inputs.deliver))continue;let J=o(it=>`${E.file}: shared-environment delivery is blocked: ${it}`,"problem"),pe={repository:b.slug,file:I.rel,sourceAsset:`${I.rel}.source`},Be;try{if(!oA(b.path,w))throw new Error("invalid path");Be=Tt.readFileSync(w)}catch{m.set(w,{record:pe,source:b,original:Buffer.alloc(0),problems:[J("test entry must be a regular file without symlinks")]});continue}if(E.change!=="added"&&xo(e,b.path,I.rel)){Q&&(pe.reason=Q,m.set(w,{record:pe,source:b,original:Be,problems:[]}));continue}if(oe===!1||E.change!=="added"&&oe!==!0){m.set(w,{record:pe,source:b,original:Be,problems:[J(oe===!1?"the file changes an existing test; retain the assertions in a new file":"cannot prove whether the shared test already exists; use a host-pinned checkout")]});continue}if(k??=Bo(Be.toString("utf8")),!Q&&k&&"restriction"in k)continue;let xe,Re=GE.safeParse(E.guardedDelivery),K=c&&i?{environmentId:c.environmentId,environmentAddress:c.environmentAddress,persistenceRevision:c.revision,offLimits:i.offLimits??[],route:{kind:"persistence"}}:void 0;if(Q)xe=Q;else if(!Re.success)xe="no guarded HTTP representation preserves the test's assertions";else if(E.covers?.length!==1||(E.functions?.length??1)!==1)xe="guarded HTTP delivery requires one test function for one planned case";else if(!K)xe=`environment restriction: persistence permission was not confirmed at generation: ${l}`;else if(!/\.test\.cjs$/.test(I.rel)||!Nye(E.ci?.runner)||!E.ci?.collected)xe="the test has no compatible Node CI entry";else if(!Pye(b.path,w,n))xe="the CI package does not declare this engine's released guarded runtime";else{let{steps:it}=Re.data,Ke=K.offLimits.length?U$(e.inputs.skyrampMcp,K.offLimits):void 0,Ft=new Map,yt=it.flatMap(st=>{if(st.op==="create"){let ot=Dye(K.environmentAddress,st.collection);return ot&&Ft.set(st.as,ot),[{method:"POST",url:ot,child:!1}]}if(st.op!=="read"&&st.op!=="update")return[];let Dt=Ft.get(st.resource);return Dt&&Ft.set(st.as,Dt),[{method:st.op==="read"?"GET":st.method??"PATCH",url:Dt,child:!0}]});yt.some(({url:st})=>!st)?xe="the guarded HTTP steps name an unknown resource or a collection outside the Test Environment":Ke&&i&&yt.some(({url:st,child:Dt})=>!Dt&&e2(st.href,i,Ke))?xe="the guarded HTTP steps name an off-limits collection":Z.length&&!Z.some(({method:st,route:Dt})=>yt.some(ot=>ot.url&&ot.method===st&&_ye(K.environmentAddress,ot.url,ot.child,Dt)))&&(xe="the guarded HTTP steps do not represent the planned HTTP operation")}let z;if(xe)pe.reason=xe;else if(Re.success&&K){let{bearerTokenEnv:it,...Ke}=Re.data;z={...Ke,definition:{...K,...it?{bearerTokenEnv:it}:{}}},pe.entry=I.rel}let Ye=tn.resolve(b.path,pe.sourceAsset),Ze=wT(Ye)&&!YE(b.path,Ye,Be)?[J("the inert source asset path already contains different bytes")]:[];m.set(w,{record:pe,source:b,original:Be,spec:z,problems:Ze})}return[...m.values()]}o(ZE,"planGuardedDelivery");function Dye(e,t){try{let n=new URL(t,`${e.replace(/\/$/,"")}/`);return!n.search&&!n.hash&&!n.username&&!n.password&&!/[\\]|%(?:2f|5c|2e|25)/i.test(t)&&eo(e,n.href)?n:void 0}catch{return}}o(Dye,"guardedCollection");function _ye(e,t,n,i){try{let r=new URL(i,t.origin),s=i.startsWith("/")&&!i.startsWith("//")&&!eo(e,r.href)?new URL(i.slice(1),`${e.replace(/\/$/,"")}/`):r;if(!eo(e,s.href))return!1;let a=t.pathname.replace(/\/$/,""),c=s.pathname.replace(/\/$/,"");if(!n)return c===a;if(!c.startsWith(`${a}/`))return!1;let u=decodeURIComponent(c.slice(a.length+1));return/^(:[\w-]+|\{[^/{}]+\}|<[^/<>]+>)$/.test(u)}catch{return!1}}o(_ye,"representsRoute");function Nye(e){return!!e&&/^(?:node|node:test|node\s+(?:.*\s)?--test(?:\s.*)?)$/i.test(e.trim())}o(Nye,"nodeTestRunner");function oA(e,t){let n=Tt.realpathSync(e);return Tt.lstatSync(t).isFile()&&Tt.realpathSync(t)===tn.join(n,tn.relative(e,t))}o(oA,"regularFileIn");function YE(e,t,n){try{return oA(e,t)&&Tt.readFileSync(t).equals(n)}catch{return!1}}o(YE,"sameRegularBytes");function wT(e){try{return Tt.lstatSync(e),!0}catch(t){if(t.code==="ENOENT")return!1;throw t}}o(wT,"pathExists");function Pye(e,t,n){if(n==="unknown")return!1;for(let i=tn.dirname(t);;i=tn.dirname(i)){let r=tn.join(i,"package.json");if(wT(r))try{if(!oA(e,r))return!1;let s=JSON.parse(Tt.readFileSync(r,"utf-8"));return(s.devDependencies?.["@skyramp/testbot-core"]??s.dependencies?.["@skyramp/testbot-core"])===n}catch{return!1}if(i===e)return!1}}o(Pye,"hasGuardRuntime");function cA(e){let t=Se(e,"write.json");return t?ZE(e,t):[]}o(cA,"guardedDeliveryPlan");function lY(e,t=cA(e),n=[],i=[]){return t.flatMap(({record:r,source:s,original:a,spec:c,problems:u})=>{if(u.length)return u;let l=tn.join(s.path,r.sourceAsset),p=tn.join(s.path,r.file);try{if(!oA(s.path,p)||!Tt.readFileSync(p).equals(a))return[`${r.file}: native source changed before guarded delivery`];let f=sc(a.toString("utf-8"),n).content;if(Js(f,e.secretValues??[])!==f)return[`${r.file}: the retained source contains a credential`];let g=vl(s.path,r.sourceAsset,Buffer.from(f));if(wT(l)){if(!YE(s.path,l,a)&&!YE(s.path,l,g))return[`${r.file}: the inert source asset path already contains different bytes`];YE(s.path,l,g)||(i.push(()=>Tt.writeFileSync(l,a)),Tt.writeFileSync(l,g))}else Tt.writeFileSync(l,g,{flag:"wx"}),i.push(()=>Tt.rmSync(l,{force:!0}));if(r.entry&&c){let h=Yf({...c,name:wl(c.name,n)}),m=vl(s.path,r.entry,Buffer.from(h));if(!Bo(m.toString("utf-8")))return[`${r.file}: the repository's file conventions changed the guarded entry`];if(Js(m.toString("utf-8"),e.secretValues??[])!==m.toString("utf-8"))return[`${r.file}: guarded delivery steps include a credential`];i.push(()=>Tt.writeFileSync(p,a)),Tt.writeFileSync(p,m)}return[]}catch{return[`${r.file}: could not assemble its guarded delivery files`]}})}o(lY,"writeGuardedDeliveryFiles");function Fye(e,t,n){let i=e.executionSafetySources?.find(r=>tn.resolve(r.path)===tn.resolve(t));if(i)try{return(0,WE.execFileSync)("git",["--literal-pathspecs","ls-tree",i.head,"--",n],{cwd:t,encoding:"utf-8",stdio:["ignore","pipe","ignore"]})===""}catch{return}}o(Fye,"newAtSourcePin");function xo(e,t,n){let i=e.executionSafetySources?.find(r=>tn.resolve(r.path)===tn.resolve(t));if(!i||!/^[a-f0-9]{40,64}$/.test(i.head))return!1;try{let r=tn.join(t,n),s=Tt.lstatSync(r);if(!s.isFile()||Tt.realpathSync(r)!==r)return!1;let a=(0,WE.execFileSync)("git",["--literal-pathspecs","ls-tree",i.head,"--",n],{cwd:t,encoding:"utf-8",stdio:["ignore","pipe","ignore"]});return!/^100(?:644|755) blob /.test(a)||(s.mode&73)!==0!==a.startsWith("100755")?!1:Tt.readFileSync(r).equals((0,WE.execFileSync)("git",["show",`${i.head}:${n}`],{cwd:t,stdio:["ignore","pipe","ignore"]}))}catch{return!1}}o(xo,"unchangedSource");function Uye(e){try{return KE.lstatSync(e),!0}catch{return!1}}o(Uye,"lexists");function XE(e,t=cA(e)){let n=new Set(t.filter(({record:I})=>!I.entry).map(({source:I,record:v})=>gn.join(I.path,v.file))),i=Se(e,"adapt.json"),r=Se(e,"finalize.json"),s=Se(e,tA),a=new Map,c=o(I=>{let v=io(e.inputs,I);if("error"in v)return;let b=a.get(v.source.path)??{source:v.source,paths:new Set};return a.set(v.source.path,b),{repo:b.source.path,paths:b.paths}},"pathsOf"),u=o((I,v)=>gn.relative(I,gn.resolve(I,v.trim())).replace(/\/+$/,""),"norm"),l=o((I,v)=>{let b=v?.trim()&&c(I);if(!b)return;let w=u(b.repo,v);b.paths.add(w);for(let Q of["__init__.py","conftest.py"]){let C=gn.join(gn.dirname(w),Q);KE.existsSync(gn.join(b.repo,C))&&(!n.has(gn.join(b.repo,w))||!xo(e,b.repo,C))&&b.paths.add(C)}},"addTest"),p=o((I,v)=>{if(typeof v!="string"||!v.trim())return;let b=c(I);if(!b)return;let w=u(b.repo,v);if(qf(gn.join(b.repo,w)))return b.paths.add(w),{...b,rel:w}},"addEdited"),f=fT(e),g=(i?.items??[]).filter(I=>I.action==="place"&&f.has(I.from??I.file??"")),h=o((I,v)=>g.some(b=>b.repository===I&&b.file&&gn.normalize(b.file)===v),"heldIn"),m=(i?.items??[]).filter(I=>!g.includes(I));for(let I of[...m,...s?.tests??[],...s?.maintained??[]])l(I.repository,I.file);for(let I of r?.dependencies?.added??[]){let v=p(I.repository,I.manifest);if(v)for(let b of iT(v.repo,OE(v.repo,v.rel)))v.paths.add(b)}for(let I of r?.lint??[])for(let v of I.fixed??[])p(I.repository,v);for(let I of r?.support??[])p(I.repository,I.file);let E=Se(e,ME)?.packages??[];for(let I of new Set(E.map(v=>v.repository))){let v=c(I),b=E.filter(w=>w.repository===I).map(w=>w.dir);if(v)for(let{path:w}of jE(v.repo)){let Q=u(v.repo,w),C=gn.join(v.repo,Q);LE(Q,b)&&!sT(Q)&&!h(I,Q)&&(!Uye(C)||qf(C))&&v.paths.add(Q)}}for(let{record:I,source:v,problems:b}of t){let w=a.get(v.path)?.paths;w?.has(I.file)&&(w.delete(I.file),!b.length&&(I.entry&&w.add(I.entry),w.add(I.sourceAsset)))}return new Map([...a.values()].map(({source:I,paths:v})=>[I,[...v].filter(b=>b&&b!==".."&&!b.startsWith(`..${gn.sep}`)&&!Da(b))]))}o(XE,"deliverAllowlist");function Oye(e,t,n=bl().version){if(!ai(e.inputs))return[];let i=ji(e.inputs.repositoryPath,e.inputs.relatedRepos??[]),r=ZE(e,t,n),s=new Map(r.map(a=>[Oe.resolve(a.source.path,a.record.file),a.problems]));return t.tests.flatMap(a=>{let c=i(a.file),u=s.get(Oe.resolve(c.root,c.rel));if(u)return u;if(a.change!=="added")return[];if(!aA(e,a))return[];let p=o(h=>[`${a.file}: shared-environment delivery is blocked: ${h}`],"problem");if(!Is(c))return p("test file is outside its checkout");let f;try{let h=Oe.join(c.root,c.rel);if(!mt.lstatSync(h).isFile()||mt.realpathSync(h)!==h)return p("test entry must be a regular file without symlinks");f=Bo(mt.readFileSync(h,"utf-8"))}catch{return p("test file is unavailable")}if(!f)return p("use the exact supported delivered harness; preserve unsupported assertions in an inactive source asset, never unrestricted executable code");if("restriction"in f){if(!f.sourceAsset.path.endsWith(".source"))return p("restricted source asset must use an inactive .source extension");let h=Oe.resolve(Oe.dirname(Oe.join(c.root,c.rel)),f.sourceAsset.path),m=Oe.relative(c.root,h);if(!m||m.startsWith("..")||Oe.isAbsolute(m))return p("restricted source asset must remain inside its checkout");try{if(!mt.lstatSync(h).isFile()||mt.realpathSync(h)!==h||(0,eI.createHash)("sha256").update(mt.readFileSync(h)).digest("hex")!==f.sourceAsset.sha256)return p("restricted source asset is missing, changed or a symlink")}catch{return p("restricted source asset is unavailable")}if(!(t.supportFiles??[]).some(E=>{let I=i(E);return Oe.join(I.root,I.rel)===h}))return p("restricted source asset must be delivered in supportFiles")}else{let h=e.inputs.sharedEnvironment;if(f.definition.environmentId!==h?.environmentId||f.definition.environmentAddress!==h?.environmentAddress)return p("harness identity/address differs from the selected Test Environment");if((h.offLimits??[]).some(m=>!f.definition.offLimits.includes(m)))return p("harness omits a configured off-limits route")}if(n==="unknown")return e.inputs.deliver?p("guarded CI delivery is unavailable from an unreleased engine build"):[];let g=Oe.dirname(Oe.join(c.root,c.rel));for(;g.startsWith(c.root);){let h=Oe.join(g,"package.json");if(mt.existsSync(h))try{let m=JSON.parse(mt.readFileSync(h,"utf-8"));return(m.devDependencies?.["@skyramp/testbot-core"]??m.dependencies?.["@skyramp/testbot-core"])===n?[]:p("declare the exact released engine version containing this harness; an unavailable or older runtime cannot protect direct invocation")}catch{return p("test package manifest is unreadable")}if(g===c.root)break;g=Oe.dirname(g)}return p("the delivered test has no package manifest declaring its guarded runtime")})}o(Oye,"restrictedDeliveryProblems");function ST(e){if(!ai(e.inputs))return[];let t=Se(e,"write.json");if(!t)return["shared-environment delivery requires its generated-test record"];let n=ji(e.inputs.repositoryPath,e.inputs.relatedRepos??[]),i=ZE(e,t),r=new Map(i.map(f=>[Oe.resolve(f.source.path,f.record.file),f])),s=t.tests.filter(f=>{let g=n(f.file);return!r.has(Oe.resolve(g.root,g.rel))&&f.change!=="updated"&&aA(e,f)});if(!s.length&&!i.length)return t.tests.flatMap(f=>{if(f.change!=="deleted")return[];let g=n(f.file);return Is(g)&&mt.existsSync(Oe.join(g.root,g.rel))?[`${f.file}: a deleted test must actually be absent`]:[]});let a=s.filter(f=>{let g=n(f.file);return f.change!=="deleted"&&!xo(e,g.root,g.rel)}).map(f=>({...f,change:"added"})),c=[...i.flatMap(f=>f.problems),...Oye(e,{...t,tests:a})],u=XE(e,i),l=new Set([...u].flatMap(([f,g])=>g.map(h=>Oe.resolve(f.path,h)))),p=new Set;for(let f of t.tests){let g=n(f.file),h=Oe.resolve(g.root,g.rel),m=r.get(h);if(m){p.add(Oe.resolve(g.root,m.record.sourceAsset)),m.record.entry&&p.add(h);continue}if(f.change==="deleted"){Lye(e,g.root,g.rel)?p.add(h):c.push(`${f.file}: a deleted shared-environment test must actually be absent and be a tracked regular file in the host-pinned source`);continue}if(f.change==="updated"||!aA(e,f)){p.add(h);continue}if(xo(e,g.root,g.rel)){p.add(h);continue}try{let E=Bo(mt.readFileSync(h,"utf-8"));if(!E)continue;if(p.add(h),"restriction"in E){let I=Oe.resolve(Oe.dirname(h),E.sourceAsset.path);p.add(I),!l.has(I)&&!xo(e,g.root,Oe.relative(g.root,I))&&c.push(`${f.file}: its restricted source asset is missing from the actual delivery commit`)}}catch{}}for(let[f,g]of u)for(let h of g){let m=Oe.resolve(f.path,h);p.has(m)||!i.length&&!e.inputs.deliver&&bl().version==="unknown"||Mye(e,f.path,h)||c.push(`${h}: shared-environment delivery refuses an unverified executable/support/manifest path`)}return c}o(ST,"sharedDeliveryAllowlistProblems");function $o(e){return Array.isArray(e)?`[${e.map($o).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).sort(([t],[n])=>t.localeCompare(n)).map(([t,n])=>`${JSON.stringify(t)}:${$o(n)}`).join(",")}}`:JSON.stringify(e)??"undefined"}o($o,"stable");function Mye(e,t,n){let i=Oe.basename(n);if(i!=="package.json"&&i!=="package-lock.json")return!1;let r=bl().version;if(r==="unknown")return!1;let s,a;try{let c=Oe.resolve(t,n);if(!mt.lstatSync(c).isFile()||mt.realpathSync(c)!==c)return!1;s=JSON.parse(mt.readFileSync(c,"utf-8"));let u=e.executionSafetySources?.find(g=>Oe.resolve(g.path)===Oe.resolve(t));if(u)try{a=JSON.parse((0,CT.execFileSync)("git",["show",`${u.head}:${n}`],{cwd:t,encoding:"utf-8",stdio:["ignore","pipe","ignore"]}))}catch{}else if(mt.existsSync(Oe.join(t,".git")))return!1;let l=o(g=>{let h=structuredClone(g);for(let m of["dependencies","devDependencies"])h[m]&&(delete h[m]["@skyramp/testbot-core"],Object.keys(h[m]).length||delete h[m]);return h},"withoutCore");if(i==="package.json")return(s.devDependencies?.["@skyramp/testbot-core"]??s.dependencies?.["@skyramp/testbot-core"])!==r?!1:a?$o(l(s))===$o(l(a)):Object.keys(s).every(g=>["name","version","private","type","scripts","dependencies","devDependencies"].includes(g))&&(!s.scripts||$o(s.scripts)===$o({test:"node --test"}))&&Object.keys(s.dependencies??{}).every(g=>g==="@skyramp/testbot-core")&&Object.keys(s.devDependencies??{}).every(g=>g==="@skyramp/testbot-core");let p=s.packages?.["node_modules/@skyramp/testbot-core"];if(!p||p.version!==r||p.link||p.hasInstallScript||p.resolved!==`https://registry.npmjs.org/@skyramp/testbot-core/-/testbot-core-${r}.tgz`||!/^sha512-[A-Za-z0-9+/=]+$/.test(p.integrity??""))return!1;let f=o(g=>{let h=structuredClone(g);return h.packages&&(delete h.packages["node_modules/@skyramp/testbot-core"],h.packages[""]&&(h.packages[""]=l(h.packages[""]))),h},"stripped");return a?$o(f(s))===$o(f(a)):Object.keys(s.packages??{}).every(g=>g===""||g==="node_modules/@skyramp/testbot-core")&&!s.packages?.[""]?.scripts}catch{return!1}}o(Mye,"safeRuntimeManifest");function Lye(e,t,n){try{return mt.lstatSync(Oe.join(t,n)),!1}catch(r){if(r.code!=="ENOENT")return!1}let i=e.executionSafetySources?.find(r=>Oe.resolve(r.path)===Oe.resolve(t));if(!i||!/^[a-f0-9]{40,64}$/.test(i.head))return!1;try{return/^100(?:644|755) blob /.test((0,CT.execFileSync)("git",["--literal-pathspecs","ls-tree",i.head,"--",n],{cwd:t,encoding:"utf-8",stdio:["ignore","pipe","ignore"]}))}catch{return!1}}o(Lye,"trackedDeletion");function dY(e,t,n=[]){if(!ai(e.inputs))return[];let i=[],r=ji(e.inputs.repositoryPath,e.inputs.relatedRepos??[]);for(let s of t.tests){if(s.change==="deleted")continue;let a=r(s.file),c=Oe.join(a.root,a.rel);if(!xo(e,a.root,a.rel))try{if(!Is(a)||!mt.lstatSync(c).isFile()||mt.realpathSync(c)!==c)continue;let u=Bo(mt.readFileSync(c,"utf-8"));if(!u)continue;if("restriction"in u){let p=Oe.resolve(Oe.dirname(c),u.sourceAsset.path),f=Oe.relative(a.root,p);if(!f||f.startsWith("..")||Oe.isAbsolute(f)||!mt.lstatSync(p).isFile()||mt.realpathSync(p)!==p){i.push(`${s.file}: restricted source asset is not a regular file in its checkout`);continue}let g=mt.readFileSync(p);if((0,eI.createHash)("sha256").update(g).digest("hex")!==u.sourceAsset.sha256){i.push(`${s.file}: restricted source asset changed before trusted formatting; not refreshing its hash`);continue}let h=sc(g.toString("utf-8"),n).content,m=vl(a.root,f,Buffer.from(h));mt.writeFileSync(p,m),u.sourceAsset.sha256=(0,eI.createHash)("sha256").update(m).digest("hex")}let l=sc(Yf(u),n).content;mt.writeFileSync(c,vl(a.root,a.rel,Buffer.from(l)))}catch{i.push(`${s.file}: could not assemble its guarded entry after trusted formatting`)}}return i}o(dY,"prepareSharedDeliveryFiles");var nn=re(require("fs")),ui=re(require("path")),YY=re(require("crypto")),WY=require("child_process");var kT=require("child_process"),Cl=re(require("fs")),pY=re(require("os")),tI=re(require("path"));var jye={onPath:o(e=>(0,kT.spawnSync)("sh",["-c",`command -v ${e}`],{stdio:"ignore"}).status===0,"onPath"),run:o((e,t)=>(0,kT.spawnSync)(e[0],e.slice(1),{cwd:t,stdio:"ignore",timeout:6e4}).status??1,"run")},uA={cleanup:o(()=>{},"cleanup")},Gye=new Set(["pnpm","yarn"]);function fY(e,t=pY.tmpdir(),n=jye){if(process.platform==="win32")return uA;try{if(Do(e))return uA;let i=tT(e);if(!Gye.has(i)||n.onPath(i)||!n.onPath("corepack"))return uA;Cl.mkdirSync(t,{recursive:!0});let r=Cl.mkdtempSync(tI.join(t,"testbot-pm-")),s=o(()=>Cl.rmSync(r,{recursive:!0,force:!0}),"cleanup");return n.run(["corepack","enable","--install-directory",r,i],e)!==0?(s(),uA):{dir:r,cleanup:s}}catch{return uA}}o(fY,"packageManagerShims");function AY(e,t=process.env){return e.dir?{...t,PATH:[e.dir,t.PATH].filter(Boolean).join(tI.delimiter)}:t}o(AY,"withShims");var fA=require("crypto");var gY=d.string().trim().min(1),BT=d.object({schemaVersion:d.literal(1).optional(),businessCaseAnalysis:gY.describe("1-2 sentences: what this change means for a user, and whether the evidence shows it working; no count of tests, which the report gives"),issuesFound:d.array(d.object({description:gY,severity:d.string().optional().describe("critical | high | medium | low"),category:d.string().optional().describe("bug | lint | type | config"),sourceFile:d.string().optional(),sourceLine:d.number().optional(),findingId:d.string().optional(),requirementIds:d.array(d.string()).optional()})).describe("every real problem this run exposed \u2014 cause, file:line, severity"),nextSteps:d.array(d.string()).describe("concrete follow-ups the author can act on; required non-empty when a disclosure is BLOCKING")});function zye(e){return $n(BT,e).errors}o(zye,"validateProseOutput");function qye(e,t=[]){let{value:n,error:i}=qt(e.stdout,t);if(i)return{errors:[i]};let r=zye(n);return r.length>0?{errors:r}:{prose:n,errors:[]}}o(qye,"parseProseFromSession");var pZe=Hn("report-schema",(e,t)=>qye(t,e.secretValues));var RT="<!-- skyramp-testbot -->",QT=IT,Hye=new Set(["lint","type","config"]),hY={critical:0,high:1,medium:2,low:3},CY=new Set(["Pass","Fail"]);var xT=o(e=>qs(ce().statusLabels,e),"statusLabel"),rI=o(e=>qs(ce().testTypeCellLabels,e),"testTypeLabel");function et(e){return(e??"").replace(/\|/g,"\\|").replace(/\r?\n/g,"<br>").trim()}o(et,"escCell");function mY(e){return e.inferred?" (inferred)":""}o(mY,"inferredMark");function yY(e,t){return!e||!CY.has(e)?"\u2014":t?`${xT(e)} (${et(SY(t))})`:xT(e)}o(yY,"maintStatus");function SY(e){let t=o(i=>{let r=i.indexOf(": ");return r<0?i:qs(ce().staged.maintenanceActions,i.slice(0,r))+i.slice(r)},"action");if(e.startsWith(rA))return ce().staged.keptNot+t(e.slice(rA.length));let n=e.indexOf(iA);return n<0?e:e.slice(0,n)+ce().staged.declinedPlanned+t(e.slice(n+iA.length))}o(SY,"declineNote");function EY(e){return e.category!==void 0&&Hye.has(e.category.toLowerCase())}o(EY,"isTooling");function IY(e,t){return(hY[(e.severity??"").toLowerCase()]??4)-(hY[(t.severity??"").toLowerCase()]??4)}o(IY,"bySeverity");var iI=o(e=>e?.length?` (${e.join(", ")})`:"","forPullRequests");function vY(e){return`- ${e.severity?`**[${qs(ce().severityLabels,e.severity.toLowerCase()).toUpperCase()}]** `:""}${e.description.trim()}${iI(e.pullRequests)}`}o(vY,"issueLine");function Yye(e){let t=e.resultId?.split("#").slice(1).join("#");if(e.testType!=="unit"||!t)return;let n=t;try{n=decodeURIComponent(t)}catch{}let i=/^(.*?)(\[.*\])$/.exec(n);return i?{fn:i[1],kase:i[2]}:{fn:n}}o(Yye,"unitTestOf");var kY=o((e,t)=>e!==void 0&&t!==void 0&&e.replace(/^\.\//,"")===t.replace(/^\.\//,""),"samePath");function BY(e,t){return(e.testVideos??[]).find(n=>n.url&&t(n))?.url}o(BY,"videoLink");function $T(e,t){return BY(e,n=>kY(n.fileName,t.fileName)&&(!n.repository||!t.repository||n.repository.toLowerCase()===t.repository.toLowerCase()))}o($T,"resultVideoLink");function TT(e,t){return BY(e,n=>kY(n.writtenAs??n.fileName,t))}o(TT,"journeyVideoLink");function Wye(e,t,n){return n?$T(e,{fileName:t,repository:n}):TT(e,t)}o(Wye,"requirementVideoLink");function Zye(e){let t=[],n=new Map;for(let a of e.newTestsCreated)a.testType==="unit"&&n.set(a.fileName,[...n.get(a.fileName)??[],a.testId.split("::").slice(1).join("::")]);let i=new Map,r=o((a,c)=>(n.get(a??"")??[]).find(u=>u!==c&&EH(c,u)),"parentOf"),s=new Map;for(let a of e.testResults){let c=Yye(a),u=c&&!c.kase?r(a.fileName,c.fn):void 0;if(c&&u&&(c={fn:u,kase:`"${c.fn}"`}),c?.kase&&i.set(a,c.kase),!c){t.push({testId:a.testId,testType:a.testType,endpoint:a.endpoint,status:a.status,details:a.details??"",...a.fileName?{fileName:a.fileName}:{},...a.repository?{repository:a.repository}:{}});continue}let l=`${a.fileName??""}#${c.fn}`,p=s.get(l);p||(p={row:{testId:a.testId,testType:a.testType,endpoint:a.endpoint,status:a.status,details:"",test:c.fn,...a.fileName?{fileName:a.fileName}:{},...a.repository?{repository:a.repository}:{}},cases:[]},s.set(l,p),t.push(p.row)),p.cases.push(a)}for(let{row:a,cases:c}of s.values()){let u=c.filter(g=>g.status==="Fail"),l=c.filter(g=>g.status==="Pass").length,p=c.filter(g=>g.status==="Skipped").length;a.cases=c.length,a.status=u.length?"Fail":p?"Skipped":"Pass";let f=u[0];a.details=c.length===1?c[0].details??"":ce().staged.casesPassed(l,c.length,p)+(f?`; ${i.get(f)??""} ${f.details??""}`.replace(/; +/,"; ").trimEnd():"")}return t}o(Zye,"resultRows");function Kye(e){return ET(e).map(t=>t.expected===void 0?t.expectation:`${t.expectation}: ${Nt(t.expected)}`)}o(Kye,"unitAssertions");function pA(e){return e.newTestsCreated.some(t=>t.testType!=="unit")&&e.testResults.every(t=>t.status==="Skipped")&&e.testResults.some(t=>t.failureCause?.kind==="environment"&&(t.failureCause.family==="app_not_started"||t.failureCause.family==="secret"))}o(pA,"nothingExecuted");function RY(e){let t=e.pullRequests??[];return t.length<2?[]:[ce().staged.validatedTogether(t.map(n=>`${Nt(`${n.repository}#${n.number}`)}${n.title?` ${Gr(n.title,120)}`:""}`).join("; "))]}o(RY,"pullRequestsLine");function QY(e,t=1/0){let n=Array.from(e.name.replace(/\s+/g," ").trim()).slice(0,t).join("").replace(/[<>[\]()*_`\\|#]/g,"\\$&").replace(/@/g,"@\u200D");return e.kind==="person"?ce().staged.requestedByPerson(n):ce().staged.requestedByPolicy(n)}o(QY,"requesterLine");function xY(e,t={}){if(t.audience==="testbot-pr")return oEe(e,t);let{audience:n,collapsed:i=!1,existingEvidence:r=[],requestedBy:s,sourcePullRequest:a}=t,c=n!=="comment",u=(e.requirements??[]).filter(C=>/^file-[a-f0-9]{16}-/i.test(C.id)).sort((C,T)=>T.id.length-C.id.length),l=o(C=>{let T=u.find(k=>C.toLowerCase().startsWith(k.id.toLowerCase()));return T?T.label+C.slice(T.id.length):C},"displayId"),p=[RT];a&&p.push(ce().staged.testsSourcePullRequest(Nt(a)),"");for(let C of RY(e))p.push(C,"");s&&p.push(QY(s),""),e.notTranslated&&p.push(qs(ce().staged.notTranslated,e.notTranslated),"");let f=o(C=>{i?p.push("<details>",`<summary>${C}</summary>`,""):p.push(`### ${C}`)},"sectionStart"),g=o(()=>{i&&p.push("","</details>"),p.push("")},"sectionEnd");for(let C of e.businessCaseAnalysis.trim().split(/\r?\n/))p.push(`> ${C}`);if(p.push(""),pA(e)&&p.push(ce().staged.noLiveApp(Il(e.newTestsCreated)),""),c&&e.newTestsCreated.length){let C=new Map;for(let k of e.newTestsCreated){if(k.testType!=="unit")continue;let Z=yT(k)[0],oe=C.get(k.fileName)??{functions:new Set,endpoints:[],descriptions:new Map};k.endpoint&&!oe.endpoints.includes(k.endpoint)&&oe.endpoints.push(k.endpoint);let J=k.description?.trim()??"",pe=oe.descriptions.get(Z)??[];pe.includes(J)||pe.push(J),oe.functions.add(Z),oe.descriptions.set(Z,pe),C.set(k.fileName,oe)}let T=e.newTestsCreated.filter(k=>k.testType!=="unit");f(ce().testRecommendationsImplementedHeader(Il(e.newTestsCreated),T.length+Il(e.newTestsCreated.filter(k=>k.testType==="unit"))));for(let[k,{functions:Z,endpoints:oe,descriptions:J}]of C){let pe=Z.size;p.push(ce().staged.unitTestsInFile(`\`${k}\``,pe,oe.map(Re=>`\`${Re}\``).join(", ")),"");let Be=new Map;for(let[Re,K]of J){let z=K.join("\0"),Ye=Be.get(z)??{fns:[],descriptions:K};Ye.fns.push(Re),Be.set(z,Ye)}let xe=0;for(let{fns:Re,descriptions:K}of Be.values()){p.push(`${++xe}. ${Re.map(Ye=>`\`${Ye}\``).join(", ")}`);let z=[...new Set(K.flatMap(Ye=>Kye(Ye)))];for(let Ye of z)p.push(` - ${Ye}`)}p.push("")}for(let k of T){let Z=k.testId?Nt(l(k.testId)):rI(k.testType),oe=k.fileName?` (\`${k.fileName}\`)`:"",J=k.endpoint?`
|
|
187
|
+
`,r)+1||e.length+1)-1,"lineEnd"),i=0;for(;i<e.length;){let r=e[i],s=e[i+1],a=i+1;if(r==="/"&&s==="*")a=e.indexOf("*/",i+2)<0?e.length:e.indexOf("*/",i+2)+2,t.push({start:i,end:a});else if(r==="/"&&s==="/"&&!/[:\w]/.test(e[i-1]??"")||r==="#"&&/^\s?$/.test(e[i-1]??"")&&!/[!{[]/.test(s??""))a=n(i),t.push({start:i,end:a});else if((r==='"'||r==="'")&&e.startsWith(r.repeat(3),i)){let c=e.indexOf(r.repeat(3),i+3);a=c<0?e.length:c+3,Rye(e,i)&&t.push({start:i,end:a})}else(r==='"'||r==="'"||r==="`")&&(a=Bye(e,i,r));i=a}return t}o(Qye,"commentRanges");var xye=/\b(?:test|it|describe|context|suite|scenario|specify|Run|DisplayName)(?:\.\w+)*(?:\.each\s*(?:\((?:[^()]|\([^()]*\))*\)|`[^`]*`))?\s*\(\s*("(?:[^"\\\n]|\\.)*"|'(?:[^'\\\n]|\\.)*'|`(?:[^`\\]|\\.)*`)/g;function $ye(e,t){return[...e.matchAll(xye)].flatMap(n=>{if(t.some(r=>n.index>=r.start&&n.index<r.end))return[];let i=n.index+n[0].length;return[{start:i-n[1].length,end:i}]})}o($ye,"titleRanges");function sc(e,t){if(t.length===0)return{content:e,cleaned:!1};let n=Qye(e),i=[];for(let c of n){let u=e.slice(c.start,c.end),l=wl(u,t);l!==u&&i.push({...c,text:l})}let r=$ye(e,n),s=new Set(r.map(c=>e.slice(c.start+1,c.end-1)));for(let c of r){let u=e[c.start],l=e.slice(c.start+1,c.end-1),p=wl(l,t);if(p===l)continue;let f=p;for(let g=2;s.has(f);g++)f=`${p} (${g})`;s.add(f),i.push({...c,text:`${u}${f}${u}`})}let a=e;for(let c of i.sort((u,l)=>l.start-u.start))a=`${a.slice(0,c.start)}${c.text}${a.slice(c.end)}`;return{content:a,cleaned:a!==e}}o(sc,"withoutRequirementTextInTestFile");function Tye(e){return!!e.guardedDelivery||!!e.context?.some(t=>t.safety?.route==="persistence")}o(Tye,"keepsSharedData");function aA(e,t){let n=e.inputs.sharedEnvironment?.environmentAddress;return!!n&&(t.result?.cases??[]).some(i=>i.runtimeTargets?.some(r=>eo(n,r)))}o(aA,"usesSharedRuntime");function ZE(e,t,n=bl().version){if(!ai(e.inputs))return[];let i=e.inputs.sharedEnvironment,r=i?.environmentAddress,s=Se(e,wC),a=Nj.safeParse(s),c=a.success&&a.data.environmentId===i?.environmentId&&a.data.environmentAddress===r?a.data:void 0,u=Pj.safeParse(s),l=u.success?dp(u.data.refusal):a.success?dp("changed"):dp("unavailable"),p=rY(e),f=Se(e,"recommend.json"),g=new Map((f?.generate??[]).map(({id:E,target:I})=>[E,I])),h=ji(e.inputs.repositoryPath,e.inputs.relatedRepos??[]),m=new Map;for(let E of t.tests){if(E.change==="deleted")continue;let I=h(E.file);if(!Is(I)||Da(I.rel))continue;let v=io(e.inputs,I.repository);if("error"in v)continue;let b=v.source,w=tn.resolve(b.path,I.rel),Q=iY(E,p),C=Tye(E),T=aA(e,E),k;if(!Q&&!T&&!C){if(!w.endsWith(".test.cjs"))continue;try{if(!oA(b.path,w))continue;k=Bo(Tt.readFileSync(w,"utf8"))}catch{continue}if(!k||"restriction"in k)continue}let Z=(E.covers??[]).flatMap(it=>{let Ke=g.get(it)?.match(/^(GET|HEAD|OPTIONS|POST|PUT|PATCH|DELETE)\s+(\S+)/i);return!Ke||!r?[]:Ke[2].startsWith("/")||eo(r,Ke[2])?[{method:Ke[1].toUpperCase(),route:Ke[2]}]:[]}),oe=Fye(e,b.path,I.rel);if(!Q&&E.change!=="added"&&(oe===!1||oe===void 0&&!e.inputs.deliver))continue;let J=o(it=>`${E.file}: shared-environment delivery is blocked: ${it}`,"problem"),pe={repository:b.slug,file:I.rel,sourceAsset:`${I.rel}.source`},Be;try{if(!oA(b.path,w))throw new Error("invalid path");Be=Tt.readFileSync(w)}catch{m.set(w,{record:pe,source:b,original:Buffer.alloc(0),problems:[J("test entry must be a regular file without symlinks")]});continue}if(E.change!=="added"&&xo(e,b.path,I.rel)){Q&&(pe.reason=Q,m.set(w,{record:pe,source:b,original:Be,problems:[]}));continue}if(oe===!1||E.change!=="added"&&oe!==!0){m.set(w,{record:pe,source:b,original:Be,problems:[J(oe===!1?"the file changes an existing test; retain the assertions in a new file":"cannot prove whether the shared test already exists; use a host-pinned checkout")]});continue}if(k??=Bo(Be.toString("utf8")),!Q&&k&&"restriction"in k)continue;let xe,Re=GE.safeParse(E.guardedDelivery),K=c&&i?{environmentId:c.environmentId,environmentAddress:c.environmentAddress,persistenceRevision:c.revision,offLimits:i.offLimits??[],route:{kind:"persistence"}}:void 0;if(Q)xe=Q;else if(!Re.success)xe="no guarded HTTP representation preserves the test's assertions";else if(E.covers?.length!==1||(E.functions?.length??1)!==1)xe="guarded HTTP delivery requires one test function for one planned case";else if(!K)xe=`environment restriction: persistence permission was not confirmed at generation: ${l}`;else if(!/\.test\.cjs$/.test(I.rel)||!Nye(E.ci?.runner)||!E.ci?.collected)xe="the test has no compatible Node CI entry";else if(!Pye(b.path,w,n))xe="the CI package does not declare this engine's released guarded runtime";else{let{steps:it}=Re.data,Ke=K.offLimits.length?U$(e.inputs.skyrampMcp,K.offLimits):void 0,Ft=new Map,yt=it.flatMap(st=>{if(st.op==="create"){let ot=Dye(K.environmentAddress,st.collection);return ot&&Ft.set(st.as,ot),[{method:"POST",url:ot,child:!1}]}if(st.op!=="read"&&st.op!=="update")return[];let Dt=Ft.get(st.resource);return Dt&&Ft.set(st.as,Dt),[{method:st.op==="read"?"GET":st.method??"PATCH",url:Dt,child:!0}]});yt.some(({url:st})=>!st)?xe="the guarded HTTP steps name an unknown resource or a collection outside the Test Environment":Ke&&i&&yt.some(({url:st,child:Dt})=>!Dt&&e2(st.href,i,Ke))?xe="the guarded HTTP steps name an off-limits collection":Z.length&&!Z.some(({method:st,route:Dt})=>yt.some(ot=>ot.url&&ot.method===st&&_ye(K.environmentAddress,ot.url,ot.child,Dt)))&&(xe="the guarded HTTP steps do not represent the planned HTTP operation")}let z;if(xe)pe.reason=xe;else if(Re.success&&K){let{bearerTokenEnv:it,...Ke}=Re.data;z={...Ke,definition:{...K,...it?{bearerTokenEnv:it}:{}}},pe.entry=I.rel}let Ye=tn.resolve(b.path,pe.sourceAsset),Ze=wT(Ye)&&!YE(b.path,Ye,Be)?[J("the inert source asset path already contains different bytes")]:[];m.set(w,{record:pe,source:b,original:Be,spec:z,problems:Ze})}return[...m.values()]}o(ZE,"planGuardedDelivery");function Dye(e,t){try{let n=new URL(t,`${e.replace(/\/$/,"")}/`);return!n.search&&!n.hash&&!n.username&&!n.password&&!/[\\]|%(?:2f|5c|2e|25)/i.test(t)&&eo(e,n.href)?n:void 0}catch{return}}o(Dye,"guardedCollection");function _ye(e,t,n,i){try{let r=new URL(i,t.origin),s=i.startsWith("/")&&!i.startsWith("//")&&!eo(e,r.href)?new URL(i.slice(1),`${e.replace(/\/$/,"")}/`):r;if(!eo(e,s.href))return!1;let a=t.pathname.replace(/\/$/,""),c=s.pathname.replace(/\/$/,"");if(!n)return c===a;if(!c.startsWith(`${a}/`))return!1;let u=decodeURIComponent(c.slice(a.length+1));return/^(:[\w-]+|\{[^/{}]+\}|<[^/<>]+>)$/.test(u)}catch{return!1}}o(_ye,"representsRoute");function Nye(e){return!!e&&/^(?:node|node:test|node\s+(?:.*\s)?--test(?:\s.*)?)$/i.test(e.trim())}o(Nye,"nodeTestRunner");function oA(e,t){let n=Tt.realpathSync(e);return Tt.lstatSync(t).isFile()&&Tt.realpathSync(t)===tn.join(n,tn.relative(e,t))}o(oA,"regularFileIn");function YE(e,t,n){try{return oA(e,t)&&Tt.readFileSync(t).equals(n)}catch{return!1}}o(YE,"sameRegularBytes");function wT(e){try{return Tt.lstatSync(e),!0}catch(t){if(t.code==="ENOENT")return!1;throw t}}o(wT,"pathExists");function Pye(e,t,n){if(n==="unknown")return!1;for(let i=tn.dirname(t);;i=tn.dirname(i)){let r=tn.join(i,"package.json");if(wT(r))try{if(!oA(e,r))return!1;let s=JSON.parse(Tt.readFileSync(r,"utf-8"));return(s.devDependencies?.["@skyramp/testbot-core"]??s.dependencies?.["@skyramp/testbot-core"])===n}catch{return!1}if(i===e)return!1}}o(Pye,"hasGuardRuntime");function cA(e){let t=Se(e,"write.json");return t?ZE(e,t):[]}o(cA,"guardedDeliveryPlan");function lY(e,t=cA(e),n=[],i=[]){return t.flatMap(({record:r,source:s,original:a,spec:c,problems:u})=>{if(u.length)return u;let l=tn.join(s.path,r.sourceAsset),p=tn.join(s.path,r.file);try{if(!oA(s.path,p)||!Tt.readFileSync(p).equals(a))return[`${r.file}: native source changed before guarded delivery`];let f=sc(a.toString("utf-8"),n).content;if(Js(f,e.secretValues??[])!==f)return[`${r.file}: the retained source contains a credential`];let g=vl(s.path,r.sourceAsset,Buffer.from(f));if(wT(l)){if(!YE(s.path,l,a)&&!YE(s.path,l,g))return[`${r.file}: the inert source asset path already contains different bytes`];YE(s.path,l,g)||(i.push(()=>Tt.writeFileSync(l,a)),Tt.writeFileSync(l,g))}else Tt.writeFileSync(l,g,{flag:"wx"}),i.push(()=>Tt.rmSync(l,{force:!0}));if(r.entry&&c){let h=Yf({...c,name:wl(c.name,n)}),m=vl(s.path,r.entry,Buffer.from(h));if(!Bo(m.toString("utf-8")))return[`${r.file}: the repository's file conventions changed the guarded entry`];if(Js(m.toString("utf-8"),e.secretValues??[])!==m.toString("utf-8"))return[`${r.file}: guarded delivery steps include a credential`];i.push(()=>Tt.writeFileSync(p,a)),Tt.writeFileSync(p,m)}return[]}catch{return[`${r.file}: could not assemble its guarded delivery files`]}})}o(lY,"writeGuardedDeliveryFiles");function Fye(e,t,n){let i=e.executionSafetySources?.find(r=>tn.resolve(r.path)===tn.resolve(t));if(i)try{return(0,WE.execFileSync)("git",["--literal-pathspecs","ls-tree",i.head,"--",n],{cwd:t,encoding:"utf-8",stdio:["ignore","pipe","ignore"]})===""}catch{return}}o(Fye,"newAtSourcePin");function xo(e,t,n){let i=e.executionSafetySources?.find(r=>tn.resolve(r.path)===tn.resolve(t));if(!i||!/^[a-f0-9]{40,64}$/.test(i.head))return!1;try{let r=tn.join(t,n),s=Tt.lstatSync(r);if(!s.isFile()||Tt.realpathSync(r)!==r)return!1;let a=(0,WE.execFileSync)("git",["--literal-pathspecs","ls-tree",i.head,"--",n],{cwd:t,encoding:"utf-8",stdio:["ignore","pipe","ignore"]});return!/^100(?:644|755) blob /.test(a)||(s.mode&73)!==0!==a.startsWith("100755")?!1:Tt.readFileSync(r).equals((0,WE.execFileSync)("git",["show",`${i.head}:${n}`],{cwd:t,stdio:["ignore","pipe","ignore"]}))}catch{return!1}}o(xo,"unchangedSource");function Uye(e){try{return KE.lstatSync(e),!0}catch{return!1}}o(Uye,"lexists");function XE(e,t=cA(e)){let n=new Set(t.filter(({record:I})=>!I.entry).map(({source:I,record:v})=>gn.join(I.path,v.file))),i=Se(e,"adapt.json"),r=Se(e,"finalize.json"),s=Se(e,tA),a=new Map,c=o(I=>{let v=io(e.inputs,I);if("error"in v)return;let b=a.get(v.source.path)??{source:v.source,paths:new Set};return a.set(v.source.path,b),{repo:b.source.path,paths:b.paths}},"pathsOf"),u=o((I,v)=>gn.relative(I,gn.resolve(I,v.trim())).replace(/\/+$/,""),"norm"),l=o((I,v)=>{let b=v?.trim()&&c(I);if(!b)return;let w=u(b.repo,v);b.paths.add(w);for(let Q of["__init__.py","conftest.py"]){let C=gn.join(gn.dirname(w),Q);KE.existsSync(gn.join(b.repo,C))&&(!n.has(gn.join(b.repo,w))||!xo(e,b.repo,C))&&b.paths.add(C)}},"addTest"),p=o((I,v)=>{if(typeof v!="string"||!v.trim())return;let b=c(I);if(!b)return;let w=u(b.repo,v);if(qf(gn.join(b.repo,w)))return b.paths.add(w),{...b,rel:w}},"addEdited"),f=fT(e),g=(i?.items??[]).filter(I=>I.action==="place"&&f.has(I.from??I.file??"")),h=o((I,v)=>g.some(b=>b.repository===I&&b.file&&gn.normalize(b.file)===v),"heldIn"),m=(i?.items??[]).filter(I=>!g.includes(I));for(let I of[...m,...s?.tests??[],...s?.maintained??[]])l(I.repository,I.file);for(let I of r?.dependencies?.added??[]){let v=p(I.repository,I.manifest);if(v)for(let b of iT(v.repo,OE(v.repo,v.rel)))v.paths.add(b)}for(let I of r?.lint??[])for(let v of I.fixed??[])p(I.repository,v);for(let I of r?.support??[])p(I.repository,I.file);let E=Se(e,ME)?.packages??[];for(let I of new Set(E.map(v=>v.repository))){let v=c(I),b=E.filter(w=>w.repository===I).map(w=>w.dir);if(v)for(let{path:w}of jE(v.repo)){let Q=u(v.repo,w),C=gn.join(v.repo,Q);LE(Q,b)&&!sT(Q)&&!h(I,Q)&&(!Uye(C)||qf(C))&&v.paths.add(Q)}}for(let{record:I,source:v,problems:b}of t){let w=a.get(v.path)?.paths;w?.has(I.file)&&(w.delete(I.file),!b.length&&(I.entry&&w.add(I.entry),w.add(I.sourceAsset)))}return new Map([...a.values()].map(({source:I,paths:v})=>[I,[...v].filter(b=>b&&b!==".."&&!b.startsWith(`..${gn.sep}`)&&!Da(b))]))}o(XE,"deliverAllowlist");function Oye(e,t,n=bl().version){if(!ai(e.inputs))return[];let i=ji(e.inputs.repositoryPath,e.inputs.relatedRepos??[]),r=ZE(e,t,n),s=new Map(r.map(a=>[Oe.resolve(a.source.path,a.record.file),a.problems]));return t.tests.flatMap(a=>{let c=i(a.file),u=s.get(Oe.resolve(c.root,c.rel));if(u)return u;if(a.change!=="added")return[];if(!aA(e,a))return[];let p=o(h=>[`${a.file}: shared-environment delivery is blocked: ${h}`],"problem");if(!Is(c))return p("test file is outside its checkout");let f;try{let h=Oe.join(c.root,c.rel);if(!mt.lstatSync(h).isFile()||mt.realpathSync(h)!==h)return p("test entry must be a regular file without symlinks");f=Bo(mt.readFileSync(h,"utf-8"))}catch{return p("test file is unavailable")}if(!f)return p("use the exact supported delivered harness; preserve unsupported assertions in an inactive source asset, never unrestricted executable code");if("restriction"in f){if(!f.sourceAsset.path.endsWith(".source"))return p("restricted source asset must use an inactive .source extension");let h=Oe.resolve(Oe.dirname(Oe.join(c.root,c.rel)),f.sourceAsset.path),m=Oe.relative(c.root,h);if(!m||m.startsWith("..")||Oe.isAbsolute(m))return p("restricted source asset must remain inside its checkout");try{if(!mt.lstatSync(h).isFile()||mt.realpathSync(h)!==h||(0,eI.createHash)("sha256").update(mt.readFileSync(h)).digest("hex")!==f.sourceAsset.sha256)return p("restricted source asset is missing, changed or a symlink")}catch{return p("restricted source asset is unavailable")}if(!(t.supportFiles??[]).some(E=>{let I=i(E);return Oe.join(I.root,I.rel)===h}))return p("restricted source asset must be delivered in supportFiles")}else{let h=e.inputs.sharedEnvironment;if(f.definition.environmentId!==h?.environmentId||f.definition.environmentAddress!==h?.environmentAddress)return p("harness identity/address differs from the selected Test Environment");if((h.offLimits??[]).some(m=>!f.definition.offLimits.includes(m)))return p("harness omits a configured off-limits route")}if(n==="unknown")return e.inputs.deliver?p("guarded CI delivery is unavailable from an unreleased engine build"):[];let g=Oe.dirname(Oe.join(c.root,c.rel));for(;g.startsWith(c.root);){let h=Oe.join(g,"package.json");if(mt.existsSync(h))try{let m=JSON.parse(mt.readFileSync(h,"utf-8"));return(m.devDependencies?.["@skyramp/testbot-core"]??m.dependencies?.["@skyramp/testbot-core"])===n?[]:p("declare the exact released engine version containing this harness; an unavailable or older runtime cannot protect direct invocation")}catch{return p("test package manifest is unreadable")}if(g===c.root)break;g=Oe.dirname(g)}return p("the delivered test has no package manifest declaring its guarded runtime")})}o(Oye,"restrictedDeliveryProblems");function ST(e){if(!ai(e.inputs))return[];let t=Se(e,"write.json");if(!t)return["shared-environment delivery requires its generated-test record"];let n=ji(e.inputs.repositoryPath,e.inputs.relatedRepos??[]),i=ZE(e,t),r=new Map(i.map(f=>[Oe.resolve(f.source.path,f.record.file),f])),s=t.tests.filter(f=>{let g=n(f.file);return!r.has(Oe.resolve(g.root,g.rel))&&f.change!=="updated"&&aA(e,f)});if(!s.length&&!i.length)return t.tests.flatMap(f=>{if(f.change!=="deleted")return[];let g=n(f.file);return Is(g)&&mt.existsSync(Oe.join(g.root,g.rel))?[`${f.file}: a deleted test must actually be absent`]:[]});let a=s.filter(f=>{let g=n(f.file);return f.change!=="deleted"&&!xo(e,g.root,g.rel)}).map(f=>({...f,change:"added"})),c=[...i.flatMap(f=>f.problems),...Oye(e,{...t,tests:a})],u=XE(e,i),l=new Set([...u].flatMap(([f,g])=>g.map(h=>Oe.resolve(f.path,h)))),p=new Set;for(let f of t.tests){let g=n(f.file),h=Oe.resolve(g.root,g.rel),m=r.get(h);if(m){p.add(Oe.resolve(g.root,m.record.sourceAsset)),m.record.entry&&p.add(h);continue}if(f.change==="deleted"){Lye(e,g.root,g.rel)?p.add(h):c.push(`${f.file}: a deleted shared-environment test must actually be absent and be a tracked regular file in the host-pinned source`);continue}if(f.change==="updated"||!aA(e,f)){p.add(h);continue}if(xo(e,g.root,g.rel)){p.add(h);continue}try{let E=Bo(mt.readFileSync(h,"utf-8"));if(!E)continue;if(p.add(h),"restriction"in E){let I=Oe.resolve(Oe.dirname(h),E.sourceAsset.path);p.add(I),!l.has(I)&&!xo(e,g.root,Oe.relative(g.root,I))&&c.push(`${f.file}: its restricted source asset is missing from the actual delivery commit`)}}catch{}}for(let[f,g]of u)for(let h of g){let m=Oe.resolve(f.path,h);p.has(m)||!i.length&&!e.inputs.deliver&&bl().version==="unknown"||Mye(e,f.path,h)||c.push(`${h}: shared-environment delivery refuses an unverified executable/support/manifest path`)}return c}o(ST,"sharedDeliveryAllowlistProblems");function $o(e){return Array.isArray(e)?`[${e.map($o).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).sort(([t],[n])=>t.localeCompare(n)).map(([t,n])=>`${JSON.stringify(t)}:${$o(n)}`).join(",")}}`:JSON.stringify(e)??"undefined"}o($o,"stable");function Mye(e,t,n){let i=Oe.basename(n);if(i!=="package.json"&&i!=="package-lock.json")return!1;let r=bl().version;if(r==="unknown")return!1;let s,a;try{let c=Oe.resolve(t,n);if(!mt.lstatSync(c).isFile()||mt.realpathSync(c)!==c)return!1;s=JSON.parse(mt.readFileSync(c,"utf-8"));let u=e.executionSafetySources?.find(g=>Oe.resolve(g.path)===Oe.resolve(t));if(u)try{a=JSON.parse((0,CT.execFileSync)("git",["show",`${u.head}:${n}`],{cwd:t,encoding:"utf-8",stdio:["ignore","pipe","ignore"]}))}catch{}else if(mt.existsSync(Oe.join(t,".git")))return!1;let l=o(g=>{let h=structuredClone(g);for(let m of["dependencies","devDependencies"])h[m]&&(delete h[m]["@skyramp/testbot-core"],Object.keys(h[m]).length||delete h[m]);return h},"withoutCore");if(i==="package.json")return(s.devDependencies?.["@skyramp/testbot-core"]??s.dependencies?.["@skyramp/testbot-core"])!==r?!1:a?$o(l(s))===$o(l(a)):Object.keys(s).every(g=>["name","version","private","type","scripts","dependencies","devDependencies"].includes(g))&&(!s.scripts||$o(s.scripts)===$o({test:"node --test"}))&&Object.keys(s.dependencies??{}).every(g=>g==="@skyramp/testbot-core")&&Object.keys(s.devDependencies??{}).every(g=>g==="@skyramp/testbot-core");let p=s.packages?.["node_modules/@skyramp/testbot-core"];if(!p||p.version!==r||p.link||p.hasInstallScript||p.resolved!==`https://registry.npmjs.org/@skyramp/testbot-core/-/testbot-core-${r}.tgz`||!/^sha512-[A-Za-z0-9+/=]+$/.test(p.integrity??""))return!1;let f=o(g=>{let h=structuredClone(g);return h.packages&&(delete h.packages["node_modules/@skyramp/testbot-core"],h.packages[""]&&(h.packages[""]=l(h.packages[""]))),h},"stripped");return a?$o(f(s))===$o(f(a)):Object.keys(s.packages??{}).every(g=>g===""||g==="node_modules/@skyramp/testbot-core")&&!s.packages?.[""]?.scripts}catch{return!1}}o(Mye,"safeRuntimeManifest");function Lye(e,t,n){try{return mt.lstatSync(Oe.join(t,n)),!1}catch(r){if(r.code!=="ENOENT")return!1}let i=e.executionSafetySources?.find(r=>Oe.resolve(r.path)===Oe.resolve(t));if(!i||!/^[a-f0-9]{40,64}$/.test(i.head))return!1;try{return/^100(?:644|755) blob /.test((0,CT.execFileSync)("git",["--literal-pathspecs","ls-tree",i.head,"--",n],{cwd:t,encoding:"utf-8",stdio:["ignore","pipe","ignore"]}))}catch{return!1}}o(Lye,"trackedDeletion");function dY(e,t,n=[]){if(!ai(e.inputs))return[];let i=[],r=ji(e.inputs.repositoryPath,e.inputs.relatedRepos??[]);for(let s of t.tests){if(s.change==="deleted")continue;let a=r(s.file),c=Oe.join(a.root,a.rel);if(!xo(e,a.root,a.rel))try{if(!Is(a)||!mt.lstatSync(c).isFile()||mt.realpathSync(c)!==c)continue;let u=Bo(mt.readFileSync(c,"utf-8"));if(!u)continue;if("restriction"in u){let p=Oe.resolve(Oe.dirname(c),u.sourceAsset.path),f=Oe.relative(a.root,p);if(!f||f.startsWith("..")||Oe.isAbsolute(f)||!mt.lstatSync(p).isFile()||mt.realpathSync(p)!==p){i.push(`${s.file}: restricted source asset is not a regular file in its checkout`);continue}let g=mt.readFileSync(p);if((0,eI.createHash)("sha256").update(g).digest("hex")!==u.sourceAsset.sha256){i.push(`${s.file}: restricted source asset changed before trusted formatting; not refreshing its hash`);continue}let h=sc(g.toString("utf-8"),n).content,m=vl(a.root,f,Buffer.from(h));mt.writeFileSync(p,m),u.sourceAsset.sha256=(0,eI.createHash)("sha256").update(m).digest("hex")}let l=sc(Yf(u),n).content;mt.writeFileSync(c,vl(a.root,a.rel,Buffer.from(l)))}catch{i.push(`${s.file}: could not assemble its guarded entry after trusted formatting`)}}return i}o(dY,"prepareSharedDeliveryFiles");var nn=re(require("fs")),ui=re(require("path")),YY=re(require("crypto")),WY=require("child_process");var kT=require("child_process"),Cl=re(require("fs")),pY=re(require("os")),tI=re(require("path"));var jye={onPath:o(e=>(0,kT.spawnSync)("sh",["-c",`command -v ${e}`],{stdio:"ignore"}).status===0,"onPath"),run:o((e,t)=>(0,kT.spawnSync)(e[0],e.slice(1),{cwd:t,stdio:"ignore",timeout:6e4}).status??1,"run")},uA={cleanup:o(()=>{},"cleanup")},Gye=new Set(["pnpm","yarn"]);function fY(e,t=pY.tmpdir(),n=jye){if(process.platform==="win32")return uA;try{if(Do(e))return uA;let i=tT(e);if(!Gye.has(i)||n.onPath(i)||!n.onPath("corepack"))return uA;Cl.mkdirSync(t,{recursive:!0});let r=Cl.mkdtempSync(tI.join(t,"testbot-pm-")),s=o(()=>Cl.rmSync(r,{recursive:!0,force:!0}),"cleanup");return n.run(["corepack","enable","--install-directory",r,i],e)!==0?(s(),uA):{dir:r,cleanup:s}}catch{return uA}}o(fY,"packageManagerShims");function AY(e,t=process.env){return e.dir?{...t,PATH:[e.dir,t.PATH].filter(Boolean).join(tI.delimiter)}:t}o(AY,"withShims");var fA=require("crypto");var gY=d.string().trim().min(1),BT=d.object({schemaVersion:d.literal(1).optional(),businessCaseAnalysis:gY.describe("1-2 sentences: what this change means for a user, and whether the evidence shows it working; no count of tests, which the report gives"),issuesFound:d.array(d.object({description:gY,severity:d.string().optional().describe("critical | high | medium | low"),category:d.string().optional().describe("bug | lint | type | config"),sourceFile:d.string().optional(),sourceLine:d.number().optional(),findingId:d.string().optional(),requirementIds:d.array(d.string()).optional()})).describe("every real problem this run exposed \u2014 cause, file:line, severity"),nextSteps:d.array(d.string()).describe("concrete follow-ups the author can act on; required non-empty when a disclosure is BLOCKING")});function zye(e){return $n(BT,e).errors}o(zye,"validateProseOutput");function qye(e,t=[]){let{value:n,error:i}=qt(e.stdout,t);if(i)return{errors:[i]};let r=zye(n);return r.length>0?{errors:r}:{prose:n,errors:[]}}o(qye,"parseProseFromSession");var fZe=Hn("report-schema",(e,t)=>qye(t,e.secretValues));var RT="<!-- skyramp-testbot -->",QT=IT,Hye=new Set(["lint","type","config"]),hY={critical:0,high:1,medium:2,low:3},CY=new Set(["Pass","Fail"]);var xT=o(e=>qs(ce().statusLabels,e),"statusLabel"),rI=o(e=>qs(ce().testTypeCellLabels,e),"testTypeLabel");function et(e){return(e??"").replace(/\|/g,"\\|").replace(/\r?\n/g,"<br>").trim()}o(et,"escCell");function mY(e){return e.inferred?" (inferred)":""}o(mY,"inferredMark");function yY(e,t){return!e||!CY.has(e)?"\u2014":t?`${xT(e)} (${et(SY(t))})`:xT(e)}o(yY,"maintStatus");function SY(e){let t=o(i=>{let r=i.indexOf(": ");return r<0?i:qs(ce().staged.maintenanceActions,i.slice(0,r))+i.slice(r)},"action");if(e.startsWith(rA))return ce().staged.keptNot+t(e.slice(rA.length));let n=e.indexOf(iA);return n<0?e:e.slice(0,n)+ce().staged.declinedPlanned+t(e.slice(n+iA.length))}o(SY,"declineNote");function EY(e){return e.category!==void 0&&Hye.has(e.category.toLowerCase())}o(EY,"isTooling");function IY(e,t){return(hY[(e.severity??"").toLowerCase()]??4)-(hY[(t.severity??"").toLowerCase()]??4)}o(IY,"bySeverity");var iI=o(e=>e?.length?` (${e.join(", ")})`:"","forPullRequests");function vY(e){return`- ${e.severity?`**[${qs(ce().severityLabels,e.severity.toLowerCase()).toUpperCase()}]** `:""}${e.description.trim()}${iI(e.pullRequests)}`}o(vY,"issueLine");function Yye(e){let t=e.resultId?.split("#").slice(1).join("#");if(e.testType!=="unit"||!t)return;let n=t;try{n=decodeURIComponent(t)}catch{}let i=/^(.*?)(\[.*\])$/.exec(n);return i?{fn:i[1],kase:i[2]}:{fn:n}}o(Yye,"unitTestOf");var kY=o((e,t)=>e!==void 0&&t!==void 0&&e.replace(/^\.\//,"")===t.replace(/^\.\//,""),"samePath");function BY(e,t){return(e.testVideos??[]).find(n=>n.url&&t(n))?.url}o(BY,"videoLink");function $T(e,t){return BY(e,n=>kY(n.fileName,t.fileName)&&(!n.repository||!t.repository||n.repository.toLowerCase()===t.repository.toLowerCase()))}o($T,"resultVideoLink");function TT(e,t){return BY(e,n=>kY(n.writtenAs??n.fileName,t))}o(TT,"journeyVideoLink");function Wye(e,t,n){return n?$T(e,{fileName:t,repository:n}):TT(e,t)}o(Wye,"requirementVideoLink");function Zye(e){let t=[],n=new Map;for(let a of e.newTestsCreated)a.testType==="unit"&&n.set(a.fileName,[...n.get(a.fileName)??[],a.testId.split("::").slice(1).join("::")]);let i=new Map,r=o((a,c)=>(n.get(a??"")??[]).find(u=>u!==c&&EH(c,u)),"parentOf"),s=new Map;for(let a of e.testResults){let c=Yye(a),u=c&&!c.kase?r(a.fileName,c.fn):void 0;if(c&&u&&(c={fn:u,kase:`"${c.fn}"`}),c?.kase&&i.set(a,c.kase),!c){t.push({testId:a.testId,testType:a.testType,endpoint:a.endpoint,status:a.status,details:a.details??"",...a.fileName?{fileName:a.fileName}:{},...a.repository?{repository:a.repository}:{}});continue}let l=`${a.fileName??""}#${c.fn}`,p=s.get(l);p||(p={row:{testId:a.testId,testType:a.testType,endpoint:a.endpoint,status:a.status,details:"",test:c.fn,...a.fileName?{fileName:a.fileName}:{},...a.repository?{repository:a.repository}:{}},cases:[]},s.set(l,p),t.push(p.row)),p.cases.push(a)}for(let{row:a,cases:c}of s.values()){let u=c.filter(g=>g.status==="Fail"),l=c.filter(g=>g.status==="Pass").length,p=c.filter(g=>g.status==="Skipped").length;a.cases=c.length,a.status=u.length?"Fail":p?"Skipped":"Pass";let f=u[0];a.details=c.length===1?c[0].details??"":ce().staged.casesPassed(l,c.length,p)+(f?`; ${i.get(f)??""} ${f.details??""}`.replace(/; +/,"; ").trimEnd():"")}return t}o(Zye,"resultRows");function Kye(e){return ET(e).map(t=>t.expected===void 0?t.expectation:`${t.expectation}: ${Nt(t.expected)}`)}o(Kye,"unitAssertions");function pA(e){return e.newTestsCreated.some(t=>t.testType!=="unit")&&e.testResults.every(t=>t.status==="Skipped")&&e.testResults.some(t=>t.failureCause?.kind==="environment"&&(t.failureCause.family==="app_not_started"||t.failureCause.family==="secret"))}o(pA,"nothingExecuted");function RY(e){let t=e.pullRequests??[];return t.length<2?[]:[ce().staged.validatedTogether(t.map(n=>`${Nt(`${n.repository}#${n.number}`)}${n.title?` ${Gr(n.title,120)}`:""}`).join("; "))]}o(RY,"pullRequestsLine");function QY(e,t=1/0){let n=Array.from(e.name.replace(/\s+/g," ").trim()).slice(0,t).join("").replace(/[<>[\]()*_`\\|#]/g,"\\$&").replace(/@/g,"@\u200D");return e.kind==="person"?ce().staged.requestedByPerson(n):ce().staged.requestedByPolicy(n)}o(QY,"requesterLine");function xY(e,t={}){if(t.audience==="testbot-pr")return oEe(e,t);let{audience:n,collapsed:i=!1,existingEvidence:r=[],requestedBy:s,sourcePullRequest:a}=t,c=n!=="comment",u=(e.requirements??[]).filter(C=>/^file-[a-f0-9]{16}-/i.test(C.id)).sort((C,T)=>T.id.length-C.id.length),l=o(C=>{let T=u.find(k=>C.toLowerCase().startsWith(k.id.toLowerCase()));return T?T.label+C.slice(T.id.length):C},"displayId"),p=[RT];a&&p.push(ce().staged.testsSourcePullRequest(Nt(a)),"");for(let C of RY(e))p.push(C,"");s&&p.push(QY(s),""),e.notTranslated&&p.push(qs(ce().staged.notTranslated,e.notTranslated),"");let f=o(C=>{i?p.push("<details>",`<summary>${C}</summary>`,""):p.push(`### ${C}`)},"sectionStart"),g=o(()=>{i&&p.push("","</details>"),p.push("")},"sectionEnd");for(let C of e.businessCaseAnalysis.trim().split(/\r?\n/))p.push(`> ${C}`);if(p.push(""),pA(e)&&p.push(ce().staged.noLiveApp(Il(e.newTestsCreated)),""),c&&e.newTestsCreated.length){let C=new Map;for(let k of e.newTestsCreated){if(k.testType!=="unit")continue;let Z=yT(k)[0],oe=C.get(k.fileName)??{functions:new Set,endpoints:[],descriptions:new Map};k.endpoint&&!oe.endpoints.includes(k.endpoint)&&oe.endpoints.push(k.endpoint);let J=k.description?.trim()??"",pe=oe.descriptions.get(Z)??[];pe.includes(J)||pe.push(J),oe.functions.add(Z),oe.descriptions.set(Z,pe),C.set(k.fileName,oe)}let T=e.newTestsCreated.filter(k=>k.testType!=="unit");f(ce().testRecommendationsImplementedHeader(Il(e.newTestsCreated),T.length+Il(e.newTestsCreated.filter(k=>k.testType==="unit"))));for(let[k,{functions:Z,endpoints:oe,descriptions:J}]of C){let pe=Z.size;p.push(ce().staged.unitTestsInFile(`\`${k}\``,pe,oe.map(Re=>`\`${Re}\``).join(", ")),"");let Be=new Map;for(let[Re,K]of J){let z=K.join("\0"),Ye=Be.get(z)??{fns:[],descriptions:K};Ye.fns.push(Re),Be.set(z,Ye)}let xe=0;for(let{fns:Re,descriptions:K}of Be.values()){p.push(`${++xe}. ${Re.map(Ye=>`\`${Ye}\``).join(", ")}`);let z=[...new Set(K.flatMap(Ye=>Kye(Ye)))];for(let Ye of z)p.push(` - ${Ye}`)}p.push("")}for(let k of T){let Z=k.testId?Nt(l(k.testId)):rI(k.testType),oe=k.fileName?` (\`${k.fileName}\`)`:"",J=k.endpoint?`
|
|
188
188
|
\`${k.endpoint}\``:"",pe=k.description?`
|
|
189
189
|
${k.description.trim()}`:"";p.push(`- ${Z}${oe}${iI(k.pullRequests)}${J}${pe}`)}g()}let h=(e.testMaintenance??[]).filter(C=>QT.has(C.action));if(c&&h.length){f(ce().staged.testMaintenanceHeader),p.push(ce().maintenanceTableHeader),p.push("|-----------|----------|------|--------|--------|-------|");for(let C of h)p.push(`| ${et(rI(C.testType))} | ${et(C.endpoint)} | \`${et(C.fileName)}\` | ${et(C.description)} | ${yY(C.beforeStatus,C.beforeDetails)} | ${yY(C.afterStatus,C.afterDetails)} |`);g()}let m=o(C=>C.startsWith(rA)||C.includes(iA),"hasDeclineNote"),E=(e.testMaintenance??[]).filter(C=>m(C.afterDetails)&&(!QT.has(C.action)||!CY.has(C.afterStatus??"")));if(c&&E.length){f(ce().staged.declinedMaintenanceHeader);for(let C of E)p.push(`- \`${et(C.fileName)}\`: ${et(SY(C.afterDetails))}`);g()}if(c&&r.length){f(ce().staged.existingEvidenceHeader);let C=new Map;for(let T of r){let k=`${T.check}\0${T.url??""}\0${T.revision??""}`;C.set(k,[...C.get(k)??[],T])}for(let[,[T,...k]]of C){let Z=T.url?`[${Nt(T.check)}](${T.url})`:Nt(T.check);p.push(ce().staged.trustedCheckPassed(Z,T.revision?Nt(T.revision.slice(0,7)):""),"");for(let oe of[T,...k])p.push(`- ${Nt(oe.behavior)}`);p.push("")}g()}if(c&&e.testResults.length){f(ce().staged.testResultsHeader);let C=Zye(e),T=C.some(J=>J.test),k=C.some(J=>$T(e,J)),Z=T?ce().staged.unitResultsTableHeader:ce().staged.resultsTableHeader;p.push(k?`${Z} ${ce().columnVideo} |`:Z),p.push(`${T?"|---------|-----------|----------|------|-------|--------|---------|":"|---------|-----------|----------|--------|---------|"}${k?"-------|":""}`);for(let J of C){let pe=J.details.replace(/(\S+\.(?:py|ts|js|spec\.\w+))/gi,"`$1`"),Be=J.testId?Nt(et(l(J.testId))):"\u2014",xe=T?` ${J.test?`\`${et(J.test)}\``:""} | ${J.cases??""} |`:"",Re=$T(e,J),K=k?` ${Re?ce().videoDownloadLink(Re):"\u2014"} |`:"";p.push(`| ${Be} | ${et(rI(J.testType))} | ${et(J.endpoint)} |${xe} ${et(xT(J.status))} | ${et(pe)} |${K}`)}let oe=(e.testVideos??[]).find(J=>J.artifactsUrl)?.artifactsUrl;!k&&oe&&p.push("",ce().videosArtifactFallback(oe)),g()}if(e.requirements?.length){let C=e.requirements.flatMap(J=>J.clauses),T=o(J=>J.status==="Pass"||J.status==="Passed, test not kept","passes"),k=C.filter(T).length;f(ce().staged.requirementsHeader(k,C.length));let Z=o(J=>qs(ce().staged.clauseStatuses,J.status),"status"),oe=o(J=>(J.status==="Not tested"||J.status==="Passed, test not kept")&&J.notTested?`${Z(J)}: ${J.notTested}`:J.findings.length?`${Z(J)} \u2014 ${J.findings.join(", ")}`:Z(J),"result");if(c){p.push(ce().staged.requirementsTableHeader),p.push("|-------------|--------|-------|--------|");for(let J of e.requirements)J.clauses.forEach((pe,Be)=>{let xe=Be===0?`**${et(J.label)}**${J.statement?` ${et(J.statement)}`:""}${iI(J.pullRequests)}`:"",Re=`${Nt(et(l(pe.id)))}${mY(pe)}${pe.text?` ${et(pe.text)}`:""}`,K=new Map;for(let Ze of pe.tests){let it=Ze.fileName??l(Ze.testId),Ke=K.get(it)??{fns:new Set};for(let Ft of Ze.functions)Ke.fns.add(Ft);Ke.video??=Ze.fileName?Wye(e,Ze.fileName,Ze.repository):void 0,K.set(it,Ke)}let z=K.size?[...K].map(([Ze,{fns:it,video:Ke}])=>`${Nt(et(Ze))}${it.size?` \u2014 ${[...it].map(Ft=>`\`${et(Ft)}\``).join(", ")}`:""}${Ke?` ${ce().videoDownloadLink(Ke)}`:""}`).join("<br>"):"\u2014",Ye=J.source==="could-break"&&pe.status==="Pass"?ce().staged.regressionGuard:"";p.push(`| ${xe} | ${Re} | ${z} | ${et(oe(pe)+Ye)} |`)})}else{p.push(ce().staged.requirementsSummaryTableHeader),p.push("|-------------|-----------------|-------------|");for(let J of e.requirements){let pe=J.clauses.filter(T).length,Be=J.clauses.filter(xe=>!T(xe)).map(xe=>`${Nt(et(l(xe.id)))}${mY(xe)} ${et(oe(xe))}`);p.push(`| **${et(J.label)}**${J.statement?` ${et(J.statement)}`:""}${iI(J.pullRequests)} | ${pe}/${J.clauses.length} | ${Be.join("<br>")||"\u2014"} |`)}}g()}if(c&&e.changes?.length&&!e.requirements?.length){let C=e.executionCoverage,T=C?ce().staged.coverageCaption(C.generated,C.modified,C.verified,C.executed):"";f(`${ce().staged.behaviourCoverageHeader}${T}`),p.push(ce().staged.coverageTableHeader),p.push("|-----------|--------|-----------|----------------|");for(let k of e.changes){let Z=k.testedBy.length?k.testedBy.map(J=>`\`${et(J)}\``).join(", "):k.writtenBy.length?ce().staged.writtenNotRun:"\u2014",oe=k.maintainedBy.length?k.maintainedBy.map(J=>`\`${et(J)}\``).join(", "):"\u2014";p.push(`| ${et(k.text)} | \`${et(k.source)}\` | ${Z} | ${oe} |`)}g()}if(e.userJourneys?.length){let C=e.userJourneys.filter(k=>k.status==="Pass"&&!k.problems.length).length;f(`\u{1F9ED} User Journeys Covered (${C}/${e.userJourneys.length} walked end to end)`);let T=e.userJourneys.some(k=>TT(e,k.fileName));p.push(`| Journey | Test | Status | Notes |${T?` ${ce().columnVideo} |`:""}`),p.push(`|---------|------|--------|-------|${T?"-------|":""}`);for(let k of e.userJourneys){let Z=k.fileName?`\`${et(k.fileName)}\`${k.test?` \u2014 ${et(k.test)}`:""}`:"\u2014",oe=k.source&&k.source!=="inferred"?`; described in the ${k.source==="spec"?"spec":"PR description"}`:"; inferred from the app",J=(k.uncovered?`not covered: ${k.uncovered}`:k.problems.length?`does not walk it end to end: ${k.problems.join("; ")}`:`from ${k.entry}, ${k.steps} steps`)+oe,pe=T?TT(e,k.fileName):void 0;p.push(`| ${et(k.name)} | ${Z} | ${et(k.status)} | ${et(J)} |${T?` ${pe?ce().videoDownloadLink(pe):"\u2014"} |`:""}`)}g()}let I=e.issuesFound.filter(C=>!EY(C)).sort(IY),v=e.issuesFound.filter(EY).sort(IY);if(I.length){f(ce().staged.issuesFoundHeader);for(let C of I)p.push(vY(C));g()}if(v.length){p.push(`### ${ce().configErrorsHeader}`);for(let C of v)p.push(vY(C));p.push("")}let b=e.testPackages??[],w=e.dependencyChanges??[];if(b.length){p.push(ce().staged.testPackagesHeader,"");for(let C of b)p.push(`- ${ce().staged.testPackageLine(C.directory,C.entrypoint,Object.entries(C.dependencies??{}).map(([T,k])=>C.runner==="pytest"?`${T}==${k}`:`${T}@${k}`).join(", "))}`);w.length||p.push(`- ${ce().staged.appManifestsUntouched}`),p.push("")}if(w.length){p.push(ce().staged.dependencyChangesHeader,"");for(let C of w)p.push(`- ${ce().staged.dependencyChangeLine(C.package,C.repository?`${C.repository}: ${C.manifest}`:C.manifest,(C.reason??"").replace(/\s+/g," ").trim())}`);p.push("")}let Q=(e.caveats??[]).filter(C=>C.kind!=="tests-not-executed"||C.subject==="written-cases"||!pA(e));if(Q.length){p.push(ce().staged.caveatsHeader,"");for(let C of Q)p.push(`- ${C.text}`);p.push("")}if(e.nextSteps.length){p.push(ce().nextStepsHeader,"");for(let C of e.nextSteps)p.push(`- ${C.trim()}`);p.push("")}return p.join(`
|
|
190
190
|
`).replace(/\n{3,}/g,`
|
|
@@ -200,7 +200,7 @@ else require("node:test").test(spec.name, () => { throw new Error("required shar
|
|
|
200
200
|
`;return T.length<=i?T:[RT,...l,...c,n.filesChanged].join(`
|
|
201
201
|
|
|
202
202
|
`)+`
|
|
203
|
-
`}o(oEe,"renderTestsPrBody");var To=re(require("fs")),DT=re(require("path"));var cEe="report.json",uEe="report-display.json",
|
|
203
|
+
`}o(oEe,"renderTestsPrBody");var To=re(require("fs")),DT=re(require("path"));var cEe="report.json",uEe="report-display.json",GZe={en:"English",ja:"Japanese"};function $Y(e){let t=DT.join(e,uEe);if(To.existsSync(t))try{return JSON.parse(To.readFileSync(t,"utf-8"))}catch{}let n=DT.join(e,cEe);return To.existsSync(n)?JSON.parse(To.readFileSync(n,"utf-8")):void 0}o($Y,"readDisplayReport");function TY(e,t){return t?`<!-- skyramp-testbot-run: ${t} -->
|
|
204
204
|
${e}`:e}o(TY,"withRunMarker");var ac=re(require("fs")),oc=re(require("path"));var sI=["build","chore","ci","docs","feat","fix","perf","refactor","revert","style","test"],dEe=["build","ci","docs","feat","fix","perf","refactor","revert","style","test"],pEe="amannn/action-semantic-pull-request",rr=o(e=>typeof e=="object"&&e!==null&&!Array.isArray(e),"isObj");function DY(e){return typeof e!="string"?!1:e.split("@")[0].split("/").some(n=>n.toLowerCase().split(/[-_.]/).includes("dco"))}o(DY,"usesDco");function _Y(e){return typeof e=="string"&&(/\bdco-check\b/.test(e)||/signed-off-by/i.test(e))}o(_Y,"scriptChecksDco");function fEe(e){if(!rr(e)||!rr(e.jobs))return!1;for(let t of Object.values(e.jobs))if(rr(t)){if(DY(t.uses))return!0;if(Array.isArray(t.steps)){for(let n of t.steps)if(rr(n)&&(DY(n.uses)||_Y(n.run)||rr(n.with)&&Object.values(n.with).some(_Y)))return!0}}return!1}o(fEe,"workflowChecksDco");function UY(e){let t=oc.join(e,".github","workflows"),n;try{n=ac.readdirSync(t).filter(i=>/\.ya?ml$/i.test(i)).sort()}catch{return[]}return n.flatMap(i=>{try{return[{file:oc.join(".github","workflows",i),doc:So(ac.readFileSync(oc.join(t,i),"utf-8"))}]}catch{return[]}})}o(UY,"workflows");function AEe(e){return!rr(e)||!rr(e.jobs)?[]:Object.values(e.jobs).flatMap(t=>rr(t)&&Array.isArray(t.steps)?t.steps.filter(rr):[])}o(AEe,"steps");function gEe(e){let t=oc.join(".github","dco.yml");if(ac.existsSync(oc.join(e,t)))return{file:t};let n=UY(e).find(i=>fEe(i.doc));return n&&{file:n.file}}o(gEe,"signOffRule");var NY=o(e=>typeof e=="string"?e.split(/\r?\n/).map(t=>t.trim()).filter(Boolean):void 0,"inputList");function hEe(e){for(let t of UY(e)){let n=AEe(t.doc).find(s=>typeof s.uses=="string"&&s.uses.split("@")[0].trim().toLowerCase()===pEe);if(!n)continue;let i=rr(n.with)?n.with:{},r=NY(i.scopes);return{file:t.file,types:NY(i.types)??sI,...r?.length?{scopes:r}:{},scopeRequired:i.requireScope===!0||String(i.requireScope).trim()==="true"}}}o(hEe,"semanticPrTitleRule");var mEe=["package.json",".commitlintrc",".commitlintrc.json",".commitlintrc.yaml",".commitlintrc.yml",".commitlintrc.js",".commitlintrc.cjs",".commitlintrc.mjs",".commitlintrc.ts",".commitlintrc.cts","commitlint.config.js","commitlint.config.cjs","commitlint.config.mjs","commitlint.config.ts","commitlint.config.cts","commitlint.config.mts"],yEe=["type-enum","scope-enum","scope-empty","subject-case","header-max-length","body-max-line-length"];function OY(e){let t=[];for(let n of e)n==="@commitlint/config-conventional"||n==="@commitlint/config-angular"?t.push(n):t.length=0;return t}o(OY,"knownPresets");var EEe={Disabled:"0",Warning:"1",Error:"2"};function IEe(e){return e.replace(/"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`(?:\\.|[^`\\])*`|\/\/[^\r\n]*|\/\*[\s\S]*?\*\//g,t=>t.startsWith("/")?t.replace(/[^\r\n]/g," "):t)}o(IEe,"withoutComments");function PY(e,t){let n=new RegExp(`["']?${t}["']?\\s*:\\s*`).exec(e);if(!n)return;let i=n.index+n[0].length;if(e[i]!=="[")return null;let r=0;for(let s=i;s<e.length;s++)if(e[s]==="[")r++;else if(e[s]==="]"&&--r===0){if(!/^\s*(?:as\s+const\s*)?(?:[,}]|$)/.test(e.slice(s+1)))return null;let a=e.slice(i,s+1).replace(/\bRuleConfigSeverity\.(\w+)/g,(u,l)=>EEe[l]??u).replace(/,(\s*\])/g,"$1"),c=a.replace(/"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'/g,'""');try{return JSON.parse(c),So(a)}catch{return null}}}o(PY,"ruleFromSource");var MY=o(e=>Object.fromEntries(yEe.map(t=>[t,e(t)])),"pickRules");function FY(e,t){if(!rr(t))return;let n=[].concat(t.extends??[]),i=rr(t.rules)?t.rules:{};return{file:e,presets:OY(n),rules:MY(r=>i[r])}}o(FY,"configFromObject");function vEe(e){for(let t of mEe){let n;try{n=ac.readFileSync(oc.join(e,t),"utf-8")}catch{continue}if(/\.[cm]?[jt]s$/.test(t)){let r=IEe(n),s=/(?:^|[,{])\s*["']?extends["']?\s*:\s*/.exec(r),a=s?PY(r.slice(s.index),"extends"):void 0,c=s?/^(["'])([^"']+)\1\s*(?:[,}]|$)/.exec(r.slice(s.index+s[0].length))?.[2]:void 0,u=Array.isArray(a)?a:c?[c]:[];return{file:t,presets:OY(u),rules:MY(l=>PY(r,l))}}let i;try{i=So(n)}catch{return}if(t!=="package.json")return FY(t,i);if(rr(i)&&rr(i.commitlint))return FY(t,i.commitlint)}}o(vEe,"commitlintConfig");function Sl(e){if(!Array.isArray(e))return;let t=Number(e[0]);if(t===1||t===2)return[String(e[1]??"always"),e[2]]}o(Sl,"ruleWhenOn");var _T=o(e=>Array.isArray(e)&&e.every(t=>typeof t=="string")?e:void 0,"stringList");function bEe(e,t){if(!e)return t?"not-capitalized":void 0;let[n,i]=e,r=typeof i=="string"?[i]:_T(i)??[];if(n==="always"&&r.length===1&&r[0]==="lower-case")return"lower-case";if(n==="always"&&r.length===1&&r[0]==="sentence-case")return"sentence-case";if(n==="never"&&r.some(s=>["sentence-case","start-case","pascal-case","upper-case"].includes(s)))return"not-capitalized"}o(bEe,"subjectCaseOf");function wEe(e){let t=vEe(e);if(!t)return;let{file:n,rules:i}=t,r=t.presets.at(-1)==="@commitlint/config-angular",s=o(I=>t.presets.length>0&&i[I]===void 0,"preset"),a=Sl(i["type-enum"]),c=a?.[0]==="always"?_T(a[1]):s("type-enum")?r?dEe:sI:void 0,u=c===void 0,l=c??sI;u&&console.warn(`[commit-rules] ${n}: allowed commit types could not be read; using a conventional header fallback. Additional preset rules may still reject it.`);let p=Sl(i["scope-enum"]),f=p?.[0]==="always"?_T(p[1]):void 0,g=o((I,v)=>{let b=Sl(i[I]);return b?typeof b[1]=="number"?b[1]:void 0:s(I)?v:void 0},"limit"),h=bEe(Sl(i["subject-case"]),s("subject-case")),m=g("header-max-length",r?72:100)??(u&&i["header-max-length"]===void 0?ds:void 0),E=g("body-max-line-length",t.presets.includes("@commitlint/config-conventional")?100:void 0);return{file:n,types:l,...u?{typesFromFallback:!0}:{},...u&&!h&&i["subject-case"]===void 0?{fallbackSubjectCase:"not-capitalized"}:{},...f?.length?{scopes:f}:{},scopeRequired:Sl(i["scope-empty"])?.[0]==="never",...Sl(i["scope-empty"])?.[0]==="always"?{scopeForbidden:!0}:{},...h?{subjectCase:h}:{},...m?{headerMaxLength:m}:{},...E?{bodyMaxLineLength:E}:{}}}o(wEe,"commitlintRule");function LY(e){let t=gEe(e),n=wEe(e),i=hEe(e);return{...t?{signOff:t}:{},...n?{commitlint:n}:{},...i?{prTitle:i}:{}}}o(LY,"readCommitRules");function CEe(e){let t=[e.commitlint,e.prTitle].filter(a=>!!a);if(!t.length)return;let n=t.map(a=>a.types).reduce((a,c)=>a.filter(u=>c.includes(u)));n.length||console.warn(`[commit-rules] ${t.map(a=>a.file).join(", ")}: no common commit type; using ${t[0].types.join(", ")} from ${t[0].file}. This may fail another rule.`);let i=t.map(a=>a.subjectCase),r=i.includes("lower-case")?"lower-case":i.find(a=>a!==void 0)??t.find(a=>a.fallbackSubjectCase)?.fallbackSubjectCase,s=Math.min(...t.map(a=>a.bodyMaxLineLength??1/0));return{rules:t,types:n.length?n:t[0].types,scopeRequired:t.some(a=>a.scopeRequired),...r?{subjectCase:r}:{},headerMaxLength:Math.min(ds,...t.map(a=>a.headerMaxLength??1/0)),...Number.isFinite(s)?{bodyMaxLineLength:s}:{}}}o(CEe,"mergedHeaderRules");function oI(e,t){return e.scopeForbidden?!1:e.scopes?e.scopes.some(n=>{if(n===t)return!0;try{return new RegExp(`^(?:${n})$`).test(t)}catch{return!1}}):!0}o(oI,"allowsScope");function SEe(e,t){let n=e.find(s=>s.scopes)?.scopes??[],i=n.filter(s=>/^[\w./-]+$/.test(s)&&e.every(a=>oI(a,s)));if(!i.length)return e.every(s=>oI(s,"tests"))||console.warn(`[commit-rules] ${e.map(s=>s.file).join(", ")}: no usable required scope; using tests, which may fail the declared scope rules (${n.join(", ")}).`),"tests";let r=o(s=>t.some(a=>a.startsWith(`${s}/`)||a.split("/").slice(0,-1).includes(s)),"under");return[...i].filter(r).sort((s,a)=>a.length-s.length)[0]??i[0]}o(SEe,"pickScope");var jY=/^([A-Za-z][\w-]*)(?:\(([^)]*)\))?!?:\s*(.*)$/,kEe=o(e=>e.split(/(`.*?`|".*?"|'.*?')/).map((t,n)=>n%2?t:t.toLowerCase()).join(""),"lowerOutsideQuotes");function GY(e,t){return t==="lower-case"?kEe(e):t==="sentence-case"?e.charAt(0).toUpperCase()+e.slice(1):t==="not-capitalized"&&/^[A-Z]/.test(e)?e.replace(/^\S+/,n=>n.toLowerCase()):e}o(GY,"withSubjectCase");function BEe(e,t){return GY(e.trim().replace(/\.+$/,"").trim()||"add tests",t)}o(BEe,"conformSubject");function VY(e,t){let[n,...i]=e.replace(/\s+$/,"").split(`
|
|
205
205
|
`),r=jY.exec(n);return[t.commitlint,t.prTitle].every(s=>{if(!s)return!0;if(!s.typesFromFallback&&(!r||!s.types.includes(r[1]))||s.headerMaxLength&&n.length>s.headerMaxLength)return!1;let a=s.bodyMaxLineLength;if(a&&i.some(u=>u.length>a&&!/\bhttps?:\/\/\S+/.test(u)))return!1;let c=r?.[2];if(s.scopeRequired&&!c||c&&!oI(s,c)||r&&!r[3].trim())return!1;if(s.subjectCase){if(!r)return!1;let u=r[3],l=u.replace(/`.*?`|".*?"|'.*?'/g,"").trim();if(/^[\p{Ll}\p{Lu}\p{Lt}]/u.test(u)&&!/^\d/.test(l)&&GY(l,s.subjectCase)!==l)return!1}return!0})}o(VY,"matchesCommitRules");function REe(e,t){if(e.length<=t)return e;let n=e.slice(0,t-1),i=n.lastIndexOf(" ");return`${(i>0?n.slice(0,i):n).replace(/[\s.,;:]+$/,"")}\u2026`}o(REe,"fitSubject");function QEe(e,t){if(e.length<=t)return[e];let n=/^\s*/.exec(e)?.[0]??"",i=[],r="";for(let s of e.trim().split(/\s+/))r&&r.length+1+s.length>t?(i.push(r),r=n+s):r?r=`${r} ${s}`:r=n+s;return r&&i.push(r),i}o(QEe,"wrap");function zY(e,t,n){let i=CEe(t);if(!i)return e;let[r,...s]=e.replace(/\s+$/,"").split(`
|
|
206
206
|
`),a=jY.exec(r.trim()),c=a&&[...sI,...i.types].some(b=>b.toLowerCase()===a[1].toLowerCase())?a:null,u=c?.[1].toLowerCase(),l=c?c[3]:r.replace(/^\s*Skyramp Testbot:\s*/i,""),p=c?.[2]?.trim()||void 0;p&&t.commitlint&&!t.commitlint.scopes&&(p=p.toLowerCase());let f=[u,"test","chore"].find(b=>!!b&&i.types.includes(b))??i.types[0],g=p&&i.rules.every(b=>oI(b,p))?p:void 0;!g&&i.scopeRequired&&(g=SEe(i.rules,n));let h=g?`${f}(${g}): `:`${f}: `,m=h+REe(BEe(l,i.subjectCase),i.headerMaxLength-h.length),E=s.join(`
|
|
@@ -216,7 +216,7 @@ ${n}`}o(aI,"withSignOff");function qY(e){let t=[],n=!1;for(let i of e.split(`
|
|
|
216
216
|
`))/^\s*signed-off-by:/i.test(i)?n=!0:n&&i.trim()===""&&t.at(-1)?.trim()===""||(t.push(i),n=!1);return t.join(`
|
|
217
217
|
`).replace(/\s+$/,"")}o(qY,"withoutSignOff");function NT(e){let t=/\b(claude|anthropic)\b/i;return e.split(`
|
|
218
218
|
`).filter(i=>{let r=i.trim();return!(/^co-authored-by:/i.test(r)&&t.test(r))&&!(/^[^\w\s]*\s*generated (?:with|by) /i.test(r)&&t.test(r))}).join(`
|
|
219
|
-
`).replace(/\s+$/,"")}o(NT,"stripAgentAttribution");var cI="Skyramp-Pull-Request",kl="Skyramp-Delivery-Base",PT="Skyramp-Tested-Revision",FT="Skyramp-Delivery-Run";var
|
|
219
|
+
`).replace(/\s+$/,"")}o(NT,"stripAgentAttribution");var cI="Skyramp-Pull-Request",kl="Skyramp-Delivery-Base",PT="Skyramp-Tested-Revision",FT="Skyramp-Delivery-Run";var a6e=["%H","%P","%an","%ae","%ce",`%(trailers:key=${cI},valueonly,separator=%x2C)`,"%s",`%(trailers:key=${kl},valueonly,separator=%x2C)`,`%(trailers:key=${PT},valueonly,separator=%x2C)`,`%(trailers:key=${FT},valueonly,separator=%x2C)`];function JY(e,t){let n=e(["log","-1","--format=%B"]);if(!n.includes(`${cI}:`)&&!n.includes(`${kl}:`))return;let i=n.split(`
|
|
220
220
|
`).filter(a=>!a.startsWith(`${kl}:`)).join(`
|
|
221
221
|
`).trimEnd(),r=t?`${i}
|
|
222
222
|
${kl}: ${t}`:i;e(["log","-1","--format=%(trailers:key=Signed-off-by,valueonly)"]).split(`
|
|
@@ -235,7 +235,7 @@ ${n}`}:{prFailure:"unknown",prDetail:t}}o(JEe,"thrownFailure");async function HE
|
|
|
235
235
|
`}catch{return""}}o(KEe,"heldBackPatch");var eW=o(e=>e.map(t=>t.dependsOn.length?`${t.file} (needs ${t.dependsOn.join(", ")})`:t.file).join("; "),"heldBackText");async function XEe(e,t,n,i,r,s){let a=fY(i.path,e.runDir),c=process.env.PATH;a.dir&&(process.env.PATH=AY(a).PATH);try{return await eIe(e,t,n,i,r,s)}finally{a.dir&&(process.env.PATH=c),a.cleanup()}}o(XEe,"deliverOne");async function eIe(e,t,n,i,r,s){let a=i.slug,c,u=!1,l,p=[];try{let f=i.path,g=await HEe(e,t,n,i,r,s),{texts:h,shown:m,title:E,bot:I,remote:v,base:b,owner:w,testsBranch:Q,origin:C,mergedBase:T}=g,k=o((ne=[])=>NT(TY(MEe(ne,b)+xY(OEe(UEe(m,e,i),ne.map(tt=>tt.file)),{audience:"testbot-pr",runUrl:e.inputs.skyrampRunUrl,requestedBy:e.inputs.requestedBy,sourcePullRequest:C&&`${C.repository.namespace}/${C.repository.name}#${C.number}`}),e.inputs.skyrampRunUrl))+`
|
|
236
236
|
`,"bodyOf"),Z=s?"pr-body.md":`pr-body-${ZY(a)}.md`,oe=ui.join(e.outputsDir,Z);nn.writeFileSync(oe,k());let J=nt(f,["rev-parse","HEAD"]),pe=T??J;nt(f,["checkout","-B",Q]),c=Q,nt(f,["reset"]);let Be=Se(e,"write.json"),xe=cA(e).filter(ne=>ne.source.path===i.path&&r.includes(ne.record.sourceAsset)),Re=ST(e);if(Re.length)throw new Error(Re.join("; "));let K=Be?dY(e,Be,h):[];if(K.length)throw new Error(K.join("; "));let z=new Set(xe.flatMap(({record:ne})=>[ne.sourceAsset,...ne.entry?[ne.entry]:[]]));for(let ne of r)z.has(ne)||FEe(ui.join(f,ne),h);let Ye=lY(e,xe,h,p);if(Ye.length)throw new Error(Ye.join("; "));let Ze=new Map([...z].map(ne=>{let tt=nn.readFileSync(ui.join(f,ne)),It=o(bs=>nt(f,["hash-object","--no-filters","--stdin"],bs),"blobHash"),Ne=new Set([It(tt)]),hn=tt.toString("latin1");return!tt.includes(0)&&hn.includes(`\r
|
|
237
237
|
`)&&Ne.add(It(Buffer.from(hn.replace(/\r\n/g,`
|
|
238
|
-
`),"latin1"))),[ne,Ne]})),it=[];for(let ne of r)try{nt(f,["--literal-pathspecs","add","--",ne])}catch{it.push(ne)}if(it.some(ne=>z.has(ne)))throw new Error("could not stage every guarded delivery file");let Ke=new Map([...Ze].map(([ne,tt])=>{let It=nt(f,["--literal-pathspecs","ls-files","--stage","--",ne]),Ne=/^100(?:644|755) ([a-f0-9]+) 0\t/.exec(It)?.[1];if(!Ne||!tt.has(Ne))throw new Error(`the staged guarded file differs from the generated file: ${ne}`);return[ne,Ne]}));try{nt(f,["diff","--cached","--quiet"])}catch{try{let ne=YEe(f,g,J,pe,e.inputs.skyrampRunUrl);nt(f,["-c",`user.name=${I.name}`,"-c",`user.email=${I.email}`,"commit","-m",ne])}catch(ne){throw new uI(ne)}u=!0}u&&(p.length=0),l=nt(f,["rev-parse","HEAD"]);let Ft,yt,st,Dt=T??s?.headSha;if(u&&Dt&&Dt!==J){let ne=!1,tt=l;try{nt(f,["checkout","-q","-B",c,Dt]),ne=!0;try{nt(f,["-c",`user.name=${I.name}`,"-c",`user.email=${I.email}`,"cherry-pick","--keep-redundant-commits",l])}catch(It){let Ne=T?ZEe(f,I,tt):void 0;if(!Ne||(yt=Ne.files.map(hn=>({file:hn,dependsOn:WEe(f,a,T,J,hn)})),st={repository:a,base:b,files:yt,patch:KEe(f,J,tt,Ne.files)},!Ne.delivered))throw It}ne=!1,JY(It=>nt(f,It),Dt),l=nt(f,["rev-parse","HEAD"])}catch(It){try{nt(f,["cherry-pick","--abort"])}catch{}nt(f,["checkout","-q","-B",c,l]);let Ne=zd(ua(It),1/0);if(T&&!ne)throw It;if(T)return{thrown:!1,held:st,record:{schemaVersion:1,repository:a,branch:c,remote:v,base:b,committed:u,commitSha:l,pushed:!1,prAction:"skipped",prTitle:E,unstaged:it,...yt?{heldBack:yt}:{},reason:yt?`every test change needs a merged revision ${b} does not have yet, so no tests PR was opened: ${eW(yt)}`:`the tests do not apply to ${b} at ${T.slice(0,12)} without the merged revisions (${Ne}), so no tests PR was opened`}};Ft=`tests committed on the checkout's merge commit (re-cut onto ${Dt.slice(0,12)} failed: ${Ne})`}}yt&&nn.writeFileSync(oe,k(yt));for(let[ne,tt]of Ke){if(yt?.some(Ne=>Ne.file===ne))continue;let It=nt(f,["--literal-pathspecs","ls-tree",l,"--",ne]);if(/^100(?:644|755) blob ([a-f0-9]+)\t/.exec(It)?.[1]!==tt)throw new Error(`the committed guarded file differs from the generated file: ${ne}`)}for(let{record:ne}of xe){if(ne.entry)continue;let tt=nt(f,["--literal-pathspecs","ls-tree",l,"--",ne.file]);if(tt&&tt!==nt(f,["--literal-pathspecs","ls-tree",J,"--",ne.file]))throw new Error(`the delivery included executable source for a held test: ${ne.file}`)}let ot=s?{}:{repositoryPath:f,repoSlug:a,devPr:null};if(!u){let ne=await t.markTestsPrUnchanged({branch:c,...ot});return{thrown:!1,record:{schemaVersion:1,repository:a,branch:c,remote:v,base:b,committed:!1,commitSha:l,pushed:!1,prAction:ne.action==="unchanged"?"unchanged":"skipped",prUrl:ne.url,prTitle:E,unstaged:it,reason:ne.action==="unchanged"?"no test changes to commit \u2014 existing tests PR annotated as unchanged":"no test changes to commit \u2014 nothing pushed, no PR opened"}}}let Et=await t.publishTestsPr({repositoryPath:f,...ot,remote:v,branch:c,base:b,commitSha:l,title:E,bodyFile:oe,mode:e.inputs.deliverMode,deliveryOwner:w,...e.inputs.firstQualification?{firstQualification:!0}:{},runUrl:e.inputs.skyrampRunUrl,signal:e.signal,deadlineMs:e.deadlineMs});return{thrown:!1,held:st,record:{schemaVersion:1,repository:a,branch:c,remote:v,base:Et.base,requestedBase:b,committed:u,commitSha:l,pushed:Et.pushed,...Et.pushedCommits?{pushedCommits:Et.pushedCommits}:{},...Et.deliveredCommit?{deliveredCommit:Et.deliveredCommit}:{},prAction:Et.action,...Et.retargetedAs?{retargetedAs:Et.retargetedAs}:{},prUrl:Et.url,prTitle:E,...Et.failure?{prFailure:Et.failure,prDetail:Et.detail}:{},...Ft?{cutNote:Ft}:{},...Et.action==="skipped"&&Et.detail?{reason:Et.detail}:{},unstaged:it,...yt?{heldBack:yt}:{}}}}catch(f){return{thrown:!0,record:{schemaVersion:1,repository:a,branch:c,committed:u,commitSha:l,pushed:!1,prAction:"failed",...JEe(f),unstaged:[]}}}finally{if(p.length){try{nt(i.path,["reset"])}catch{}for(let f of p.reverse())try{f()}catch{}}}}o(eIe,"deliverRepository");var _6e={name:"deliver",timeoutMinutes:5,execute:GEe,validateInput:o(e=>{let t=mT(e);return t?{ok:!1,reasons:[t]}:TEe(e)},"validateInput"),requires:["report"],branchRequires:{runtime:["write"],"no-runtime":["generate-unit"]}};var tIe=10*6e4,nIe=4*6e4,rIe=6e4;function iIe(e,t){return e.getTime()-t.getTime()-tIe}o(iIe,"remainingBudgetMs");var tW="This attempt revoked its scoped GitHub credentials; it mints no more.";var sIe=10*6e4;var oIe=o(e=>!!e&&Object.keys(e).length===1&&e.contents==="read","onlyReads"),aIe=3e4,cIe=3,nW=30,li=class extends Error{constructor(n,i,r,s){super(n);this.status=i;this.code=r;this.path=s}status;code;path;static{o(this,"AppRefusal")}},Gi=class extends Error{static{o(this,"AppUnreachable")}},Bl=class extends Gi{static{o(this,"AppNotReady")}},MT=class extends Bl{static{o(this,"RunnerProviderNotReady")}};function LT(e){let t;try{t=new URL(e)}catch{throw new Error(`skyrampAppOrigin "${e}" is not a URL`)}if(t.protocol!=="https:"||t.origin!==e.replace(/\/+$/,""))throw new Error(`skyrampAppOrigin must be an https origin, got "${e}"`);return t.origin}o(LT,"appOrigin");function sW(e,t){if(!wu.test(e))throw new Error(`The ${t} "${e}" is not a uuid`);return e}o(sW,"routeId");function oW(e,t,n,i){throw t<500&&t!==429?new li(e,t,n,i):t===503&&n==="RUNNER_PROVIDER_NOT_READY"?new MT(e):t===503&&n==="RUN_NOT_READY"?new Bl(e):new Gi(e)}o(oW,"refusedOrUnreachable");async function aW(e,t,n,i,r,s=1/0){let a=LT(e.origin),c=`The time limit for ${t} ${n} was reached`,u,l=0;for(let p=1;p<=cIe||u instanceof Bl;p+=1){if(u instanceof Bl){if(l===nW)throw u;l+=1,p-=1,e.log?.(`${u.message}; trying again (${l} of ${nW}).`),await new Promise(f=>setTimeout(f,Math.max(0,Math.min(e.readyWaitMs??1e4,s-Date.now()))))}else p>1&&await new Promise(f=>setTimeout(f,Math.max(0,Math.min((e.retryDelayMs??2e3)*(p-1),s-Date.now()))));if(Date.now()>=s)throw new Gi(c);try{let f,g=await(Number.isFinite(s)?Promise.race([e.idToken(a),new Promise((m,E)=>{f=setTimeout(()=>E(new Gi(c)),Math.max(1,s-Date.now()))})]).finally(()=>{f&&clearTimeout(f)}):e.idToken(a));if(Date.now()>=s)throw new Gi(c);let h=await(e.fetch??fetch)(new URL(n,a).toString(),{...i(g),redirect:"error",signal:AbortSignal.timeout(Math.max(1,Math.min(aIe,s-Date.now())))}).catch(m=>{throw new Gi(m instanceof Error?m.message:String(m),{cause:m})});return await r(h)}catch(f){if(f instanceof li||Date.now()>=s)throw f;u=f}}throw u}o(aW,"callWithRetries");function cW(e,t,n,i,r){let s=i.headers.get("cf-ray");e.log?.(`Testbot V3: ${t} ${n} answered ${i.status}${s?`, cf-ray ${s}`:""}: ${r.replace(/\s+/g," ").slice(0,200)}`)}o(cW,"logRefusal");var AA=class extends Error{static{o(this,"ReportUploadSizeError")}};function uW(e){let t=Buffer.byteLength(e,"utf8");if(t<=_C)return{body:e};if(t>f1)throw new AA("The report exceeds the app's 16 MiB expanded report limit");let n=new Uint8Array((0,iW.gzipSync)(e));if(n.length>_C)throw new AA("The compressed report exceeds the app's 1 MiB report upload limit");return{body:n,gzip:!0}}o(uW,"encodeReportUpload");function lI(e,t,n,i,r){let s=t==="GET"?void 0:JSON.stringify(i),a=t==="PUT"&&/^\/api\/v1\/runner\/attempts\/[^/]+\/report$/.test(n)&&s!==void 0?uW(s):{body:s};return lW(e,t,n,a,r)}o(lI,"callApp");function lW(e,t,n,i,r){return aW(e,t,n,o(a=>({method:t,headers:{Authorization:`Bearer ${a}`,"Content-Type":"application/json",Accept:"application/json",...i.gzip?{"Content-Encoding":"gzip"}:{}},body:i.body}),"request"),async a=>{let c=await a.text().catch(()=>""),u={};try{u=JSON.parse(c)}catch{}if(a.ok)return u.data;cW(e,t,n,a,c);let l=u.error?.fields,p=typeof l?.path=="string"&&typeof l.reason=="string"?` at ${l.path}: ${l.reason}`:"",f=`The Skyramp app refused ${t} ${n}: ${a.status} ${u.error?.code??"no error code"}${p}`;return oW(f,a.status,u.error?.code,typeof l?.path=="string"?l.path:void 0)},r)}o(lW,"callEncodedApp");function uIe(e,t,n){return aW(e,"GET",t,o(r=>({method:"GET",headers:{Authorization:`Bearer ${r}`,Accept:"application/octet-stream"}}),"request"),async r=>{if(!r.ok)return cW(e,"GET",t,r,await r.text().catch(()=>"")),oW(`The Skyramp app refused GET ${t}: ${r.status}`,r.status);let s=Buffer.from(await r.arrayBuffer());if(s.length>n)throw new li(`The Skyramp app answered GET ${t} with more than ${n} bytes`,r.status);return s})}o(uIe,"callAppBytes");var gA=class{constructor(t,n,i,r,s,a,c,u,l,p=[],f=[],g){this.attemptId=t;this.attemptNumber=n;this.deadlineAt=i;this.manifest=r;this.deps=s;this.license=a;this.requestedBy=c;this.writeAllowed=u;this.claudeCodeVersion=l;this.deployedPins=p;this.statedPins=f;this.runSettings=g}attemptId;attemptNumber;deadlineAt;manifest;deps;license;requestedBy;writeAllowed;claudeCodeVersion;deployedPins;statedPins;runSettings;static{o(this,"V3Attempt")}budgetMs(t,n){let i=n===void 0?void 0:Date.parse(this.manifest.trigger.requestedAt)+n*6e4;if(this.deadlineAt.getTime()!==i)return iIe(this.deadlineAt,t);let r=this.deadlineAt.getTime()-t.getTime(),s=Math.max(rIe,Math.min(nIe,r/2));return r-s}get skyrampRunUrl(){return a1(LT(this.deps.origin),this.manifest.runId)}log(t){this.deps.log?.(t)}send(t,n,i,r){return lI(this.deps,t,n,i,r)}async sendReport(t){await lW(this.deps,"PUT",`/api/v1/runner/attempts/${this.attemptId}/report`,t)}readBytes(t,n){return uIe(this.deps,t,n)}issuedTokens=[];closure;modelKey;modelCredentials=[];credentials={};revocation;token(){return this.cachedToken("run")}readOnlyToken(){return this.cachedToken("read")}async cachedToken(t){if(this.revocation)throw new Error(tW);let n=(this.deps.now??(()=>new Date))().getTime(),i=this.credentials[t],r=i&&await i.catch(()=>{});if(this.credentials[t]!==i)return(await this.credentials[t]).token;if(r&&r.expiresAt-n>=sIe)return r.token;if(this.revocation)throw new Error(tW);let s=t==="read",a=s?{schemaVersion:1,access:t}:{schemaVersion:1},c=s?"read-only":"scoped",u=this.send("POST",`/api/v1/runner/attempts/${this.attemptId}/credentials`,a).then(l=>{let p={...l,token:l.token??this.jobToken()};if(this.issuedTokens.push(p.token),this.deps.mask?.(p.token),p.anthropicApiKey&&this.deps.mask?.(p.anthropicApiKey),s&&l.token&&!oIe(p.permissions))throw new Error(`The Skyramp app was asked for a read-only GitHub token, but its token grants ${JSON.stringify(p.permissions??null)}`);!s&&!r&&p.anthropicApiKey&&(this.modelKey=p.anthropicApiKey),this.deps.onTokenGranted?.(t);let f=r?"Renewed":"Received";return l.token&&this.deps.log?.(`${f} ${c} GitHub credentials; they expire at ${p.expiresAt}.`),{token:p.token,expiresAt:l.token?new Date(p.expiresAt).getTime():Number.POSITIVE_INFINITY}},l=>{if(this.deps.onTokenRefused?.(l,t),!(l instanceof li)||l.code!=="CREDENTIALS_UNAVAILABLE")throw l;let p=o(h=>[...new Set(h.map(m=>m.namespace))].join(", "),"unique"),f=this.manifest.sources.map(h=>h.repository);if(new Set(f.map(h=>h.providerAccountId)).size>1)throw new li(`${l.message}. The run's repositories are on more than one GitHub account (${p(f)}), which Skyramp does not support yet.`,l.status,l.code);let g=p([...f,this.manifest.execution.repository]);throw new li(`${l.message}. Check the Skyramp GitHub App installation on ${g}: it must be installed and not suspended, have access to these repositories, and have accepted the App's current permissions. Each account must also be connected to your Skyramp organization.`,l.status,l.code)});return this.credentials[t]=u,(await u).token}jobToken(){if(this.deps.sourceToken)return this.deps.sourceToken;throw new Error("The app answered the credentials request without a token, and the job gave Testbot none of its own: on Azure Pipelines, set SYSTEM_ACCESSTOKEN to $(System.AccessToken) in the Testbot step's env.")}sourceFetch(t){return t.fetch??this.deps.fetch??fetch}revokeTokens(t={}){let n=t.host??Z0();return this.revocation??=n.revokeToken?this.revokeIssued(i=>n.revokeToken(i,this.sourceFetch(t))):Promise.resolve([]),this.revocation}async revokeIssued(t){let n=[...this.issuedTokens],i=Promise.all(n.map(a=>this.revokeOne(a,t)));await Promise.all(Object.values(this.credentials).map(a=>a.catch(()=>{})));let r=this.issuedTokens.filter(a=>!n.includes(a));return[...await i,...await Promise.all(r.map(a=>this.revokeOne(a,t)))].filter(a=>a!==void 0)}async revokeOne(t,n){try{await n(t);return}catch(i){return`token ${this.issuedTokens.indexOf(t)+1} of ${this.issuedTokens.length}: ${i instanceof Error?i.message:String(i)}`}}};async function dW(e,t,n){sW(e,"run id"),LT(n.origin);let i=OC(e,t),r=`/api/v1/runner/runs/${e}/attempts`,s;try{s=await lI(n,"POST",r,i)}catch(l){if(!(l instanceof li&&l.status===400&&l.path==="$.statedPins"))throw l;i=OC(e,t,{statedPins:!1}),s=await lI(n,"POST",r,i)}let a=_1(s);if(a.manifest.runId!==e)throw new Error(`The app answered the handshake of run ${e} with the manifest of another run (${a.manifest.runId})`);let c=a.manifest.sources.find(l=>l.repository.provider!==i.execution.provider);if(c)throw new Error(`The manifest of run ${e} names ${c.repository.namespace}/${c.repository.name} on ${c.repository.provider}, but this job runs on ${i.execution.provider}`);lIe(a.manifest,[...a.deployedRevisions??[],...a.statedRevisions??[]]),a.runToken&&n.mask?.(a.runToken);let u=a.runToken?{entitlements:a.entitlements??[],runToken:a.runToken}:void 0;return new gA(a.attempt.id,a.attempt.number,new Date(a.attempt.deadlineAt),a.manifest,n,u,a.requestedBy??void 0,a.writeAllowed,a.claudeCodeVersion??void 0,a.deployedRevisions??[],a.statedRevisions??[],a.runSettings)}o(dW,"startV3Attempt");function lIe(e,t){if(t.length===0)return;if(!I1(e))throw new Error(`The app pinned an attempt of a ${e.trigger.kind} run; only a scheduled run or unchosen manual run's retry is pinned to an earlier attempt's read`);let n=new Set(e.sources.map(r=>Ti(r.repository))),i=new Set;for(let r of t){let s=Ti(r.repository);if(!n.has(s))throw new Error(`The app pinned the attempt to repository ${r.repository.providerRepositoryId}, which is not a source of the run`);if(i.has(s))throw new Error(`The app pinned repository ${r.repository.providerRepositoryId} twice`);i.add(s)}}o(lIe,"checkAttemptPins");async function jT(e,t){return x1.parse(await e.send("POST",`/api/v1/runner/attempts/${e.attemptId}/heartbeat`,{schemaVersion:1},t))}o(jT,"heartbeatV3Attempt");async function pW(e,t=()=>new Date,n){if(e.closure)return e.closure;let i=await jT(e,n).then(r=>$1(r,t())).catch(()=>null);return i&&(e.closure=i),i}o(pW,"closedV3Attempt");var T9e=10*6e4;var D9e=["TRIGGER","AUTHORITATIVE_RELATED_CHANGE"];var _9e=d.object({tests:d.object({placements:d.array(d.unknown()).optional()}).passthrough().optional()}).passthrough(),N9e=d.object({repository:TC,testType:d.string(),directory:d.string()}).passthrough();var P9e=d.object({report:d.object({language:d.string()}).passthrough()}).passthrough();var F9e=d.object({environment:d.object({components:d.array(d.unknown()).optional(),dependencies:d.array(d.unknown()).optional()}).passthrough()}).passthrough(),U9e=d.object({environment:d.object({offLimits:d.unknown().optional()}).passthrough()}).passthrough();var O9e=d.object({environment:d.object({allowedEgress:d.unknown().optional()}).passthrough()}).passthrough();var M9e=d.object({name:d.string().min(1),provision:d.literal("existing"),url:d.string().min(1),repository:TC.optional(),revisionUrl:d.string().min(1).optional()}).passthrough(),L9e=d.object({name:d.string().min(1),url:d.string().nullable(),versionUrl:d.string().nullable(),notes:d.string().nullable()}).passthrough();var j9e=new Set(["TRIGGER","AUTHORITATIVE_RELATED_CHANGE","MANUAL_OVERRIDE"]);function fW(e){let t=o(n=>e.testResults.filter(i=>i.status===n).length,"count");return{passed:t("Pass"),failed:t("Fail"),skipped:t("Skipped")}}o(fW,"statusCounts");function dIe(e){let{passed:t,failed:n,skipped:i}=fW(e);return t+n===0?{sufficiency:"insufficient",rationale:i>0?`Every test was skipped (${i}), so nothing was validated.`:"No test ran, so nothing was validated.",gaps:["No test ran against the frozen sources."],acceptedEvidence:[],actionRequired:[]}:{sufficiency:"sufficient",rationale:`${t+n} tests ran against the frozen sources: ${t} passed, ${n} failed${i?`, ${i} skipped`:""}.`,gaps:[],acceptedEvidence:[],actionRequired:[]}}o(dIe,"executedTestsValidation");function pIe(e,t){let n=e.map(c=>({result:c,repository:c.repository??t,path:c.fileName||c.testType})),i=new Map;for(let c of n){let u=`${c.repository}:${c.result.testType}:${c.path}`;i.set(u,(i.get(u)??0)+1)}let r=n.map(({result:c,repository:u,path:l})=>{let p=(i.get(`${u}:${c.testType}:${l}`)??0)>1;return c.resultId??PC(u,c.testType,l,p&&c.endpoint||void 0)}),s=new Map;for(let c of r)s.set(c,(s.get(c)??0)+1);let a=new Set(r.filter(c=>s.get(c)===1));return n.map(({result:c,repository:u},l)=>{let p=r[l],f=p;if(s.get(p)>1&&a.has(p))for(let g=2;a.has(f)||f===p;g+=1)f=p.includes("#")?`${p}.${g}`:`${p}#${g}`;return a.add(f),{...c,repository:u,resultId:f}})}o(pIe,"withResultIds");function fIe({notTranslated:e,...t},n){let i=pIe(t.testResults,n);return{...t,testResults:i,...AIe(t,i,n),validation:mIe(yIe(t,gIe(t,t.validation??dIe(t)))),traceVersion:1}}o(fIe,"v3Report");function AIe(e,t,n){if(!e.testExecutionContexts)return{};let i=new Set,r=o(c=>{let u=c;for(let l=2;i.has(u);l+=1)u=`${c}#${l}`;return i.add(u),u},"unique"),s=[],a=new Map;for(let{repository:c,...u}of e.testExecutionContexts){let l=u.status==="not_run"?[]:t.filter(p=>p.fileName===u.test&&p.repository===(c?.trim()||n));l.length||s.push(u);for(let{resultId:p}of l){let f=a.get(p),g=f!==void 0&&s[f].cleanup.status==="failed"?s[f].cleanup:u.cleanup,h={...u,cleanup:g,test:p,resultId:p};f===void 0?a.set(p,s.push(h)-1):s[f]=h}}for(let c of s)c.resultId&&i.add(c.resultId);return{testExecutionContexts:s.map(c=>c.resultId?c:{...c,test:r(c.test.slice(0,512))}).slice(0,5e3)}}o(AIe,"linkedContexts");function gIe(e,t){let{passed:n,failed:i}=fW(e);return t.sufficiency!=="sufficient"||n+i>0||t.acceptedEvidence.length>0?t:{...t,sufficiency:"insufficient",gaps:["No test ran and no existing evidence was accepted, so nothing was validated."]}}o(gIe,"withEvidence");var hIe={"model-provider-denied":"model_provider_denied","model-provider-unavailable":"model_provider_unavailable"};function mIe(e){return{...e,gaps:$f(e.gaps)}}o(mIe,"boundedGaps");function yIe(e,t){if(t.sufficiency==="sufficient")return t;let n=(e.caveats??[]).map(r=>hIe[r.kind]).filter(r=>r!==void 0),i=[...new Set(n)].filter(r=>!t.actionRequired.includes(r));return i.length?{...t,actionRequired:[...i,...t.actionRequired]}:t}o(yIe,"withModelProviderFailure");function EIe(e,t,n){let{language:i,report:r}=t;if(i==="en")return;let s={language:i,businessCaseAnalysis:r.businessCaseAnalysis},a=o((I,v,b)=>Array.isArray(I)&&Array.isArray(v)&&I.length===v.length?I.map(w=>({[b]:w[b]})):void 0,"rows"),c=e.validation;r.validation&&c&&c.rationale===n.validation.rationale&&JSON.stringify($f(c.gaps))===JSON.stringify(n.validation.gaps)&&$f(r.validation.gaps).length===n.validation.gaps.length&&(s.validation={rationale:r.validation.rationale,gaps:$f(r.validation.gaps)});let u=new Set((n.changes??[]).map(I=>I.id)),l=(r.changes??[]).filter(I=>u.has(I.id)).map(({id:I,text:v})=>({id:I,text:v}));l.length&&(s.changes=l);let p=new Set((n.requirements??[]).filter(I=>I.statement!==void 0).map(I=>I.id)),f=(r.requirements??[]).flatMap(({id:I,statement:v})=>p.has(I)&&I.length>0&&I.length<=hp.id&&v?.trim()?[{id:I,statement:v.slice(0,hp.statement)}]:[]);f.length&&(s.requirements=f.slice(0,hp.rows));let g=a(r.issuesFound,n.issuesFound,"description");g&&(s.issuesFound=g);let h=a(r.newTestsCreated,n.newTestsCreated,"description");h&&(s.newTestsCreated=h);let m=a(r.testResults,n.testResults,"details");m&&(s.testResults=m);let E=a(r.caveats,n.caveats,"text");return E&&(s.caveats=E),s}o(EIe,"v3Display");async function AW(e,t){let n=aj([...e.issuedTokens,...t.secrets??[]]),i={...fIe(t.report,t.workingSlug),...t.notTranslated?{notTranslated:t.notTranslated}:{}},r=t.translated&&EIe(t.report,t.translated,i),s=IIe(ca(t.delivery,n)),a=t.sources.map(({repository:m,revision:E})=>({repository:m,revision:E})),c=ca(i,n),u=r&&NC.safeParse(ca(r,n)),l=u?.success?u.data:void 0;if(u&&!u.success){let m=u.error.issues[0]?.path.join(".");e.log(`Testbot V3: omitted the translated display because ${m?`display.${m}`:"it"} did not meet the report field limits.`)}let p=o((m,E)=>N1({manifest:e.manifest,attemptNumber:e.attemptNumber,checkedOut:a,firstQualification:t.firstQualification,generatedTests:m,producer:t.producer,report:E&&l?{...c,display:l}:c,githubWrites:t.githubWrites}),"build"),f=o((m,E)=>uW(JSON.stringify(p(m,E))),"encode"),g=(s.status==="partial"||s.status==="failed")&&s.failures?.some(m=>m.heldBack)?{...s,failures:s.failures.map(({heldBack:m,...E})=>E)}:void 0,h=[{delivery:s,display:!!l}];g&&h.push({delivery:g,display:!!l}),l&&(h.push({delivery:s,display:!1}),g&&h.push({delivery:g,display:!1}));for(let[m,E]of h.entries()){let I;try{I=f(E.delivery,E.display)}catch(v){if(!(v instanceof AA)||m===h.length-1)throw v;continue}l&&!E.display&&e.log("Testbot V3: omitted the translated display to fit the report upload."),E.delivery===g&&e.log("Testbot V3: omitted structured held-back files to fit the report upload. See held-back.json for the complete list."),await e.sendReport(I);return}}o(AW,"uploadV3Report");async function GT(e,t,n){if(!d.string().uuid().safeParse(t).success)return{refusal:"no_environment"};let i;try{i=Q1.parse(await e.send("GET",t1.persistentDataPolicy.replace(":attemptId",e.attemptId),void 0))}catch{return{refusal:"unavailable"}}try{if(!i.environmentAddress||new URL(i.environmentAddress).href!==new URL(n).href)return{refusal:"changed"}}catch{return{refusal:"changed"}}if(i.environmentId!==t)return{refusal:"changed"};let r=i.persistentDataPolicy;return r?r.environmentId===t?{policy:r}:{refusal:"changed"}:{refusal:"denied"}}o(GT,"fetchV3PersistentDataPolicy");async function gW(e,t,n){let{environmentId:i,environmentAddress:r}=t;if(!i||!r)return{allowed:!1,refusal:"no_environment"};let s=t.persistentDataPolicy;if(!s?.allowed||s.environmentId!==i)return{allowed:!1,refusal:"no_recorded_grant"};let a=await GT(e,i,r);return"refusal"in a?{allowed:!1,refusal:a.refusal}:a.policy.allowed?a.policy.revision!==s.revision?{allowed:!1,refusal:"changed"}:Hh(t,a.policy,n)?{allowed:!0,policy:a.policy}:{allowed:!1,refusal:"out_of_scope"}:{allowed:!1,refusal:"denied"}}o(gW,"currentV3PersistenceDecision");var rW=o((e,t=om)=>e.length>t?`${e.slice(0,t-1)}\u2026`:e,"boundDeliveryMessage");function IIe(e){let t=o(n=>n.map(i=>({...i,message:rW(i.message)})),"bound");return e.status==="partial"?{...e,failures:t(e.failures)}:e.status==="failed"?{...e,message:rW(e.message),...e.failures&&{failures:t(e.failures)}}:e}o(IIe,"boundDeliveryMessages");async function hW(e,t){return sW(e.attemptId,"attempt id"),lI(t,"POST",`/api/v1/runner/attempts/${e.attemptId}/end`,P1({reportUploaded:e.reportUploaded,recipeUploaded:e.recipeUploaded,revisionsUploaded:e.revisionsUploaded,cancelled:e.cause==="cancelled",timedOut:e.cause==="timed_out",setupFailed:e.cause==="setup_failed",checkoutFailed:e.cause==="checkout_failed"||e.cause==="merge_conflict"&&!e.conflict,mergeConflict:e.cause==="merge_conflict"?e.conflict:void 0,environmentUnverified:e.cause==="environment_unverified",runnerProviderNotReady:e.cause==="runner_provider_not_ready",credentialMissing:e.cause==="credential_missing",modelProviderDenied:e.cause==="model_provider_denied",modelProviderUnavailable:e.cause==="model_provider_unavailable",githubWrites:e.githubWrites,environmentUnavailable:e.cause==="environment_unavailable"}))}o(hW,"endV3Attempt");0&&(module.exports={AppRefusal,AppUnreachable,AttemptEndReason,DeliveryStatus,GitHubWriteKind,NoReportCause,SourceProvider,TARGET_ENVIRONMENT_KEYS,V3Attempt,ValidationSufficiency,closedV3Attempt,currentV3PersistenceDecision,endV3Attempt,fetchV3PersistentDataPolicy,heartbeatV3Attempt,startV3Attempt,uploadV3Report});
|
|
238
|
+
`),"latin1"))),[ne,Ne]})),it=[];for(let ne of r)try{nt(f,["--literal-pathspecs","add","--",ne])}catch{it.push(ne)}if(it.some(ne=>z.has(ne)))throw new Error("could not stage every guarded delivery file");let Ke=new Map([...Ze].map(([ne,tt])=>{let It=nt(f,["--literal-pathspecs","ls-files","--stage","--",ne]),Ne=/^100(?:644|755) ([a-f0-9]+) 0\t/.exec(It)?.[1];if(!Ne||!tt.has(Ne))throw new Error(`the staged guarded file differs from the generated file: ${ne}`);return[ne,Ne]}));try{nt(f,["diff","--cached","--quiet"])}catch{try{let ne=YEe(f,g,J,pe,e.inputs.skyrampRunUrl);nt(f,["-c",`user.name=${I.name}`,"-c",`user.email=${I.email}`,"commit","-m",ne])}catch(ne){throw new uI(ne)}u=!0}u&&(p.length=0),l=nt(f,["rev-parse","HEAD"]);let Ft,yt,st,Dt=T??s?.headSha;if(u&&Dt&&Dt!==J){let ne=!1,tt=l;try{nt(f,["checkout","-q","-B",c,Dt]),ne=!0;try{nt(f,["-c",`user.name=${I.name}`,"-c",`user.email=${I.email}`,"cherry-pick","--keep-redundant-commits",l])}catch(It){let Ne=T?ZEe(f,I,tt):void 0;if(!Ne||(yt=Ne.files.map(hn=>({file:hn,dependsOn:WEe(f,a,T,J,hn)})),st={repository:a,base:b,files:yt,patch:KEe(f,J,tt,Ne.files)},!Ne.delivered))throw It}ne=!1,JY(It=>nt(f,It),Dt),l=nt(f,["rev-parse","HEAD"])}catch(It){try{nt(f,["cherry-pick","--abort"])}catch{}nt(f,["checkout","-q","-B",c,l]);let Ne=zd(ua(It),1/0);if(T&&!ne)throw It;if(T)return{thrown:!1,held:st,record:{schemaVersion:1,repository:a,branch:c,remote:v,base:b,committed:u,commitSha:l,pushed:!1,prAction:"skipped",prTitle:E,unstaged:it,...yt?{heldBack:yt}:{},reason:yt?`every test change needs a merged revision ${b} does not have yet, so no tests PR was opened: ${eW(yt)}`:`the tests do not apply to ${b} at ${T.slice(0,12)} without the merged revisions (${Ne}), so no tests PR was opened`}};Ft=`tests committed on the checkout's merge commit (re-cut onto ${Dt.slice(0,12)} failed: ${Ne})`}}yt&&nn.writeFileSync(oe,k(yt));for(let[ne,tt]of Ke){if(yt?.some(Ne=>Ne.file===ne))continue;let It=nt(f,["--literal-pathspecs","ls-tree",l,"--",ne]);if(/^100(?:644|755) blob ([a-f0-9]+)\t/.exec(It)?.[1]!==tt)throw new Error(`the committed guarded file differs from the generated file: ${ne}`)}for(let{record:ne}of xe){if(ne.entry)continue;let tt=nt(f,["--literal-pathspecs","ls-tree",l,"--",ne.file]);if(tt&&tt!==nt(f,["--literal-pathspecs","ls-tree",J,"--",ne.file]))throw new Error(`the delivery included executable source for a held test: ${ne.file}`)}let ot=s?{}:{repositoryPath:f,repoSlug:a,devPr:null};if(!u){let ne=await t.markTestsPrUnchanged({branch:c,...ot});return{thrown:!1,record:{schemaVersion:1,repository:a,branch:c,remote:v,base:b,committed:!1,commitSha:l,pushed:!1,prAction:ne.action==="unchanged"?"unchanged":"skipped",prUrl:ne.url,prTitle:E,unstaged:it,reason:ne.action==="unchanged"?"no test changes to commit \u2014 existing tests PR annotated as unchanged":"no test changes to commit \u2014 nothing pushed, no PR opened"}}}let Et=await t.publishTestsPr({repositoryPath:f,...ot,remote:v,branch:c,base:b,commitSha:l,title:E,bodyFile:oe,mode:e.inputs.deliverMode,deliveryOwner:w,...e.inputs.firstQualification?{firstQualification:!0}:{},runUrl:e.inputs.skyrampRunUrl,signal:e.signal,deadlineMs:e.deadlineMs});return{thrown:!1,held:st,record:{schemaVersion:1,repository:a,branch:c,remote:v,base:Et.base,requestedBase:b,committed:u,commitSha:l,pushed:Et.pushed,...Et.pushedCommits?{pushedCommits:Et.pushedCommits}:{},...Et.deliveredCommit?{deliveredCommit:Et.deliveredCommit}:{},prAction:Et.action,...Et.retargetedAs?{retargetedAs:Et.retargetedAs}:{},prUrl:Et.url,prTitle:E,...Et.failure?{prFailure:Et.failure,prDetail:Et.detail}:{},...Ft?{cutNote:Ft}:{},...Et.action==="skipped"&&Et.detail?{reason:Et.detail}:{},unstaged:it,...yt?{heldBack:yt}:{}}}}catch(f){return{thrown:!0,record:{schemaVersion:1,repository:a,branch:c,committed:u,commitSha:l,pushed:!1,prAction:"failed",...JEe(f),unstaged:[]}}}finally{if(p.length){try{nt(i.path,["reset"])}catch{}for(let f of p.reverse())try{f()}catch{}}}}o(eIe,"deliverRepository");var N6e={name:"deliver",timeoutMinutes:5,execute:GEe,validateInput:o(e=>{let t=mT(e);return t?{ok:!1,reasons:[t]}:TEe(e)},"validateInput"),requires:["report"],branchRequires:{runtime:["write"],"no-runtime":["generate-unit"]}};var tIe=10*6e4,nIe=4*6e4,rIe=6e4;function iIe(e,t){return e.getTime()-t.getTime()-tIe}o(iIe,"remainingBudgetMs");var tW="This attempt revoked its scoped GitHub credentials; it mints no more.";var sIe=10*6e4;var oIe=o(e=>!!e&&Object.keys(e).length===1&&e.contents==="read","onlyReads"),aIe=3e4,cIe=3,nW=30,li=class extends Error{constructor(n,i,r,s){super(n);this.status=i;this.code=r;this.path=s}status;code;path;static{o(this,"AppRefusal")}},Gi=class extends Error{static{o(this,"AppUnreachable")}},Bl=class extends Gi{static{o(this,"AppNotReady")}},MT=class extends Bl{static{o(this,"RunnerProviderNotReady")}};function LT(e){let t;try{t=new URL(e)}catch{throw new Error(`skyrampAppOrigin "${e}" is not a URL`)}if(t.protocol!=="https:"||t.origin!==e.replace(/\/+$/,""))throw new Error(`skyrampAppOrigin must be an https origin, got "${e}"`);return t.origin}o(LT,"appOrigin");function sW(e,t){if(!wu.test(e))throw new Error(`The ${t} "${e}" is not a uuid`);return e}o(sW,"routeId");function oW(e,t,n,i){throw t<500&&t!==429?new li(e,t,n,i):t===503&&n==="RUNNER_PROVIDER_NOT_READY"?new MT(e):t===503&&n==="RUN_NOT_READY"?new Bl(e):new Gi(e)}o(oW,"refusedOrUnreachable");async function aW(e,t,n,i,r,s=1/0){let a=LT(e.origin),c=`The time limit for ${t} ${n} was reached`,u,l=0;for(let p=1;p<=cIe||u instanceof Bl;p+=1){if(u instanceof Bl){if(l===nW)throw u;l+=1,p-=1,e.log?.(`${u.message}; trying again (${l} of ${nW}).`),await new Promise(f=>setTimeout(f,Math.max(0,Math.min(e.readyWaitMs??1e4,s-Date.now()))))}else p>1&&await new Promise(f=>setTimeout(f,Math.max(0,Math.min((e.retryDelayMs??2e3)*(p-1),s-Date.now()))));if(Date.now()>=s)throw new Gi(c);try{let f,g=await(Number.isFinite(s)?Promise.race([e.idToken(a),new Promise((m,E)=>{f=setTimeout(()=>E(new Gi(c)),Math.max(1,s-Date.now()))})]).finally(()=>{f&&clearTimeout(f)}):e.idToken(a));if(Date.now()>=s)throw new Gi(c);let h=await(e.fetch??fetch)(new URL(n,a).toString(),{...i(g),redirect:"error",signal:AbortSignal.timeout(Math.max(1,Math.min(aIe,s-Date.now())))}).catch(m=>{throw new Gi(m instanceof Error?m.message:String(m),{cause:m})});return await r(h)}catch(f){if(f instanceof li||Date.now()>=s)throw f;u=f}}throw u}o(aW,"callWithRetries");function cW(e,t,n,i,r){let s=i.headers.get("cf-ray");e.log?.(`Testbot V3: ${t} ${n} answered ${i.status}${s?`, cf-ray ${s}`:""}: ${r.replace(/\s+/g," ").slice(0,200)}`)}o(cW,"logRefusal");var AA=class extends Error{static{o(this,"ReportUploadSizeError")}};function uW(e){let t=Buffer.byteLength(e,"utf8");if(t<=_C)return{body:e};if(t>f1)throw new AA("The report exceeds the app's 16 MiB expanded report limit");let n=new Uint8Array((0,iW.gzipSync)(e));if(n.length>_C)throw new AA("The compressed report exceeds the app's 1 MiB report upload limit");return{body:n,gzip:!0}}o(uW,"encodeReportUpload");function lI(e,t,n,i,r){let s=t==="GET"?void 0:JSON.stringify(i),a=t==="PUT"&&/^\/api\/v1\/runner\/attempts\/[^/]+\/report$/.test(n)&&s!==void 0?uW(s):{body:s};return lW(e,t,n,a,r)}o(lI,"callApp");function lW(e,t,n,i,r){return aW(e,t,n,o(a=>({method:t,headers:{Authorization:`Bearer ${a}`,"Content-Type":"application/json",Accept:"application/json",...i.gzip?{"Content-Encoding":"gzip"}:{}},body:i.body}),"request"),async a=>{let c=await a.text().catch(()=>""),u={};try{u=JSON.parse(c)}catch{}if(a.ok)return u.data;cW(e,t,n,a,c);let l=u.error?.fields,p=typeof l?.path=="string"&&typeof l.reason=="string"?` at ${l.path}: ${l.reason}`:"",f=`The Skyramp app refused ${t} ${n}: ${a.status} ${u.error?.code??"no error code"}${p}`;return oW(f,a.status,u.error?.code,typeof l?.path=="string"?l.path:void 0)},r)}o(lW,"callEncodedApp");function uIe(e,t,n){return aW(e,"GET",t,o(r=>({method:"GET",headers:{Authorization:`Bearer ${r}`,Accept:"application/octet-stream"}}),"request"),async r=>{if(!r.ok)return cW(e,"GET",t,r,await r.text().catch(()=>"")),oW(`The Skyramp app refused GET ${t}: ${r.status}`,r.status);let s=Buffer.from(await r.arrayBuffer());if(s.length>n)throw new li(`The Skyramp app answered GET ${t} with more than ${n} bytes`,r.status);return s})}o(uIe,"callAppBytes");var gA=class{constructor(t,n,i,r,s,a,c,u,l,p=[],f=[],g){this.attemptId=t;this.attemptNumber=n;this.deadlineAt=i;this.manifest=r;this.deps=s;this.license=a;this.requestedBy=c;this.writeAllowed=u;this.claudeCodeVersion=l;this.deployedPins=p;this.statedPins=f;this.runSettings=g}attemptId;attemptNumber;deadlineAt;manifest;deps;license;requestedBy;writeAllowed;claudeCodeVersion;deployedPins;statedPins;runSettings;static{o(this,"V3Attempt")}budgetMs(t,n){let i=n===void 0?void 0:Date.parse(this.manifest.trigger.requestedAt)+n*6e4;if(this.deadlineAt.getTime()!==i)return iIe(this.deadlineAt,t);let r=this.deadlineAt.getTime()-t.getTime(),s=Math.max(rIe,Math.min(nIe,r/2));return r-s}get skyrampRunUrl(){return a1(LT(this.deps.origin),this.manifest.runId)}log(t){this.deps.log?.(t)}send(t,n,i,r){return lI(this.deps,t,n,i,r)}async sendReport(t){await lW(this.deps,"PUT",`/api/v1/runner/attempts/${this.attemptId}/report`,t)}readBytes(t,n){return uIe(this.deps,t,n)}issuedTokens=[];closure;modelKey;modelCredentials=[];credentials={};revocation;token(){return this.cachedToken("run")}readOnlyToken(){return this.cachedToken("read")}async cachedToken(t){if(this.revocation)throw new Error(tW);let n=(this.deps.now??(()=>new Date))().getTime(),i=this.credentials[t],r=i&&await i.catch(()=>{});if(this.credentials[t]!==i)return(await this.credentials[t]).token;if(r&&r.expiresAt-n>=sIe)return r.token;if(this.revocation)throw new Error(tW);let s=t==="read",a=s?{schemaVersion:1,access:t}:{schemaVersion:1},c=s?"read-only":"scoped",u=this.send("POST",`/api/v1/runner/attempts/${this.attemptId}/credentials`,a).then(l=>{let p={...l,token:l.token??this.jobToken()};if(this.issuedTokens.push(p.token),this.deps.mask?.(p.token),p.anthropicApiKey&&this.deps.mask?.(p.anthropicApiKey),s&&l.token&&!oIe(p.permissions))throw new Error(`The Skyramp app was asked for a read-only GitHub token, but its token grants ${JSON.stringify(p.permissions??null)}`);!s&&!r&&p.anthropicApiKey&&(this.modelKey=p.anthropicApiKey),this.deps.onTokenGranted?.(t);let f=r?"Renewed":"Received";return l.token&&this.deps.log?.(`${f} ${c} GitHub credentials; they expire at ${p.expiresAt}.`),{token:p.token,expiresAt:l.token?new Date(p.expiresAt).getTime():Number.POSITIVE_INFINITY}},l=>{if(this.deps.onTokenRefused?.(l,t),!(l instanceof li)||l.code!=="CREDENTIALS_UNAVAILABLE")throw l;let p=o(h=>[...new Set(h.map(m=>m.namespace))].join(", "),"unique"),f=this.manifest.sources.map(h=>h.repository);if(new Set(f.map(h=>h.providerAccountId)).size>1)throw new li(`${l.message}. The run's repositories are on more than one GitHub account (${p(f)}), which Skyramp does not support yet.`,l.status,l.code);let g=p([...f,this.manifest.execution.repository]);throw new li(`${l.message}. Check the Skyramp GitHub App installation on ${g}: it must be installed and not suspended, have access to these repositories, and have accepted the App's current permissions. Each account must also be connected to your Skyramp organization.`,l.status,l.code)});return this.credentials[t]=u,(await u).token}jobToken(){if(this.deps.sourceToken)return this.deps.sourceToken;throw new Error("The app answered the credentials request without a token, and the job gave Testbot none of its own: on Azure Pipelines, set SYSTEM_ACCESSTOKEN to $(System.AccessToken) in the Testbot step's env.")}sourceFetch(t){return t.fetch??this.deps.fetch??fetch}revokeTokens(t={}){let n=t.host??Z0();return this.revocation??=n.revokeToken?this.revokeIssued(i=>n.revokeToken(i,this.sourceFetch(t))):Promise.resolve([]),this.revocation}async revokeIssued(t){let n=[...this.issuedTokens],i=Promise.all(n.map(a=>this.revokeOne(a,t)));await Promise.all(Object.values(this.credentials).map(a=>a.catch(()=>{})));let r=this.issuedTokens.filter(a=>!n.includes(a));return[...await i,...await Promise.all(r.map(a=>this.revokeOne(a,t)))].filter(a=>a!==void 0)}async revokeOne(t,n){try{await n(t);return}catch(i){return`token ${this.issuedTokens.indexOf(t)+1} of ${this.issuedTokens.length}: ${i instanceof Error?i.message:String(i)}`}}};async function dW(e,t,n){sW(e,"run id"),LT(n.origin);let i=OC(e,t),r=`/api/v1/runner/runs/${e}/attempts`,s;try{s=await lI(n,"POST",r,i)}catch(l){if(!(l instanceof li&&l.status===400&&l.path==="$.statedPins"))throw l;i=OC(e,t,{statedPins:!1}),s=await lI(n,"POST",r,i)}let a=_1(s);if(a.manifest.runId!==e)throw new Error(`The app answered the handshake of run ${e} with the manifest of another run (${a.manifest.runId})`);let c=a.manifest.sources.find(l=>l.repository.provider!==i.execution.provider);if(c)throw new Error(`The manifest of run ${e} names ${c.repository.namespace}/${c.repository.name} on ${c.repository.provider}, but this job runs on ${i.execution.provider}`);lIe(a.manifest,[...a.deployedRevisions??[],...a.statedRevisions??[]]),a.runToken&&n.mask?.(a.runToken);let u=a.runToken?{entitlements:a.entitlements??[],runToken:a.runToken}:void 0;return new gA(a.attempt.id,a.attempt.number,new Date(a.attempt.deadlineAt),a.manifest,n,u,a.requestedBy??void 0,a.writeAllowed,a.claudeCodeVersion??void 0,a.deployedRevisions??[],a.statedRevisions??[],a.runSettings)}o(dW,"startV3Attempt");function lIe(e,t){if(t.length===0)return;if(!I1(e))throw new Error(`The app pinned an attempt of a ${e.trigger.kind} run; only a scheduled run or unchosen manual run's retry is pinned to an earlier attempt's read`);let n=new Set(e.sources.map(r=>Ti(r.repository))),i=new Set;for(let r of t){let s=Ti(r.repository);if(!n.has(s))throw new Error(`The app pinned the attempt to repository ${r.repository.providerRepositoryId}, which is not a source of the run`);if(i.has(s))throw new Error(`The app pinned repository ${r.repository.providerRepositoryId} twice`);i.add(s)}}o(lIe,"checkAttemptPins");async function jT(e,t){return x1.parse(await e.send("POST",`/api/v1/runner/attempts/${e.attemptId}/heartbeat`,{schemaVersion:1},t))}o(jT,"heartbeatV3Attempt");async function pW(e,t=()=>new Date,n){if(e.closure)return e.closure;let i=await jT(e,n).then(r=>$1(r,t())).catch(()=>null);return i&&(e.closure=i),i}o(pW,"closedV3Attempt");var D9e=10*6e4;var _9e=["TRIGGER","AUTHORITATIVE_RELATED_CHANGE"];var N9e=d.object({tests:d.object({placements:d.array(d.unknown()).optional()}).passthrough().optional()}).passthrough(),P9e=d.object({repository:TC,testType:d.string(),directory:d.string()}).passthrough();var F9e=d.object({report:d.object({language:d.string()}).passthrough()}).passthrough();var U9e=d.object({environment:d.object({components:d.array(d.unknown()).optional(),dependencies:d.array(d.unknown()).optional()}).passthrough()}).passthrough(),O9e=d.object({environment:d.object({offLimits:d.unknown().optional()}).passthrough()}).passthrough();var M9e=d.object({environment:d.object({allowedEgress:d.unknown().optional()}).passthrough()}).passthrough();var L9e=d.object({name:d.string().min(1),provision:d.literal("existing"),url:d.string().min(1),repository:TC.optional(),revisionUrl:d.string().min(1).optional()}).passthrough(),j9e=d.object({name:d.string().min(1),url:d.string().nullable(),versionUrl:d.string().nullable(),notes:d.string().nullable()}).passthrough();var G9e=new Set(["TRIGGER","AUTHORITATIVE_RELATED_CHANGE","MANUAL_OVERRIDE"]);function fW(e){let t=o(n=>e.testResults.filter(i=>i.status===n).length,"count");return{passed:t("Pass"),failed:t("Fail"),skipped:t("Skipped")}}o(fW,"statusCounts");function dIe(e){let{passed:t,failed:n,skipped:i}=fW(e);return t+n===0?{sufficiency:"insufficient",rationale:i>0?`Every test was skipped (${i}), so nothing was validated.`:"No test ran, so nothing was validated.",gaps:["No test ran against the frozen sources."],acceptedEvidence:[],actionRequired:[]}:{sufficiency:"sufficient",rationale:`${t+n} tests ran against the frozen sources: ${t} passed, ${n} failed${i?`, ${i} skipped`:""}.`,gaps:[],acceptedEvidence:[],actionRequired:[]}}o(dIe,"executedTestsValidation");function pIe(e,t){let n=e.map(c=>({result:c,repository:c.repository??t,path:c.fileName||c.testType})),i=new Map;for(let c of n){let u=`${c.repository}:${c.result.testType}:${c.path}`;i.set(u,(i.get(u)??0)+1)}let r=n.map(({result:c,repository:u,path:l})=>{let p=(i.get(`${u}:${c.testType}:${l}`)??0)>1;return c.resultId??PC(u,c.testType,l,p&&c.endpoint||void 0)}),s=new Map;for(let c of r)s.set(c,(s.get(c)??0)+1);let a=new Set(r.filter(c=>s.get(c)===1));return n.map(({result:c,repository:u},l)=>{let p=r[l],f=p;if(s.get(p)>1&&a.has(p))for(let g=2;a.has(f)||f===p;g+=1)f=p.includes("#")?`${p}.${g}`:`${p}#${g}`;return a.add(f),{...c,repository:u,resultId:f}})}o(pIe,"withResultIds");function fIe({notTranslated:e,...t},n){let i=pIe(t.testResults,n);return{...t,testResults:i,...AIe(t,i,n),validation:mIe(yIe(t,gIe(t,t.validation??dIe(t)))),traceVersion:1}}o(fIe,"v3Report");function AIe(e,t,n){if(!e.testExecutionContexts)return{};let i=new Set,r=o(c=>{let u=c;for(let l=2;i.has(u);l+=1)u=`${c}#${l}`;return i.add(u),u},"unique"),s=[],a=new Map;for(let{repository:c,...u}of e.testExecutionContexts){let l=u.status==="not_run"?[]:t.filter(p=>p.fileName===u.test&&p.repository===(c?.trim()||n));l.length||s.push(u);for(let{resultId:p}of l){let f=a.get(p),g=f!==void 0&&s[f].cleanup.status==="failed"?s[f].cleanup:u.cleanup,h={...u,cleanup:g,test:p,resultId:p};f===void 0?a.set(p,s.push(h)-1):s[f]=h}}for(let c of s)c.resultId&&i.add(c.resultId);return{testExecutionContexts:s.map(c=>c.resultId?c:{...c,test:r(c.test.slice(0,512))}).slice(0,5e3)}}o(AIe,"linkedContexts");function gIe(e,t){let{passed:n,failed:i}=fW(e);return t.sufficiency!=="sufficient"||n+i>0||t.acceptedEvidence.length>0?t:{...t,sufficiency:"insufficient",gaps:["No test ran and no existing evidence was accepted, so nothing was validated."]}}o(gIe,"withEvidence");var hIe={"model-provider-denied":"model_provider_denied","model-provider-unavailable":"model_provider_unavailable"};function mIe(e){return{...e,gaps:$f(e.gaps)}}o(mIe,"boundedGaps");function yIe(e,t){if(t.sufficiency==="sufficient")return t;let n=(e.caveats??[]).map(r=>hIe[r.kind]).filter(r=>r!==void 0),i=[...new Set(n)].filter(r=>!t.actionRequired.includes(r));return i.length?{...t,actionRequired:[...i,...t.actionRequired]}:t}o(yIe,"withModelProviderFailure");function EIe(e,t,n){let{language:i,report:r}=t;if(i==="en")return;let s={language:i,businessCaseAnalysis:r.businessCaseAnalysis},a=o((I,v,b)=>Array.isArray(I)&&Array.isArray(v)&&I.length===v.length?I.map(w=>({[b]:w[b]})):void 0,"rows"),c=e.validation;r.validation&&c&&c.rationale===n.validation.rationale&&JSON.stringify($f(c.gaps))===JSON.stringify(n.validation.gaps)&&$f(r.validation.gaps).length===n.validation.gaps.length&&(s.validation={rationale:r.validation.rationale,gaps:$f(r.validation.gaps)});let u=new Set((n.changes??[]).map(I=>I.id)),l=(r.changes??[]).filter(I=>u.has(I.id)).map(({id:I,text:v})=>({id:I,text:v}));l.length&&(s.changes=l);let p=new Set((n.requirements??[]).filter(I=>I.statement!==void 0).map(I=>I.id)),f=(r.requirements??[]).flatMap(({id:I,statement:v})=>p.has(I)&&I.length>0&&I.length<=hp.id&&v?.trim()?[{id:I,statement:v.slice(0,hp.statement)}]:[]);f.length&&(s.requirements=f.slice(0,hp.rows));let g=a(r.issuesFound,n.issuesFound,"description");g&&(s.issuesFound=g);let h=a(r.newTestsCreated,n.newTestsCreated,"description");h&&(s.newTestsCreated=h);let m=a(r.testResults,n.testResults,"details");m&&(s.testResults=m);let E=a(r.caveats,n.caveats,"text");return E&&(s.caveats=E),s}o(EIe,"v3Display");async function AW(e,t){let n=aj([...e.issuedTokens,...t.secrets??[]]),i={...fIe(t.report,t.workingSlug),...t.notTranslated?{notTranslated:t.notTranslated}:{}},r=t.translated&&EIe(t.report,t.translated,i),s=IIe(ca(t.delivery,n)),a=t.sources.map(({repository:m,revision:E})=>({repository:m,revision:E})),c=ca(i,n),u=r&&NC.safeParse(ca(r,n)),l=u?.success?u.data:void 0;if(u&&!u.success){let m=u.error.issues[0]?.path.join(".");e.log(`Testbot V3: omitted the translated display because ${m?`display.${m}`:"it"} did not meet the report field limits.`)}let p=o((m,E)=>N1({manifest:e.manifest,attemptNumber:e.attemptNumber,checkedOut:a,firstQualification:t.firstQualification,generatedTests:m,producer:t.producer,report:E&&l?{...c,display:l}:c,githubWrites:t.githubWrites}),"build"),f=o((m,E)=>uW(JSON.stringify(p(m,E))),"encode"),g=(s.status==="partial"||s.status==="failed")&&s.failures?.some(m=>m.heldBack)?{...s,failures:s.failures.map(({heldBack:m,...E})=>E)}:void 0,h=[{delivery:s,display:!!l}];g&&h.push({delivery:g,display:!!l}),l&&(h.push({delivery:s,display:!1}),g&&h.push({delivery:g,display:!1}));for(let[m,E]of h.entries()){let I;try{I=f(E.delivery,E.display)}catch(v){if(!(v instanceof AA)||m===h.length-1)throw v;continue}l&&!E.display&&e.log("Testbot V3: omitted the translated display to fit the report upload."),E.delivery===g&&e.log("Testbot V3: omitted structured held-back files to fit the report upload. See held-back.json for the complete list."),await e.sendReport(I);return}}o(AW,"uploadV3Report");async function GT(e,t,n){if(!d.string().uuid().safeParse(t).success)return{refusal:"no_environment"};let i;try{i=Q1.parse(await e.send("GET",t1.persistentDataPolicy.replace(":attemptId",e.attemptId),void 0))}catch{return{refusal:"unavailable"}}try{if(!i.environmentAddress||new URL(i.environmentAddress).href!==new URL(n).href)return{refusal:"changed"}}catch{return{refusal:"changed"}}if(i.environmentId!==t)return{refusal:"changed"};let r=i.persistentDataPolicy;return r?r.environmentId===t?{policy:r}:{refusal:"changed"}:{refusal:"denied"}}o(GT,"fetchV3PersistentDataPolicy");async function gW(e,t,n){let{environmentId:i,environmentAddress:r}=t;if(!i||!r)return{allowed:!1,refusal:"no_environment"};let s=t.persistentDataPolicy;if(!s?.allowed||s.environmentId!==i)return{allowed:!1,refusal:"no_recorded_grant"};let a=await GT(e,i,r);return"refusal"in a?{allowed:!1,refusal:a.refusal}:a.policy.allowed?a.policy.revision!==s.revision?{allowed:!1,refusal:"changed"}:Hh(t,a.policy,n)?{allowed:!0,policy:a.policy}:{allowed:!1,refusal:"out_of_scope"}:{allowed:!1,refusal:"denied"}}o(gW,"currentV3PersistenceDecision");var rW=o((e,t=om)=>e.length>t?`${e.slice(0,t-1)}\u2026`:e,"boundDeliveryMessage");function IIe(e){let t=o(n=>n.map(i=>({...i,message:rW(i.message)})),"bound");return e.status==="partial"?{...e,failures:t(e.failures)}:e.status==="failed"?{...e,message:rW(e.message),...e.failures&&{failures:t(e.failures)}}:e}o(IIe,"boundDeliveryMessages");async function hW(e,t){return sW(e.attemptId,"attempt id"),lI(t,"POST",`/api/v1/runner/attempts/${e.attemptId}/end`,P1({reportUploaded:e.reportUploaded,recipeUploaded:e.recipeUploaded,revisionsUploaded:e.revisionsUploaded,cancelled:e.cause==="cancelled",timedOut:e.cause==="timed_out",setupFailed:e.cause==="setup_failed",checkoutFailed:e.cause==="checkout_failed"||e.cause==="merge_conflict"&&!e.conflict,mergeConflict:e.cause==="merge_conflict"?e.conflict:void 0,environmentUnverified:e.cause==="environment_unverified",runnerProviderNotReady:e.cause==="runner_provider_not_ready",credentialMissing:e.cause==="credential_missing",modelProviderDenied:e.cause==="model_provider_denied",modelProviderUnavailable:e.cause==="model_provider_unavailable",githubWrites:e.githubWrites,environmentUnavailable:e.cause==="environment_unavailable"}))}o(hW,"endV3Attempt");0&&(module.exports={AppRefusal,AppUnreachable,AttemptEndReason,DeliveryStatus,GitHubWriteKind,NoReportCause,SourceProvider,TARGET_ENVIRONMENT_KEYS,V3Attempt,ValidationSufficiency,closedV3Attempt,currentV3PersistenceDecision,endV3Attempt,fetchV3PersistentDataPolicy,heartbeatV3Attempt,startV3Attempt,uploadV3Report});
|
|
239
239
|
/*! Bundled license information:
|
|
240
240
|
|
|
241
241
|
undici/lib/web/fetch/body.js:
|