Hold 0071's rule as data, and check that the statement is not short (#71) - #289
Merged
Merged
Conversation
) 0071 refuses a diagnostics bundle assembled by the core: 0068 and 0100 both fix that an event is handed over and forgotten in the same call, so there is no store of past events here to assemble one out of. What that record asks for instead is the rule as data - for each field name the core has ever emitted, which of the three treatments it applies - so a client assembling a bundle out of what its own sink kept can include the statement verbatim and whoever is about to send it can read what is not in it. Nothing in the tree produced it. `lifecycle::every_field_name_the_core_emits` is that statement. It is gathered there because a field name lives beside the event identity that carries it, which is 0100's placement and what 0071 wants, so the only place that sees all of them is the one that sees every subsystem, which 0115 makes creation. The nine names two cache modules declare become visible to the crate and to nothing outside it. The one way that statement can be wrong in the direction that matters is by being SHORT. A subsystem can declare a name and emit it while the gathered list does not move; the statement is then incomplete and goes on reading as complete, and a bundle carrying it tells somebody a value is not in their events when it is. Nothing inside the crate can catch that, because a missing entry is a shorter array rather than an error. tests/the_rule_as_data_names_every_field.rs is what catches it. Its subject is the source read as bytes, which is why it is out there rather than in the crate: `no-filesystem-access` refuses `std::fs` under `src/`, and reading the tree is exactly what this has to do. It compares the names declared outside every file's own test module against the statement in both directions, and it checks that the treatment stated for a name is the one its declaration gave it, which is 0071's own reversal condition. The skip that test rests on is narrower than it looks and it was watched failing: taking the string `#[cfg(test)]` anywhere cuts three files off above their declarations, because each mentions the attribute inside a doc comment, so what is matched is a line that is exactly that at column zero, and a case asserts no file carries two of them. Signed-off-by: Nils Lehnen <30603423+iderex@users.noreply.github.com>
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 issue this belongs to
Refs #71. It reaches the third of that issue's conditions in the form 0071
substitutes for it, and neither of the other two, so no closing keyword is
written here: four landings on this board have written "does not close #N" and
GitHub read the keyword out of the sentence with the negation discarded.
What changed
#71's third condition is that the bundle names its own exclusions, and
docs/decisions/0071-what-may-leave-through-a-diagnostic-event.mdanswers it byrefusing the bundle. 0068 and 0100 both fix that an event is handed over and
forgotten in the same call, with no ring buffer and nothing retained, so there is
no store of past events for the core to assemble one out of. What that record
asks the core for instead is the rule as data: for each field name it has ever
emitted, which of the three treatments it applies. A client assembling a bundle
out of what its own sink kept includes the statement verbatim, so whoever is
about to send it can read what is not in it. Nothing in the tree produced it.
lifecycle::every_field_name_the_core_emitsis that statement. It is gatheredthere rather than in
src/diagnostics/because 0071 deliberately keeps a fieldname beside the event identity that carries it, which is 0100's placement, so the
only place that sees all of them is the place that sees every subsystem, and
0115 makes that creation. The nine names the two cache modules declare become
visible to the crate and to nothing outside it.
What failure it prevents
The one way the statement can be wrong in the direction that matters is by being
SHORT. A subsystem declares a name beside its event and emits it, the gathered
list does not move, and the statement is then incomplete while it goes on reading
as complete. A bundle carrying it tells somebody a value is not in their events
when it is, which is worse than saying nothing, and it is exactly the shape 0071
exists against.
Nothing inside the crate can catch that. The list and the declarations are the
same kind of thing to the compiler, and a missing entry is a shorter array rather
than an error.
tests/the_rule_as_data_names_every_field.rscatches it. Its subject is thesource read as bytes, which is why it is a test target rather than a case in the
module:
no-filesystem-accessin.github/invariants/rulesrefusesstd::fsunder
src/, grounded in 0003, and reading the tree is exactly what this has todo. It compares what the tree declares against the statement in both directions,
and it checks that the treatment stated for a name is the one its declaration
gave it, which is 0071's own reversal condition rather than a worry invented
here.
Evidence
Read at the commit being pushed.
The last two of those four are inside their own file's test module and the
scanner skips them, which is what the module documentation on that test file says
and what the second case below is about.
The gate legs that need no network on this machine:
What a guard here refuses, and the proof it bites
Four deliberate violations, each run with
cargo test --locked --test the_rule_as_data_names_every_field. The green run isthe one above: 5 passed, 0 failed.
THE ONE THIS EXISTS FOR: a subsystem declares a name and does not register
it. A tenth name was added beside the nine in
src/cache/bound.rsand nothingelse was touched:
A registered name dropped from the statement, which is the same failure
arriving from the other side.
bound::SUSPENDED_FORwas removed from the list:The statement naming one field twice, which is where a name and a treatment
could disagree inside one list:
The one reduced field replaced by a carried-whole one, which is the pair
0071 says comes apart:
And the skip the scanner rests on was watched failing on the tree itself, on
its first run. It began as "everything after the first
#[cfg(test)]in afile", and
no_source_file_carries_more_than_one_test_modulewent red at once:The second occurrence is the attribute mentioned inside a doc comment, in that
file and in two others. Taking the string anywhere would have cut three files off
above their declarations and reported a green run over source it never read. What
is matched is a line that is exactly
#[cfg(test)]at column zero, and the casenow asserts no file carries two of those, so the skip cannot quietly widen.
What this does not cover
Two of #71's three conditions. The rule being recorded is met by 0071 and was
before this. A test driving a full session at the most verbose level and
searching the output for every named personal field needs a session, a transport
and a sign-in, none of which exists.
Whether a treatment is the RIGHT one for a name. That is 0068's judgement,
no reading of this tree makes it, and
src/diagnostics/redaction.rsalready saysso of itself. Everything here is about the name and the treatment agreeing, never
about the treatment being correct.
A name assembled rather than written as a literal. The three constructors
take a
&'static strand every declaration in this tree passes a literal, so thescanner finds them. One built some other way is invisible to it, and would also
be a departure from what 0071 says a name is.
The statement is what THIS BUILD emits and is not a promise about a client's
sink. 0071's own sentence, and it is in the doc comment rather than only here.
No field this build emits is excluded. 0071 puts the session token and
anything derived from it under that treatment and nothing in this tree emits one
yet, so a bundle assembled today holds a correlator for one field and nothing at
all for none. The case that reads the set asserts that emptiness rather than
passing over it, so the day an excluded field arrives it is a red run and a
decision rather than a silent change to what a bundle says.
Two files outside this change's own subject were touched, and they are
src/cache/bound.rsandsrc/cache/envelope.rs. What changed in each is thevisibility of the field-name constants, from private to crate-visible, with no
change to a value, a name or a treatment. #42 and #105 own those files and
neither is moved by this.
The
targetsandthread-detectorlegs did not run here. One needs crosstoolchains this machine has not set up and the other a nightly compiler it does
not carry.
Nothing was run that could raise a consent prompt on this machine.
Who has read it
Nobody other than me. There was no second reader available for it, and the
evidence above stands in place of one.