Repository navigation
docs: classify provider methods, and run the fixture that proves why - #566
Merged
Merged
Conversation
+devlore:access is attached to a provider, but the property it describes belongs to individual methods, and `both` is the evidence: it does not describe a provider at all, it says the provider's methods are not all the same kind. file is three things wearing one name -- join and parent take a value and return one, exists and read_text read the host, write_text and remove change it -- and one annotation covering all three cannot be right about any of them. Today it is wrong in the dangerous direction. Because file is access=both, file.write_text is callable during planning, outside the graph, with no receipt, no compensation and no trace. 3.6 replaces the annotation with three method kinds -- pure, query, action -- from which two things derive rather than being annotated separately. Namespace placement derives, because an action changes the world and so must be a graph node to earn a receipt. Hermeticity derives, because a hermetic evaluation admits pure and nothing else. The mutation hole then closes by construction instead of by filtering. Attribution is optional rather than required. Only one misclassification opens a hole -- claiming pure for something impure -- and requiring an attribution everywhere does not reduce it while manufacturing it where none was needed: platform.Hostname() takes nothing and cannot fail, so pure is a plausible wrong answer, but left unannotated it defaults to query, which is correct. The action tier infers itself from a *Receipt return, which this repository already enforces through its Fallible / Actions / Compensable delineators. A pure claim is verified against the call graph, a check every scheme needs and so no reason to prefer one. Codegen emits the derived classification so that silence stops being ambiguous. The fixture work rides along because it is the evidence. test_imm_file.star had never been executed by any test, and running it is what proved the claim the document is built on: file.write_text, mkdir, copy, move and remove all succeed immediately, with unit_count 0. It failed on two stale type assertions and nothing else -- "struct" where the Starlark type is now "Regular" -- so what the fixture asserted about mutation was true and unwatched. Refs #563, #564.
Wiring test_imm_file.star in regressed the windows baseline from 8 to 9. The fixture asserted
file.join(parts=["a", "b", "c.txt"]) == "a/b/c.txt"
and file.Join is deliberately OS-native: it builds a path FOR USE, unlike Name and Parent, which answer
questions ABOUT a path as a value and are slash-form everywhere. So windows returns a\b\c.txt and the
expectation was wrong there before the fixture ever ran -- running it is what exposed it.
The fixture cannot assert multi-part join without encoding a platform, and does not need to:
TestJoin_MultipleParts already covers it per platform in Go. What this fixture uniquely proves is that
file.write_text, mkdir, copy, move and remove all succeed immediately with unit_count 0, which the remaining
assertions still do. The single-part and empty cases stay, since neither involves a separator.
Baseline returns to 8.
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 diagnosis
+devlore:accessis attached to a provider; the property belongs to methods.bothis the tell — itdoesn't describe a provider, it says "this provider's methods aren't all the same kind."
One annotation over three kinds can't be right about any of them, and today it's wrong in the dangerous
direction:
fileisaccess=both, sofile.write_textruns during planning — outside the graph, with noreceipt, no compensation, no trace.
The scheme
purequeryactionplan.*only — must be a graph nodeTwo things derive from one property. Namespace placement derives, because an action changes the world and
so must be a graph node to earn a receipt. Hermeticity derives, because a hermetic evaluation admits
pureandnothing else.
immediate/planned/bothwere describing the consequence rather than the cause.The mutation hole then closes by construction rather than by filtering.
Attribution is optional
Only one misclassification opens a hole — claiming
purefor something impure. Requiring attributioneverywhere doesn't reduce it, and manufactures it:
platform.Hostname() stringtakes nothing and cannotfail, so
pureis a plausible wrong answer. Unannotated it defaults toquery, which is correct, with nodecision made.
actioninfers itself from a*Receiptreturn — already enforced by the Fallible / Actions /Compensable delineators
pureis claimed and verified against the call graph — a check every scheme needs, so not adifferentiator
queryis the default, which fails closedWhy the fixture is in this PR
test_imm_file.starhad never been executed by any test. Running it is what proved the claim the documentrests on:
write_text,mkdir,copy,moveandremoveall succeed immediately withunit_count == 0.It failed on two stale type assertions and nothing else —
"struct"where the Starlark type is now"Regular". So everything it asserted about immediate mutation was true, and unwatched.Verified
make check— run by the commit script before committingTestImmediateFilepasses with the corrected type namesRefs #563, #564.