Repository navigation
ProviderFlags: a Surfaces bit field and a Placement value, each distinctly typed - #726
Merged
Merged
Conversation
…alue Closes #715. +devlore:surface=graph produced RoleAction and +devlore:surface=module produced RoleModule -- two vocabularies for one idea, connected only by a switch in generate.star. An author wrote graph and the generated code said Action. The op->workflow rename forces the issue: Graph becomes Definition, so surface=graph would name a type that no longer exists, and module is starlark's word for a namespace rather than a term in the new taxonomy. Neither word survives. +devlore:surface=script|workflow a list; default both +devlore:placement=promoted one value; default qualified type ProviderFlags uint16 packs both type Surfaces uint8 BIT FIELD -- SurfaceScript, SurfaceWorkflow type Placement uint8 VALUE -- PlacementQualified, PlacementPromoted The zones are not the same kind of thing, and the design says so three ways PLURAL for the set, singular for the value. flags.Surfaces() returning SurfaceScript|SurfaceWorkflow reads correctly; flags.Surface() returning two things would read as a contradiction. The accessor signatures alone say which zone is which. DISTINCT TYPES per zone, following reflect, where flag.kind() returns Kind rather than another flag. flags.Placement() == SurfaceScript is now a compile error rather than nonsense that compiles. C# disagrees -- MethodAttributes packs a MemberAccessMask zone and flag bits in one enum -- and Go's answer was taken for the type safety. PlacementQualified = 0x00 is the zero VALUE of an enumeration, not an absent flag, so nothing can express "promoted and qualified" -- not because a check rejects it, but because the zone holds one value of a type with two. Why ProviderFlags rather than something specific ProviderRole was specific and went stale: #677 changed the zone from invocation mode to surface eligibility, and RoleAction, Dispatch(), and ProviderRole all outlived what they named. Dispatch() -> Surfaces() for the same reason. A generic name cannot fail that way, and the accessors carry the meaning. Precedent: 14 *Flag/*Flags types in Go's stdlib, and C#'s BindingFlags. The bootstrap had no two-pass escape generate.star emits the constant names into every .gen.go, so renaming them broke all 58 generated references at once, the tree stopped compiling, star could not rebuild, and codegen -- the only thing that could rewrite those files -- could not run. Unlike #708 no ordering avoids it: the constant name and its generated use must change together. make star-lkg first, so a prebuilt star could regenerate a tree it could not itself compile. It took five iterations of generate.star scope errors to get through, and the tree was uncompilable during all of them; each would have been unrecoverable without it. The LKG was then removed and a source-built star reproduced all 159 files identically, proving it was an escape hatch rather than load-bearing. A property that was documented three times and tested zero times #717 established that ui, reaching both surfaces, promotes six names into plan.* as well as installing six globals. That claim lived in three doc comments and no test -- and it is the half of placement this rename routes through new code. TestProvider_ResolveAttr_Tier2_PromotedAcrossBothSurfaces now asserts it, with a negative case proving file.copy stays qualified. Without the negative half it would pass on a change that promoted everything. Also: promoteRootMethods -> promoteMethods and rootNames -> promotedNames, resolving an identifier that carried two words for one idea. Placement test functions renamed; fsroot, run-root, scoped-root, and git-root names deliberately untouched -- a word-level sweep over "root" would break their meaning without breaking the build (#725 tracks the last two artifacts). The accessors mask explicitly rather than relying on the conversion to truncate, which gosec G115 caught: the bare form is correct only while both zones are a byte wide.
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.
Closes #715. Plan:
docs/plans/role-vocabulary.md(merged as #723).Breaking.
ProviderRole,RoleModule,RoleAction,RoleRoot,Dispatch(),Roles(),Modules(),Actions(), andRootProviders()are all replaced.The defect
+devlore:surface=graphproducedRoleAction;+devlore:surface=moduleproducedRoleModule— twovocabularies for one idea, connected only by a switch in
generate.star. An author wrotegraphand thegenerated code said
Action.The
op → workflowrename forces it:GraphbecomesDefinition, sosurface=graphwould name a type thatno longer exists, and
moduleis Starlark's word for a namespace rather than a term in the new taxonomy.The zones are not the same kind of thing
Plural for the set, singular for the value.
flags.Surfaces()returningSurfaceScript|SurfaceWorkflowreads correctly;
flags.Surface()returning two things would read as a contradiction. The accessor signaturesalone say which zone is which.
Distinct types per zone, following
reflect, whereflag.kind()returnsKindrather than anotherflag.flags.Placement() == SurfaceScriptis now a compile error rather than nonsense that compiles. C#disagrees —
MethodAttributespacks aMemberAccessMaskzone and flag bits in one enum — and Go's answer wastaken for the type safety.
PlacementQualified = 0x00is the zero value of an enumeration, not an absent flag. Nothing can express"promoted and qualified" — not because a check rejects it, but because the zone holds one value of a type with
two.
Why
ProviderFlagsand not something specificProviderRolewas specific and went stale: #677 changed the zone from invocation mode to surfaceeligibility, and
RoleAction,Dispatch(), andProviderRoleall outlived what they named. A generic namecannot fail that way, and the accessors carry the meaning. Precedent: 14
*Flag/*Flagstypes in Go'sstdlib, and C#'s
BindingFlags.Dispatch()→Surfaces()for the same reason.The bootstrap had no two-pass escape
generate.staremits the constant names into every.gen.go. Renaming them broke all 58 generated referencesat once — the tree stopped compiling,
starcould not rebuild, and codegen, the only thing that could rewritethose files, could not run. Unlike #708 no ordering avoids it: the constant name and its generated use must
change together.
make star-lkgfirst, so a prebuiltstarcould regenerate a tree it could not itself compile. It took fiveiterations of
generate.starscope errors to get through, and the tree was uncompilable during all of them —each unrecoverable without it. The LKG was then removed, and a source-built
starreproduced all 159 filesidentically, proving it an escape hatch rather than load-bearing.
A property documented three times and tested zero times
#717 established that
ui, reaching both surfaces, promotes six names intoplan.*as well as installing sixglobals. That claim lived in three doc comments and no test — and it is the half of placement this rename
routes through new code.
TestProvider_ResolveAttr_Tier2_PromotedAcrossBothSurfacesnow asserts it, with a negative case provingfile.copystays qualified. Without the negative half it would pass on a change that promoted everything.It also failed on first run for the wrong reason:
uiwas not announced in that test binary, sinceplanimports
flowdirectly but notui. A fixture gap wearing the costume of a behavioral finding.What was deliberately NOT renamed
fsroot, the run root, scoped-root tests, and git root all contain "root" in a filesystem sense. Aword-level sweep would break their meaning without breaking the build. #725 tracks the last two artifacts that
do carry the retired placement vocabulary.
Two doc comments deliberately retain
ProviderRole/RoleAction/Dispatch()in historical notesexplaining why the rename happened.
Also
The accessors mask explicitly rather than relying on the conversion to truncate —
gosecG115 caught that thebare form is correct only while both zones happen to be a byte wide.
Verified
make check,make test-race,make test-scenario— all pass, on the currentdeveloptip (a3b4d7b8,after #719).