12 ms·
Hyrum’s Law in Golang
- _rlh 2y agoFred Brooks discussed this in the unfortunately named pun "The Mythical Man-Month". Most of the gray beards have read it, ask to borrow it, it will make their day. The punchline was on the IBM 360 they stopped fixing bugs when the fix cause the same or more bugs than the unfixed bug, which soon became all bugs. Well aware of Brooks, when the loop var semantics were changed Go did an analysis showing that many more bugs were fixed than created by the change.
- sudhirj 2y agoWeren’t there a couple of anecdotes where Windows couldn’t fix a bug because some popular game (maybe SimCity?) depended on it, so the devs hardcoded a SimCity check inside Windows and made the bug happen if it was running?
- masklinn 2y agoIt was not a bug in windows, it was a bug in SimCity: it would UAF some memory, but the Windows 3.x allocator did not unmap / clear that memory so it worked. Windows 95 changed that, and so one of the compatibility shims it got is that the allocator had a 3.x adjacent mode, which would be turned on when running SimCity (and probably other similarly misbehaving software as well). Nowadays this is formalised in the compatibility engine (dating back to windows do), which can enable special modes or compatibility shims for applications (windows admins trying to run legacy or unmaintained applications can manage the application of compatibility modes via the “compatibility administrator”).
- praptak 2y agoStill a pretty good example of having to support something which is definitely not part of the official spec.
- guappa 2y agoHad it been open source, they could have just fixed the software instead
- masklinn 2y agoFixing the upstream would not have updated it on the millions of machines running it, which is what they wanted to not break.
- cesarb 2y ago> Fixing the upstream would not have updated it on the millions of machines running it, It was a very different world back then. You couldn't even assume a dial-up connection. Nowadays, the software would have been automatically updated for 99% of the machines running it, whether they wanted that update or not.
- masklinn 2y agoHah. Debian will happily keep shipping libraries years out of date. Then complain that you’re holding them back when they finally wake up and update sid to a bleeding edge release.
- guappa 2y agoI feel like you have no idea on how debian works, but have read an article 25 years ago and are angry about that ever since. The proof is this totally OT comment that doesn't even make any sense :)
- adontz 2y agohttps://www.joelonsoftware.com/2000/05/24/strategy-letter-ii-chicken-and-egg-problems/ https://www.joelonsoftware.com/2000/05/24/strategy-letter-ii... Jon Ross, who wrote the original version of SimCity for Windows 3.x, told me that he accidentally left a bug in SimCity where he read memory that he had just freed. Yep. It worked fine on Windows 3.x, because the memory never went anywhere. Here’s the amazing part: On beta versions of Windows 95, SimCity wasn’t working in testing. Microsoft tracked down the bug and added specific code to Windows 95 that looks for SimCity. If it finds SimCity running, it runs the memory allocator in a special mode that doesn’t free memory right away. That’s the kind of obsession with backward compatibility that made people willing to upgrade to Windows 95.
- praptak 2y agoCorollary: uptime is part of the defacto spec being relied on. One of the SRE practices is breaking your service on purpose to bring the actual service level closer to what is promised and supported.
- hambes 2y agoSolution to the specifically mentioned problem: Don't use string-based errors, use sentinel errors [1]. More generally: Don't produce code where consumers of your API are the least bit inclined to rely on non-technical strings. Instead use first-level language constructs like predefined error values, types or even constants that contain the non-technical string so that API consumers can compare the return value againnst the constant instead of hard-coding the contained string themselves. Hyrum's Law is definitely a thing, but its effects can be mitigated. [1]: https://thomas-guettler.de/go/wrapping-and-sentinel-errors https://thomas-guettler.de/go/wrapping-and-sentinel-errors
- Svip 2y agoIn your example, the onus is on the consumer not the provider. I could still be writing code that checks if `err.String() == "no more tea available."`. I agree, I shouldn't do that, but nothing is preventing me from doing that. Additionally, errors.Is is a relatively recent addition to Go, so by the time people would check for errors like this, it was just easier to check the literal string. But as an API provider in Go, you cannot prevent your consumers from checking the return values of .String().
- hambes 2y agoUnfortunately true. The Go maintainers might not agree with me on this, but I think in this case consumers have to learn the hard way. Go tries to always be backwards compatible, but I don't think that trying to be backwards compatible with incorrect usage is ever the right choice.
- LudwigNagasena 2y agoSo the people who decided to make a stringly type error with `errors.New("http: request body too large")` and make you suffer, now can remove a stringly typed error and make you suffer even more? What would the lesson be? What would consumers learn?
- 2y ago
- adontz 2y agoThis is a good example of "stringly typed" software. Golang designers did not want exceptions (still have them with panic/recover), but untyped errors are evil. On the other hand, how would one process typed errors without pattern matching? Because "catch" in most languages is a [rudimentary] pattern matching. https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/statements/exception-handling-statements#a-when-exception-filter https://learn.microsoft.com/en-us/dotnet/csharp/language-ref...
- KRAKRISMOTT 2y agoGo has typed errors, it just didn't use it in this case.
- Svip 2y agoThe consumer didn't, but the error in the example is typed, it's called `MaxBytesError`.
- eptcyka 2y agoMatching the underlying type when using an interface never feels natural and is definitely the more foreign part of Go's syntax to people who are not super proficient with it. Thus, they fall back on what they know - string comparison.
- simiones 2y agoOnly since go 1.19. It was a stringy error since go 1.0 until then.
- TheDong 2y agoIt has typed errors, except every function that returns an error returns the 'error' interface, which gives you no information on the set of errors you might have. In other statically typed languages, you can do things like 'match err' and have the compiler tell you if you handled all the variants. In java you can `try { x } catch (SomeTypedException)` and have the compiler tell you if you missed any checked exceptions. In go, you have to read the recursive call stack of the entire function you called to know if a certain error type is returned. Can 'pgx.Connect' return an `io.EOF` error? Can it return a "tls: unknown certificate authority" (unexported string only error)? The only way to know is to recursively read every line of code `pgx.Connect` calls and take note of every returned error. In other languages, it's part of the type-signature. Go doesn't have _useful_ typed errors since idiomatically they're type-erased into 'error' the second they're returned up from any method.
- apitman 2y agoWhen I clicked on the link to codebases relying on the specific error string, I was expecting to see random side projects. Wasn't expecting to see Grafana and Caddy on the list.
- Cthulhu_ 2y agoNever underestimate the mediocrity of known large codebases, lol. (just kidding, they're not mediocre, but they're not infallible or perfect either)
- apitman 2y agoThis instance doesn't necessarily indicate they did anything wrong. See sibling.
- gwd 2y agoTo be fair to those projects, the type was introduced only three years ago: https://github.com/golang/go/pull/49359/files https://github.com/golang/go/pull/49359/files Before that, doing a string compare was basically the only way to detect that specific error. That was definitely an omission on the part of the original authors of the stdlib code; I don't it should be classified as "Hyrum's Law".
- apitman 2y agoYeah I don't doubt it was the best option. Just a bit surprised.
- mholt 2y agoHey Anders; Francis notified us of this today. I didn't realize a proper type had been created. We'll update our code.
- turtleyacht 2y agoIn Docker's error response for `docker rmi'; the fifteenth word is "container" and the sixteenth is the container ID.
- fullstackchris 2y agoSure... but this is why we have sem versioning and release notes. It's always nice to try and support all users but sometimes you just need to ship breaking changes...
- Cthulhu_ 2y agoWhile in principle you're correct, Go the language is very dedicated to backwards and forwards compatibility; while there's been talk of a Go 2 for a long time now, they're not eager to go there and if they do, they intend to make the transition low impact. That said, I'd say this is an excellent candidate to deprecate or warn about now, and to make impossible in a version 2. Then again, how would you even stop this? A string representation of an error is common in any language, you need it to log things. I think at best there will be a static analysis rule (in e.g. go vet) that tries to figure out if any matching is done on the string representation of an error.
- TheDong 2y ago> I think at best there will be a static analysis rule (in e.g. go vet) that tries to figure out if any matching is done on the string representation of an error. First they'd need to export the errors the stdlib returns https://news.ycombinator.com/item?id=41507714 https://news.ycombinator.com/item?id=41507714 I wouldn't hold my breath on that one.
- fullstackchris 2y agoI'm not talking about Go itself, I'm talking about building an API. All this talk of "string vs type" is not the solution to the root problem - sure, types can be better to return but what if the type changes? You still have breaking changes.
- hifromwork 2y agoHyrum's law is specifically about how every change is a breaking change if you have enough users. So it's always a bit subjective. No sane person considers changing an error message a breaking change in context of semver. It's just go going above and beyond to take care of backward compatibility.
- raverbashing 2y agoIt's like an inverted game of cat and mice 1 - Lang/OS/Lib developer puts out a quirky or buggy API (or even just an ok API) 2 - Developers rely on a quirky, weird or unexpected side effect because it's easier/more obvious or it just works this way due to a bug 3 - Original developer can't fix it because it would break compatibility 4 GOTO 1
- withinboredom 2y agoImmediately reminded of this: https://externals.io/message/126011 https://externals.io/message/126011 that is an ongoing conversation in php-internals about removing a quirky/buggy behavior from PHP that, at the very end (at least of this comment's time) someone jumps in and says "yep, its useful, please keep it"
- Cthulhu_ 2y agoAnd this isn't even quirky/buggy, it's just the string representation of an error. That said, Go took a while to improve its core error mechanisms and add utilities for matching errors by type instead of its string representation.
- simiones 2y agoIn this case, it really is - because until Go 1.19, that function simply returned `errors.New("http: request body too large")`. So until Go 1.19, there really was no other way to check if this error occurred than `err.String() == "http: request body too large"`. Even if we had had errors.Is/As earlier, it wouldn't have helped in this case.
- FiloSottile 2y agoHah, I wrote the crypto/rsa comments. We take Hyrum's Law (and backwards compatibility [1]) extremely seriously in Go. Here are a couple more examples: - We randomly read an extra byte from random streams in various GenerateKey functions (which are not marked like the ones in OP) with MaybeReadByte [2] to avoid having our algorithm locked in - Just yesterday someone reported that a private ECDSA key with a nil public key used to work, and now it doesn't, so we probably have to make it work again [3] - Iterating over a map uses a randomized order to avoid exposing the internals - The output of rand.Rand is considered part of the compatibility promise, so we had to go to great lengths to improve it [4] - We discuss all the time what commitments to make in docs and what behaviors to disclaim, knowing we can never change something documented and probably something that's not explicitly documented as "this may change" [6] [1]: https://go.dev/doc/go1compat https://go.dev/doc/go1compat [2]: https://pkg.go.dev/crypto/internal/randutil#MaybeReadByte https://pkg.go.dev/crypto/internal/randutil#MaybeReadByte [3]: https://go.dev/issue/70468 https://go.dev/issue/70468 [4]: https://go.dev/blog/randv2 https://go.dev/blog/randv2 [5]: https://go.dev/blog/chacha8rand https://go.dev/blog/chacha8rand [6]: https://go-review.googlesource.com/c/go/+/598336/comment/5d6877aa_f45d6fa5/ https://go-review.googlesource.com/c/go/+/598336/comment/5d6...
- mkesper 2y agoThe nil key case really makes me wonder how sane it is to support these cases. You will be forced to lug this broken behavior with you forever, like the infamous A20 line (https://en.wikipedia.org/wiki/A20_line https://en.wikipedia.org/wiki/A20_line).
- FiloSottile 2y ago> You will be forced to lug this broken behavior with you forever Yep, welcome to my life.
- atsjie 2y agoWouldn't that broken behaviour be a potential security issue by itself? I do remember Go making backwards incompatible changes in some rare scenarios like that. (and technically the loopvar fix was a big backwards incompatible change; granted that was done with a lot of consideration)
- indulona 2y agoThis is why we have semantic versioning.
- simiones 2y agoSemantic versioning does nothing to help here. If you don't realize that people are depending on such a behavior, you won't increment the major version number.
- mseepgood 2y agoAnd if you realize it (as in this case) you probably don't want to increase the major version number either, but leave it as-is (unless you follow the CADT model of maintainership).
- cloverich 2y agoI think a very nice middle ground is when you decide to remove something, to mark it as deprecated in the next major version, and remove it in the one after. Not always possible, but IIRC React does this; so I'd frequently upgrade, then start seeing deprecation warning messages (in dev); I'd then have a clear signal before upgrading to the next version. It helped that major versions did not arrive often so making this kind of change was only occasionally necessary. A bit trickier in this case no doubt; and trade offs. Ive not minded the React updates over the years, but busting out the Go code I wrote many years ago and having it still run flawlessly is amazing too.
- voiper1 2y agoRelated XKCD: https://xkcd.com/1172/ https://xkcd.com/1172/
- red_admiral 2y agoShould this not be handled by checking "resp.status == 413" ?
- lovasoa 2y agoAn interesting topic is how to fight Hyrum's law. A possibility is to add randomness in things you don't want people to rely on. If I remember well, this is what the QUIC protocol does. Some fields are unused in the current version, but required by the specification to be set to random values, not null bytes, so that routers don't start relying on them to identify the packets. EDIT. I think I found the source: https://www.rfc-editor.org/rfc/rfc9000#section-17.2.1 https://www.rfc-editor.org/rfc/rfc9000#section-17.2.1 > The value in the Unused field is set to an arbitrary value by the server. Clients MUST ignore the value of this field. [...] Note that other versions of QUIC might not make a similar recommendation. I think they call it "greasing", to prevent "ossification".
- rho4 2y agoInteresting thanks! Might indeed be valuable to add to one's toolbox.
- vitus 2y ago> I think they call it "greasing" This is a reference to RFC 8701, which coined the acronym GREASE ("Generate Random Extensions And Sustain Extensibility"), first in the context of TLS. https://www.rfc-editor.org/rfc/rfc8701.html https://www.rfc-editor.org/rfc/rfc8701.html (The earliest draft of the RFC dates back to mid-2016, which is likely the first public mention of the term: https://datatracker.ietf.org/doc/html/draft-davidben-tls-grease-00 https://datatracker.ietf.org/doc/html/draft-davidben-tls-gre...)
- klabb3 2y agoThis is wonderful. I’m quite familiar with QUIC but hadn’t heard about this. Nothing like waking up after 10 years, realize you now really need those bits, and 20 different routers from 10 brands have decided that those bits must be a certain way. Bonus points for checksums/crypto that breaks on the other end if the bits have been messed with. Curse those middle-boxes and their “clever hacks”.
- deleted 2y ago[deleted]
- sixfiveotwo 2y agoQuite interesting, thank you. However, in this specific instance, even if the text cannot be changed, couldn't the error itself in the server be processed and signaled differently, eg. by returning a Status Code 413[1], since clients ought to recognize that status code anyway? [1]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/413 https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/413
- majewsky 2y agoSince the caller gets this as an error object, instead of as a plain string, it seems likely that this is within the same process, i.e. a library function returns the MaxBytesError to a level higher in the business logic, without a network transmission inbetween.
- djoldman 2y agoOne interesting metric for LLMs is that for some tasks their precision is garbage but recall is high. (in essence: their top 5 answers are wrong but top 100 have the right answer). As relates to infinite context, if one pairs the above with some kind of intelligent "solution-checker," it's interesting if models may be able to provide value across absolute monstrous text sizes where it's critical to tie two facts that are worlds apart.
- littlestymaar 2y ago> so per Hyrum's Law it's probably relied upon by some. Yikes. this kind of defensive posture with respect to Hyrum's law is extreme and absurd. Per Hyrum's Law everything is potentially relied upon by someone, keeping stuff that may be relied upon means you cannot change anything (see this infamous xkcd on this[1])! Thinking that no change is acceptable at all isn't the right take-away from Hyrum's Law: instead you should be ready to have to roll back changes that break people's workflow even when you didn't expected the change to break anything (and it also means that you need to have a way for your users to communicate their issues to you, which definitely isn't something Google is well-known for …). [1]: https://xkcd.com/1172/ https://xkcd.com/1172/
- jen20 2y agoThe Go project is in fact VERY well known for accepting user feedback, via golang-nuts or GitHub issues.
- littlestymaar 2y agoIt's much better known for rejecting them actually… Coincidentally, the first thing that comes to my mind when talking about golang-nuts is this gem: https://groups.google.com/g/golang-nuts/c/hJHCAaiL0so/m/kG3BHV6QFfIJ https://groups.google.com/g/golang-nuts/c/hJHCAaiL0so/m/kG3B...
- gr4vityWall 2y agoThis line of the article resonates with me a lot: > A good reminder to be careful when changing code others might depend on If you maintain a widely use Free Software library, please consider avoiding breaking changes when possible. I'm not going to imply you have any obligation to do so, but your users will appreciate it.
- kibwen 2y agoHyrum's Law is one of those observations that's certainly useful, but be careful not to fixate on it and draw the wrong conclusions. Consider that even the total runtime of a function is an observable property, which means that optimizing a function to make it faster is a breaking change (what if suddenly one of your queues clears too fast and triggers a deadlock??), despite the fact that 99.99999999% of your users would probably appreciate having code that runs faster for no effort on their part. Therefore it's unavoidable that what constitutes a "breaking change" is a social contract, not a technical contract, because the alternative is that literally nothing is ever allowed to change. So as a library author, document what parts of your API are guaranteed not to change, be reasonable, and have empathy for your users. And as a library consumer, understand that making undocumented interfaces into load-bearing constructs is done at your own risk, and have empathy for the library authors.
- rjst01 2y agoOne day I will give a lighting talk about the load bearing teapot, or how and why I made HTTP Status 418 a load bearing part of an internal API, and why it was the least bad option considering the constraints.
- renewiltord 2y agoIt’s a classic. Binance will give you 429 errors to back off then 418s to tell you you will be IP banned and then they’ll ban you.
- wodenokoto 2y agoAt work we have a data providers whose API always returns 200, often with the text content “ERROR: …” And that’s how put Hyrums law into effect.
- mox111 2y agoPerhaps some package authors are more accepting of this than others. I stumbled upon this comment in the `json` package the other day: // isValidNumber reports whether s is a valid JSON number literal. // // isValidNumber should be an internal detail, // but widely used packages access it using linkname. // Notable members of the hall of shame include: // - github.com/bytedance/sonic
- algorithmsRcool 2y agoAnother related effect of this is Protocol Ossification [0] which happens when implementers of a public API/Protocol surface area take implicit dependencies on common but not standardized behaviors of the API/Protocol implementation. That being said, you can take proactive steps to defeat this. For example, the default Hash for strings in .NET is randomly seeded each time a process starts[1] in order to strongly dissuade folks from taking an implicit dependency on the underlying algorithm which is not guaranteed to be stable [0] : https://en.wikipedia.org/wiki/Protocol_ossification https://en.wikipedia.org/wiki/Protocol_ossification [1] : https://andrewlock.net/why-is-string-gethashcode-different-each-time-i-run-my-program-in-net-core/ https://andrewlock.net/why-is-string-gethashcode-different-e...
- dhosek 2y agoAt one job, I found a misspelling in an error message and fixing it only to discover that the web of dependencies on that misspelled text was so deep that it was impractical to fix and had to return to the misspelled text. It still bugs me.
- forbiddenlake 2y agoAre you Phillip Hallam-Baker? :) https://en.wikipedia.org/wiki/HTTP_referer https://en.wikipedia.org/wiki/HTTP_referer
- fulafel 2y agoAt least in the post context there's still time to fix "Golang".
- lokar 2y agoPeople who parse text error messages deserve what they get
- jgeada 2y agoI think Hyrum's law really depends on APIs not applying consequences to people that depend on non-guaranteed behavior. The world needs more consequences for poor behavior. Just randomly change the non-guaranteed stuff in every release and this behavior likely would stop and/or you'd lose the users that don't know any better. Both sides of that sound like a win to me.
- inlined 2y agoGo seems really sensitive to this subject. Maps iterate in order, but one day they said “this is incidental and we said not to rely on it. You do, so we’re breaking it in a minor release” and now maps iterate in order… from a random offset
- kbolino 2y agoOn the one hand, I never realized that map iteration order was consistent, but it's just the starting point that changes. On the other hand, I guess there's no other way to do it, since a proper shuffle would require O(n) bookkeeping. I suppose you could also flip a coin for going backwards too.
- souenzzo 2y agoClojure manages to do improvement to the language, without breaking the users. Most of improvements are "additions", it is never a "change" or "re-do something better" It is an awesome experience be able to upgrade the language anytime with no fear or pain.
- ivanjermakov 2y agoI don't know. I think Hyrum's law should not prevent the project from advancing. If the user is so dependent on non-contact behavior of the API, they have to expect that some logic might break even on minor version updates.
- jnordwick 2y agoDoes anybody else always read this as Hyrule's Law?
- aidenn0 2y agoMany occurrences of Hyrum's are "desire paths[1]" of APIs. For many people, the most obvious way to determine if the error was a MaxBytesError was to check the string. I'm not familiar with Go, but assuming it has RTTI, I'm guessing the intended path for people to take was to check the type of the error against MaxBytesError, and occurrences of this were people who either didn't know that, or found the error string to be immediately available in their tooling, but the type not immediately available. [edit] Per [2], this looks desire paths is even more an apt analogy than I thought; until 3 years ago, this code returned a generic Error type. 1: https://en.wikipedia.org/wiki/Desire_path https://en.wikipedia.org/wiki/Desire_path 2: https://news.ycombinator.com/item?id=42202472 https://news.ycombinator.com/item?id=42202472
- adrianmsmith 2y agoIt's interesting that this law is the exact opposite of the Robustness Principle / Postel's Law. > be conservative in what you send, be liberal in what you accept If you are liberal in what you accept, you'd better understand the ways in which you've been liberal, and document them (at least) internally, because you're going to have to support all those ways forever, even after huge codebase changes, due to Hyrum's Law. I try to avoid creating APIs which are "liberal in what they accept" for exactly that reason.
- remus 2y ago> I try to avoid creating APIs which are "liberal in what they accept" for exactly that reason. That's my preference too. When you have relaxed criteria about what kind of data you accept via an API I find you inevitably end up having to make decisions about how to massage that data in to some sort of canonical format, and those decisions almost always seem to end up leading to behaviour that's surprising to users in one way or another.
- jameson 2y agowhat I learned from shipping APIs: 1. Clients will do whatever they need to do get their job done, even if it's not the publisher's intended way 2. Clients don't read documentation 3. Bugs will become part of API once enough clients rely on their behavior 4. The number of API calls does not necessarily equate to importance. --- As such, I aim for the following when developing an API 1. Ship the beta API early and see how they use it to minimize the surprise. (This may not always be possible) 2. In most cases, bump up the major version while supporting the previous version. This means you'll need to define SLA for your API 3. Most clients are OK with breakages as long as they are given enough time to migrate, or the API provider gives them a tool to auto-migrate the code (if that's possible in your product)
- evanfarrar 2y agoWhat do they call the law that says they can’t increase the major version?
- remus 2y ago"Guido's Law" perhaps?
- sublimefire 2y agoThere are cases when you need to make a choice if you want to fix the bug as it might break many people who rely on it. There is no real good answer but to be able to look forward and anticipate the misuse.
- nicocesar 2y agosee also https://news.ycombinator.com/item?id=16286764 https://news.ycombinator.com/item?id=16286764
- tonymet 2y ago> to design systems in a way that minimizes the chances of unintended go team did their best to define a custom MaxSizeError to discourage developers from the flimsy string dependency. Every system hits a limit on the amount of guard rails and protections needed to protect foolish customers from their own bad behavior. Sometimes you need to deliberately break dependencies that were never meant to exist to reveal the vulnerabilities in a system.
- jimjimjim 2y agoI wish someone in the Chrome team knew about Hyrum's Law before they released a breaking change in the way chrome validates custom URLs.
- zaptheimpaler 2y agoIt's sort of Hyrum's Law but it's really just Go being Go. The error could've been an enum type that could be changed with only a string replace for consumers. Instead they are using strings as types, so now you have no idea how consumers might rely on it. They could check the middle 6 chars of the error and break if you change it. It's another terrible anachronistic design decision when better alternatives have been in use in other languages for decades. Early mistakes + inability to change things means you're stuck forever.
- nitwit005 2y agoYes, sadly, the comment is essentially incorrect. The strings were their official API in many cases.
- andrewfromx 2y agolike https://en.wikipedia.org/wiki/HTTP_referer https://en.wikipedia.org/wiki/HTTP_referer can't be referrer ever
- earthboundkid 2y agoI wrote "// Due to Hyrum's law, this text cannot be changed." AMA.
- rotbart 2y agoHyrum's Law especially applies when you have consumers of your APIs that violate Postel's Law. To minimise those in the past, we've introduced intentional jitter in our API responses that while didn't violate the schema prevented unintentional reliance on behaviour that wasn't intentional[1]. [1]: <https://medium.com/pageup-tech/update-on-driving-client-resiliency-how-we-enforced-postels-law-by-violating-postel-s-law-7cd51bf15baa https://medium.com/pageup-tech/update-on-driving-client-resi...>
- thayne 2y agoIME, one of the places hyrums law shows up the most is in tests. I've seen tests of various types (unit, integration end-to-end) break because they made assumptions about behaviors that weren't garanteed, and supposedly backwards compatible updates broke them. Here are some examples of things that have broken tests: - an update resulted in a change in the order of elements in a Hashmap or set. - a change in an error message (or other user-facing message), changed - a change in how leap days are handled for datetime arithmetic - change in the format of locale-specific datetimes - the timezone offset for a given area - removal of internal-only APIs that were accessed using reflection - something performed faster, which revealed race conditions in the testing code - changing the precise representation of some data format. To give a specific example, changing a single byte when gzip compressing a file, that has no impact on the compressed content.
- kazinator 2y agoThe only reason we care about this law is that the end users matter. If we can change a misused API such that things break only for the misusing developer, then that is usually a who-cares. Sometimes that developer is in the same organization that you're in, and their users are your users. Sometimes that developer is no longer in your organization and their code is your code.