Skip to content

Commit b9c6464

Browse files
authored
Merge branch 'main' into feature/drc-2116-create-models-in-recce
2 parents c895ac2 + 70ef407 commit b9c6464

23 files changed

Lines changed: 93 additions & 81 deletions

js/src/components/query/querydiff.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,8 @@ export const inlineRenderCell = ({
340340
columnType?: ColumnType;
341341
columnRenderMode?: ColumnRenderMode;
342342
};
343-
const baseKey = `base__${column.key}`;
344-
const currentKey = `current__${column.key}`;
343+
const baseKey = `base__${column.key}`.toLowerCase();
344+
const currentKey = `current__${column.key}`.toLowerCase();
345345

346346
if (!Object.hasOwn(row, baseKey) && !Object.hasOwn(row, currentKey)) {
347347
// should not happen
@@ -352,13 +352,13 @@ export const inlineRenderCell = ({
352352
const hasCurrent = Object.hasOwn(row, currentKey);
353353
const [baseValue, baseGrayOut] = toRenderedValue(
354354
row,
355-
`base__${column.key}`,
355+
`base__${column.key}`.toLowerCase(),
356356
columnType,
357357
columnRenderMode,
358358
);
359359
const [currentValue, currentGrayOut] = toRenderedValue(
360360
row,
361-
`current__${column.key}`,
361+
`current__${column.key}`.toLowerCase(),
362362
columnType,
363363
columnRenderMode,
364364
);
@@ -468,21 +468,21 @@ export function toDataDiffGrid(
468468
base.columns.forEach((col) => {
469469
if (primaryKeys.includes(col.key)) {
470470
// add the primary key value directly (not prefixed with base__ or current__)
471-
row[col.key] = baseRow[col.key];
471+
row[String(col.key).toLowerCase()] = baseRow[col.key];
472472
return;
473473
}
474-
row[`base__${col.key}`] = baseRow[col.key];
474+
row[`base__${col.key}`.toLowerCase()] = baseRow[col.key];
475475
});
476476
}
477477

478478
if (currentRow) {
479479
current.columns.forEach((col) => {
480480
if (primaryKeys.includes(col.key)) {
481481
// add the primary key value directly (not prefixed with base__ or current__)
482-
row[col.key] = currentRow[col.key];
482+
row[String(col.key).toLowerCase()] = currentRow[col.key];
483483
return;
484484
}
485-
row[`current__${col.key}`] = currentRow[col.key];
485+
row[`current__${col.key}`.toLowerCase()] = currentRow[col.key];
486486
});
487487
}
488488

js/src/components/valuediff/valuediff.tsx

Lines changed: 46 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { mergeKeysWithStatus } from "@/lib/mergeKeys";
1414
import {
1515
dataFrameToRowObjects,
1616
getCaseInsensitive,
17+
getValueAtPath,
1718
includesIgnoreCase,
1819
keyToNumber,
1920
} from "@/utils/transforms";
@@ -36,25 +37,27 @@ function _getColumnMap(df: DataFrame) {
3637
> = {};
3738

3839
df.columns.map((col, index) => {
39-
// Normalize special column names to uppercase
40-
const normalizedColName =
41-
col.name.toLowerCase() === "in_a"
42-
? "IN_A"
43-
: col.name.toLowerCase() === "in_b"
44-
? "IN_B"
45-
: col.name;
46-
const normalizedColKey =
47-
col.key.toLowerCase() === "in_a"
48-
? "IN_A"
49-
: col.key.toLowerCase() === "in_b"
50-
? "IN_B"
51-
: col.key;
52-
53-
result[normalizedColName] = {
54-
key: normalizedColKey,
55-
index,
56-
colType: col.type,
57-
};
40+
if (
41+
col.name.toLowerCase() === "in_a" ||
42+
col.name.toLowerCase() === "in_b"
43+
) {
44+
result[col.name.toUpperCase()] = {
45+
key: col.key,
46+
index,
47+
colType: col.type,
48+
};
49+
result[col.name.toLowerCase()] = {
50+
key: col.key,
51+
index,
52+
colType: col.type,
53+
};
54+
} else {
55+
result[col.name] = {
56+
key: col.key,
57+
index,
58+
colType: col.type,
59+
};
60+
}
5861
});
5962

6063
return result;
@@ -215,11 +218,6 @@ export function toValueDiffGrid(
215218
})[] = [];
216219
const columnMap = _getColumnMap(df);
217220

218-
// "in_a" and "in_b" are special columns used in the query template, columns are in uppercase in snowflake
219-
if ("IN_A" in columnMap) {
220-
primaryKeys = primaryKeys.map((key) => key.toUpperCase());
221-
}
222-
223221
// merge row
224222
const baseMap: Record<string, RowObjectType | undefined> = {};
225223
const currentMap: Record<string, RowObjectType | undefined> = {};
@@ -264,21 +262,21 @@ export function toValueDiffGrid(
264262
df.columns.forEach((col) => {
265263
if (includesIgnoreCase(primaryKeys, col.key)) {
266264
// add the primary key value directly (not prefixed with base__ or current__)
267-
row[col.key] = baseRow[col.key];
265+
row[String(col.key).toLowerCase()] = baseRow[col.key];
268266
return;
269267
}
270-
row[`base__${col.key}`] = baseRow[col.key];
268+
row[`base__${col.key}`.toLowerCase()] = baseRow[col.key];
271269
});
272270
}
273271

274272
if (currentRow) {
275273
df.columns.forEach((col) => {
276274
if (includesIgnoreCase(primaryKeys, col.key)) {
277275
// add the primary key value directly (not prefixed with base__ or current__)
278-
row[col.key] = currentRow[col.key];
276+
row[String(col.key).toLowerCase()] = currentRow[col.key];
279277
return;
280278
}
281-
row[`current__${col.key}`] = currentRow[col.key];
279+
row[`current__${col.key}`.toLowerCase()] = currentRow[col.key];
282280
});
283281
}
284282

@@ -431,15 +429,18 @@ export function toValueDiffGrid(
431429

432430
// merges columns: primary keys
433431
primaryKeys.forEach((name) => {
434-
const lowercaseName = name.toLowerCase();
435-
const columnStatus = columnMap[lowercaseName].status ?? "";
436-
const columnType = columnMap[lowercaseName].colType;
432+
const col = getValueAtPath(columnMap, name);
433+
if (!col) {
434+
throw new Error(`Primary column ${name} not found in DataFrame`);
435+
}
436+
const columnStatus = col.status ?? "";
437+
const columnType = col.colType;
437438

438439
columns.push({
439-
key: lowercaseName,
440+
key: name,
440441
name: (
441442
<DataFrameColumnGroupHeader
442-
name={lowercaseName}
443+
name={name}
443444
columnStatus={columnStatus}
444445
primaryKeys={primaryKeys.map((k) => k.toLowerCase())}
445446
columnType={"unknown"}
@@ -455,35 +456,33 @@ export function toValueDiffGrid(
455456
},
456457
renderCell: defaultRenderCell,
457458
columnType,
458-
columnRenderMode: columnsRenderMode[lowercaseName],
459+
columnRenderMode: columnsRenderMode[name],
459460
});
460461
});
461462

462463
// merges columns: pinned columns
463464
pinnedColumns.forEach((name) => {
464-
const lowercaseName = name.toLowerCase();
465-
const columnStatus = columnMap[lowercaseName].status ?? "";
466-
const columnType = columnMap[lowercaseName].colType;
465+
const col = getValueAtPath(columnMap, name);
466+
if (!col) {
467+
throw new Error(`Pinned column ${name} not found in DataFrame`);
468+
}
469+
const columnStatus = col.status ?? "";
470+
const columnType = col.colType;
467471

468-
if (includesIgnoreCase(primaryKeys, lowercaseName)) {
472+
if (includesIgnoreCase(primaryKeys, name)) {
469473
return;
470474
}
471475

472476
columns.push(
473-
toColumn(
474-
lowercaseName,
475-
columnStatus,
476-
columnType,
477-
columnsRenderMode[lowercaseName],
478-
),
477+
toColumn(name, columnStatus, columnType, columnsRenderMode[name]),
479478
);
480479
});
481480

482481
// merges columns: other columns
483482
Object.entries(columnMap).forEach(([name, mergedColumn]) => {
484483
const columnStatus = mergedColumn.status ?? "";
485484

486-
if (name === "IN_A" || name === "IN_B") {
485+
if (includesIgnoreCase(["in_a", "IN_A", "in_b", "IN_B"], name)) {
487486
return;
488487
}
489488

@@ -506,10 +505,10 @@ export function toValueDiffGrid(
506505
}
507506
columns.push(
508507
toColumn(
509-
name.toLowerCase(),
508+
name,
510509
columnStatus,
511510
mergedColumn.colType,
512-
columnsRenderMode[name.toLowerCase()],
511+
columnsRenderMode[name],
513512
),
514513
);
515514
});

js/src/utils/transforms.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,16 @@ export function getCaseInsensitive<T extends RowObjectType>(
7070

7171
return foundKey ? obj[foundKey] : undefined;
7272
}
73+
74+
// Get the value of an object at a given path, case-insensitively
75+
export function getValueAtPath<T = RowDataTypes>(
76+
obj: Record<string, T | undefined>,
77+
path: string,
78+
): T | undefined {
79+
let col = obj[path.toLowerCase()];
80+
if (!col) {
81+
// try upper-case match
82+
col = obj[path.toUpperCase()];
83+
}
84+
return col;
85+
}

recce/data/404.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

recce/data/__next.__PAGE__.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
1:"$Sreact.fragment"
22
2:I[74549,["/_next/static/chunks/99d638224186c118.js","/_next/static/chunks/d003eb36240e92f3.js"],"ClientPageRoot"]
3-
3:I[31713,["/_next/static/chunks/2df9ec28a061971d.js","/_next/static/chunks/1e8469bf3e6fe4ff.js","/_next/static/chunks/19c10d219a6a21ff.js","/_next/static/chunks/8a4c4ec4acba3f95.js"],"default"]
3+
3:I[31713,["/_next/static/chunks/2df9ec28a061971d.js","/_next/static/chunks/7b8a236a09aa29b9.js","/_next/static/chunks/19c10d219a6a21ff.js","/_next/static/chunks/8a4c4ec4acba3f95.js"],"default"]
44
6:I[87372,["/_next/static/chunks/99d638224186c118.js","/_next/static/chunks/d003eb36240e92f3.js"],"OutletBoundary"]
55
7:"$Sreact.suspense"
66
:HL["/_next/static/chunks/f40141db1bdb46f0.css","style"]
7-
0:{"buildId":"DeI_lJ2nrMtNQ1zGPoFGI","rsc":["$","$1","c",{"children":[["$","$L2",null,{"Component":"$3","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@4","$@5"]}}],[["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/f40141db1bdb46f0.css","precedence":"next"}],["$","script","script-0",{"src":"/_next/static/chunks/19c10d219a6a21ff.js","async":true}],["$","script","script-1",{"src":"/_next/static/chunks/8a4c4ec4acba3f95.js","async":true}]],["$","$L6",null,{"children":["$","$7",null,{"name":"Next.MetadataOutlet","children":"$@8"}]}]]}],"loading":null,"isPartial":false}
7+
0:{"buildId":"iRBzHUXHlPV86_79ssTXj","rsc":["$","$1","c",{"children":[["$","$L2",null,{"Component":"$3","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@4","$@5"]}}],[["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/f40141db1bdb46f0.css","precedence":"next"}],["$","script","script-0",{"src":"/_next/static/chunks/19c10d219a6a21ff.js","async":true}],["$","script","script-1",{"src":"/_next/static/chunks/8a4c4ec4acba3f95.js","async":true}]],["$","$L6",null,{"children":["$","$7",null,{"name":"Next.MetadataOutlet","children":"$@8"}]}]]}],"loading":null,"isPartial":false}
88
4:{}
99
5:"$0:rsc:props:children:0:props:serverProvidedParams:params"
1010
8:null

recce/data/__next._full.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
1:"$Sreact.fragment"
2-
2:I[84654,["/_next/static/chunks/2df9ec28a061971d.js","/_next/static/chunks/1e8469bf3e6fe4ff.js"],"default"]
2+
2:I[84654,["/_next/static/chunks/2df9ec28a061971d.js","/_next/static/chunks/7b8a236a09aa29b9.js"],"default"]
33
3:I[13322,["/_next/static/chunks/99d638224186c118.js","/_next/static/chunks/d003eb36240e92f3.js"],"default"]
44
4:I[45446,["/_next/static/chunks/99d638224186c118.js","/_next/static/chunks/d003eb36240e92f3.js"],"default"]
55
5:I[74549,["/_next/static/chunks/99d638224186c118.js","/_next/static/chunks/d003eb36240e92f3.js"],"ClientPageRoot"]
6-
6:I[31713,["/_next/static/chunks/2df9ec28a061971d.js","/_next/static/chunks/1e8469bf3e6fe4ff.js","/_next/static/chunks/19c10d219a6a21ff.js","/_next/static/chunks/8a4c4ec4acba3f95.js"],"default"]
6+
6:I[31713,["/_next/static/chunks/2df9ec28a061971d.js","/_next/static/chunks/7b8a236a09aa29b9.js","/_next/static/chunks/19c10d219a6a21ff.js","/_next/static/chunks/8a4c4ec4acba3f95.js"],"default"]
77
9:I[87372,["/_next/static/chunks/99d638224186c118.js","/_next/static/chunks/d003eb36240e92f3.js"],"OutletBoundary"]
88
a:"$Sreact.suspense"
99
c:I[87372,["/_next/static/chunks/99d638224186c118.js","/_next/static/chunks/d003eb36240e92f3.js"],"ViewportBoundary"]
@@ -13,7 +13,7 @@ e:I[87372,["/_next/static/chunks/99d638224186c118.js","/_next/static/chunks/d003
1313
:HL["/_next/static/chunks/ffe5529fff9d6fe6.css","style"]
1414
:HC["/",""]
1515
:HL["/_next/static/chunks/f40141db1bdb46f0.css","style"]
16-
0:{"P":null,"b":"DeI_lJ2nrMtNQ1zGPoFGI","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/e124bccf574a3361.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/chunks/ffe5529fff9d6fe6.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/_next/static/chunks/2df9ec28a061971d.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/_next/static/chunks/1e8469bf3e6fe4ff.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","suppressHydrationWarning":true,"children":[false,["$","body",null,{"children":["$","$L2",null,{"children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]]}]]}],{"children":[["$","$1","c",{"children":[["$","$L5",null,{"Component":"$6","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@7","$@8"]}}],[["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/f40141db1bdb46f0.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/_next/static/chunks/19c10d219a6a21ff.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/_next/static/chunks/8a4c4ec4acba3f95.js","async":true,"nonce":"$undefined"}]],["$","$L9",null,{"children":["$","$a",null,{"name":"Next.MetadataOutlet","children":"$@b"}]}]]}],{},null,false,false]},null,false,false],["$","$1","h",{"children":[null,["$","$Lc",null,{"children":"$@d"}],["$","div",null,{"hidden":true,"children":["$","$Le",null,{"children":["$","$a",null,{"name":"Next.Metadata","children":"$@f"}]}]}],null]}],false]],"m":"$undefined","G":["$10",[]],"S":true}
16+
0:{"P":null,"b":"iRBzHUXHlPV86_79ssTXj","c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/e124bccf574a3361.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/chunks/ffe5529fff9d6fe6.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/_next/static/chunks/2df9ec28a061971d.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/_next/static/chunks/7b8a236a09aa29b9.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","suppressHydrationWarning":true,"children":[false,["$","body",null,{"children":["$","$L2",null,{"children":["$","$L3",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L4",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]}]]}]]}],{"children":[["$","$1","c",{"children":[["$","$L5",null,{"Component":"$6","serverProvidedParams":{"searchParams":{},"params":{},"promises":["$@7","$@8"]}}],[["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/f40141db1bdb46f0.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/_next/static/chunks/19c10d219a6a21ff.js","async":true,"nonce":"$undefined"}],["$","script","script-1",{"src":"/_next/static/chunks/8a4c4ec4acba3f95.js","async":true,"nonce":"$undefined"}]],["$","$L9",null,{"children":["$","$a",null,{"name":"Next.MetadataOutlet","children":"$@b"}]}]]}],{},null,false,false]},null,false,false],["$","$1","h",{"children":[null,["$","$Lc",null,{"children":"$@d"}],["$","div",null,{"hidden":true,"children":["$","$Le",null,{"children":["$","$a",null,{"name":"Next.Metadata","children":"$@f"}]}]}],null]}],false]],"m":"$undefined","G":["$10",[]],"S":true}
1717
7:{}
1818
8:"$0:f:0:1:1:children:0:props:children:0:props:serverProvidedParams:params"
1919
d:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]]

recce/data/__next._head.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
4:I[87372,["/_next/static/chunks/99d638224186c118.js","/_next/static/chunks/d003eb36240e92f3.js"],"MetadataBoundary"]
44
5:"$Sreact.suspense"
55
7:I[22698,["/_next/static/chunks/99d638224186c118.js","/_next/static/chunks/d003eb36240e92f3.js"],"IconMark"]
6-
0:{"buildId":"DeI_lJ2nrMtNQ1zGPoFGI","rsc":["$","$1","h",{"children":[null,["$","$L2",null,{"children":"$@3"}],["$","div",null,{"hidden":true,"children":["$","$L4",null,{"children":["$","$5",null,{"name":"Next.Metadata","children":"$@6"}]}]}],null]}],"loading":null,"isPartial":false}
6+
0:{"buildId":"iRBzHUXHlPV86_79ssTXj","rsc":["$","$1","h",{"children":[null,["$","$L2",null,{"children":"$@3"}],["$","div",null,{"hidden":true,"children":["$","$L4",null,{"children":["$","$5",null,{"name":"Next.Metadata","children":"$@6"}]}]}],null]}],"loading":null,"isPartial":false}
77
3:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]]
88
6:[["$","title","0",{"children":"recce"}],["$","meta","1",{"name":"description","content":"Recce: Data validation toolkit for comprehensive PR review"}],["$","link","2",{"rel":"icon","href":"/favicon.ico?favicon.a8d38d84.ico","sizes":"32x32","type":"image/x-icon"}],["$","$L7","3",{}]]

0 commit comments

Comments
 (0)