@skyramp/mcp 0.3.4 → 0.3.6-rc.1

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.
Files changed (159) hide show
  1. package/build/playwright/registerPlaywrightTools.js +92 -30
  2. package/build/playwright/traceRecordingPrompt.d.ts +6 -0
  3. package/build/playwright/traceRecordingPrompt.js +6 -2
  4. package/build/prompts/code-reuse.d.ts +1 -2
  5. package/build/prompts/code-reuse.js +182 -77
  6. package/build/prompts/modularization/integration-test-modularization.d.ts +2 -0
  7. package/build/prompts/modularization/integration-test-modularization.js +83 -41
  8. package/build/prompts/modularization/render.d.ts +18 -0
  9. package/build/prompts/modularization/render.js +12 -0
  10. package/build/prompts/modularization/ui-test-modularization.d.ts +3 -1
  11. package/build/prompts/modularization/ui-test-modularization.js +89 -47
  12. package/build/prompts/pom-aware-code-reuse.js +3 -1
  13. package/build/prompts/shared-helper-policy.d.ts +57 -0
  14. package/build/prompts/shared-helper-policy.js +135 -0
  15. package/build/prompts/test-recommendation/diffExecutionPlan.js +62 -56
  16. package/build/prompts/test-recommendation/fullRepoCatalog.js +19 -8
  17. package/build/prompts/test-recommendation/recommendationShared.d.ts +28 -6
  18. package/build/prompts/test-recommendation/recommendationShared.js +90 -16
  19. package/build/prompts/test-recommendation/registerRecommendTestsPrompt.js +22 -0
  20. package/build/prompts/test-recommendation/test-recommendation-prompt.d.ts +2 -2
  21. package/build/prompts/test-recommendation/test-recommendation-prompt.js +3 -3
  22. package/build/prompts/testbot/testbot-prompts.js +88 -33
  23. package/build/recommendation/budgeters/shared.js +105 -27
  24. package/build/recommendation/discriminators.js +13 -2
  25. package/build/recommendation/planRanker.d.ts +6 -6
  26. package/build/recommendation/planRanker.js +6 -61
  27. package/build/services/AnalyticsService.d.ts +7 -0
  28. package/build/services/AnalyticsService.js +7 -1
  29. package/build/services/ModularizationService.js +1 -3
  30. package/build/services/TestDiscoveryService.d.ts +0 -2
  31. package/build/services/TestDiscoveryService.js +2 -37
  32. package/build/services/TestGenerationService.d.ts +16 -0
  33. package/build/services/TestGenerationService.js +86 -10
  34. package/build/services/containerEnv.js +13 -12
  35. package/build/tools/code-refactor/codeReuseTool.js +279 -93
  36. package/build/tools/code-refactor/enhance-state.d.ts +49 -0
  37. package/build/tools/code-refactor/enhance-state.js +109 -0
  38. package/build/tools/code-refactor/enhanceAssertionsTool.js +34 -1
  39. package/build/tools/code-refactor/modularizationTool.js +9 -2
  40. package/build/tools/code-refactor/reuse-outcome.d.ts +23 -1
  41. package/build/tools/code-refactor/reuse-outcome.js +14 -4
  42. package/build/tools/code-refactor/reuse-state.d.ts +127 -5
  43. package/build/tools/code-refactor/reuse-state.js +628 -16
  44. package/build/tools/code-refactor/utils-verify-gates.d.ts +26 -0
  45. package/build/tools/code-refactor/utils-verify-gates.js +100 -0
  46. package/build/tools/code-refactor/verify-gates.d.ts +2 -1
  47. package/build/tools/code-refactor/verify-gates.js +90 -25
  48. package/build/tools/executeSkyrampTestTool.d.ts +19 -0
  49. package/build/tools/executeSkyrampTestTool.js +158 -8
  50. package/build/tools/generate-tests/generateBatchScenarioRestTool.js +2 -2
  51. package/build/tools/generate-tests/generateE2ERestTool.js +16 -0
  52. package/build/tools/generate-tests/generateUIRestTool.d.ts +1 -0
  53. package/build/tools/generate-tests/generateUIRestTool.js +22 -0
  54. package/build/tools/generate-tests/scenarioLint.d.ts +2 -0
  55. package/build/tools/generate-tests/scenarioLint.js +127 -19
  56. package/build/tools/generate-tests/trace-reuse-guard.d.ts +20 -0
  57. package/build/tools/generate-tests/trace-reuse-guard.js +93 -0
  58. package/build/tools/submitReportTool.d.ts +38 -38
  59. package/build/tools/submitReportTool.js +487 -104
  60. package/build/tools/test-management/analyzeChangesTool.d.ts +24 -1
  61. package/build/tools/test-management/analyzeChangesTool.js +75 -12
  62. package/build/tools/test-management/analyzeTestHealthTool.js +7 -7
  63. package/build/tools/test-management/registerTestPlanTool.d.ts +203 -0
  64. package/build/tools/test-management/registerTestPlanTool.js +149 -23
  65. package/build/types/Recommendation.d.ts +34 -5
  66. package/build/types/RepositoryAnalysis.d.ts +133 -114
  67. package/build/types/RepositoryAnalysis.js +1 -1
  68. package/build/types/ReuseOutcome.d.ts +102 -6
  69. package/build/types/ReuseOutcome.js +16 -2
  70. package/build/types/TestRecommendation.js +21 -3
  71. package/build/types/TestTypes.js +14 -8
  72. package/build/types/TestbotReport.d.ts +25 -3
  73. package/build/types/index.d.ts +2 -2
  74. package/build/types/index.js +1 -1
  75. package/build/utils/AnalysisStateManager.d.ts +69 -1
  76. package/build/utils/AnalysisStateManager.js +69 -5
  77. package/build/utils/branchDiff.d.ts +10 -0
  78. package/build/utils/branchDiff.js +28 -0
  79. package/build/utils/changedRoutes.d.ts +29 -0
  80. package/build/utils/changedRoutes.js +87 -0
  81. package/build/utils/featureFlags.d.ts +21 -0
  82. package/build/utils/featureFlags.js +23 -0
  83. package/build/utils/frontendIntegration.js +34 -4
  84. package/build/utils/importerHop.d.ts +2 -8
  85. package/build/utils/importerHop.js +15 -53
  86. package/build/utils/pathMatching.d.ts +38 -0
  87. package/build/utils/pathMatching.js +71 -0
  88. package/build/utils/pathSignatures.d.ts +22 -0
  89. package/build/utils/pathSignatures.js +57 -0
  90. package/build/utils/planMatchKeys.d.ts +16 -3
  91. package/build/utils/planMatchKeys.js +26 -10
  92. package/build/utils/pluralization.d.ts +10 -0
  93. package/build/utils/pluralization.js +18 -0
  94. package/build/utils/pom-catalog-parse.d.ts +52 -0
  95. package/build/utils/pom-catalog-parse.js +141 -0
  96. package/build/utils/pom-scope/selector-extractor.d.ts +12 -0
  97. package/build/utils/pom-scope/selector-extractor.js +34 -8
  98. package/build/utils/pom-verify/verify.d.ts +6 -5
  99. package/build/utils/pom-verify/verify.js +8 -6
  100. package/build/utils/reportLanguage.d.ts +43 -0
  101. package/build/utils/reportLanguage.js +125 -0
  102. package/build/utils/reportVerification.d.ts +74 -4
  103. package/build/utils/reportVerification.js +259 -3
  104. package/build/utils/reuseRouting.d.ts +3 -0
  105. package/build/utils/reuseRouting.js +50 -0
  106. package/build/utils/routeParsers.d.ts +2 -0
  107. package/build/utils/routeParsers.js +65 -8
  108. package/build/utils/scenarioDrafting.d.ts +1 -1
  109. package/build/utils/scenarioDrafting.js +57 -45
  110. package/build/utils/subjectEndpoints.d.ts +19 -0
  111. package/build/utils/subjectEndpoints.js +98 -0
  112. package/build/utils/testFileClassification.d.ts +11 -0
  113. package/build/utils/testFileClassification.js +47 -0
  114. package/build/utils/uiPageEnumerator.d.ts +45 -19
  115. package/build/utils/uiPageEnumerator.js +95 -51
  116. package/build/utils/utils-verify/allow.d.ts +16 -0
  117. package/build/utils/utils-verify/allow.js +68 -0
  118. package/build/utils/utils-verify/call-sites.d.ts +34 -0
  119. package/build/utils/utils-verify/call-sites.js +154 -0
  120. package/build/utils/utils-verify/index.d.ts +7 -0
  121. package/build/utils/utils-verify/index.js +7 -0
  122. package/build/utils/utils-verify/language-spec.d.ts +91 -0
  123. package/build/utils/utils-verify/language-spec.js +210 -0
  124. package/build/utils/utils-verify/locate.d.ts +39 -0
  125. package/build/utils/utils-verify/locate.js +199 -0
  126. package/build/utils/utils-verify/parse.d.ts +34 -0
  127. package/build/utils/utils-verify/parse.js +177 -0
  128. package/build/utils/utils-verify/stage.d.ts +24 -0
  129. package/build/utils/utils-verify/stage.js +107 -0
  130. package/build/utils/utils-verify/verify.d.ts +63 -0
  131. package/build/utils/utils-verify/verify.js +168 -0
  132. package/build/utils/utils.d.ts +3 -1
  133. package/build/utils/utils.js +3 -1
  134. package/build/workspace/workspace.d.ts +32 -32
  135. package/node_modules/playwright/lib/mcp/skyramp/assertTool.js +9 -5
  136. package/node_modules/playwright/lib/mcp/skyramp/loadTraceTool.js +16 -0
  137. package/node_modules/playwright/lib/mcp/skyramp/skyRampImport.js +2 -0
  138. package/node_modules/playwright/lib/mcp/skyramp/traceRecordingBackend.js +115 -14
  139. package/node_modules/playwright/lib/mcp/test/skyRampExport.js +13 -1
  140. package/node_modules/playwright/node_modules/playwright-core/.DS_Store +0 -0
  141. package/node_modules/playwright/node_modules/playwright-core/lib/server/codegen/skyramp/jsonlReader.js +2 -0
  142. package/node_modules/playwright/node_modules/playwright-core/lib/vite/htmlReport/index.html +27 -253
  143. package/node_modules/playwright/node_modules/playwright-core/lib/vite/recorder/assets/{codeMirrorModule-DtudTj_v.js → codeMirrorModule-DJMC4zNo.js} +1 -1
  144. package/node_modules/playwright/node_modules/playwright-core/lib/vite/recorder/assets/index-BW82eAUI.js +196 -0
  145. package/node_modules/playwright/node_modules/playwright-core/lib/vite/recorder/index.html +1 -1
  146. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/assets/{codeMirrorModule-FNMuBzX1.js → codeMirrorModule-CZfp96qZ.js} +1 -1
  147. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-gpLo02E0.js +809 -0
  148. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/index.Bq1r1URj.js +2 -0
  149. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/index.html +2 -2
  150. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/uiMode.VEfqi1qN.js +5 -0
  151. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +2 -2
  152. package/node_modules/playwright/node_modules/playwright-core/package.json +1 -1
  153. package/node_modules/playwright/node_modules/playwright-core/src/server/codegen/skyramp/jsonlReader.ts +1 -1
  154. package/node_modules/playwright/package.json +1 -1
  155. package/package.json +2 -2
  156. package/node_modules/playwright/node_modules/playwright-core/lib/vite/recorder/assets/index-BpDwp16L.js +0 -422
  157. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-Co9upU5h.js +0 -1035
  158. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/index.DXNIQ_dx.js +0 -2
  159. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/uiMode.CIKB3XSv.js +0 -5
