@skyramp/testbot-core 0.13.0-v3.255 → 0.13.0-v3.256

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.0-v3.255","commit":"5033292c72a75bc2e8f5c6df8365290bfcd96bc6"}
1
+ {"version":"0.13.0-v3.256","commit":"99f9f02319e5fe4261109a127a8fe1b0cfaa8afa"}
package/dist/main.js CHANGED
@@ -675,7 +675,7 @@ Fix them in the test files, not the lint config, run it on your files again, and
675
675
  missing evidence to obtain: ${t.covers||"(unstated)"}
676
676
  where the change is: ${t.where}`),"Every behavior above gets an in-process test, except that a test of what the change could break stays only if it","fails on the change (step 1).",""]:[],...e.defects.length?["For each defect suspected above, write a test that reaches it and expects the correct behaviour, so it fails on this","change and passes once the defect is fixed, and give its id in covers; a defect no in-process test can reach goes","under notWritten, with why.",""]:[],...e.browserJourneys.length?["These user journeys need a browser and the running app, which this run does not have: no in-process test can walk","them, so each goes under notWritten by its id, with what it needs that is missing:",...e.browserJourneys.map(t=>` - ${t.id} ${t.name}`),""]:[]]}function Fur(e,t=[]){let r="";try{let n=$l(e,t),s=[...new Set(n.flatMap(i=>i.secretEnv))].filter(i=>t.includes(i));r=DXe(PE(n),s).trim()}catch{return[]}return r?["Some variables the repo's CI sets would clash with your own model access, so their values are in your shell",`renamed, under a TESTBOT_CI_ prefix. Run a test that needs CI's values with them mapped back: \`${r} <test command>\`.`]:[]}function Lur(e,t=Date.now()){return e.deadlineMs==null?"":` About ${Math.max(0,Math.floor((e.deadlineMs-t)/6e4))} minutes are left in this run: it stops then and keeps what you have written.`}function Uur(e){let t=e.prepared,r=e.inputs.repositoryPath,n=Zr(e),s=n?.repository.currentBranch??"HEAD",i=n?.repository.baseBranch??e.inputs.baseBranch??"origin/main",o=BE(e.inputs,e.runDir),a=bi(e),c=me(e,"analyze.json"),l=new Map((c?.behaviors??[]).map(R=>[R.id,R.statement])),u=(c?.findings??[]).filter(R=>R.status!=="refuted"&&R.status!=="latent"),d=(c?.findings??[]).filter(R=>R.status==="latent"),p=me(e,"plan.json"),f=new Map((p?.cases??[]).map(R=>[R.id,R.steps])),m=Ts(e.inputs.requirementItems),g=new Map((p?.requirements??[]).flatMap(R=>R.reference&&R.criterion?[[R.id,` (${yo(R.reference,R.criterion,m)})`]]:[])),E=Zce(e)&&VR(e),A=Un(e),w=lx(e),S=bnt(e),x=new Set(S.map(R=>R.id)),I=a.generate.filter(R=>!x.has(R.id)).map(R=>{let P=[R.from_behavior&&`${R.from_behavior}: ${l.get(R.from_behavior)??""}`.trim(),R.from_finding&&`defect ${R.from_finding}`].filter(Boolean).join("; ");return[` - ${R.id} [${R.type}] ${R.target}${P?` \u2014 ${P}`:""}`,` do: ${f.get(R.id)??R.rationale}`,` expect: ${R.expected_observable}`].join(`
