@runa-ai/runa-cli 0.7.0 → 0.7.2

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 (139) hide show
  1. package/dist/{build-V66FAQXB.js → build-HQMSVN6N.js} +3 -3
  2. package/dist/{check-LOMVIRHX.js → check-PCSQPYDM.js} +2 -2
  3. package/dist/{chunk-QM53IQHM.js → chunk-2QX7T24B.js} +1 -1
  4. package/dist/{chunk-XDCHRVE3.js → chunk-4XHZQRRK.js} +2 -2
  5. package/dist/{chunk-7B5C6U2K.js → chunk-A6A7JIRD.js} +35 -2
  6. package/dist/{chunk-Z4Z5DNW4.js → chunk-B3POLMII.js} +12 -0
  7. package/dist/chunk-CKRLVEIO.js +119 -0
  8. package/dist/{chunk-HD74F6W2.js → chunk-FWMGC5FP.js} +1 -0
  9. package/dist/{chunk-H2AHNI75.js → chunk-LCK2LGVR.js} +1 -1
  10. package/dist/{chunk-FHG3ILE4.js → chunk-OBYZDT2E.js} +38 -8
  11. package/dist/{chunk-AIP6MR42.js → chunk-PMXE5XOJ.js} +1 -1
  12. package/dist/{chunk-VM3IWOT5.js → chunk-QSEF4T3Y.js} +13 -5
  13. package/dist/{chunk-NPSRD26F.js → chunk-UHDAYPHH.js} +1 -1
  14. package/dist/{chunk-2APB25TT.js → chunk-VSH3IXDQ.js} +7 -3
  15. package/dist/{chunk-644FVGIQ.js → chunk-WPMR7RQ4.js} +9 -2
  16. package/dist/chunk-XVNDDHAF.js +65 -0
  17. package/dist/{risk-detector-plpgsql-HWKS4OLR.js → chunk-Y5ANTCKE.js} +3 -412
  18. package/dist/{chunk-SGJG3BKD.js → chunk-Z7A4BEWF.js} +1 -1
  19. package/dist/{ci-ZWRVWNFX.js → ci-Z4525QW6.js} +3095 -709
  20. package/dist/{cli-2JNBJUBB.js → cli-Q2XIQDRS.js} +72 -54
  21. package/dist/commands/ci/commands/ci-prod-db-operations.d.ts +6 -4
  22. package/dist/commands/ci/commands/ci-prod-types.d.ts +3 -0
  23. package/dist/commands/ci/commands/ci-prod-workflow.d.ts +1 -1
  24. package/dist/commands/ci/commands/ci-resolvers.d.ts +1 -1
  25. package/dist/commands/ci/commands/ci-supabase-local.d.ts +4 -0
  26. package/dist/commands/ci/machine/actors/build/build-and-playwright.d.ts +1 -1
  27. package/dist/commands/ci/machine/actors/db/collect-schema-stats.d.ts +15 -2
  28. package/dist/commands/ci/machine/actors/db/production-preview.d.ts +32 -4
  29. package/dist/commands/ci/machine/actors/db/schema-canonical-diff.d.ts +30 -1
  30. package/dist/commands/ci/machine/actors/db/sync-schema.d.ts +1 -0
  31. package/dist/commands/ci/machine/actors/finalize/index.d.ts +0 -1
  32. package/dist/commands/ci/machine/actors/index.d.ts +1 -1
  33. package/dist/commands/ci/machine/actors/setup/local.d.ts +2 -0
  34. package/dist/commands/ci/machine/actors/setup/pr-common.d.ts +3 -0
  35. package/dist/commands/ci/machine/actors/setup/pr-local.d.ts +2 -0
  36. package/dist/commands/ci/machine/commands/machine-runner.d.ts +6 -0
  37. package/dist/commands/ci/machine/commands/step-telemetry.d.ts +16 -0
  38. package/dist/commands/ci/machine/contract.d.ts +40 -0
  39. package/dist/commands/ci/machine/formatters/github-comment-types.d.ts +7 -2
  40. package/dist/commands/ci/machine/formatters/github-comment.d.ts +2 -1
  41. package/dist/commands/ci/machine/formatters/sections/final-comment.d.ts +2 -1
  42. package/dist/commands/ci/machine/formatters/sections/index.d.ts +1 -1
  43. package/dist/commands/ci/machine/formatters/sections/production-schema-status.d.ts +30 -0
  44. package/dist/commands/ci/machine/formatters/summary.d.ts +4 -4
  45. package/dist/commands/ci/machine/guards.d.ts +4 -0
  46. package/dist/commands/ci/machine/helpers.d.ts +33 -0
  47. package/dist/commands/ci/machine/machine-state-helpers.d.ts +1 -1
  48. package/dist/commands/ci/machine/machine.d.ts +71 -11
  49. package/dist/commands/ci/machine/types.d.ts +9 -0
  50. package/dist/commands/ci/utils/ci-diagnostics.d.ts +67 -0
  51. package/dist/commands/ci/utils/ci-summary.d.ts +118 -0
  52. package/dist/commands/ci/utils/db-url-utils.d.ts +4 -77
  53. package/dist/commands/ci/utils/github-api.d.ts +14 -0
  54. package/dist/commands/db/apply/contract.d.ts +73 -0
  55. package/dist/commands/db/apply/helpers/alter-statement-parsers.d.ts +95 -0
  56. package/dist/commands/db/apply/helpers/data-compatibility-checker.d.ts +0 -61
  57. package/dist/commands/db/apply/helpers/function-plan-false-positive-filter.d.ts +36 -0
  58. package/dist/commands/db/apply/helpers/hazard-handler.d.ts +4 -4
  59. package/dist/commands/db/apply/helpers/index.d.ts +14 -5
  60. package/dist/commands/db/apply/helpers/partition-acl-cleaner.d.ts +3 -1
  61. package/dist/commands/db/apply/helpers/pg-schema-diff-helpers.d.ts +69 -6
  62. package/dist/commands/db/apply/helpers/plan-ast.d.ts +56 -0
  63. package/dist/commands/db/apply/helpers/plan-check-filter.d.ts +26 -0
  64. package/dist/commands/db/apply/helpers/plan-drop-protection.d.ts +43 -0
  65. package/dist/commands/db/apply/helpers/plan-ordering.d.ts +6 -0
  66. package/dist/commands/db/apply/helpers/plan-statement-parser.d.ts +39 -0
  67. package/dist/commands/db/apply/helpers/plan-validator.d.ts +8 -40
  68. package/dist/commands/db/apply/helpers/retry-logic.d.ts +1 -10
  69. package/dist/commands/db/apply/helpers/temp-db-bootstrap.d.ts +18 -0
  70. package/dist/commands/db/apply/helpers/temp-db-dsn.d.ts +14 -0
  71. package/dist/commands/db/apply/machine.d.ts +56 -32
  72. package/dist/commands/db/commands/db-apply-error.d.ts +5 -0
  73. package/dist/commands/db/commands/db-apply.d.ts +2 -0
  74. package/dist/commands/db/commands/db-sync/directory-placement-check.d.ts +4 -0
  75. package/dist/commands/db/commands/db-sync/error-classifier.d.ts +1 -1
  76. package/dist/commands/db/commands/db-sync/plan-boundary-reconciliation.d.ts +3 -0
  77. package/dist/commands/db/commands/db-sync/precheck-helpers.d.ts +18 -0
  78. package/dist/commands/db/commands/db-sync/production-precheck.d.ts +15 -0
  79. package/dist/commands/db/commands/db-sync/risk-scan-collectors.d.ts +11 -0
  80. package/dist/commands/db/commands/db-sync.d.ts +11 -5
  81. package/dist/commands/db/sync/contract.d.ts +80 -0
  82. package/dist/commands/db/sync/machine.d.ts +60 -1
  83. package/dist/commands/db/types.d.ts +5 -0
  84. package/dist/commands/db/utils/boundary-policy/rule-compiler.d.ts +2 -1
  85. package/dist/commands/db/utils/boundary-policy/types.d.ts +21 -0
  86. package/dist/commands/db/utils/boundary-policy-runtime.d.ts +12 -3
  87. package/dist/commands/db/utils/boundary-policy.d.ts +1 -1
  88. package/dist/commands/db/utils/db-target.d.ts +5 -3
  89. package/dist/commands/db/utils/declarative-dependency-collectors.d.ts +6 -0
  90. package/dist/commands/db/utils/declarative-dependency-contract.d.ts +78 -0
  91. package/dist/commands/db/utils/declarative-dependency-sql-utils.d.ts +49 -0
  92. package/dist/commands/db/utils/declarative-dependency-warning-governance.d.ts +24 -0
  93. package/dist/commands/db/utils/preflight-check.d.ts +1 -1
  94. package/dist/commands/db/utils/preflight-checks/declarative-dependency-checks.d.ts +4 -0
  95. package/dist/commands/db/utils/preflight-checks/idempotent-risk-checks.d.ts +4 -0
  96. package/dist/commands/db/utils/preflight-checks/schema-boundary-checks.d.ts +4 -0
  97. package/dist/commands/db/utils/preflight-checks/schema-risk-policy.d.ts +4 -0
  98. package/dist/commands/db/utils/preflight-checks/supabase-checks.d.ts +12 -0
  99. package/dist/commands/db/utils/psql.d.ts +23 -0
  100. package/dist/commands/db/utils/sql-table-extractor.d.ts +42 -1
  101. package/dist/commands/env/commands/setup/types.d.ts +1 -0
  102. package/dist/commands/env/constants/local-supabase.d.ts +4 -1
  103. package/dist/commands/observability.d.ts +72 -0
  104. package/dist/commands/observability.helpers.d.ts +25 -0
  105. package/dist/commands/template-check/commands/template-check.d.ts +1 -0
  106. package/dist/commands/template-check/contract.d.ts +4 -3
  107. package/dist/commands/template-check/machine.d.ts +1 -1
  108. package/dist/commands/workflow/commands/deploy-production.d.ts +0 -1
  109. package/dist/constants/versions.d.ts +1 -1
  110. package/dist/{db-XULCILOU.js → db-BPQ2TEQM.js} +14618 -11273
  111. package/dist/{dev-5YXNPTCJ.js → dev-MLRKIP7F.js} +5 -5
  112. package/dist/{doctor-MZLOA53G.js → doctor-ROSWSMLH.js} +2 -2
  113. package/dist/{env-SS66PZ4B.js → env-WNHJVLOT.js} +37 -20
  114. package/dist/{env-HMMRSYCI.js → env-XPPACZM4.js} +2 -2
  115. package/dist/{env-files-2UIUYLLR.js → env-files-HRNUGZ5O.js} +1 -1
  116. package/dist/{error-handler-HEXBRNVV.js → error-handler-YRQWRDEF.js} +17 -0
  117. package/dist/{hotfix-YA3DGLOM.js → hotfix-Z5EGVSMH.js} +4 -4
  118. package/dist/index.js +4 -4
  119. package/dist/{init-ZIL6LRFO.js → init-S2ATHLJ6.js} +1 -1
  120. package/dist/{inject-test-attrs-P44BVTQS.js → inject-test-attrs-XN4I2AOR.js} +2 -2
  121. package/dist/internal/machines/index.d.ts +1 -1
  122. package/dist/internal/machines/snapshot-helpers.d.ts +6 -0
  123. package/dist/{manifest-TMFLESHW.js → manifest-EGCAZ4TK.js} +1 -1
  124. package/dist/observability-CJA5UFIC.js +721 -0
  125. package/dist/{risk-detector-4U6ZJ2G5.js → risk-detector-VO5HJR4R.js} +1 -1
  126. package/dist/{risk-detector-core-TK4OAI3N.js → risk-detector-core-7WZJZ5ZI.js} +61 -3
  127. package/dist/risk-detector-plpgsql-ULV7NLDB.js +638 -0
  128. package/dist/{template-check-3P4HZXVY.js → template-check-BDFMT6ZO.js} +23 -6
  129. package/dist/{upgrade-NUK3ZBCL.js → upgrade-BDUWBRT5.js} +1 -1
  130. package/dist/utils/db-url-utils.d.ts +81 -0
  131. package/dist/validators/risk-detector-plpgsql.d.ts +3 -1
  132. package/dist/{vuln-check-2W7N5TA2.js → vuln-check-66RXX3TO.js} +1 -1
  133. package/dist/{vuln-checker-IQJ56RUV.js → vuln-checker-FFOGOJPT.js} +1 -1
  134. package/dist/{watch-PNTKZYFB.js → watch-ITYW57SL.js} +1 -1
  135. package/dist/{workflow-H75N4BXX.js → workflow-UZIZ2JUS.js} +2 -3
  136. package/package.json +3 -3
  137. package/dist/chunk-IBVVGH6X.js +0 -33
  138. package/dist/chunk-KWX3JHCY.js +0 -85
  139. package/dist/commands/ci/machine/actors/finalize/summary.d.ts +0 -32
