@skyramp/testbot-core 0.13.0-v3.115 → 0.13.0-v3.116
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/VERSION.json +1 -1
- package/dist/main.js +3 -3
- package/dist/post.js +3 -3
- package/package.json +1 -1
package/dist/VERSION.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.13.0-v3.
|
|
1
|
+
{"version":"0.13.0-v3.116","commit":"8d70ca8184e7cd2b3687e60c46c011857b7b8f68"}
|
package/dist/main.js
CHANGED
|
@@ -784,8 +784,8 @@ ${a.body.slice(0,6e3)}
|
|
|
784
784
|
${nwr(t,e)}`}function nwr(t,e){if(t.inputs.appRunning)return[`${t.inputs.appRunning.trim()} Don't start it again: check it answers a real request with real data, and fill "app" with outcome clean (or bringup-failed, with why, if it doesn't answer) and its base URLs.`,e.revisionRead].filter(Boolean).join(`
|
|
785
785
|
`);let r=t.inputs.repositoryPath,n=e.recipe;return n.present?[`Bring the app up so the tests can run against it, and leave it running. The repo records how: ${[n.setupScript,n.teardownScript,n.authTokenScript,n.workspaceFile].filter(i=>!!i).map(i=>qi.relative(r,i)).join(", ")}.`,"Run it. If it has drifted, fix it and update those files to what actually worked. If this PR broke start-up, that's","a defect \u2014 say which changed file. Check that the app answers a real request with real data, not just an open port.",...n.budgetMinutes?[`Start-up can legitimately take up to ${n.budgetMinutes} minutes.`]:[],...n.healthHint?[`A known-good health check: ${JSON.stringify(n.healthHint)}`]:[],...n.stale?[`This PR changes start-up files (${n.staleFiles.join(", ")}), so the recipe may be out of date.`]:[]].join(`
|
|
786
786
|
`):["Bring the app up so the tests can run against it, and leave it running. The repo has no recorded way to start it","(.skyramp/sut/setup.sh). If you can start it from the repo's own docs or compose files without much effort, do, and","save what worked as .skyramp/sut/setup.sh and .skyramp/sut/teardown.sh. Otherwise set app.outcome to bringup-failed and say why."].join(`
|
|
787
|
-
`)}var tW=t=>!!t.appRunning&&Lc(t),swr=new Set(["mutates"]);function iwr(t){return tW(t.inputs)?[" The app runs in a shared environment this policy protects. A case or clause whose test changes state there (an"," API POST, PUT, PATCH or DELETE, in the test or its setup, or a UI flow that submits, creates, edits or deletes) is"," withheld by the runner and reported as a gap: prefer cases that only read, and mark each that still changes state,",' and each such maintenance item, "mutates": true.']:[]}function owr(t,e){if(t.inputs.planOnly)return[];if(!t.inputs.appRunning&&e.preflight&&!e.preflight.sutRequired)return[];let r=qi.join(qi.dirname(e.checkpoint),"probe");return tW(t.inputs)?["8. Only under runtime_required: probe the running app before any test is written (skip this and 9 if it isn't"," answering). It is a shared environment this policy protects: send only requests that change nothing (GET and"," HEAD: reads, lists, searches, filters, sorts) and never create, edit, delete, reset or seed anything there. Put",` every probe in one script under ${r}* and run it once, printing one line per probe: what it read, the status`," codes, and which check failed. Probe what the change touches through reads: every state its records can be in,"," every field it adds through list, sort, filter and search, and odd query values (zero, negative, huge, empty, case"," variants). Flag any 5xx, and reads that disagree with each other or with derived values (totals, counts).","9. Re-run each flagged probe once. Each that repeats and involves what the change touched is a defect: add it to",' "findings" with the request and response as its evidence, and a case for it. Then write the updated plan to',` ${e.checkpoint} again.`]:["8. Only under runtime_required: probe the running app before any test is written (skip this and 9 if it isn't"," answering). Put every probe in one",` script under ${r}* and run it once, printing one line per probe: what it did, the status codes, and which`," check failed. Probe what the change touches:"," - every state its records can be in (from the code's status fields and enums) \xD7 every operation the change adds or alters;"," - sequences: write then read back; set, reset, read; edit twice; delete then edit; write then list;"," - payloads: zero, negative, huge, empty, null, missing and extra fields, wrong types, case variants, more items"," than a page holds, one valid and one invalid item together;"," - every field the change adds, through the existing list, sort, filter and search."," Read the record before and after each action. Flag any 5xx; a rejected request that changed anything; a read that"," differs from what was written; a repeated request that changed something more; derived values (totals, counts)"," that disagree with their inputs; an operation that succeeds on a record in a final state (cancelled, shipped, deleted).","9. Re-run each flagged probe once. Each that repeats and involves what the change touched is a defect: add it to",' "findings" with the request and response as its evidence, and a case whose steps are that request sequence and',` whose expected outcome is the correct behaviour. Then write the updated plan to ${e.checkpoint} again.`]}function Cmt(t){let e=Hn(t);return e?Qfe(Vu(e,"").map(r=>r.path)):[]}function EAe(t){let e=Cmt(t);if(!e.length&&!Lfe(t.inputs.repositoryPath))return[];let r=e.slice(0,8).join(", ")+(e.length>8?", \u2026":"");return[' User journeys: under "journeys", the flows a user walks through the UI, each from where a user normally starts it'," to the outcome they came for, that together pass through everything the change alters that a user sees or does:"," every ui clause is in some journey's steps (or under notInJourney, with why no journey reaches it). Use as many"," journeys as that takes. For each: the entry route; every step in order, with the clauses it exercises and what the user then sees;"," the outcome that shows the journey worked; its source \u2014 the spec or PR description that describes the flow (quote it),"," else inferred; and the test file it belongs in. Each becomes one test of the whole flow as the PR intends it (its kind):"," in-process only where the repo's own in-process UI tests (component tests under jsdom or the like, for that code) can"," walk and check all of it \u2014 a request-level test client (Django's, Flask's, Rails integration tests) runs no page script"," and does not count \u2014 else a browser test, which needs the running app, so the decision is runtime_required (step 4)."," The changed step is inside the flow, not the whole of it: the
|
|
788
|
-
`)).map(i=>i?` ${i}`:""))([...vge(t,e.triage.change),"",...Rge(t,e.triage),...r?["",`Run budget: ${r} minutes for the whole run, including everything you plan. Name in gaps what it cannot cover.`]:[],"","Scope: validate what this change alters or newly reaches, and what the PR description or a spec states.","- Out of scope is only a clause the change cannot reach: its deciding code is unchanged and no changed path leads to it, or it lives in a checkout the change does not touch. List it under outOfScope with the unchanged line that decides it (path:line), and plan nothing for it. Code the change newly calls or feeds new values to is in scope, and so is a defect it exposes there.","","The evidence ladder \u2014 use the cheapest mechanism that establishes each clause in scope:"," existing_evidence an accepted ci-<n> result. A check you ran (typecheck, compile, test collection) establishes only a prerequisite clause \u2014 that the change builds or its config parses \u2014 never a behaviour"," unaffected the change cannot reach this clause: no changed code path leads to it \u2014 cite the code that shows it (path:line); never for a clause decided in a changed file"," existing_unit existing native unit tests that exercise the clause"," new_unit a new in-process test, for evidence nothing provides yet"," runtime only the running application can establish it","A clause only the running app can check is runtime, not a gap, even when every other clause is in-process. It is a gap only when the app cannot be run here; then name what is missing.","Give each clause the kind of test the repo already uses for the code it checks \u2014 in-process where the repo tests that code in-process, runtime where it tests it against the running app \u2014 unless that kind cannot check it; then the kind that can.",`Browser-only: for every clause, ask whether its behaviour happens only in a browser \u2014 real clicks or keys driving page script, client-side sorting or filtering, script-driven DOM updates, focus, drag-and-drop, navigation, rendering that depends on CSS or JavaScript \u2014 and if so mark it browserOnly. A test that only checks markup (a class or attribute present, the HTML a request returns) proves the precondition, not the behaviour: the header having the sort class does not show that "clicking a column header sorts the list". A browser-only clause is tested in a browser: in the repo's in-process browser harness where it has one \u2014 a Django LiveServerTestCase or StaticLiveServerTestCase, or pytest-django live_server, suite that drives Selenium or Playwright; component tests under jsdom only when the repo's own jsdom tests already drive that kind of interaction \u2014 named as its browserHarness (the suite's path), and the clause stays new_unit, with its triage item's covers saying it is driven in that browser suite; else decide runtime_required with a browser test of it. A markup check may be added, not substituted.`,"","Decisions:","- existing_evidence_sufficient means every clause in scope is established by existing evidence, with no gaps.","- targeted_unit plans unit tests and nothing that needs a running app.","- runtime_required marks at least one clause runtime, and plans no new unit tests: once the app is needed, this plan's cases are every new test, each still written the way the repo tests that code \u2014 in-process where that can check its clause, in the browser only where it cannot. The existing unit tests you identify still run, as existing_unit.","- The journeys and maintenance of step 5 can need the app too, so plan them before you decide. Decide runtime_required when any journey needs a browser \u2014 real JavaScript or htmx behaviour, navigation across pages, what persists after a reload, or a server-rendered page the repo tests only at the request level \u2014 and mark runtime the clauses its steps exercise.",'- Decide runtime_required as well when any test under "maintenance" calls the deployed app \u2014 API, contract, integration, end-to-end or UI tests that reach it at its address (BASE_URL or the like), and Skyramp tests \u2014 and checks what the change itself alters, and mark runtime the clauses it checks, so it is verified against the app. So does a browser part the plan itself says goes untested, and a browser-only clause the repo has no in-process browser harness for.',"- A test that starts its own live server in the test process and drives it in a browser (Django's LiveServerTestCase or StaticLiveServerTestCase, pytest-django's live_server, with Selenium or Playwright) needs no deployed app: under targeted_unit it is maintained and run in-process, with the repo's CI settings and a headless browser.","- When the app cannot be run here, list each such journey's clauses under notInJourney, and each such test under gaps, with what is missing: it is reported not covered, never dropped. So is a browser-only clause with no in-process browser harness: name it under gaps with what is missing.","- Only what the change itself alters decides it. A journey or browser-only clause only for what the change could break elsewhere (a could-break requirement), or for UI code the change does not touch when it touches no UI code, does not make the decision runtime_required: off the runtime path list its clauses under notInJourney and the browser-only ones under gaps, with what is missing (a browser, downstream of this change), so it is reported not covered. Nor does a maintained test that calls the deployed app only for such clauses: give each maintained test the clauses it checks, and name such a test under gaps with what is missing (the running app, downstream of this change).","- blocked_preflight: the change cannot meet a basic prerequisite. It names the changed file the failure is in and quotes the error, and plans nothing. A check that fails for an environment reason (a dependency not installed, a missing tool) is not the change failing \u2014 never block on it.","","Rules:","- Every clause is planned, listed in gaps, or listed under outOfScope, by its id (R1a). A gap is evidence this run cannot obtain; a test this run will execute (existing_unit, new_unit, runtime) is not one, even when you could not run it while planning.","- Only accepted ci-<n> items, and passing checks you ran for prerequisite clauses, can establish a clause. A stale, untrusted, pending, failing or inconclusive result establishes nothing; a trusted result that failed is a reason to plan evidence, never a pass. AI review is advisory, never evidence.","- Find the existing tests yourself: where the repo keeps tests of the changed code, and their framework.",'- Existing tests that call a running app (API, contract, integration, end-to-end or UI tests) are never evidence: list them in "maintenance" (verify, or update).',"- Repository evidence is only native unit tests, which run without the app. Every repository evidence item lists its tests as repo-relative paths (path::test-name when the file holds more than the relevant ones) \u2014 only the tests that exercise the changed behavior, never the whole suite.",`- ${bj}`,`- ${uR}`,"- Every repository evidence item is run: cite it from an existing_unit item for the clauses it exercises. Only under existing_evidence_sufficient is nothing run: cite it from the existing_evidence item it supports instead.","- Plan new_unit only for what no existing test asserts, or asserts differently from the requirement (the boundary the change moved); never for what existing tests already prove.","- When the PR description or a spec states the expected behavior, plan evidence for what it states, not for what the code does.","- Evidence items are existing repository tests (source repository) and checks you ran with Bash (source testbot), each with a unique id; the ci-<n> results above are not restated. Run each check as one plain command \u2014 no `&&`, pipes or `echo` \u2014 and copy it into its evidence exactly. Don't start the application, install dependencies or run test suites for triage."])]}function cwr(t){let e=t.prepared,r=t.inputs.repositoryPath,n=e.preflight?.repository.currentBranch??"HEAD",s=e.preflight?.repository.baseBranch??t.inputs.baseBranch??"origin/main";return["Plan functional tests for this PR. You won't write the tests: another session will, working from your plan alone,","so whatever it needs has to be in the plan.","",`The repo is at ${r}, checked out on branch \`${n}\`. You can see the change with \`git diff ${s}...HEAD\`.`,"Ignore .skyramp/ \u2014 it is Skyramp's own setup, not part of the change.",...xAe(t),...Gl(t.inputs),...gmt(t.inputs),...ymt(t.inputs),"","1. Read the change: the diff, the description, and any spec, issue or design doc either of them points to.","2. List the requirements: everything the description or a spec states or clearly implies and, where they say"," nothing, what the change is evidently meant to do. Split each into independently testable clauses: each input"," class, boundary, error path, and anything that must stay unchanged. For each clause, write the expected outcome.",` Each requirement's id is the label the description or spec gives it ("AC-3", "REQ-12"; item 4 of a numbered list`," is R4), else R1, R2\u2026 in order, numbering on after the highest R-label the source uses (R6 after its R5). Where two"," items give the same label, put the item's key in front (PAY-184-AC1, PAY-185-AC1). A clause id is its"," requirement's id plus a letter (AC-3a), and each id is used once. Every case, clause and journey step keeps these"," ids and names a clause or finding the plan has; a finding names the requirement or clause it breaks."," Where the description or spec sets it, it wins over the code: if they disagree, the code is what's wrong. Where"," nothing is stated, take it from the change's evident intent; code that contradicts that intent, or itself"," elsewhere, is still a defect. Where the outcome is left open, expect only what any correct implementation must"," do, and say so."," Then list what the change could break that no requirement mentions \u2014 other callers of the functions it changed,"," other paths that read or write the same data, behaviour right next to the change \u2014 and add each as a requirement"," of its own (source could-break, evidence the code it could break), with its clauses.",' For each clause, give under "code" the path:line of the code that decides it, when there is one.',"3. Note every defect you find in the change, with the line that shows it.",...awr(t,e),"5. Only under runtime_required, and only for the clauses your triage marks runtime and the defects: write the test",' plan. Under any other decision leave "cases" empty and give no clause a test: the evidence'," comes from triage's plan."," Write the test plan on the clauses themselves: each clause gets the test that checks it (type, target, steps;",` its expected outcome is the clause's, and its kind the one the repo already uses for that code, unless that kind cannot check it), or, on the clause, why it can't be tested here. Add to "cases" a second`," test for a clause where one is needed, and one case for every defect you found \u2014 even where a clause's test"," covers the same ground. A defect's case reaches the defect itself (the state, input or sequence that shows it)"," and expects the correct behaviour, so it fails on this branch; where the requirement allows more than one correct"," outcome (reject, or cap), it accepts each of them, so it passes on any fix.",' Under every decision, list under "maintenance" the existing tests you can see the change makes wrong or stale,'," and whether to update, delete, regenerate or just re-run (verify) each \u2014 a starting point: the step that writes"," the tests runs the affected tests and finds the rest. One that calls the deployed app to check what the change itself alters makes the decision runtime_required (step 4); a live-server test, which runs in-process, does not.",...EAe(t),`6. Write the plan as JSON (below), "triage" included, to ${e.checkpoint} now, before anything is started.`,`7. ${rwr(t,e)}`,...owr(t,e),...iwr(t),"",`Stay inside the checkout and don't commit or push. When you're done, update ${e.checkpoint} with "app" filled in;`,"that file is what's read. End with a one-line final message \u2014 don't repeat the plan in it. The plan's JSON:","",yn(Hc,0,tW(t.inputs)?new Set:swr)].join(`
|
|
787
|
+
`)}var tW=t=>!!t.appRunning&&Lc(t),swr=new Set(["mutates"]);function iwr(t){return tW(t.inputs)?[" The app runs in a shared environment this policy protects. A case or clause whose test changes state there (an"," API POST, PUT, PATCH or DELETE, in the test or its setup, or a UI flow that submits, creates, edits or deletes) is"," withheld by the runner and reported as a gap: prefer cases that only read, and mark each that still changes state,",' and each such maintenance item, "mutates": true.']:[]}function owr(t,e){if(t.inputs.planOnly)return[];if(!t.inputs.appRunning&&e.preflight&&!e.preflight.sutRequired)return[];let r=qi.join(qi.dirname(e.checkpoint),"probe");return tW(t.inputs)?["8. Only under runtime_required: probe the running app before any test is written (skip this and 9 if it isn't"," answering). It is a shared environment this policy protects: send only requests that change nothing (GET and"," HEAD: reads, lists, searches, filters, sorts) and never create, edit, delete, reset or seed anything there. Put",` every probe in one script under ${r}* and run it once, printing one line per probe: what it read, the status`," codes, and which check failed. Probe what the change touches through reads: every state its records can be in,"," every field it adds through list, sort, filter and search, and odd query values (zero, negative, huge, empty, case"," variants). Flag any 5xx, and reads that disagree with each other or with derived values (totals, counts).","9. Re-run each flagged probe once. Each that repeats and involves what the change touched is a defect: add it to",' "findings" with the request and response as its evidence, and a case for it. Then write the updated plan to',` ${e.checkpoint} again.`]:["8. Only under runtime_required: probe the running app before any test is written (skip this and 9 if it isn't"," answering). Put every probe in one",` script under ${r}* and run it once, printing one line per probe: what it did, the status codes, and which`," check failed. Probe what the change touches:"," - every state its records can be in (from the code's status fields and enums) \xD7 every operation the change adds or alters;"," - sequences: write then read back; set, reset, read; edit twice; delete then edit; write then list;"," - payloads: zero, negative, huge, empty, null, missing and extra fields, wrong types, case variants, more items"," than a page holds, one valid and one invalid item together;"," - every field the change adds, through the existing list, sort, filter and search."," Read the record before and after each action. Flag any 5xx; a rejected request that changed anything; a read that"," differs from what was written; a repeated request that changed something more; derived values (totals, counts)"," that disagree with their inputs; an operation that succeeds on a record in a final state (cancelled, shipped, deleted).","9. Re-run each flagged probe once. Each that repeats and involves what the change touched is a defect: add it to",' "findings" with the request and response as its evidence, and a case whose steps are that request sequence and',` whose expected outcome is the correct behaviour. Then write the updated plan to ${e.checkpoint} again.`]}function Cmt(t){let e=Hn(t);return e?Qfe(Vu(e,"").map(r=>r.path)):[]}function EAe(t){let e=Cmt(t);if(!e.length&&!Lfe(t.inputs.repositoryPath))return[];let r=e.slice(0,8).join(", ")+(e.length>8?", \u2026":"");return[' User journeys: under "journeys", the flows a user walks through the UI, each from where a user normally starts it'," to the outcome they came for, that together pass through everything the change alters that a user sees or does:"," every ui clause is in some journey's steps (or under notInJourney, with why no journey reaches it). Use as many"," journeys as that takes. For each: the entry route; every step in order, with the clauses it exercises and what the user then sees;"," the outcome that shows the journey worked; its source \u2014 the spec or PR description that describes the flow (quote it),"," else inferred; and the test file it belongs in. Each becomes one test of the whole flow as the PR intends it (its kind):"," in-process only where the repo's own in-process UI tests (component tests under jsdom or the like, for that code) can"," walk and check all of it \u2014 a request-level test client (Django's, Flask's, Rails integration tests) runs no page script"," and does not count \u2014 else a browser test, which needs the running app, so the decision is runtime_required (step 4)."," The changed step is inside the flow, not the whole of it. The journey starts where the user starts the flow and"," gets to the changed step through the page: what an earlier step of the same flow creates (the record a change then"," edits) the journey creates through the app's own form, not through the API. That is for the journey only: the other"," cases keep using the records the app already has wherever the change reads or edits existing data, since a record"," made fresh for the test can hide a defect that shows only on older data. The journey ends where the user sees the result,"," which may be past the changed page: the next page built from what was saved, or a record it links to. After a"," change that saves something, a step reloads or reopens it and checks it held. Code that decides what a page shows"," counts though no page changed (a composable, store, hook, style or theme it renders from): what the user then sees"," is in a journey, whatever unit test also checks it."," A repo with no browser tests is no reason to leave a clause out: its browser journeys go in a test package of their own."," Empty when the change alters nothing a user sees; then say so under notInJourney, per clause, with why. A change"," to UI code that alters what the page holds along a user flow (a DOM attribute, the theme, other client state the"," flow sets) owes a journey that asserts it, even when nothing in the repo reads it yet: that nothing reads it, or"," that the user cannot see it, is no reason to leave it out.",...e.length?[` The change touches UI files: ${r}.`]:[]]}function awr(t,e){let{budgetMinutes:r}=t.inputs;return["4. Validation triage, before anything is started: decide what evidence each clause still needs and the cheapest",' reliable way to get it, and save it as "triage" (its behaviorIds are your clause ids). The app is brought up only'," when the decision is runtime_required; existing evidence or native unit tests can often validate a change"," without it. You are not a code reviewer here: no style, naming or architecture commentary.","",...(s=>s.flatMap(i=>i.split(`
|
|
788
|
+
`)).map(i=>i?` ${i}`:""))([...vge(t,e.triage.change),"",...Rge(t,e.triage),...r?["",`Run budget: ${r} minutes for the whole run, including everything you plan. Name in gaps what it cannot cover.`]:[],"","Scope: validate what this change alters or newly reaches, and what the PR description or a spec states.","- Out of scope is only a clause the change cannot reach: its deciding code is unchanged and no changed path leads to it, or it lives in a checkout the change does not touch. List it under outOfScope with the unchanged line that decides it (path:line), and plan nothing for it. Code the change newly calls or feeds new values to is in scope, and so is a defect it exposes there.","","The evidence ladder \u2014 use the cheapest mechanism that establishes each clause in scope:"," existing_evidence an accepted ci-<n> result. A check you ran (typecheck, compile, test collection) establishes only a prerequisite clause \u2014 that the change builds or its config parses \u2014 never a behaviour"," unaffected the change cannot reach this clause: no changed code path leads to it \u2014 cite the code that shows it (path:line); never for a clause decided in a changed file"," existing_unit existing native unit tests that exercise the clause"," new_unit a new in-process test, for evidence nothing provides yet"," runtime only the running application can establish it","A clause only the running app can check is runtime, not a gap, even when every other clause is in-process. It is a gap only when the app cannot be run here; then name what is missing.","Give each clause the kind of test the repo already uses for the code it checks \u2014 in-process where the repo tests that code in-process, runtime where it tests it against the running app \u2014 unless that kind cannot check it; then the kind that can.",`Browser-only: for every clause, ask whether its behaviour happens only in a browser \u2014 real clicks or keys driving page script, client-side sorting or filtering, script-driven DOM updates, focus, drag-and-drop, navigation, rendering that depends on CSS or JavaScript \u2014 and if so mark it browserOnly. A test that only checks markup (a class or attribute present, the HTML a request returns) proves the precondition, not the behaviour: the header having the sort class does not show that "clicking a column header sorts the list". A browser-only clause is tested in a browser: in the repo's in-process browser harness where it has one \u2014 a Django LiveServerTestCase or StaticLiveServerTestCase, or pytest-django live_server, suite that drives Selenium or Playwright; component tests under jsdom only when the repo's own jsdom tests already drive that kind of interaction \u2014 named as its browserHarness (the suite's path), and the clause stays new_unit, with its triage item's covers saying it is driven in that browser suite; else decide runtime_required with a browser test of it. A markup check may be added, not substituted.`,"","Decisions:","- existing_evidence_sufficient means every clause in scope is established by existing evidence, with no gaps.","- targeted_unit plans unit tests and nothing that needs a running app.","- runtime_required marks at least one clause runtime, and plans no new unit tests: once the app is needed, this plan's cases are every new test, each still written the way the repo tests that code \u2014 in-process where that can check its clause, in the browser only where it cannot. The existing unit tests you identify still run, as existing_unit.","- The journeys and maintenance of step 5 can need the app too, so plan them before you decide. Decide runtime_required when any journey needs a browser \u2014 real JavaScript or htmx behaviour, navigation across pages, what persists after a reload, or a server-rendered page the repo tests only at the request level \u2014 and mark runtime the clauses its steps exercise.",'- Decide runtime_required as well when any test under "maintenance" calls the deployed app \u2014 API, contract, integration, end-to-end or UI tests that reach it at its address (BASE_URL or the like), and Skyramp tests \u2014 and checks what the change itself alters, and mark runtime the clauses it checks, so it is verified against the app. So does a browser part the plan itself says goes untested, and a browser-only clause the repo has no in-process browser harness for.',"- A test that starts its own live server in the test process and drives it in a browser (Django's LiveServerTestCase or StaticLiveServerTestCase, pytest-django's live_server, with Selenium or Playwright) needs no deployed app: under targeted_unit it is maintained and run in-process, with the repo's CI settings and a headless browser.","- When the app cannot be run here, list each such journey's clauses under notInJourney, and each such test under gaps, with what is missing: it is reported not covered, never dropped. So is a browser-only clause with no in-process browser harness: name it under gaps with what is missing.","- Only what the change itself alters decides it. A journey or browser-only clause only for what the change could break elsewhere (a could-break requirement), or for UI code the change does not touch when it touches no UI code, does not make the decision runtime_required: off the runtime path list its clauses under notInJourney and the browser-only ones under gaps, with what is missing (a browser, downstream of this change), so it is reported not covered. Nor does a maintained test that calls the deployed app only for such clauses: give each maintained test the clauses it checks, and name such a test under gaps with what is missing (the running app, downstream of this change).","- blocked_preflight: the change cannot meet a basic prerequisite. It names the changed file the failure is in and quotes the error, and plans nothing. A check that fails for an environment reason (a dependency not installed, a missing tool) is not the change failing \u2014 never block on it.","","Rules:","- Every clause is planned, listed in gaps, or listed under outOfScope, by its id (R1a). A gap is evidence this run cannot obtain; a test this run will execute (existing_unit, new_unit, runtime) is not one, even when you could not run it while planning.","- Only accepted ci-<n> items, and passing checks you ran for prerequisite clauses, can establish a clause. A stale, untrusted, pending, failing or inconclusive result establishes nothing; a trusted result that failed is a reason to plan evidence, never a pass. AI review is advisory, never evidence.","- Find the existing tests yourself: where the repo keeps tests of the changed code, and their framework.",'- Existing tests that call a running app (API, contract, integration, end-to-end or UI tests) are never evidence: list them in "maintenance" (verify, or update).',"- Repository evidence is only native unit tests, which run without the app. Every repository evidence item lists its tests as repo-relative paths (path::test-name when the file holds more than the relevant ones) \u2014 only the tests that exercise the changed behavior, never the whole suite.",`- ${bj}`,`- ${uR}`,"- Every repository evidence item is run: cite it from an existing_unit item for the clauses it exercises. Only under existing_evidence_sufficient is nothing run: cite it from the existing_evidence item it supports instead.","- Plan new_unit only for what no existing test asserts, or asserts differently from the requirement (the boundary the change moved); never for what existing tests already prove.","- When the PR description or a spec states the expected behavior, plan evidence for what it states, not for what the code does.","- Evidence items are existing repository tests (source repository) and checks you ran with Bash (source testbot), each with a unique id; the ci-<n> results above are not restated. Run each check as one plain command \u2014 no `&&`, pipes or `echo` \u2014 and copy it into its evidence exactly. Don't start the application, install dependencies or run test suites for triage."])]}function cwr(t){let e=t.prepared,r=t.inputs.repositoryPath,n=e.preflight?.repository.currentBranch??"HEAD",s=e.preflight?.repository.baseBranch??t.inputs.baseBranch??"origin/main";return["Plan functional tests for this PR. You won't write the tests: another session will, working from your plan alone,","so whatever it needs has to be in the plan.","",`The repo is at ${r}, checked out on branch \`${n}\`. You can see the change with \`git diff ${s}...HEAD\`.`,"Ignore .skyramp/ \u2014 it is Skyramp's own setup, not part of the change.",...xAe(t),...Gl(t.inputs),...gmt(t.inputs),...ymt(t.inputs),"","1. Read the change: the diff, the description, and any spec, issue or design doc either of them points to.","2. List the requirements: everything the description or a spec states or clearly implies and, where they say"," nothing, what the change is evidently meant to do. Split each into independently testable clauses: each input"," class, boundary, error path, and anything that must stay unchanged. For each clause, write the expected outcome.",` Each requirement's id is the label the description or spec gives it ("AC-3", "REQ-12"; item 4 of a numbered list`," is R4), else R1, R2\u2026 in order, numbering on after the highest R-label the source uses (R6 after its R5). Where two"," items give the same label, put the item's key in front (PAY-184-AC1, PAY-185-AC1). A clause id is its"," requirement's id plus a letter (AC-3a), and each id is used once. Every case, clause and journey step keeps these"," ids and names a clause or finding the plan has; a finding names the requirement or clause it breaks."," Where the description or spec sets it, it wins over the code: if they disagree, the code is what's wrong. Where"," nothing is stated, take it from the change's evident intent; code that contradicts that intent, or itself"," elsewhere, is still a defect. Where the outcome is left open, expect only what any correct implementation must"," do, and say so."," Then list what the change could break that no requirement mentions \u2014 other callers of the functions it changed,"," other paths that read or write the same data, behaviour right next to the change \u2014 and add each as a requirement"," of its own (source could-break, evidence the code it could break), with its clauses.",' For each clause, give under "code" the path:line of the code that decides it, when there is one.',"3. Note every defect you find in the change, with the line that shows it. Compare the change with the code beside it"," that does the same job \u2014 other routes answering the same kind of request, other reads of the same data, the other"," layer handling the same value, other code that copies the same record: where they handle a case the change handles"," differently (how a malformed id is answered, who may act, what a read leaves out, whether a value's case matters,"," which fields a copy carries), the change is wrong unless the description asks for the difference. On each page the"," change touches, follow what the user sees when its request fails, when they enter a value it refuses, and right"," after a save, without a reload.",...awr(t,e),"5. Only under runtime_required, and only for the clauses your triage marks runtime and the defects: write the test",' plan. Under any other decision leave "cases" empty and give no clause a test: the evidence'," comes from triage's plan."," Write the test plan on the clauses themselves: each clause gets the test that checks it (type, target, steps;",` its expected outcome is the clause's, and its kind the one the repo already uses for that code, unless that kind cannot check it), or, on the clause, why it can't be tested here. Add to "cases" a second`," test for a clause where one is needed, and one case for every defect you found \u2014 even where a clause's test"," covers the same ground. A defect's case reaches the defect itself (the state, input or sequence that shows it)"," and expects the correct behaviour, so it fails on this branch; where the requirement allows more than one correct"," outcome (reject, or cap), it accepts each of them, so it passes on any fix.",' Under every decision, list under "maintenance" the existing tests you can see the change makes wrong or stale,'," and whether to update, delete, regenerate or just re-run (verify) each \u2014 a starting point: the step that writes"," the tests runs the affected tests and finds the rest. One that calls the deployed app to check what the change itself alters makes the decision runtime_required (step 4); a live-server test, which runs in-process, does not.",...EAe(t),`6. Write the plan as JSON (below), "triage" included, to ${e.checkpoint} now, before anything is started.`,`7. ${rwr(t,e)}`,...owr(t,e),...iwr(t),"",`Stay inside the checkout and don't commit or push. When you're done, update ${e.checkpoint} with "app" filled in;`,"that file is what's read. End with a one-line final message \u2014 don't repeat the plan in it. The plan's JSON:","",yn(Hc,0,tW(t.inputs)?new Set:swr)].join(`
|
|
789
789
|
`)}function XV(t,e,r){let n=qi.join(t.outputsDir,e);return ZV.writeFileSync(n,JSON.stringify(Xr(r,t.secretValues??[]),null,2)+`
|
|
790
790
|
`),qi.relative(t.runDir,n)}function Imt(t){let e=t.prepared?.recipe??Vc(t.inputs.repositoryPath);return e.teardownScript?`bash ${qi.relative(t.inputs.repositoryPath,e.teardownScript)}`:void 0}function vmt(t,e){let r=Emt(e);r!==e&&cd(t).warn("[plan] the plan used an id more than once: renamed the later ones so each is kept");let n=kat(pAe(r,t.inputs.requirementItems),u=>cd(t).warn(`[plan] case id ${u} is used twice: kept one case and left out the other`)),s=$he(t,n.triage,!!n.app,uhe(n,ha(t.inputs.requirementItems))).length===0,i=!s||n.triage?.decision==="runtime_required",o=Bat(s?Pat(n):n,i),a=Hn(t),c=Oat(o,{repository:a?.repository??{path:t.inputs.repositoryPath,currentBranch:"HEAD",baseBranch:t.inputs.baseBranch??""},changedFiles:a?.changedFiles.map(u=>u.path)??[],nonApplicationOnly:a?.nonApplicationOnly??!1,defaultTeardown:Imt(t),itemNames:ha(t.inputs.requirementItems)}),l={plan:XV(t,"plan.json",o),analyze:XV(t,"analyze.json",c.analyze),recommend:XV(t,"recommend.json",tW(t.inputs)?nR(t.inputs,c.recommend):c.recommend)};return c.deploy&&(l.deploy=XV(t,"deploy.json",c.deploy)),s&&Object.assign(l,jct(t,o.triage)),l}var lwr={runtime_required:"validation triage: the change needs the running app \u2014 tests against it follow",targeted_unit:"validation triage: unit tests are enough \u2014 no app deployed",existing_evidence_sufficient:"validation triage: existing evidence is enough \u2014 no app deployed, no new tests",blocked_preflight:"validation triage: the change does not meet a prerequisite \u2014 nothing further runs"};function uwr(t){let e=ae(t,"triage.json");if(e)return lwr[e.decision];let r=ae(t,"plan.json");return r?$he(t,r.triage,!!r.app)[0]:void 0}async function dwr(t,e){let r=t.inputs.sharedEnvironment;if(!t.inputs.appRunning||!K_(r))return{};let n=await nj(r,[],e,t.secretValues??[],t.platform,await Cfe(t,r));return tr(t,da,Xr(n,t.secretValues??[]),[])}function pwr(t,e){let r=gD(qi.join(eW(t),wAe)),n=vj(Hc,[...e.map(s=>s.session?.stdout).reverse(),r,_at(r)]);return n?vmt(t,n):void 0}function mwr(t){if(t.inputs.appRunning||t.inputs.planOnly)return!1;let e=Hn(t);if(e&&!e.sutRequired)return!1;let r=ae(t,"plan.json");return!(r?.triage&&!kR(r.triage.plan)&&!r.app)}function xmt(t){if(!mwr(t))return;let e=ae(t,"deploy.json")?.teardown??Imt(t);!e||e==="true"||(0,Smt.spawnSync)(e,{shell:!0,cwd:t.inputs.repositoryPath,env:wt(),timeout:12e4,stdio:"ignore"})}var Rmt="plan-triage-grounded",fwr={name:Rmt,verify(t,e){let{value:r}=$i(Hc,e.stdout,Om(t),t.secretValues);if(!r)return{name:this.name,passed:!0};let n=pAe(r,t.inputs.requirementItems),s=Uhe(t,n.triage,!!n.app,uhe(n,ha(t.inputs.requirementItems)));return s.length?{name:this.name,passed:!1,details:s.join("; "),repairable:!0}:{name:this.name,passed:!0}}},Nmt="plan-journeys",hwr=[/\b(?:no|without|lacks?|missing)\b[^.;:]{0,30}\b(?:browser|e2e|end-to-end|playwright|cypress|selenium|ui|frontend|front-end)\b[^.;:]{0,30}\b(?:tests?|harness|runner|setup|framework|installed|suite)\b/i,/\bno\s+(?:tests?|harness)\s+(?:for|of)\s+the\s+(?:ui|frontend|front-end|browser|pages?)\b/i],gwr=/\b(?:credentials?|log[- ]?ins?|sso|auth\w*|accounts?|seed(?:ed)?|external|third[- ]party|api[- ]keys?|secrets?|tokens?|observ\w*|visible|shows?|logs?|reach\w*|unreachable|behind|admin\w*|licen[cs]e\w*|hardware|devices?|e-?mail|sms|payment|stripe|host[- ]app|embedd\w*)\b/i,Awr=t=>hwr.some(e=>e.test(t))&&!gwr.test(t),ywr=/\b(?:not|never|isn'?t|aren'?t)\s+(?:visible|seen|shown|user[- ]visible)\b|\binvisible\b|\bno\s+(?:user[- ])?visible\b|\b(?:user|nobody|no one)\s+sees\s+no(?:thing)?\b|\bnothing\s+(?:a|the)\s+user\s+sees\b|\bnothing\b[^.;]{0,40}\b(?:styles?|reads?|renders?|consumes?|uses?)\b|\bno\s+(?:css|style|component|rendering)\b[^.;]{0,40}\b(?:reads?|consumes?|depends?|uses?)\b/i,bwr=/\b(?:not reachable|unreachable|no (?:route|page|screen|flow|path|link) (?:reaches|renders|opens|leads to)|(?:rendered|used|mounted) only (?:by|in|from)\b[^;]{0,100}\bnothing (?:in the app )?(?:renders|uses|mounts))/i;function Ewr(t){let e=!1,r=[];for(let n of t){let s=n.why??"",i=!bwr.test(s)&&(ywr.test(s)||/^\s*same\b/i.test(s)&&e);i&&r.push(n.clause),e=i}return r}function wwr(t,e){let r=e.trim().replace(/^\.\//,""),n=(t.inputs.relatedRepos??[]).find(s=>r.startsWith(`${bAe(s)}/`));return n?{root:n.path,rel:r.slice(bAe(n).length+1)}:{root:t.inputs.repositoryPath,rel:r}}var xwr={name:Nmt,verify(t,e){let{value:r}=$i(Hc,e.stdout,Om(t),t.secretValues);if(!r)return{name:this.name,passed:!0};let n=!r.triage||r.triage.decision==="runtime_required",s=r.requirements.flatMap(E=>E.clauses),i=new Set([...r.cases.map(E=>E.id),...s.map(E=>E.id)]),o=[...Gw(t.inputs),...(t.inputs.relatedRepos??[]).map(E=>({body:E.prDescription??""}))],a={takenIds:i,clauses:new Set(s.map(E=>E.id)),uiClauses:EAe(t).length?s.filter(E=>E.type==="ui"&&!E.skip?.trim()).map(E=>E.id):[],notInJourney:new Set((r.notInJourney??[]).map(E=>E.clause)),quoted:E=>oD(o,E)},c=Hn(t),l=c?Vu(c,"").map(E=>E.path):[],u=n?[]:cmt(r,{locate:E=>wwr(t,E),runtimePossible:!!t.inputs.appRunning||c?.sutRequired!==!1,...c?{own:amt(r,l,Qfe(l).length>0)}:{}}),d=n?r.journeys:(r.journeys??[]).filter(E=>E.kind==="in-process"),p=(r.notInJourney??[]).filter(E=>Awr(E.why??"")).map(E=>`clause ${E.clause} is under notInJourney because the repo has no browser tests, which is no reason to leave it out: put it in a journey \u2014 in-process where the repo's in-process tests can walk and check it, else a browser test in a test package of its own (decide runtime_required)`),m=EAe(t).length?Cmt(t):[],f=m.length&&!(r.journeys??[]).length&&!(r.notInJourney??[]).length?[`the change touches UI code (${m.slice(0,5).join(", ")}) and the plan has no journey: plan the journey through what a user then sees change, or, if the change alters nothing a user sees, list its clauses under notInJourney with why`]:[],h=m.length&&Lfe(t.inputs.repositoryPath)?Ewr(r.notInJourney??[]).map(E=>`clause ${E} is under notInJourney because nothing reads it or the user cannot see it, and the change touches UI code: a change to UI code that alters what the page holds along a user flow owes a journey that asserts it, even when nothing reads it yet \u2014 put the clause in that flow's journey, at the step that sets it, and assert it there`):[],A=[...u,...p,...f,...h,...Not(d,a)];return A.length?{name:this.name,passed:!1,details:A.join("; "),repairable:!0}:{name:this.name,passed:!0}}},Tmt="plan-requirements-grounded",Swr={name:Tmt,async verify(t,e){let{value:r}=$i(Hc,e.stdout,Om(t),t.secretValues);if(!r)return{name:this.name,passed:!0};t.reviewItemFile&&await umt(r,t.inputs.requirementItems,t.reviewItemFile);let n=Upt(r,t.inputs.requirementItems);return n.length?{name:this.name,passed:!1,repairable:!0,droppable:n.map(({id:s})=>s),details:n.map(({id:s,why:i})=>`${s}: ${i}`).join("; ")}:{name:this.name,passed:!0}}};function Cwr(t,e,r){let n=r.some(a=>a.name===Tmt)?`Repair "requirements" in ${Om(t)}: give each requirement-reference requirement its item's key as "reference" and, as evidence, words copied exactly from that item's file. A requirement no item states is not requirement-reference. One that still does not hold is dropped.`:void 0,s=r.some(a=>a.name===Nmt)?`Repair "journeys" in ${Om(t)} as named above: each needs an entry route, at least two steps each saying what the user then sees, the outcome and a test file, and every ui clause is in some journey's steps or under notInJourney. Where a journey, maintained test or browser-only clause above needs the running app, decide runtime_required in "triage" and mark runtime the clauses it checks (keep existing_unit for the existing unit tests, and make new_unit clauses runtime).`:void 0,i=r.some(a=>a.name===yAe)?`Repair the ids in ${Om(t)} as named above and keep the rest of the plan: each id is used once (where two items give the same label, put the item's key in front: PAY-185-AC1; unlabelled requirements number on after the highest R-label), a clause id is its requirement's id plus a letter, every case, clause and journey step names a clause or finding the plan has, and a finding names the requirement or clause it breaks.`:void 0,o=Iwr(t,e,r);return[n,i,o,s].filter(Boolean).join(`
|
|
791
791
|
`)||void 0}function Iwr(t,e,r){let n=r.filter(o=>o.name===Rmt);if(!n.length)return;let s=Nge(t,e,n),i=n.some(o=>/brought the app up/.test(o.details??""))?['Only runtime_required starts the app: when a clause needs it, decide runtime_required and mark that clause runtime; when none does, stop what you started and remove "app" from the plan.']:[];return[`Repair "triage" in ${Om(t)} and keep the rest of the plan: its behaviorIds are your clause ids.`,...i,...s?[s]:[]].join(`
|
|
@@ -795,7 +795,7 @@ ${nwr(t,e)}`}function nwr(t,e){if(t.inputs.appRunning)return[`${t.inputs.appRunn
|
|
|
795
795
|
`;)i++;continue}if(!s&&u==="/"&&t[i+1]==="*"){let d=t.indexOf("*/",i+2),p=d<0?n:d+2;for(let m=i;m<p;m++)t[m]===`
|
|
796
796
|
`&&c(m);i=p;continue}if(u==='"'||u==="'"||u==="`"){let d={line:o,col:i-a},p=s&&t.startsWith(u.repeat(3),i)?3:1,m=l(i,u),f=t.slice(i+p,Math.max(i+p,m-p));r.push({kind:"s",text:f,...d,template:u==="`"&&e==="js"&&f.includes("${")}),i=m;continue}if(/[A-Za-z_$]/.test(u)){let d=i+1;for(;d<n&&/[\w$]/.test(t[d]);)d++;let p=t.slice(i,d);if(s&&Twr.test(p)&&(t[d]==='"'||t[d]==="'")){i=d;continue}r.push({kind:"i",text:p,line:o,col:i-a}),i=d;continue}if(/\d/.test(u)){let d=i+1;for(;d<n&&/[\w.]/.test(t[d]);)d++;r.push({kind:"n",text:t.slice(i,d),line:o,col:i-a}),i=d;continue}r.push({kind:"p",text:u,line:o,col:i-a}),i++}return r}var Bwr={"(":")","[":"]","{":"}"};function Uh(t,e){let r=t[e].text,n=Bwr[r],s=0;for(let i=e;i<t.length;i++){let o=t[i];if(o.kind==="p"){if(o.text===r)s++;else if(o.text===n&&--s===0)return i}}return-1}var $h=(t,e)=>e===0||t[e-1].line<t[e].line;function CAe(t,e,r){let n=[],s=0,i=!0;for(let o=e+1;o<r;o++){let a=t[o];a.kind==="p"&&"([{<".includes(a.text)?s++:a.kind==="p"&&")]}>".includes(a.text)?s=Math.max(0,s-1):s===0&&a.text===","?i=!0:s===0&&i&&a.kind==="i"&&!["public","private","protected","readonly"].includes(a.text)&&(n.push(a.text),i=!1)}return n}function Pwr(t,e){let r=new Map;for(let n=0;n+2<t.length;n++){let[s,i,o]=[t[n],t[n+1],t[n+2]];if(s.kind!=="i"||i.text!=="="||o.kind!=="s"||o.template)continue;let a=e==="py"?$h(t,n)&&s.col===0:t[n-1]?.text==="const",c=t[n+3];a&&(!c||c.line>o.line||c.text===";")&&r.set(s.text,o.text)}return r}function IAe(t,e,r,n,s,i){let o=new Map(n.map((u,d)=>[u,`$${d}`])),a=[],c=e;for(i==="py"&&t[c]?.kind==="s"&&(c+1>=r||t[c+1].line>t[c].line)&&c++;c<r;c++){let u=t[c];if(u.kind==="s"){let d=u.template?u.text.replace(/\$\{\s*([A-Za-z_$][\w$]*)\s*\}/g,(p,m)=>s.get(m)??(o.has(m)?`\${${o.get(m)}}`:p)):u.text;a.push(JSON.stringify(d))}else u.kind==="i"&&t[c-1]?.text!=="."?a.push(o.get(u.text)??(s.has(u.text)?JSON.stringify(s.get(u.text)):u.text)):a.push(u.text)}return{key:a.filter(u=>u!==";").join(" ").replace(/ , (?=[)\]}])/g," "),size:a.length}}function Dmt(t,e){let r=0,n=0;for(let s=e;s<t.length;s++){let i=t[s].text;if(i==="<")r++;else if(i===">"&&t[s-1]?.text!=="=")r=Math.max(0,r-1);else if(i==="(")n++;else if(i===")")n--;else{if(i==="{"&&r===0&&n===0)return s;if(i===";"||i==="="&&t[s+1]?.text!==">")return-1}}return-1}function _wr(t,e){return t.kind==="p"&&!")]}".includes(t.text)||e.kind==="p"&&".?:&|+-*/<>=".includes(e.text)}function Dwr(t,e){let r=0;for(let n=e;n<t.length;n++){let s=t[n];if(s.kind==="p"&&"([{".includes(s.text))r++;else if(s.kind==="p"&&")]}".includes(s.text)){if(r===0)return n;r--}else if(r===0&&(s.text===";"||s.text===","||n>e&&s.line>t[n-1].line&&!_wr(t[n-1],s)))return n}return t.length}function Omt(t){let e=new Set,r=n=>{let s=Uh(t,n);for(let i=n+1;i>0&&i<s;i++){let o=t[i];o.kind!=="i"||t[i-1]?.text==="as"||t[i-1]?.text===":"||[",","}",":","as"].includes(t[i+1]?.text)&&e.add(o.text)}};for(let n=0;n<t.length;n++){let s=t[n].text;s==="export"&&t[n+1]?.text==="{"&&r(n+1),s==="exports"&&t[n+1]?.text==="="&&t[n+2]?.text==="{"&&r(n+2),s==="exports"&&t[n+1]?.text==="."&&t[n+2]?.kind==="i"&&e.add(t[n+2].text)}return e}function Owr(t,e){let r=[],n=Omt(t),s=o=>{for(let a=o-1;a>=Math.max(0,o-4);a--){if(t[a].text==="export")return!0;if(!["default","async","function","*","const","let","var"].includes(t[a].text))return!1}return!1},i=(o,a,c,l,u)=>{let d=t[o].text,{key:p,size:m}=IAe(t,l,u,CAe(t,a,c),e,"js");r.push({name:d,line:t[o].line,exported:s(o)||n.has(d),key:p,size:m})};for(let o=0;o<t.length;o++){let a=t[o];if(a.kind==="i"){if(a.text==="function"){let c=o+1;if(t[c]?.text==="*"&&c++,t[c]?.kind!=="i")continue;let l=c++;if(t[c]?.text==="<")for(;c<t.length&&t[c].text!=="(";)c++;if(t[c]?.text!=="(")continue;let u=Uh(t,c),d=u<0?-1:Dmt(t,u+1),p=d<0?-1:Uh(t,d);p>0&&i(l,c,u,d+1,p);continue}if((a.text==="const"||a.text==="let"||a.text==="var")&&t[o+1]?.kind==="i"){let c=o+1,l=o+2;if(t[l]?.text===":")for(;l<t.length&&t[l].text!=="="&&t[l].line===t[c].line;)l++;if(t[l]?.text!=="=")continue;l++,t[l]?.text==="async"&&l++;let u,d;if(t[l]?.text==="("){if(u=l,d=Uh(t,l),d<0)continue}else if(t[l]?.kind==="i"&&t[l+1]?.text==="="&&t[l+2]?.text===">")u=l-1,d=l+1;else continue;let p=d+1;if(t[p]?.text===":")for(;p<t.length&&!(t[p].text==="="&&t[p+1]?.text===">")&&t[p].text!==";";)p++;if(t[p]?.text!=="="||t[p+1]?.text!==">")continue;if(p+=2,t[p]?.text==="{"){let m=Uh(t,p);m>0&&i(c,u,d,p+1,m)}else i(c,u,d,p,Dwr(t,p))}}}return r}function Mwr(t,e){let r=[];for(let n=0;n<t.length;n++){if(t[n].text!=="def"||t[n+1]?.kind!=="i"||t[n+2]?.text!=="(")continue;let s=t[n-1]?.text==="async"&&$h(t,n-1);if(!s&&!$h(t,n))continue;let i=t[s?n-1:n].col,o=Uh(t,n+2);if(o<0)continue;let a=o+1;for(;a<t.length&&t[a].text!==":";)a++;let c=a+1;for(;c<t.length&&!($h(t,c)&&t[c].line>t[a].line&&t[c].col<=i);)c++;let l=CAe(t,n+2,o).filter(m=>m!=="self"&&m!=="cls"),{key:u,size:d}=IAe(t,a+1,c,l,e,"py"),p=t[n+1].text;r.push({name:p,line:t[n+1].line,exported:i===0&&!p.startsWith("_"),key:u,size:d})}return r}function Qwr(t,e){let r=[];for(let n=0;n<t.length;n++){if(t[n].text!=="func"||!$h(t,n))continue;let s=n+1;if(t[s]?.text==="("&&(s=Uh(t,s)+1),s<=0||t[s]?.kind!=="i"||t[s+1]?.text!=="(")continue;let i=Uh(t,s+1),o=i<0?-1:Dmt(t,i+1),a=o<0?-1:Uh(t,o);if(a<0)continue;let{key:c,size:l}=IAe(t,o+1,a,CAe(t,s+1,i),e,"go");r.push({name:t[s].text,line:t[s].line,exported:/^[A-Z]/.test(t[s].text),key:c,size:l})}return r}function Lwr(t,e){let r=[],n=[];if(e==="js"){for(let s=0;s<t.length;s++){if(t[s].text!=="import"||!$h(t,s)||t[s+1]?.text==="(")continue;let i=s+1;for(;i<t.length&&t[i].kind!=="s"&&t[i].text!==";";)i++;if(t[i]?.kind==="s"&&(n.push([s,i]),t[s+1]?.text!=="type"))for(let o=s+1;o<i;o++){let a=t[o];a.kind!=="i"||["from","as","type"].includes(a.text)||t[o-1]?.text==="type"||t[o+1]?.text!=="as"&&r.push({local:a.text,from:t[i].text,line:a.line})}}for(let s=0;s<t.length;s++){if(t[s].text!=="require"||t[s+1]?.text!=="("||t[s+2]?.kind!=="s"||t[s+3]?.text!==")"||t[s-1]?.text!=="=")continue;let i=t[s+2].text,o=s-2;if(t[o]?.kind==="i"&&["const","let","var"].includes(t[o-1]?.text)){n.push([o-1,s+3]),r.push({local:t[o].text,from:i,line:t[o].line});continue}if(t[o]?.text!=="}")continue;let a=o;for(let c=0;a>=0;a--)if(t[a].text==="}")c++;else if(t[a].text==="{"&&--c===0)break;if(!(a<1||!["const","let","var"].includes(t[a-1].text))){n.push([a-1,s+3]);for(let c=a+1;c<o;c++)t[c].kind==="i"&&t[c+1]?.text!==":"&&r.push({local:t[c].text,from:i,line:t[c].line})}}}else if(e==="py"){for(let s=0;s<t.length;s++){if(t[s].text!=="from"||!$h(t,s))continue;let i=s+1,o="";for(;i<t.length&&t[i].text!=="import"&&t[i].line===t[s].line;)o+=t[i++].text;if(t[i]?.text!=="import")continue;let a=t[i+1]?.text==="(",c=i+1;for(;c<t.length&&!(a?t[c].text===")":t[c].line>t[i].line&&t[c-1].text!=="\\");)c++;n.push([s,a?c:c-1]);for(let l=i+1;l<c;l++){let u=t[l];u.kind!=="i"||u.text==="as"||t[l+1]?.text==="as"||r.push({local:u.text,from:o,line:u.line})}}for(let s=0;s<t.length;s++){if(t[s].text!=="import"||!$h(t,s))continue;let i=s+1;for(;i<t.length&&t[i].line===t[s].line;){let o="",a=t[i];for(;i<t.length&&t[i].line===t[s].line&&t[i].text!==","&&t[i].text!=="as";)o+=t[i++].text;let c=a?.kind==="i"?a.text:"";t[i]?.text==="as"&&t[i+1]?.kind==="i"&&(c=t[i+1].text,i+=2),c&&o&&r.push({local:c,from:o,line:a.line}),t[i]?.text===","&&i++}n.push([s,i-1])}}return{imports:r,spans:n}}function Fwr(t,e,r){let n=new Set(r.map(s=>s.from));if(e==="js")for(let s=0;s<t.length;s++){let i=t[s];if(i.kind!=="s")continue;let o=t[s-1]?.text;(o==="from"||o==="import"&&t[s-1]?.kind==="i"||o==="("&&["require","import"].includes(t[s-2]?.text??"")&&t[s+1]?.text===")")&&n.add(i.text)}return[...n]}function Uwr(t,e){let r=0;for(let n=0;n<t.length;n++){if(t[n].kind!=="i"||t[n].text!=="class")continue;let s=t[n+1];(e==="py"?$h(t,n)&&s?.kind==="i":s&&(s.kind==="i"||s.text==="{"))&&r++}return r}function YR(t,e){let r=qh(e);if(!r)return;let n=kwr(t,r),s=Pwr(n,r),i=r==="js"?Owr(n,s):r==="py"?Mwr(n,s):Qwr(n,s),{imports:o,spans:a}=Lwr(n,r),c=new Map,l=d=>c.set(d,(c.get(d)??0)+1),u=0;for(let d=0;d<n.length;d++){for(;u<a.length&&d>a[u][1];)u++;if(u<a.length&&d>=a[u][0])continue;let p=n[d];if(p.kind==="i")l(p.text);else if(p.kind==="s"&&(p.template||r==="py"&&p.text.includes("{")))for(let m of p.text.matchAll(/\{[^{}]*\}/g))for(let f of m[0].matchAll(/[A-Za-z_$][\w$]*/g))l(f[0])}return{lang:r,functions:i,imports:o,uses:c,listedExports:r==="js"?Omt(n):new Set,deps:Fwr(n,r,o),classes:r==="go"?0:Uwr(n,r)}}var qwr=15,Hwr=6,xx=t=>ua.test(t),zwr=/utils?|skyramp/i,Gwr=/utils?/i,JR=t=>fr.posix.basename(t).replace(/\.[^.]+$/,""),jwr=/^(conftest\.py|__init__\.py|[^/]*\.config\.[cm]?[jt]s|[^/]+\.(setup|teardown)\.[cm]?[jt]sx?|setupTests\.[cm]?[jt]sx?)$/i,Vwr=/^([\w.-]+\.config\.([cm]?[jt]s|json)|package\.json|pytest\.ini|pyproject\.toml|setup\.cfg|tox\.ini)$/i,Mmt=t=>t.replace(/\.([cm]?[jt]sx?|py)$/,"");function Wwr(t,e){let r=Mmt(e),n=fr.posix.dirname(t.rel);return(t.text.match(/[\w@$.\-/]+/g)??[]).some(i=>{let o=i.replace(/^<rootDir>\//,"").replace(/[.,]+$/,"");if(!o)return!1;let a=Mmt(fr.posix.normalize(fr.posix.join(o.startsWith("/")?".":n,o.replace(/^\//,"")))),c=/^[A-Za-z_][\w.]*$/.test(o)&&o.includes(".")?o.replace(/\./g,"/"):void 0;return a===r||c!==void 0&&(c===r||fr.posix.join(n,c)===r)})}function Qmt(t,e){return jwr.test(fr.posix.basename(t))?!0:e.some(r=>Wwr(r,t))}var vAe=[".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts"];function KR(t,e,r,n){let s=fr.posix.dirname(t),i=o=>o.map(a=>fr.posix.normalize(a)).find(a=>!a.startsWith("..")&&n(a));if(r==="js"){if(!e.startsWith("."))return;let o=fr.posix.join(s,e),a=o.replace(/\.[cm]?js$/,"");return i([o,...vAe.map(c=>o+c),...vAe.map(c=>a+c),...vAe.map(c=>`${o}/index${c}`)])}if(r==="py"){let o=e.match(/^\.*/)[0].length,a=e.slice(o).replace(/\./g,"/"),c=[];if(o){let l=s;for(let u=1;u<o;u++)l=fr.posix.dirname(l);c.push(l)}else for(let l=s;c.push(l),!(l==="."||l==="/"||l==="");l=fr.posix.dirname(l));return i(c.flatMap(l=>a?[`${l}/${a}.py`,`${l}/${a}/__init__.py`]:[`${l}/__init__.py`]))}}var Lmt=t=>`${t.rel}:${t.fn.line}`;function Ywr(t,e){return[...new Set(t.code.imports.map(r=>KR(t.rel,r.from,t.code.lang,e)).filter(r=>!!r&&!xx(r)))]}function Jwr(t){let e=T=>{let O=YR(T.text,T.rel);return O?{rel:T.rel,code:O,test:xx(T.rel)}:void 0},r=t.written.flatMap(T=>{let O=e(T),U=T.before===void 0?void 0:YR(T.before,T.rel);return O?[{...O,before:U,isNew:T.before===void 0,definesHelpers:O.code.functions.length>0||O.code.classes>0}]:[]}),n=t.existing.flatMap(T=>e(T)??[]),s=new Map([...n,...r].map(T=>[T.rel,T])),i=T=>s.has(T),o=[],a=new Map,c=T=>a.set(T.fn.key,[...a.get(T.fn.key)??[],T]);for(let T of n)for(let O of T.code.functions)c({rel:T.rel,fn:O,lang:T.code.lang,test:T.test});for(let T of r){let O=new Set(T.code.functions.map(U=>U.name));for(let U of T.before?.functions??[])O.has(U.name)&&c({rel:T.rel,fn:U,lang:T.code.lang,test:T.test})}let l=(T,O)=>T.key===O.key&&(T.size>=qwr||T.name===O.name&&T.size>=Hwr),u=(T,O)=>new Set((a.get(T.key)??[]).filter(U=>U.lang===O&&l(T,U.fn)).map(U=>U.rel)).size>=2,d=r.flatMap(T=>{let O=new Set((T.before?.functions??[]).map(U=>U.name));return T.code.functions.filter(U=>!O.has(U.name)).map(U=>({w:T,fn:U}))}),p=T=>{let O=T.flatMap(U=>Ywr(U,i)).find(U=>!r.some(J=>J.rel===U&&J.isNew));return O?`the repo's ${O}`:"the repo's shared test-support module (else a module beside the tests that use it, laid out the way the repo keeps its tests, named for what it holds)"},m=new Set;for(let{w:T,fn:O}of d){if(u(O,T.code.lang))continue;let U=(a.get(O.key)??[]).find(z=>z.lang===T.code.lang&&!(z.rel===T.rel&&z.fn.name===O.name)&&l(O,z.fn));if(!U)continue;m.add(O);let J=s.get(U.rel);U.fn.exported||!U.test?o.push(`${T.rel}:${O.line} ${O.name} copies ${U.fn.name} (${Lmt(U)}) \u2014 import ${U.fn.name} from there instead of defining it again`):o.push(`${T.rel}:${O.line} ${O.name} copies ${U.fn.name}, local to ${Lmt(U)} \u2014 move ${U.fn.name} into ${p([T,...J?[J]:[]])} and import it in both files; no second copy`)}let f=r.filter(T=>T.isNew&&!T.test),h=new Map;for(let{w:T,fn:O}of d){if(!T.test||m.has(O))continue;let U=f.find(Q=>Q.code.lang===T.code.lang&&Q.code.functions.some(L=>l(O,L))),J=U?.code.functions.find(Q=>l(O,Q));if(!U||!J)continue;m.add(O);let z=`${T.rel}:${O.line} ${O.name} copies ${J.name} (${U.rel}:${J.line}) \u2014 import ${J.name} from there instead of defining it again`,H=h.get(U.rel)??{tests:new Set,sent:[]};H.tests.add(T.rel),H.sent.push(z),h.set(U.rel,H),o.push(z)}let A=[],E=T=>XD(T).dir;for(let T of d){if(!T.w.test||m.has(T.fn)||u(T.fn,T.w.code.lang))continue;let O=A.find(U=>U[0].w.code.lang===T.w.code.lang&&E(U[0].w.rel)===E(T.w.rel)&&l(U[0].fn,T.fn));O?O.push(T):A.push([T])}for(let T of A){let O=[...new Map(T.map(U=>[U.w.rel,U.w])).values()];O.length<2||o.push(`${T[0].fn.name} is defined in ${O.length} test files (${O.map(U=>U.rel).join(", ")}) \u2014 define it once, in ${p(O)}, and import it from each`)}for(let T of r){let O=new Set((T.before?.imports??[]).map(U=>`${U.local}\0${U.from}`));for(let U of T.code.imports){if(O.has(`${U.local}\0${U.from}`)||(T.code.uses.get(U.local)??0)>0)continue;(U.from.startsWith(".")||KR(T.rel,U.from,T.code.lang,i)!==void 0)&&o.push(`${T.rel}:${U.line} imports ${U.local} from ${U.from} and never uses it \u2014 use it, or drop the import`)}}let y=new Map([...(t.otherTests??[]).flatMap(T=>e(T)??[]).map(T=>[T.rel,T]),...s]),w=T=>[...y.values()].filter(O=>O.rel!==T&&O.code.deps.some(U=>KR(O.rel,U,O.code.lang,i)===T)),C=n.filter(T=>!T.test&&(T.code.functions.length>0||T.code.classes>0)&&!Qmt(T.rel,t.configs??[])).map(T=>({rel:T.rel,users:w(T.rel).filter(O=>O.test&&!r.some(U=>U.rel===O.rel)).length})).filter(T=>T.users>0),v=C.filter(T=>T.users===1),k=T=>v.some(O=>fr.posix.dirname(O.rel)===fr.posix.dirname(T))||C.length>0&&v.length*2>=C.length,N=new Set;for(let T of r){if(!T.isNew||T.test||!T.definesHelpers||Qmt(T.rel,t.configs??[])||k(T.rel))continue;let O=w(T.rel);if(O.some(H=>!H.test))continue;let U=h.get(T.rel),J=new Set([...O.map(H=>H.rel),...U?.tests??[]]);if(J.size!==1)continue;N.add(T.rel);let z=[...J][0];if(U)for(let H of U.sent)o.splice(o.indexOf(H),1);o.push(`${T.rel} is imported only by ${z}${U?", which also copies its helpers":""} \u2014 move its contents into ${z} and delete ${T.rel}; keep it only if a second test file uses it`)}for(let T of r){if(!T.isNew||T.test||N.has(T.rel))continue;let O=new Map;for(let U of T.code.functions){if(!U.exported||(T.code.uses.get(U.name)??0)-1-(T.code.listedExports.has(U.name)?1:0)>0)continue;let z=[...s.values()].filter(H=>H.test&&H.rel!==T.rel&&(H.code.uses.get(U.name)??0)>0&&H.code.imports.some(Q=>KR(H.rel,Q.from,H.code.lang,i)===T.rel));z.length===1&&O.set(z[0].rel,[...O.get(z[0].rel)??[],U.name])}for(let[U,J]of O)o.push(`${T.rel}: ${J.join(", ")} ${J.length>1?"are":"is"} used only by ${U} \u2014 a helper only one test file uses stays in that file`)}let M=n.some(T=>!T.test&&Gwr.test(JR(T.rel)));for(let T of r){if(!T.isNew||T.test||!T.code.functions.length)continue;let O=JR(T.rel);(/skyramp/i.test(O)||!M&&zwr.test(O))&&o.push(`${T.rel}: name the module for what it holds (e.g. orders, session, pages) \u2014 not "utils" or "Skyramp"`)}return o}var rW=new Set(["node_modules",".git","dist","build","coverage","test-results","playwright-report","__pycache__",".venv","venv","vendor",".next","target"]),Fmt=new RegExp(`(^|/)(${[...rW].map(t=>t.replace(/\./g,"\\.")).join("|")})/`),Hmt=/^(tests?|e2e|e2e-tests|__tests__|specs?|playwright|cypress|integration|testing)$/i,Kwr=/test|spec|helper|support|fixture|page/i,Umt=3e3,Xwr=256*1024,Zwr=4e3;function wx(t){try{let e=nW.statSync(t);return e.isFile()&&e.size<=Xwr?nW.readFileSync(t,"utf-8"):void 0}catch{return}}function exr(t,e){try{return(0,qmt.execFileSync)("git",[...Ui,"show",`HEAD:${e}`],{cwd:t,env:wt(),encoding:"utf-8",maxBuffer:16*1024*1024,stdio:["ignore","pipe","ignore"]})}catch{return}}function XD(t){let e=fr.posix.dirname(t).split("/").filter(n=>n&&n!=="."),r=e.findIndex(n=>Hmt.test(n));return r>=0?{dir:e.slice(0,r+1).join("/"),deep:!0}:{dir:e.join("/"),deep:!1}}function RAe(t,e){let r=[];for(let u of ay(t)){if(!qh(u.path)||Fmt.test(u.path)||u.code.includes("D")||e?.has(fr.resolve(t,u.path)))continue;let d=wx(fr.join(t,u.path));if(d===void 0)continue;let p=u.code==="??"||u.code[0]==="A";r.push({rel:u.path,text:d,before:p?void 0:exr(t,u.path)??void 0})}let n=new Set(r.map(u=>u.rel)),s=[],i=new Set;for(let{dir:u,deep:d}of new Map(r.map(p=>[JSON.stringify(XD(p.rel)),XD(p.rel)])).values())cm(fr.join(t,u),p=>{let m=fr.relative(t,p).split(fr.sep).join("/");if(i.has(m)||n.has(m)||!qh(m)||!d&&!xx(m)&&!Kwr.test(fr.posix.basename(m)))return;i.add(m);let f=wx(p);if(f!==void 0&&s.push({rel:m,text:f}),s.length>=Umt)return!1},{skip:rW,maxDepth:d?8:0});let o=u=>wx(fr.join(t,u))!==void 0;for(let u of r){let d=YR(u.text,u.rel);if(d)for(let p of d.imports){if(s.length>=Umt)break;let m=KR(u.rel,p.from,d.lang,o);if(!m||i.has(m)||n.has(m)||Fmt.test(m))continue;i.add(m);let f=wx(fr.join(t,m));f!==void 0&&s.push({rel:m,text:f})}}let a=r.filter(u=>u.before===void 0&&!xx(u.rel)),c=[],l=[];if(a.length){let u=a.map(m=>JR(m.rel)),d=[...new Set(a.flatMap(m=>/^(index|__init__)$/.test(JR(m.rel))?[JR(m.rel),fr.posix.basename(fr.posix.dirname(m.rel))]:[JR(m.rel)]))],p=0;cm(t,(m,f)=>{let h=f.split(fr.sep).join("/"),A=Vwr.test(fr.posix.basename(h)),E=!A&&xx(h)&&qh(h)!==void 0&&!i.has(h)&&!n.has(h);if(!A&&!E)return;if(E&&++p>Zwr)return!1;let y=wx(m);y!==void 0&&(A?u:d).some(w=>y.includes(w))&&(A?l:c).push({rel:h,text:y})},{skip:rW,maxDepth:10})}return{written:r,existing:s,otherTests:c,configs:l}}var NAe="write-reuse",txr=/\bcopies\b| is defined in \d+ test files | is imported only by /;function $mt(t){return txr.test(t)}var zmt={name:NAe,verify(t){let e=t.prepared?.secretGateBaseline,r=[];for(let i of kt(t.inputs)){let o=i.path===t.inputs.repositoryPath?"":qt(t.inputs,i.slug);r.push(...Jwr(RAe(i.path,e)).map(a=>o+a))}let n=r.filter(i=>!$mt(i));n.length&&console.log(`[${this.name}] noted, not sent back: ${n.join("; ")}`);let s=r.filter($mt);return s.length?{...ve(this.name,s),repairable:!0}:{name:this.name,passed:!0}}},rxr=10,nxr=/test|spec|helper|support|fixture/i,sxr=t=>t.split("/").some(e=>Hmt.test(e)||nxr.test(e)),ixr=10,oxr=4e3;function axr(t,e){let r=e==="js"?/^export\s+(?:default\s+)?(?:async\s+)?(?:function\*?|class|const|let)\s+([A-Za-z_$][\w$]*)/gm:/^(?:async\s+)?(?:def|class)\s+([A-Za-z]\w*)/gm,n=[...t.matchAll(r)].map(i=>i[1]),s=e==="js"?[...YR(t,"x.ts")?.listedExports??[]]:[];return[...new Set([...n,...s])]}function Gmt(t){let e=new Set,r=[];cm(t,(o,a)=>{let c=a.split(fr.sep).join("/"),l=qh(c);l!=="js"&&l!=="py"||(e.add(c),xx(c)&&r.length<oxr&&r.push(c))},{skip:rW,maxDepth:10});let n=o=>e.has(o),s=new Map;for(let o of r){let a=wx(fr.join(t,o)),c=a===void 0?void 0:YR(a,o);if(!c)continue;let l=new Set(c.imports.map(u=>KR(o,u.from,c.lang,n)).filter(u=>!!u&&!xx(u)));for(let u of l)s.set(u,(s.get(u)??0)+1)}for(let o of e){if(fr.posix.basename(o)!=="conftest.py")continue;let a=fr.posix.dirname(o),c=r.filter(l=>l.endsWith(".py")&&(a==="."||l.startsWith(`${a}/`))).length;c&&s.set(o,Math.max(s.get(o)??0,c))}let i=o=>fr.posix.basename(o)==="conftest.py";return[...s].filter(([o,a])=>a>=2&&(sxr(o)||i(o))).sort((o,a)=>a[1]-o[1]||o[0].localeCompare(a[0])).slice(0,rxr).map(([o,a])=>{let c=wx(fr.join(t,o))??"";return{rel:o,importers:a,names:axr(c,qh(o)).slice(0,ixr)}})}function jmt(t){return t.length?["The repo's shared test helpers, by how many of its test files use them:",...t.map(({label:e,module:r})=>` - ${e}${r.rel} (${r.importers} test files)${r.names.length?`: ${r.names.join(", ")}`:""}`)]:[]}var Wmt=q(require("path"));var cxr=10,lxr=3,uxr=5,dxr=/\.(?:locator|getBy[A-Z]\w*|get_by_\w+)\(/g,pxr=/^\s*(?:export\s+(?:default\s+)?)?class\s+\w+/m,mxr=/@testing-library\/|from ["']enzyme["']/,sW=t=>(t.match(dxr)??[]).length,fxr=/@playwright\/test|from\s+['"]playwright|\bpage\.(?:goto|locator|getBy\w+)\s*\(|\bcy\.(?:visit|get)\s*\(|webdriver|selenium|newSkyrampPlaywrightPage/i,Vmt=(t,e)=>Ymt(t,e)&&fxr.test(e);function hxr(t,e){if(e===void 0)return sW(t);let r=new Map;for(let s of e.split(`
|
|
797
797
|
`))r.set(s,(r.get(s)??0)+1);let n=0;for(let s of t.split(`
|
|
798
|
-
`)){let i=r.get(s)??0;i>0?r.set(s,i-1):n+=sW(s)}return n}var gxr=t=>t[Math.max(0,Math.ceil(.9*t.length)-1)],TAe=t=>ua.test(t),Ymt=(t,e)=>{let r=qh(t);return(r==="js"||r==="py")&&!mxr.test(e)};function Axr(t){let e=new Map;for(let r of t){let n=Wmt.posix.dirname(r).split("/"),s=n.findIndex(o=>/^pages?$/i.test(o)),i=s>=0?n.slice(0,s+1).join("/"):n.join("/");e.set(i,(e.get(i)??0)+(s>=0?1e3:1))}return[...e].sort((r,n)=>n[1]-r[1]||r[0].localeCompare(n[0]))[0][0]}function yxr(t){let e=[],r=new Map;for(let n of t.written){if(!TAe(n.rel)||!Vmt(n.rel,n.text))continue;let s=XD(n.rel).dir;r.set(s,[...r.get(s)??[],n])}for(let[n,s]of r){let i=t.written.filter(d=>d.before!==void 0).map(d=>({rel:d.rel,text:d.before})),o=[...t.existing,...i].filter(d=>n===""||d.rel.startsWith(`${n}/`)),a=o.filter(d=>!TAe(d.rel)&&Ymt(d.rel,d.text)&&pxr.test(d.text)&&sW(d.text)>0).map(d=>d.rel);if(a.length<lxr)continue;let c=o.filter(d=>TAe(d.rel)&&Vmt(d.rel,d.text)).map(d=>sW(d.text)).sort((d,p)=>d-p);if(c.length<uxr)continue;let l=gxr(c),u=Axr(a);for(let d of s){let p=hxr(d.text,d.before);p>=cxr&&p>l&&e.push(`${d.rel} locates ${p} elements inline, where nine in ten of the repo's specs locate ${l} or fewer and reach their pages through the page objects in ${u} \u2014 locate them in the page's page object there (a new one for a page that has none) and use it from the spec`)}}return e}var kAe="write-page-objects",Jmt={name:kAe,verify(t){let e=t.prepared?.secretGateBaseline,r=[];for(let n of kt(t.inputs)){let s=n.path===t.inputs.repositoryPath?"":qt(t.inputs,n.slug);r.push(...yxr(RAe(n.path,e)).map(i=>s+i))}return r.length?{...ve(this.name,r),repairable:!0}:{name:this.name,passed:!0}}};var Kmt=q(require("fs")),ld=q(require("path"));var BAe="write-no-app",bxr="needs the running app (a browser journey), and this run brings no app up: Validation Triage decided targeted_unit";function XR(t){if(!ma(t))return{behaviors:[],defects:[],journeys:[],browserJourneys:[],maintenance:[]};let e=ae(t,"triage.json"),r=new Map((ae(t,"analyze.json")?.behaviors??[]).map(i=>[i.id,i])),n=new Set(_D(t));return{behaviors:(e?.plan??[]).filter(i=>i.mechanism==="new_unit"&&n.delete(i.behaviorId)).map(i=>{let o=r.get(i.behaviorId);return{id:i.behaviorId,statement:o?.statement??i.behaviorId,covers:i.covers??"",where:`${qt(t.inputs,o?.repository)}${o?.evidence??""}`}}),defects:hy(t),journeys:Sm(t),browserJourneys:sy(ae(t,"plan.json")?.journeys).filter(i=>i.kind!=="in-process"),maintenance:Jr(t)?.maintenance??[]}}function PAe(t){return t.behaviors.length+t.defects.length+t.journeys.length+t.maintenance.length>0}function Xmt(t,e){let r=new Set([...t.notWritten.map(s=>s.case.trim()),...t.tests.flatMap(s=>s.covers)]),n=e.filter(s=>!r.has(s.id)).map(s=>({case:s.id,reason:bxr}));return n.length?{...t,notWritten:[...t.notWritten,...n]}:t}function _Ae(t){return kt(t.inputs).filter(e=>e.writable).flatMap(e=>{let r=ey(t.inputs,e.slug,"unit");return r?[{root:ld.resolve(e.path),slug:e.slug,dir:r}]:[]})}function Exr(t,e){let r=[],{work:n}=e,s=new Set(t.tests.flatMap(c=>c.covers)),i=new Set(t.notWritten.map(c=>c.case.trim())),o=c=>s.has(c)||i.has(c);for(let c of n.behaviors)!o(c.id)&&!e.couldBreak.has(c.id)&&r.push(`behavior "${c.id}" was planned a new in-process test and no test covers it \u2014 give it one, or say in notWritten why no in-process test can check it`);for(let c of n.defects)o(c.id)||r.push(`defect "${c.id}" has no test and is not in notWritten \u2014 give it a test that reaches it and expects the correct behaviour, or say in notWritten why no in-process test can`);for(let c of n.journeys)o(c.id)||r.push(`journey "${c.id}" has no test and is not in notWritten \u2014 walk it in one in-process test, or say in notWritten what it needs that is missing`);let a=c=>{let l=lx(c).file,u=d=>d===l||d.endsWith(`/${l}`)||l.endsWith(`/${d}`);return t.tests.some(d=>u(d.file))||[...i].some(d=>d===c||u(lx(d).file))};for(let c of n.maintenance)a(c.test)||r.push(`existing test ${c.test} (the plan says ${c.action}) is neither in tests nor in notWritten \u2014 run or maintain it in-process and list it, or put it under notWritten with what it needs that this run does not have`);for(let c of t.tests){if(c.change!=="added")continue;let l=e.read(c.file);if(!l)continue;for(let m of jj(l.body))r.push(`${c.file} uses ${m} \u2014 every test runs in one process: no network, no running app; mock outbound calls with the repo's own tools inside the test`);let u=e.placedDir?.(l.root),d=ld.dirname(l.rel).split(ld.sep).join("/");u&&u!=="."&&d!==u&&!d.startsWith(`${u}/`)&&r.push(`${c.file} is not in ${u}, where the Target puts unit tests for this repository`);let p=Em(l.root,l.rel);p&&wm(p)&&!IR(p,l.rel)&&r.push(`${c.file} is not named the way ${p} collects tests \u2014 name it the way its runner collects tests, as the repo's own tests are`)}return r}function wxr(t,e){let r=e.replace(/^\.\//,""),n=r.split("/")[0],s=[{root:t[0],rel:r},...t.slice(1).filter(i=>ld.basename(i)===n).map(i=>({root:i,rel:r.slice(n.length+1)}))];for(let i of s){let o=ld.resolve(i.root,i.rel);if(o.startsWith(i.root+ld.sep))try{return{body:Kmt.readFileSync(o,"utf-8"),root:i.root,rel:i.rel}}catch{continue}}}function Zmt(t){return{name:BAe,verify(e,r){if(!ma(e))return{name:this.name,passed:!0};let n=t(e,r);if(!n)return{name:this.name,passed:!0};let s=ae(e,"plan.json"),i=[e.inputs.repositoryPath,...(e.inputs.relatedRepos??[]).map(a=>a.path)].map(a=>ld.resolve(a)),o=Exr(n,{work:XR(e),couldBreak:s?new Set(AD(s).keys()):new Set,read:a=>wxr(i,a),placedDir:a=>_Ae(e).find(c=>c.root===a)?.dir});return o.length?{name:this.name,passed:!1,details:o.join("; "),repairable:!0}:{name:this.name,passed:!0}}}}var iW=q(require("fs"));function eft(t,e){return{name:t,verify(r,n){let s=Ey(r.inputs.requirementItems);if(s.length===0)return{name:this.name,passed:!0};let i=[];for(let o of new Set(e(r,n))){let a;try{let l=she(r,o);if(iW.statSync(l).size>GV)continue;a=iW.readFileSync(l,"utf-8")}catch{continue}let c=Dpt(a,s);c.length&&i.push(`${o} copies the words of ${c.join(" and ")} in a comment, test title or test name`)}return i.length?{name:this.name,passed:!1,repairable:!0,details:`${i.join("; ")}. Tests are public to the repository's readers: name an item only by its key and criterion number (e.g. "PAY-184 AC2", "Confluence page 3021 AC1") and keep its words out of comments, titles and test names. When you rename a test, run it again under its new name.`}:{name:this.name,passed:!0}}}}var DAe="write.json",OAe=["adapt.json","generate.json","generate-ui.json","finalize.json",Fh],rft="write-no-secret-leak",nft="write-checkout-intact",sft="write-dependencies",aW=t=>bs.join(t.outputsDir,"write-scratch"),Ai=t=>bs.join(aW(t),DAe);function ift(t){if(ma(t))return Sm(t);let e=ae(t,"plan.json")?.journeys;if(!Array.isArray(e)||!e.length)return[];let r=new Set((Jr(t)?.generate??[]).map(n=>n.id));return e.filter(n=>n&&typeof n.id=="string"&&Array.isArray(n.steps)&&r.has(n.id))}function xxr(t,e={}){if(!t.length)return[];let r=e.noApp?["Each is one in-process test of the whole flow: it drives the UI the way the repo's in-process tests do, checks after","each step what the user then sees, and asserts every part of the outcome at the end. Mark each step so a failure","names it (a labelled assertion, or the runner's own step or subtest), and let a failed check go on to the next step","where the test still allows it.","A journey no in-process test can walk here goes under notWritten, with what it needs that is missing: it is","reported as not covered, never left out."]:["Each is one test of the whole flow, of its kind. A browser journey runs against the real app: it opens the entry route","and does every step through the UI in order (no URL jump to a later step, no stub of the app's own network). An","in-process journey drives the UI the way the repo's in-process tests do. Either checks after each step what the user then sees, and","asserts every part of the outcome at the end, after a reload where it must persist. Mark each step so a failure names it (in Playwright, test.step),","and let a failed check go on to the next step where the page still allows it, so one defect does not hide the rest.","A journey whose test cannot run here (a browser, package or service it needs cannot be set up) goes under notWritten,","with what is missing: it is reported as not covered, never left out."];return["User journeys:",...t.map(n=>[` - ${n.id} ${n.name} \u2192 ${n.testFile}`,` entry: ${n.entry}`,` steps: ${sR(n)}`,` outcome: ${n.outcome}`].join(`
|
|
798
|
+
`)){let i=r.get(s)??0;i>0?r.set(s,i-1):n+=sW(s)}return n}var gxr=t=>t[Math.max(0,Math.ceil(.9*t.length)-1)],TAe=t=>ua.test(t),Ymt=(t,e)=>{let r=qh(t);return(r==="js"||r==="py")&&!mxr.test(e)};function Axr(t){let e=new Map;for(let r of t){let n=Wmt.posix.dirname(r).split("/"),s=n.findIndex(o=>/^pages?$/i.test(o)),i=s>=0?n.slice(0,s+1).join("/"):n.join("/");e.set(i,(e.get(i)??0)+(s>=0?1e3:1))}return[...e].sort((r,n)=>n[1]-r[1]||r[0].localeCompare(n[0]))[0][0]}function yxr(t){let e=[],r=new Map;for(let n of t.written){if(!TAe(n.rel)||!Vmt(n.rel,n.text))continue;let s=XD(n.rel).dir;r.set(s,[...r.get(s)??[],n])}for(let[n,s]of r){let i=t.written.filter(d=>d.before!==void 0).map(d=>({rel:d.rel,text:d.before})),o=[...t.existing,...i].filter(d=>n===""||d.rel.startsWith(`${n}/`)),a=o.filter(d=>!TAe(d.rel)&&Ymt(d.rel,d.text)&&pxr.test(d.text)&&sW(d.text)>0).map(d=>d.rel);if(a.length<lxr)continue;let c=o.filter(d=>TAe(d.rel)&&Vmt(d.rel,d.text)).map(d=>sW(d.text)).sort((d,p)=>d-p);if(c.length<uxr)continue;let l=gxr(c),u=Axr(a);for(let d of s){let p=hxr(d.text,d.before);p>=cxr&&p>l&&e.push(`${d.rel} locates ${p} elements inline, where nine in ten of the repo's specs locate ${l} or fewer and reach their pages through the page objects in ${u} \u2014 locate them in the page's page object there (a new one for a page that has none) and use it from the spec`)}}return e}var kAe="write-page-objects",Jmt={name:kAe,verify(t){let e=t.prepared?.secretGateBaseline,r=[];for(let n of kt(t.inputs)){let s=n.path===t.inputs.repositoryPath?"":qt(t.inputs,n.slug);r.push(...yxr(RAe(n.path,e)).map(i=>s+i))}return r.length?{...ve(this.name,r),repairable:!0}:{name:this.name,passed:!0}}};var Kmt=q(require("fs")),ld=q(require("path"));var BAe="write-no-app",bxr="needs the running app (a browser journey), and this run brings no app up: Validation Triage decided targeted_unit";function XR(t){if(!ma(t))return{behaviors:[],defects:[],journeys:[],browserJourneys:[],maintenance:[]};let e=ae(t,"triage.json"),r=new Map((ae(t,"analyze.json")?.behaviors??[]).map(i=>[i.id,i])),n=new Set(_D(t));return{behaviors:(e?.plan??[]).filter(i=>i.mechanism==="new_unit"&&n.delete(i.behaviorId)).map(i=>{let o=r.get(i.behaviorId);return{id:i.behaviorId,statement:o?.statement??i.behaviorId,covers:i.covers??"",where:`${qt(t.inputs,o?.repository)}${o?.evidence??""}`}}),defects:hy(t),journeys:Sm(t),browserJourneys:sy(ae(t,"plan.json")?.journeys).filter(i=>i.kind!=="in-process"),maintenance:Jr(t)?.maintenance??[]}}function PAe(t){return t.behaviors.length+t.defects.length+t.journeys.length+t.maintenance.length>0}function Xmt(t,e){let r=new Set([...t.notWritten.map(s=>s.case.trim()),...t.tests.flatMap(s=>s.covers)]),n=e.filter(s=>!r.has(s.id)).map(s=>({case:s.id,reason:bxr}));return n.length?{...t,notWritten:[...t.notWritten,...n]}:t}function _Ae(t){return kt(t.inputs).filter(e=>e.writable).flatMap(e=>{let r=ey(t.inputs,e.slug,"unit");return r?[{root:ld.resolve(e.path),slug:e.slug,dir:r}]:[]})}function Exr(t,e){let r=[],{work:n}=e,s=new Set(t.tests.flatMap(c=>c.covers)),i=new Set(t.notWritten.map(c=>c.case.trim())),o=c=>s.has(c)||i.has(c);for(let c of n.behaviors)!o(c.id)&&!e.couldBreak.has(c.id)&&r.push(`behavior "${c.id}" was planned a new in-process test and no test covers it \u2014 give it one, or say in notWritten why no in-process test can check it`);for(let c of n.defects)o(c.id)||r.push(`defect "${c.id}" has no test and is not in notWritten \u2014 give it a test that reaches it and expects the correct behaviour, or say in notWritten why no in-process test can`);for(let c of n.journeys)o(c.id)||r.push(`journey "${c.id}" has no test and is not in notWritten \u2014 walk it in one in-process test, or say in notWritten what it needs that is missing`);let a=c=>{let l=lx(c).file,u=d=>d===l||d.endsWith(`/${l}`)||l.endsWith(`/${d}`);return t.tests.some(d=>u(d.file))||[...i].some(d=>d===c||u(lx(d).file))};for(let c of n.maintenance)a(c.test)||r.push(`existing test ${c.test} (the plan says ${c.action}) is neither in tests nor in notWritten \u2014 run or maintain it in-process and list it, or put it under notWritten with what it needs that this run does not have`);for(let c of t.tests){if(c.change!=="added")continue;let l=e.read(c.file);if(!l)continue;for(let m of jj(l.body))r.push(`${c.file} uses ${m} \u2014 every test runs in one process: no network, no running app; mock outbound calls with the repo's own tools inside the test`);let u=e.placedDir?.(l.root),d=ld.dirname(l.rel).split(ld.sep).join("/");u&&u!=="."&&d!==u&&!d.startsWith(`${u}/`)&&r.push(`${c.file} is not in ${u}, where the Target puts unit tests for this repository`);let p=Em(l.root,l.rel);p&&wm(p)&&!IR(p,l.rel)&&r.push(`${c.file} is not named the way ${p} collects tests \u2014 name it the way its runner collects tests, as the repo's own tests are`)}return r}function wxr(t,e){let r=e.replace(/^\.\//,""),n=r.split("/")[0],s=[{root:t[0],rel:r},...t.slice(1).filter(i=>ld.basename(i)===n).map(i=>({root:i,rel:r.slice(n.length+1)}))];for(let i of s){let o=ld.resolve(i.root,i.rel);if(o.startsWith(i.root+ld.sep))try{return{body:Kmt.readFileSync(o,"utf-8"),root:i.root,rel:i.rel}}catch{continue}}}function Zmt(t){return{name:BAe,verify(e,r){if(!ma(e))return{name:this.name,passed:!0};let n=t(e,r);if(!n)return{name:this.name,passed:!0};let s=ae(e,"plan.json"),i=[e.inputs.repositoryPath,...(e.inputs.relatedRepos??[]).map(a=>a.path)].map(a=>ld.resolve(a)),o=Exr(n,{work:XR(e),couldBreak:s?new Set(AD(s).keys()):new Set,read:a=>wxr(i,a),placedDir:a=>_Ae(e).find(c=>c.root===a)?.dir});return o.length?{name:this.name,passed:!1,details:o.join("; "),repairable:!0}:{name:this.name,passed:!0}}}}var iW=q(require("fs"));function eft(t,e){return{name:t,verify(r,n){let s=Ey(r.inputs.requirementItems);if(s.length===0)return{name:this.name,passed:!0};let i=[];for(let o of new Set(e(r,n))){let a;try{let l=she(r,o);if(iW.statSync(l).size>GV)continue;a=iW.readFileSync(l,"utf-8")}catch{continue}let c=Dpt(a,s);c.length&&i.push(`${o} copies the words of ${c.join(" and ")} in a comment, test title or test name`)}return i.length?{name:this.name,passed:!1,repairable:!0,details:`${i.join("; ")}. Tests are public to the repository's readers: name an item only by its key and criterion number (e.g. "PAY-184 AC2", "Confluence page 3021 AC1") and keep its words out of comments, titles and test names. When you rename a test, run it again under its new name.`}:{name:this.name,passed:!0}}}}var DAe="write.json",OAe=["adapt.json","generate.json","generate-ui.json","finalize.json",Fh],rft="write-no-secret-leak",nft="write-checkout-intact",sft="write-dependencies",aW=t=>bs.join(t.outputsDir,"write-scratch"),Ai=t=>bs.join(aW(t),DAe);function ift(t){if(ma(t))return Sm(t);let e=ae(t,"plan.json")?.journeys;if(!Array.isArray(e)||!e.length)return[];let r=new Set((Jr(t)?.generate??[]).map(n=>n.id));return e.filter(n=>n&&typeof n.id=="string"&&Array.isArray(n.steps)&&r.has(n.id))}function xxr(t,e={}){if(!t.length)return[];let r=e.noApp?["Each is one in-process test of the whole flow: it drives the UI the way the repo's in-process tests do, checks after","each step what the user then sees, and asserts every part of the outcome at the end. Mark each step so a failure","names it (a labelled assertion, or the runner's own step or subtest), and let a failed check go on to the next step","where the test still allows it.","A journey no in-process test can walk here goes under notWritten, with what it needs that is missing: it is","reported as not covered, never left out."]:["Each is one test of the whole flow, of its kind. A browser journey runs against the real app: it opens the entry route","and does every step through the UI in order (no URL jump to a later step, no stub of the app's own network). An","in-process journey drives the UI the way the repo's in-process tests do. Either checks after each step what the user then sees, and","asserts every part of the outcome at the end, after a reload where it must persist. Where a step lands on another page (a","redirect after a save, a detail or confirmation page), check on that page what it shows of what the user entered or saved","(the values, totals and counts), not only its address. Mark each step so a failure names it (in Playwright, test.step),","and let a failed check go on to the next step where the page still allows it, so one defect does not hide the rest.","A journey whose test cannot run here (a browser, package or service it needs cannot be set up) goes under notWritten,","with what is missing: it is reported as not covered, never left out."];return["User journeys:",...t.map(n=>[` - ${n.id} ${n.name} \u2192 ${n.testFile}`,` entry: ${n.entry}`,` steps: ${sR(n)}`,` outcome: ${n.outcome}`].join(`
|
|
799
799
|
`)),...r,'List each under "journeys" in your result (its file and test title, and where it broke when it did) and put its id in',`that file's "covers".`,""]}function oW(t){return ma(t)?!1:(Jr(t)?.generate??[]).some(e=>e.type==="ui")}function Sxr(t){let e=BR(t);if(e){for(let n of[...OAe,zc])Yc.rmSync(bs.join(t.outputsDir,n),{force:!0});return{ok:!1,reasons:[e]}}let r=Jr(t);return r?r.generate.length===0&&r.maintenance.length===0&&!PAe(XR(t))?{ok:!1,reasons:["the plan has no test cases and no maintenance"]}:{ok:!0,reasons:[]}:{ok:!1,reasons:["no test plan (recommend.json) to write tests from"]}}function Cxr(t){let e=ihe(t),r=MV(t);for(let c of[...OAe,"write.json",vR,zc])Yc.rmSync(bs.join(t.outputsDir,c),{force:!0});let n=oW(t),s=(Jr(t)?.generate??[]).some(c=>c.type!=="ui")||PAe(XR(t)),{packages:i,notes:o}=Cdt(t,{ui:n,backend:s});oft(t,i);let a=[...o,...hx(t,"backend",[],{declaredOnly:!0,packages:i}),...n?hx(t,"ui",[],{declaredOnly:!0,packages:i}):[]];return{checkpoint:bs.join(aW(t),DAe),secretGateBaseline:e,checkoutHeads:r,provisionNotes:a,sharedHelpers:Ixr(t),testPackages:i,dependencyBaseline:ihe(t)}}function oft(t,e){let r=bs.join(t.outputsDir,zc);e.length===0?Yc.rmSync(r,{force:!0}):Yc.writeFileSync(r,JSON.stringify({schemaVersion:1,packages:[...e]},null,2)+`
|
|
800
800
|
`)}function Ixr(t){try{return jmt(kt(t.inputs).flatMap(e=>{let r=e.path===t.inputs.repositoryPath?"":qt(t.inputs,e.slug);return Gmt(e.path).map(n=>({label:r,module:n}))}))}catch{return[]}}function vxr(t){let e=Lc(t.inputs)?["It is a shared environment this policy protects: write and run no test that changes state there (a create, edit or delete, a form that submits, a setup that seeds); list any such test in notWritten instead."]:[];if(t.inputs.appRunning){let o=sj(ae(t,`${da}.json`));return[t.inputs.appRunning.trim(),...e,...o?[o]:[]]}let r=ae(t,"deploy.json"),n=Vc(t.inputs.repositoryPath),s=n.setupScript?`start it with ${bs.relative(t.inputs.repositoryPath,n.setupScript)} and check it answers`:"start it the way the repo documents";if(lhe(r)){let o=Object.entries(r.baseUrls??{}).map(([c,l])=>`${c} ${l}`).join(", "),a=r.health?.url??r.health?.command;return[`The app is running${o?`: ${o}`:""}.${a?` Health check: ${a}`:""}`,`If it stops answering, ${s}.`]}return[`The app may not be running.${r?.bringupError?.output?` Planning could not start it: ${r.bringupError.output.slice(0,300)}`:""} Check, and if it isn't up, ${s}; leave it running.`,"If you can't get it running, still write the tests and record them as not run (exit null)."]}function Rxr(t){let e=_Ae(t);return["No app is running, and none is started for this run: Validation Triage decided the change is proven in-process","(targeted_unit). Every test runs in one process, the way the repo's own in-process tests run: no network or running","app, so nothing that calls a live service, the Skyramp client and its runtime mocks included. Mock outbound calls","(HTTP, queues, other services) inside the test with the repo's own fixtures and mocking tools. Run the tests the way","the repo's CI runs them (its runner, config and environment), selected as step 4 says. Each new test file is named the way its runner","collects tests, as the repo's own tests are. Maintain every stale existing test that can run in-process. An existing","test that needs the running app goes under notWritten, by its path, with what it needs that this run does not have:","it is reported as not covered.",...e.length?["The Target puts new unit tests in these directories, over the repo's own layout: put each new test under its repository's directory, not beside the existing tests:",...e.map(r=>` - ${qt(t.inputs,r.slug)}${r.dir}/`)]:[]]}function Nxr(t){return[...t.behaviors.length?['Behaviors that need a new in-process test (give each id in "covers"):',...t.behaviors.map(e=>` - ${e.id}: ${e.statement}
|
|
801
801
|
missing evidence to obtain: ${e.covers||"(unstated)"}
|
package/dist/post.js
CHANGED
|
@@ -571,8 +571,8 @@ ${a.body.slice(0,6e3)}
|
|
|
571
571
|
${iTt(t,e)}`}function iTt(t,e){if(t.inputs.appRunning)return[`${t.inputs.appRunning.trim()} Don't start it again: check it answers a real request with real data, and fill "app" with outcome clean (or bringup-failed, with why, if it doesn't answer) and its base URLs.`,e.revisionRead].filter(Boolean).join(`
|
|
572
572
|
`);let r=t.inputs.repositoryPath,n=e.recipe;return n.present?[`Bring the app up so the tests can run against it, and leave it running. The repo records how: ${[n.setupScript,n.teardownScript,n.authTokenScript,n.workspaceFile].filter(i=>!!i).map(i=>zn.relative(r,i)).join(", ")}.`,"Run it. If it has drifted, fix it and update those files to what actually worked. If this PR broke start-up, that's","a defect \u2014 say which changed file. Check that the app answers a real request with real data, not just an open port.",...n.budgetMinutes?[`Start-up can legitimately take up to ${n.budgetMinutes} minutes.`]:[],...n.healthHint?[`A known-good health check: ${JSON.stringify(n.healthHint)}`]:[],...n.stale?[`This PR changes start-up files (${n.staleFiles.join(", ")}), so the recipe may be out of date.`]:[]].join(`
|
|
573
573
|
`):["Bring the app up so the tests can run against it, and leave it running. The repo has no recorded way to start it","(.skyramp/sut/setup.sh). If you can start it from the repo's own docs or compose files without much effort, do, and","save what worked as .skyramp/sut/setup.sh and .skyramp/sut/teardown.sh. Otherwise set app.outcome to bringup-failed and say why."].join(`
|
|
574
|
-
`)}var tO=t=>!!t.appRunning&&no(t),oTt=new Set(["mutates"]);function aTt(t){return tO(t.inputs)?[" The app runs in a shared environment this policy protects. A case or clause whose test changes state there (an"," API POST, PUT, PATCH or DELETE, in the test or its setup, or a UI flow that submits, creates, edits or deletes) is"," withheld by the runner and reported as a gap: prefer cases that only read, and mark each that still changes state,",' and each such maintenance item, "mutates": true.']:[]}function cTt(t,e){if(t.inputs.planOnly)return[];if(!t.inputs.appRunning&&e.preflight&&!e.preflight.sutRequired)return[];let r=zn.join(zn.dirname(e.checkpoint),"probe");return tO(t.inputs)?["8. Only under runtime_required: probe the running app before any test is written (skip this and 9 if it isn't"," answering). It is a shared environment this policy protects: send only requests that change nothing (GET and"," HEAD: reads, lists, searches, filters, sorts) and never create, edit, delete, reset or seed anything there. Put",` every probe in one script under ${r}* and run it once, printing one line per probe: what it read, the status`," codes, and which check failed. Probe what the change touches through reads: every state its records can be in,"," every field it adds through list, sort, filter and search, and odd query values (zero, negative, huge, empty, case"," variants). Flag any 5xx, and reads that disagree with each other or with derived values (totals, counts).","9. Re-run each flagged probe once. Each that repeats and involves what the change touched is a defect: add it to",' "findings" with the request and response as its evidence, and a case for it. Then write the updated plan to',` ${e.checkpoint} again.`]:["8. Only under runtime_required: probe the running app before any test is written (skip this and 9 if it isn't"," answering). Put every probe in one",` script under ${r}* and run it once, printing one line per probe: what it did, the status codes, and which`," check failed. Probe what the change touches:"," - every state its records can be in (from the code's status fields and enums) \xD7 every operation the change adds or alters;"," - sequences: write then read back; set, reset, read; edit twice; delete then edit; write then list;"," - payloads: zero, negative, huge, empty, null, missing and extra fields, wrong types, case variants, more items"," than a page holds, one valid and one invalid item together;"," - every field the change adds, through the existing list, sort, filter and search."," Read the record before and after each action. Flag any 5xx; a rejected request that changed anything; a read that"," differs from what was written; a repeated request that changed something more; derived values (totals, counts)"," that disagree with their inputs; an operation that succeeds on a record in a final state (cancelled, shipped, deleted).","9. Re-run each flagged probe once. Each that repeats and involves what the change touched is a defect: add it to",' "findings" with the request and response as its evidence, and a case whose steps are that request sequence and',` whose expected outcome is the correct behaviour. Then write the updated plan to ${e.checkpoint} again.`]}function IOe(t){let e=Ir(t);return e?F4(Wa(e,"").map(r=>r.path)):[]}function X5(t){let e=IOe(t);if(!e.length&&!L4(t.inputs.repositoryPath))return[];let r=e.slice(0,8).join(", ")+(e.length>8?", \u2026":"");return[' User journeys: under "journeys", the flows a user walks through the UI, each from where a user normally starts it'," to the outcome they came for, that together pass through everything the change alters that a user sees or does:"," every ui clause is in some journey's steps (or under notInJourney, with why no journey reaches it). Use as many"," journeys as that takes. For each: the entry route; every step in order, with the clauses it exercises and what the user then sees;"," the outcome that shows the journey worked; its source \u2014 the spec or PR description that describes the flow (quote it),"," else inferred; and the test file it belongs in. Each becomes one test of the whole flow as the PR intends it (its kind):"," in-process only where the repo's own in-process UI tests (component tests under jsdom or the like, for that code) can"," walk and check all of it \u2014 a request-level test client (Django's, Flask's, Rails integration tests) runs no page script"," and does not count \u2014 else a browser test, which needs the running app, so the decision is runtime_required (step 4)."," The changed step is inside the flow, not the whole of it: the
|
|
575
|
-
`)).map(i=>i?` ${i}`:""))([...s5(t,e.triage.change),"",...i5(t,e.triage),...r?["",`Run budget: ${r} minutes for the whole run, including everything you plan. Name in gaps what it cannot cover.`]:[],"","Scope: validate what this change alters or newly reaches, and what the PR description or a spec states.","- Out of scope is only a clause the change cannot reach: its deciding code is unchanged and no changed path leads to it, or it lives in a checkout the change does not touch. List it under outOfScope with the unchanged line that decides it (path:line), and plan nothing for it. Code the change newly calls or feeds new values to is in scope, and so is a defect it exposes there.","","The evidence ladder \u2014 use the cheapest mechanism that establishes each clause in scope:"," existing_evidence an accepted ci-<n> result. A check you ran (typecheck, compile, test collection) establishes only a prerequisite clause \u2014 that the change builds or its config parses \u2014 never a behaviour"," unaffected the change cannot reach this clause: no changed code path leads to it \u2014 cite the code that shows it (path:line); never for a clause decided in a changed file"," existing_unit existing native unit tests that exercise the clause"," new_unit a new in-process test, for evidence nothing provides yet"," runtime only the running application can establish it","A clause only the running app can check is runtime, not a gap, even when every other clause is in-process. It is a gap only when the app cannot be run here; then name what is missing.","Give each clause the kind of test the repo already uses for the code it checks \u2014 in-process where the repo tests that code in-process, runtime where it tests it against the running app \u2014 unless that kind cannot check it; then the kind that can.",`Browser-only: for every clause, ask whether its behaviour happens only in a browser \u2014 real clicks or keys driving page script, client-side sorting or filtering, script-driven DOM updates, focus, drag-and-drop, navigation, rendering that depends on CSS or JavaScript \u2014 and if so mark it browserOnly. A test that only checks markup (a class or attribute present, the HTML a request returns) proves the precondition, not the behaviour: the header having the sort class does not show that "clicking a column header sorts the list". A browser-only clause is tested in a browser: in the repo's in-process browser harness where it has one \u2014 a Django LiveServerTestCase or StaticLiveServerTestCase, or pytest-django live_server, suite that drives Selenium or Playwright; component tests under jsdom only when the repo's own jsdom tests already drive that kind of interaction \u2014 named as its browserHarness (the suite's path), and the clause stays new_unit, with its triage item's covers saying it is driven in that browser suite; else decide runtime_required with a browser test of it. A markup check may be added, not substituted.`,"","Decisions:","- existing_evidence_sufficient means every clause in scope is established by existing evidence, with no gaps.","- targeted_unit plans unit tests and nothing that needs a running app.","- runtime_required marks at least one clause runtime, and plans no new unit tests: once the app is needed, this plan's cases are every new test, each still written the way the repo tests that code \u2014 in-process where that can check its clause, in the browser only where it cannot. The existing unit tests you identify still run, as existing_unit.","- The journeys and maintenance of step 5 can need the app too, so plan them before you decide. Decide runtime_required when any journey needs a browser \u2014 real JavaScript or htmx behaviour, navigation across pages, what persists after a reload, or a server-rendered page the repo tests only at the request level \u2014 and mark runtime the clauses its steps exercise.",'- Decide runtime_required as well when any test under "maintenance" calls the deployed app \u2014 API, contract, integration, end-to-end or UI tests that reach it at its address (BASE_URL or the like), and Skyramp tests \u2014 and checks what the change itself alters, and mark runtime the clauses it checks, so it is verified against the app. So does a browser part the plan itself says goes untested, and a browser-only clause the repo has no in-process browser harness for.',"- A test that starts its own live server in the test process and drives it in a browser (Django's LiveServerTestCase or StaticLiveServerTestCase, pytest-django's live_server, with Selenium or Playwright) needs no deployed app: under targeted_unit it is maintained and run in-process, with the repo's CI settings and a headless browser.","- When the app cannot be run here, list each such journey's clauses under notInJourney, and each such test under gaps, with what is missing: it is reported not covered, never dropped. So is a browser-only clause with no in-process browser harness: name it under gaps with what is missing.","- Only what the change itself alters decides it. A journey or browser-only clause only for what the change could break elsewhere (a could-break requirement), or for UI code the change does not touch when it touches no UI code, does not make the decision runtime_required: off the runtime path list its clauses under notInJourney and the browser-only ones under gaps, with what is missing (a browser, downstream of this change), so it is reported not covered. Nor does a maintained test that calls the deployed app only for such clauses: give each maintained test the clauses it checks, and name such a test under gaps with what is missing (the running app, downstream of this change).","- blocked_preflight: the change cannot meet a basic prerequisite. It names the changed file the failure is in and quotes the error, and plans nothing. A check that fails for an environment reason (a dependency not installed, a missing tool) is not the change failing \u2014 never block on it.","","Rules:","- Every clause is planned, listed in gaps, or listed under outOfScope, by its id (R1a). A gap is evidence this run cannot obtain; a test this run will execute (existing_unit, new_unit, runtime) is not one, even when you could not run it while planning.","- Only accepted ci-<n> items, and passing checks you ran for prerequisite clauses, can establish a clause. A stale, untrusted, pending, failing or inconclusive result establishes nothing; a trusted result that failed is a reason to plan evidence, never a pass. AI review is advisory, never evidence.","- Find the existing tests yourself: where the repo keeps tests of the changed code, and their framework.",'- Existing tests that call a running app (API, contract, integration, end-to-end or UI tests) are never evidence: list them in "maintenance" (verify, or update).',"- Repository evidence is only native unit tests, which run without the app. Every repository evidence item lists its tests as repo-relative paths (path::test-name when the file holds more than the relevant ones) \u2014 only the tests that exercise the changed behavior, never the whole suite.",`- ${_Q}`,`- ${QE}`,"- Every repository evidence item is run: cite it from an existing_unit item for the clauses it exercises. Only under existing_evidence_sufficient is nothing run: cite it from the existing_evidence item it supports instead.","- Plan new_unit only for what no existing test asserts, or asserts differently from the requirement (the boundary the change moved); never for what existing tests already prove.","- When the PR description or a spec states the expected behavior, plan evidence for what it states, not for what the code does.","- Evidence items are existing repository tests (source repository) and checks you ran with Bash (source testbot), each with a unique id; the ci-<n> results above are not restated. Run each check as one plain command \u2014 no `&&`, pipes or `echo` \u2014 and copy it into its evidence exactly. Don't start the application, install dependencies or run test suites for triage."])]}function uTt(t){let e=t.prepared,r=t.inputs.repositoryPath,n=e.preflight?.repository.currentBranch??"HEAD",s=e.preflight?.repository.baseBranch??t.inputs.baseBranch??"origin/main";return["Plan functional tests for this PR. You won't write the tests: another session will, working from your plan alone,","so whatever it needs has to be in the plan.","",`The repo is at ${r}, checked out on branch \`${n}\`. You can see the change with \`git diff ${s}...HEAD\`.`,"Ignore .skyramp/ \u2014 it is Skyramp's own setup, not part of the change.",...e6(t),...na(t.inputs),...gOe(t.inputs),...yOe(t.inputs),"","1. Read the change: the diff, the description, and any spec, issue or design doc either of them points to.","2. List the requirements: everything the description or a spec states or clearly implies and, where they say"," nothing, what the change is evidently meant to do. Split each into independently testable clauses: each input"," class, boundary, error path, and anything that must stay unchanged. For each clause, write the expected outcome.",` Each requirement's id is the label the description or spec gives it ("AC-3", "REQ-12"; item 4 of a numbered list`," is R4), else R1, R2\u2026 in order, numbering on after the highest R-label the source uses (R6 after its R5). Where two"," items give the same label, put the item's key in front (PAY-184-AC1, PAY-185-AC1). A clause id is its"," requirement's id plus a letter (AC-3a), and each id is used once. Every case, clause and journey step keeps these"," ids and names a clause or finding the plan has; a finding names the requirement or clause it breaks."," Where the description or spec sets it, it wins over the code: if they disagree, the code is what's wrong. Where"," nothing is stated, take it from the change's evident intent; code that contradicts that intent, or itself"," elsewhere, is still a defect. Where the outcome is left open, expect only what any correct implementation must"," do, and say so."," Then list what the change could break that no requirement mentions \u2014 other callers of the functions it changed,"," other paths that read or write the same data, behaviour right next to the change \u2014 and add each as a requirement"," of its own (source could-break, evidence the code it could break), with its clauses.",' For each clause, give under "code" the path:line of the code that decides it, when there is one.',"3. Note every defect you find in the change, with the line that shows it.",...lTt(t,e),"5. Only under runtime_required, and only for the clauses your triage marks runtime and the defects: write the test",' plan. Under any other decision leave "cases" empty and give no clause a test: the evidence'," comes from triage's plan."," Write the test plan on the clauses themselves: each clause gets the test that checks it (type, target, steps;",` its expected outcome is the clause's, and its kind the one the repo already uses for that code, unless that kind cannot check it), or, on the clause, why it can't be tested here. Add to "cases" a second`," test for a clause where one is needed, and one case for every defect you found \u2014 even where a clause's test"," covers the same ground. A defect's case reaches the defect itself (the state, input or sequence that shows it)"," and expects the correct behaviour, so it fails on this branch; where the requirement allows more than one correct"," outcome (reject, or cap), it accepts each of them, so it passes on any fix.",' Under every decision, list under "maintenance" the existing tests you can see the change makes wrong or stale,'," and whether to update, delete, regenerate or just re-run (verify) each \u2014 a starting point: the step that writes"," the tests runs the affected tests and finds the rest. One that calls the deployed app to check what the change itself alters makes the decision runtime_required (step 4); a live-server test, which runs in-process, does not.",...X5(t),`6. Write the plan as JSON (below), "triage" included, to ${e.checkpoint} now, before anything is started.`,`7. ${sTt(t,e)}`,...cTt(t,e),...aTt(t),"",`Stay inside the checkout and don't commit or push. When you're done, update ${e.checkpoint} with "app" filled in;`,"that file is what's read. End with a one-line final message \u2014 don't repeat the plan in it. The plan's JSON:","",or(po,0,tO(t.inputs)?new Set:oTt)].join(`
|
|
574
|
+
`)}var tO=t=>!!t.appRunning&&no(t),oTt=new Set(["mutates"]);function aTt(t){return tO(t.inputs)?[" The app runs in a shared environment this policy protects. A case or clause whose test changes state there (an"," API POST, PUT, PATCH or DELETE, in the test or its setup, or a UI flow that submits, creates, edits or deletes) is"," withheld by the runner and reported as a gap: prefer cases that only read, and mark each that still changes state,",' and each such maintenance item, "mutates": true.']:[]}function cTt(t,e){if(t.inputs.planOnly)return[];if(!t.inputs.appRunning&&e.preflight&&!e.preflight.sutRequired)return[];let r=zn.join(zn.dirname(e.checkpoint),"probe");return tO(t.inputs)?["8. Only under runtime_required: probe the running app before any test is written (skip this and 9 if it isn't"," answering). It is a shared environment this policy protects: send only requests that change nothing (GET and"," HEAD: reads, lists, searches, filters, sorts) and never create, edit, delete, reset or seed anything there. Put",` every probe in one script under ${r}* and run it once, printing one line per probe: what it read, the status`," codes, and which check failed. Probe what the change touches through reads: every state its records can be in,"," every field it adds through list, sort, filter and search, and odd query values (zero, negative, huge, empty, case"," variants). Flag any 5xx, and reads that disagree with each other or with derived values (totals, counts).","9. Re-run each flagged probe once. Each that repeats and involves what the change touched is a defect: add it to",' "findings" with the request and response as its evidence, and a case for it. Then write the updated plan to',` ${e.checkpoint} again.`]:["8. Only under runtime_required: probe the running app before any test is written (skip this and 9 if it isn't"," answering). Put every probe in one",` script under ${r}* and run it once, printing one line per probe: what it did, the status codes, and which`," check failed. Probe what the change touches:"," - every state its records can be in (from the code's status fields and enums) \xD7 every operation the change adds or alters;"," - sequences: write then read back; set, reset, read; edit twice; delete then edit; write then list;"," - payloads: zero, negative, huge, empty, null, missing and extra fields, wrong types, case variants, more items"," than a page holds, one valid and one invalid item together;"," - every field the change adds, through the existing list, sort, filter and search."," Read the record before and after each action. Flag any 5xx; a rejected request that changed anything; a read that"," differs from what was written; a repeated request that changed something more; derived values (totals, counts)"," that disagree with their inputs; an operation that succeeds on a record in a final state (cancelled, shipped, deleted).","9. Re-run each flagged probe once. Each that repeats and involves what the change touched is a defect: add it to",' "findings" with the request and response as its evidence, and a case whose steps are that request sequence and',` whose expected outcome is the correct behaviour. Then write the updated plan to ${e.checkpoint} again.`]}function IOe(t){let e=Ir(t);return e?F4(Wa(e,"").map(r=>r.path)):[]}function X5(t){let e=IOe(t);if(!e.length&&!L4(t.inputs.repositoryPath))return[];let r=e.slice(0,8).join(", ")+(e.length>8?", \u2026":"");return[' User journeys: under "journeys", the flows a user walks through the UI, each from where a user normally starts it'," to the outcome they came for, that together pass through everything the change alters that a user sees or does:"," every ui clause is in some journey's steps (or under notInJourney, with why no journey reaches it). Use as many"," journeys as that takes. For each: the entry route; every step in order, with the clauses it exercises and what the user then sees;"," the outcome that shows the journey worked; its source \u2014 the spec or PR description that describes the flow (quote it),"," else inferred; and the test file it belongs in. Each becomes one test of the whole flow as the PR intends it (its kind):"," in-process only where the repo's own in-process UI tests (component tests under jsdom or the like, for that code) can"," walk and check all of it \u2014 a request-level test client (Django's, Flask's, Rails integration tests) runs no page script"," and does not count \u2014 else a browser test, which needs the running app, so the decision is runtime_required (step 4)."," The changed step is inside the flow, not the whole of it. The journey starts where the user starts the flow and"," gets to the changed step through the page: what an earlier step of the same flow creates (the record a change then"," edits) the journey creates through the app's own form, not through the API. That is for the journey only: the other"," cases keep using the records the app already has wherever the change reads or edits existing data, since a record"," made fresh for the test can hide a defect that shows only on older data. The journey ends where the user sees the result,"," which may be past the changed page: the next page built from what was saved, or a record it links to. After a"," change that saves something, a step reloads or reopens it and checks it held. Code that decides what a page shows"," counts though no page changed (a composable, store, hook, style or theme it renders from): what the user then sees"," is in a journey, whatever unit test also checks it."," A repo with no browser tests is no reason to leave a clause out: its browser journeys go in a test package of their own."," Empty when the change alters nothing a user sees; then say so under notInJourney, per clause, with why. A change"," to UI code that alters what the page holds along a user flow (a DOM attribute, the theme, other client state the"," flow sets) owes a journey that asserts it, even when nothing in the repo reads it yet: that nothing reads it, or"," that the user cannot see it, is no reason to leave it out.",...e.length?[` The change touches UI files: ${r}.`]:[]]}function lTt(t,e){let{budgetMinutes:r}=t.inputs;return["4. Validation triage, before anything is started: decide what evidence each clause still needs and the cheapest",' reliable way to get it, and save it as "triage" (its behaviorIds are your clause ids). The app is brought up only'," when the decision is runtime_required; existing evidence or native unit tests can often validate a change"," without it. You are not a code reviewer here: no style, naming or architecture commentary.","",...(s=>s.flatMap(i=>i.split(`
|
|
575
|
+
`)).map(i=>i?` ${i}`:""))([...s5(t,e.triage.change),"",...i5(t,e.triage),...r?["",`Run budget: ${r} minutes for the whole run, including everything you plan. Name in gaps what it cannot cover.`]:[],"","Scope: validate what this change alters or newly reaches, and what the PR description or a spec states.","- Out of scope is only a clause the change cannot reach: its deciding code is unchanged and no changed path leads to it, or it lives in a checkout the change does not touch. List it under outOfScope with the unchanged line that decides it (path:line), and plan nothing for it. Code the change newly calls or feeds new values to is in scope, and so is a defect it exposes there.","","The evidence ladder \u2014 use the cheapest mechanism that establishes each clause in scope:"," existing_evidence an accepted ci-<n> result. A check you ran (typecheck, compile, test collection) establishes only a prerequisite clause \u2014 that the change builds or its config parses \u2014 never a behaviour"," unaffected the change cannot reach this clause: no changed code path leads to it \u2014 cite the code that shows it (path:line); never for a clause decided in a changed file"," existing_unit existing native unit tests that exercise the clause"," new_unit a new in-process test, for evidence nothing provides yet"," runtime only the running application can establish it","A clause only the running app can check is runtime, not a gap, even when every other clause is in-process. It is a gap only when the app cannot be run here; then name what is missing.","Give each clause the kind of test the repo already uses for the code it checks \u2014 in-process where the repo tests that code in-process, runtime where it tests it against the running app \u2014 unless that kind cannot check it; then the kind that can.",`Browser-only: for every clause, ask whether its behaviour happens only in a browser \u2014 real clicks or keys driving page script, client-side sorting or filtering, script-driven DOM updates, focus, drag-and-drop, navigation, rendering that depends on CSS or JavaScript \u2014 and if so mark it browserOnly. A test that only checks markup (a class or attribute present, the HTML a request returns) proves the precondition, not the behaviour: the header having the sort class does not show that "clicking a column header sorts the list". A browser-only clause is tested in a browser: in the repo's in-process browser harness where it has one \u2014 a Django LiveServerTestCase or StaticLiveServerTestCase, or pytest-django live_server, suite that drives Selenium or Playwright; component tests under jsdom only when the repo's own jsdom tests already drive that kind of interaction \u2014 named as its browserHarness (the suite's path), and the clause stays new_unit, with its triage item's covers saying it is driven in that browser suite; else decide runtime_required with a browser test of it. A markup check may be added, not substituted.`,"","Decisions:","- existing_evidence_sufficient means every clause in scope is established by existing evidence, with no gaps.","- targeted_unit plans unit tests and nothing that needs a running app.","- runtime_required marks at least one clause runtime, and plans no new unit tests: once the app is needed, this plan's cases are every new test, each still written the way the repo tests that code \u2014 in-process where that can check its clause, in the browser only where it cannot. The existing unit tests you identify still run, as existing_unit.","- The journeys and maintenance of step 5 can need the app too, so plan them before you decide. Decide runtime_required when any journey needs a browser \u2014 real JavaScript or htmx behaviour, navigation across pages, what persists after a reload, or a server-rendered page the repo tests only at the request level \u2014 and mark runtime the clauses its steps exercise.",'- Decide runtime_required as well when any test under "maintenance" calls the deployed app \u2014 API, contract, integration, end-to-end or UI tests that reach it at its address (BASE_URL or the like), and Skyramp tests \u2014 and checks what the change itself alters, and mark runtime the clauses it checks, so it is verified against the app. So does a browser part the plan itself says goes untested, and a browser-only clause the repo has no in-process browser harness for.',"- A test that starts its own live server in the test process and drives it in a browser (Django's LiveServerTestCase or StaticLiveServerTestCase, pytest-django's live_server, with Selenium or Playwright) needs no deployed app: under targeted_unit it is maintained and run in-process, with the repo's CI settings and a headless browser.","- When the app cannot be run here, list each such journey's clauses under notInJourney, and each such test under gaps, with what is missing: it is reported not covered, never dropped. So is a browser-only clause with no in-process browser harness: name it under gaps with what is missing.","- Only what the change itself alters decides it. A journey or browser-only clause only for what the change could break elsewhere (a could-break requirement), or for UI code the change does not touch when it touches no UI code, does not make the decision runtime_required: off the runtime path list its clauses under notInJourney and the browser-only ones under gaps, with what is missing (a browser, downstream of this change), so it is reported not covered. Nor does a maintained test that calls the deployed app only for such clauses: give each maintained test the clauses it checks, and name such a test under gaps with what is missing (the running app, downstream of this change).","- blocked_preflight: the change cannot meet a basic prerequisite. It names the changed file the failure is in and quotes the error, and plans nothing. A check that fails for an environment reason (a dependency not installed, a missing tool) is not the change failing \u2014 never block on it.","","Rules:","- Every clause is planned, listed in gaps, or listed under outOfScope, by its id (R1a). A gap is evidence this run cannot obtain; a test this run will execute (existing_unit, new_unit, runtime) is not one, even when you could not run it while planning.","- Only accepted ci-<n> items, and passing checks you ran for prerequisite clauses, can establish a clause. A stale, untrusted, pending, failing or inconclusive result establishes nothing; a trusted result that failed is a reason to plan evidence, never a pass. AI review is advisory, never evidence.","- Find the existing tests yourself: where the repo keeps tests of the changed code, and their framework.",'- Existing tests that call a running app (API, contract, integration, end-to-end or UI tests) are never evidence: list them in "maintenance" (verify, or update).',"- Repository evidence is only native unit tests, which run without the app. Every repository evidence item lists its tests as repo-relative paths (path::test-name when the file holds more than the relevant ones) \u2014 only the tests that exercise the changed behavior, never the whole suite.",`- ${_Q}`,`- ${QE}`,"- Every repository evidence item is run: cite it from an existing_unit item for the clauses it exercises. Only under existing_evidence_sufficient is nothing run: cite it from the existing_evidence item it supports instead.","- Plan new_unit only for what no existing test asserts, or asserts differently from the requirement (the boundary the change moved); never for what existing tests already prove.","- When the PR description or a spec states the expected behavior, plan evidence for what it states, not for what the code does.","- Evidence items are existing repository tests (source repository) and checks you ran with Bash (source testbot), each with a unique id; the ci-<n> results above are not restated. Run each check as one plain command \u2014 no `&&`, pipes or `echo` \u2014 and copy it into its evidence exactly. Don't start the application, install dependencies or run test suites for triage."])]}function uTt(t){let e=t.prepared,r=t.inputs.repositoryPath,n=e.preflight?.repository.currentBranch??"HEAD",s=e.preflight?.repository.baseBranch??t.inputs.baseBranch??"origin/main";return["Plan functional tests for this PR. You won't write the tests: another session will, working from your plan alone,","so whatever it needs has to be in the plan.","",`The repo is at ${r}, checked out on branch \`${n}\`. You can see the change with \`git diff ${s}...HEAD\`.`,"Ignore .skyramp/ \u2014 it is Skyramp's own setup, not part of the change.",...e6(t),...na(t.inputs),...gOe(t.inputs),...yOe(t.inputs),"","1. Read the change: the diff, the description, and any spec, issue or design doc either of them points to.","2. List the requirements: everything the description or a spec states or clearly implies and, where they say"," nothing, what the change is evidently meant to do. Split each into independently testable clauses: each input"," class, boundary, error path, and anything that must stay unchanged. For each clause, write the expected outcome.",` Each requirement's id is the label the description or spec gives it ("AC-3", "REQ-12"; item 4 of a numbered list`," is R4), else R1, R2\u2026 in order, numbering on after the highest R-label the source uses (R6 after its R5). Where two"," items give the same label, put the item's key in front (PAY-184-AC1, PAY-185-AC1). A clause id is its"," requirement's id plus a letter (AC-3a), and each id is used once. Every case, clause and journey step keeps these"," ids and names a clause or finding the plan has; a finding names the requirement or clause it breaks."," Where the description or spec sets it, it wins over the code: if they disagree, the code is what's wrong. Where"," nothing is stated, take it from the change's evident intent; code that contradicts that intent, or itself"," elsewhere, is still a defect. Where the outcome is left open, expect only what any correct implementation must"," do, and say so."," Then list what the change could break that no requirement mentions \u2014 other callers of the functions it changed,"," other paths that read or write the same data, behaviour right next to the change \u2014 and add each as a requirement"," of its own (source could-break, evidence the code it could break), with its clauses.",' For each clause, give under "code" the path:line of the code that decides it, when there is one.',"3. Note every defect you find in the change, with the line that shows it. Compare the change with the code beside it"," that does the same job \u2014 other routes answering the same kind of request, other reads of the same data, the other"," layer handling the same value, other code that copies the same record: where they handle a case the change handles"," differently (how a malformed id is answered, who may act, what a read leaves out, whether a value's case matters,"," which fields a copy carries), the change is wrong unless the description asks for the difference. On each page the"," change touches, follow what the user sees when its request fails, when they enter a value it refuses, and right"," after a save, without a reload.",...lTt(t,e),"5. Only under runtime_required, and only for the clauses your triage marks runtime and the defects: write the test",' plan. Under any other decision leave "cases" empty and give no clause a test: the evidence'," comes from triage's plan."," Write the test plan on the clauses themselves: each clause gets the test that checks it (type, target, steps;",` its expected outcome is the clause's, and its kind the one the repo already uses for that code, unless that kind cannot check it), or, on the clause, why it can't be tested here. Add to "cases" a second`," test for a clause where one is needed, and one case for every defect you found \u2014 even where a clause's test"," covers the same ground. A defect's case reaches the defect itself (the state, input or sequence that shows it)"," and expects the correct behaviour, so it fails on this branch; where the requirement allows more than one correct"," outcome (reject, or cap), it accepts each of them, so it passes on any fix.",' Under every decision, list under "maintenance" the existing tests you can see the change makes wrong or stale,'," and whether to update, delete, regenerate or just re-run (verify) each \u2014 a starting point: the step that writes"," the tests runs the affected tests and finds the rest. One that calls the deployed app to check what the change itself alters makes the decision runtime_required (step 4); a live-server test, which runs in-process, does not.",...X5(t),`6. Write the plan as JSON (below), "triage" included, to ${e.checkpoint} now, before anything is started.`,`7. ${sTt(t,e)}`,...cTt(t,e),...aTt(t),"",`Stay inside the checkout and don't commit or push. When you're done, update ${e.checkpoint} with "app" filled in;`,"that file is what's read. End with a one-line final message \u2014 don't repeat the plan in it. The plan's JSON:","",or(po,0,tO(t.inputs)?new Set:oTt)].join(`
|
|
576
576
|
`)}function XD(t,e,r){let n=zn.join(t.outputsDir,e);return ZD.writeFileSync(n,JSON.stringify(hr(r,t.secretValues??[]),null,2)+`
|
|
577
577
|
`),zn.relative(t.runDir,n)}function xOe(t){let e=t.prepared?.recipe??go(t.inputs.repositoryPath);return e.teardownScript?`bash ${zn.relative(t.inputs.repositoryPath,e.teardownScript)}`:void 0}function vOe(t,e){let r=bOe(e);r!==e&&oc(t).warn("[plan] the plan used an id more than once: renamed the later ones so each is kept");let n=TNe(H5(r,t.inputs.requirementItems),u=>oc(t).warn(`[plan] case id ${u} is used twice: kept one case and left out the other`)),s=$8(t,n.triage,!!n.app,d8(n,js(t.inputs.requirementItems))).length===0,i=!s||n.triage?.decision==="runtime_required",o=NNe(s?_Ne(n):n,i),a=Ir(t),c=DNe(o,{repository:a?.repository??{path:t.inputs.repositoryPath,currentBranch:"HEAD",baseBranch:t.inputs.baseBranch??""},changedFiles:a?.changedFiles.map(u=>u.path)??[],nonApplicationOnly:a?.nonApplicationOnly??!1,defaultTeardown:xOe(t),itemNames:js(t.inputs.requirementItems)}),l={plan:XD(t,"plan.json",o),analyze:XD(t,"analyze.json",c.analyze),recommend:XD(t,"recommend.json",tO(t.inputs)?SE(t.inputs,c.recommend):c.recommend)};return c.deploy&&(l.deploy=XD(t,"deploy.json",c.deploy)),s&&Object.assign(l,W_e(t,o.triage)),l}var dTt={runtime_required:"validation triage: the change needs the running app \u2014 tests against it follow",targeted_unit:"validation triage: unit tests are enough \u2014 no app deployed",existing_evidence_sufficient:"validation triage: existing evidence is enough \u2014 no app deployed, no new tests",blocked_preflight:"validation triage: the change does not meet a prerequisite \u2014 nothing further runs"};function pTt(t){let e=ee(t,"triage.json");if(e)return dTt[e.decision];let r=ee(t,"plan.json");return r?$8(t,r.triage,!!r.app)[0]:void 0}async function fTt(t,e){let r=t.inputs.sharedEnvironment;if(!t.inputs.appRunning||!ox(r))return{};let n=await sQ(r,[],e,t.secretValues??[],t.platform,await E4(t,r));return ot(t,Vs,hr(n,t.secretValues??[]),[])}function hTt(t,e){let r=kx(zn.join(eO(t),Z5)),n=LQ(po,[...e.map(s=>s.session?.stdout).reverse(),r,PNe(r)]);return n?vOe(t,n):void 0}function mTt(t){if(t.inputs.appRunning||t.inputs.planOnly)return!1;let e=Ir(t);if(e&&!e.sutRequired)return!1;let r=ee(t,"plan.json");return!(r?.triage&&!ZE(r.triage.plan)&&!r.app)}function COe(t){if(!mTt(t))return;let e=ee(t,"deploy.json")?.teardown??xOe(t);!e||e==="true"||(0,SOe.spawnSync)(e,{shell:!0,cwd:t.inputs.repositoryPath,env:Ye(),timeout:12e4,stdio:"ignore"})}var ROe="plan-triage-grounded",gTt={name:ROe,verify(t,e){let{value:r}=jn(po,e.stdout,Hl(t),t.secretValues);if(!r)return{name:this.name,passed:!0};let n=H5(r,t.inputs.requirementItems),s=U8(t,n.triage,!!n.app,d8(n,js(t.inputs.requirementItems)));return s.length?{name:this.name,passed:!1,details:s.join("; "),repairable:!0}:{name:this.name,passed:!0}}},BOe="plan-journeys",ATt=[/\b(?:no|without|lacks?|missing)\b[^.;:]{0,30}\b(?:browser|e2e|end-to-end|playwright|cypress|selenium|ui|frontend|front-end)\b[^.;:]{0,30}\b(?:tests?|harness|runner|setup|framework|installed|suite)\b/i,/\bno\s+(?:tests?|harness)\s+(?:for|of)\s+the\s+(?:ui|frontend|front-end|browser|pages?)\b/i],yTt=/\b(?:credentials?|log[- ]?ins?|sso|auth\w*|accounts?|seed(?:ed)?|external|third[- ]party|api[- ]keys?|secrets?|tokens?|observ\w*|visible|shows?|logs?|reach\w*|unreachable|behind|admin\w*|licen[cs]e\w*|hardware|devices?|e-?mail|sms|payment|stripe|host[- ]app|embedd\w*)\b/i,ETt=t=>ATt.some(e=>e.test(t))&&!yTt.test(t),bTt=/\b(?:not|never|isn'?t|aren'?t)\s+(?:visible|seen|shown|user[- ]visible)\b|\binvisible\b|\bno\s+(?:user[- ])?visible\b|\b(?:user|nobody|no one)\s+sees\s+no(?:thing)?\b|\bnothing\s+(?:a|the)\s+user\s+sees\b|\bnothing\b[^.;]{0,40}\b(?:styles?|reads?|renders?|consumes?|uses?)\b|\bno\s+(?:css|style|component|rendering)\b[^.;]{0,40}\b(?:reads?|consumes?|depends?|uses?)\b/i,wTt=/\b(?:not reachable|unreachable|no (?:route|page|screen|flow|path|link) (?:reaches|renders|opens|leads to)|(?:rendered|used|mounted) only (?:by|in|from)\b[^;]{0,100}\bnothing (?:in the app )?(?:renders|uses|mounts))/i;function CTt(t){let e=!1,r=[];for(let n of t){let s=n.why??"",i=!wTt.test(s)&&(bTt.test(s)||/^\s*same\b/i.test(s)&&e);i&&r.push(n.clause),e=i}return r}function STt(t,e){let r=e.trim().replace(/^\.\//,""),n=(t.inputs.relatedRepos??[]).find(s=>r.startsWith(`${K5(s)}/`));return n?{root:n.path,rel:r.slice(K5(n).length+1)}:{root:t.inputs.repositoryPath,rel:r}}var ITt={name:BOe,verify(t,e){let{value:r}=jn(po,e.stdout,Hl(t),t.secretValues);if(!r)return{name:this.name,passed:!0};let n=!r.triage||r.triage.decision==="runtime_required",s=r.requirements.flatMap(w=>w.clauses),i=new Set([...r.cases.map(w=>w.id),...s.map(w=>w.id)]),o=[..._m(t.inputs),...(t.inputs.relatedRepos??[]).map(w=>({body:w.prDescription??""}))],a={takenIds:i,clauses:new Set(s.map(w=>w.id)),uiClauses:X5(t).length?s.filter(w=>w.type==="ui"&&!w.skip?.trim()).map(w=>w.id):[],notInJourney:new Set((r.notInJourney??[]).map(w=>w.clause)),quoted:w=>Ex(o,w)},c=Ir(t),l=c?Wa(c,"").map(w=>w.path):[],u=n?[]:cOe(r,{locate:w=>STt(t,w),runtimePossible:!!t.inputs.appRunning||c?.sutRequired!==!1,...c?{own:aOe(r,l,F4(l).length>0)}:{}}),d=n?r.journeys:(r.journeys??[]).filter(w=>w.kind==="in-process"),p=(r.notInJourney??[]).filter(w=>ETt(w.why??"")).map(w=>`clause ${w.clause} is under notInJourney because the repo has no browser tests, which is no reason to leave it out: put it in a journey \u2014 in-process where the repo's in-process tests can walk and check it, else a browser test in a test package of its own (decide runtime_required)`),f=X5(t).length?IOe(t):[],h=f.length&&!(r.journeys??[]).length&&!(r.notInJourney??[]).length?[`the change touches UI code (${f.slice(0,5).join(", ")}) and the plan has no journey: plan the journey through what a user then sees change, or, if the change alters nothing a user sees, list its clauses under notInJourney with why`]:[],A=f.length&&L4(t.inputs.repositoryPath)?CTt(r.notInJourney??[]).map(w=>`clause ${w} is under notInJourney because nothing reads it or the user cannot see it, and the change touches UI code: a change to UI code that alters what the page holds along a user flow owes a journey that asserts it, even when nothing reads it yet \u2014 put the clause in that flow's journey, at the step that sets it, and assert it there`):[],C=[...u,...p,...h,...A,...RTe(d,a)];return C.length?{name:this.name,passed:!1,details:C.join("; "),repairable:!0}:{name:this.name,passed:!0}}},kOe="plan-requirements-grounded",xTt={name:kOe,async verify(t,e){let{value:r}=jn(po,e.stdout,Hl(t),t.secretValues);if(!r)return{name:this.name,passed:!0};t.reviewItemFile&&await uOe(r,t.inputs.requirementItems,t.reviewItemFile);let n=UDe(r,t.inputs.requirementItems);return n.length?{name:this.name,passed:!1,repairable:!0,droppable:n.map(({id:s})=>s),details:n.map(({id:s,why:i})=>`${s}: ${i}`).join("; ")}:{name:this.name,passed:!0}}};function vTt(t,e,r){let n=r.some(a=>a.name===kOe)?`Repair "requirements" in ${Hl(t)}: give each requirement-reference requirement its item's key as "reference" and, as evidence, words copied exactly from that item's file. A requirement no item states is not requirement-reference. One that still does not hold is dropped.`:void 0,s=r.some(a=>a.name===BOe)?`Repair "journeys" in ${Hl(t)} as named above: each needs an entry route, at least two steps each saying what the user then sees, the outcome and a test file, and every ui clause is in some journey's steps or under notInJourney. Where a journey, maintained test or browser-only clause above needs the running app, decide runtime_required in "triage" and mark runtime the clauses it checks (keep existing_unit for the existing unit tests, and make new_unit clauses runtime).`:void 0,i=r.some(a=>a.name===J5)?`Repair the ids in ${Hl(t)} as named above and keep the rest of the plan: each id is used once (where two items give the same label, put the item's key in front: PAY-185-AC1; unlabelled requirements number on after the highest R-label), a clause id is its requirement's id plus a letter, every case, clause and journey step names a clause or finding the plan has, and a finding names the requirement or clause it breaks.`:void 0,o=RTt(t,e,r);return[n,i,o,s].filter(Boolean).join(`
|
|
578
578
|
`)||void 0}function RTt(t,e,r){let n=r.filter(o=>o.name===ROe);if(!n.length)return;let s=o5(t,e,n),i=n.some(o=>/brought the app up/.test(o.details??""))?['Only runtime_required starts the app: when a clause needs it, decide runtime_required and mark that clause runtime; when none does, stop what you started and remove "app" from the plan.']:[];return[`Repair "triage" in ${Hl(t)} and keep the rest of the plan: its behaviorIds are your clause ids.`,...i,...s?[s]:[]].join(`
|
|
@@ -582,7 +582,7 @@ ${iTt(t,e)}`}function iTt(t,e){if(t.inputs.appRunning)return[`${t.inputs.appRunn
|
|
|
582
582
|
`;)i++;continue}if(!s&&u==="/"&&t[i+1]==="*"){let d=t.indexOf("*/",i+2),p=d<0?n:d+2;for(let f=i;f<p;f++)t[f]===`
|
|
583
583
|
`&&c(f);i=p;continue}if(u==='"'||u==="'"||u==="`"){let d={line:o,col:i-a},p=s&&t.startsWith(u.repeat(3),i)?3:1,f=l(i,u),h=t.slice(i+p,Math.max(i+p,f-p));r.push({kind:"s",text:h,...d,template:u==="`"&&e==="js"&&h.includes("${")}),i=f;continue}if(/[A-Za-z_$]/.test(u)){let d=i+1;for(;d<n&&/[\w$]/.test(t[d]);)d++;let p=t.slice(i,d);if(s&&NTt.test(p)&&(t[d]==='"'||t[d]==="'")){i=d;continue}r.push({kind:"i",text:p,line:o,col:i-a}),i=d;continue}if(/\d/.test(u)){let d=i+1;for(;d<n&&/[\w.]/.test(t[d]);)d++;r.push({kind:"n",text:t.slice(i,d),line:o,col:i-a}),i=d;continue}r.push({kind:"p",text:u,line:o,col:i-a}),i++}return r}var PTt={"(":")","[":"]","{":"}"};function hd(t,e){let r=t[e].text,n=PTt[r],s=0;for(let i=e;i<t.length;i++){let o=t[i];if(o.kind==="p"){if(o.text===r)s++;else if(o.text===n&&--s===0)return i}}return-1}var md=(t,e)=>e===0||t[e-1].line<t[e].line;function r6(t,e,r){let n=[],s=0,i=!0;for(let o=e+1;o<r;o++){let a=t[o];a.kind==="p"&&"([{<".includes(a.text)?s++:a.kind==="p"&&")]}>".includes(a.text)?s=Math.max(0,s-1):s===0&&a.text===","?i=!0:s===0&&i&&a.kind==="i"&&!["public","private","protected","readonly"].includes(a.text)&&(n.push(a.text),i=!1)}return n}function QTt(t,e){let r=new Map;for(let n=0;n+2<t.length;n++){let[s,i,o]=[t[n],t[n+1],t[n+2]];if(s.kind!=="i"||i.text!=="="||o.kind!=="s"||o.template)continue;let a=e==="py"?md(t,n)&&s.col===0:t[n-1]?.text==="const",c=t[n+3];a&&(!c||c.line>o.line||c.text===";")&&r.set(s.text,o.text)}return r}function n6(t,e,r,n,s,i){let o=new Map(n.map((u,d)=>[u,`$${d}`])),a=[],c=e;for(i==="py"&&t[c]?.kind==="s"&&(c+1>=r||t[c+1].line>t[c].line)&&c++;c<r;c++){let u=t[c];if(u.kind==="s"){let d=u.template?u.text.replace(/\$\{\s*([A-Za-z_$][\w$]*)\s*\}/g,(p,f)=>s.get(f)??(o.has(f)?`\${${o.get(f)}}`:p)):u.text;a.push(JSON.stringify(d))}else u.kind==="i"&&t[c-1]?.text!=="."?a.push(o.get(u.text)??(s.has(u.text)?JSON.stringify(s.get(u.text)):u.text)):a.push(u.text)}return{key:a.filter(u=>u!==";").join(" ").replace(/ , (?=[)\]}])/g," "),size:a.length}}function QOe(t,e){let r=0,n=0;for(let s=e;s<t.length;s++){let i=t[s].text;if(i==="<")r++;else if(i===">"&&t[s-1]?.text!=="=")r=Math.max(0,r-1);else if(i==="(")n++;else if(i===")")n--;else{if(i==="{"&&r===0&&n===0)return s;if(i===";"||i==="="&&t[s+1]?.text!==">")return-1}}return-1}function DTt(t,e){return t.kind==="p"&&!")]}".includes(t.text)||e.kind==="p"&&".?:&|+-*/<>=".includes(e.text)}function OTt(t,e){let r=0;for(let n=e;n<t.length;n++){let s=t[n];if(s.kind==="p"&&"([{".includes(s.text))r++;else if(s.kind==="p"&&")]}".includes(s.text)){if(r===0)return n;r--}else if(r===0&&(s.text===";"||s.text===","||n>e&&s.line>t[n-1].line&&!DTt(t[n-1],s)))return n}return t.length}function DOe(t){let e=new Set,r=n=>{let s=hd(t,n);for(let i=n+1;i>0&&i<s;i++){let o=t[i];o.kind!=="i"||t[i-1]?.text==="as"||t[i-1]?.text===":"||[",","}",":","as"].includes(t[i+1]?.text)&&e.add(o.text)}};for(let n=0;n<t.length;n++){let s=t[n].text;s==="export"&&t[n+1]?.text==="{"&&r(n+1),s==="exports"&&t[n+1]?.text==="="&&t[n+2]?.text==="{"&&r(n+2),s==="exports"&&t[n+1]?.text==="."&&t[n+2]?.kind==="i"&&e.add(t[n+2].text)}return e}function MTt(t,e){let r=[],n=DOe(t),s=o=>{for(let a=o-1;a>=Math.max(0,o-4);a--){if(t[a].text==="export")return!0;if(!["default","async","function","*","const","let","var"].includes(t[a].text))return!1}return!1},i=(o,a,c,l,u)=>{let d=t[o].text,{key:p,size:f}=n6(t,l,u,r6(t,a,c),e,"js");r.push({name:d,line:t[o].line,exported:s(o)||n.has(d),key:p,size:f})};for(let o=0;o<t.length;o++){let a=t[o];if(a.kind==="i"){if(a.text==="function"){let c=o+1;if(t[c]?.text==="*"&&c++,t[c]?.kind!=="i")continue;let l=c++;if(t[c]?.text==="<")for(;c<t.length&&t[c].text!=="(";)c++;if(t[c]?.text!=="(")continue;let u=hd(t,c),d=u<0?-1:QOe(t,u+1),p=d<0?-1:hd(t,d);p>0&&i(l,c,u,d+1,p);continue}if((a.text==="const"||a.text==="let"||a.text==="var")&&t[o+1]?.kind==="i"){let c=o+1,l=o+2;if(t[l]?.text===":")for(;l<t.length&&t[l].text!=="="&&t[l].line===t[c].line;)l++;if(t[l]?.text!=="=")continue;l++,t[l]?.text==="async"&&l++;let u,d;if(t[l]?.text==="("){if(u=l,d=hd(t,l),d<0)continue}else if(t[l]?.kind==="i"&&t[l+1]?.text==="="&&t[l+2]?.text===">")u=l-1,d=l+1;else continue;let p=d+1;if(t[p]?.text===":")for(;p<t.length&&!(t[p].text==="="&&t[p+1]?.text===">")&&t[p].text!==";";)p++;if(t[p]?.text!=="="||t[p+1]?.text!==">")continue;if(p+=2,t[p]?.text==="{"){let f=hd(t,p);f>0&&i(c,u,d,p+1,f)}else i(c,u,d,p,OTt(t,p))}}}return r}function FTt(t,e){let r=[];for(let n=0;n<t.length;n++){if(t[n].text!=="def"||t[n+1]?.kind!=="i"||t[n+2]?.text!=="(")continue;let s=t[n-1]?.text==="async"&&md(t,n-1);if(!s&&!md(t,n))continue;let i=t[s?n-1:n].col,o=hd(t,n+2);if(o<0)continue;let a=o+1;for(;a<t.length&&t[a].text!==":";)a++;let c=a+1;for(;c<t.length&&!(md(t,c)&&t[c].line>t[a].line&&t[c].col<=i);)c++;let l=r6(t,n+2,o).filter(f=>f!=="self"&&f!=="cls"),{key:u,size:d}=n6(t,a+1,c,l,e,"py"),p=t[n+1].text;r.push({name:p,line:t[n+1].line,exported:i===0&&!p.startsWith("_"),key:u,size:d})}return r}function LTt(t,e){let r=[];for(let n=0;n<t.length;n++){if(t[n].text!=="func"||!md(t,n))continue;let s=n+1;if(t[s]?.text==="("&&(s=hd(t,s)+1),s<=0||t[s]?.kind!=="i"||t[s+1]?.text!=="(")continue;let i=hd(t,s+1),o=i<0?-1:QOe(t,i+1),a=o<0?-1:hd(t,o);if(a<0)continue;let{key:c,size:l}=n6(t,o+1,a,r6(t,s+1,i),e,"go");r.push({name:t[s].text,line:t[s].line,exported:/^[A-Z]/.test(t[s].text),key:c,size:l})}return r}function UTt(t,e){let r=[],n=[];if(e==="js"){for(let s=0;s<t.length;s++){if(t[s].text!=="import"||!md(t,s)||t[s+1]?.text==="(")continue;let i=s+1;for(;i<t.length&&t[i].kind!=="s"&&t[i].text!==";";)i++;if(t[i]?.kind==="s"&&(n.push([s,i]),t[s+1]?.text!=="type"))for(let o=s+1;o<i;o++){let a=t[o];a.kind!=="i"||["from","as","type"].includes(a.text)||t[o-1]?.text==="type"||t[o+1]?.text!=="as"&&r.push({local:a.text,from:t[i].text,line:a.line})}}for(let s=0;s<t.length;s++){if(t[s].text!=="require"||t[s+1]?.text!=="("||t[s+2]?.kind!=="s"||t[s+3]?.text!==")"||t[s-1]?.text!=="=")continue;let i=t[s+2].text,o=s-2;if(t[o]?.kind==="i"&&["const","let","var"].includes(t[o-1]?.text)){n.push([o-1,s+3]),r.push({local:t[o].text,from:i,line:t[o].line});continue}if(t[o]?.text!=="}")continue;let a=o;for(let c=0;a>=0;a--)if(t[a].text==="}")c++;else if(t[a].text==="{"&&--c===0)break;if(!(a<1||!["const","let","var"].includes(t[a-1].text))){n.push([a-1,s+3]);for(let c=a+1;c<o;c++)t[c].kind==="i"&&t[c+1]?.text!==":"&&r.push({local:t[c].text,from:i,line:t[c].line})}}}else if(e==="py"){for(let s=0;s<t.length;s++){if(t[s].text!=="from"||!md(t,s))continue;let i=s+1,o="";for(;i<t.length&&t[i].text!=="import"&&t[i].line===t[s].line;)o+=t[i++].text;if(t[i]?.text!=="import")continue;let a=t[i+1]?.text==="(",c=i+1;for(;c<t.length&&!(a?t[c].text===")":t[c].line>t[i].line&&t[c-1].text!=="\\");)c++;n.push([s,a?c:c-1]);for(let l=i+1;l<c;l++){let u=t[l];u.kind!=="i"||u.text==="as"||t[l+1]?.text==="as"||r.push({local:u.text,from:o,line:u.line})}}for(let s=0;s<t.length;s++){if(t[s].text!=="import"||!md(t,s))continue;let i=s+1;for(;i<t.length&&t[i].line===t[s].line;){let o="",a=t[i];for(;i<t.length&&t[i].line===t[s].line&&t[i].text!==","&&t[i].text!=="as";)o+=t[i++].text;let c=a?.kind==="i"?a.text:"";t[i]?.text==="as"&&t[i+1]?.kind==="i"&&(c=t[i+1].text,i+=2),c&&o&&r.push({local:c,from:o,line:a.line}),t[i]?.text===","&&i++}n.push([s,i-1])}}return{imports:r,spans:n}}function $Tt(t,e,r){let n=new Set(r.map(s=>s.from));if(e==="js")for(let s=0;s<t.length;s++){let i=t[s];if(i.kind!=="s")continue;let o=t[s-1]?.text;(o==="from"||o==="import"&&t[s-1]?.kind==="i"||o==="("&&["require","import"].includes(t[s-2]?.text??"")&&t[s+1]?.text===")")&&n.add(i.text)}return[...n]}function qTt(t,e){let r=0;for(let n=0;n<t.length;n++){if(t[n].kind!=="i"||t[n].text!=="class")continue;let s=t[n+1];(e==="py"?md(t,n)&&s?.kind==="i":s&&(s.kind==="i"||s.text==="{"))&&r++}return r}function Eb(t,e){let r=gd(e);if(!r)return;let n=_Tt(t,r),s=QTt(n,r),i=r==="js"?MTt(n,s):r==="py"?FTt(n,s):LTt(n,s),{imports:o,spans:a}=UTt(n,r),c=new Map,l=d=>c.set(d,(c.get(d)??0)+1),u=0;for(let d=0;d<n.length;d++){for(;u<a.length&&d>a[u][1];)u++;if(u<a.length&&d>=a[u][0])continue;let p=n[d];if(p.kind==="i")l(p.text);else if(p.kind==="s"&&(p.template||r==="py"&&p.text.includes("{")))for(let f of p.text.matchAll(/\{[^{}]*\}/g))for(let h of f[0].matchAll(/[A-Za-z_$][\w$]*/g))l(h[0])}return{lang:r,functions:i,imports:o,uses:c,listedExports:r==="js"?DOe(n):new Set,deps:$Tt(n,r,o),classes:r==="go"?0:qTt(n,r)}}var HTt=15,jTt=6,ig=t=>zs.test(t),zTt=/utils?|skyramp/i,VTt=/utils?/i,bb=t=>mt.posix.basename(t).replace(/\.[^.]+$/,""),WTt=/^(conftest\.py|__init__\.py|[^/]*\.config\.[cm]?[jt]s|[^/]+\.(setup|teardown)\.[cm]?[jt]sx?|setupTests\.[cm]?[jt]sx?)$/i,YTt=/^([\w.-]+\.config\.([cm]?[jt]s|json)|package\.json|pytest\.ini|pyproject\.toml|setup\.cfg|tox\.ini)$/i,OOe=t=>t.replace(/\.([cm]?[jt]sx?|py)$/,"");function JTt(t,e){let r=OOe(e),n=mt.posix.dirname(t.rel);return(t.text.match(/[\w@$.\-/]+/g)??[]).some(i=>{let o=i.replace(/^<rootDir>\//,"").replace(/[.,]+$/,"");if(!o)return!1;let a=OOe(mt.posix.normalize(mt.posix.join(o.startsWith("/")?".":n,o.replace(/^\//,"")))),c=/^[A-Za-z_][\w.]*$/.test(o)&&o.includes(".")?o.replace(/\./g,"/"):void 0;return a===r||c!==void 0&&(c===r||mt.posix.join(n,c)===r)})}function MOe(t,e){return WTt.test(mt.posix.basename(t))?!0:e.some(r=>JTt(r,t))}var s6=[".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts"];function wb(t,e,r,n){let s=mt.posix.dirname(t),i=o=>o.map(a=>mt.posix.normalize(a)).find(a=>!a.startsWith("..")&&n(a));if(r==="js"){if(!e.startsWith("."))return;let o=mt.posix.join(s,e),a=o.replace(/\.[cm]?js$/,"");return i([o,...s6.map(c=>o+c),...s6.map(c=>a+c),...s6.map(c=>`${o}/index${c}`)])}if(r==="py"){let o=e.match(/^\.*/)[0].length,a=e.slice(o).replace(/\./g,"/"),c=[];if(o){let l=s;for(let u=1;u<o;u++)l=mt.posix.dirname(l);c.push(l)}else for(let l=s;c.push(l),!(l==="."||l==="/"||l==="");l=mt.posix.dirname(l));return i(c.flatMap(l=>a?[`${l}/${a}.py`,`${l}/${a}/__init__.py`]:[`${l}/__init__.py`]))}}var FOe=t=>`${t.rel}:${t.fn.line}`;function KTt(t,e){return[...new Set(t.code.imports.map(r=>wb(t.rel,r.from,t.code.lang,e)).filter(r=>!!r&&!ig(r)))]}function XTt(t){let e=R=>{let M=Eb(R.text,R.rel);return M?{rel:R.rel,code:M,test:ig(R.rel)}:void 0},r=t.written.flatMap(R=>{let M=e(R),q=R.before===void 0?void 0:Eb(R.before,R.rel);return M?[{...M,before:q,isNew:R.before===void 0,definesHelpers:M.code.functions.length>0||M.code.classes>0}]:[]}),n=t.existing.flatMap(R=>e(R)??[]),s=new Map([...n,...r].map(R=>[R.rel,R])),i=R=>s.has(R),o=[],a=new Map,c=R=>a.set(R.fn.key,[...a.get(R.fn.key)??[],R]);for(let R of n)for(let M of R.code.functions)c({rel:R.rel,fn:M,lang:R.code.lang,test:R.test});for(let R of r){let M=new Set(R.code.functions.map(q=>q.name));for(let q of R.before?.functions??[])M.has(q.name)&&c({rel:R.rel,fn:q,lang:R.code.lang,test:R.test})}let l=(R,M)=>R.key===M.key&&(R.size>=HTt||R.name===M.name&&R.size>=jTt),u=(R,M)=>new Set((a.get(R.key)??[]).filter(q=>q.lang===M&&l(R,q.fn)).map(q=>q.rel)).size>=2,d=r.flatMap(R=>{let M=new Set((R.before?.functions??[]).map(q=>q.name));return R.code.functions.filter(q=>!M.has(q.name)).map(q=>({w:R,fn:q}))}),p=R=>{let M=R.flatMap(q=>KTt(q,i)).find(q=>!r.some(J=>J.rel===q&&J.isNew));return M?`the repo's ${M}`:"the repo's shared test-support module (else a module beside the tests that use it, laid out the way the repo keeps its tests, named for what it holds)"},f=new Set;for(let{w:R,fn:M}of d){if(u(M,R.code.lang))continue;let q=(a.get(M.key)??[]).find(W=>W.lang===R.code.lang&&!(W.rel===R.rel&&W.fn.name===M.name)&&l(M,W.fn));if(!q)continue;f.add(M);let J=s.get(q.rel);q.fn.exported||!q.test?o.push(`${R.rel}:${M.line} ${M.name} copies ${q.fn.name} (${FOe(q)}) \u2014 import ${q.fn.name} from there instead of defining it again`):o.push(`${R.rel}:${M.line} ${M.name} copies ${q.fn.name}, local to ${FOe(q)} \u2014 move ${q.fn.name} into ${p([R,...J?[J]:[]])} and import it in both files; no second copy`)}let h=r.filter(R=>R.isNew&&!R.test),A=new Map;for(let{w:R,fn:M}of d){if(!R.test||f.has(M))continue;let q=h.find(U=>U.code.lang===R.code.lang&&U.code.functions.some(F=>l(M,F))),J=q?.code.functions.find(U=>l(M,U));if(!q||!J)continue;f.add(M);let W=`${R.rel}:${M.line} ${M.name} copies ${J.name} (${q.rel}:${J.line}) \u2014 import ${J.name} from there instead of defining it again`,Y=A.get(q.rel)??{tests:new Set,sent:[]};Y.tests.add(R.rel),Y.sent.push(W),A.set(q.rel,Y),o.push(W)}let C=[],w=R=>ov(R).dir;for(let R of d){if(!R.w.test||f.has(R.fn)||u(R.fn,R.w.code.lang))continue;let M=C.find(q=>q[0].w.code.lang===R.w.code.lang&&w(q[0].w.rel)===w(R.w.rel)&&l(q[0].fn,R.fn));M?M.push(R):C.push([R])}for(let R of C){let M=[...new Map(R.map(q=>[q.w.rel,q.w])).values()];M.length<2||o.push(`${R[0].fn.name} is defined in ${M.length} test files (${M.map(q=>q.rel).join(", ")}) \u2014 define it once, in ${p(M)}, and import it from each`)}for(let R of r){let M=new Set((R.before?.imports??[]).map(q=>`${q.local}\0${q.from}`));for(let q of R.code.imports){if(M.has(`${q.local}\0${q.from}`)||(R.code.uses.get(q.local)??0)>0)continue;(q.from.startsWith(".")||wb(R.rel,q.from,R.code.lang,i)!==void 0)&&o.push(`${R.rel}:${q.line} imports ${q.local} from ${q.from} and never uses it \u2014 use it, or drop the import`)}}let E=new Map([...(t.otherTests??[]).flatMap(R=>e(R)??[]).map(R=>[R.rel,R]),...s]),I=R=>[...E.values()].filter(M=>M.rel!==R&&M.code.deps.some(q=>wb(M.rel,q,M.code.lang,i)===R)),x=n.filter(R=>!R.test&&(R.code.functions.length>0||R.code.classes>0)&&!MOe(R.rel,t.configs??[])).map(R=>({rel:R.rel,users:I(R.rel).filter(M=>M.test&&!r.some(q=>q.rel===M.rel)).length})).filter(R=>R.users>0),v=x.filter(R=>R.users===1),Q=R=>v.some(M=>mt.posix.dirname(M.rel)===mt.posix.dirname(R))||x.length>0&&v.length*2>=x.length,B=new Set;for(let R of r){if(!R.isNew||R.test||!R.definesHelpers||MOe(R.rel,t.configs??[])||Q(R.rel))continue;let M=I(R.rel);if(M.some(Y=>!Y.test))continue;let q=A.get(R.rel),J=new Set([...M.map(Y=>Y.rel),...q?.tests??[]]);if(J.size!==1)continue;B.add(R.rel);let W=[...J][0];if(q)for(let Y of q.sent)o.splice(o.indexOf(Y),1);o.push(`${R.rel} is imported only by ${W}${q?", which also copies its helpers":""} \u2014 move its contents into ${W} and delete ${R.rel}; keep it only if a second test file uses it`)}for(let R of r){if(!R.isNew||R.test||B.has(R.rel))continue;let M=new Map;for(let q of R.code.functions){if(!q.exported||(R.code.uses.get(q.name)??0)-1-(R.code.listedExports.has(q.name)?1:0)>0)continue;let W=[...s.values()].filter(Y=>Y.test&&Y.rel!==R.rel&&(Y.code.uses.get(q.name)??0)>0&&Y.code.imports.some(U=>wb(Y.rel,U.from,Y.code.lang,i)===R.rel));W.length===1&&M.set(W[0].rel,[...M.get(W[0].rel)??[],q.name])}for(let[q,J]of M)o.push(`${R.rel}: ${J.join(", ")} ${J.length>1?"are":"is"} used only by ${q} \u2014 a helper only one test file uses stays in that file`)}let L=n.some(R=>!R.test&&VTt.test(bb(R.rel)));for(let R of r){if(!R.isNew||R.test||!R.code.functions.length)continue;let M=bb(R.rel);(/skyramp/i.test(M)||!L&&zTt.test(M))&&o.push(`${R.rel}: name the module for what it holds (e.g. orders, session, pages) \u2014 not "utils" or "Skyramp"`)}return o}var rO=new Set(["node_modules",".git","dist","build","coverage","test-results","playwright-report","__pycache__",".venv","venv","vendor",".next","target"]),LOe=new RegExp(`(^|/)(${[...rO].map(t=>t.replace(/\./g,"\\.")).join("|")})/`),GOe=/^(tests?|e2e|e2e-tests|__tests__|specs?|playwright|cypress|integration|testing)$/i,ZTt=/test|spec|helper|support|fixture|page/i,UOe=3e3,eNt=256*1024,tNt=4e3;function sg(t){try{let e=nO.statSync(t);return e.isFile()&&e.size<=eNt?nO.readFileSync(t,"utf-8"):void 0}catch{return}}function rNt(t,e){try{return(0,qOe.execFileSync)("git",[...bs,"show",`HEAD:${e}`],{cwd:t,env:Ye(),encoding:"utf-8",maxBuffer:16*1024*1024,stdio:["ignore","pipe","ignore"]})}catch{return}}function ov(t){let e=mt.posix.dirname(t).split("/").filter(n=>n&&n!=="."),r=e.findIndex(n=>GOe.test(n));return r>=0?{dir:e.slice(0,r+1).join("/"),deep:!0}:{dir:e.join("/"),deep:!1}}function i6(t,e){let r=[];for(let u of ef(t)){if(!gd(u.path)||LOe.test(u.path)||u.code.includes("D")||e?.has(mt.resolve(t,u.path)))continue;let d=sg(mt.join(t,u.path));if(d===void 0)continue;let p=u.code==="??"||u.code[0]==="A";r.push({rel:u.path,text:d,before:p?void 0:rNt(t,u.path)??void 0})}let n=new Set(r.map(u=>u.rel)),s=[],i=new Set;for(let{dir:u,deep:d}of new Map(r.map(p=>[JSON.stringify(ov(p.rel)),ov(p.rel)])).values())Ju(mt.join(t,u),p=>{let f=mt.relative(t,p).split(mt.sep).join("/");if(i.has(f)||n.has(f)||!gd(f)||!d&&!ig(f)&&!ZTt.test(mt.posix.basename(f)))return;i.add(f);let h=sg(p);if(h!==void 0&&s.push({rel:f,text:h}),s.length>=UOe)return!1},{skip:rO,maxDepth:d?8:0});let o=u=>sg(mt.join(t,u))!==void 0;for(let u of r){let d=Eb(u.text,u.rel);if(d)for(let p of d.imports){if(s.length>=UOe)break;let f=wb(u.rel,p.from,d.lang,o);if(!f||i.has(f)||n.has(f)||LOe.test(f))continue;i.add(f);let h=sg(mt.join(t,f));h!==void 0&&s.push({rel:f,text:h})}}let a=r.filter(u=>u.before===void 0&&!ig(u.rel)),c=[],l=[];if(a.length){let u=a.map(f=>bb(f.rel)),d=[...new Set(a.flatMap(f=>/^(index|__init__)$/.test(bb(f.rel))?[bb(f.rel),mt.posix.basename(mt.posix.dirname(f.rel))]:[bb(f.rel)]))],p=0;Ju(t,(f,h)=>{let A=h.split(mt.sep).join("/"),C=YTt.test(mt.posix.basename(A)),w=!C&&ig(A)&&gd(A)!==void 0&&!i.has(A)&&!n.has(A);if(!C&&!w)return;if(w&&++p>tNt)return!1;let E=sg(f);E!==void 0&&(C?u:d).some(I=>E.includes(I))&&(C?l:c).push({rel:A,text:E})},{skip:rO,maxDepth:10})}return{written:r,existing:s,otherTests:c,configs:l}}var o6="write-reuse",nNt=/\bcopies\b| is defined in \d+ test files | is imported only by /;function $Oe(t){return nNt.test(t)}var HOe={name:o6,verify(t){let e=t.prepared?.secretGateBaseline,r=[];for(let i of je(t.inputs)){let o=i.path===t.inputs.repositoryPath?"":Xe(t.inputs,i.slug);r.push(...XTt(i6(i.path,e)).map(a=>o+a))}let n=r.filter(i=>!$Oe(i));n.length&&console.log(`[${this.name}] noted, not sent back: ${n.join("; ")}`);let s=r.filter($Oe);return s.length?{...ce(this.name,s),repairable:!0}:{name:this.name,passed:!0}}},sNt=10,iNt=/test|spec|helper|support|fixture/i,oNt=t=>t.split("/").some(e=>GOe.test(e)||iNt.test(e)),aNt=10,cNt=4e3;function lNt(t,e){let r=e==="js"?/^export\s+(?:default\s+)?(?:async\s+)?(?:function\*?|class|const|let)\s+([A-Za-z_$][\w$]*)/gm:/^(?:async\s+)?(?:def|class)\s+([A-Za-z]\w*)/gm,n=[...t.matchAll(r)].map(i=>i[1]),s=e==="js"?[...Eb(t,"x.ts")?.listedExports??[]]:[];return[...new Set([...n,...s])]}function jOe(t){let e=new Set,r=[];Ju(t,(o,a)=>{let c=a.split(mt.sep).join("/"),l=gd(c);l!=="js"&&l!=="py"||(e.add(c),ig(c)&&r.length<cNt&&r.push(c))},{skip:rO,maxDepth:10});let n=o=>e.has(o),s=new Map;for(let o of r){let a=sg(mt.join(t,o)),c=a===void 0?void 0:Eb(a,o);if(!c)continue;let l=new Set(c.imports.map(u=>wb(o,u.from,c.lang,n)).filter(u=>!!u&&!ig(u)));for(let u of l)s.set(u,(s.get(u)??0)+1)}for(let o of e){if(mt.posix.basename(o)!=="conftest.py")continue;let a=mt.posix.dirname(o),c=r.filter(l=>l.endsWith(".py")&&(a==="."||l.startsWith(`${a}/`))).length;c&&s.set(o,Math.max(s.get(o)??0,c))}let i=o=>mt.posix.basename(o)==="conftest.py";return[...s].filter(([o,a])=>a>=2&&(oNt(o)||i(o))).sort((o,a)=>a[1]-o[1]||o[0].localeCompare(a[0])).slice(0,sNt).map(([o,a])=>{let c=sg(mt.join(t,o))??"";return{rel:o,importers:a,names:lNt(c,gd(o)).slice(0,aNt)}})}function zOe(t){return t.length?["The repo's shared test helpers, by how many of its test files use them:",...t.map(({label:e,module:r})=>` - ${e}${r.rel} (${r.importers} test files)${r.names.length?`: ${r.names.join(", ")}`:""}`)]:[]}var WOe=V(require("path"));var uNt=10,dNt=3,pNt=5,fNt=/\.(?:locator|getBy[A-Z]\w*|get_by_\w+)\(/g,hNt=/^\s*(?:export\s+(?:default\s+)?)?class\s+\w+/m,mNt=/@testing-library\/|from ["']enzyme["']/,sO=t=>(t.match(fNt)??[]).length,gNt=/@playwright\/test|from\s+['"]playwright|\bpage\.(?:goto|locator|getBy\w+)\s*\(|\bcy\.(?:visit|get)\s*\(|webdriver|selenium|newSkyrampPlaywrightPage/i,VOe=(t,e)=>YOe(t,e)&&gNt.test(e);function ANt(t,e){if(e===void 0)return sO(t);let r=new Map;for(let s of e.split(`
|
|
584
584
|
`))r.set(s,(r.get(s)??0)+1);let n=0;for(let s of t.split(`
|
|
585
|
-
`)){let i=r.get(s)??0;i>0?r.set(s,i-1):n+=sO(s)}return n}var yNt=t=>t[Math.max(0,Math.ceil(.9*t.length)-1)],a6=t=>zs.test(t),YOe=(t,e)=>{let r=gd(t);return(r==="js"||r==="py")&&!mNt.test(e)};function ENt(t){let e=new Map;for(let r of t){let n=WOe.posix.dirname(r).split("/"),s=n.findIndex(o=>/^pages?$/i.test(o)),i=s>=0?n.slice(0,s+1).join("/"):n.join("/");e.set(i,(e.get(i)??0)+(s>=0?1e3:1))}return[...e].sort((r,n)=>n[1]-r[1]||r[0].localeCompare(n[0]))[0][0]}function bNt(t){let e=[],r=new Map;for(let n of t.written){if(!a6(n.rel)||!VOe(n.rel,n.text))continue;let s=ov(n.rel).dir;r.set(s,[...r.get(s)??[],n])}for(let[n,s]of r){let i=t.written.filter(d=>d.before!==void 0).map(d=>({rel:d.rel,text:d.before})),o=[...t.existing,...i].filter(d=>n===""||d.rel.startsWith(`${n}/`)),a=o.filter(d=>!a6(d.rel)&&YOe(d.rel,d.text)&&hNt.test(d.text)&&sO(d.text)>0).map(d=>d.rel);if(a.length<dNt)continue;let c=o.filter(d=>a6(d.rel)&&VOe(d.rel,d.text)).map(d=>sO(d.text)).sort((d,p)=>d-p);if(c.length<pNt)continue;let l=yNt(c),u=ENt(a);for(let d of s){let p=ANt(d.text,d.before);p>=uNt&&p>l&&e.push(`${d.rel} locates ${p} elements inline, where nine in ten of the repo's specs locate ${l} or fewer and reach their pages through the page objects in ${u} \u2014 locate them in the page's page object there (a new one for a page that has none) and use it from the spec`)}}return e}var c6="write-page-objects",JOe={name:c6,verify(t){let e=t.prepared?.secretGateBaseline,r=[];for(let n of je(t.inputs)){let s=n.path===t.inputs.repositoryPath?"":Xe(t.inputs,n.slug);r.push(...bNt(i6(n.path,e)).map(i=>s+i))}return r.length?{...ce(this.name,r),repairable:!0}:{name:this.name,passed:!0}}};var KOe=V(require("fs")),ac=V(require("path"));var l6="write-no-app",wNt="needs the running app (a browser journey), and this run brings no app up: Validation Triage decided targeted_unit";function Cb(t){if(!wi(t))return{behaviors:[],defects:[],journeys:[],browserJourneys:[],maintenance:[]};let e=ee(t,"triage.json"),r=new Map((ee(t,"analyze.json")?.behaviors??[]).map(i=>[i.id,i])),n=new Set(Vx(t));return{behaviors:(e?.plan??[]).filter(i=>i.mechanism==="new_unit"&&n.delete(i.behaviorId)).map(i=>{let o=r.get(i.behaviorId);return{id:i.behaviorId,statement:o?.statement??i.behaviorId,covers:i.covers??"",where:`${Xe(t.inputs,o?.repository)}${o?.evidence??""}`}}),defects:lf(t),journeys:Dl(t),browserJourneys:Kp(ee(t,"plan.json")?.journeys).filter(i=>i.kind!=="in-process"),maintenance:Gt(t)?.maintenance??[]}}function u6(t){return t.behaviors.length+t.defects.length+t.journeys.length+t.maintenance.length>0}function XOe(t,e){let r=new Set([...t.notWritten.map(s=>s.case.trim()),...t.tests.flatMap(s=>s.covers)]),n=e.filter(s=>!r.has(s.id)).map(s=>({case:s.id,reason:wNt}));return n.length?{...t,notWritten:[...t.notWritten,...n]}:t}function d6(t){return je(t.inputs).filter(e=>e.writable).flatMap(e=>{let r=Vp(t.inputs,e.slug,"unit");return r?[{root:ac.resolve(e.path),slug:e.slug,dir:r}]:[]})}function CNt(t,e){let r=[],{work:n}=e,s=new Set(t.tests.flatMap(c=>c.covers)),i=new Set(t.notWritten.map(c=>c.case.trim())),o=c=>s.has(c)||i.has(c);for(let c of n.behaviors)!o(c.id)&&!e.couldBreak.has(c.id)&&r.push(`behavior "${c.id}" was planned a new in-process test and no test covers it \u2014 give it one, or say in notWritten why no in-process test can check it`);for(let c of n.defects)o(c.id)||r.push(`defect "${c.id}" has no test and is not in notWritten \u2014 give it a test that reaches it and expects the correct behaviour, or say in notWritten why no in-process test can`);for(let c of n.journeys)o(c.id)||r.push(`journey "${c.id}" has no test and is not in notWritten \u2014 walk it in one in-process test, or say in notWritten what it needs that is missing`);let a=c=>{let l=Ym(c).file,u=d=>d===l||d.endsWith(`/${l}`)||l.endsWith(`/${d}`);return t.tests.some(d=>u(d.file))||[...i].some(d=>d===c||u(Ym(d).file))};for(let c of n.maintenance)a(c.test)||r.push(`existing test ${c.test} (the plan says ${c.action}) is neither in tests nor in notWritten \u2014 run or maintain it in-process and list it, or put it under notWritten with what it needs that this run does not have`);for(let c of t.tests){if(c.change!=="added")continue;let l=e.read(c.file);if(!l)continue;for(let f of iD(l.body))r.push(`${c.file} uses ${f} \u2014 every test runs in one process: no network, no running app; mock outbound calls with the repo's own tools inside the test`);let u=e.placedDir?.(l.root),d=ac.dirname(l.rel).split(ac.sep).join("/");u&&u!=="."&&d!==u&&!d.startsWith(`${u}/`)&&r.push(`${c.file} is not in ${u}, where the Target puts unit tests for this repository`);let p=_l(l.root,l.rel);p&&Pl(p)&&!WE(p,l.rel)&&r.push(`${c.file} is not named the way ${p} collects tests \u2014 name it the way its runner collects tests, as the repo's own tests are`)}return r}function SNt(t,e){let r=e.replace(/^\.\//,""),n=r.split("/")[0],s=[{root:t[0],rel:r},...t.slice(1).filter(i=>ac.basename(i)===n).map(i=>({root:i,rel:r.slice(n.length+1)}))];for(let i of s){let o=ac.resolve(i.root,i.rel);if(o.startsWith(i.root+ac.sep))try{return{body:KOe.readFileSync(o,"utf-8"),root:i.root,rel:i.rel}}catch{continue}}}function ZOe(t){return{name:l6,verify(e,r){if(!wi(e))return{name:this.name,passed:!0};let n=t(e,r);if(!n)return{name:this.name,passed:!0};let s=ee(e,"plan.json"),i=[e.inputs.repositoryPath,...(e.inputs.relatedRepos??[]).map(a=>a.path)].map(a=>ac.resolve(a)),o=CNt(n,{work:Cb(e),couldBreak:s?new Set(Tx(s).keys()):new Set,read:a=>SNt(i,a),placedDir:a=>d6(e).find(c=>c.root===a)?.dir});return o.length?{name:this.name,passed:!1,details:o.join("; "),repairable:!0}:{name:this.name,passed:!0}}}}var iO=V(require("fs"));function eMe(t,e){return{name:t,verify(r,n){let s=mf(r.inputs.requirementItems);if(s.length===0)return{name:this.name,passed:!0};let i=[];for(let o of new Set(e(r,n))){let a;try{let l=i8(r,o);if(iO.statSync(l).size>GD)continue;a=iO.readFileSync(l,"utf-8")}catch{continue}let c=QDe(a,s);c.length&&i.push(`${o} copies the words of ${c.join(" and ")} in a comment, test title or test name`)}return i.length?{name:this.name,passed:!1,repairable:!0,details:`${i.join("; ")}. Tests are public to the repository's readers: name an item only by its key and criterion number (e.g. "PAY-184 AC2", "Confluence page 3021 AC1") and keep its words out of comments, titles and test names. When you rename a test, run it again under its new name.`}:{name:this.name,passed:!0}}}}var p6="write.json",f6=["adapt.json","generate.json","generate-ui.json","finalize.json",fd],rMe="write-no-secret-leak",nMe="write-checkout-intact",sMe="write-dependencies",aO=t=>jr.join(t.outputsDir,"write-scratch"),In=t=>jr.join(aO(t),p6);function iMe(t){if(wi(t))return Dl(t);let e=ee(t,"plan.json")?.journeys;if(!Array.isArray(e)||!e.length)return[];let r=new Set((Gt(t)?.generate??[]).map(n=>n.id));return e.filter(n=>n&&typeof n.id=="string"&&Array.isArray(n.steps)&&r.has(n.id))}function INt(t,e={}){if(!t.length)return[];let r=e.noApp?["Each is one in-process test of the whole flow: it drives the UI the way the repo's in-process tests do, checks after","each step what the user then sees, and asserts every part of the outcome at the end. Mark each step so a failure","names it (a labelled assertion, or the runner's own step or subtest), and let a failed check go on to the next step","where the test still allows it.","A journey no in-process test can walk here goes under notWritten, with what it needs that is missing: it is","reported as not covered, never left out."]:["Each is one test of the whole flow, of its kind. A browser journey runs against the real app: it opens the entry route","and does every step through the UI in order (no URL jump to a later step, no stub of the app's own network). An","in-process journey drives the UI the way the repo's in-process tests do. Either checks after each step what the user then sees, and","asserts every part of the outcome at the end, after a reload where it must persist. Mark each step so a failure names it (in Playwright, test.step),","and let a failed check go on to the next step where the page still allows it, so one defect does not hide the rest.","A journey whose test cannot run here (a browser, package or service it needs cannot be set up) goes under notWritten,","with what is missing: it is reported as not covered, never left out."];return["User journeys:",...t.map(n=>[` - ${n.id} ${n.name} \u2192 ${n.testFile}`,` entry: ${n.entry}`,` steps: ${BE(n)}`,` outcome: ${n.outcome}`].join(`
|
|
585
|
+
`)){let i=r.get(s)??0;i>0?r.set(s,i-1):n+=sO(s)}return n}var yNt=t=>t[Math.max(0,Math.ceil(.9*t.length)-1)],a6=t=>zs.test(t),YOe=(t,e)=>{let r=gd(t);return(r==="js"||r==="py")&&!mNt.test(e)};function ENt(t){let e=new Map;for(let r of t){let n=WOe.posix.dirname(r).split("/"),s=n.findIndex(o=>/^pages?$/i.test(o)),i=s>=0?n.slice(0,s+1).join("/"):n.join("/");e.set(i,(e.get(i)??0)+(s>=0?1e3:1))}return[...e].sort((r,n)=>n[1]-r[1]||r[0].localeCompare(n[0]))[0][0]}function bNt(t){let e=[],r=new Map;for(let n of t.written){if(!a6(n.rel)||!VOe(n.rel,n.text))continue;let s=ov(n.rel).dir;r.set(s,[...r.get(s)??[],n])}for(let[n,s]of r){let i=t.written.filter(d=>d.before!==void 0).map(d=>({rel:d.rel,text:d.before})),o=[...t.existing,...i].filter(d=>n===""||d.rel.startsWith(`${n}/`)),a=o.filter(d=>!a6(d.rel)&&YOe(d.rel,d.text)&&hNt.test(d.text)&&sO(d.text)>0).map(d=>d.rel);if(a.length<dNt)continue;let c=o.filter(d=>a6(d.rel)&&VOe(d.rel,d.text)).map(d=>sO(d.text)).sort((d,p)=>d-p);if(c.length<pNt)continue;let l=yNt(c),u=ENt(a);for(let d of s){let p=ANt(d.text,d.before);p>=uNt&&p>l&&e.push(`${d.rel} locates ${p} elements inline, where nine in ten of the repo's specs locate ${l} or fewer and reach their pages through the page objects in ${u} \u2014 locate them in the page's page object there (a new one for a page that has none) and use it from the spec`)}}return e}var c6="write-page-objects",JOe={name:c6,verify(t){let e=t.prepared?.secretGateBaseline,r=[];for(let n of je(t.inputs)){let s=n.path===t.inputs.repositoryPath?"":Xe(t.inputs,n.slug);r.push(...bNt(i6(n.path,e)).map(i=>s+i))}return r.length?{...ce(this.name,r),repairable:!0}:{name:this.name,passed:!0}}};var KOe=V(require("fs")),ac=V(require("path"));var l6="write-no-app",wNt="needs the running app (a browser journey), and this run brings no app up: Validation Triage decided targeted_unit";function Cb(t){if(!wi(t))return{behaviors:[],defects:[],journeys:[],browserJourneys:[],maintenance:[]};let e=ee(t,"triage.json"),r=new Map((ee(t,"analyze.json")?.behaviors??[]).map(i=>[i.id,i])),n=new Set(Vx(t));return{behaviors:(e?.plan??[]).filter(i=>i.mechanism==="new_unit"&&n.delete(i.behaviorId)).map(i=>{let o=r.get(i.behaviorId);return{id:i.behaviorId,statement:o?.statement??i.behaviorId,covers:i.covers??"",where:`${Xe(t.inputs,o?.repository)}${o?.evidence??""}`}}),defects:lf(t),journeys:Dl(t),browserJourneys:Kp(ee(t,"plan.json")?.journeys).filter(i=>i.kind!=="in-process"),maintenance:Gt(t)?.maintenance??[]}}function u6(t){return t.behaviors.length+t.defects.length+t.journeys.length+t.maintenance.length>0}function XOe(t,e){let r=new Set([...t.notWritten.map(s=>s.case.trim()),...t.tests.flatMap(s=>s.covers)]),n=e.filter(s=>!r.has(s.id)).map(s=>({case:s.id,reason:wNt}));return n.length?{...t,notWritten:[...t.notWritten,...n]}:t}function d6(t){return je(t.inputs).filter(e=>e.writable).flatMap(e=>{let r=Vp(t.inputs,e.slug,"unit");return r?[{root:ac.resolve(e.path),slug:e.slug,dir:r}]:[]})}function CNt(t,e){let r=[],{work:n}=e,s=new Set(t.tests.flatMap(c=>c.covers)),i=new Set(t.notWritten.map(c=>c.case.trim())),o=c=>s.has(c)||i.has(c);for(let c of n.behaviors)!o(c.id)&&!e.couldBreak.has(c.id)&&r.push(`behavior "${c.id}" was planned a new in-process test and no test covers it \u2014 give it one, or say in notWritten why no in-process test can check it`);for(let c of n.defects)o(c.id)||r.push(`defect "${c.id}" has no test and is not in notWritten \u2014 give it a test that reaches it and expects the correct behaviour, or say in notWritten why no in-process test can`);for(let c of n.journeys)o(c.id)||r.push(`journey "${c.id}" has no test and is not in notWritten \u2014 walk it in one in-process test, or say in notWritten what it needs that is missing`);let a=c=>{let l=Ym(c).file,u=d=>d===l||d.endsWith(`/${l}`)||l.endsWith(`/${d}`);return t.tests.some(d=>u(d.file))||[...i].some(d=>d===c||u(Ym(d).file))};for(let c of n.maintenance)a(c.test)||r.push(`existing test ${c.test} (the plan says ${c.action}) is neither in tests nor in notWritten \u2014 run or maintain it in-process and list it, or put it under notWritten with what it needs that this run does not have`);for(let c of t.tests){if(c.change!=="added")continue;let l=e.read(c.file);if(!l)continue;for(let f of iD(l.body))r.push(`${c.file} uses ${f} \u2014 every test runs in one process: no network, no running app; mock outbound calls with the repo's own tools inside the test`);let u=e.placedDir?.(l.root),d=ac.dirname(l.rel).split(ac.sep).join("/");u&&u!=="."&&d!==u&&!d.startsWith(`${u}/`)&&r.push(`${c.file} is not in ${u}, where the Target puts unit tests for this repository`);let p=_l(l.root,l.rel);p&&Pl(p)&&!WE(p,l.rel)&&r.push(`${c.file} is not named the way ${p} collects tests \u2014 name it the way its runner collects tests, as the repo's own tests are`)}return r}function SNt(t,e){let r=e.replace(/^\.\//,""),n=r.split("/")[0],s=[{root:t[0],rel:r},...t.slice(1).filter(i=>ac.basename(i)===n).map(i=>({root:i,rel:r.slice(n.length+1)}))];for(let i of s){let o=ac.resolve(i.root,i.rel);if(o.startsWith(i.root+ac.sep))try{return{body:KOe.readFileSync(o,"utf-8"),root:i.root,rel:i.rel}}catch{continue}}}function ZOe(t){return{name:l6,verify(e,r){if(!wi(e))return{name:this.name,passed:!0};let n=t(e,r);if(!n)return{name:this.name,passed:!0};let s=ee(e,"plan.json"),i=[e.inputs.repositoryPath,...(e.inputs.relatedRepos??[]).map(a=>a.path)].map(a=>ac.resolve(a)),o=CNt(n,{work:Cb(e),couldBreak:s?new Set(Tx(s).keys()):new Set,read:a=>SNt(i,a),placedDir:a=>d6(e).find(c=>c.root===a)?.dir});return o.length?{name:this.name,passed:!1,details:o.join("; "),repairable:!0}:{name:this.name,passed:!0}}}}var iO=V(require("fs"));function eMe(t,e){return{name:t,verify(r,n){let s=mf(r.inputs.requirementItems);if(s.length===0)return{name:this.name,passed:!0};let i=[];for(let o of new Set(e(r,n))){let a;try{let l=i8(r,o);if(iO.statSync(l).size>GD)continue;a=iO.readFileSync(l,"utf-8")}catch{continue}let c=QDe(a,s);c.length&&i.push(`${o} copies the words of ${c.join(" and ")} in a comment, test title or test name`)}return i.length?{name:this.name,passed:!1,repairable:!0,details:`${i.join("; ")}. Tests are public to the repository's readers: name an item only by its key and criterion number (e.g. "PAY-184 AC2", "Confluence page 3021 AC1") and keep its words out of comments, titles and test names. When you rename a test, run it again under its new name.`}:{name:this.name,passed:!0}}}}var p6="write.json",f6=["adapt.json","generate.json","generate-ui.json","finalize.json",fd],rMe="write-no-secret-leak",nMe="write-checkout-intact",sMe="write-dependencies",aO=t=>jr.join(t.outputsDir,"write-scratch"),In=t=>jr.join(aO(t),p6);function iMe(t){if(wi(t))return Dl(t);let e=ee(t,"plan.json")?.journeys;if(!Array.isArray(e)||!e.length)return[];let r=new Set((Gt(t)?.generate??[]).map(n=>n.id));return e.filter(n=>n&&typeof n.id=="string"&&Array.isArray(n.steps)&&r.has(n.id))}function INt(t,e={}){if(!t.length)return[];let r=e.noApp?["Each is one in-process test of the whole flow: it drives the UI the way the repo's in-process tests do, checks after","each step what the user then sees, and asserts every part of the outcome at the end. Mark each step so a failure","names it (a labelled assertion, or the runner's own step or subtest), and let a failed check go on to the next step","where the test still allows it.","A journey no in-process test can walk here goes under notWritten, with what it needs that is missing: it is","reported as not covered, never left out."]:["Each is one test of the whole flow, of its kind. A browser journey runs against the real app: it opens the entry route","and does every step through the UI in order (no URL jump to a later step, no stub of the app's own network). An","in-process journey drives the UI the way the repo's in-process tests do. Either checks after each step what the user then sees, and","asserts every part of the outcome at the end, after a reload where it must persist. Where a step lands on another page (a","redirect after a save, a detail or confirmation page), check on that page what it shows of what the user entered or saved","(the values, totals and counts), not only its address. Mark each step so a failure names it (in Playwright, test.step),","and let a failed check go on to the next step where the page still allows it, so one defect does not hide the rest.","A journey whose test cannot run here (a browser, package or service it needs cannot be set up) goes under notWritten,","with what is missing: it is reported as not covered, never left out."];return["User journeys:",...t.map(n=>[` - ${n.id} ${n.name} \u2192 ${n.testFile}`,` entry: ${n.entry}`,` steps: ${BE(n)}`,` outcome: ${n.outcome}`].join(`
|
|
586
586
|
`)),...r,'List each under "journeys" in your result (its file and test title, and where it broke when it did) and put its id in',`that file's "covers".`,""]}function oO(t){return wi(t)?!1:(Gt(t)?.generate??[]).some(e=>e.type==="ui")}function xNt(t){let e=eb(t);if(e){for(let n of[...f6,fo])yo.rmSync(jr.join(t.outputsDir,n),{force:!0});return{ok:!1,reasons:[e]}}let r=Gt(t);return r?r.generate.length===0&&r.maintenance.length===0&&!u6(Cb(t))?{ok:!1,reasons:["the plan has no test cases and no maintenance"]}:{ok:!0,reasons:[]}:{ok:!1,reasons:["no test plan (recommend.json) to write tests from"]}}function vNt(t){let e=o8(t),r=DD(t);for(let c of[...f6,"write.json",YE,fo])yo.rmSync(jr.join(t.outputsDir,c),{force:!0});let n=oO(t),s=(Gt(t)?.generate??[]).some(c=>c.type!=="ui")||u6(Cb(t)),{packages:i,notes:o}=xQe(t,{ui:n,backend:s});oMe(t,i);let a=[...o,...eg(t,"backend",[],{declaredOnly:!0,packages:i}),...n?eg(t,"ui",[],{declaredOnly:!0,packages:i}):[]];return{checkpoint:jr.join(aO(t),p6),secretGateBaseline:e,checkoutHeads:r,provisionNotes:a,sharedHelpers:RNt(t),testPackages:i,dependencyBaseline:o8(t)}}function oMe(t,e){let r=jr.join(t.outputsDir,fo);e.length===0?yo.rmSync(r,{force:!0}):yo.writeFileSync(r,JSON.stringify({schemaVersion:1,packages:[...e]},null,2)+`
|
|
587
587
|
`)}function RNt(t){try{return zOe(je(t.inputs).flatMap(e=>{let r=e.path===t.inputs.repositoryPath?"":Xe(t.inputs,e.slug);return jOe(e.path).map(n=>({label:r,module:n}))}))}catch{return[]}}function BNt(t){let e=no(t.inputs)?["It is a shared environment this policy protects: write and run no test that changes state there (a create, edit or delete, a form that submits, a setup that seeds); list any such test in notWritten instead."]:[];if(t.inputs.appRunning){let o=iQ(ee(t,`${Vs}.json`));return[t.inputs.appRunning.trim(),...e,...o?[o]:[]]}let r=ee(t,"deploy.json"),n=go(t.inputs.repositoryPath),s=n.setupScript?`start it with ${jr.relative(t.inputs.repositoryPath,n.setupScript)} and check it answers`:"start it the way the repo documents";if(u8(r)){let o=Object.entries(r.baseUrls??{}).map(([c,l])=>`${c} ${l}`).join(", "),a=r.health?.url??r.health?.command;return[`The app is running${o?`: ${o}`:""}.${a?` Health check: ${a}`:""}`,`If it stops answering, ${s}.`]}return[`The app may not be running.${r?.bringupError?.output?` Planning could not start it: ${r.bringupError.output.slice(0,300)}`:""} Check, and if it isn't up, ${s}; leave it running.`,"If you can't get it running, still write the tests and record them as not run (exit null)."]}function kNt(t){let e=d6(t);return["No app is running, and none is started for this run: Validation Triage decided the change is proven in-process","(targeted_unit). Every test runs in one process, the way the repo's own in-process tests run: no network or running","app, so nothing that calls a live service, the Skyramp client and its runtime mocks included. Mock outbound calls","(HTTP, queues, other services) inside the test with the repo's own fixtures and mocking tools. Run the tests the way","the repo's CI runs them (its runner, config and environment), selected as step 4 says. Each new test file is named the way its runner","collects tests, as the repo's own tests are. Maintain every stale existing test that can run in-process. An existing","test that needs the running app goes under notWritten, by its path, with what it needs that this run does not have:","it is reported as not covered.",...e.length?["The Target puts new unit tests in these directories, over the repo's own layout: put each new test under its repository's directory, not beside the existing tests:",...e.map(r=>` - ${Xe(t.inputs,r.slug)}${r.dir}/`)]:[]]}function TNt(t){return[...t.behaviors.length?['Behaviors that need a new in-process test (give each id in "covers"):',...t.behaviors.map(e=>` - ${e.id}: ${e.statement}
|
|
588
588
|
missing evidence to obtain: ${e.covers||"(unstated)"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyramp/testbot-core",
|
|
3
|
-
"version": "0.13.0-v3.
|
|
3
|
+
"version": "0.13.0-v3.116",
|
|
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. eval-entry.js is a development entry and must not ship. dist/VERSION.json exists only in a release-engine.yml build. assets/gen-reference/ is the staged codegen reference corpus, which generate.ts finds at ../assets from dist/.",
|