@skyramp/testbot-core 0.13.2-v3.538 → 0.13.2-v3.540
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
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.13.2-v3.
|
|
1
|
+
{"version":"0.13.2-v3.540","commit":"4ebd9629e656de118899409fa36f898eb5b9803b"}
|
package/dist/post.js
CHANGED
|
@@ -137,7 +137,7 @@ ${s}
|
|
|
137
137
|
`,v:"\v",f:"\f",r:"\r",'"':'"',"\\":"\\"};return e.slice(1,-1).replace(/(?:\\[0-7]{3})+|\\([abtnvfr"\\])/g,(n,s)=>s!==void 0?t[s]:Buffer.from(n.slice(1).split("\\").map(r=>parseInt(r,8))).toString("utf8"))}function az(e){let t=/^diff --git (?:"a\/(?:[^"\\]|\\.)+"|a\/.+) ("b\/(?:[^"\\]|\\.)+"|b\/.+)$/.exec(e)?.[1];return t&&oz(t).slice(2)}function hpe(e){let t=[],n=[],s;for(let r of e.split(`
|
|
138
138
|
`)){if(r.startsWith("diff --git ")){s=az(r);continue}r==="--- /dev/null"&&s?t.push(s):r==="+++ /dev/null"&&s&&n.push(s)}return{newFiles:t,deletedFiles:n}}function WR(e,t){let n=td(e,t);if(!n)return;let s=Kn(e,["merge-base",n,"HEAD"])??n,r=Kn(e,["diff","--no-relative",s,...qR],wE);if(r===void 0)return;let i=["--",...eh],o=[r,Kn(e,["diff","--no-relative",s,"HEAD",...i],wE)].filter(Boolean).join(`
|
|
139
139
|
`),a=[Kn(e,["diff","--stat",s,...qR],wE),Kn(e,["diff","--stat",s,"HEAD",...i],wE)].filter(Boolean).join(`
|
|
140
|
-
`);return{baseRef:n,diffContent:o,diffStat:a,...hpe(o)}}function IE(e,t){if(!JR(e))return;let n=td(e,t);if(!n)return;let s=Kn(e,["rev-parse","--abbrev-ref","HEAD"])??"HEAD",r=new Map,o=Kn(e,["diff","--no-relative","--name-status","-z",`${n}...HEAD`])?.split("\0")??[];for(let l=0;l<o.length-1;){let p=o[l++].charAt(0);(p==="R"||p==="C")&&l++;let h=o[l++];h&&r.set(h,p)}let c=Kn(e,["status","--porcelain","-z",...qR])?.split("\0")??[];for(let l=0;l<c.length-1;){let p=c[l++],h=p.slice(0,2),g=p.slice(3);/[RC]/.test(h)&&l++,g&&r.set(g,h==="??"?"A":h.trim().charAt(0)||"M")}let u=[...r.entries()].map(([l,p])=>({path:l,status:p})).sort((l,p)=>l.path.localeCompare(p.path));return{currentBranch:s,baseBranch:n,changedFiles:u}}var Z9=G(require("path"));On();var cz=G(require("fs")),uz=G(require("path"));function so(e=__dirname){try{let t=cz.readFileSync(uz.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"}}On();var Kc=(i=>(i.NotFound="not_found",i.NoAccess="no_access",i.Unavailable="unavailable",i.AccessLost="access_lost",i.CannotOpen="cannot_open",i))(Kc||{});var YR=e=>`${e.source}:${e.site??""}:${e.key}`;var nh=/^pasted-[0-9a-f]{16}$/,io=/^file-[0-9a-f]{16}$/,rh=(r=>(r.Pdf="application/pdf",r.Csv="text/csv",r.Docx="application/vnd.openxmlformats-officedocument.wordprocessingml.document",r.Xlsx="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",r))(rh||{}),Xc=e=>e.trim().toUpperCase(),lz=(e,t)=>{let n=e.trim();return nh.test(n.toLowerCase())?"Pasted text":io.test(n.toLowerCase())?t?.get(Xc(n))??"Uploaded document":/^\d+$/.test(n)?`Confluence page ${n}`:n.toUpperCase()};var CE=(s=>(s.New="new",s.Updated="updated",s.Existing="existing",s))(CE||{}),bi=(s=>(s.Sufficient="sufficient",s.Insufficient="insufficient",s.NoChange="no_change",s))(bi||{}),ca=(E=>(E.RelatedChangeConflict="related_change_conflict",E.ReferenceOutsideTarget="reference_outside_target",E.SourceAccessLost="source_access_lost",E.ConfigurationIncomplete="configuration_incomplete",E.CredentialUnavailable="credential_unavailable",E.WorkflowBindingUnverified="workflow_binding_unverified",E.WorkflowRefUnprotected="workflow_ref_unprotected",E.BedrockWorkflowRequired="bedrock_workflow_required",E.DeploymentReview="deployment_review",E.SutRevisionMismatch="sut_revision_mismatch",E.IsolationUnavailable="isolation_unavailable",E.EvidenceInsufficient="evidence_insufficient",E.ConfigurationUnresolved="configuration_unresolved",E.ModelProviderDenied="model_provider_denied",E.ModelProviderUnavailable="model_provider_unavailable",E.RunnerProviderNotReady="runner_provider_not_ready",E.MergeConflict="merge_conflict",E))(ca||{}),ua=(i=>(i.CiCheck="ci_check",i.TestReport="test_report",i.StaticAnalysis="static_analysis",i.CodeReview="code_review",i.Other="other",i))(ua||{}),sh=(s=>(s.Application="application",s.Environment="environment",s.TestDefect="test_defect",s))(sh||{}),ih=(a=>(a.AuthToken="auth_token",a.Secret="secret",a.DataConnection="data_connection",a.AppNotStarted="app_not_started",a.Login="login",a.ExternalDependency="external_dependency",a.RecordingReplay="recording_replay",a))(ih||{});var SE=(n=>(n.Probe="probe",n.Agent="agent",n))(SE||{}),oh=(s=>(s.Seed="seed",s.RuntimeMock="runtime_mock",s.EnvOverride="env_override",s))(oh||{}),kE=(s=>(s.TestCode="test_code",s.SkyrampMocker="skyramp_mocker",s.RecipeOverride="recipe_override",s))(kE||{});var mn=e=>e.slice(0,12);var mpe=["generate-unit","native-run"],b_e=["preflight","plan","write",...mpe,"report","deliver"];var RE=(s=>(s.Unit="unit",s.Integration="integration",s.E2e="e2e",s))(RE||{}),Ape=Object.values(RE);var ch=(n=>(n.Skyramp="skyramp",n.Llm="llm",n))(ch||{}),wi=d.string().trim().min(1),ype=d.object({case:wi.describe("recommend id this assertion enforces"),evidence:wi.describe("the exact assertion line from the file that checks that case's observable")});var dz=d.object({route:d.literal("persistence"),url:d.string().url()}).strict(),uh=d.object({kind:d.nativeEnum(oh).describe("seed: data the test creates in the app; runtime_mock: a mock on a Skyramp worker, which other tests reach too; env_override: an env value the app runs with. A stub inside the test's own process, such as a browser page's route, is none of these"),target:wi.describe("the dependency, endpoint or data it affects"),mechanism:d.nativeEnum(kE).describe("test_code: the test applies and undoes it; skyramp_mocker: a mock the test applies on a Skyramp worker; recipe_override: the mocker cannot reach the dependency (its URL is fixed in the build)"),detail:wi.describe("what it sets up"),worker:wi.optional().describe("skyramp_mocker: host:port of the worker the test applies the mock to (default localhost:35142)"),safety:dz.optional().describe("shared seed that keeps its data only because the environment permits it: the persistence route and the exact endpoint; Testbot checks the current permission just before it runs the test"),cleanup:wi.optional().describe("seed: when its data can be removed, a command that removes it if the test does not; otherwise declare leftBehind instead. Run as written and without a shell: give real values, not a placeholder such as <id>, single-quote an argument that holds shell syntax, or put the logic in a script in the repository and run that"),leftBehind:wi.optional().describe("seed: the records the test creates and cannot remove from the app, and how to find them")}).refine(e=>!e.leftBehind||e.kind==="seed",{message:"leftBehind is for a seed only: a runtime mock or an env override creates no records",path:["leftBehind"]}),Epe=d.object({file:wi.describe("staged path under .skyramp/staged/"),source:d.nativeEnum(ch),language:wi,covers:d.array(d.string()).min(1,"must be a non-empty array of recommend ids").describe("recommend ids this test covers"),assertions:d.array(ype).min(1,"must be a non-empty array").describe("one per case covered, citing the real line"),context:d.array(uh).optional().describe("what the test sets up against the running app, in order: data it seeds, Skyramp mocks it applies, env overrides; omit when none")}),ZR=d.object({schemaVersion:d.literal(1),tests:d.array(Epe),deferredUi:d.array(d.string()).describe("recommend ui ids left for the UI stage (generate) \u2014 [] for generate-ui"),summary:wi.describe("one paragraph")});var oo=(o=>(o.Place="place",o.Update="update",o.Regenerate="regenerate",o.Delete="delete",o.Verify="verify",o.None="none",o))(oo||{}),er=(s=>(s.Pass="pass",s.Fail="fail",s.Skip="skip",s))(er||{}),Xn=d.string().trim().min(1),KR=(r=>(r.Setup="setup",r.Expectation="expectation",r.Locator="locator",r.Other="other",r))(KR||{}),BE=d.object({kind:d.nativeEnum(KR),reason:Xn.describe("what in the test is wrong, with the evidence: the setup error it raised, or the requirement or changed line its expectation contradicts")}),lh=d.array(d.string().url().max(2048).regex(/^https?:\/\//i)).max(50),pz=d.object({case:Xn.describe("a covers id \u2014 the recommend case this test realizes"),status:d.nativeEnum(er),runtimeTargets:lh.optional().describe("HTTP(S) URLs this case actually exercised in its current run; omit for in-process or mocked checks, never infer from test type"),environmentRestriction:Xn.optional().describe("for a skipped case: what this run lacks to execute it; the test is still written"),fromJourney:d.boolean().optional(),testProblem:BE.optional().describe("[derived] write's reading of a failing case: the test, not the app, is at fault"),defect:d.boolean().optional().describe("[derived] write's reading of a failing case: true when the app is wrong and the test is right"),failure:d.string().optional().describe("[derived] for a failing case: the runner's failure for it, as printed")}).refine(e=>!e.environmentRestriction||e.status==="skip"&&!e.runtimeTargets?.length,{message:"an environment-restricted case must be skipped and have no runtimeTargets"}),fz=d.object({started:d.boolean().optional().describe("with exit null: true if the 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({invalid_type_error:"must be a number or null"}).nullable().describe("process exit of the re-run; null when no SUT was available"),details:d.string().optional().describe("what failed, or why a file was not run \u2014 required on any non-zero exit"),tests:d.array(pz).optional().describe("ONE ENTRY PER CASE the file covers, its own result; must agree with exit (0 \u2192 no fail; non-zero \u2192 at least one, or the non-test reason in details). The report reads the file by these where they are given")}),hz=d.object({context:d.array(uh).optional().describe("[derived] setup declarations retained for every executed test, including maintained tests"),from:d.string().optional().describe("staged path \u2014 required for placements"),file:Xn.describe("final path relative to its repository, inside that checkout, with a source-file extension"),repository:Xn.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),action:d.nativeEnum(oo),covers:d.array(d.string()).optional().describe("recommend ids a placed test covers"),repro:d.boolean().optional().describe("this test is MEANT to fail \u2014 it reproduces a reported bug"),finding:d.boolean().optional().describe("a non-repro test that failed on a REAL product bug"),placementBroken:d.boolean().optional().describe('placement/harness problem one repair could not fix \u2014 every reran.tests entry is then "skip"'),keptReason:Xn.optional().describe("why a planned delete/regenerate was declined and the file kept"),isolatedRun:Xn.optional().describe('only for a test marked "runs alone": the command, from its checkout root and without a shell, that runs only this file and writes its JUnit XML into $SKYRAMP_RESULTS_DIR (named by its path: no shell expands it) \u2014 the harness runs it, so leave reran.exit null'),reran:fz,assertionCount:d.number().int().nonnegative().optional().describe("[derived] assertions reachable from the file, counted at write time"),addedOnly:d.boolean().optional().describe("[derived] an existing test file the run only added to: every line it had is still there"),added:d.array(Xn).optional().describe("[derived] the cases of the test functions the run added to an existing file: functions it did not have"),staleOnBase:d.boolean().optional().describe("[derived] an existing test that fails the same way on the base branch: its failure is the test's own")}).refine(e=>e.action!=="place"||typeof e.from=="string"&&e.from.trim().length>0,{message:'is a place but has no "from" staged path',path:[]}),gz=(n=>(n.Junit="junit",n.Converter="converter",n))(gz||{}),vpe=Xn.optional().describe("the items[].file this test is in \u2014 needed only when two of this suite's files cover the same case id"),bpe=d.object({results:Xn.describe("the JUnit XML file this run wrote, a plain file name inside $SKYRAMP_RESULTS_DIR (e.g. backend.xml)"),source:d.nativeEnum(gz),run:Xn.describe("the command you ran that wrote it, exactly as you ran it (with any converter)"),files:d.array(Xn).min(1).describe("the items[].file paths this run covered"),cases:d.array(d.object({test:Xn.describe("the test's name as the runner reports it, qualified by its class or file (e.g. tests/test_a.py::test_x) when the bare name repeats"),case:Xn.describe("the covers id it realizes"),file:vpe})).describe("map each reported test name to the case it covers")}),wpe=d.object({suites:d.array(bpe).min(1)}),XR=d.object({schemaVersion:d.literal(1),items:d.array(hz),runnerResults:wpe.optional().describe("the JUnit XML your test runs wrote into $SKYRAMP_RESULTS_DIR, so the harness reads each test's result from the runner \u2014 omit only when no SUT is available"),ignored:d.array(d.string()).describe("existing tests assessed and deliberately left untouched"),summary:Xn.describe("one paragraph")});var dh=d.string().uuid(),xE=d.object({environmentId:d.string().uuid(),allowed:d.boolean(),revision:dh,updatedAt:d.string().datetime(),updatedBy:d.string().uuid()}).strict();var ph=(o=>(o.NoEnvironment="no_environment",o.NoRecordedGrant="no_recorded_grant",o.Unavailable="unavailable",o.Changed="changed",o.Denied="denied",o.OutOfScope="out_of_scope",o))(ph||{});function fh(e){switch(e){case"no_environment":return"the run has no selected Test Environment address";case"no_recorded_grant":return"the run's configuration did not record permission to keep test data in this environment";case"unavailable":return"the current permission to keep test data could not be read";case"changed":return"the permission to keep test data changed after the run started";case"denied":return"the environment does not permit test data to stay";case"out_of_scope":return"the request is outside the environment's address"}}function tu(e,t){try{let n=new URL(t),s=new URL(e);if(s.search||s.hash)return!1;let r=/%(?:2f|5c|2e|25)/i;if(t.includes("\\")||e.includes("\\")||r.test(n.pathname)||r.test(s.pathname))return!1;let i=s.pathname.replace(/\/$/,"");return["https:","http:"].includes(s.protocol)&&n.origin===s.origin&&(n.pathname===i||n.pathname.startsWith(`${i}/`))}catch{return!1}}var eB="delivery-persistence.json",mz=d.object({environmentId:d.string().uuid(),environmentAddress:d.string().url(),revision:dh}).strict(),Az=d.object({refusal:d.nativeEnum(ph)}).strict();var Qz=d.unknown().optional();var mh=(n=>(n.GitHub="github",n.AzureDevOps="azure-devops",n))(mh||{}),Ah=(i=>(i.Trigger="TRIGGER",i.Baseline="BASELINE",i.AuthoritativeRelatedChange="AUTHORITATIVE_RELATED_CHANGE",i.ConfiguredSharedDependency="CONFIGURED_SHARED_DEPENDENCY",i.ManualOverride="MANUAL_OVERRIDE",i))(Ah||{}),yh=(o=>(o.PullRequest="pull_request",o.ReadyForReview="ready_for_review",o.Schedule="schedule",o.Manual="manual",o.SutSetup="sut_setup",o.RevisionRead="revision_read",o))(yh||{}),Ipe=["sut_setup"],Cpe=["sut_setup","schedule","revision_read"];var NE=(t=>(t.PullRequest="pull_request",t))(NE||{}),sB=(n=>(n.PullRequest="pull_request",n.Branch="branch",n))(sB||{}),yz=["TRIGGER","AUTHORITATIVE_RELATED_CHANGE","MANUAL_OVERRIDE"];var PE=(i=>(i.ReportUploaded="report_uploaded",i.NoReport="no_report",i.Cancelled="cancelled",i.RecipeUploaded="recipe_uploaded",i.RevisionsUploaded="revisions_uploaded",i))(PE||{}),_z=(n=>(n.Running="running",n.Ended="ended",n))(_z||{}),OE=(h=>(h.TimedOut="timed_out",h.AgentFailed="agent_failed",h.SetupFailed="setup_failed",h.CredentialMissing="credential_missing",h.RunnerLost="runner_lost",h.CheckoutFailed="checkout_failed",h.EnvironmentUnverified="environment_unverified",h.ModelProviderDenied="model_provider_denied",h.ModelProviderUnavailable="model_provider_unavailable",h.RunnerProviderNotReady="runner_provider_not_ready",h.MergeConflict="merge_conflict",h.EnvironmentUnavailable="environment_unavailable",h))(OE||{}),iB=(s=>(s.Onboard="onboard",s.Deploy="deploy",s.Recheck="recheck",s))(iB||{}),Eh=(n=>(n.Started="started",n.Finished="finished",n))(Eh||{}),oB=(s=>(s.Passed="passed",s.Failed="failed",s.Skipped="skipped",s))(oB||{});var aB=(s=>(s.ChooseCredential="choose_credential",s.FreeText="free_text",s.ChooseSource="choose_source",s))(aB||{});var UE=(r=>(r.Answered="answered",r.Followed="followed",r.NotFollowed="not_followed",r.TooLate="too_late",r))(UE||{}),vh=(s=>(s.Discover="discover",s.Start="start",s.Check="check",s))(vh||{}),hh=(r=>(r.ValidationPlan="validation_plan",r.TestEnvironment="test_environment",r.TestConditions="test_conditions",r.Tests="tests",r))(hh||{});var bh=(r=>(r.Found="found",r.Starting="starting",r.Up="up",r.OutOfScope="out_of_scope",r))(bh||{}),As=d.string().regex(/^[1-9][0-9]{0,18}$/),ys=d.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),tB=d.string().regex(/^(?!.*\.\.)(?!\/)(?!.*\/$)[A-Za-z0-9._/-]{1,255}$/),rd=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;var Mn=d.string().regex(rd),tr=d.string().regex(/^[0-9a-f]{64}$/),DE=d.object({id:Mn,revision:As}).strict(),FE={provider:d.literal("github"),providerAccountId:As,providerRepositoryId:As},ME={provider:d.literal("azure-devops"),providerAccountId:Mn,providerRepositoryId:Mn},Hr=d.discriminatedUnion("provider",[d.object(FE).strict(),d.object(ME).strict()]),cB=d.discriminatedUnion("provider",[d.object(FE).passthrough(),d.object(ME).passthrough()]),nu=e=>`${e.provider}:${e.providerRepositoryId}`,Ez={namespace:d.string().min(1),name:d.string().min(1)},Dz=d.discriminatedUnion("provider",[d.object({...FE,...Ez}).strict(),d.object({...ME,...Ez}).strict()]),vz=d.object({ref:d.string().min(1),revision:ys}).strict(),Spe=d.object({kind:d.nativeEnum(sB),number:As.optional(),ref:d.string().min(1),revision:ys,reason:d.nativeEnum(Ah)}).strict(),kpe=d.object({repository:Dz,revision:ys,ref:d.string().nullable(),reason:d.nativeEnum(Ah),change:d.object({kind:d.nativeEnum(NE),number:As,base:vz.optional()}).strict().nullable(),compareWith:vz.optional(),merge:d.array(Spe).min(2).optional()}).strict();function Rpe(e){let t=e.merge;if(!t)return null;if(e.change||e.compareWith)return{path:["merge"],message:"a merged source names no change and no compareWith"};if(e.ref===null)return{path:["ref"],message:"a merged source names its baseline branch"};let n=new Set,s=new Set;for(let[i,o]of t.entries()){if(o.kind==="pull_request"!=(o.number!==void 0))return{path:["merge",i,"number"],message:"a pull request names its number, and a branch none"};if(!yz.includes(o.reason))return{path:["merge",i,"reason"],message:`${o.reason} does not select a merged revision`};if(o.kind==="branch"&&o.reason!=="MANUAL_OVERRIDE")return{path:["merge",i,"reason"],message:"only a person chooses a branch to merge"};if(o.ref===e.ref)return{path:["merge",i,"ref"],message:"the baseline branch is what the source merges onto"};if(o.number!==void 0&&n.has(o.number)||s.has(o.ref))return{path:["merge",i],message:"names a revision the source already merges"};o.number!==void 0&&n.add(o.number),s.add(o.ref)}let r=yz.find(i=>t.some(o=>o.reason===i));return e.reason!==r?{path:["reason"],message:`a source that merges these revisions is ${r}`}:null}function Bpe(e){if(e.trigger.kind==="revision_read"!=!e.baseline)return e.baseline?"a revision_read run names no baseline":"names its baseline";if(!e.baseline)return null;let{confirmedRunId:t,initialBaselineId:n,comparisonBaselineId:s,sources:r}=e.baseline;if([t,n,s].filter(u=>u!=null).length>1)return"a run compares with one baseline";let i=e.trigger.kind==="schedule"&&t!==null||n!==void 0||s!==void 0;if(!r)return i?"names every source of the snapshot, once":null;if(t===null&&n===void 0&&s===void 0)return"a run with no Confirmed Baseline names no baseline sources";let o=new Set(e.sources.map(u=>nu(u.repository))),a=new Set(r.map(u=>nu(u.repository)));return a.size===r.length&&a.size===o.size&&[...a].every(u=>o.has(u))?null:"names every source of the snapshot, once"}var Nz=/^[A-Z][A-Z0-9_]+-[1-9][0-9]*$/,Pz=/^[1-9][0-9]{0,18}$/,bz=new RegExp(`${Nz.source}|${Pz.source}`),wz=/^https:\/\/[a-z0-9-]+(\.[a-z0-9-]+)+$/,xpe=d.union([d.object({source:d.literal("jira"),site:d.string().regex(wz),key:d.string().regex(Nz),updated:d.string().datetime(),contentHash:tr}).strict(),d.object({source:d.literal("confluence"),site:d.string().regex(wz),key:d.string().regex(Pz),version:d.number().int().positive(),contentHash:tr}).strict(),d.object({source:d.literal("other"),key:d.string().regex(nh),contentHash:tr}).strict(),d.object({source:d.literal("other"),key:d.string().regex(io),contentHash:tr,fileName:d.string().min(1).max(255),mediaType:d.nativeEnum(rh)}).strict()]),Iz=d.union([d.literal("jira"),d.literal("confluence")]),$pe=d.object({schemaVersion:d.literal(1),items:d.array(d.union([d.object({source:Iz,site:d.string(),key:d.string().regex(bz),state:d.literal("read"),text:d.string(),version:d.string().min(1),contentMatches:d.boolean()}).strict(),d.object({source:Iz,site:d.string(),key:d.string().regex(bz),state:d.literal("not_read"),reason:d.nativeEnum(Kc)}).strict(),d.object({source:d.literal("other"),key:d.string().regex(nh),state:d.literal("read"),text:d.string(),version:d.string().min(1),contentMatches:d.boolean()}).strict(),d.object({source:d.literal("other"),key:d.string().regex(nh),state:d.literal("not_read"),reason:d.nativeEnum(Kc)}).strict(),d.object({source:d.literal("other"),key:d.string().regex(io),state:d.literal("read"),version:tr,fileName:d.string().min(1).max(255),mediaType:d.nativeEnum(rh)}).strict(),d.object({source:d.literal("other"),key:d.string().regex(io),state:d.literal("not_read"),reason:d.nativeEnum(Kc)}).strict()])),instructions:d.array(d.string()).optional()}).strict(),Tpe=d.object({resultId:d.string().min(1),repository:d.string().min(1),testType:d.string().min(1),path:d.string(),finding:d.string().min(1)}).strict(),Qpe=d.object({schemaVersion:d.literal(1),runId:Mn,skyrampOrgId:Mn,target:DE,policy:DE.nullable(),trigger:d.object({kind:d.nativeEnum(yh),requestedAt:d.string().datetime()}).strict(),configuration:d.object({captureId:Mn,revision:As.nullable(),hash:tr}).strict(),baseline:d.object({confirmedRunId:Mn.nullable(),initialBaselineId:Mn.optional(),comparisonBaselineId:Mn.optional(),knownFailures:d.array(Tpe).optional(),sources:d.array(d.object({repository:Hr,revision:ys}).strict()).optional()}).strict().optional(),sources:d.array(kpe).min(1).max(1e3),execution:d.object({provider:d.nativeEnum(mh),repository:Dz,workflowPath:d.string(),ref:d.string()}).strict(),credentials:d.array(d.object({name:d.string(),purpose:d.nativeEnum(Zc),required:d.boolean()}).strict()),requirements:d.array(xpe).min(1).optional(),instructions:d.object({contentHash:tr}).strict().optional(),deployedRevisions:d.array(d.object({repository:Hr,revision:ys}).strict()).min(1).optional()}).strict().superRefine((e,t)=>{let n=new Set;(e.requirements??[]).forEach((c,u)=>{let l="fileName"in c?"file":"pasted";c.source==="other"&&c.key!==`${l}-${c.contentHash.slice(0,16)}`&&t.addIssue({code:d.ZodIssueCode.custom,message:"is not the key of its content hash",path:["requirements",u,"key"]});let p=YR({source:c.source,key:c.key});n.has(p)&&t.addIssue({code:d.ZodIssueCode.custom,message:"names an item that the run already names",path:["requirements",u,"key"]}),n.add(p)});let s=e.trigger.kind,r=Ipe.includes(s);r!==(e.policy===null)&&t.addIssue({code:d.ZodIssueCode.custom,path:["policy"],message:r?`a ${s} run has no policy`:"names the policy revision"}),e.baseline?.knownFailures&&!e.baseline.comparisonBaselineId&&t.addIssue({code:d.ZodIssueCode.custom,path:["baseline","knownFailures"],message:"known failures require a chosen comparison checkpoint"});let i=Bpe(e);i&&t.addIssue({code:d.ZodIssueCode.custom,path:e.baseline?["baseline","sources"]:["baseline"],message:i}),Cpe.includes(s)&&e.sources.forEach((c,u)=>{c.reason!=="BASELINE"&&t.addIssue({code:d.ZodIssueCode.custom,path:["sources",u,"reason"],message:`a ${s} run selects only BASELINE sources`})}),e.deployedRevisions&&s!=="manual"&&t.addIssue({code:d.ZodIssueCode.custom,path:["deployedRevisions"],message:"only a manual run pins deployed revisions"});let o=new Set(e.sources.map(c=>nu(c.repository))),a=new Set;(e.deployedRevisions??[]).forEach((c,u)=>{let l=nu(c.repository);o.has(l)?a.has(l)&&t.addIssue({code:d.ZodIssueCode.custom,path:["deployedRevisions",u,"repository"],message:"repository appears twice"}):t.addIssue({code:d.ZodIssueCode.custom,path:["deployedRevisions",u,"repository"],message:"names a repository outside the snapshot"}),a.add(l)}),e.sources.forEach((c,u)=>{c.compareWith&&(c.reason!=="MANUAL_OVERRIDE"||c.change)&&t.addIssue({code:d.ZodIssueCode.custom,path:["sources",u,"compareWith"],message:"only a MANUAL_OVERRIDE source without a change names a revision to compare with"}),e.baseline?.comparisonBaselineId&&(c.change?.base||c.compareWith||c.merge)&&t.addIssue({code:d.ZodIssueCode.custom,path:["sources",u],message:"a chosen checkpoint cannot be combined with a source comparison base or merge"});let l=Rpe(c);l&&t.addIssue({code:d.ZodIssueCode.custom,path:["sources",u,...l.path],message:l.message})})});var uB=(n=>(n.Person="person",n.Policy="policy",n))(uB||{}),_pe=d.object({kind:d.nativeEnum(uB),name:d.string().min(1).max(256)}).strict(),Dpe=d.object({mcp:d.discriminatedUnion("source",[d.object({source:d.literal("npm"),version:d.string().regex(/^[A-Za-z0-9][A-Za-z0-9.+_-]{0,63}$/).nullable()}).strict(),d.object({source:d.literal("github"),ref:d.string().regex(/^[A-Za-z0-9._/-]{1,255}$/)}).strict()]),bedrock:d.object({region:d.string().regex(/^[a-z]{2}(-[a-z]+)+-[0-9]$/),roleArn:d.string().regex(/^arn:aws(-[a-z]+)*:iam::[0-9]{12}:role\/[\w+=,.@/-]{1,512}$/)}).strict().nullable()}).strict(),M_e=d.object({schemaVersion:d.literal(1),attempt:d.object({id:Mn,number:d.number().int().positive(),deadlineAt:d.string().datetime()}).strict(),manifest:Qpe,manifestHash:tr,entitlements:d.array(d.string()).optional(),runToken:d.string().min(1).optional(),requestedBy:_pe.nullable().optional(),writeAllowed:d.boolean().optional(),claudeCodeVersion:d.string().regex(/^[0-9]+\.[0-9]+\.[0-9]+$/,"an exact version, such as 2.1.290").nullable().optional(),deployedRevisions:d.array(d.object({repository:Hr,revision:ys}).strict()).optional(),statedRevisions:d.array(d.object({repository:Hr,revision:ys}).strict()).optional(),runSettings:Dpe.optional()}).strict(),Cz={providerRunAttempt:d.number().int().positive(),workflowRef:d.string().min(1)},Npe=d.string().regex(/^[^/]+\/[^/]+\/[1-9][0-9]{0,15}\/[1-9][0-9]{0,15}$/),L_e=d.object({schemaVersion:d.literal(1),runId:Mn,execution:d.discriminatedUnion("provider",[d.object({...Cz,provider:d.literal("github"),repository:d.object(FE).strict(),providerRunId:As}).strict(),d.object({...Cz,provider:d.literal("azure-devops"),repository:d.object(ME).strict(),providerRunId:Npe}).strict()]),requester:d.literal(!0).optional(),writeCheck:d.literal(!0).optional(),claudeCodePin:d.literal(!0).optional(),deployedPins:d.literal(!0).optional(),statedPins:d.literal(!0).optional(),runSettings:d.literal(!0).optional(),credentialKinds:d.literal(!0).optional()}).strict(),Sz=d.object({repository:Hr,number:As,commitSha:ys.optional()}).strict(),$E=d.array(d.object({repository:Hr,reason:d.string().max(4096).regex(/\S/)}).strict()).max(1e3).optional(),Oz=d.object({branch:tB.optional(),commitSha:ys.optional()}).strict(),lB=4096,Uz=d.array(d.object({file:d.string().max(4096).regex(/\S/),dependsOn:d.array(d.string().max(2048).regex(/\S/)).max(100)}).strict()).min(1).max(500),kz=d.object({repository:Hr,message:d.string().max(lB),...Oz.shape,heldBack:Uz.optional()}).strict(),Ppe=d.discriminatedUnion("status",[d.object({status:d.literal("none"),noTests:$E}).strict(),d.object({status:d.literal("delivered"),noTests:$E,pullRequests:d.array(Sz).min(1)}).strict(),d.object({status:d.literal("partial"),noTests:$E,pullRequests:d.array(Sz).min(1),failures:d.array(kz).min(1)}).strict(),d.object({status:d.literal("failed"),message:d.string().max(lB),noTests:$E,failures:d.array(kz).min(1).optional()}).strict()]),dB=1024*1024,Fz=16*1024*1024,gh={id:4096,text:16384,businessCase:65536},Mz={id:gh.id,statement:gh.text,rows:1e3},Rz=d.string().min(1).max(gh.id),QE=d.string().max(gh.text),TE=(e,t)=>d.array(d.object({[e]:QE}).strict()).max(t).optional(),Lz=d.object({language:d.custom(e=>e==="ja","Invalid"),businessCaseAnalysis:d.string().max(gh.businessCase),validation:d.object({rationale:QE.min(1),gaps:d.array(d.string().min(1).max(4096)).max(200)}).strict().optional(),changes:d.array(d.object({id:Rz,text:QE}).strict()).max(1e3).optional(),requirements:d.array(d.object({id:Rz,statement:QE}).strict()).max(Mz.rows).optional(),issuesFound:TE("description",5e3),newTestsCreated:TE("description",5e3),testResults:TE("details",5e3),caveats:TE("text",100)}).strict(),Ope=d.object({blockedPreflight:d.object({file:d.string().min(1),repository:d.string().min(1).optional(),reason:d.string().min(1).max(300),evidence:d.string().min(1).max(400)}).strict().optional(),sufficiency:d.nativeEnum(bi),rationale:d.string().min(1),gaps:d.array(d.string().min(1)),acceptedEvidence:d.array(d.object({kind:d.nativeEnum(ua),repository:d.string().min(1),revision:ys,reference:d.string().min(1),summary:d.string().min(1)}).strict()),actionRequired:d.array(d.nativeEnum(ca))}).strict().superRefine((e,t)=>{e.sufficiency==="insufficient"!=e.gaps.length>0&&t.addIssue({code:d.ZodIssueCode.custom,path:["gaps"],message:"only insufficient evidence names gaps, and it names at least one"}),new Set(e.actionRequired).size!==e.actionRequired.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["actionRequired"],message:"a reason appears twice"})}),_E=500,jz=2048,Vz=1e3,Upe=/[\\/:*?"<>|;#$*{},+=[\]%\p{Cc}\p{Cf}]/u,Bz=e=>e.length>0&&e.length<=64&&e===e.trim()&&!Upe.test(e)&&!/[^\S ]/u.test(e)&&!/^[._]/.test(e)&&!e.endsWith("."),Gz=e=>{if(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/.test(e))return!0;let[t,n,s,...r]=e.split("/");return e.length<=201&&r.length===0&&s!==void 0&&/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,48}[A-Za-z0-9])?$/.test(t)&&Bz(n)&&Bz(s)},Fpe=d.object({testResults:d.array(d.object({resultId:d.string().regex(/^[^\u0000-\u001f]{1,512}$/),repository:d.string().refine(Gz,"Invalid"),testType:d.string(),runtimeTargets:lh.optional(),endpoint:d.string(),status:d.enum(["Pass","Fail","Skipped"]),details:d.string(),fileName:d.string().optional(),testId:d.string().regex(/^[^\u0000-\u001f]{1,512}$/).optional(),failureCause:d.object({kind:d.nativeEnum(sh),family:d.nativeEnum(ih).optional()}).strict().optional(),origin:d.nativeEnum(CE).optional()}).strict()),validation:Ope,changes:d.array(d.object({id:d.string().min(1).max(512),text:d.string().max(16384),source:d.string().max(jz),testedBy:d.array(d.string().min(1).max(1024)).max(_E),writtenBy:d.array(d.string().min(1).max(1024)).max(_E),maintainedBy:d.array(d.string().min(1).max(1024)).max(_E)}).strict()).max(Vz).optional(),traceVersion:d.literal(1),display:Lz.optional()}).passthrough().superRefine((e,t)=>{let n=e.display,s={issuesFound:e.issuesFound,newTestsCreated:e.newTestsCreated,testResults:e.testResults,caveats:e.caveats};for(let i of["issuesFound","newTestsCreated","testResults","caveats"]){let o=n?.[i];o&&o.length!==(Array.isArray(s[i])?s[i].length:0)&&t.addIssue({code:d.ZodIssueCode.custom,path:["display",i],message:`has not one row per ${i} row`})}n?.validation&&n.validation.gaps.length!==e.validation.gaps.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["display","validation","gaps"],message:"has not one gap per validation gap"});let r=new Set;e.testResults.forEach((i,o)=>{let a=i.failureCause;a&&i.status==="Pass"&&t.addIssue({code:d.ZodIssueCode.custom,path:["testResults",o,"failureCause"],message:"a passing result has no failure cause"}),a&&a.kind==="environment"!=(a.family!==void 0)&&t.addIssue({code:d.ZodIssueCode.custom,path:["testResults",o,"failureCause"],message:"an environment cause names its family, and no other cause does"});let c=["testResults",o,"resultId"],u=i.resultId.slice(`${i.repository}:${i.testType}:`.length);(!i.resultId.startsWith(`${i.repository}:${i.testType}:`)||u===""||u.startsWith("/")||u.startsWith("#"))&&t.addIssue({code:d.ZodIssueCode.custom,path:c,message:"is not repository:testType:path for this result"}),r.has(i.resultId)&&t.addIssue({code:d.ZodIssueCode.custom,path:c,message:"stable identity repeated"}),r.add(i.resultId)})});var LE=50,jE=d.discriminatedUnion("kind",[d.object({kind:d.literal("branch_pushed"),repository:Hr,branch:tB,commit:ys}).strict(),d.object({kind:d.enum(["pull_request_opened","pull_request_edited"]),repository:Hr,number:As,branch:tB}).strict()]),pB=100,Mpe=2048,zz=d.object({records:d.array(d.string().regex(/^https?:\/\/[^\s/?#@]+(\/[^\s?#]*)?$/).max(Mpe)).max(pB),unlisted:d.number().int().nonnegative()}).strict().refine(e=>e.records.length+e.unlisted>0,"names at least one create"),Lpe=d.object({schemaVersion:d.literal(1),run:d.object({runId:Mn,attemptNumber:d.number().int().positive(),manifestHash:tr}).strict(),target:DE,policy:DE,provenance:d.object({sources:d.array(d.object({repository:Hr,revision:ys}).strict()),firstQualification:d.literal(!0).optional()}).strict(),delivery:d.object({generatedTests:Ppe}).strict(),producer:d.object({testbot:d.string().regex(/^[0-9A-Za-z.+-]{1,64}$/),mcp:d.string().regex(/^[0-9A-Za-z.+-]{1,64}$/)}).strict(),report:Fpe,githubWrites:d.array(jE).max(LE).optional()}).strict(),VE=(r=>(r.Recipe="recipe",r.CredentialRejected="credential_rejected",r.Environment="environment",r.Unknown="unknown",r))(VE||{}),fB=200,jpe=d.object({cause:d.nativeEnum(VE),credential:d.string().regex(Gr).optional(),reason:d.string().trim().min(1).max(fB).optional()}).strict().refine(e=>e.cause==="credential_rejected"==(e.credential!==void 0&&e.reason!==void 0),{message:"a credential_rejected check, and only one, names the credential and why"}),Vpe=d.object({name:d.string().regex(Gr),purpose:d.enum(["sut_access","other"]),required:d.boolean(),how:d.string().trim().min(1).max(yE)}).strict(),j_e=Lpe.pick({schemaVersion:!0,run:!0,target:!0,provenance:!0,producer:!0}).extend({recipe:VR,check:jpe.optional(),inputs:d.array(Vpe).min(1).max(50).optional()}).strict().superRefine(({recipe:e},t)=>{let n=(i,o)=>t.addIssue({code:d.ZodIssueCode.custom,path:["recipe",...i],message:o});e.status==="blocked"&&e.blockers.length===0&&n(["blockers"],"a blocked recipe names at least one blocker");let s=new Set,r=0;e.files.forEach((i,o)=>{Xf(i.path)||n(["files",o,"path"],"is not a file under .skyramp/sut/, or the .skyramp/workspace.yml a recipe stored before SKYR-5829 carries"),s.has(i.path)&&n(["files",o,"path"],"file repeated"),s.add(i.path),FR.test(i.content)&&n(["files",o,"content"],"is not text");let a=Buffer.byteLength(i.content,"utf8");r+=a,a>Yf&&n(["files",o,"content"],`larger than ${Yf} bytes`)}),r>Zf&&n(["files"],`recipe text over ${Zf} bytes in total`)}),V_e=d.object({components:d.array(d.object({name:d.string().min(1),repository:d.string().refine(Gz,"Invalid"),observedRevision:d.string().regex(/^[0-9a-f]{7,64}$/).nullable(),source:d.nativeEnum(SE),evidence:d.string()}).strict().refine(e=>e.source!=="agent"||e.observedRevision===null,{path:["observedRevision"],message:"a component only an agent session can read names no revision"}))}).strict();var Gpe=d.object({schemaVersion:d.literal(1),stage:d.nativeEnum(iB),event:d.nativeEnum(Eh),status:d.nativeEnum(oB).optional()}).strict().refine(e=>e.status===void 0||e.event==="finished",{path:["status"],message:"only a finished stage has a status"}),sd=100,hB=5e3,la=2e3,nB=100,gB=/^[A-Za-z0-9_-]{1,64}$/,qz=20,Hz=200,Jz=100,Wz=100,zpe=200,xz="[^/\\s](?:(?:[^/\\s]| )*[^/\\s])?",qpe=new RegExp(`^(?:[^/\\s]+/[^/\\s]+|[^/\\s]+/${xz}/${xz})$`),Yz=500,rB=50,Zz=10,Kz=/^[A-Za-z0-9](?:[A-Za-z0-9 _-]{0,48}[A-Za-z0-9])?$/,id=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/,qr=e=>d.string().max(e).refine(t=>t.trim().length>0&&!id.test(t),"blank, or not text"),Ii={sequence:d.number().int().min(1).max(hB),at:d.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?Z$/)},Xz=d.object({...Ii,kind:d.literal("reply"),to:d.string().uuid(),outcome:d.nativeEnum(UE),accepted:d.boolean(),text:qr(la),note:d.object({source:d.enum(["target","environment"]),quote:qr(la)}).strict().optional(),kept:qr(la).optional()}).strict();function eq(e,t){if(e.kind!=="reply")return;let n=e;n.accepted!==(n.outcome==="answered"||n.outcome==="followed")&&t.addIssue({code:d.ZodIssueCode.custom,path:["accepted"],message:"accepted exactly when answered or followed"}),n.note&&n.outcome!=="not_followed"&&t.addIssue({code:d.ZodIssueCode.custom,path:["note"],message:"a note only when not_followed"}),n.kept&&n.outcome!=="followed"&&t.addIssue({code:d.ZodIssueCode.custom,path:["kept"],message:"kept only when followed"})}var tq=d.discriminatedUnion("kind",[d.object({...Ii,kind:d.literal("log"),phase:d.nativeEnum(vh),text:qr(la)}).strict(),d.object({...Ii,kind:d.literal("component"),name:qr(nB),repository:qr(zpe).refine(e=>qpe.test(e)||e===br,"not owner/name"),file:qr(Yz).nullable(),status:d.nativeEnum(bh),version:qr(Wz).optional()}).strict(),Xz,d.object({...Ii,kind:d.literal("question"),id:d.string().regex(gB),type:d.nativeEnum(aB),text:qr(la),component:qr(nB).nullable(),choices:d.array(qr(Hz)).max(qz),placeholder:qr(Jz).optional()}).strict(),d.object({...Ii,kind:d.literal("delivered"),ids:d.array(d.string().uuid()).max(sd)}).strict(),d.object({...Ii,kind:d.literal("credentials"),names:d.array(d.string().regex(Gr)).min(1).max(rB),logins:d.array(d.object({key:d.string().regex(Kz),usernameVariable:d.string().regex(Gr),passwordVariable:d.string().regex(Gr)}).strict()).min(1).max(Zz).optional(),variables:d.array(d.string().regex(Gr)).min(1).max(rB).optional()}).strict()]).superRefine((e,t)=>{if(eq(e,t),e.kind==="credentials"&&new Set(e.names).size!==e.names.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["names"],message:"a name twice"}),e.kind==="credentials"&&e.logins){let n=e.logins.map(s=>BR(s.key));new Set(n).size!==n.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["logins"],message:"a key twice"}),e.logins.forEach((s,r)=>{for(let i of["usernameVariable","passwordVariable"])e.names.includes(s[i])||t.addIssue({code:d.ZodIssueCode.custom,path:["logins",r,i],message:"not one of the names"})})}e.kind==="credentials"&&e.variables&&(new Set(e.variables).size!==e.variables.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["variables"],message:"a name twice"}),e.variables.forEach((n,s)=>{e.names.includes(n)||t.addIssue({code:d.ZodIssueCode.custom,path:["variables",s],message:"not one of the names"})})),e.kind==="question"&&(e.type==="free_text"!=(e.choices.length===0)&&t.addIssue({code:d.ZodIssueCode.custom,path:["choices"],message:"choices exactly when the question is not free_text"}),new Set(e.choices).size!==e.choices.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["choices"],message:"a choice twice"}))}),Hpe=d.object({schemaVersion:d.literal(1),events:d.array(tq).max(sd)}).strict(),nq=d.discriminatedUnion("kind",[d.object({...Ii,kind:d.literal("log"),stage:d.nativeEnum(hh),text:qr(la)}).strict(),Xz,d.object({...Ii,kind:d.literal("delivered"),ids:d.array(d.string().uuid()).max(sd)}).strict(),d.object({...Ii,kind:d.literal("stage"),stage:d.nativeEnum(hh),event:d.nativeEnum(Eh)}).strict(),d.object({...Ii,kind:d.literal("test"),resultId:d.string().regex(/^[^\u0000-\u001f]{1,512}$/),status:d.enum(["Pass","Fail","Skipped"]),details:d.string().max(la).refine(e=>!id.test(e),"not text")}).strict()]).superRefine(eq),Jpe=d.object({schemaVersion:d.literal(1),events:d.array(nq).max(sd)}).strict(),$z={id:d.string().uuid(),text:d.string(),by:d.string().nullable(),at:d.string(),replied:d.literal(!0).optional()},rq=d.discriminatedUnion("kind",[d.object({...$z,kind:d.literal("instruction"),question:d.null()}),d.object({...$z,kind:d.literal("answer"),question:d.string().regex(gB)})]),sq=d.string().regex(/^[A-Za-z0-9+/]{43}=$/),Wpe=d.object({id:d.string().uuid(),revision:d.string(),by:d.string().nullable(),at:d.string(),target:d.string(),own:d.object({source:d.enum(["policy","test_environment"]),text:d.string()}).nullable()}),Ype=d.object({schemaVersion:d.literal(1),leftOut:d.array(d.string()),messages:d.array(rq).optional(),stop:d.object({key:sq}).optional(),notes:Wpe.optional()}),Zpe=d.object({schemaVersion:d.literal(1),messages:d.array(rq).optional()});var iq=500*1024*1024,oq=d.object({id:As,name:d.string().regex(/^[A-Za-z0-9._-]{1,200}$/),providerRunId:As,expiresAt:d.string().datetime()}).strict(),Kpe=d.object({schemaVersion:d.literal(1),artifact:oq,sessionId:Mn,contentHash:tr,bytes:d.number().int().min(1).max(iq)}).strict(),Xpe=d.object({schemaVersion:d.literal(1),checkpoint:d.object({artifact:oq,repository:d.object({namespace:d.string().min(1),name:d.string().min(1)}).strict(),sessionId:Mn,contentHash:tr,key:sq}).strict().nullable()}).strict(),efe=200,nd=100,mB=(s=>(s.Resume="resume",s.Retry="retry",s.Update="update",s))(mB||{}),tfe=d.object({kind:d.nativeEnum(mB),setup:d.object({runId:Mn,endedAt:d.string().nullable(),outcome:d.string().nullable()}).strict(),components:d.array(d.object({name:d.string().min(1),repository:d.string().min(1),status:d.nativeEnum(bh)}).strict()).max(nd),credentials:d.array(d.string().min(1)).max(nd),answers:d.array(d.object({question:d.string(),answer:d.string().nullable()}).strict()).max(nd),instructions:d.array(d.object({text:d.string(),reply:d.string().nullable()}).strict()).max(nd),log:d.array(d.object({phase:d.nativeEnum(vh),text:d.string()}).strict()).max(efe),recipe:d.object({files:d.array(d.object({path:d.string().min(1),content:d.string()}).strict()).max(nd),blockers:d.array(d.object({component:d.string(),problem:d.string(),evidence:d.string(),fix:d.string()}).strict()).max(nd)}).strict().optional()}).strict(),nfe=d.object({schemaVersion:d.literal(1),context:tfe.nullable()}).strict(),rfe=d.object({schemaVersion:d.literal(1),configuration:d.object({captureId:Mn,revision:As.nullable(),hash:tr}).strict(),capture:d.object({schemaVersion:d.literal(1),settings:d.object({target:d.object({environment:d.unknown()}).passthrough(),timeoutMinutes:d.number().int().positive(),answerWaitMinutes:d.number().int().positive().optional(),testEnvironment:d.object({name:d.string().min(1),address:d.string().min(1).optional(),readyWhen:d.string().min(1).optional(),environmentId:d.string().uuid().optional(),persistentDataPolicy:Qz}).passthrough().optional()}).passthrough(),provenance:d.object({}).passthrough(),hash:tr}).strict()}).strict(),sfe=d.object({schemaVersion:d.literal(1),environmentId:d.string().uuid().nullable(),environmentAddress:d.string().url().nullable(),persistentDataPolicy:xE.nullable()}).strict(),ife=ed.extend({environmentId:d.string().uuid().optional(),persistentDataPolicy:Qz,version:d.number().int().positive(),components:d.array(d.object({name:d.string().min(1),repository:d.string().min(1)}).strict()),contentHash:tr.optional(),files:d.array(d.object({path:d.string().refine(e=>Xf(e)&&!bE.includes(e),"not a file of a customer_deployed plan"),content:d.string()}).strict()).optional()}).strict(),ofe=d.object({schemaVersion:d.literal(1),testEnvironment:ife.nullable().optional(),runtimePlan:d.object({version:d.number().int().positive(),contentHash:tr,files:d.array(d.object({path:d.string().refine(Xf,"not a recipe file path"),content:d.string()}).strict()).min(1),repository:vE.optional(),recipeRepository:vE.optional(),recipe:d.record(d.unknown()).optional()}).strict().nullable()}).strict().refine(e=>!(e.runtimePlan&&e.testEnvironment),{message:"a run pins a recipe or a customer's Test Environment, never both",path:["testEnvironment"]}),afe=d.object({schemaVersion:d.literal(1),state:d.nativeEnum(_z),ending:d.nativeEnum(PE).nullable(),cause:d.nativeEnum(OE).nullable(),deadlineAt:d.string().datetime()}).strict();var aq=50,cq=d.object({repository:Hr,revisions:d.array(d.number().int().nonnegative()).min(1).max(2).refine(e=>e.length<2||e[0]<e[1],"two revisions name the earlier first"),files:d.array(d.string().min(1)).min(1).max(aq)}).strict();var cfe=e=>({provider:e.provider,providerAccountId:e.providerAccountId,providerRepositoryId:e.providerRepositoryId});function uq(e){if(e.reportUploaded)return{schemaVersion:1,reason:"report_uploaded",cause:null};if(e.recipeUploaded)return{schemaVersion:1,reason:"recipe_uploaded",cause:null};if(e.revisionsUploaded)return{schemaVersion:1,reason:"revisions_uploaded",cause:null};let t=e.githubWrites?.length?{githubWrites:e.githubWrites.map(n=>({...n,repository:cfe(n.repository)}))}:{};return e.cancelled?{schemaVersion:1,reason:"cancelled",cause:null,...t,...e.sharedEnvironmentRecords?{sharedEnvironmentRecords:e.sharedEnvironmentRecords}:{}}:e.mergeConflict&&Tz(e)==="merge_conflict"?{schemaVersion:1,reason:"no_report",cause:"merge_conflict",conflict:e.mergeConflict,...t}:{schemaVersion:1,reason:"no_report",cause:Tz({...e,mergeConflict:void 0}),...t}}function Tz(e){return e.runnerProviderNotReady?"runner_provider_not_ready":e.credentialMissing?"credential_missing":e.mergeConflict?"merge_conflict":e.checkoutFailed?"checkout_failed":e.environmentUnverified?"environment_unverified":e.setupFailed?"setup_failed":e.timedOut?"timed_out":e.modelProviderDenied?"model_provider_denied":e.modelProviderUnavailable?"model_provider_unavailable":e.environmentUnavailable?"environment_unavailable":"agent_failed"}var AB=G(require("path"));var od=G(require("fs")),ao=G(require("path"));var ufe=8;function An(e,t,n={}){let s=t.slice(0,ufe),r=t.length-s.length;return{name:e,passed:!1,details:s.join("; ")+(r>0?`; \u2026and ${r} more`:""),...n.fatal?{fatal:!0}:{}}}function Vs(e){if(od.existsSync(e))try{return JSON.parse(od.readFileSync(e,"utf-8"))}catch{return}}function Ae(e,t){return Vs(ao.join(e.outputsDir,t))}function Ln(e,t,n,s){if(!n)throw new Error(`${t}.json unexpectedly invalid at artifact time: ${s[0]}`);let r=ao.join(e.outputsDir,`${t}.json`);return od.writeFileSync(r,JSON.stringify(n,null,2)+`
|
|
140
|
+
`);return{baseRef:n,diffContent:o,diffStat:a,...hpe(o)}}function IE(e,t){if(!JR(e))return;let n=td(e,t);if(!n)return;let s=Kn(e,["rev-parse","--abbrev-ref","HEAD"])??"HEAD",r=new Map,o=Kn(e,["diff","--no-relative","--name-status","-z",`${n}...HEAD`])?.split("\0")??[];for(let l=0;l<o.length-1;){let p=o[l++].charAt(0);(p==="R"||p==="C")&&l++;let h=o[l++];h&&r.set(h,p)}let c=Kn(e,["status","--porcelain","-z",...qR])?.split("\0")??[];for(let l=0;l<c.length-1;){let p=c[l++],h=p.slice(0,2),g=p.slice(3);/[RC]/.test(h)&&l++,g&&r.set(g,h==="??"?"A":h.trim().charAt(0)||"M")}let u=[...r.entries()].map(([l,p])=>({path:l,status:p})).sort((l,p)=>l.path.localeCompare(p.path));return{currentBranch:s,baseBranch:n,changedFiles:u}}var Z9=G(require("path"));On();var cz=G(require("fs")),uz=G(require("path"));function so(e=__dirname){try{let t=cz.readFileSync(uz.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"}}On();var Kc=(i=>(i.NotFound="not_found",i.NoAccess="no_access",i.Unavailable="unavailable",i.AccessLost="access_lost",i.CannotOpen="cannot_open",i))(Kc||{});var YR=e=>`${e.source}:${e.site??""}:${e.key}`;var nh=/^pasted-[0-9a-f]{16}$/,io=/^file-[0-9a-f]{16}$/,rh=(r=>(r.Pdf="application/pdf",r.Csv="text/csv",r.Docx="application/vnd.openxmlformats-officedocument.wordprocessingml.document",r.Xlsx="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",r))(rh||{}),Xc=e=>e.trim().toUpperCase(),lz=(e,t)=>{let n=e.trim();return nh.test(n.toLowerCase())?"Pasted text":io.test(n.toLowerCase())?t?.get(Xc(n))??"Uploaded document":/^\d+$/.test(n)?`Confluence page ${n}`:n.toUpperCase()};var CE=(s=>(s.New="new",s.Updated="updated",s.Existing="existing",s))(CE||{}),bi=(s=>(s.Sufficient="sufficient",s.Insufficient="insufficient",s.NoChange="no_change",s))(bi||{}),ca=(E=>(E.RelatedChangeConflict="related_change_conflict",E.ReferenceOutsideTarget="reference_outside_target",E.SourceAccessLost="source_access_lost",E.ConfigurationIncomplete="configuration_incomplete",E.CredentialUnavailable="credential_unavailable",E.WorkflowBindingUnverified="workflow_binding_unverified",E.WorkflowRefUnprotected="workflow_ref_unprotected",E.BedrockWorkflowRequired="bedrock_workflow_required",E.DeploymentReview="deployment_review",E.SutRevisionMismatch="sut_revision_mismatch",E.IsolationUnavailable="isolation_unavailable",E.EvidenceInsufficient="evidence_insufficient",E.ConfigurationUnresolved="configuration_unresolved",E.ModelProviderDenied="model_provider_denied",E.ModelProviderUnavailable="model_provider_unavailable",E.RunnerProviderNotReady="runner_provider_not_ready",E.MergeConflict="merge_conflict",E))(ca||{}),ua=(i=>(i.CiCheck="ci_check",i.TestReport="test_report",i.StaticAnalysis="static_analysis",i.CodeReview="code_review",i.Other="other",i))(ua||{}),sh=(s=>(s.Application="application",s.Environment="environment",s.TestDefect="test_defect",s))(sh||{}),ih=(a=>(a.AuthToken="auth_token",a.Secret="secret",a.DataConnection="data_connection",a.AppNotStarted="app_not_started",a.Login="login",a.ExternalDependency="external_dependency",a.RecordingReplay="recording_replay",a))(ih||{});var SE=(n=>(n.Probe="probe",n.Agent="agent",n))(SE||{}),oh=(s=>(s.Seed="seed",s.RuntimeMock="runtime_mock",s.EnvOverride="env_override",s))(oh||{}),kE=(s=>(s.TestCode="test_code",s.SkyrampMocker="skyramp_mocker",s.RecipeOverride="recipe_override",s))(kE||{});var mn=e=>e.slice(0,12);var mpe=["generate-unit","native-run"],b_e=["preflight","plan","write",...mpe,"report","deliver"];var RE=(s=>(s.Unit="unit",s.Integration="integration",s.E2e="e2e",s))(RE||{}),Ape=Object.values(RE);var ch=(n=>(n.Skyramp="skyramp",n.Llm="llm",n))(ch||{}),wi=d.string().trim().min(1),ype=d.object({case:wi.describe("recommend id this assertion enforces"),evidence:wi.describe("the exact assertion line from the file that checks that case's observable")});var dz=d.object({route:d.literal("persistence"),url:d.string().url()}).strict(),uh=d.object({kind:d.nativeEnum(oh).describe("seed: data the test creates in the app; runtime_mock: a mock on a Skyramp worker, which other tests reach too; env_override: an env value the app runs with. A stub inside the test's own process, such as a browser page's route, is none of these"),target:wi.describe("the dependency, endpoint or data it affects"),mechanism:d.nativeEnum(kE).describe("test_code: the test applies and undoes it; skyramp_mocker: a mock the test applies on a Skyramp worker; recipe_override: the mocker cannot reach the dependency (its URL is fixed in the build)"),detail:wi.describe("what it sets up"),worker:wi.optional().describe("skyramp_mocker: host:port of the worker the test applies the mock to (default localhost:35142)"),safety:dz.optional().describe("shared seed that keeps its data only because the environment permits it: the persistence route and the exact endpoint; Testbot checks the current permission just before it runs the test"),cleanup:wi.optional().describe("seed: when its data can be removed, a command that removes it if the test does not; otherwise declare leftBehind instead. Run as written and without a shell: give real values, not a placeholder such as <id>, single-quote an argument that holds shell syntax, or put the logic in a script in the repository and run that"),leftBehind:wi.optional().describe("seed: the records the test creates and cannot remove from the app, and how to find them")}).refine(e=>!e.leftBehind||e.kind==="seed",{message:"leftBehind is for a seed only: a runtime mock or an env override creates no records",path:["leftBehind"]}),Epe=d.object({file:wi.describe("staged path under .skyramp/staged/"),source:d.nativeEnum(ch),language:wi,covers:d.array(d.string()).min(1,"must be a non-empty array of recommend ids").describe("recommend ids this test covers"),assertions:d.array(ype).min(1,"must be a non-empty array").describe("one per case covered, citing the real line"),context:d.array(uh).optional().describe("what the test sets up against the running app, in order: data it seeds, Skyramp mocks it applies, env overrides; omit when none")}),ZR=d.object({schemaVersion:d.literal(1),tests:d.array(Epe),deferredUi:d.array(d.string()).describe("recommend ui ids left for the UI stage (generate) \u2014 [] for generate-ui"),summary:wi.describe("one paragraph")});var oo=(o=>(o.Place="place",o.Update="update",o.Regenerate="regenerate",o.Delete="delete",o.Verify="verify",o.None="none",o))(oo||{}),er=(s=>(s.Pass="pass",s.Fail="fail",s.Skip="skip",s))(er||{}),Xn=d.string().trim().min(1),KR=(r=>(r.Setup="setup",r.Expectation="expectation",r.Locator="locator",r.Other="other",r))(KR||{}),BE=d.object({kind:d.nativeEnum(KR),reason:Xn.describe("what in the test is wrong, with the evidence: the setup error it raised, or the requirement or changed line its expectation contradicts")}),lh=d.array(d.string().url().max(2048).regex(/^https?:\/\//i)).max(50),pz=d.object({case:Xn.describe("a covers id \u2014 the recommend case this test realizes"),status:d.nativeEnum(er),runtimeTargets:lh.optional().describe("HTTP(S) URLs this case actually exercised in its current run; omit for in-process or mocked checks, never infer from test type"),environmentRestriction:Xn.optional().describe("for a skipped case: what this run lacks to execute it; the test is still written"),fromJourney:d.boolean().optional(),testProblem:BE.optional().describe("[derived] write's reading of a failing case: the test, not the app, is at fault"),defect:d.boolean().optional().describe("[derived] write's reading of a failing case: true when the app is wrong and the test is right"),failure:d.string().optional().describe("[derived] for a failing case: the runner's failure for it, as printed")}).refine(e=>!e.environmentRestriction||e.status==="skip"&&!e.runtimeTargets?.length,{message:"an environment-restricted case must be skipped and have no runtimeTargets"}),fz=d.object({started:d.boolean().optional().describe("with exit null: true if the 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({invalid_type_error:"must be a number or null"}).nullable().describe("process exit of the re-run; null when no SUT was available"),details:d.string().optional().describe("what failed, or why a file was not run \u2014 required on any non-zero exit"),tests:d.array(pz).optional().describe("ONE ENTRY PER CASE the file covers, its own result; must agree with exit (0 \u2192 no fail; non-zero \u2192 at least one, or the non-test reason in details). The report reads the file by these where they are given")}),hz=d.object({context:d.array(uh).optional().describe("[derived] setup declarations retained for every executed test, including maintained tests"),from:d.string().optional().describe("staged path \u2014 required for placements"),file:Xn.describe("final path relative to its repository, inside that checkout, with a source-file extension"),repository:Xn.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),action:d.nativeEnum(oo),covers:d.array(d.string()).optional().describe("recommend ids a placed test covers"),repro:d.boolean().optional().describe("this test is MEANT to fail \u2014 it reproduces a reported bug"),finding:d.boolean().optional().describe("a non-repro test that failed on a REAL product bug"),placementBroken:d.boolean().optional().describe('placement/harness problem one repair could not fix \u2014 every reran.tests entry is then "skip"'),keptReason:Xn.optional().describe("why a planned delete/regenerate was declined and the file kept"),isolatedRun:Xn.optional().describe('only for a test marked "runs alone": the command, from its checkout root and without a shell, that runs only this file and writes its JUnit XML into $SKYRAMP_RESULTS_DIR (named by its path: no shell expands it) \u2014 the harness runs it, so leave reran.exit null'),reran:fz,assertionCount:d.number().int().nonnegative().optional().describe("[derived] assertions reachable from the file, counted at write time"),addedOnly:d.boolean().optional().describe("[derived] an existing test file the run only added to: every line it had is still there"),added:d.array(Xn).optional().describe("[derived] the cases of the test functions the run added to an existing file: functions it did not have"),staleOnBase:d.boolean().optional().describe("[derived] an existing test that fails the same way on the base branch: its failure is the test's own")}).refine(e=>e.action!=="place"||typeof e.from=="string"&&e.from.trim().length>0,{message:'is a place but has no "from" staged path',path:[]}),gz=(n=>(n.Junit="junit",n.Converter="converter",n))(gz||{}),vpe=Xn.optional().describe("the items[].file this test is in \u2014 needed only when two of this suite's files cover the same case id"),bpe=d.object({results:Xn.describe("the JUnit XML file this run wrote, a plain file name inside $SKYRAMP_RESULTS_DIR (e.g. backend.xml)"),source:d.nativeEnum(gz),run:Xn.describe("the command you ran that wrote it, exactly as you ran it (with any converter)"),files:d.array(Xn).min(1).describe("the items[].file paths this run covered"),cases:d.array(d.object({test:Xn.describe("the test's name as the runner reports it, qualified by its class or file (e.g. tests/test_a.py::test_x) when the bare name repeats"),case:Xn.describe("the covers id it realizes"),file:vpe})).describe("map each reported test name to the case it covers")}),wpe=d.object({suites:d.array(bpe).min(1)}),XR=d.object({schemaVersion:d.literal(1),items:d.array(hz),runnerResults:wpe.optional().describe("the JUnit XML your test runs wrote into $SKYRAMP_RESULTS_DIR, so the harness reads each test's result from the runner \u2014 omit only when no SUT is available"),ignored:d.array(d.string()).describe("existing tests assessed and deliberately left untouched"),summary:Xn.describe("one paragraph")});var dh=d.string().uuid(),xE=d.object({environmentId:d.string().uuid(),allowed:d.boolean(),revision:dh,updatedAt:d.string().datetime(),updatedBy:d.string().uuid()}).strict();var ph=(o=>(o.NoEnvironment="no_environment",o.NoRecordedGrant="no_recorded_grant",o.Unavailable="unavailable",o.Changed="changed",o.Denied="denied",o.OutOfScope="out_of_scope",o))(ph||{});function fh(e){switch(e){case"no_environment":return"the run has no selected Test Environment address";case"no_recorded_grant":return"the run's configuration did not record permission to keep test data in this environment";case"unavailable":return"the current permission to keep test data could not be read";case"changed":return"the permission to keep test data changed after the run started";case"denied":return"the environment does not permit test data to stay";case"out_of_scope":return"the request is outside the environment's address"}}function tu(e,t){try{let n=new URL(t),s=new URL(e);if(s.search||s.hash)return!1;let r=/%(?:2f|5c|2e|25)/i;if(t.includes("\\")||e.includes("\\")||r.test(n.pathname)||r.test(s.pathname))return!1;let i=s.pathname.replace(/\/$/,"");return["https:","http:"].includes(s.protocol)&&n.origin===s.origin&&(n.pathname===i||n.pathname.startsWith(`${i}/`))}catch{return!1}}var eB="delivery-persistence.json",mz=d.object({environmentId:d.string().uuid(),environmentAddress:d.string().url(),revision:dh}).strict(),Az=d.object({refusal:d.nativeEnum(ph)}).strict();var Qz=d.unknown().optional();var mh=(n=>(n.GitHub="github",n.AzureDevOps="azure-devops",n))(mh||{}),Ah=(i=>(i.Trigger="TRIGGER",i.Baseline="BASELINE",i.AuthoritativeRelatedChange="AUTHORITATIVE_RELATED_CHANGE",i.ConfiguredSharedDependency="CONFIGURED_SHARED_DEPENDENCY",i.ManualOverride="MANUAL_OVERRIDE",i))(Ah||{}),yh=(o=>(o.PullRequest="pull_request",o.ReadyForReview="ready_for_review",o.Schedule="schedule",o.Manual="manual",o.SutSetup="sut_setup",o.RevisionRead="revision_read",o))(yh||{}),Ipe=["sut_setup"],Cpe=["sut_setup","schedule","revision_read"];var NE=(t=>(t.PullRequest="pull_request",t))(NE||{}),sB=(n=>(n.PullRequest="pull_request",n.Branch="branch",n))(sB||{}),yz=["TRIGGER","AUTHORITATIVE_RELATED_CHANGE","MANUAL_OVERRIDE"];var PE=(i=>(i.ReportUploaded="report_uploaded",i.NoReport="no_report",i.Cancelled="cancelled",i.RecipeUploaded="recipe_uploaded",i.RevisionsUploaded="revisions_uploaded",i))(PE||{}),_z=(n=>(n.Running="running",n.Ended="ended",n))(_z||{}),OE=(h=>(h.TimedOut="timed_out",h.AgentFailed="agent_failed",h.SetupFailed="setup_failed",h.CredentialMissing="credential_missing",h.RunnerLost="runner_lost",h.CheckoutFailed="checkout_failed",h.EnvironmentUnverified="environment_unverified",h.ModelProviderDenied="model_provider_denied",h.ModelProviderUnavailable="model_provider_unavailable",h.RunnerProviderNotReady="runner_provider_not_ready",h.MergeConflict="merge_conflict",h.EnvironmentUnavailable="environment_unavailable",h))(OE||{}),iB=(s=>(s.Onboard="onboard",s.Deploy="deploy",s.Recheck="recheck",s))(iB||{}),Eh=(n=>(n.Started="started",n.Finished="finished",n))(Eh||{}),oB=(s=>(s.Passed="passed",s.Failed="failed",s.Skipped="skipped",s))(oB||{});var aB=(s=>(s.ChooseCredential="choose_credential",s.FreeText="free_text",s.ChooseSource="choose_source",s))(aB||{});var UE=(r=>(r.Answered="answered",r.Followed="followed",r.NotFollowed="not_followed",r.TooLate="too_late",r))(UE||{}),vh=(s=>(s.Discover="discover",s.Start="start",s.Check="check",s))(vh||{}),hh=(r=>(r.ValidationPlan="validation_plan",r.TestEnvironment="test_environment",r.TestConditions="test_conditions",r.Tests="tests",r))(hh||{});var bh=(r=>(r.Found="found",r.Starting="starting",r.Up="up",r.OutOfScope="out_of_scope",r))(bh||{}),As=d.string().regex(/^[1-9][0-9]{0,18}$/),ys=d.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),tB=d.string().regex(/^(?!.*\.\.)(?!\/)(?!.*\/$)[A-Za-z0-9._/-]{1,255}$/),rd=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;var Mn=d.string().regex(rd),tr=d.string().regex(/^[0-9a-f]{64}$/),DE=d.object({id:Mn,revision:As}).strict(),FE={provider:d.literal("github"),providerAccountId:As,providerRepositoryId:As},ME={provider:d.literal("azure-devops"),providerAccountId:Mn,providerRepositoryId:Mn},Hr=d.discriminatedUnion("provider",[d.object(FE).strict(),d.object(ME).strict()]),cB=d.discriminatedUnion("provider",[d.object(FE).passthrough(),d.object(ME).passthrough()]),nu=e=>`${e.provider}:${e.providerRepositoryId}`,Ez={namespace:d.string().min(1),name:d.string().min(1)},Dz=d.discriminatedUnion("provider",[d.object({...FE,...Ez}).strict(),d.object({...ME,...Ez}).strict()]),vz=d.object({ref:d.string().min(1),revision:ys}).strict(),Spe=d.object({kind:d.nativeEnum(sB),number:As.optional(),ref:d.string().min(1),revision:ys,reason:d.nativeEnum(Ah)}).strict(),kpe=d.object({repository:Dz,revision:ys,ref:d.string().nullable(),reason:d.nativeEnum(Ah),change:d.object({kind:d.nativeEnum(NE),number:As,base:vz.optional()}).strict().nullable(),compareWith:vz.optional(),merge:d.array(Spe).min(2).optional()}).strict();function Rpe(e){let t=e.merge;if(!t)return null;if(e.change||e.compareWith)return{path:["merge"],message:"a merged source names no change and no compareWith"};if(e.ref===null)return{path:["ref"],message:"a merged source names its baseline branch"};let n=new Set,s=new Set;for(let[i,o]of t.entries()){if(o.kind==="pull_request"!=(o.number!==void 0))return{path:["merge",i,"number"],message:"a pull request names its number, and a branch none"};if(!yz.includes(o.reason))return{path:["merge",i,"reason"],message:`${o.reason} does not select a merged revision`};if(o.kind==="branch"&&o.reason!=="MANUAL_OVERRIDE")return{path:["merge",i,"reason"],message:"only a person chooses a branch to merge"};if(o.ref===e.ref)return{path:["merge",i,"ref"],message:"the baseline branch is what the source merges onto"};if(o.number!==void 0&&n.has(o.number)||s.has(o.ref))return{path:["merge",i],message:"names a revision the source already merges"};o.number!==void 0&&n.add(o.number),s.add(o.ref)}let r=yz.find(i=>t.some(o=>o.reason===i));return e.reason!==r?{path:["reason"],message:`a source that merges these revisions is ${r}`}:null}function Bpe(e){if(e.trigger.kind==="revision_read"!=!e.baseline)return e.baseline?"a revision_read run names no baseline":"names its baseline";if(!e.baseline)return null;let{confirmedRunId:t,initialBaselineId:n,comparisonBaselineId:s,sources:r}=e.baseline;if([t,n,s].filter(u=>u!=null).length>1)return"a run compares with one baseline";let i=e.trigger.kind==="schedule"&&t!==null||n!==void 0||s!==void 0;if(!r)return i?"names every source of the snapshot, once":null;if(t===null&&n===void 0&&s===void 0)return"a run with no Confirmed Baseline names no baseline sources";let o=new Set(e.sources.map(u=>nu(u.repository))),a=new Set(r.map(u=>nu(u.repository)));return a.size===r.length&&a.size===o.size&&[...a].every(u=>o.has(u))?null:"names every source of the snapshot, once"}var Nz=/^[A-Z][A-Z0-9_]+-[1-9][0-9]*$/,Pz=/^[1-9][0-9]{0,18}$/,bz=new RegExp(`${Nz.source}|${Pz.source}`),wz=/^https:\/\/[a-z0-9-]+(\.[a-z0-9-]+)+$/,xpe=d.union([d.object({source:d.literal("jira"),site:d.string().regex(wz),key:d.string().regex(Nz),updated:d.string().datetime(),contentHash:tr}).strict(),d.object({source:d.literal("confluence"),site:d.string().regex(wz),key:d.string().regex(Pz),version:d.number().int().positive(),contentHash:tr}).strict(),d.object({source:d.literal("other"),key:d.string().regex(nh),contentHash:tr}).strict(),d.object({source:d.literal("other"),key:d.string().regex(io),contentHash:tr,fileName:d.string().min(1).max(255),mediaType:d.nativeEnum(rh)}).strict()]),Iz=d.union([d.literal("jira"),d.literal("confluence")]),$pe=d.object({schemaVersion:d.literal(1),items:d.array(d.union([d.object({source:Iz,site:d.string(),key:d.string().regex(bz),state:d.literal("read"),text:d.string(),version:d.string().min(1),contentMatches:d.boolean()}).strict(),d.object({source:Iz,site:d.string(),key:d.string().regex(bz),state:d.literal("not_read"),reason:d.nativeEnum(Kc)}).strict(),d.object({source:d.literal("other"),key:d.string().regex(nh),state:d.literal("read"),text:d.string(),version:d.string().min(1),contentMatches:d.boolean()}).strict(),d.object({source:d.literal("other"),key:d.string().regex(nh),state:d.literal("not_read"),reason:d.nativeEnum(Kc)}).strict(),d.object({source:d.literal("other"),key:d.string().regex(io),state:d.literal("read"),version:tr,fileName:d.string().min(1).max(255),mediaType:d.nativeEnum(rh)}).strict(),d.object({source:d.literal("other"),key:d.string().regex(io),state:d.literal("not_read"),reason:d.nativeEnum(Kc)}).strict()])),instructions:d.array(d.string()).optional()}).strict(),Tpe=d.object({resultId:d.string().min(1),repository:d.string().min(1),testType:d.string().min(1),path:d.string(),finding:d.string().min(1)}).strict(),Qpe=d.object({schemaVersion:d.literal(1),runId:Mn,skyrampOrgId:Mn,target:DE,policy:DE.nullable(),trigger:d.object({kind:d.nativeEnum(yh),requestedAt:d.string().datetime()}).strict(),configuration:d.object({captureId:Mn,revision:As.nullable(),hash:tr}).strict(),baseline:d.object({confirmedRunId:Mn.nullable(),initialBaselineId:Mn.optional(),comparisonBaselineId:Mn.optional(),knownFailures:d.array(Tpe).optional(),sources:d.array(d.object({repository:Hr,revision:ys}).strict()).optional()}).strict().optional(),sources:d.array(kpe).min(1).max(1e3),execution:d.object({provider:d.nativeEnum(mh),repository:Dz,workflowPath:d.string(),ref:d.string()}).strict(),credentials:d.array(d.object({name:d.string(),purpose:d.nativeEnum(Zc),required:d.boolean()}).strict()),requirements:d.array(xpe).min(1).optional(),instructions:d.object({contentHash:tr}).strict().optional(),deployedRevisions:d.array(d.object({repository:Hr,revision:ys}).strict()).min(1).optional()}).strict().superRefine((e,t)=>{let n=new Set;(e.requirements??[]).forEach((c,u)=>{let l="fileName"in c?"file":"pasted";c.source==="other"&&c.key!==`${l}-${c.contentHash.slice(0,16)}`&&t.addIssue({code:d.ZodIssueCode.custom,message:"is not the key of its content hash",path:["requirements",u,"key"]});let p=YR({source:c.source,key:c.key});n.has(p)&&t.addIssue({code:d.ZodIssueCode.custom,message:"names an item that the run already names",path:["requirements",u,"key"]}),n.add(p)});let s=e.trigger.kind,r=Ipe.includes(s);r!==(e.policy===null)&&t.addIssue({code:d.ZodIssueCode.custom,path:["policy"],message:r?`a ${s} run has no policy`:"names the policy revision"}),e.baseline?.knownFailures&&!e.baseline.comparisonBaselineId&&t.addIssue({code:d.ZodIssueCode.custom,path:["baseline","knownFailures"],message:"known failures require a chosen comparison checkpoint"});let i=Bpe(e);i&&t.addIssue({code:d.ZodIssueCode.custom,path:e.baseline?["baseline","sources"]:["baseline"],message:i}),Cpe.includes(s)&&e.sources.forEach((c,u)=>{c.reason!=="BASELINE"&&t.addIssue({code:d.ZodIssueCode.custom,path:["sources",u,"reason"],message:`a ${s} run selects only BASELINE sources`})}),e.deployedRevisions&&s!=="manual"&&t.addIssue({code:d.ZodIssueCode.custom,path:["deployedRevisions"],message:"only a manual run pins deployed revisions"});let o=new Set(e.sources.map(c=>nu(c.repository))),a=new Set;(e.deployedRevisions??[]).forEach((c,u)=>{let l=nu(c.repository);o.has(l)?a.has(l)&&t.addIssue({code:d.ZodIssueCode.custom,path:["deployedRevisions",u,"repository"],message:"repository appears twice"}):t.addIssue({code:d.ZodIssueCode.custom,path:["deployedRevisions",u,"repository"],message:"names a repository outside the snapshot"}),a.add(l)}),e.sources.forEach((c,u)=>{c.compareWith&&(c.reason!=="MANUAL_OVERRIDE"||c.change)&&t.addIssue({code:d.ZodIssueCode.custom,path:["sources",u,"compareWith"],message:"only a MANUAL_OVERRIDE source without a change names a revision to compare with"}),e.baseline?.comparisonBaselineId&&(c.change?.base||c.compareWith||c.merge)&&t.addIssue({code:d.ZodIssueCode.custom,path:["sources",u],message:"a chosen checkpoint cannot be combined with a source comparison base or merge"});let l=Rpe(c);l&&t.addIssue({code:d.ZodIssueCode.custom,path:["sources",u,...l.path],message:l.message})})});var uB=(n=>(n.Person="person",n.Policy="policy",n))(uB||{}),_pe=d.object({kind:d.nativeEnum(uB),name:d.string().min(1).max(256)}).strict(),Dpe=d.object({mcp:d.discriminatedUnion("source",[d.object({source:d.literal("npm"),version:d.string().regex(/^[A-Za-z0-9][A-Za-z0-9.+_-]{0,63}$/).nullable()}).strict(),d.object({source:d.literal("github"),ref:d.string().regex(/^[A-Za-z0-9._/-]{1,255}$/)}).strict()]),bedrock:d.object({region:d.string().regex(/^[a-z]{2}(-[a-z]+)+-[0-9]$/),roleArn:d.string().regex(/^arn:aws(-[a-z]+)*:iam::[0-9]{12}:role\/[\w+=,.@/-]{1,512}$/)}).strict().nullable()}).strict(),M_e=d.object({schemaVersion:d.literal(1),attempt:d.object({id:Mn,number:d.number().int().positive(),deadlineAt:d.string().datetime()}).strict(),manifest:Qpe,manifestHash:tr,entitlements:d.array(d.string()).optional(),runToken:d.string().min(1).optional(),requestedBy:_pe.nullable().optional(),writeAllowed:d.boolean().optional(),claudeCodeVersion:d.string().regex(/^[0-9]+\.[0-9]+\.[0-9]+$/,"an exact version, such as 2.1.290").nullable().optional(),deployedRevisions:d.array(d.object({repository:Hr,revision:ys}).strict()).optional(),statedRevisions:d.array(d.object({repository:Hr,revision:ys}).strict()).optional(),runSettings:Dpe.optional()}).strict(),Cz={providerRunAttempt:d.number().int().positive(),workflowRef:d.string().min(1)},Npe=d.string().regex(/^[^/]+\/[^/]+\/[1-9][0-9]{0,15}\/[1-9][0-9]{0,15}$/),L_e=d.object({schemaVersion:d.literal(1),runId:Mn,execution:d.discriminatedUnion("provider",[d.object({...Cz,provider:d.literal("github"),repository:d.object(FE).strict(),providerRunId:As}).strict(),d.object({...Cz,provider:d.literal("azure-devops"),repository:d.object(ME).strict(),providerRunId:Npe}).strict()]),requester:d.literal(!0).optional(),writeCheck:d.literal(!0).optional(),claudeCodePin:d.literal(!0).optional(),deployedPins:d.literal(!0).optional(),statedPins:d.literal(!0).optional(),runSettings:d.literal(!0).optional(),credentialKinds:d.literal(!0).optional()}).strict(),Sz=d.object({repository:Hr,number:As,commitSha:ys.optional()}).strict(),$E=d.array(d.object({repository:Hr,reason:d.string().max(4096).regex(/\S/)}).strict()).max(1e3).optional(),Oz=d.object({branch:tB.optional(),commitSha:ys.optional()}).strict(),lB=4096,Uz=d.array(d.object({file:d.string().max(4096).regex(/\S/),dependsOn:d.array(d.string().max(2048).regex(/\S/)).max(100)}).strict()).min(1).max(500),kz=d.object({repository:Hr,message:d.string().max(lB),...Oz.shape,heldBack:Uz.optional()}).strict(),Ppe=d.discriminatedUnion("status",[d.object({status:d.literal("none"),noTests:$E}).strict(),d.object({status:d.literal("delivered"),noTests:$E,pullRequests:d.array(Sz).min(1)}).strict(),d.object({status:d.literal("partial"),noTests:$E,pullRequests:d.array(Sz).min(1),failures:d.array(kz).min(1)}).strict(),d.object({status:d.literal("failed"),message:d.string().max(lB),noTests:$E,failures:d.array(kz).min(1).optional()}).strict()]),dB=1024*1024,Fz=16*1024*1024,gh={id:4096,text:16384,businessCase:65536},Mz={id:gh.id,statement:gh.text,rows:1e3},Rz=d.string().min(1).max(gh.id),QE=d.string().max(gh.text),TE=(e,t)=>d.array(d.object({[e]:QE}).strict()).max(t).optional(),Lz=d.object({language:d.custom(e=>e==="ja","Invalid"),businessCaseAnalysis:d.string().max(gh.businessCase),validation:d.object({rationale:QE.min(1),gaps:d.array(d.string().min(1).max(4096)).max(200)}).strict().optional(),changes:d.array(d.object({id:Rz,text:QE}).strict()).max(1e3).optional(),requirements:d.array(d.object({id:Rz,statement:QE}).strict()).max(Mz.rows).optional(),issuesFound:TE("description",5e3),newTestsCreated:TE("description",5e3),testResults:TE("details",5e3),caveats:TE("text",100)}).strict(),Ope=d.object({blockedPreflight:d.object({file:d.string().min(1),repository:d.string().min(1).optional(),reason:d.string().min(1).max(300),evidence:d.string().min(1).max(400)}).strict().optional(),sufficiency:d.nativeEnum(bi),rationale:d.string().min(1),gaps:d.array(d.string().min(1)),acceptedEvidence:d.array(d.object({kind:d.nativeEnum(ua),repository:d.string().min(1),revision:ys,reference:d.string().min(1),summary:d.string().min(1)}).strict()),actionRequired:d.array(d.nativeEnum(ca))}).strict().superRefine((e,t)=>{e.sufficiency==="insufficient"!=e.gaps.length>0&&t.addIssue({code:d.ZodIssueCode.custom,path:["gaps"],message:"only insufficient evidence names gaps, and it names at least one"}),new Set(e.actionRequired).size!==e.actionRequired.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["actionRequired"],message:"a reason appears twice"})}),_E=500,jz=2048,Vz=1e3,Upe=/[\\/:*?"<>|;#$*{},+=[\]%\p{Cc}\p{Cf}]/u,Bz=e=>e.length>0&&e.length<=64&&e===e.trim()&&!Upe.test(e)&&!/[^\S ]/u.test(e)&&!/^[._]/.test(e)&&!e.endsWith("."),Gz=e=>{if(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/.test(e))return!0;let[t,n,s,...r]=e.split("/");return e.length<=201&&r.length===0&&s!==void 0&&/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,48}[A-Za-z0-9])?$/.test(t)&&Bz(n)&&Bz(s)},Fpe=d.object({testResults:d.array(d.object({resultId:d.string().regex(/^[^\u0000-\u001f]{1,512}$/),repository:d.string().refine(Gz,"Invalid"),testType:d.string(),runtimeTargets:lh.optional(),endpoint:d.string(),status:d.enum(["Pass","Fail","Skipped"]),details:d.string(),fileName:d.string().optional(),testId:d.string().regex(/^[^\u0000-\u001f]{1,512}$/).optional(),failureCause:d.object({kind:d.nativeEnum(sh),family:d.nativeEnum(ih).optional()}).strict().optional(),origin:d.nativeEnum(CE).optional()}).strict()),validation:Ope,changes:d.array(d.object({id:d.string().min(1).max(512),text:d.string().max(16384),source:d.string().max(jz),testedBy:d.array(d.string().min(1).max(1024)).max(_E),writtenBy:d.array(d.string().min(1).max(1024)).max(_E),maintainedBy:d.array(d.string().min(1).max(1024)).max(_E)}).strict()).max(Vz).optional(),traceVersion:d.literal(1),display:Lz.optional()}).passthrough().superRefine((e,t)=>{let n=e.display,s={issuesFound:e.issuesFound,newTestsCreated:e.newTestsCreated,testResults:e.testResults,caveats:e.caveats};for(let i of["issuesFound","newTestsCreated","testResults","caveats"]){let o=n?.[i];o&&o.length!==(Array.isArray(s[i])?s[i].length:0)&&t.addIssue({code:d.ZodIssueCode.custom,path:["display",i],message:`has not one row per ${i} row`})}n?.validation&&n.validation.gaps.length!==e.validation.gaps.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["display","validation","gaps"],message:"has not one gap per validation gap"});let r=new Set;e.testResults.forEach((i,o)=>{let a=i.failureCause;a&&i.status==="Pass"&&t.addIssue({code:d.ZodIssueCode.custom,path:["testResults",o,"failureCause"],message:"a passing result has no failure cause"}),a&&a.kind==="environment"!=(a.family!==void 0)&&t.addIssue({code:d.ZodIssueCode.custom,path:["testResults",o,"failureCause"],message:"an environment cause names its family, and no other cause does"});let c=["testResults",o,"resultId"],u=i.resultId.slice(`${i.repository}:${i.testType}:`.length);(!i.resultId.startsWith(`${i.repository}:${i.testType}:`)||u===""||u.startsWith("/")||u.startsWith("#"))&&t.addIssue({code:d.ZodIssueCode.custom,path:c,message:"is not repository:testType:path for this result"}),r.has(i.resultId)&&t.addIssue({code:d.ZodIssueCode.custom,path:c,message:"stable identity repeated"}),r.add(i.resultId)})});var LE=50,jE=d.discriminatedUnion("kind",[d.object({kind:d.literal("branch_pushed"),repository:Hr,branch:tB,commit:ys}).strict(),d.object({kind:d.enum(["pull_request_opened","pull_request_edited"]),repository:Hr,number:As,branch:tB}).strict()]),pB=100,Mpe=2048,zz=d.object({records:d.array(d.string().regex(/^https?:\/\/[^\s/?#@]+(\/[^\s?#]*)?$/).max(Mpe)).max(pB),unlisted:d.number().int().nonnegative()}).strict().refine(e=>e.records.length+e.unlisted>0,"names at least one create"),Lpe=d.object({schemaVersion:d.literal(1),run:d.object({runId:Mn,attemptNumber:d.number().int().positive(),manifestHash:tr}).strict(),target:DE,policy:DE,provenance:d.object({sources:d.array(d.object({repository:Hr,revision:ys}).strict()),firstQualification:d.literal(!0).optional()}).strict(),delivery:d.object({generatedTests:Ppe}).strict(),producer:d.object({testbot:d.string().regex(/^[0-9A-Za-z.+-]{1,64}$/),mcp:d.string().regex(/^[0-9A-Za-z.+-]{1,64}$/)}).strict(),report:Fpe,githubWrites:d.array(jE).max(LE).optional()}).strict(),VE=(r=>(r.Recipe="recipe",r.CredentialRejected="credential_rejected",r.Environment="environment",r.Unknown="unknown",r))(VE||{}),fB=200,jpe=d.object({cause:d.nativeEnum(VE),credential:d.string().regex(Gr).optional(),reason:d.string().trim().min(1).max(fB).optional()}).strict().refine(e=>e.cause==="credential_rejected"==(e.credential!==void 0&&e.reason!==void 0),{message:"a credential_rejected check, and only one, names the credential and why"}),Vpe=d.object({name:d.string().regex(Gr),purpose:d.enum(["sut_access","other"]),required:d.boolean(),how:d.string().trim().min(1).max(yE)}).strict(),j_e=Lpe.pick({schemaVersion:!0,run:!0,target:!0,provenance:!0,producer:!0}).extend({recipe:VR,check:jpe.optional(),inputs:d.array(Vpe).min(1).max(50).optional()}).strict().superRefine(({recipe:e},t)=>{let n=(i,o)=>t.addIssue({code:d.ZodIssueCode.custom,path:["recipe",...i],message:o});e.status==="blocked"&&e.blockers.length===0&&n(["blockers"],"a blocked recipe names at least one blocker");let s=new Set,r=0;e.files.forEach((i,o)=>{Xf(i.path)||n(["files",o,"path"],"is not a file under .skyramp/sut/, or the .skyramp/workspace.yml a recipe stored before SKYR-5829 carries"),s.has(i.path)&&n(["files",o,"path"],"file repeated"),s.add(i.path),FR.test(i.content)&&n(["files",o,"content"],"is not text");let a=Buffer.byteLength(i.content,"utf8");r+=a,a>Yf&&n(["files",o,"content"],`larger than ${Yf} bytes`)}),r>Zf&&n(["files"],`recipe text over ${Zf} bytes in total`)}),V_e=d.object({components:d.array(d.object({name:d.string().min(1),repository:d.string().refine(Gz,"Invalid"),observedRevision:d.string().regex(/^[0-9a-f]{7,64}$/).nullable(),source:d.nativeEnum(SE),evidence:d.string()}).strict().refine(e=>e.source!=="agent"||e.observedRevision===null,{path:["observedRevision"],message:"a component only an agent session can read names no revision"}))}).strict();var Gpe=d.object({schemaVersion:d.literal(1),stage:d.nativeEnum(iB),event:d.nativeEnum(Eh),status:d.nativeEnum(oB).optional()}).strict().refine(e=>e.status===void 0||e.event==="finished",{path:["status"],message:"only a finished stage has a status"}),sd=100,hB=5e3,la=2e3,nB=100,gB=/^[A-Za-z0-9_-]{1,64}$/,qz=20,Hz=200,Jz=100,Wz=100,zpe=200,xz="[^/\\s](?:(?:[^/\\s]| )*[^/\\s])?",qpe=new RegExp(`^(?:[^/\\s]+/[^/\\s]+|[^/\\s]+/${xz}/${xz})$`),Yz=500,rB=50,Zz=10,Kz=/^[A-Za-z0-9](?:[A-Za-z0-9 _-]{0,48}[A-Za-z0-9])?$/,id=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/,qr=e=>d.string().max(e).refine(t=>t.trim().length>0&&!id.test(t),"blank, or not text"),Ii={sequence:d.number().int().min(1).max(hB),at:d.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?Z$/)},Xz=d.object({...Ii,kind:d.literal("reply"),to:d.string().uuid(),outcome:d.nativeEnum(UE),accepted:d.boolean(),text:qr(la),note:d.object({source:d.enum(["target","environment"]),quote:qr(la)}).strict().optional(),kept:qr(la).optional()}).strict();function eq(e,t){if(e.kind!=="reply")return;let n=e;n.accepted!==(n.outcome==="answered"||n.outcome==="followed")&&t.addIssue({code:d.ZodIssueCode.custom,path:["accepted"],message:"accepted exactly when answered or followed"}),n.note&&n.outcome!=="not_followed"&&t.addIssue({code:d.ZodIssueCode.custom,path:["note"],message:"a note only when not_followed"}),n.kept&&n.outcome!=="followed"&&t.addIssue({code:d.ZodIssueCode.custom,path:["kept"],message:"kept only when followed"})}var tq=d.discriminatedUnion("kind",[d.object({...Ii,kind:d.literal("log"),phase:d.nativeEnum(vh),text:qr(la)}).strict(),d.object({...Ii,kind:d.literal("component"),name:qr(nB),repository:qr(zpe).refine(e=>qpe.test(e)||e===br,"not owner/name"),file:qr(Yz).nullable(),status:d.nativeEnum(bh),version:qr(Wz).optional()}).strict(),Xz,d.object({...Ii,kind:d.literal("question"),id:d.string().regex(gB),type:d.nativeEnum(aB),text:qr(la),component:qr(nB).nullable(),choices:d.array(qr(Hz)).max(qz),placeholder:qr(Jz).optional()}).strict(),d.object({...Ii,kind:d.literal("delivered"),ids:d.array(d.string().uuid()).max(sd)}).strict(),d.object({...Ii,kind:d.literal("credentials"),names:d.array(d.string().regex(Gr)).min(1).max(rB),logins:d.array(d.object({key:d.string().regex(Kz),usernameVariable:d.string().regex(Gr),passwordVariable:d.string().regex(Gr)}).strict()).min(1).max(Zz).optional(),variables:d.array(d.string().regex(Gr)).min(1).max(rB).optional()}).strict()]).superRefine((e,t)=>{if(eq(e,t),e.kind==="credentials"&&new Set(e.names).size!==e.names.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["names"],message:"a name twice"}),e.kind==="credentials"&&e.logins){let n=e.logins.map(s=>BR(s.key));new Set(n).size!==n.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["logins"],message:"a key twice"}),e.logins.forEach((s,r)=>{for(let i of["usernameVariable","passwordVariable"])e.names.includes(s[i])||t.addIssue({code:d.ZodIssueCode.custom,path:["logins",r,i],message:"not one of the names"})})}e.kind==="credentials"&&e.variables&&(new Set(e.variables).size!==e.variables.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["variables"],message:"a name twice"}),e.variables.forEach((n,s)=>{e.names.includes(n)||t.addIssue({code:d.ZodIssueCode.custom,path:["variables",s],message:"not one of the names"})})),e.kind==="question"&&(e.type==="free_text"!=(e.choices.length===0)&&t.addIssue({code:d.ZodIssueCode.custom,path:["choices"],message:"choices exactly when the question is not free_text"}),new Set(e.choices).size!==e.choices.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["choices"],message:"a choice twice"}))}),Hpe=d.object({schemaVersion:d.literal(1),events:d.array(tq).max(sd)}).strict(),nq=d.discriminatedUnion("kind",[d.object({...Ii,kind:d.literal("log"),stage:d.nativeEnum(hh),text:qr(la)}).strict(),Xz,d.object({...Ii,kind:d.literal("delivered"),ids:d.array(d.string().uuid()).max(sd)}).strict(),d.object({...Ii,kind:d.literal("stage"),stage:d.nativeEnum(hh),event:d.nativeEnum(Eh)}).strict(),d.object({...Ii,kind:d.literal("test"),resultId:d.string().regex(/^[^\u0000-\u001f]{1,512}$/),status:d.enum(["Pass","Fail","Skipped"]),details:d.string().max(la).refine(e=>!id.test(e),"not text")}).strict()]).superRefine(eq),Jpe=d.object({schemaVersion:d.literal(1),events:d.array(nq).max(sd)}).strict(),$z={id:d.string().uuid(),text:d.string(),by:d.string().nullable(),at:d.string(),replied:d.literal(!0).optional()},rq=d.discriminatedUnion("kind",[d.object({...$z,kind:d.literal("instruction"),question:d.null()}),d.object({...$z,kind:d.literal("answer"),question:d.string().regex(gB)})]),sq=d.string().regex(/^[A-Za-z0-9+/]{43}=$/),Wpe=d.object({id:d.string().uuid(),revision:d.string(),by:d.string().nullable(),at:d.string(),target:d.string(),own:d.object({source:d.enum(["policy","test_environment"]),text:d.string()}).nullable()}),Ype=d.object({schemaVersion:d.literal(1),leftOut:d.array(d.string()),messages:d.array(rq).optional(),stop:d.object({key:sq}).optional(),notes:Wpe.optional()}),Zpe=d.object({schemaVersion:d.literal(1),messages:d.array(rq).optional()});var iq=500*1024*1024,oq=d.object({id:As,name:d.string().regex(/^[A-Za-z0-9._-]{1,200}$/),providerRunId:As,expiresAt:d.string().datetime()}).strict(),Kpe=d.object({schemaVersion:d.literal(1),artifact:oq,sessionId:Mn,contentHash:tr,bytes:d.number().int().min(1).max(iq)}).strict(),Xpe=d.object({schemaVersion:d.literal(1),checkpoint:d.object({artifact:oq,repository:d.object({namespace:d.string().min(1),name:d.string().min(1)}).strict(),sessionId:Mn,contentHash:tr,key:sq}).strict().nullable()}).strict(),efe=200,nd=100,mB=(s=>(s.Resume="resume",s.Retry="retry",s.Update="update",s))(mB||{}),tfe=d.object({kind:d.nativeEnum(mB),setup:d.object({runId:Mn,endedAt:d.string().nullable(),outcome:d.string().nullable()}).strict(),components:d.array(d.object({name:d.string().min(1),repository:d.string().min(1),status:d.nativeEnum(bh)}).strict()).max(nd),credentials:d.array(d.string().min(1)).max(nd),answers:d.array(d.object({question:d.string(),answer:d.string().nullable()}).strict()).max(nd),instructions:d.array(d.object({text:d.string(),reply:d.string().nullable()}).strict()).max(nd),log:d.array(d.object({phase:d.nativeEnum(vh),text:d.string()}).strict()).max(efe),recipe:d.object({files:d.array(d.object({path:d.string().min(1),content:d.string()}).strict()).max(nd),blockers:d.array(d.object({component:d.string(),problem:d.string(),evidence:d.string(),fix:d.string()}).strict()).max(nd)}).strict().optional()}).strict(),nfe=d.object({schemaVersion:d.literal(1),context:tfe.nullable()}).strict(),rfe=d.object({schemaVersion:d.literal(1),configuration:d.object({captureId:Mn,revision:As.nullable(),hash:tr}).strict(),capture:d.object({schemaVersion:d.literal(1),settings:d.object({target:d.object({environment:d.unknown()}).passthrough(),timeoutMinutes:d.number().int().positive(),answerWaitMinutes:d.number().int().positive().optional(),testEnvironment:d.object({name:d.string().min(1),address:d.string().min(1).optional(),readyWhen:d.string().min(1).optional(),environmentId:d.string().uuid().optional(),persistentDataPolicy:Qz}).passthrough().optional()}).passthrough(),provenance:d.object({}).passthrough(),hash:tr}).strict()}).strict(),sfe=d.object({schemaVersion:d.literal(1),environmentId:d.string().uuid().nullable(),environmentAddress:d.string().url().nullable(),persistentDataPolicy:xE.nullable()}).strict(),ife=ed.extend({environmentId:d.string().uuid().optional(),persistentDataPolicy:Qz,version:d.number().int().positive(),components:d.array(d.object({name:d.string().min(1),repository:d.string().min(1)}).strict()),contentHash:tr.optional(),files:d.array(d.object({path:d.string().refine(e=>Xf(e)&&!bE.includes(e),"not a file of a customer_deployed plan"),content:d.string()}).strict()).optional()}).strict(),ofe=d.object({schemaVersion:d.literal(1),testEnvironment:ife.nullable().optional(),runtimePlan:d.object({version:d.number().int().positive(),contentHash:tr,files:d.array(d.object({path:d.string().refine(Xf,"not a recipe file path"),content:d.string()}).strict()).min(1),repository:vE.optional(),recipeRepository:vE.optional(),recipe:d.record(d.unknown()).optional()}).strict().nullable()}).strict().refine(e=>!(e.runtimePlan&&e.testEnvironment),{message:"a run pins a recipe or a customer's Test Environment, never both",path:["testEnvironment"]}),afe=d.object({schemaVersion:d.literal(1),state:d.nativeEnum(_z),ending:d.nativeEnum(PE).nullable(),cause:d.nativeEnum(OE).nullable(),deadlineAt:d.string().datetime()}).strict();var aq=50,cq=d.object({repository:Hr,revisions:d.array(d.number().int().nonnegative()).min(1).max(2).refine(e=>e.length<2||e[0]<e[1],"two revisions name the earlier first"),files:d.array(d.string().min(1)).min(1).max(aq)}).strict();var cfe=e=>({provider:e.provider,providerAccountId:e.providerAccountId,providerRepositoryId:e.providerRepositoryId});function uq(e){if(e.reportUploaded)return{schemaVersion:1,reason:"report_uploaded",cause:null};if(e.recipeUploaded)return{schemaVersion:1,reason:"recipe_uploaded",cause:null};if(e.revisionsUploaded)return{schemaVersion:1,reason:"revisions_uploaded",cause:null};let t=e.githubWrites?.length?{githubWrites:e.githubWrites.map(s=>({...s,repository:cfe(s.repository)}))}:{},n=e.sharedEnvironmentRecords?{sharedEnvironmentRecords:e.sharedEnvironmentRecords}:{};return e.cancelled?{schemaVersion:1,reason:"cancelled",cause:null,...t,...n}:e.mergeConflict&&Tz(e)==="merge_conflict"?{schemaVersion:1,reason:"no_report",cause:"merge_conflict",conflict:e.mergeConflict,...t,...n}:{schemaVersion:1,reason:"no_report",cause:Tz({...e,mergeConflict:void 0}),...t,...n}}function Tz(e){return e.runnerProviderNotReady?"runner_provider_not_ready":e.credentialMissing?"credential_missing":e.mergeConflict?"merge_conflict":e.checkoutFailed?"checkout_failed":e.environmentUnverified?"environment_unverified":e.setupFailed?"setup_failed":e.timedOut?"timed_out":e.modelProviderDenied?"model_provider_denied":e.modelProviderUnavailable?"model_provider_unavailable":e.environmentUnavailable?"environment_unavailable":"agent_failed"}var AB=G(require("path"));var od=G(require("fs")),ao=G(require("path"));var ufe=8;function An(e,t,n={}){let s=t.slice(0,ufe),r=t.length-s.length;return{name:e,passed:!1,details:s.join("; ")+(r>0?`; \u2026and ${r} more`:""),...n.fatal?{fatal:!0}:{}}}function Vs(e){if(od.existsSync(e))try{return JSON.parse(od.readFileSync(e,"utf-8"))}catch{return}}function Ae(e,t){return Vs(ao.join(e.outputsDir,t))}function Ln(e,t,n,s){if(!n)throw new Error(`${t}.json unexpectedly invalid at artifact time: ${s[0]}`);let r=ao.join(e.outputsDir,`${t}.json`);return od.writeFileSync(r,JSON.stringify(n,null,2)+`
|
|
141
141
|
`),{[t]:ao.relative(e.runDir,r)}}function wr(e,t){return{name:e,verify(n,s){let{errors:r}=t(n,s);return r.length===0?{name:this.name,passed:!0}:An(this.name,r,{fatal:!0})}}}function Ci(e,t){return ao.relative(e,ao.resolve(e,t)).replace(/\/+$/,"")}function wh(e){return e.replace(/\s+/g," ").trim()}var Ih=new RegExp("(^|/)("+["test_[^/]+\\.py","[^/]+_test\\.py","[^/]+\\.(spec|test)\\.[cm]?[jt]sx?","[^/]+\\.e2e-(spec|test)\\.[cm]?[jt]sx?","[^/]+_test\\.go","[^/]+Tests?\\.(java|kts?)","[^/]+_(test|spec)\\.rb","[^/]+\\.feature","[^/]+Tests?\\.cs","[^/]+_test\\.rs","tests/[^/]+\\.rs","[^/]+Test\\.php","[^/]+(Test|Spec|Suite)\\.scala","[^/]+Tests?\\.swift","[^/]+_test\\.exs","[^/]+_test\\.dart","[^/]+_test\\.(c|cc|cpp|cxx)","test_[^/]+\\.(c|cc|cpp|cxx)","[^/]+(Spec|Test)\\.groovy"].join("|")+")$","i");var yB="outputs/preflight.json",ru="pr-diff.txt",EB="related-diffs";function vB(e){return AB.join(EB,`${e.toLowerCase().replace(/\//g,"__").replace(/[^a-z0-9._-]/g,"_")}.diff`)}function GE(e,t,n){return e.some(s=>s.path===n&&s.repository.toLowerCase()===t.toLowerCase())}function Gs(e){if(e.outputsDir)return Vs(AB.join(e.outputsDir,"preflight.json"))}var zs=G(require("path"));var Ch=G(require("path"));var bB=G(require("path")),co="Skyramp Testbot",da="test-bot@skyramp.dev";function lq(){return bB.join(process.env.RUNNER_TEMP??"/tmp","skyramp")}function dq(){return bB.join(lq(),"staged")}var lfe=(e,t)=>Gt(t,{cwd:e,encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim();function pq(e){let t="";try{t=lfe(e,["remote","get-url","origin"])}catch{}let n=/[:/]([A-Za-z0-9._-]+)\/([A-Za-z0-9._-]+?)(?:\.git)?\/?$/.exec(t);return n&&!t.startsWith("/")&&!t.startsWith(".")?`${n[1]}/${n[2]}`:`local/${Ch.basename(Ch.resolve(e)).replace(/[^A-Za-z0-9._-]/g,"-")||"repo"}`}var eDe=new Set(Object.values(ua));var tDe=d.object({checks:d.array(d.object({repository:d.string().optional(),name:d.string().min(1),headSha:d.string().regex(/^[0-9a-f]{40}$|^[0-9a-f]{64}$/i),status:d.string().default("completed"),conclusion:d.string().nullable().optional(),url:d.string().optional(),summary:d.string().optional()}))});var fq=8e3;function hq(e,t){return(e.contextRepositories??[]).some(n=>qs(n,t))}var wB=new Map;function pfe(e){return e.repositorySlug?e.repositorySlug:(wB.has(e.repositoryPath)||wB.set(e.repositoryPath,pq(e.repositoryPath)),wB.get(e.repositoryPath))}function Jt(e){let t=pfe(e);return[{slug:t,path:e.repositoryPath,writable:!hq(e,t),working:!0},...(e.relatedRepos??[]).map(n=>({slug:n.slug,path:n.path,writable:n.writable===!0,working:!1}))]}function Si(e){return Jt(e)[0]}function IB(e,t){return gq(Jt(e),t)}function gq(e,t){return[...e].sort((n,s)=>s.path.length-n.path.length).find(n=>{let s=zs.relative(n.path,t);return!s.startsWith("..")&&!zs.isAbsolute(s)})}var qs=(e,t)=>e.toLowerCase()===t.toLowerCase();function ad(e,t){return t?.trim()?e.find(n=>qs(n.slug,t.trim())):e[0]}function Jr(e,t){return ad(Jt(e),t)}var ffe=(e,t)=>`${t} is not a repository of this run (${Jt(e).map(n=>n.slug).join(", ")})`;function uo(e,t){let n=Jr(e,t);return n?n.writable?{source:n}:{error:`${n.slug} is read-only in this run: tests are written only to ${Jt(e).filter(s=>s.writable).map(s=>s.slug).join(", ")}`}:{error:ffe(e,t)}}function Es(e,t){return mq(Jt(e),t)}var CB=e=>zs.basename(zs.resolve(e.path));function mq(e,t){return e.length<2?"":`${ad(e,t)?.slug??t}: `}var dDe={focused:"Focused",impacted_critical:"Impacted and critical",broad:"Broad"};var cd=e=>!!e.inputs?.scheduledValidation?.comparisonBaselineId;var d6=G(require("path"));var gfe=4,Sh=12,kh="\xABredacted\xBB";function Rh(e){let t=new Set;for(let n of e){let s=(n??"").trim();s.length>=gfe&&t.add(s)}return[...t].sort((n,s)=>s.length-n.length)}function mfe(e){return e.replace(/AUTHORIZATION: (basic|bearer) \S+/gi,"AUTHORIZATION: $1 ***").replace(/x-access-token:[^@\s]+@/gi,"x-access-token:***@")}function Bh(e){return e.replace(/(https?:\/\/)[^\s/@]+@/gi,"$1[redacted]@")}var Afe=/\.skyramp(?:\/sut(?:\/(?:setup\.sh|teardown\.sh|health\.json|health-check\.sh|deployed-revisions\.sh|get-auth-token\.sh))?)?|\bSKYRAMP(?=_)|@skyramp\/(?:mcp|skyramp|testbot)\b|\bskyramp(?=[A-Z])|outputs\/onboard-hooks(?:\/(?:setup-event|setup-hooks)\.mjs)?/g;function yfe(e){return[...e.matchAll(Afe)].map(t=>[t.index,t.index+t[0].length])}function Efe(e,t){let n=yfe(e),s=[];for(let r=e.indexOf(t);r!==-1;r=e.indexOf(t,r+t.length))n.some(([i,o])=>i<=r&&r+t.length<=o)||s.push(r);return s}function Lt(e,t){if(!e||t.length===0)return e;let n=e;for(let s of t){if(!s||!n.includes(s))continue;let r=Efe(n,s);for(let i=r.length-1;i>=0;i-=1)n=n.slice(0,r[i])+kh+n.slice(r[i]+s.length)}return n}function kB(e,t,n){let s=e;for(let r of[...new Set(t.filter(Boolean))].sort((i,o)=>o.length-i.length))s=s.split(r).join("*".repeat(r.length));return s.slice(-n)}function vfe(e,t,n){let s=t+n.text.length;if(s>e.length)return-1;let r=e.slice(t,s);return(n.escaped?r.toUpperCase():r)===n.text?s:-1}function Aq(e,t,n){let s,r=(o,a)=>o*(e.length+1)+a,i=[{unit:0,pos:t,next:0}];for(;i.length;){let o=i[i.length-1];if(o.unit===n.length)return o.pos;let a=-1;for(;a<0&&o.next<n[o.unit].length;)a=vfe(e,o.pos,n[o.unit][o.next]),o.next+=1,a>=0&&s?.has(r(o.unit+1,a))&&(a=-1);a>=0?i.push({unit:o.unit+1,pos:a,next:0}):((s??=new Set).add(r(o.unit,o.pos)),i.pop())}return-1}function bfe(e){let t=[];for(let n=0;n<e.length;){let s=e.slice(n,n+3);if(/^%[0-9a-fA-F]{2}$/.test(s))t.push([{text:s.toUpperCase(),escaped:!0}]),n+=3;else{let r=String.fromCodePoint(e.codePointAt(n));t.push([{text:r,escaped:!1}]),n+=r.length}}return t}function wfe(e){return Array.from(e,t=>{let n=[...Buffer.from(t.toWellFormed())].map(r=>`%${r.toString(16).toUpperCase().padStart(2,"0")}`).join(""),s=[{text:t,escaped:!1},{text:n,escaped:!0}];return t===" "?[...s,{text:"+",escaped:!1}]:s})}function Ife(e){let t=[],n=(r,i)=>t.push({length:r.length,units:i});for(let r of[...new Set(e)].filter(Boolean)){let i=wfe(r);n(r,i);let o=new URL("https://example.invalid");o.username=r,o.password=r;let a=new URL("https://example.invalid");a.search=`?value=${r}`;let c=new URL("https://example.invalid");c.pathname=`/${r}`;let u=[encodeURIComponent(r.toWellFormed()),encodeURI(r.toWellFormed()),new URLSearchParams({value:r}).toString().slice(6),o.username,o.password,a.search.slice(7),c.pathname.slice(1)];for(let l of new Set(u))l&&Aq(l,0,i)!==l.length&&n(l,bfe(l))}t.sort((r,i)=>i.length-r.length);let s=new Map;for(let{units:r}of t)for(let i of new Set(r[0].map(o=>o.text[0]))){let o=s.get(i)??[];o.length===0&&s.set(i,o),o.push(r)}return r=>{let i="",o=0;for(let a=0;a<r.length;){let c=-1;for(let u of s.get(r[a])??[])if(c=Aq(r,a,u),c>a)break;c>a?(i+=r.slice(o,a)+kh,o=a=c):a+=1}return o===0?r:i+r.slice(o)}}function xh(e,t){return!e||!t.length?e:Ife(t)(e)}function ki(e,t){return Lt(mfe(e),t)}function Cfe(e,t){let n=s=>typeof s=="string"?t(s):Array.isArray(s)?s.map(n):s&&typeof s=="object"?Object.fromEntries(Object.entries(s).map(([r,i])=>[r,n(i)])):s;return n(e)}function Hs(e,t){return t.length===0?e:Cfe(e,n=>Lt(n,t))}var ADe=new TextDecoder("utf-8",{fatal:!0});function Wt(e,t=[]){let n=e.trim();if(!n)return{error:"session produced no output"};let s=c=>{try{let u=JSON.parse(c);return typeof u=="object"&&u!==null&&!Array.isArray(u)?u:void 0}catch{return}},r=s(n);if(r!==void 0)return{value:r};let i;if(n.startsWith("{")&&n.endsWith("}"))try{JSON.parse(n)}catch(c){i=c instanceof Error?c.message:String(c)}let o=[...n.matchAll(/```(?:json)?\s*\n([\s\S]*?)```/g)];for(let c=o.length-1;c>=0;c--){let u=s(o[c][1].trim());if(u!==void 0)return{value:u}}let a;for(let c=n.indexOf("{");c!==-1;c=n.indexOf("{",c+1)){let u=0,l=!1,p=!1;for(let h=c;h<n.length;h++){let g=n[h];if(p){p=!1;continue}if(g==="\\"){p=l;continue}if(g==='"'){l=!l;continue}if(!l){if(g==="{")u++;else if(g==="}"&&(u--,u===0)){let m=s(n.slice(c,h+1));m!==void 0&&Object.keys(m).length>0&&(a=m,c=h);break}}}}return i&&(a===void 0||Object.keys(a).length<3)?{error:`final message is not valid JSON \u2014 ${i}. Most often an unescaped double quote inside a string (e.g. in "summary" or "evidence"): escape it as \\" or use single quotes in prose`}:a!==void 0?{value:a}:i?{error:`final message is not valid JSON \u2014 ${i}. Most often an unescaped double quote inside a string (e.g. in "summary" or "evidence"): escape it as \\" or use single quotes in prose`}:{error:`no parseable JSON object found in session output \u2014 the final message was: "${Sfe(Lt(n,t))}"`}}var yq=240;function Sfe(e){let t=e.replace(/\s+/g," ").trim();return t.length<=yq?t:`\u2026${t.slice(-yq)}`}function vq(e,t=0,n=new Set){return $h(e,t,n)}var Eq=e=>" ".repeat(e);function $h(e,t,n){let s=kfe(e);switch(s._def.typeName){case"ZodObject":{let i=s.shape,o=Object.keys(i).filter(c=>!n.has(c)&&!i[c].description?.startsWith("[derived]"));return o.length===0?"{}":`{
|
|
142
142
|
${o.map((c,u)=>{let l=i[c],p=l.isOptional()?" (optional)":"",h=l.description?` // ${l.description}`:"",g=$h(l,t+2,n);return`${Eq(t+2)}"${c}": ${g}${u<o.length-1?",":""}${p}${h}`}).join(`
|
|
143
143
|
`)}
|
|
@@ -337,7 +337,7 @@ STALENESS WARNING: this PR changed recipe/infra files (${t.staleFiles.join(", ")
|
|
|
337
337
|
The recorded recipe may no longer match. If bring-up fails, first decide
|
|
338
338
|
WHY: recipe drift (infra moved, recipe is behind) vs the change itself
|
|
339
339
|
breaking bring-up. Do NOT paper over a PR that broke the app.`:"","",...r?MBe(r.address,t):["Tasks:","1. Replay the recipe: run .skyramp/sut/setup.sh (or the workspace bring-up)"," even when the SUT already answers: never skip it because something is running."," Bring up every dependency you can; mock one only when deploying it here"," is genuinely infeasible. If the recipe has drifted, correct it so it works"," and update the recipe files to what actually worked. teardown.sh exits 0"," when nothing runs.","2. Seed or reset state per the recipe. Acquire the auth token the way the"," recipe records (.skyramp/sut/get-auth-token.sh) \u2014 never echo it.",...o.length?[` Leave the shared components ${o.join(", ")} unchanged: do not seed or reset them.`]:[],"3. Health-check: confirm application logic answers with real data (seeded",' data readable via a real endpoint) \u2014 NOT "port open", NOT "any HTTP',' status". Record the exact url/command and what it returned.',...t.healthHint?[" Recommended health check (recorded by onboarding \u2014 prefer it, and",` record its real output): ${JSON.stringify(t.healthHint)}`]:[],'4. Record the outcome honestly (see the schema): "change-broke-bringup" is',' published to the author as "your change broke the app" and needs evidence'," \u2014 bringupError plus suspectFiles that THIS PR changed; without a changed",' file to point at, it is "bringup-failed".'],...FBe(e),...LBe(e),"","Output: end with one JSON object matching:","",vq(Kf)," // health.output is evidence, not narration: the exact bytes, with NOTHING"," // appended \u2014 no gloss on what the response proves, no list of the other probes"," // you ran. This gate RE-RUNS the check and matches the fresh output against this"," // field, so a sentence added here describes a run nobody can reproduce. Say what"," // it means in your prose answer instead."," // On a failed bring-up, baseUrls/health may be omitted \u2014 never invent a URL for an app that didn't start."].filter(a=>a!==void 0).join(`
|
|
340
|
-
`)}function M9(e){let t=Sm.join(e.outputsDir,"deploy.txt");if(AI.existsSync(t)){let{deploy:s}=Ru({exitCode:0,stdout:AI.readFileSync(t,"utf-8"),stderr:"",timedOut:!1,durationMs:0});if(s?.teardown)return{argv:["sh","-c",s.teardown],label:"deploy.json's teardown"}}let{teardownScript:n}=xa(e.inputs.repositoryPath);if(n)return{argv:["bash",n],label:Sm.join(".skyramp","sut","teardown.sh")}}function L9(e,t){return yw(t,e.inputs.repositoryPath,{env:pt(),secretValues:e.secretValues})}async function F9(e){let t=M9(e);if(t){let n=await L9(e,t);if(n&&hZ(e))throw new Error(`SUT teardown failed: ${n}`)}}async function GBe(e,t){let n=t.passed?void 0:j9(e);if(!n)return;let s=await L9(e,n);return s&&`${s} (if nothing was running, a teardown must exit 0)`}function j9(e){return xN(e)?void 0:M9(e)}function zBe(e){if(j9(e))return"Testbot tore down the SUT the previous attempt started. Bring it up again from the start: run .skyramp/sut/setup.sh (or the workspace bring-up), even if something still answers. Never reuse what is running."}function qBe(e,t){let{deploy:n}=Ru(t,e.inputs.repositoryPath,e.secretValues);if(!n)return;if(n.outcome==="bringup-failed"){let r=Lt(n.bringupError?.output?.trim()??"",e.secretValues??[]);return`bring-up failed (environment) \u2014 no live app for later stages${r?`: ${r.slice(0,160)}`:""}`}if(n.outcome==="change-broke-bringup")return"this PR broke bring-up \u2014 recorded as a finding, no live app for later stages";let s=Yg(e).map(r=>r.name);if(s.length)return`the shared environment's ${s.join(", ")} does not verifiably run the revision under validation \u2014 no runtime test runs against it`}var V9=U9({name:"deploy",model:"opus",timeoutMinutes:25,requires:["preflight"],softRequires:["onboard"],startsApp:e=>!e.inputs.appRunning&&!(e.inputs.testEnvironment&&xN(e)),triageBranch:"runtime",validateInput:NBe,prepare:OBe,scaleTimeout:PBe,buildPrompt:VBe,allowedTools:DBe,buildSessionEnv:()=>({...T9}),selfVerification:["dependencies lists every backing service, true only if really deployed \u2014 a mocked one is false, never omitted.","Your final message is one JSON object matching the schema."],exitGates:[_w(),fK()],onPassed:async(e,t)=>({...gK(e,t),...await hK(e,t)}),passReason:qBe,afterAttempt:GBe,retryNote:zBe,onAbort:F9,teardown:F9});On();var xet=20*1024*1024;var ko=G(require("fs"));var z9=G(require("path"));var Met=z9.join(".skyramp","sut","get-auth-token.sh");var $N="\\$([A-Z][A-Z0-9_]{0,99})",Let=new RegExp(`^${$N}$`),jet=new RegExp(`^${$N}:${$N}$`);var dtt=new Set([...AD,"coverage",".nyc_output","htmlcov","TestResults"]);var cnt=3*6e4;var unt=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;var WBe=["GH_TOKEN","GITHUB_TOKEN","ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","CLAUDE_CODE_OAUTH_TOKEN","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","AWS_BEARER_TOKEN_BEDROCK","AWS_CONTAINER_AUTHORIZATION_TOKEN"],YBe=["AWS_WEB_IDENTITY_TOKEN_FILE","AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE"];function ZBe(e){if(e)try{return ko.statSync(e).size>64*1024?void 0:ko.readFileSync(e,"utf8").trim()||void 0}catch{return}}function q9(e=process.env){return Rh([...WBe.map(t=>e[t]),...YBe.map(t=>ZBe(e[t]))])}var yI=G(require("fs")),TN=G(require("path"));function KBe(e){let t;try{t=yI.readdirSync(e)}catch{return[]}let n=t.filter(s=>/^session-[0-9a-f-]{36}$/.test(s)).map(s=>TN.join(e,s)).filter(s=>yI.lstatSync(s,{throwIfNoEntry:!1})?.isDirectory());return[e,...n.sort()]}function XBe(e,t){let n;try{n=new URL(e)}catch{return}if(n.protocol!=="http:"&&n.protocol!=="https:")return;let s=xh(ki(`${n.protocol}//${n.host}${n.pathname}`,t),t);return zz.safeParse({records:[s],unlisted:0}).success?s:void 0}function H9(e,t){let n=TN.join(e,Fg),s=KBe(n).flatMap(c=>[J_(c,!0,new Set),J_(c,!1,new Set)]),{leftovers:r,unparsedCreates:i}=fZ(s.flatMap(c=>c.ledgers)),o=[],a=i.length+s.flatMap(c=>c.failures).length;for(let c of new Set(r)){let u=XBe(c,t);u===void 0||o.includes(u)||o.length>=pB?a+=1:o.push(u)}return o.length+a>0?{records:o,unlisted:a}:void 0}var Dnt=new RegExp(id.source,"g");var txe="https://testbot.skyramp.dev",Di={attemptId:"v3AttemptId",deadlineAt:"v3DeadlineAt",reportUploaded:"v3ReportUploaded",recipeUploaded:"v3RecipeUploaded",recipeStatus:"v3RecipeStatus",revisionsUploaded:"v3RevisionsUploaded",cause:"v3Cause",conflict:"v3Conflict",githubWrites:"v3GithubWrites",credentialNames:"v3CredentialNames"};function J9(e,t,n){return{origin:e,idToken:t,sourceToken:n,mask:s=>Wi(s),log:s=>ls(s),onTokenRefused:(s,r)=>{rxe(s)&&W9.set(r,s)},onTokenGranted:s=>{W9.delete(s)}}}var W9=new Map;var fit=["setup_failed","checkout_failed","environment_unverified"];function nxe(e,t){return t.getTime()>=e.getTime()}function rxe(e){return e instanceof _i||e instanceof So&&e.code!=="CREDENTIALS_UNAVAILABLE"}var hit={cancelled:"Skyramp cancelled this run",expired:"this attempt passed its deadline in Skyramp",ended:"Skyramp already ended this attempt"},git={cancelled:"attempt-cancelled",expired:"attempt-closed",ended:"attempt-closed"},mit={cancelled:"cancelled",expired:"timed_out",ended:"agent_failed"};var Ait={analyze:"analyze",triage:"analyze",recommend:"recommend",generate:"generate","generate-ui":"generate","generate-unit":"generate",adapt:"generate",write:"generate",onboard:"execute",deploy:"execute","native-run":"execute",deliver:"deliver"},yit={analyze:"change analysis",recommend:"test recommendations",generate:"test generation",execute:"test execution",deliver:"opening a pull request with the tests"};function Y9(){return je("skyrampAppOrigin").trim()||txe}var Eit=10*6e4;var vit={onboard:"onboard",deploy:"deploy"},bit={plan:{stage:"validation_plan",text:"Working out what to validate, and bringing up what it needs"},write:{stage:"tests",text:"Writing and running the tests"},"generate-unit":{stage:"tests",text:"Writing unit tests"},"native-run":{stage:"tests",text:"Running the unit tests"}},wit=new Set(["write","native-run"]);function sxe(){let e=Us(Di.conflict);if(!e)return;let t;try{t=cq.safeParse(JSON.parse(e))}catch(n){Dt(`Testbot V3: the saved merge conflict is not JSON (${n instanceof Error?n.message:String(n)})`);return}if(t.success)return t.data;Dt(`Testbot V3: the saved merge conflict breaks the contract (${t.error.issues.map(n=>`${n.path.join(".")}: ${n.message}`).join("; ")})`)}function ixe(){let e=Us(Di.githubWrites);if(!e)return[];let t;try{t=JSON.parse(e)}catch(n){return Dt(`Testbot V3: the saved GitHub writes are not JSON (${n instanceof Error?n.message:String(n)})`),[]}return Array.isArray(t)?t.flatMap(n=>{let s=jE.safeParse(n);return s.success?[s.data]:[]}).slice(0,LE):[]}function oxe(){let e=Us(Di.credentialNames).split(",").filter(Boolean),t=Rh([...e.map(n=>process.env[n]),...Object.values(Lf()),...q9()]);try{let n=H9(Z9.join(dq(),"outputs"),t);return n&&ls(`Testbot V3: this
|
|
340
|
+
`)}function M9(e){let t=Sm.join(e.outputsDir,"deploy.txt");if(AI.existsSync(t)){let{deploy:s}=Ru({exitCode:0,stdout:AI.readFileSync(t,"utf-8"),stderr:"",timedOut:!1,durationMs:0});if(s?.teardown)return{argv:["sh","-c",s.teardown],label:"deploy.json's teardown"}}let{teardownScript:n}=xa(e.inputs.repositoryPath);if(n)return{argv:["bash",n],label:Sm.join(".skyramp","sut","teardown.sh")}}function L9(e,t){return yw(t,e.inputs.repositoryPath,{env:pt(),secretValues:e.secretValues})}async function F9(e){let t=M9(e);if(t){let n=await L9(e,t);if(n&&hZ(e))throw new Error(`SUT teardown failed: ${n}`)}}async function GBe(e,t){let n=t.passed?void 0:j9(e);if(!n)return;let s=await L9(e,n);return s&&`${s} (if nothing was running, a teardown must exit 0)`}function j9(e){return xN(e)?void 0:M9(e)}function zBe(e){if(j9(e))return"Testbot tore down the SUT the previous attempt started. Bring it up again from the start: run .skyramp/sut/setup.sh (or the workspace bring-up), even if something still answers. Never reuse what is running."}function qBe(e,t){let{deploy:n}=Ru(t,e.inputs.repositoryPath,e.secretValues);if(!n)return;if(n.outcome==="bringup-failed"){let r=Lt(n.bringupError?.output?.trim()??"",e.secretValues??[]);return`bring-up failed (environment) \u2014 no live app for later stages${r?`: ${r.slice(0,160)}`:""}`}if(n.outcome==="change-broke-bringup")return"this PR broke bring-up \u2014 recorded as a finding, no live app for later stages";let s=Yg(e).map(r=>r.name);if(s.length)return`the shared environment's ${s.join(", ")} does not verifiably run the revision under validation \u2014 no runtime test runs against it`}var V9=U9({name:"deploy",model:"opus",timeoutMinutes:25,requires:["preflight"],softRequires:["onboard"],startsApp:e=>!e.inputs.appRunning&&!(e.inputs.testEnvironment&&xN(e)),triageBranch:"runtime",validateInput:NBe,prepare:OBe,scaleTimeout:PBe,buildPrompt:VBe,allowedTools:DBe,buildSessionEnv:()=>({...T9}),selfVerification:["dependencies lists every backing service, true only if really deployed \u2014 a mocked one is false, never omitted.","Your final message is one JSON object matching the schema."],exitGates:[_w(),fK()],onPassed:async(e,t)=>({...gK(e,t),...await hK(e,t)}),passReason:qBe,afterAttempt:GBe,retryNote:zBe,onAbort:F9,teardown:F9});On();var xet=20*1024*1024;var ko=G(require("fs"));var z9=G(require("path"));var Met=z9.join(".skyramp","sut","get-auth-token.sh");var $N="\\$([A-Z][A-Z0-9_]{0,99})",Let=new RegExp(`^${$N}$`),jet=new RegExp(`^${$N}:${$N}$`);var dtt=new Set([...AD,"coverage",".nyc_output","htmlcov","TestResults"]);var cnt=3*6e4;var unt=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;var WBe=["GH_TOKEN","GITHUB_TOKEN","ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","CLAUDE_CODE_OAUTH_TOKEN","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","AWS_BEARER_TOKEN_BEDROCK","AWS_CONTAINER_AUTHORIZATION_TOKEN"],YBe=["AWS_WEB_IDENTITY_TOKEN_FILE","AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE"];function ZBe(e){if(e)try{return ko.statSync(e).size>64*1024?void 0:ko.readFileSync(e,"utf8").trim()||void 0}catch{return}}function q9(e=process.env){return Rh([...WBe.map(t=>e[t]),...YBe.map(t=>ZBe(e[t]))])}var yI=G(require("fs")),TN=G(require("path"));function KBe(e){let t;try{t=yI.readdirSync(e)}catch{return[]}let n=t.filter(s=>/^session-[0-9a-f-]{36}$/.test(s)).map(s=>TN.join(e,s)).filter(s=>yI.lstatSync(s,{throwIfNoEntry:!1})?.isDirectory());return[e,...n.sort()]}function XBe(e,t){let n;try{n=new URL(e)}catch{return}if(n.protocol!=="http:"&&n.protocol!=="https:")return;let s=xh(ki(`${n.protocol}//${n.host}${n.pathname}`,t),t);return zz.safeParse({records:[s],unlisted:0}).success?s:void 0}function H9(e,t){let n=TN.join(e,Fg),s=KBe(n).flatMap(c=>[J_(c,!0,new Set),J_(c,!1,new Set)]),{leftovers:r,unparsedCreates:i}=fZ(s.flatMap(c=>c.ledgers)),o=[],a=i.length+s.flatMap(c=>c.failures).length;for(let c of new Set(r)){let u=XBe(c,t);u===void 0||o.includes(u)||o.length>=pB?a+=1:o.push(u)}return o.length+a>0?{records:o,unlisted:a}:void 0}var Dnt=new RegExp(id.source,"g");var txe="https://testbot.skyramp.dev",Di={attemptId:"v3AttemptId",deadlineAt:"v3DeadlineAt",reportUploaded:"v3ReportUploaded",recipeUploaded:"v3RecipeUploaded",recipeStatus:"v3RecipeStatus",revisionsUploaded:"v3RevisionsUploaded",cause:"v3Cause",conflict:"v3Conflict",githubWrites:"v3GithubWrites",credentialNames:"v3CredentialNames"};function J9(e,t,n){return{origin:e,idToken:t,sourceToken:n,mask:s=>Wi(s),log:s=>ls(s),onTokenRefused:(s,r)=>{rxe(s)&&W9.set(r,s)},onTokenGranted:s=>{W9.delete(s)}}}var W9=new Map;var fit=["setup_failed","checkout_failed","environment_unverified"];function nxe(e,t){return t.getTime()>=e.getTime()}function rxe(e){return e instanceof _i||e instanceof So&&e.code!=="CREDENTIALS_UNAVAILABLE"}var hit={cancelled:"Skyramp cancelled this run",expired:"this attempt passed its deadline in Skyramp",ended:"Skyramp already ended this attempt"},git={cancelled:"attempt-cancelled",expired:"attempt-closed",ended:"attempt-closed"},mit={cancelled:"cancelled",expired:"timed_out",ended:"agent_failed"};var Ait={analyze:"analyze",triage:"analyze",recommend:"recommend",generate:"generate","generate-ui":"generate","generate-unit":"generate",adapt:"generate",write:"generate",onboard:"execute",deploy:"execute","native-run":"execute",deliver:"deliver"},yit={analyze:"change analysis",recommend:"test recommendations",generate:"test generation",execute:"test execution",deliver:"opening a pull request with the tests"};function Y9(){return je("skyrampAppOrigin").trim()||txe}var Eit=10*6e4;var vit={onboard:"onboard",deploy:"deploy"},bit={plan:{stage:"validation_plan",text:"Working out what to validate, and bringing up what it needs"},write:{stage:"tests",text:"Writing and running the tests"},"generate-unit":{stage:"tests",text:"Writing unit tests"},"native-run":{stage:"tests",text:"Running the unit tests"}},wit=new Set(["write","native-run"]);function sxe(){let e=Us(Di.conflict);if(!e)return;let t;try{t=cq.safeParse(JSON.parse(e))}catch(n){Dt(`Testbot V3: the saved merge conflict is not JSON (${n instanceof Error?n.message:String(n)})`);return}if(t.success)return t.data;Dt(`Testbot V3: the saved merge conflict breaks the contract (${t.error.issues.map(n=>`${n.path.join(".")}: ${n.message}`).join("; ")})`)}function ixe(){let e=Us(Di.githubWrites);if(!e)return[];let t;try{t=JSON.parse(e)}catch(n){return Dt(`Testbot V3: the saved GitHub writes are not JSON (${n instanceof Error?n.message:String(n)})`),[]}return Array.isArray(t)?t.flatMap(n=>{let s=jE.safeParse(n);return s.success?[s.data]:[]}).slice(0,LE):[]}function oxe(){let e=Us(Di.credentialNames).split(",").filter(Boolean),t=Rh([...e.map(n=>process.env[n]),...Object.values(Lf()),...q9()]);try{let n=H9(Z9.join(dq(),"outputs"),t);return n&&ls(`Testbot V3: this run uploaded nothing and created ${n.records.length+n.unlisted} record(s) in the shared environment that it did not see removed; sending them to Skyramp.`),n}catch(n){let s=n instanceof Error?n.message:String(n);Dt(`Testbot V3: could not read what this run created in the shared environment (${s})`);return}}async function K9(){let e=Us(Di.attemptId);if(!e)return;let t=Us(Di.reportUploaded)==="true",n=Us(Di.recipeUploaded)==="true",s=Us(Di.revisionsUploaded)==="true",r=Us(Di.deadlineAt),i=Us(Di.cause)||void 0;!i&&!t&&!n&&!s&&r&&nxe(new Date(r),new Date)&&(i="timed_out");let o=Xd().takeIdToken(),a=sxe(),c={attemptId:e,reportUploaded:t,recipeUploaded:n,revisionsUploaded:s,cause:i,...a?{conflict:a}:{},githubWrites:ixe()},u=!t&&!n&&!s?oxe():void 0,l;try{l=await kN({...c,...u?{sharedEnvironmentRecords:u}:{}},J9(Y9(),o))}catch(h){if(!u||!(h instanceof So)||h.status!==400)throw h;Dt(`Testbot V3: Skyramp refused the end; ending again without the shared-environment records (${h.message}); the attempt ends without them.`),l=await kN(c,J9(Y9(),o))}let p=Us(Di.recipeStatus);n&&p?ls(`Testbot V3: attempt ended; the setup ended ${p==="ready"?"Ready":"blocked (Needs input)"}.`):ls(`Testbot V3: attempt ended; the run's outcome in Skyramp is ${l.outcome??"not final yet"}.`)}var X9=require("child_process"),Ni=G(require("fs")),_N=G(require("path")),DN=require("string_decoder");var axe="skyramp-testbot-state",cxe=/^\$\([^)]*\)$/;function uxe(e){for(let[t,n]of Object.entries(e))n!==void 0&&cxe.test(n)&&delete e[t]}function lxe(e){let t={},n=Ni.existsSync(e)?Ni.readFileSync(e,"utf-8"):"",s=/^([^\r\n<]+)<<(\S+)\r?\n([\s\S]*?)\r?\n\2\r?$/gm;for(let r=s.exec(n);r;r=s.exec(n))t[r[1]]=r[3];return t}function e3(e,t={}){let n=t.env??process.env;if(!$a(n))return!1;uxe(n),$Z(n);let s=n.AGENT_TEMPDIRECTORY||n.RUNNER_TEMP;if(s){n.RUNNER_TEMP??=s;let o=_N.join(s,axe);if(e==="main")Ni.writeFileSync(o,"",{mode:384});else for(let[a,c]of Object.entries(lxe(o)))n[`STATE_${a}`]=c;n.GITHUB_STATE=o;for(let[a,c]of[["GITHUB_OUTPUT","output"],["GITHUB_ENV","env"],["GITHUB_PATH","path"],["GITHUB_STEP_SUMMARY",`summary-${e}.md`]])n[a]=_N.join(s,`skyramp-testbot-${c}`),Ni.writeFileSync(n[a],"",{mode:384})}let r=t.stdout??n===process.env;r&&dxe(n,t.write);let i=n.GITHUB_STEP_SUMMARY;if(r&&i){let o=t.write??(a=>eD(a.replace(/\n$/,"")));process.once("exit",()=>{Ni.existsSync(i)&&Ni.statSync(i).size>0&&o(`${vw("task.uploadsummary",{},i)}
|
|
341
341
|
`)})}return!0}function dxe(e,t){let n=process.stdout.write.bind(process.stdout),s=o=>e[Lg]==="1"?X_(o,e):void n(o.command!==void 0?`${o.command}
|
|
342
342
|
`:o.text??""),r=t??(o=>s({command:o.replace(/\n$/,"")})),i=t??(o=>s({text:o}));process.stdout.write=((o,...a)=>{let c=typeof o=="string"?o:Buffer.from(o).toString("utf-8"),u="";for(let p of c.split(/(?<=\n)/)){let h=p.startsWith("::")?IZ(p):void 0;if(!h){u+=p;continue}u&&i(u),u="";for(let g of h)r(`${g}
|
|
343
343
|
`)}return u&&i(u),a.find(p=>typeof p=="function")?.(),!0})}var pxe=64*1024;function QN(e){let t=new DN.StringDecoder("utf8"),n="",s=r=>e(Ew(r));return{push(r){n+=typeof r=="string"?r:t.write(r);let i=n.lastIndexOf(`
|