677
677
  `)});return["Write functional tests for this PR and run them. The plan below came from reading the PR; turn it into tests in the","repo, run them, and tell me what they show about the change.","",`The repo is at ${r}, checked out on branch \`${s}\`. You can see the change with \`git diff ${i}...HEAD\`.`,...iG(o,i),...Ace(e),...XA(e.inputs,o.descriptions),"",...Btt(e.inputs),..._tt(e.inputs),...c?.requirements?.length?["Requirements:",...c.requirements.map(R=>` - ${R.id}${g.get(R.id)??""}: ${R.statement}`),""]:[],...u.length?["Defects suspected while reading the change:",...u.map(R=>` - ${R.id} (${R.severity}) ${R.file}${R.line?`:${R.line}`:""} \u2014 ${R.claim}`),""]:[],...d.length?["Defects the base already has, in code the change left as it was: not this change's. Write no test that fails on them;","if your tests show one, report it as existing (its id as the issue's finding):",...d.map(R=>` - ${R.id} (${R.severity}) ${R.file}${R.line?`:${R.line}`:""} \u2014 ${R.claim}`),""]:[],"Test plan. Each case's expected outcome is the one the plan sets, not whatever the app does:",...I.length?I:[" (no new cases)"],"",...oF(p?.questions),...a.maintenance.length?["","Existing tests to maintain:",...a.maintenance.map(R=>` - ${R.action.toUpperCase()} ${vh(e.inputs,R.repository,R.test)} \u2014 ${R.evidence}`)]:[],"",...A?Mur(w):[],...Tur(S,{noApp:A}),...A?Qur(e):Our(e),...E?["For the ui cases you have the Skyramp browser tools (mcp__skyramp__browser_*): look at the real page before you pick locators."]:[],...t.skyrampWalk?kur(t.skyrampWalk):[],...t.skyrampApi?.helper?Bur(t.skyrampApi.decision,t.skyrampApi.helper):[],...t.provisionNotes.length?[`Setup notes: ${t.provisionNotes.join("; ")}`]:[],...t.testPackages?.length?["",...lPe(t.testPackages,{skyrampVersion:A?void 0:$ur(e,t),nodeTests:(A||a.generate.some(R=>R.type!=="ui"))&&Hce(r)})]:[],...t.sharedHelpers?.length?["",...t.sharedHelpers]:[],...Fur(r,e.providedEnvKeys??[]),"","1. Write each test the way the repo already tests that code (the same kind of test, framework, directories, naming,",...A?[" helpers and fixtures), unless that kind cannot check its case in one process; then use the in-process kind that can,"," and where none can, list the case under notWritten with what it needs."]:[" helpers and fixtures), unless that kind of test cannot check its case; then use the kind that can."]," Put each test where the repo's CI will run it. Find out from the repo how its CI runs tests: the step that runs them,"," and what that step's runner picks up. Don't move a test elsewhere, or change the repo's test configuration (import"," mode, paths, conftest), to get round a failure the change itself causes: a test that fails there because of the"," change is the result, reported as its defect. Test code the change adds or edits that does not load (a conftest or"," fixture importing what does not exist) is not such a failure: repair it, the least change that makes it load and no"," assertion touched, and list it under supportFiles.",` For each test you add or update, say under "ci" whether the repo's CI will run it, and how you know:`," the line in a CI file that starts the tests and each line it runs on the way to the test runner,"," the test runner the last of those lines starts,"," and a command that lists the tests that runner collects without running them. Testbot runs that command to confirm."," Where CI will not run a test, say why,"," and name it in ciNotes with the exact change the author must make for CI to run it."," Reuse the repo's helpers, page objects and fixtures, and put yours where someone who knows this repo would look for"," them: never write your own version of a helper the repo already has \u2014 import it."," A helper only one test file uses stays in that file, unless the repo keeps that kind in its own module (a page object"," per page, say). A helper two or more test files use \u2014 yours, or one you take from another test file \u2014 is defined"," once, where the repo keeps shared helpers for those tests: usually the support module they already import, or a new"," module beside it when that one no longer fits (say the repo splits its helpers by area, or the module has grown"," large); where there is none yet, beside the tests that use it.",` Name a new module for what it holds, not "utils" or "Skyramp". Add to the repo's helpers and page objects what your`," tests need, and leave the code already there as it was unless this change breaks it. Use every name you import."," Testbot delivers only the tests you list and the files under supportFiles:"," list there each helper module, page object, fixture or snapshot you add or change for them."," Where the repo's browser tests reach its pages through page objects,"," so do yours: locate a page's elements in its page object, the way its existing members locate theirs, and add a page"," object, where the repo keeps them, for a page that has none. Find an element by its role and name, label or test id;"," when a locator matches more than one element, narrow it to the one you mean (inside its row, dialog or region, or by"," its text) rather than taking .first(), .last() or .nth(). Find that row, dialog or region the same way, by its role,"," label or test id, not by climbing the page's markup (an XPath ancestor or parent step, a positional div[n]): a layout"," change breaks that. Pick by position only where the order is what the test checks.",...A?[" Write in-process tests the way the repo's own unit and in-process tests are written. The repo's existing tests"]:[" Don't add unit tests (a function or module called directly, its collaborators mocked). The repo's existing tests"]," are for maintenance only: update the ones the change makes wrong \u2014 the maintenance list is where to start, step 4"," finds the rest \u2014 above all any that assert as correct what the plan says is a defect, rather than writing a new"," one beside it."," Keep each requirement's check on its own, so one failure can't hide another: give it its own test or assertion,"," and stub or seed any data its setup needs that a different defect could break (a list the page loads, a shared"," helper that rejects the response before your assertion reads it). A test that shows a defect asserts the outcome"," its case expects \u2014 all of it, since that is what tells the defect apart (a 400 where the app answers 404, a total"," that still adds up), and nothing more \u2014 one defect per test, so it passes once that defect is fixed. Give a"," defect's case its own test rather than folding it into a broader test of the same clause."," Check the outcome a case expects itself, not a sign of it, in the kind of test you are writing: a value that is"," saved, read back; something that is shown, checked where it is shown; a status code alone shows only that a"," request was answered."," For each requirement the PR or spec states, ask how the change could get it wrong while your tests still pass:"," another status or message than the one it states, a value left behind, the result kept somewhere other than where"," the user reads it, a path (an undo, a reset, an input it refuses) that no test takes. Where it could, add the check"," that would catch it, within what the requirement states."," For each element or field the change adds, assert that it is there (shown, or present in the response); clicking"," or filling it is not an assertion. For each it removes or renames, assert that it is gone: not shown, a count of 0,"," the field missing, a 404, the old option no longer offered."," Where a case's steps give the exact requests, send them as they are rather than working them out again, and keep"," those tests together in one file.",...A?[]:[" A test runs against a fresh app, and again against one it already ran on. It makes the data it needs in its own"," setup (a file to share, a record to edit) rather than relying on what exists only because this run made it, in the"," plan's probes or here; what the app's setup recipe creates is there in CI too. It signs in as an account the setup"," recipe or the run's login variables provide, or one it creates in its own setup. A value the app keeps unique (a"," name, slug, SKU, email) is made unique to the run, the one change to a case's exact requests, and the test finds"," and asserts by the value it sent. When it ends, failed or not, it deletes what it made, through the API where it can."," Some tests set up something outside their own process that another test could run into: data they create in the",` app, a Skyramp mock, an env override. Record it in the test's "context", and give the test an "isolatedRun", the`,' command that runs only that file. For data it creates, add a "cleanup": a command that removes that data, through'," the API like the test's own cleanup, if the test stops before its own cleanup runs. Testbot runs each such test"," alone after you finish, then its cleanup, and keeps that result. These commands run without a shell, with the same"," env as your test runs."]," The plan is where to start, not the limit: if you notice something else the change should do, or could break,"," while you write and run these, test that too, filed under the plan requirement it guards. A test of what it could"," break that passes stays only when it is the one test of its requirement; remove one that another of your tests",' already covers, and list its case under notWritten with a reason that starts "Passing:" and says what it checked \u2014'," never a journey's test, which stays whether it"," passes or fails. Where nothing says what should happen, only decide it for what"," the change does; how older code treats odd input is not this PR's to test. One case for each kind of input is"," enough: add another only where it could fail while the first passes.",A?"2. Run the tests you wrote together, once, in the foreground, with a short per-test timeout so a hung test fails":`2. Run the tests you wrote together, once (a test with a context on its own, by its isolatedRun), in the foreground,
678
- with a short per-test timeout so a hung test fails`,` fast; wait for the run to finish (one Bash call may run up to ${qG} minutes), and don't end the session with a test`," run still going: the session is non-interactive and ends when you stop, so nothing would report its result."," A run that never finishes (the runner hangs or times out as a whole, not one test failing) is the environment's,"," not your tests': don't run it again with a longer timeout. Record those files as not run (exit null), with the",` runner's last output as the failure, and go on with the rest.${Lur(e)}`,"3. For each failure, work out whose fault it is, and settle it outside the test before you call it a defect. The"," outcome the test expects must be one the PR, spec, code or plan requires, not one you chose: an exact status where only a"," refusal is required, a message or format nothing states, a value read from a column picked by position. Where only"," part of it is required, assert only that part. A failure before the step that checks the case (sign-in, setup,"," seeding, a helper, an element not found, a timeout) is the test's until you have seen the app do it wrong: look at"," the page or send the request yourself, and find the line of application code that does it."," If the test checks what its case requires and the app does something else, that's a defect in the change: keep the"," test as written, mark the case and its file as a defect, and report the bug with that line. Never change an expected"," outcome to match what the app does. If the test itself is wrong (selector, setup, data, import, timing, an outcome"," nothing requires), fix it and re-run only the tests that failed (e.g. pytest --lf, playwright test --last-failed, or"," by name); a failing case you could not fix is marked defect: false, never a defect. Give each failing case the",` runner's failure as it printed it ("failure"), and each case you keep as a defect its "cause", the application line,`,` and "requires", the words of the PR description, a requirement or clause of the plan, or the code a finding's "keeps" names, that state what its failing check expects \u2014`,` or, for a case whose finding names a rule every app keeps under "rule", that rule's sentence whole: ${xN()}`," quoted. When no words state it, the check asserts more than is required: assert only what is, and re-run it."," Keep each run's full output and the runner's own report (JUnit XML or JSON) in a file under /tmp, and read what"," failed from that file rather than running the tests again to see more: output piped through grep, tail or head is"," lost to the next look. Re-run only the tests that failed, by name. Don't re-run the whole set at"," the end: the results you already have stand.","4. Then run the repo's existing tests that reach the code the change touches, the way its CI runs them (its command"," and environment), selected as narrowly as still covers that code: the whole suite only when it runs in a few"," minutes. Run each once, its output kept as above. For each one that fails, find out whether this change made it"," fail; when you can't tell, run it on the base branch in a scratch copy outside the"," checkout (e.g. git worktree add under /tmp). One that asserts behaviour the change deliberately replaced is stale:"," update it, or delete it where the behaviour is gone, and re-run it; give staleBecause for it \u2014 the requirement the"," change deliberately alters and the changed line of application code (path:line) that alters it. One that catches"," something the change breaks is a defect: leave it failing and report it. Leave alone failures the change did not cause.","5. If the repo has a linter or formatter for test code, run it on your files of the kinds its lint script covers (one"," that lints `--ext js,jsx` never lints a .ts spec), and record the exact command you ran: Testbot re-runs it, and"," sends back what it still reports. Run each linter the repo configures for your files (a formatter alone is not one),"," with the repo's own config, from the repository: a copied config matches its file patterns where the copy is."," The application's manifests and"," lockfiles are its owner's: a test in the repo's own framework uses only what the repo already declares, and you"," never add, upgrade or remove a package in the application's own manifests or lockfiles for Testbot's tests.",A?" For the app's code, reach it the way the repo's in-process tests do (its test client, fixtures and helpers).":" For calls to the app, use the client and helpers the repo's existing tests use for that service."," A browser test goes in the repo's own browser suite where it has one (Selenium, Cypress, Capybara), with its page objects."," Tooling the repo doesn't declare (Playwright where it has none) goes in the Testbot test package"," above, never in the application's manifests; with no such package, write the test with what the repo has."," The one exception is a test that must run inside the application's existing test environment and cannot"," without a package it lacks: add it to the manifest of the checkout the test is in, keep the manifest's"," constraints, upgrade nothing else, update that manifest's lockfile with its own package manager (the updated lockfile"," must name the added package), run the existing tests of that environment, and list it in dependenciesAdded"," with the reason and the manifest's path relative to its checkout; for another checkout of the change,"," name that checkout as the entry's repository (its owner/repo).","",'In your result, give each file you added or updated its "functions": each test function in it as the runner names',"it, with the plan case ids it checks, so that every case it covers is checked by a function you name. Give each","issue its plan finding id and the requirement or clause ids it violates. Name each test for what it checks: no plan","id in a test's name or title, except a label the description or spec itself gives the requirement (AC-3).","","Apart from that scratch copy, stay inside the checkout and leave it on the commit it is on,","with the change's files in place: run or read the base in the scratch copy (or with git show <commit>:<file>), never","by checking the checkout out, resetting or stashing it. Don't commit or push, and leave the tests in the working tree.",`Once you've run the tests the first time, write your result as JSON (below) to ${t.checkpoint}, and keep it current`,"as you go: that file is what's","read. End with a one-line final message \u2014 don't repeat the JSON in it. The report is read by the PR author: describe","their code, not this process.","",Iu(Fr)].join(`
678
+ with a short per-test timeout so a hung test fails`,` fast; wait for the run to finish (one Bash call may run up to ${qG} minutes), and don't end the session with a test`," run still going: the session is non-interactive and ends when you stop, so nothing would report its result."," A run that never finishes (the runner hangs or times out as a whole, not one test failing) is the environment's,"," not your tests': don't run it again with a longer timeout. Record those files as not run (exit null), with the",` runner's last output as the failure, and go on with the rest.${Lur(e)}`,"3. For each failure, work out whose fault it is, and settle it outside the test before you call it a defect. The"," outcome the test expects must be one the PR, spec, code or plan requires, not one you chose: an exact status where only a"," refusal is required, a message or format nothing states, a value read from a column picked by position. Where only"," part of it is required, assert only that part. A failure before the step that checks the case (sign-in, setup,"," seeding, a helper, an element not found, a timeout) is the test's until you have seen the app do it wrong: look at"," the page or send the request yourself, and find the line of application code that does it."," If the test checks what its case requires and the app does something else, that's a defect in the change: keep the"," test as written, mark the case and its file as a defect, and report the bug with that line. Never change an expected"," outcome to match what the app does. If the test itself is wrong (selector, setup, data, import, timing, an outcome"," nothing requires), fix it and re-run only the tests that failed (e.g. pytest --lf, playwright test --last-failed, or"," by name); a failing case you could not fix is marked defect: false, never a defect. Give each failing case the",` runner's failure as it printed it ("failure"), and each case you keep as a defect its "cause", the application line,`,` and "requires", the words of the PR description, a requirement or clause of the plan, or the code a finding's "keeps" names, that state what its failing check expects \u2014`,` or, for a case whose finding names a rule every app keeps under "rule", that rule's sentence whole: ${xN()}`," quoted. When no words state it, the check asserts more than is required: assert only what is, and re-run it."," Keep each run's full output and the runner's own report (JUnit XML or JSON) in a file under /tmp, and read what"," failed from that file rather than running the tests again to see more: output piped through grep, tail or head is"," lost to the next look. Re-run only the tests that failed, by name. Don't re-run the whole set at"," the end: the results you already have stand.","4. Then run the repo's existing tests that reach the code the change touches, the way its CI runs them (its command"," and environment), selected as narrowly as still covers that code: the whole suite only when it runs in a few"," minutes. Run each once, its output kept as above. A run that does not finish (it hangs, or waits on a network or"," service this run cannot reach) has its result too: note where it stopped, run by name only the tests in it that"," reach the change, with any they depend on, and don't run the whole of it again. For each one that fails, find out"," whether this change made it fail; when you can't tell, run it on the base branch in a scratch copy outside the"," checkout (e.g. git worktree add under /tmp). One that asserts behaviour the change deliberately replaced is stale:"," update it, or delete it where the behaviour is gone, and re-run it; give staleBecause for it \u2014 the requirement the"," change deliberately alters and the changed line of application code (path:line) that alters it. One that catches"," something the change breaks is a defect: leave it failing and report it. Leave alone failures the change did not cause.","5. If the repo has a linter or formatter for test code, run it on your files of the kinds its lint script covers (one"," that lints `--ext js,jsx` never lints a .ts spec), and record the exact command you ran: Testbot re-runs it, and"," sends back what it still reports. Run each linter the repo configures for your files (a formatter alone is not one),"," with the repo's own config, from the repository: a copied config matches its file patterns where the copy is."," The application's manifests and"," lockfiles are its owner's: a test in the repo's own framework uses only what the repo already declares, and you"," never add, upgrade or remove a package in the application's own manifests or lockfiles for Testbot's tests.",A?" For the app's code, reach it the way the repo's in-process tests do (its test client, fixtures and helpers).":" For calls to the app, use the client and helpers the repo's existing tests use for that service."," A browser test goes in the repo's own browser suite where it has one (Selenium, Cypress, Capybara), with its page objects."," Tooling the repo doesn't declare (Playwright where it has none) goes in the Testbot test package"," above, never in the application's manifests; with no such package, write the test with what the repo has."," The one exception is a test that must run inside the application's existing test environment and cannot"," without a package it lacks: add it to the manifest of the checkout the test is in, keep the manifest's"," constraints, upgrade nothing else, update that manifest's lockfile with its own package manager (the updated lockfile"," must name the added package), run the existing tests of that environment, and list it in dependenciesAdded"," with the reason and the manifest's path relative to its checkout; for another checkout of the change,"," name that checkout as the entry's repository (its owner/repo).","",'In your result, give each file you added or updated its "functions": each test function in it as the runner names',"it, with the plan case ids it checks, so that every case it covers is checked by a function you name. Give each","issue its plan finding id and the requirement or clause ids it violates. Name each test for what it checks: no plan","id in a test's name or title, except a label the description or spec itself gives the requirement (AC-3).","","Apart from that scratch copy, stay inside the checkout and leave it on the commit it is on,","with the change's files in place: run or read the base in the scratch copy (or with git show <commit>:<file>), never","by checking the checkout out, resetting or stashing it. Don't commit or push, and leave the tests in the working tree.",`Once you've run the tests the first time, write your result as JSON (below) to ${t.checkpoint}, and keep it current`,"as you go: that file is what's","read. End with a one-line final message \u2014 don't repeat the JSON in it. The report is read by the PR author: describe","their code, not this process.","",Iu(Fr)].join(`
679
679
  `)}function $ur(e,t){let r=t.skyrampApi?.helper?.env.SKYRAMP_API_SDK;return r&&t.skyrampApi?.decision.placement==="test-package"?s2(r):VR(e)?sM(e.inputs.skyrampMcp):void 0}function Ax(e,t,r){let n=pr.join(e.outputsDir,t);return eo.writeFileSync(n,JSON.stringify(Br(r,e.secretValues??[]),null,2)+`
680
680
  `),pr.relative(e.runDir,n)}function qur(e,t){return gK(t.dependenciesAdded??[],Cl(e.inputs.repositoryPath,e.inputs.relatedRepos??[])).added}function vnt(e,t){let r=e.prepared?.dependencyBaseline??new Set;return[...Crt(e,t,r),...vrt(e)]}var Gur={name:wnt,verify(e,t){let{value:r}=yr(Fr,t.stdout,nr(e),e.secretValues);if(!r)return{name:this.name,passed:!0};let n=vnt(e,qur(e,r));return n.length?{...or(this.name,n),repairable:!0}:{name:this.name,passed:!0}}};function jur(e,t){let r=me(e,_a);if(!r)return[];let n=t.tests.map(i=>i.file),s=r.packages.filter(i=>{try{let o=cPe(e.inputs.repositoryPath,i,n);return o&&Es(e).info(`[write] no test went in the new test package ${i.dir}: removed it`),!o}catch{return!0}});return Cnt(e,s),s}function Hur(e,t){let{write:r,settled:n}=ott(t);n.length&&Es(e).warn(`[write] failed before any check, with no application line \u2014 not a defect: ${n.join(", ")}`);let s=Bnt(e),{write:i,settled:o}=ptt(r,s.texts,s.rules);o.length&&Es(e).warn(`[write] quoted no requirement for what its failing check expects \u2014 not a defect: ${o.join(", ")}`);let a=Un(e)?oet(i,lx(e).browserJourneys):i;jur(e,a);let c=AK(a,e.inputs.repositoryPath,e.inputs.relatedRepos??[],bG(e,a)),l=vnt(e,c.finalize.dependencies.added);l.length&&(c.finalize.ready=!1,c.finalize.blockers=[...c.finalize.blockers,...l.slice(0,4)]);let u=Nce(e,a,e.prepared?.dependencyBaseline??new Set);u.length&&(c.finalize.ready=!1,c.finalize.blockers=[...c.finalize.blockers,...u.slice(0,4)]),c.dropped.length&&Es(e).warn(`[write] not on disk, left out of adapt.json: ${c.dropped.join(", ")}`),c.ambiguous.length&&Es(e).warn(`[write] in both the repo under test and a related checkout, kept the repo under test's: ${c.ambiguous.join(", ")}`);let d={write:Ax(e,"write.json",a),adapt:Ax(e,"adapt.json",c.adapt),generate:Ax(e,"generate.json",c.generate),"generate-ui":Ax(e,"generate-ui.json",c.generateUi),finalize:Ax(e,"finalize.json",c.finalize),deliverable:Ax(e,cae,QZe(e))};return NOe(e),{artifacts:d,placed:c.placed}}function Kce(e){return!Un(e)&&(!!e.inputs.appRunning||cF(me(e,"deploy.json")))}var Xce=e=>({...rle(e),...e.sutAuthEnv??{}});function zur(e,t){let r=AK(t,e.inputs.repositoryPath,e.inputs.relatedRepos??[]),n=new Map(t.tests.map(o=>[o.file,o])),s=r.placed.map(o=>({file:o.written,context:n.get(o.written)?.context})),i=new Map(r.placed.map(o=>[`${o.repository??""}\0${o.file}`,n.get(o.written)]));return{planned:COe(e.inputs,s,r.adapt.items.map((o,a)=>({...o,from:r.placed[a].written}))),written:o=>i.get(`${o.repository??""}\0${o.file}`)}}function Vur(e,t){return e.exit===0?e.covers.map(r=>({case:r,status:"pass"})):t&&t.result.exit!==0?t.result.cases.map(r=>({case:r.case,status:r.status})):[]}async function xnt(e,t){let{artifacts:r,placed:n}=Hur(e,t);if(Un(e))return r;let s=new Map(n.map(o=>[o.written,o])),i=await Yet({write:t,outputsDir:e.outputsDir,resolve:o=>{let a=s.get(o),c=a&&pr.resolve(a.root,a.file);return a&&c&&eo.existsSync(c)&&eo.statSync(c).isFile()?{abs:c,root:pr.resolve(a.root),file:a.file,...a.repository?{repository:a.repository}:{}}:void 0},env:{...rle(e),...e.sutAuthEnv??{}},...e.deadlineMs!==void 0?{deadlineMs:e.deadlineMs}:{},...e.signal?{signal:e.signal}:{}}).catch(o=>{Es(e).warn(`[write] recording the browser tests' videos failed: ${o instanceof Error?o.message:String(o)}`)});return i?.skipped.length&&Es(e).info(`[write] no video for ${i.skipped.map(o=>`${o.fileName} (${o.reason})`).join(", ")}`),{...r,...i?{"ui-videos":pr.relative(e.runDir,pr.join(e.outputsDir,Ef))}:{}}}function rle(e){let t={};try{let n=Un(e)?nle(e):[],s=sN(n.flatMap(({job:i})=>i.toolSteps),process.env,void 0,nN(yf,e.inputs.repositoryPath));t={...n.length?UXe(e.outputsDir):{},...s.env}}catch{}let r=e.prepared?.appUrls?.env??{};try{return{...OXe(PE($l(e.inputs.repositoryPath))),...t,...r,...Af}}catch{return{...t,...r,...Af}}}function nle(e){let t=new Map;for(let{repo:r,run:n}of Vae(e)){let s=gG(zm(r),n.cwd,n.argv);s&&t.set(`${r}\0${s.workflow}\0${s.job}`,{repo:r,job:s})}return[...t.values()]}function Wur(e){let t=sN(nle(e).flatMap(({job:n})=>n.toolSteps),process.env,void 0,nN(yf,e.inputs.repositoryPath)),r=t.missing.map(n=>`${n.tool} ${n.version}`);return[...t.notes.length?[`The CI test job's tool versions are first on PATH for you and for native-run (${t.notes.map(n=>n.replace(/^provisioning: /,"")).join("; ")}).`]:[],...r.length?[`The CI test job sets up ${r.join(", ")}, which this runner does not have: a test that needs it cannot run here, and native-run reports it as blocked by the environment. That is not a defect: change no code or test for it.`]:[]]}var Int="write-stale-updates",Jur={name:Int,verify(e,t){let{value:r}=yr(Fr,t.stdout,nr(e),e.secretValues);if(!r)return{name:this.name,passed:!0};let n=Cl(e.inputs.repositoryPath,e.inputs.relatedRepos??[]),s=E=>{let A=n(E);return xo(A)?vh(e.inputs,A.repository,A.rel):E},o=[{path:e.inputs.repositoryPath},...e.inputs.relatedRepos??[]].flatMap(({path:E,slug:A})=>{try{return(0,Ant.execFileSync)("git",["-C",E,"diff","--name-only","--diff-filter=d","HEAD"],{encoding:"utf-8"}).split(`
681
681
  `).filter(w=>w&&Ou(w)&&!w.startsWith(".skyramp/")).map(w=>vh(e.inputs,A,w))}catch{return[]}}),a=r.tests.filter(E=>E.change!=="added"&&E.change!=="deleted").map(E=>({file:s(E.file),changed:E.change!=="unchanged",ran:E.result.exit!==null})),c=WQe(o,a),l=r.tests.filter(E=>E.change==="updated");if(!l.length)return eo.writeFileSync(pr.join(e.outputsDir,rC),`[]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyramp/testbot-core",
3
- "version": "0.13.0-v3.255",
3
+ "version": "0.13.0-v3.256",
4
4
  "description": "Skyramp Testbot engine: AI-powered deterministic test generation, execution and maintenance",
5
5
  "main": "dist/main.js",
6
6
  "//files": "An explicit allowlist, never a glob. `dist/` is gitignored, so without this key npm's .gitignore fallback would publish a package with no engine in it; with a glob it would publish the sourcemaps, whose sourcesContent embeds every src/*.ts verbatim. dist/VERSION.json exists only in a release-engine.yml build.",