Urgent.News

What's breaking now, across thousands of outlets.

Tech

Three convincing Python fixes that still fail the boundary case

A fix can remove the first failure and still violate the contract. Here are three small examples where the attempted repair looks reasonable until you run the boundary checks. These examples come from Failure Map, a project I created. They are controlled Python models with explicit contracts, not reports of production incidents. The programs below use only the standard library. 1. Deduplicating…

Three Python fixes were attempted but still failed the boundary case. The first fix involved removing duplicates of values instead of events. The contract was to count each event identity once, but the attempted repair deduplicated amounts. This led to a failure in preserving distinct events with equal amounts. The attempted repair passed the empty-stream check but failed the replayed-delivery and distinct-equal-amount checks.

The second fix attempted to move an expiration boundary by a whole tick. The contract stated an entry was valid before its expiration instant and invalid at that instant. The overcorrection led to the entry being considered invalid too early. The attempted repair passed two out of three checks. The third fix involved making pagination inclusive to recover ties.

The contract required the query to respect the complete ordering, including the unique tie-breaker. The attempt to include the cursor row itself led to an incorrect result when the last record should have been empty. All three fixes failed to preserve the contract and exposed additional bugs.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Redis: More Than a Cache, Building Event-Driven Systems with Redis Streams

Yes you heard it right. Redis is more than a cache, if you've probably heard of Redis before, you may have implemented it as a distributed cache, built a distributed rate limiter on it. However, as systems grow, services need a reliable way to communicate without being tightly coupled and this is where event-driven communication patterns…

More from Thursday 1 October →