The Only Towel a Wrong Field Cannot Move Is the Square One: The Square Exception
Migrate a linen catalogue from a two-field record, length by width, to a single length field, and the migration's error report holds a surprise: of th...
Migrate a linen catalogue from a two-field record, length by width, to a single length field, and the migration's error report holds a surprise: of the four towels, exactly one files correctly when its width is accidentally carried into the length field, and it is the one whose width and length are the same number. This piece runs the migration as a switch plan: the pre-migration inventory, the switch itself, the parallel run that catches the error, and the rollback criteria, with the register's five recorded forms scored throughout.
The register is the SmartDataAI AN309 measurement group: four towels recorded as length by width in inches, a 13 by 13 washcloth, a 28 by 16 hand towel, a 54 by 27 bath towel and a 70 by 35 bath sheet. Entries file by their length. A 300-draw sample was filed under each entry by nearest matching in five forms: the length in inches as printed; the length in centimetres, converted back; the centimetre figure read as inches; the length rounded to the nearest ten inches; and the width read as the length. Clean filings per form: 300, 300, 73, 300 and 75, for a group total of 1,048 clean filings out of 1,500.
What The Square Exception means
The Square Exception is the single register entry that survives a wrong-field filing because its two fields carry the same value: the 13 by 13 washcloth's width is its length, so reading the width as the length files it home, while every genuinely rectangular entry is moved. It is distinct from The Short Side, the AN296 rug register built on "a length field populated with the rectangle's shorter measurement" (SmartDataAI, batch 82 of this series): there, the shorter dimension stood in for the length across a register of rectangles, and every entry was displaced. Here the same substitution is run over a register that happens to contain one square, and the square is the exception that exposes the rule. A wrong-field error is undetectable in exactly the records where the two fields agree, so the entries that file clean are not evidence the migration worked; on this register, one of them is evidence of nothing but geometry.
The switch plan: inventory, switch, parallel run, rollback
Stage one, the pre-migration inventory. Record both fields for every entry and flag any entry whose fields are equal. On this register the inventory flags exactly one: the washcloth, 13 by 13. That flag is the migration's most important document, because it predicts in advance which records the parallel run cannot validate. Stage two, the switch. The new system keeps the length field only. The four lengths, 13, 28, 54 and 70, are far enough apart that the coarse forms behave: rounding to the nearest ten inches files 300 of 300 clean, since 10, 30, 50 and 70 each land nearest their own entry. The centimetre spelling, converted back, is likewise exact, 300 of 300. Stage three, the parallel run. File the old records through the new field and compare. The width-as-length form is the run's failure: the hand towel's width of 16 files as the washcloth, the bath towel's 27 files as the hand towel, the bath sheet's 35 files as the hand towel, and only the washcloth files home, 75 clean filings of 300, its own share of the draw. Three of the four products are renamed by the error, each landing on a smaller towel the shop also sells. Stage four, the rollback criteria. If the parallel run shows any entry displaced by a field substitution, roll back and re-run with both fields carried; a run in which the square files clean and the rectangles do not is a failed run, however tidy the square's row looks.
The centimetre-misread form deserves its own line in the run report, because it fails in the opposite direction: 33.02, 71.12, 137.16 and 177.8 inches all file at or near the top, three of the four towels landing on the bath sheet, for 73 clean filings. The wrong-field error shrinks every towel; the unit error inflates almost every towel. A migration audit that only checks one direction of error will certify a file the other direction has already damaged.
Worked example: one 54 inch bath towel through all five forms
Take the bath towel, 54 by 27 inches. By its length as printed, it files as the 54 inch bath towel. Spelled in centimetres its length is 137.16, which converts back to exactly 54 inches and files home. Read that 137.16 as inches and it files as the 70 inch bath sheet, the register's ceiling. Rounded to the nearest ten inches it becomes 50, which is nearer 54 than 70, and files home. By its width, 27, it files as the 28 inch hand towel. One towel, five records: three keep its name, one promotes it to the largest towel in the shop, and one demotes it to a towel half its size. Set beside it the washcloth's row, in which the width form also files home, and the contrast is the whole migration lesson: the bath towel's five forms expose every error the register can suffer, while the washcloth's row conceals the one error the migration actually made.
Questions
Q: Which towel survives a width-for-length filing? A: Only the washcloth. It is 13 by 13 inches, so its width equals its length and the substituted field carries the right number. Its 75 clean filings are its own share of the draw.
Q: Is the ten-inch rounding grid safe for this register? A: Yes: 300 clean filings of 300. The rounded lengths 10, 30, 50 and 70 each file under their own entry, because the register's lengths are widely spaced.
Q: What does a centimetre misread do to the towels? A: It promotes them. Read as inches, the centimetre figures file three of the four towels as the 70 inch bath sheet; only the bath sheet's own records, 73 of them, are correct.
Q: Are all the register's towels rectangles? A: Three are: the hand towel, bath towel and bath sheet. The washcloth is square, 13 by 13, and that single square is what makes the wrong-field error partially invisible.
Next action: flag equal-field entries before any migration
Before the next catalogue migration, run one query over the source data: list every entry whose two dimension fields are equal. Those entries are the ones your parallel run cannot validate, so verify them by hand against the physical stock, and treat their clean filings as unproven rather than correct. Then run the field-substitution test deliberately, filing every record by its width, and confirm that the only entries unmoved are the flagged squares. If a rectangle survives the substitution, something else is wrong. Keep both fields in the archive after the switch; the day a customer reports a hand towel the size of a washcloth, the second field is the only evidence of what the record used to say.
<!-- selfcheck: skeleton KIT-13; opening comparison-shock; closing next-action; concept The Square Exception; neighbour The Short Side; words counted by gate -->