@@ -1,4 +1,8 @@
1
1
  import { z } from "zod";
2
+ import { pendingReuseDebt } from "./reuse-state.js";
3
+ import { recordEnhanceObligation } from "./enhance-state.js";
4
+ import { stageUtilsArtifacts } from "../../utils/utils-verify/index.js";
5
+ import { toolError } from "../../utils/utils.js";
2
6
  import { TestType } from "../../types/TestTypes.js";
3
7
  import { AnalyticsService } from "../../services/AnalyticsService.js";
4
8
  import { getContractProviderAssertionsPrompt } from "../../prompts/enhance-assertions/contractProviderAssertionsPrompt.js";
@@ -73,8 +77,32 @@ export function registerEnhanceAssertionsTool(server) {
73
77
  inputSchema: enhanceAssertionsSchema,
74
78
  }, async (params) => {
75
79
  const { testFile, testType, enhanceType, autoApply } = params;
80
+ // SKYR-4115: the reuse tool hands out POM mapping instructions and then relies on
81
+ // the agent to come back with `verify: true` — the call that runs the zero-reuse
82
+ // gate. This is the first tool called after it on the same spec, so it is where a
83
+ // skipped verify is caught cheapest. Enforcing the call (not the outcome) keeps
84
+ // the policy in the reuse phase where it belongs.
85
+ //
86
+ // No stateFile is passed because this tool's schema has no such field, so outside
87
+ // CI — where nothing anchors the run state path — this checkpoint fails open. The
88
+ // execute_test backstop does take params.stateFile and covers that caller.
89
+ // SKYR-4220: stage the shared utils file this spec wrote or imports BEFORE the
90
+ // debt check, unconditionally — so the file reaches the output commit even on a
91
+ // path where the agent never calls verify. Located by header, not by name.
92
+ await stageUtilsArtifacts(testFile);
93
+ const owed = await pendingReuseDebt(testFile, undefined, testType, {
94
+ chain: false,
95
+ });
96
+ if (owed)
97
+ return toolError(owed);
76
98
  // Stage so testbot includes the generated files in its output commit.
77
99
  await stageGeneratedPaths(testFile);
100
+ // SKYR-4262: snapshot the spec at instruction-handout time. This tool only
101
+ // returns instructions — nothing here verifies the agent follows them — so
102
+ // skyramp_execute_test blocks later if the file is still byte-identical
103
+ // (instructions acknowledged, never acted on). Any edit clears the debt,
104
+ // including a documented `// assertions reviewed:` no-change decision.
105
+ await recordEnhanceObligation(testFile);
78
106
  if (autoApply) {
79
107
  const compactInstructions = [
80
108
  `Enhance response body assertions in: \`${testFile}\``,
@@ -92,7 +120,12 @@ export function registerEnhanceAssertionsTool(server) {
92
120
  content: [{ type: "text", text: compactInstructions }],
93
121
  isError: false,
94
122
  };
95
- AnalyticsService.pushMCPToolEvent(TOOL_NAME, undefined, { testFile: params.testFile, testType: params.testType, enhanceType: params.enhanceType, autoApply: Boolean(params.autoApply) }).catch(() => { });
123
+ AnalyticsService.pushMCPToolEvent(TOOL_NAME, undefined, {
124
+ testFile: params.testFile,
125
+ testType: params.testType,
126
+ enhanceType: params.enhanceType,
127
+ autoApply: Boolean(params.autoApply),
128
+ }).catch(() => { });
96
129
  return result;
97
130
  }
98
131
  const enhanceCtx = enhanceType;
@@ -7,6 +7,7 @@ import { AnalyticsService } from "../../services/AnalyticsService.js";
7
7
  import { normalizeLanguageParams, resolveParamAliases, } from "../../utils/normalizeParams.js";
8
8
  import { normalizeSkyrampImportsInFile } from "../../utils/normalizeSkyrampImports.js";
9
9
  import { stageGeneratedPaths } from "../../utils/gitStaging.js";
10
+ import { recordModularized } from "./reuse-state.js";
10
11
  const modularizationSchema = {
11
12
  testFile: z
12
13
  .string()
@@ -77,11 +78,15 @@ After modularization, if errors remain, call skyramp_fix_errors.
77
78
  params.testType = TestType.UI;
78
79
  // For UI/E2E/Integration tests, always enable modularization.
79
80
  // These test types are trace-based and benefit from modularization.
80
- if (!params.isTraceBased && [TestType.UI, TestType.E2E, TestType.INTEGRATION].includes(params.testType))
81
+ if (!params.isTraceBased &&
82
+ [TestType.UI, TestType.E2E, TestType.INTEGRATION].includes(params.testType))
81
83
  params.isTraceBased = true;
82
84
  normalizeSkyrampImportsInFile(params.testFile);
83
85
  // Stage so testbot includes the generated files in its output commit.
84
86
  await stageGeneratedPaths(params.testFile);
87
+ // SKYR-4220: the modularize→reuse pair is enforced on hand-off targets; this is
88
+ // the mark the reuse tool checks. Best-effort, like every reuse-state write.
89
+ await recordModularized(params.testFile);
85
90
  // Default prompt to test file content
86
91
  if (!params.prompt && params.testFile) {
87
92
  try {
@@ -120,7 +125,9 @@ After modularization, if errors remain, call skyramp_fix_errors.
120
125
  testFile: params.testFile,
121
126
  language: params.language ?? "",
122
127
  testType: params.testType ?? "",
123
- }).catch((err) => { logger.warning("Analytics event failed", { error: String(err) }); });
128
+ }).catch((err) => {
129
+ logger.warning("Analytics event failed", { error: String(err) });
130
+ });
124
131
  }
