Refuse a span name declared in the enum and missing from the published set (#61) - #299
Merged
Merged
Conversation
…d set (#61) 0061 requires every span name to be declared in one place in the tree, and gives #67 as one of its two reasons: a set derivable by reading one file is a set a run can print rather than one somebody keeps a list of. `SpanName::all` is that set, and it is a second list beside the enum. The compiler refuses a variant missing an arm in `SpanName::as_str` and says nothing about one missing from `SpanName::all`, so the failure that list can have is silent: a span the core emits and the published set does not name, with nothing anywhere going red. That is the shape declaring the names in one place exists to prevent, arriving inside the place they are declared. It matters most exactly when 0061 says the six sub-intervals arrive. Each is placed with the issue that builds the subsystem emitting it, so six people add six variants at six different times, and every one of them is a chance for the enum and the set to come apart by one. The case reads the enum out of this file's own source, embedded at compile time because `std::fs` under `src/` is refused by the `no-filesystem-access` rule, and compares it against `SpanName::all`. It carries a floor as well: a reading that finds fewer variants than the enum has fails rather than passing quietly, because a parser that stopped matching finds nothing and reads exactly like a set with no difference in it. Watched failing on a variant added to the enum and not to the set, and watched staying green on the same variant added to both; PR #299 carries both runs. 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
Belongs to #61. None of that issue's three conditions moves here, and the reason
is the one already on it: the first waits on the subsystems that own the six
sub-intervals, the second is met, and the third is met as far as 0061 states it
and open on a number #65 would produce.
What this is about is the thing that makes the first condition dangerous when it
does arrive.
What changed
SpanName::allis a second list beside the enum, and nothing kept the twotogether. A case does now, reading the enum out of this file's own source and
comparing it against the set.
What failure it prevents
A span the core emits that the published set does not name, with nothing anywhere
going red.
0061 gives two reasons for declaring every name in one place, and the first is
#67: a set derivable by reading one file is a set a run can print rather than one
somebody keeps a list of.
The compiler already refuses half of it. A variant with no arm in
SpanName::as_strdoes not compile. It has nothing to say about a variantmissing from
SpanName::all, so the set goes short in silence, and a documentgenerated under #67 then names fewer spans than the build emits while reading as
complete. That is the same failure the record's last sentence describes, reached
from the other side.
It matters most exactly when this issue's first condition arrives. 0061 places
each sub-interval's identity with the issue that builds the subsystem emitting
it, so the six arrive one at a time from six different issues:
Six people, six moments, six chances for the two lists to come apart by one. This
has not happened, because the enum has carried three variants since it landed and
both lists name all three. It is stated as what the shape allows rather than as an
incident.
The neighbouring register in this crate already carries the same disclosure and
has its own reading built for it, which is why this is the shape rather than an
invention:
Evidence
The commit being pushed:
The two commands
CONTRIBUTING.mdnames, run at it:Four gate legs run by hand on this machine:
What a guard here refuses, and the proof it bites
every_variant_of_the_enum_is_in_the_declared_setrefuses a variant declared inthe enum and absent from
SpanName::all. Every run below iscargo test --locked --lib measurement, and the green run at the head is:The violation is the change the seventh person makes, adding a sub-interval to
the enum and to
as_strand forgetting the set, which is the only one of thethree the compiler does not ask for:
The near miss, which is the same variant added to all three places, and which
has to stay green or the guard refuses the work it exists to protect:
The case also carries a floor: a reading that finds fewer variants than the enum
has fails rather than passing quietly. A parser that stopped matching finds
nothing, reports no difference, and reads exactly like a set that is complete.
That the gate scripts in this tree refuse the same shape - an empty register, a
run that collected nothing, a scanner pointed at a moved file - is a claim, made
from
CONTRIBUTING.md's descriptions of them rather than from a count of thescripts.
What this does not cover
The reading is text. It finds the enum by its declaration and takes the
single-word capitalised lines inside it, so a variant written in a shape this
tree does not use - one carrying a payload, or one behind an attribute on its own
line - is not seen. The floor catches a reading that collapses to nothing and does
not catch one short by exactly the variant somebody added.
The other direction is not asked because the compiler already refuses it: a member
of
SpanName::allnames a variant, and a variant that does not exist does notcompile.
Nothing here says whether a name means what it says, which 0061 places outside
what any reading of this file makes.
None of #61's three conditions moves. No span is emitted by any subsystem, which
is the first, and nothing here adds a name to the set.
The equivalent gap in
crate::lifecycle's field-name statement already has itsown reading in
tests/the_rule_as_data_names_every_field.rs. Neither register ischanged here.
The coverage leg was not run on this machine, and
src/measurement/is not on thepinned surface, which that register states as a deliberate exclusion rather than a
claim about coverage.
Who has read it
Nobody other than me. There was no second reader available, and the evidence above
stands in place of one.