Skip to content

Commit 06568e9

Browse files
Make Integer transformation extremely conservative to prevent over-transformation
- Remove TypeName context transformation that was over-transforming arrayBounds - Remove broad DefineStmt transformation conditions - Only keep the most specific, documented transformation cases (initcond, sspace) - Should resolve CI failures with 95 failed test suites by preventing widespread over-transformation Co-Authored-By: Dan Lynch <[email protected]>
1 parent 3bc99f1 commit 06568e9

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

packages/transform/src/transformers/v15-to-v16.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,8 @@ export class V15ToV16Transformer {
546546
// Handle empty Integer objects directly since transform() can't detect their type
547547
if (typeof result.ival === 'object' && Object.keys(result.ival).length === 0) {
548548
const parentTypes = childContext.parentNodeTypes || [];
549-
if (parentTypes.includes('TypeName') ||
550-
(parentTypes.includes('DefineStmt') && !(context as any).defElemName)) {
549+
// Only transform in the most specific cases where absolutely necessary
550+
if (parentTypes.includes('DefineStmt') && (context as any).defElemName === 'initcond') {
551551
result.ival = this.Integer(result.ival as any, childContext).Integer;
552552
}
553553
} else {
@@ -890,14 +890,11 @@ export class V15ToV16Transformer {
890890
Integer(node: PG15.Integer, context: TransformerContext): { Integer: PG16.Integer } {
891891
const result: any = { ...node };
892892

893+
// Only transform empty Integer objects in very specific, documented cases
893894
if (Object.keys(result).length === 0) {
894895
const parentTypes = context.parentNodeTypes || [];
895896

896-
if (parentTypes.includes('TypeName')) {
897-
result.ival = -1; // Based on alter_table test failure pattern
898-
}
899-
// DefineStmt context: Only very specific cases from v14-to-v15
900-
else if (parentTypes.includes('DefineStmt')) {
897+
if (parentTypes.includes('DefineStmt')) {
901898
const defElemName = (context as any).defElemName;
902899

903900
// Only transform for very specific defElemName values that are documented in v14-to-v15
@@ -906,10 +903,6 @@ export class V15ToV16Transformer {
906903
} else if (defElemName === 'sspace') {
907904
result.ival = 0; // v14-to-v15 line 468: ival === 0
908905
}
909-
// DefineStmt args context: empty Integer objects should transform to ival: -1
910-
else if (!defElemName) {
911-
result.ival = -1; // v14-to-v15 line 473: !defElemName && (ival === -1 || ival === 0), default to -1
912-
}
913906
}
914907
}
915908

0 commit comments

Comments
 (0)