Engineering notes
What keeps the answer honest
switchtender is a small program with a few stubborn habits. Most of them come back to one question. How far can you trust what it just told you?
Unknown is not clear
When a feed fails, the code hands back
null. Never0. A zero would claim there's no incident and no delay, which is a lie when the feed is simply down. Null admits it couldn't tell, and that's the honest answer.Trust the live query over the docs
One routing provider documented its delay fields beautifully. Around DC, every one of them came back zero. Since then, no source gets in until it has answered a real query for the real area.
What didn't make it
Source Why it is out MapQuest The delay fields are documented. On a live query they were all zero. DDOT MajorEvent No data after 2017. HSEMA road closures No data after 2023. WMATA GTFS-RT Real time only, so it can't warn you about planned work ahead of time. Freshness is two tests
A feed has to prove it's alive. If its newest record isn't from this month, the source is out. After that, each record is judged by whether its window covers the commute. When it was filed doesn't matter. A closure posted last week can still be blocking the road this morning.
A signal has to earn its vote
Incidents, closures, events and track work all show up in what you hear, and each one costs some confidence. None of them can flip the verdict yet. A signal earns that only once the logs show it actually predicts a slower drive.
No coordinates in source
Every place lives in a config file that never gets committed. The engine has no idea where anyone lives. If a maintainer's coordinates ever turn up in the example config, a test fails.
Rate limits are real
Ticketmaster allows two requests a second. Looking up every venue on every run blew straight past that and came back with HTTP 429. Now the venue ids sit in config. Any lookups left over are spaced half a second apart, and a 429 gets exactly one retry, after waiting as long as
Retry-Afterasks.Cost stays inside the free tier
Each verdict makes three routing calls. Two verdicts a weekday fit inside the routing API's free monthly allowance. The repo's cost note does the math tier by tier.
Tests never touch the network
The whole suite runs offline in a fraction of a second. Each new feed arrives with a fixture recorded from the real source, contact details blanked before commit. So the tests see real payloads and never wait on somebody else's uptime.
All of this comes from the public repository atgithub.com/moneymikeMD/switchtender.
