An example that produces the code - #966
Merged
Merged
Conversation
`deed explain DEED2011` says "there is no range in this language" and printed
this program:
module a
fn f() -> Int {
Int n = 1
n
}
That is DEED2010. Forty-three of the eighty-nine pages carrying an example
showed a program that does not produce the code, measured by checking each one
and running its tests.
The example was "the first deed-looking string in a test that mentions this
code", which is a different claim from "a program that produces it". Two
shapes: the extractor read a test from its `#[test]` to the next `#[test]`, so
it swallowed the banner introducing the following test, and every code named in
a banner was offered the previous test's program; and where a test carried two
modules or a passing control arm, the first string was the wrong half.
This is read by `deed explain`, by the `deed_explain` MCP tool and by the error
index the site builds from the same artefact, so an agent asking what a code
means was handed a program about a different one.
The example is now the first candidate that produces the code, asked of the
compiler: checked, and run when the code only appears at run time. Seventy-five
pages carry one and every one is verified; the other twenty-nine carry none.
The generator moved to `crates/deed-driver/tests/explain_pages.rs`. Deciding
this needs a checker, and `deed-explain` depends on nothing on purpose --
making it depend on the compiler to test itself puts two published crates in a
dependency cycle `cargo publish` cannot order. Measured before choosing:
`cargo metadata` resolves such a cycle happily and `--dry-run` would not have
said otherwise, which is the reason to decide it on the real command's terms.
Two gates, both break-verified:
- `every_example_produces_the_code_its_page_is_about` reads the committed
pages, not the tree, so it holds what a reader gets.
- `a_test_body_ends_before_what_introduces_the_next_one` holds the window.
The floor in `explain.rs` moves from 76 to 75 and now says why a lower number
is the better one.
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.
deed explain DEED2011says "there is no range in this language", and printedthis:
That program produces DEED2010. There is no range in it.
Measured
Every page's example, checked, and run when the code only appears at run time:
Why
The example was "the first deed-looking string in a test that mentions this
code", which is a different claim from "a program that produces it". Two
shapes:
The extractor read a test from its
#[test]to the next#[test], sothe window swallowed whatever introduced the following test. These files
introduce a test with a banner naming its code:
// -- DEED2011, a range ------------------------------------------------so every code named that way matched the previous test's window first.
That is the whole DEED2002…DEED2012 run, each page holding its predecessor's
program.
Where a test carried two modules, or a passing control arm, the first string
was the wrong half.
DEED4006(non-exhaustive match) showed one module of atwo-module program, which on its own produces
DEED3007, "no moduleother".This artefact is read by
deed explain, by thedeed_explainMCP tool, and bythe error index the site builds. An agent asking what a code means was handed a
program about a different one.
The rule now
An example is the first candidate that produces the code, asked of the
compiler. Every deed snippet in every test naming the code is a candidate.
Fourteen pages traded a wrong program for no program. A page with nothing true
to show should show nothing, and
Page::examplewas alreadyOption.DEED2011now prints the range.DEED4025prints a call that breaks aprecondition.
Why the generator moved
To
crates/deed-driver/tests/explain_pages.rs. Deciding that a programproduces a code takes a checker, and
deed-explaindepends on nothing onpurpose — it is data. Letting it dev-depend on
deed-driverputs two publishedcrates in a dependency cycle, and neither could then be published first.
Measured before choosing rather than assumed:
cargo metadataresolves thatcycle without complaint, and
cargo publish --dry-runwould not have saidotherwise. Deciding it on the dry run's terms is exactly the mistake that costs
a release.
deed-explainkeeps its packaging tests, which are about a different bug andstill hold.
Gates
Both break-verified:
every_example_produces_the_code_its_page_is_aboutreads the committedpages, not the tree, so it holds what a reader of the shipped compiler gets
even if the generator is never run again.
a_test_body_ends_before_what_introduces_the_next_oneholds the window on afixture with the banner in it.
explain.rsmoves 76 → 75 and now records why the lower numberis the better one, so nobody buys it back with programs that do not produce
the code.
Checks
cargo fmt,clippy -D warnings,nextest --profile ci(2438 passed, 4skipped),
cargo test --doc --workspace. Regeneration takes about a second.