Turn Run off where there is nothing to run - #31
Merged
Conversation
Explaining the refusal after the fact was not the fix. Twenty-two of the twenty-nine examples are libraries, so for most of the corpus the first thing somebody does is press a button that cannot work, and being told why afterwards is still being told afterwards. So the picker knows. `examples/index.json` now records, per example, whether it has a `main` and how many tests it has, and Run is off before it is reached for, with the reason next to it. Both facts are asked, not guessed. `tools/examples.mjs` runs the pinned artifact over each file and reads its answer, because looking for `fn main` in the text would be a small parser written here, which is the thing this repository does not do. Seven of twenty-nine have a `main`. The button comes back the moment the text is edited, since what was known was known about the example and not about whatever it has become. A shared link is not an example either. The note under the last change stays, for a program somebody wrote themselves that has no `main`. That path is the one that cannot be known in advance. Co-authored-by: GitHub Copilot <copilot@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.
Follow-up to #30, which was not the fix.
Explaining the refusal after the fact is still telling somebody afterwards. Twenty-two of the twenty-nine examples are libraries, so for most of the corpus the first thing a reader does is press a button that cannot work.
The picker knows now.
examples/index.jsonrecords, per example, whether it has amainand how many tests it has, and Run is off before it is reached for, with the reason beside it:Both facts are asked, not guessed
tools/examples.mjsruns the pinned artifact over each file and reads its answer. Looking forfn mainin the text would be a small parser written here, which is the thing this repository does not do.It is a maintenance script, run when the pin moves, alongside the two commands already documented for that.
tools/check.mjsfails if any entry is missingsummary,runsortests, so an index regenerated by an older version of the script cannot ship quietly.The button comes back
The moment the text is edited, because what was known was known about the example and not about whatever it has become. A shared link is not an example either.
The note added in #30 stays, for a program somebody wrote themselves with no
main. That is the path that cannot be known in advance.Checked
mainto run, 3 tests to press Test on.mainto run, 3 tests to press Test on.Then typing one character into
calendar: Run on, note gone.Written with AI assistance.