125
132
  });
126
133
  }
@@ -1,6 +1,7 @@
1
1
  import type { VerifyResult } from "../../utils/pom-verify/index.js";
2
2
  import { ReuseVerificationOutcome, type ReuseSkippedEntry } from "../../types/ReuseOutcome.js";
3
- export { ReuseDeclinedBy, ReuseVerificationOutcome, type ReuseOutcome, type ReuseSkippedEntry, } from "../../types/ReuseOutcome.js";
3
+ import { HelperVerificationOutcome } from "../../types/ReuseOutcome.js";
4
+ export { ReuseDeclinedBy, ReuseVerificationOutcome, HelperVerificationOutcome, type ReuseOutcome, type ReuseSkippedEntry, } from "../../types/ReuseOutcome.js";
4
5
  /** A member the verifier flagged at some point in this run. NOT the same as "a
5
6
  * member that was demoted": the workflow allows one remap attempt, so a flagged
6
7
  * member may have been fixed rather than restored to raw inline. Only a
@@ -48,6 +49,27 @@ export interface ReuseRecord {
48
49
  /** Identity of the spec to re-derive from, and the language to parse it as. */
49
50
  testFilePath?: string;
50
51
  language?: string;
52
+ /** The SkyrampUtils path's debt. Written when that path's reuse instructions are
53
+ * issued; the debt is exactly "issued and no verify pass has recorded a PASSED or
54
+ * NoUtilsFile verdict". Not recoverable from the spec: whether instructions were
55
+ * handed out is a fact about the run, not the file. `framework` is kept only so
56
+ * the checkpoint can hand back the exact call — the reuse tool's schema requires
57
+ * it, and a Python hand-off omits it. */
58
+ utils?: UtilsReuseRecord;
59
+ /** `skyramp_modularization` ran for this spec (the call, not its application — the
60
+ * enforceable unit, as with every other debt here). Read by the reuse tool on a
61
+ * hand-off target: modularize-first flows owe modularization BEFORE reuse. */
62
+ modularized?: true;
63
+ }
64
+ export interface UtilsReuseRecord {
65
+ /** True once the utils path handed out reuse instructions; a bare verify without a
66
+ * prior discovery records `false` — a verdict, not a debt. */
67
+ issued: boolean;
68
+ framework: string;
69
+ testType?: string;
70
+ verification?: HelperVerificationOutcome;
71
+ /** The last verify pass threw; the debt fails open until a pass succeeds. */
72
+ verifyError?: boolean;
51
73
  }
