| ▲ | gingersnap 4 hours ago |
| I start to see a lot of these re-writes that depend on tests to state that its working. But the things that make software like Postgres and SQLite reliable are not mostly the test, but the real world production scars. That's where the reliability comes from, years and years of running in production. |
|
| ▲ | sshine 3 hours ago | parent | next [-] |
| > not mostly the test, but the real world production scars Most extensive test suites are exactly production scars: every time you have a bug or a regression, you write a test that confirms correct behaviour. SQLite is a good example to bring up because its extensive closed-source tests are what’s often cited as being what keeps people from forking it. (Turso did it, though, but it takes a company to deliver some guarantee of equivalent diligence.) And yes, years and years of running. |
| |
| ▲ | kelnos 3 hours ago | parent | next [-] | | Sure, but behaviors that never have a bug or regression don't get a test. Software of this kind of complexity has all kinds of behavior that has never been broken, and doesn't have a specific test written for it. Getting an extensive test suite passing is certainly orders of magnitude better than having no test suite at all, but it still doesn't tell you as much as you need to know. I would absolutely never trust an LLM Postgres rewrite (in any language) in production based on "only" Postgres's test suite passing. | | |
| ▲ | bob1029 3 hours ago | parent | next [-] | | > Software of this kind of complexity has all kinds of behavior that has never been broken This space of things is astronomically larger than the space of things expressly covered by any test suite. "Program testing can be used to show the presence of bugs, but never to show their absence." -Edsger W. Dijkstra | | |
| ▲ | mbrock 3 minutes ago | parent | next [-] | | The same basically holds for proofs in the absence of coherent global correctness criteria like, say, confluence and normalization for a lambda calculus, or soundness and completeness for a logic. Fable's napkin estimate of the effort required to produce a passable reference semantics for Postgres, which would involve novel discoveries in denotational semantics of concurrent transactions and so on, might be in the ballpark of 30–60 years of PhD level work. So realistically I think the only way to validate a Postgres implementation involves differential testing, fuzzing, acceptance test suites, etc. And still you'll have bugs that need to be hammered out the good old fashioned way. | |
| ▲ | w4der 2 hours ago | parent | prev [-] | | I've also seen situations where a customer reports a bug, the fix breaks some regression, and the updated behavior to work around the fix breaking the regressions turns into an undocumented feature. |
| |
| ▲ | gblargg 3 hours ago | parent | prev | next [-] | | Or even a human rewrite merely because some language is the current fad. A rewrite in a different language should be done for very good reasons, to solve problems that are bigger than the costs of all the bugs that will be introduced. | |
| ▲ | gb2d_hn 3 hours ago | parent | prev [-] | | Agreed.And a rewrite in another language creates a high probability of a change in behaviour |
| |
| ▲ | hvb2 3 hours ago | parent | prev | next [-] | | The maintainers that wrote those tests will have experience you won't get out of a rewrite. I think this is also where the real work is. A rewrite is one thing, that you can show off with a flashy blogpost. The maintenance, for years to come, won't be of that nature yet it still requires as much work. | |
| ▲ | martin-adams 2 hours ago | parent | prev | next [-] | | This feels like the image of the plane that returns from battle with bullet holes, and the engineer being asked to path up where the holes to make it stronger. Only to be told to patch where there weren't holes as those planes didn't make it home. While not an exact fit of an analogy, those tests patch what was a problem with Postgres in the wild. What it doesn't cover are the things that worked in Postgres without tests, but may fail in port and go undetected. | |
| ▲ | rustyhancock 3 hours ago | parent | prev | next [-] | | One issue is those are the bugs you get when you write it in C++. They aren't the bugs you get when you write it in Rust. The kind of bugs you get are usually a function of the problem, language, implementation approach. | | |
| ▲ | consp 3 hours ago | parent [-] | | So you get other bugs when rewriting in another language without existing tests, got it. This is why I hate all the announcements of "it is rewritten in rust so it is obviously better than the original since it passes all the tests". Edit: and it's an LLM rewrite. Add that to the pile of over hyped messaging. | | |
| ▲ | baranul 2 hours ago | parent [-] | | Unfortunately, too many people are getting captured by marketing and are divorcing themselves from reality. A rewrite can be an improvement, even if in the same or any other language. But, there are also levels, in terms of quality and human code review, when dealing with rewrites. New bugs can be introduced or there can be style issues, that can take time to fully reveal themselves, and particularly if the person or people involved are not familiar with the other language. |
|
| |
| ▲ | nicce 2 hours ago | parent | prev | next [-] | | > Most extensive test suites are exactly production scars: every time you have a bug or a regression, you write a test that confirms correct behaviour. If you can be 100% guaranteed that there indeed is a test for every occurred bug. Sometimes maintainers are not so strict about it. And some programmers are so good that some issues are self-explanatory and they write good code to note a thing but don't write a test, because implementing the test is more expensive. | |
| ▲ | byzantinegene 2 hours ago | parent | prev | next [-] | | a code written to pass a test can surface unintended new bugs. | |
| ▲ | 3 hours ago | parent | prev | next [-] | | [deleted] | |
| ▲ | _s_a_m_ 2 hours ago | parent | prev [-] | | very naive. the runtime behavior of a rewrite should be significantly different in all kinds of unpredictable ways nobody see coming or might expect. It is a combination of language semantics, compiler behavior, operating system behavior, file system behavior, driver behavior, .. |
|
|
| ▲ | nextaccountic 2 hours ago | parent | prev | next [-] |
| > I start to see a lot of these re-writes that depend on tests to state that its working. There's another way to validate the rewrite though. Just run both pgrust and postgres and compare the output. Know of an edge case? Run it too. Doesn't know? Use a fuzzer or some automated tool to find interesting inputs. Found an inconsistency? The input/output pair becomes a test case now Not sure if there's tooling for that though. If there is, just give it to Claude so they will incorporate it in their development loop |
|
| ▲ | xlii 2 hours ago | parent | prev | next [-] |
| As sibling mentioned - bugs and regressions are the thing that are (in a perfect world) usually covered. The problem however is non-covered success cases. A visualisation of the problem: let's say universe of interaction for DB consists of 10.000 SQL queries. Over 10 years various regressions were found and 2.000 SQL queries are guarded by tests. In reference implementation remaining 8.000 never surfaced over this time and it's unclear if they will work. And, thinking of how many various SQL queries PostgreSQL users around the world are using vs the test cases covered it's obvious that feature space isn't covered in 1% of the success ratio cases. Now the new, test-based implementation, has to prove it can handle remaining 99%. |
|
| ▲ | thunderbong 3 hours ago | parent | prev | next [-] |
| I agree. I also agree with the sibling reply that - > every time you have a bug or a regression, you write a test that confirms correct behaviour. What I fail to see in these rewrites however is - what about new bugs introduced by virtue of this rewrite? I mean it'll have to go through its own challenges in real-world scenarios, right? |
|
| ▲ | mrklol 3 hours ago | parent | prev | next [-] |
| And also the amount of people running it in thousands of scenarios. Not sure if these areas can be even tested for, but I guess time will tell (can observe Bun if it breaks somewhere as that’s afaik the first big AI rewrite which got into prod for masses). |
| |
| ▲ | joshka 3 hours ago | parent [-] | | A lot of the signal (github, forums, mailing lists, discord, etc.) can be turned into signal. Right now it's easy enough to collect. In future it will be easy enough to cluster and generate preferences, experience, etc. Every bug report, code change as a result, PR / commit message, PR comment that steers preferences, etc. is solid signal to generate future tests. |
|
|
| ▲ | hk__2 3 hours ago | parent | prev | next [-] |
| The test suite is the result of these years of years of running in production. Every time you fix a bug, you add a non-regression test to ensure you don’t break it again. |
|
| ▲ | 3 hours ago | parent | prev | next [-] |
| [deleted] |
|
| ▲ | kstrauser 3 hours ago | parent | prev | next [-] |
| In a project like PostgreSQL, those scars are reflected in unit tests demonstrating that they’re fixed. It’d be hard to pass its test suite and not be as robust as the original. |
| |
| ▲ | simiones 3 hours ago | parent | next [-] | | > It’d be hard to pass its test suite and not be as robust as the original. This is not true, even in principle, even for Postgres itself. You'd be right to say that it'd be hard to pass the test suite and not be robust at all to some extent. But even in Postgres, I bet that you can quite easily introduce a change that will pass the whole test suite but reduce robustness compared to the latest release (for a somewhat silly example, add a call to `exit()` on a timer that's longer than the longest duration test in the suite - that will significantly reduce robustness while still passing the entire test suite). | |
| ▲ | dwedge 3 hours ago | parent | prev | next [-] | | Sure but these scars/tests are from the original implementation. Just because it doesn't have issues there doesn't mean it didn't bring its own set of issues | |
| ▲ | ShinTakuya 3 hours ago | parent | prev | next [-] | | This is all well and good in theory, but the number of times I've seen tests that don't actually test what they say they're testing is hard to count. Yes even when you encourage the developers to ensure the test fails first and do TDD. Tests help you ship with confidence but there's usually at least a few that are just passing by pure luck. So no, I wouldn't judge a rewrite as being equal just because it passes the tests. That said, I don't think that means you shouldn't do it. You just have to be pragmatic about it. | |
| ▲ | kelnos 3 hours ago | parent | prev | next [-] | | Passing a regression test suite only proves that those particular regressions aren't present. It proves nothing about robustness beyond that. | |
| ▲ | guenthert 3 hours ago | parent | prev | next [-] | | They ought to, but are they? In https://wiki.postgresql.org/wiki/Developer_FAQ I don't see a requirement to provide a regression test for a bug fix. | | | |
| ▲ | tpetry 3 hours ago | parent | prev | next [-] | | You immply that a testcase exists for every weird edge case. Especially filesystem and concurrency is things you can barely build test cases for. Even a 100% test coversge is far away from verifying all behaviour. | |
| ▲ | oblio 3 hours ago | parent | prev [-] | | Edsger W. Dijkstra: "Program testing can be used to show the presence of bugs, but never to show their absence!" |
|
|
| ▲ | zsoltkacsandi 3 hours ago | parent | prev | next [-] |
| Completely agree with this. The biggest lie of software engineering is that everything can be testable with tests. That a 100% test coverage is an indicator of quality software. |
|
| ▲ | rowanG077 3 hours ago | parent | prev | next [-] |
| That's precisely what a regression test suite is for. There is a bug, you fix the bug, you add a regression test. So if the test suite is well maintained these real world production scars are reflected in the tests. |
|
| ▲ | Lomlioto 2 hours ago | parent | prev | next [-] |
| I hope you are not true at all. Software like a Database should have an extensive test bench with concurrency tests, all corner cases etc. I'm not here running the new version on production to tell the maintainer/devs that my 'production unit tests failed'. What is this even for logic? I mean there is balance when i write tests for my production software, but my software is used by me. If i would have a library, i would test everything. And there was some blog post about another database system were they even virtualized the File access to test cases like when the disk controller stops working. |
|
| ▲ | throwaway132448 3 hours ago | parent | prev [-] |
| Wait - does the AI rewrite the tests too? If so, lol. |