Repository navigation
Commit 3a34f9d
authored
fix(contracts): profile awkward cells, compare storage-independently, drop phantom drift (#446)
Four defects found by fuzzing, all on entry points documented as read-only
profiling of any pandas frame:
* list and dict cells crashed profiling, because nunique/unique hash every
value. They are ordinary JSON-derived data, so such cells are counted by
their text form instead.
* non-UTF-8 bytes crashed the categorical profile on pandas 2, whose string
cast decodes strictly, and lone surrogates crashed the keyed-label HMAC.
Bytes now decode with backslash escapes, and the HMAC encodes with
"surrogatepass". Valid UTF-8 strings keep their previous label, so
existing baselines still match.
* allowed_values raised a raw pyarrow error on pyarrow-backed columns, while
the same rule reported a violation on numpy or masked storage. The
membership test now falls back to object comparison, so the finding no
longer depends on how the column is stored.
* a frame could fail PSI drift against a baseline built from that same frame.
A quantile interpolated between two observed values sits in a gap where the
baseline CDF is flat, so its nominal probability overstates the share of
rows at or below it, and the bin between two such knots claimed mass no
data could fill. Stored probabilities are now read as the baseline's own
empirical CDF, (floor(p*(n-1)) + 1)/n.
Closes #434
Closes #435
Closes #439
Closes #4411 parent 915dd7b commit 3a34f9d
2 files changed
Lines changed: 198 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
160 | 207 | | |
161 | 208 | | |
162 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
163 | 215 | | |
164 | 216 | | |
165 | 217 | | |
| |||
849 | 901 | | |
850 | 902 | | |
851 | 903 | | |
852 | | - | |
| 904 | + | |
853 | 905 | | |
854 | 906 | | |
855 | 907 | | |
| |||
864 | 916 | | |
865 | 917 | | |
866 | 918 | | |
867 | | - | |
| 919 | + | |
868 | 920 | | |
869 | 921 | | |
870 | 922 | | |
| |||
883 | 935 | | |
884 | 936 | | |
885 | 937 | | |
886 | | - | |
| 938 | + | |
887 | 939 | | |
888 | 940 | | |
889 | 941 | | |
| |||
1058 | 1110 | | |
1059 | 1111 | | |
1060 | 1112 | | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
1061 | 1138 | | |
1062 | 1139 | | |
1063 | 1140 | | |
| |||
1076 | 1153 | | |
1077 | 1154 | | |
1078 | 1155 | | |
1079 | | - | |
| 1156 | + | |
1080 | 1157 | | |
1081 | 1158 | | |
1082 | 1159 | | |
| |||
1919 | 1996 | | |
1920 | 1997 | | |
1921 | 1998 | | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
| 2012 | + | |
1922 | 2013 | | |
1923 | 2014 | | |
1924 | 2015 | | |
1925 | 2016 | | |
1926 | 2017 | | |
1927 | | - | |
| 2018 | + | |
1928 | 2019 | | |
1929 | 2020 | | |
1930 | 2021 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
18 | | - | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
295 | 297 | | |
296 | 298 | | |
297 | 299 | | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
0 commit comments