52
74
  /**
53
75
  * Every well-formed `// kept inline: <basename> — <reason>` marker in a spec.
@@ -22,7 +22,7 @@ const KEY_SEP = "\0";
22
22
  // The wire shape lives in types/ (and is re-exported from types/index.ts for
23
23
  // consumers). Re-exported here so this module stays the one place to look when
24
24
  // working on the derivation.
25
- export { ReuseDeclinedBy, ReuseVerificationOutcome, } from "../../types/ReuseOutcome.js";
25
+ export { ReuseDeclinedBy, ReuseVerificationOutcome, HelperVerificationOutcome, } from "../../types/ReuseOutcome.js";
26
26
  /** Matches a well-formed `// kept inline: <basename> <sep> <reason>` marker.
27
27
  *
28
28
  * The separator must be an em/en dash or a *spaced* hyphen. Discovery has no
@@ -89,7 +89,10 @@ export function flaggedFrom(r) {
89
89
  for (const v of r.violations) {
90
90
  const file = v.searched[0];
91
91
  if (file)
92
- out.push({ pageObject: path.basename(file), member: `${v.binding}.${v.member}` });
92
+ out.push({
93
+ pageObject: path.basename(file),
94
+ member: `${v.binding}.${v.member}`,
95
+ });
93
96
  }
94
97
  return out;
95
98
  }
@@ -144,7 +147,12 @@ export function buildSkipped(specContent, flagged) {
144
147
  return { pageObject, declinedBy: ReuseDeclinedBy.NotMapped, reason };
145
148
  }
146
149
  if (members.length === 1 && markerCounts.get(pageObject) === 1) {
147
- return { pageObject, member: members[0], declinedBy: ReuseDeclinedBy.DemotedByVerify, reason };
150
+ return {
151
+ pageObject,
152
+ member: members[0],
153
+ declinedBy: ReuseDeclinedBy.DemotedByVerify,
154
+ reason,
155
+ };
148
156
  }
149
157
  return { pageObject, reason };
150
158
  });
@@ -154,5 +162,7 @@ export function buildSkipped(specContent, flagged) {
154
162
  * here — it is recorded on the prompt-generation call, where "no reusable POM
155
163
  * layer detected" is determined. */