@@ -53,6 +53,36 @@ export declare const CiSummarySchema: z.ZodObject<{
53
53
  "pj-repo": "pj-repo";
54
54
  }>;
55
55
  detected: z.ZodRecord<z.ZodString, z.ZodUnknown>;
56
+ diagnostics: z.ZodDefault<z.ZodObject<{
57
+ setup: z.ZodOptional<z.ZodObject<{
58
+ runtimeOwner: z.ZodOptional<z.ZodEnum<{
59
+ external: "external";
60
+ sdk: "sdk";
61
+ }>>;
62
+ playwrightOwner: z.ZodOptional<z.ZodEnum<{
63
+ external: "external";
64
+ sdk: "sdk";
65
+ }>>;
66
+ supabase: z.ZodOptional<z.ZodObject<{
67
+ strategy: z.ZodEnum<{
68
+ "assume-ready": "assume-ready";
69
+ "status-polling": "status-polling";
70
+ "fallback-default": "fallback-default";
71
+ }>;
72
+ finalSource: z.ZodEnum<{
73
+ "assumed-local-config": "assumed-local-config";
74
+ "status-json": "status-json";
75
+ "default-fallback": "default-fallback";
76
+ }>;
77
+ attempts: z.ZodNumber;
78
+ maxAttempts: z.ZodNumber;
79
+ sleepSeconds: z.ZodNumber;
80
+ waitedMs: z.ZodNumber;
81
+ retriesExhausted: z.ZodOptional<z.ZodBoolean>;
82
+ lastError: z.ZodOptional<z.ZodString>;
83
+ }, z.core.$strict>>;
84
+ }, z.core.$strict>>;
85
+ }, z.core.$strict>>;
56
86
  steps: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
