carry the whole condition out of a failure, and test that we do - #6
Merged
Merged
Conversation
The scorecard item asks that every failure carry the standard's condition code, the place, and the doc URL, checked by a test rather than promised in a page. Two things were missing. The wrapper was reading five of the nine error accessors the ABI offers. Gone were the subject and its kind, which is the pair a tool acts on rather than prints, and the graph and schema, which a host with more than one graph open needs in order to say which one refused the statement. A caller wanting to underline the bad name had to find it in the sentence and parse it back out from between the quotes, and that works until somebody rewords the sentence. Error now copies all four and hands them out beside the rest. Then the test file, which is the part the item is actually about. Ten cases over the fields one at a time: the code and its class and the page it is written up on, the doc URL ending in the code it is the page for across four conditions from three classes, the line and column and byte offset and the excerpt and where the caret lands under them, the subject and its kind for two different names under one code, the graph and schema, and a division by zero carrying no position rather than a made up one. Every expected value in there was read off the running engine before it was written down. Two of them are worth calling out. The offset and the column are the same place said two ways and they only stop agreeing once there is a character outside ASCII on the line, so that case runs a statement with an earth in it and pins the offset three past the ASCII arithmetic; a client handing an editor the column where a byte index was wanted underlines the right word in every test written in ASCII. And the last case is the gap rather than a pass. A connection that could not be opened and an appender aimed at a table nothing declares carry a status and a sentence and nothing else, no code and no standard text and no doc URL, so this client does not hold the item honestly yet. It is asserted rather than skipped so that the day the engine attaches conditions to the failures that happen beside a statement, this fails and somebody comes and reads the comment.
tamnd
added a commit
to tamnd/zu
that referenced
this pull request
Aug 22, 2026
zu-c now carries the whole of a refusal and has a suite saying so, in tamnd/zu-c#6, so the row picks up the ten points and goes to 22. The item's own line gets a note rather than a rewrite. It reads "every failure" and no client holds that today, because the fields are not there to hold: a database that will not open and an appender aimed at a table nothing declares come back with a message and no code, no standard text and no doc URL. That is #614. It caps this item for all seven rows and not for one of them, so it belongs at the item where a reader meets it, rather than scored against whichever client last went looking. Lowering the item's wording would have hidden the gap instead, and the other four rows have claimed conditions on the statement reading all along, so scoring zu-c by a stricter one would make the column stop comparing.
22 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
conditionsitem on the scorecard asks that every failure carry the standard's condition code, the place, and the doc URL, checked by a test rather than promised in a page. Two things were in the way.Four accessors the wrapper never read
zu.hoffers nine ways to ask an error what it is about andzu::Errorwas reading five. Missing weresubject_kindandsubject, andgraphandschema.The subject pair is the one that matters most. A refusal about a name currently reaches a caller only as English with quotes in it, so a tool that wants to underline the bad identifier or suggest a near spelling has to parse the name back out of the sentence, and that works right up until somebody rewords the sentence. With the pair,
RETURN nopesays variable and nope,RETURN nosuchfn(1)says function and nosuchfn, and those two carry the same code as each other, which is the whole reason the subject is a field. Graph and schema say which graph the statement was running in, which a host with more than one open cannot work out any other way.Error::takecopies all four the way it copies the rest, so they still read after thezu_erroris freed and the connection is gone.The test file
Ten cases, one field at a time, in
test/test_conditions.cpp. The message is barely checked because the message is the part that is allowed to be reworded; the code, the class, the doc URL and the subject are the parts a program acts on and those are checked exactly. Every expected value in there was read off the running engine before it was written down.Two are worth calling out.
The doc URL case loops over four conditions from three different classes and asserts the URL ends in the code it is the page for. A URL that is present but points at another condition is worse than none, because the reader believes it, and one built from a constant somewhere would pass a single case happily.
The offset case is a pair. The offset and the column are the same place said two ways and they only stop agreeing once there is a character outside ASCII on the line. The ASCII statement has offset one below the column; the statement with an earth in it has offset three above, because three of the four bytes are columns nobody counted. A client that hands an editor the column where a byte index was wanted underlines the right word in every test written in ASCII, so this is the shape of case that catches it.
The gap, written down rather than skipped
The last case is not a pass, it is a record. Everything else here is a statement the engine refused and those carry the whole of it. A connection that could not be opened, and an appender aimed at a table nothing declares, carry a status and a sentence and nothing else: no code, no standard text, no doc URL. The item says every failure, so zu-c does not hold it honestly until the engine attaches conditions to the failures that happen before or beside a statement.
It is asserted rather than left alone so that the day it changes, this case fails and somebody comes and reads the comment explaining why it was written that way.
Checked
37 of 37 green on server3 with gcc 13 against libzu at engine HEAD, both the C++23 build and the C++20 floor,
test_conditionsandtest_conditions_cxx20among them.