156
164
  export function verificationFrom(gateFired, r) {
157
- return !gateFired && r.ok ? ReuseVerificationOutcome.Passed : ReuseVerificationOutcome.Failed;
165
+ return !gateFired && r.ok
166
+ ? ReuseVerificationOutcome.Passed
167
+ : ReuseVerificationOutcome.Failed;
158
168
  }
@@ -1,7 +1,19 @@
1
1
  import { type VerifyResult } from "../../utils/pom-verify/index.js";
2
2
  import { type ReuseOutcome, type ReuseRecord } from "./reuse-outcome.js";
3
- /** Record the tier-1 candidate count STEP 1 detected. */
4
- export declare function recordCandidates(testFile: string, candidatesDetected: number, explicitStateFile?: string): Promise<void>;
3
+ import { type UtilsVerifyResult } from "../../utils/utils-verify/index.js";
4
+ /**
5
+ * Record the tier-1 candidate count STEP 1 detected, plus the identity needed to
6
+ * re-derive the counts from the delivered spec later.
7
+ *
8
+ * The identity is written here and not only by {@link recordVerifyOutcome} because
9
+ * the verify pass is a call the agent decides whether to make. When it skips it,
10
+ * a record holding the candidate count alone makes `rederiveReuseOutcome` bail out,
11
+ * and the report states "N candidate POM files detected" with no reuse numbers —
12
+ * indistinguishable from a run where reuse was measured and simply not summarized.
13
+ * Recording it unconditionally is what makes the zero-reuse case reportable without
14
+ * the agent's cooperation.
15
+ */
16
+ export declare function recordCandidates(testFile: string, candidatesDetected: number, language: string, explicitStateFile?: string): Promise<void>;
5
17
  /** The prompt-generation call found no reusable POM layer at all. No candidate
6
18
  * count is recorded: "0 candidates" adds nothing to "no POM layer was found",
7
19
  * and rendering both produces a redundant zero in the summary. */
