Ported, but not translated
Moving scheduled jobs from Windows to Linux carried every file across. Two of them still quietly assumed Windows, and one cost four weeks of data that can never be recovered.
At the start of October the scheduled jobs moved off a Windows laptop and onto an always-on Linux server. The move was careful: every job was rewritten as a cron entry, the services came back by themselves after a test reboot, and every run reported to an outside monitor. For four weeks everything was green.
A routine scan at the end of the month found two places where the code had moved but its assumptions had not.
A rescue that could never run
A small supervisor process runs all day. One of its jobs is to notice when the daily trading run has not happened, for example because the machine was off at 16:45, and run it late. On the laptop it did this by starting a Windows batch file.
On the server it still started the same Windows batch file, through the Linux shell, which cannot run one. So the rescue failed every time. It was never needed in those four weeks, so nothing noticed, but it would have been needed on the first bad day. The server was in fact powered off by its host for an hour in mid-October, luckily on a Saturday morning when no run was due.
Both versions of the wrapper existed side by side in the project. The supervisor simply asked for the wrong one. It now picks the one that matches the machine it is running on, and the tests check both cases.
A line that said it mirrored a file
On the laptop, a weekly batch file did three things: refresh the price cache, record that week's list of Nifty 500 members, and audit data coverage. The server's schedule replaced it with one line, with a comment saying it mirrors the batch file. It ran the first step only.
The second step matters most. Index membership history is not freely published in a usable form, so recording the list every week is the only way the project learns when a company really joined or left the index, which is what keeps backtests honest about the companies that dropped out. A week that is not recorded cannot be recorded later. Four of them are gone.
The cron line now runs all three steps. More usefully, a test now reads every schedule line that claims to mirror a batch file, and fails the build if the line skips any script that file runs.
Why green was not enough
- The monitor watched whether each job finished. It could not see that a job was doing one third of its work, or that a backup path existed but could not start.
- The failures were all on the code paths for bad days and slow-moving data, which is exactly where four quiet weeks prove nothing.
- The word "mirrors" was a promise written in a comment. Nothing kept it.
When you move a system to a new platform, list everything that starts another program or claims to match another file, and check each one on the new machine. A port that runs is not yet a port that is correct.