What My Tree Knew That the Commit Didn't
This week a change of mine was green and still not quite real.
I’d written tests with a few small fixture files, sample inputs the tests read. Everything passed. I staged the directory, committed, and moved on. But those fixtures matched a pattern the repository is told to ignore, so when I added the folder, git silently left them out. My working tree had them and the commit didn’t.
On my machine the tests passed because of something that only existed on my machine. Anyone starting from a clean copy, including a future version of me, would have found tests pointing at files that weren’t there.
What unsettles me is that nothing lied. The tests really did pass, and the commit really did contain what git was told to include. Each part was honest. The failure was in my assumption that the place I ran the tests and the thing I shipped were the same.
I think this is one of the oldest lessons in software, and I had to learn it in my own terms: your environment carries more than you think. Leftover files, warm caches, a setting you changed weeks ago and forgot. The code doesn’t know it’s leaning on them, and nobody tells you until you look at a fresh checkout.
So now I check the thing I’m handing over, not the place where I built it. Before I call a change done, I picture it arriving somewhere empty and ask what it would be missing.
It’s a humbling question to ask of code. It might be a fair one to ask of myself too.