summaryrefslogtreecommitdiff
path: root/plugins/code-modernization/scripts/compare.py
AgeCommit message (Collapse)Author
2026-09-24code-modernization: approve a difference once per inputMorgan Lunt
An independent check of a rewritten batch job found differences on two new inputs of one family (a blank numeric field the rewrite rejects on purpose and the old program reads as zero). Each input has several output files, so accepting the deviation meant three or four hand-written entries per input. A top-level "approvedInputs": {"F23": "reason"} in a cases file now approves every case that shares that input label. A reason is still required (blank approves nothing), a case's own reason wins, a missing file is never turned into a pass, and the result still lists the difference as approved.
2026-09-24code-modernization: harden the numeric tolerance and say what Rehost and ↵Morgan Lunt
Replace mean Follow-ups from review of the tolerance check: an absolute tolerance above 1e-6 is refused like a relative one above 1%, numbers are compared as exact decimals rather than doubles, dotted runs such as 1.2.3 or 10.0.0.1 are text that must match exactly, and the self-check now changes the leading digit of every sampled number to prove the tolerance cannot hide a real change. The business-rules header says how many rules there were at extraction, since later steps add rules. The assessment says what to do when it recommends Rehost or Replace, which change no code and so have no build command.
2026-09-24code-modernization: compare floating-point output within a declared toleranceMorgan Lunt
The equivalence check compared bytes only, which cannot pass for numeric code (Fortran, C, scientific and financial results) whose last digits differ between compilers and math libraries, so those cases pushed people to mask the numbers away. A case can now declare a tolerance, relative or absolute, with a required reason. Only numbers written with a decimal point or an exponent may differ within it; integers and every other byte must match, a relative tolerance above 1% is refused, and the tolerance and the largest difference are recorded in the result. The self-check also fails when a tolerance is loose enough to hide a change to the leading digit of a number.
2026-09-24code-modernization: simpler commands, a source option, a report page and an ↵Morgan Lunt
equivalence check Commands hardcoded legacy/<system>, so code too big to copy, or living at an absolute path, needed a hand-made symlink. Preflight now takes --source <path> and makes the legacy/<system> link for you (a junction on Windows); nothing is copied, and every command says where the link points before it starts. The harden patch is applied with patch -p1 -d. Each command ends by naming the next command to run, and the commands are about a third shorter with no step removed: - map accepts an existing dependency graph (--graph) or the stack's own tooling, maps very large estates in resumable chunks, records reflection targets as unresolved instead of dead, asks before describing more than 40 nodes, and never gives two nodes the same location. - transform can take its module and target from the brief, counts the equivalence cases that executed (zero is a failure and a comparison never skips), shows the tests can fail with a deliberate one-line break, and hands "same or different" to a script when both systems can run. - brief writes each phase in one fixed shape: one command, module ids as in the map, and criteria written as conditions a build command may tick but not reword. - reimagine reuses the discovery artifacts instead of extracting them again. - status names the exact command to paste next. scripts/build_report.py turns whatever the commands wrote into one self-contained, offline REPORT.html (Mermaid is vendored, all text from the analysis is escaped, the quarantined secrets file is never read), and scripts/compare.py decides byte-for-byte whether two outputs match, records why, and checks it can fail. The shard builder ignores symbolic links and paths that leave the source, matches a plain name against what lies beneath it, and falls back to the directory tree when the map's modules share a location. The README drops from 275 to about 100 lines; the pane's reference moves to hooks/README.md.