@@ -18,6 +30,115 @@ export declare function recordNoPomLayer(testFile: string, explicitStateFile?: s
18
30
  * than restored (see buildSkipped for how narrowly it is trusted).
19
31
  */
20
32
  export declare function recordVerifyOutcome(testFile: string, r: VerifyResult, gateFired: boolean, language: string, explicitStateFile?: string): Promise<void>;
33
+ /**
34
+ * Has this spec been handed POM mapping instructions it never came back to verify?
35
+ *
36
+ * The enforcement half of SKYR-4115, and deliberately NOT a second copy of the
37
+ * zero-reuse policy. `zeroReuseGateFailure` is already the right check in the right
38
+ * place — inside `skyramp_reuse_code`'s verify branch. Its only defect was being
39
+ * reachable solely through a call the agent chooses to make. So this enforces the
40
+ * CALL, not the outcome: the gate then runs where it was designed to, with its own
41
+ * mapping instructions and its own documented-decline escape hatch.
42
+ *
43
+ * The debt needs no field of its own — it is exactly "detection recorded candidates
44
+ * and no verify pass has recorded a verdict". `recordCandidates` writes the former,
45
+ * `recordVerifyOutcome` always writes the latter, so ONE `verify: true` call clears
46
+ * this unconditionally. That is what makes a hard block safe without a retry budget:
47
+ * the agent cannot be stuck, because the action that clears it always succeeds.
48
+ *
49
+ * A FAILED verdict does NOT clear it. `formatVerifyReport` already tells the agent
50
+ * "do not finish until it reports PASSED" — enforcing that in prose is the exact
51
+ * failure this ticket exists to replace, and this is the one place positioned to
52
+ * enforce it in code.
53
+ *
54
+ * Blocking on a failure needs no retry budget either, because these checkpoints are
55
+ * NOT terminal. A PASS is always reachable in one edit plus one call (substitute the
56
+ * members, or document each candidate with a `// kept inline:` marker, which the gate
57
+ * accepts), and an agent that resolves neither can still walk past these tools to
58
+ * `skyramp_submit_report`, which does not block and reports the honest zero. So the
59
+ * worst case degrades to the reporting half rather than to a run that produces
60
+ * nothing — which is what a bound would have been protecting against.
61
+ */
62
+ export declare function pendingReuseVerification(testFile: string, explicitStateFile?: string): Promise<string | undefined>;
63
+ /**
64
+ * The utils path handed out its reuse instructions for this spec. This is the debt:
65
+ * from here until a `verify: true` pass records PASSED or NoUtilsFile, the tools that
66
+ * follow reuse on the same spec refuse.
67
+ *
68
+ * Same shape as {@link recordCandidates} for the POM path, and for the same reason:
69
+ * the verify call is the agent's to make, and the utils file it stages and checks is
70
+ * the artifact a skipped call would ship broken (SKYR-4196 Part B run 2). Recorded
71
+ * unconditionally on the utils path — even a spec that ends up moving nothing clears
72
+ * cheaply (NoUtilsFile), and the cost of a skipped debt is a test importing a module
73
+ * the PR does not contain.
74
+ */
75
+ export declare function recordUtilsReuseIssued(testFile: string, language: string, framework: string, testType: string | undefined, explicitStateFile?: string): Promise<void>;
76
+ /** A verify pass that threw. Recorded so the debt FAILS OPEN — a verifier that cannot
77
+ * run must not leave a debt nothing can pay — and cleared by the next successful pass. */
78
+ export declare function recordUtilsVerifyError(testFile: string, explicitStateFile?: string): Promise<void>;
79
+ /** Verdict of one utils verify pass. The verdict alone is stored — counts and the
80
+ * file list are re-derived from the delivered files at report time. */
81
+ export declare function recordUtilsVerifyOutcome(testFile: string, r: UtilsVerifyResult, language: string, framework: string, testType: string | undefined, explicitStateFile?: string): Promise<boolean>;
82
+ /** `skyramp_modularization` was called for this spec. Ownership on the write, like
83
+ * the utils debt: a same-basename spec elsewhere does not inherit the mark. */
84
+ export declare function recordModularized(testFile: string, explicitStateFile?: string): Promise<void>;
85
+ /**
86
+ * Does this spec owe `skyramp_modularization` before reuse may be issued? Only a spec
87
+ * generation handed off (modularize-first flows: the hand-off names both calls, in
88
+ * order) and only until the mark exists. Measured: eval run u4219f — the agent skipped
89
+ * modularization for both new tests and went straight to reuse; the reuse half was
90
+ * enforced, the modularization half was prose. Fails open without a hand-off, on a
91
+ * record owned by another spec, on an unwritable or unreadable state file.
92
+ */
93
+ export declare function pendingModularization(testFile: string, explicitStateFile?: string): Promise<string | undefined>;
94
+ /**
95
+ * Has this spec been handed SkyrampUtils reuse instructions it never came back to
96
+ * verify? The utils-path twin of {@link pendingReuseVerification}, needed because that
97
+ * predicate keys on `candidatesDetected`, which only a POM-aware target writes — a
98
+ * utils debt riding it would fail open on every repo without a page-object layer,
99
+ * precisely the population this exists for.
100
+ *
101
+ * Failure mode, stated: an unresolved utils debt BLOCKS execution. On the POM path
102
+ * a missed verify degrades a report; here it ships a test importing a file the PR
103
+ * does not contain, which cannot run at all — so losing the execution attempt is
104
+ * the cheaper failure. Same no-retry-budget reasoning as the POM twin: PASSED is one
105
+ * edit plus one call away (fix the invariant, or document it with the
106
+ * `reuse-verify: allow` line the verify text hands over), NoUtilsFile clears it for
107
+ * free, and `skyramp_submit_report` never reads it, so nothing hangs.
108
+ */
109
+ export declare function pendingUtilsVerification(testFile: string, explicitStateFile?: string): Promise<string | undefined>;
110
+ /**
111
+ * Generation emitted a modularize→reuse hand-off for the tests it wrote into
112
+ * `outputDir`. Recorded at the SAME site and under the SAME condition as the
113
+ * hand-off text, so the debt can never be owed for a test that was never told to
114
+ * pay it (a gate that cannot be satisfied is the SKYR-4115 failure inverted).
115
+ */
116
+ export declare function recordReuseHandOff(files: string[], testType: string, language: string, framework: string, explicitStateFile?: string): Promise<void>;
117
+ /**
118
+ * Does this spec owe the modularize→reuse pair its generation handed off? The
119
+ * chain-compliance half of SKYR-4220: 2 of 8 SKYR-4196 Part B runs wrote a second
120
+ * integration test's imports by hand and skipped the pair. A hand-off of the spec's
121
+ * test type exists for its directory (integration, or ui since SKYR-4224), the spec
122
+ * is new in this run, and no reuse pass was ever recorded for it → refuse, naming
123
+ * the two calls. Fails open on everything else.
124
+ */
125
+ export declare function pendingReuseChain(testFile: string, explicitStateFile?: string, testType?: string): Promise<string | undefined>;
126
+ /** Every reuse-phase debt a downstream tool must refuse on, first one wins. One call
127
+ * site for both checkpoints so they cannot drift apart. */
128
+ export declare function pendingReuseDebt(testFile: string, explicitStateFile?: string, testType?: string, opts?: {
129
+ chain?: boolean;
130
+ }): Promise<string | undefined>;
131
+ /**
132
+ * Report-time chain verdict for one report row. `fileName` is a basename, so it is
133
+ * matched against the basenames of the handed-off files of the same test type. True
134
+ * only when such a file exists, is new in this run, and no reuse record was ever
135
+ * written for that basename — never `false`, so a consumer omits rather than renders a
136
+ * negative.
137
+ */
138
+ export declare function reuseChainSkipped(fileName: string, testType: string, record: ReuseRecord | undefined, handOffs: Record<string, {
139
+ testType: string;
140
+ language: string;
141
+ }> | undefined): Promise<true | undefined>;
21
142
  /**
22
143
  * Re-derive a recorded outcome from the spec as it stands NOW, so the report
23
144
  * describes the delivered artifact rather than the state at verify time.
@@ -38,8 +159,9 @@ export declare function recordVerifyOutcome(testFile: string, r: VerifyResult, g
38
159
  * reads as though the empty result had been blessed.
39
160
  *
40
161
  * Returns the recorded outcome minus internals when re-derivation is impossible
41
- * (no path recorded — e.g. only the candidate count was ever written), and
42
- * `undefined` when it fails outright. Failing closed matters: falling back to the
43
- * recorded counts is exactly the false claim this exists to prevent.
162
+ * (no path recorded — now only the no-POM-layer path, which has no spec to measure
163
+ * and no candidates to contrast against), and `undefined` when it fails outright.
164
+ * Failing closed matters: falling back to the recorded counts is exactly the false
165
+ * claim this exists to prevent.
44
166
  */
45
167
  export declare function rederiveReuseOutcome(record: ReuseRecord): Promise<ReuseOutcome | undefined>;