57
87
  status: z.ZodEnum<{
58
88
  killed: "killed";
@@ -63,6 +93,23 @@ export declare const CiSummarySchema: z.ZodObject<{
63
93
  }>;
64
94
  exitCode: z.ZodOptional<z.ZodNumber>;
65
95
  logPath: z.ZodOptional<z.ZodString>;
96
+ error: z.ZodOptional<z.ZodString>;
97
+ reason: z.ZodOptional<z.ZodString>;
98
+ title: z.ZodOptional<z.ZodString>;
99
+ phase: z.ZodOptional<z.ZodEnum<{
100
+ db: "db";
101
+ test: "test";
102
+ build: "build";
103
+ setup: "setup";
104
+ github: "github";
105
+ observability: "observability";
106
+ finalize: "finalize";
107
+ }>>;
108
+ parentStep: z.ZodOptional<z.ZodString>;
109
+ optional: z.ZodOptional<z.ZodBoolean>;
110
+ startedAt: z.ZodOptional<z.ZodString>;
111
+ endedAt: z.ZodOptional<z.ZodString>;
112
+ durationMs: z.ZodOptional<z.ZodNumber>;
66
113
  }, z.core.$strict>>>;
67
114
  layers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
68
115
  status: z.ZodEnum<{
@@ -89,6 +136,77 @@ export declare const CiSummarySchema: z.ZodObject<{
89
136
  step: z.ZodString;
90
137
  details: z.ZodOptional<z.ZodString>;
91
138
  }, z.core.$strict>>>;
139
+ dbOutcome: z.ZodOptional<z.ZodObject<{
140
+ command: z.ZodString;
141
+ exitMode: z.ZodEnum<{
142
+ success: "success";
143
+ success_with_warnings: "success_with_warnings";
144
+ failed: "failed";
145
+ timeout: "timeout";
146
+ cancelled: "cancelled";
147
+ }>;
148
+ startedAt: z.ZodString;
149
+ endedAt: z.ZodString;
150
+ durationMs: z.ZodNumber;
151
+ phases: z.ZodArray<z.ZodObject<{
152
+ id: z.ZodString;
153
+ label: z.ZodString;
154
+ status: z.ZodEnum<{
155
+ failed: "failed";
156
+ timeout: "timeout";
157
+ cancelled: "cancelled";
158
+ pending: "pending";
159
+ running: "running";
160
+ passed: "passed";
161
+ warning: "warning";
162
+ skipped: "skipped";
163
+ }>;
164
+ startedAt: z.ZodOptional<z.ZodString>;
165
+ endedAt: z.ZodOptional<z.ZodString>;
166
+ durationMs: z.ZodOptional<z.ZodNumber>;
167
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
168
+ warningCount: z.ZodOptional<z.ZodNumber>;
169
+ error: z.ZodOptional<z.ZodObject<{
170
+ code: z.ZodString;
171
+ message: z.ZodString;
172
+ statusCode: z.ZodOptional<z.ZodNumber>;
173
+ retryable: z.ZodBoolean;
174
+ retryAfterMs: z.ZodOptional<z.ZodNumber>;
175
+ phase: z.ZodOptional<z.ZodString>;
176
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
177
+ }, z.core.$strict>>;
178
+ warnings: z.ZodOptional<z.ZodArray<z.ZodObject<{
179
+ code: z.ZodString;
180
+ message: z.ZodString;
181
+ phase: z.ZodString;
182
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
183
+ }, z.core.$strict>>>;
184
+ metrics: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
185
+ }, z.core.$strict>>;
186
+ warnings: z.ZodArray<z.ZodObject<{
187
+ code: z.ZodString;
188
+ message: z.ZodString;
189
+ phase: z.ZodString;
190
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
191
+ }, z.core.$strict>>;
192
+ errors: z.ZodArray<z.ZodObject<{
193
+ code: z.ZodString;
194
+ message: z.ZodString;
195
+ statusCode: z.ZodOptional<z.ZodNumber>;
196
+ retryable: z.ZodBoolean;
197
+ retryAfterMs: z.ZodOptional<z.ZodNumber>;
198
+ phase: z.ZodOptional<z.ZodString>;
199
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
200
+ }, z.core.$strict>>;
201
+ summary: z.ZodObject<{
202
+ passed: z.ZodNumber;
203
+ warnings: z.ZodNumber;
204
+ failed: z.ZodNumber;
205
+ skipped: z.ZodNumber;
206
+ timedOut: z.ZodNumber;
207
+ }, z.core.$strict>;
208
+ nextActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
209
+ }, z.core.$strict>>;
92
210
  blockingPolicy: z.ZodOptional<z.ZodObject<{
93
211
  profile: z.ZodOptional<z.ZodEnum<{
94
212
  "runa-strict": "runa-strict";
@@ -1,81 +1,8 @@
1
1
  /**
2
- * AI HINT: Database URL normalization utilities for CI operations
2
+ * AI HINT: Re-export from shared utils for backward compatibility.
3
3
  *
4
- * Purpose: Normalize database URLs for DDL operations and catalog queries
5
- * Shared: These utilities match SDK's behavior for consistent handling
6
- *
7
- * Key transformations:
8
- * 1. Port conversion: Transaction Pooler (6543) → Session Pooler (5432)
9
- * 2. pgbouncer cleanup: Remove pgbouncer parameter for Session Pooler
10
- * 3. IPv4 resolution: GitHub Actions runners can't reach IPv6-only hosts
11
- */
12
- /**
13
- * Resolve hostname to IPv4 address using getent (Linux).
14
- *
15
- * This is critical for GitHub Actions where IPv6 may not be routable to Supabase.
16
- * Matches SDK's resolveHostToIPv4 behavior.
17
- *
18
- * @param hostname - The hostname to resolve
19
- * @returns IPv4 address if resolvable, null otherwise
20
- */
21
- export declare function resolveHostToIPv4(hostname: string): string | null;
22
- /**
23
- * Normalize database URL for DDL reads and psql operations.
24
- *
25
- * Handles three critical issues:
26
- * 1. Port conversion: Transaction Pooler (6543) → Session Pooler (5432)
27
- * - DDL and catalog reads are more reliable via Session Pooler
28
- * 2. pgbouncer cleanup: Remove pgbouncer parameter for Session Pooler
29
- * - Session Pooler (5432) does NOT accept pgbouncer parameter
30
- * 3. IPv4 resolution: GitHub Actions runners can't reach IPv6-only hosts
31
- * - This matches SDK's normalizeDatabaseUrlForDDL behavior
32
- *
33
- * @param databaseUrl - The database URL to normalize
34
- * @returns Normalized database URL suitable for DDL operations
35
- */
36
- export declare function normalizeDatabaseUrlForDdl(databaseUrl: string): string;
37
- /**
38
- * Get safe database target string for logging (without password).
39
- *
40
- * @param databaseUrl - The database URL
41
- * @returns Safe string for logging
42
- */
43
- export declare function getSafeDatabaseTarget(databaseUrl: string): string;
44
- /**
45
- * Escape SQL literal value for safe inclusion in SQL strings.
46
- *
47
- * @param value - The string value to escape
48
- * @returns Escaped string safe for SQL literals
49
- */
50
- export declare function escapeSqlLiteral(value: string): string;
51
- /**
52
- * Parse PostgreSQL boolean result to JavaScript boolean.
53
- *
54
- * PostgreSQL returns 't', 'true', or '1' for true values.
55
- * This utility normalizes these variants.
56
- *
57
- * @param value - The PostgreSQL boolean string
58
- * @returns JavaScript boolean
59
- */
60
- export declare function parseBoolish(value: string): boolean;
61
- /**
62
- * Check if a hostname resolves ONLY to IPv6 (no IPv4).
63
- *
64
- * This indicates that Supabase IPv4 Add-on is not enabled.
65
- * GitHub Actions cannot reach IPv6-only hosts.
66
- *
67
- * @param hostname - The hostname to check
68
- * @returns true if hostname resolves ONLY to IPv6, false otherwise
69
- */
70
- export declare function isIPv6Only(hostname: string): boolean;
71
- /**
72
- * Enhance error message with actionable advice.
73
- *
74
- * Detects common error patterns and adds clear guidance for users.
75
- *
76
- * @param error - Original error message
77
- * @param databaseUrl - The database URL that failed (optional)
78
- * @returns Enhanced error message with guidance
4
+ * The actual implementation lives in packages/cli/src/utils/db-url-utils.ts
5
+ * since these utilities are shared across both CI and DB modules.
79
6
  */
80
- export declare function enhanceConnectionError(error: string, databaseUrl?: string): string;
7
+ export { enhanceConnectionError, escapeSqlLiteral, getSafeDatabaseTarget, isIPv6Only, normalizeDatabaseUrlForDdl, parseBoolish, resolveHostToIPv4, } from '../../../utils/db-url-utils.js';
81
8
  //# sourceMappingURL=db-url-utils.d.ts.map
@@ -15,12 +15,26 @@ export declare function listPullRequestFiles(params: {
15
15
  repo: RepoContext;
16
16
  pullNumber: number;
17
17
  }): Promise<string[]>;
18
+ export declare function mergeCommentSectionBody(params: {
19
+ existingBody: string;
20
+ startMarker: string;
21
+ endMarker: string;
22
+ sectionBody: string;
23
+ }): string;
18
24
  export declare function upsertIssueComment(params: {
19
25
  repo: RepoContext;
20
26
  issueNumber: number;
21
27
  marker: string;
22
28
  body: string;
23
29
  }): Promise<void>;
30
+ export declare function mergeIssueCommentSection(params: {
31
+ repo: RepoContext;
32
+ issueNumber: number;
33
+ marker: string;
34
+ startMarker: string;
35
+ endMarker: string;
36
+ sectionBody: string;
37
+ }): Promise<void>;
24
38
  export declare function addIssueLabels(params: {
25
39
  repo: RepoContext;
26
40
  issueNumber: number;
@@ -23,7 +23,9 @@ export declare const DbApplyInputSchema: z.ZodObject<{
23
23
  allowDataLoss: z.ZodDefault<z.ZodBoolean>;
24
24
  confirmAuthzUpdate: z.ZodDefault<z.ZodBoolean>;
25
25
  check: z.ZodDefault<z.ZodBoolean>;
26
+ strict: z.ZodDefault<z.ZodBoolean>;
26
27
  skipDataCheck: z.ZodDefault<z.ZodBoolean>;
28
+ compareOnly: z.ZodDefault<z.ZodBoolean>;
27
29
  maxLockWaitMs: z.ZodDefault<z.ZodNumber>;
28
30
  freshDbCheckSql: z.ZodOptional<z.ZodString>;
29
31
  }, z.core.$strict>;
@@ -67,6 +69,77 @@ export declare const DbApplyOutputSchema: z.ZodObject<{
67
69
  seedMs: z.ZodOptional<z.ZodNumber>;
68
70
  retryAttempts: z.ZodOptional<z.ZodNumber>;
69
71
  }, z.core.$strip>>;
72
+ outcome: z.ZodObject<{
73
+ command: z.ZodString;
74
+ exitMode: z.ZodEnum<{
75
+ success: "success";
76
+ success_with_warnings: "success_with_warnings";
77
+ failed: "failed";
78
+ timeout: "timeout";
79
+ cancelled: "cancelled";
80
+ }>;
81
+ startedAt: z.ZodString;
82
+ endedAt: z.ZodString;
83
+ durationMs: z.ZodNumber;
84
+ phases: z.ZodArray<z.ZodObject<{
85
+ id: z.ZodString;
86
+ label: z.ZodString;
87
+ status: z.ZodEnum<{
88
+ failed: "failed";
89
+ timeout: "timeout";
90
+ cancelled: "cancelled";
91
+ pending: "pending";
92
+ running: "running";
93
+ passed: "passed";
94
+ warning: "warning";
95
+ skipped: "skipped";
96
+ }>;
97
+ startedAt: z.ZodOptional<z.ZodString>;
98
+ endedAt: z.ZodOptional<z.ZodString>;
99
+ durationMs: z.ZodOptional<z.ZodNumber>;
100
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
101
+ warningCount: z.ZodOptional<z.ZodNumber>;
102
+ error: z.ZodOptional<z.ZodObject<{
103
+ code: z.ZodString;
104
+ message: z.ZodString;
105
+ statusCode: z.ZodOptional<z.ZodNumber>;
106
+ retryable: z.ZodBoolean;
107
+ retryAfterMs: z.ZodOptional<z.ZodNumber>;
108
+ phase: z.ZodOptional<z.ZodString>;
109
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
110
+ }, z.core.$strict>>;
111
+ warnings: z.ZodOptional<z.ZodArray<z.ZodObject<{
112
+ code: z.ZodString;
113
+ message: z.ZodString;
114
+ phase: z.ZodString;
115
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
116
+ }, z.core.$strict>>>;
117
+ metrics: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
118
+ }, z.core.$strict>>;
119
+ warnings: z.ZodArray<z.ZodObject<{
120
+ code: z.ZodString;
121
+ message: z.ZodString;
122
+ phase: z.ZodString;
123
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
124
+ }, z.core.$strict>>;
125
+ errors: z.ZodArray<z.ZodObject<{
126
+ code: z.ZodString;
127
+ message: z.ZodString;
128
+ statusCode: z.ZodOptional<z.ZodNumber>;
129
+ retryable: z.ZodBoolean;
130
+ retryAfterMs: z.ZodOptional<z.ZodNumber>;
131
+ phase: z.ZodOptional<z.ZodString>;
132
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
133
+ }, z.core.$strict>>;
134
+ summary: z.ZodObject<{
135
+ passed: z.ZodNumber;
136
+ warnings: z.ZodNumber;
137
+ failed: z.ZodNumber;
138
+ skipped: z.ZodNumber;
139
+ timedOut: z.ZodNumber;
140
+ }, z.core.$strict>;
141
+ nextActions: z.ZodOptional<z.ZodArray<z.ZodString>>;
142
+ }, z.core.$strict>;
70
143
  }, z.core.$strict>;
71
144
  export type DbApplyOutput = z.infer<typeof DbApplyOutputSchema>;
72
145
  //# sourceMappingURL=contract.d.ts.map
@@ -0,0 +1,95 @@
1
+ /**
2
+ * AI HINT: ALTER Statement Parsers & Validation Query Builders
3
+ *
4
+ * Purpose: Parse ALTER TABLE / CREATE UNIQUE INDEX statements to detect
5
+ * data compatibility risks, and build validation queries for each.
6
+ *
7
+ * Detected patterns:
8
+ * 1. SET NOT NULL - fails if NULL values exist
9
+ * 2. ALTER TYPE - fails if values can't be cast
10
+ * 3. ADD CHECK - fails if data violates constraint
11
+ * 4. ADD UNIQUE / CREATE UNIQUE INDEX - fails if duplicates exist
12
+ *
13
+ * Extracted from data-compatibility-checker.ts for single responsibility.
14
+ */
15
+ /**
16
+ * Parse SET NOT NULL from ALTER TABLE statement.
17
+ * Pattern: ALTER TABLE [IF EXISTS] ["schema"]."table" ALTER COLUMN ["col"] SET NOT NULL
18
+ */
19
+ export declare function parseSetNotNull(sql: string): {
20
+ schema: string;
21
+ table: string;
22
+ column: string;
23
+ } | null;
24
+ /**
25
+ * Parse ALTER TYPE from ALTER TABLE statement.
26
+ * Pattern: ALTER TABLE ["schema"]."table" ALTER COLUMN ["col"] [SET DATA] TYPE target_type [USING ...]
27
+ *
28
+ * Handles:
29
+ * - Precision types: character varying(100), numeric(10,2)
30
+ * - Schema-qualified types: extensions.vector, public.citext
31
+ * - Array types: integer[], text[]
32
+ */
33
+ export declare function parseAlterType(sql: string): {
34
+ schema: string;
35
+ table: string;
36
+ column: string;
37
+ targetType: string;
38
+ } | null;
39
+ /**
40
+ * Parse ADD CHECK from ALTER TABLE statement.
41
+ * Pattern: ALTER TABLE ["schema"]."table" ADD [CONSTRAINT name] CHECK (expr)
42
+ *
43
+ * Filters out pg-schema-diff internal temporary constraints (pgschemadiff_tmpnn_*)
44
+ * which are used for online NOT NULL migrations and would cause duplicate reports
45
+ * alongside parseSetNotNull.
46
+ */
47
+ export declare function parseAddCheck(sql: string): {
48
+ schema: string;
49
+ table: string;
50
+ constraintName: string;
51
+ checkExpr: string;
52
+ } | null;
53
+ /**
54
+ * Parse ADD UNIQUE from ALTER TABLE statement.
55
+ * Pattern: ALTER TABLE ["schema"]."table" ADD [CONSTRAINT name] UNIQUE [NULLS [NOT] DISTINCT] (col1, col2)
56
+ */
57
+ export declare function parseAddUnique(sql: string): {
58
+ schema: string;
59
+ table: string;
60
+ columns: string[];
61
+ } | null;
62
+ /**
63
+ * Parse CREATE UNIQUE INDEX statement.
64
+ * Pattern: CREATE UNIQUE INDEX [CONCURRENTLY] [IF NOT EXISTS] name ON ["schema"]."table" (columns) [WHERE ...]
65
+ *
66
+ * Handles:
67
+ * - Functional indexes: lower(email), upper(name)
68
+ * - Partial indexes: WHERE deleted_at IS NULL (excluded from column capture)
69
+ * - NULLS NOT DISTINCT (PostgreSQL 15+)
70
+ */
71
+ export declare function parseCreateUniqueIndex(sql: string): {
72
+ schema: string;
73
+ table: string;
74
+ columns: string[];
75
+ } | null;
76
+ export declare function buildNotNullQuery(schema: string, table: string, column: string): string;
77
+ /**
78
+ * Build a type cast validation query for known types.
79
+ * Returns null for unknown types (skip).
80
+ */
81
+ export declare function buildTypeCastQuery(schema: string, table: string, column: string, targetType: string): string | null;
82
+ /**
83
+ * Build query to validate CHECK constraint against existing data.
84
+ *
85
+ * SECURITY NOTE: checkExpr comes from pg_catalog (database metadata), not user input.
86
+ * We still apply basic validation as defense-in-depth against unexpected content.
87
+ */
88
+ export declare function buildCheckConstraintQuery(schema: string, table: string, checkExpr: string): string;
89
+ /**
90
+ * Quote a column expression for SQL.
91
+ * Simple column names are quoted; functional expressions (containing parens) are passed through.
92
+ */
93
+ export declare function quoteColumnExpr(expr: string): string;
94
+ export declare function buildUniqueQuery(schema: string, table: string, columns: string[]): string;
95
+ //# sourceMappingURL=alter-statement-parsers.d.ts.map
@@ -33,67 +33,6 @@ export interface DataCompatibilityResult {
33
33
  /** Number of validation queries that failed (query errors + timeouts) */
34
34
  queryErrorCount: number;
35
35
  }
36
- /**
37
- * Parse SET NOT NULL from ALTER TABLE statement.
38
- * Pattern: ALTER TABLE [IF EXISTS] ["schema"]."table" ALTER COLUMN ["col"] SET NOT NULL
39
- */
40
- export declare function parseSetNotNull(sql: string): {
41
- schema: string;
42
- table: string;
43
- column: string;
44
- } | null;
45
- /**
46
- * Parse ALTER TYPE from ALTER TABLE statement.
47
- * Pattern: ALTER TABLE ["schema"]."table" ALTER COLUMN ["col"] [SET DATA] TYPE target_type [USING ...]
48
- *
49
- * Handles:
50
- * - Precision types: character varying(100), numeric(10,2)
51
- * - Schema-qualified types: extensions.vector, public.citext
52
- * - Array types: integer[], text[]
53
- */
54
- export declare function parseAlterType(sql: string): {
55
- schema: string;
56
- table: string;
57
- column: string;
58
- targetType: string;
59
- } | null;
60
- /**
61
- * Parse ADD CHECK from ALTER TABLE statement.
62
- * Pattern: ALTER TABLE ["schema"]."table" ADD [CONSTRAINT name] CHECK (expr)
63
- *
64
- * Filters out pg-schema-diff internal temporary constraints (pgschemadiff_tmpnn_*)
65
- * which are used for online NOT NULL migrations and would cause duplicate reports
66
- * alongside parseSetNotNull.
67
- */
68
- export declare function parseAddCheck(sql: string): {
69
- schema: string;
70
- table: string;
71
- constraintName: string;
72
- checkExpr: string;
73
- } | null;
74
- /**
75
- * Parse ADD UNIQUE from ALTER TABLE statement.
76
- * Pattern: ALTER TABLE ["schema"]."table" ADD [CONSTRAINT name] UNIQUE [NULLS [NOT] DISTINCT] (col1, col2)
77
- */
78
- export declare function parseAddUnique(sql: string): {
79
- schema: string;
80
- table: string;
81
- columns: string[];
82
- } | null;
83
- /**
84
- * Parse CREATE UNIQUE INDEX statement.
85
- * Pattern: CREATE UNIQUE INDEX [CONCURRENTLY] [IF NOT EXISTS] name ON ["schema"]."table" (columns) [WHERE ...]
86
- *
87
- * Handles:
88
- * - Functional indexes: lower(email), upper(name)
89
- * - Partial indexes: WHERE deleted_at IS NULL (excluded from column capture)
90
- * - NULLS NOT DISTINCT (PostgreSQL 15+)
91
- */
92
- export declare function parseCreateUniqueIndex(sql: string): {
93
- schema: string;
94
- table: string;
95
- columns: string[];
96
- } | null;
97
36
  /**
98
37
  * Check data compatibility for all statements in a plan.
99
38
  *
@@ -0,0 +1,36 @@
1
+ import type { PlanStatement } from './plan-validator.js';
2
+ import { type PlanAnalysisSession } from './plan-ast.js';
3
+ interface DbFunctionMetadata {
4
+ schema: string;
5
+ name: string;
6
+ definition: string;
7
+ proconfig: string[];
8
+ }
9
+ interface NormalizedFunctionDefinition {
10
+ normalizedDefinition: string;
11
+ normalizedConfig: string;
12
+ }
13
+ export interface FunctionSchemaCheckSuppressionResult {
14
+ planOutput: string;
15
+ suppressedStatements: PlanStatement[];
16
+ warnings: string[];
17
+ }
18
+ declare function normalizeDbProconfig(entries: string[]): string;
19
+ declare function normalizePlpgsqlFunctionDefinition(sql: string, dbProconfig?: string[], session?: PlanAnalysisSession): Promise<NormalizedFunctionDefinition | null>;
20
+ declare function matchesSchemaCheckExclusion(objectKey: string, patterns: readonly string[]): boolean;
21
+ declare function serializePlanStatements(statements: PlanStatement[]): string;
22
+ declare function isSemanticallyEquivalentPlpgsqlFunction(sql: string, candidates: readonly DbFunctionMetadata[], session: PlanAnalysisSession): Promise<boolean>;
23
+ export declare function suppressFunctionSchemaCheckFalsePositives(params: {
24
+ dbUrl: string;
25
+ planOutput: string;
26
+ excludeFromSchemaCheck?: readonly string[];
27
+ }): Promise<FunctionSchemaCheckSuppressionResult>;
28
+ export declare const _test: {
29
+ isSemanticallyEquivalentPlpgsqlFunction: typeof isSemanticallyEquivalentPlpgsqlFunction;
30
+ matchesSchemaCheckExclusion: typeof matchesSchemaCheckExclusion;
31
+ normalizeDbProconfig: typeof normalizeDbProconfig;
32
+ normalizePlpgsqlFunctionDefinition: typeof normalizePlpgsqlFunctionDefinition;
33
+ serializePlanStatements: typeof serializePlanStatements;
34
+ };
35
+ export {};
36
+ //# sourceMappingURL=function-plan-false-positive-filter.d.ts.map
@@ -48,12 +48,12 @@ export declare function handleHazardsWithContext(planOutput: string, input: DbAp
48
48
  hasDeletesData: boolean;
49
49
  hasAuthzUpdate: boolean;
50
50
  };
51
- /**
52
- * Display check mode results.
53
- */
54
51
  export declare function displayCheckModeResults(planOutput: string, filterInfo?: {
55
52
  filteredPlanSql: string;
56
- removedStatements: {
53
+ removedDropStatements: {
54
+ sql: string;
55
+ }[];
56
+ removedAuthzStatements: {
57
57
  sql: string;
58
58
  }[];
59
59
  }): void;
@@ -4,16 +4,25 @@
4
4
  * Purpose: Export all helper functions for db apply actors
5
5
  */
6
6
  export { acquireAdvisoryLock, MIGRATION_LOCK_ID, releaseAdvisoryLock, } from './advisory-lock.js';
7
- export type { FilterResult, PlanHazard, PlanStatement, ValidatedPlan } from './plan-validator.js';
8
- export { ALLOWED_DDL_PREFIXES, BLOCKED_SQL_PATTERNS, filterIdempotentProtectedStatements, isDropStatementForProtectedObject, parsePlanOutput, validatePlanForExecution, validateStatementTypes, } from './plan-validator.js';
9
- export type { IdempotentProtectedObjects, ParsedHazard, PartitionPrivilegeDetection, PgSchemaDiffPlanOptions, } from './pg-schema-diff-helpers.js';
7
+ export type { PlanHazard, PlanStatement, ValidatedPlan } from './plan-validator.js';
8
+ export { ALLOWED_DDL_PREFIXES, BLOCKED_SQL_PATTERNS, parsePlanOutput, validatePlanForExecution, validateStatementTypes, } from './plan-validator.js';
9
+ export type { FilterResult } from './plan-drop-protection.js';
10
+ export { filterIdempotentProtectedStatements, isDropStatementForProtectedObject, } from './plan-drop-protection.js';
11
+ export type { CheckModeFilterResult } from './plan-check-filter.js';
12
+ export { filterCheckModePlanStatements, isIdempotentManagedAuthzStatement, resetManagedAuthzCache, stripLeadingSessionStatements, } from './plan-check-filter.js';
13
+ export type { IdempotentProtectedObjects, ParsedHazard } from './idempotent-object-registry.js';
14
+ export { filterFalsePositiveHazards, getIdempotentProtectedObjects, getIdempotentProtectedTables, getIdempotentRoles, isIdempotentRoleHazard, resetIdempotentRolesCache, } from './idempotent-object-registry.js';
15
+ export { buildAllowedHazards, displayCheckModeResults, displayHazardsWithContext, handleHazardsWithContext, handleProductionAuthzProtection, handleProductionDataProtection, parseHazardsWithContext, } from './hazard-handler.js';
16
+ export type { PartitionPrivilegeDetection, PgSchemaDiffPlanOptions, } from './pg-schema-diff-helpers.js';
17
+ export { detectDropTableStatements, detectPartitionPrivilegeError, executePgSchemaDiffPlan, formatPartitionPrivilegeHint, freeConnectionSlotsForPgSchemaDiff, startConnectionCleanupDaemon, stopConnectionCleanupDaemon, PG_SCHEMA_DIFF_APPLY_TIMEOUT_MS, verifyDatabaseConnection, verifyPgSchemaDiffBinary, } from './pg-schema-diff-helpers.js';
10
18
  export type { ShadowDbConfig, ShadowDbResult } from './shadow-db-manager.js';
11
- export { buildAllowedHazards, detectDropTableStatements, detectPartitionPrivilegeError, displayCheckModeResults, displayHazardsWithContext, executePgSchemaDiffPlan, filterFalsePositiveHazards, formatPartitionPrivilegeHint, getIdempotentProtectedObjects, getIdempotentProtectedTables, getIdempotentRoles, handleHazardsWithContext, handleProductionAuthzProtection, handleProductionDataProtection, isIdempotentRoleHazard, parseHazardsWithContext, PG_SCHEMA_DIFF_APPLY_TIMEOUT_MS, resetIdempotentRolesCache, verifyDatabaseConnection, verifyPgSchemaDiffBinary, } from './pg-schema-diff-helpers.js';
12
19
  export type { PlanSqlRetryConfig, RetryConfig, RetryResult } from './retry-logic.js';
13
20
  export { BASE_DELAY_MS, calculateBackoffDelay, DEFAULT_MAX_DELAY_MS, executePlanSqlWithRetry, isLockTimeoutError, MAX_RETRIES, sleep, } from './retry-logic.js';
14
21
  export { cleanupOrphanShadowDatabases, createShadowDbWithExtensions, needsShadowDb, } from './shadow-db-manager.js';
22
+ export { bootstrapTempDbFromSource, buildTempDbBootstrapStatements, } from './temp-db-bootstrap.js';
23
+ export { buildCheckConstraintQuery, buildNotNullQuery, buildTypeCastQuery, buildUniqueQuery, parseAddCheck, parseAddUnique, parseAlterType, parseCreateUniqueIndex, parseSetNotNull, } from './alter-statement-parsers.js';
15
24
  export type { DataCompatibilityResult, DataViolation, DataViolationType, } from './data-compatibility-checker.js';
16
- export { checkDataCompatibility, displayDataCompatibilityResults, parseAddCheck, parseAddUnique, parseAlterType, parseCreateUniqueIndex, parseSetNotNull, } from './data-compatibility-checker.js';
25
+ export { checkDataCompatibility, displayDataCompatibilityResults, } from './data-compatibility-checker.js';
17
26
  export type { CleanPartitionAclsResult, PartitionAcl } from './partition-acl-cleaner.js';
18
27
  export { cleanPartitionAclsForPgSchemaDiff } from './partition-acl-cleaner.js';
19
28
  export type { DetectedPartitionStub, PrefilterResult } from './partition-prefilter.js';
@@ -34,7 +34,9 @@ export declare function parseAclForNonOwnerRoles(acl: string, owner: string): Se
34
34
  /**
35
35
  * Execute REVOKE ALL statements for non-owner roles on partition children.
36
36
  *
37
- * Each REVOKE is executed individually so a single failure doesn't block others.
37
+ * All REVOKE statements are batched into a single psql process to minimize
38
+ * connection count (N*M → 1). Uses ON_ERROR_STOP=off so individual failures
39
+ * don't block others.
38
40
  */
39
41
  export declare function revokePartitionAcls(dbUrl: string, partitions: PartitionAcl[]): CleanPartitionAclsResult;
40
42
  /**