Uncategorized

  • An outbox table, and the relay that reads it

    Publishing to a broker inside a database transaction is two systems and one commit, which cannot be made atomic. The index on (published_at, id) with nulls first is…

  • PHPUnit 10, and the listeners that no longer exist

    10.0 in February, a configuration file that has accreted since 2014, and a custom TestListener that the new version has no place for.

  • A plugin update that changed a hook’s arguments

    A filter that gained a fourth argument, and our callback declared with three, which is legal and silently receives less than it could. PHP does not complain when…

  • Time in tests, and the clock we injected

    A test that fails between 23:00 and midnight, once a year, and passes on every rerun. PSR-20 standardised this interface in 2022, which is worth adopting for the…

  • At-least-once, and the consumer that had to say so

    Every broker worth using delivers at least once, and every consumer that does not say how it handles that is claiming something it has not checked. Writing the…

  • Coverage on a directory, not on a percentage

    A global threshold of 80% says nothing about whether the code that matters is tested, and it is satisfied by testing the code that is easy. Different code…

  • An HTTP client faked at the PSR-18 boundary

    Mocking a client library’s own interface couples every test to that library; faking the standard interface does not. Throwing on an unstubbed request is the design decision that…

  • useSyncExternalStore for a store that is not React’s

    Subscribing to an external store with useEffect and useState tears under concurrent rendering, which is what this hook exists to prevent. The snapshot function must return a cached…

  • Reindexing behind an alias, and a switch nobody noticed

    Changing an analyser means reindexing, and reindexing in place means a search index that is half old and half new for twenty minutes. The application must only ever…

  • Extracting a module without extracting a service

    A billing module everybody agrees should be separate, a team of four, and 88 classes that reference it. The boundary, drawn in code rather than in conversation.