Repository navigation
Plan: ProviderFlags — a Surfaces bit field and a Placement value - #723
Merged
Merged
Conversation
Plan for #715, under the op->workflow rename epic (#451). The defect: +devlore:surface=graph produces RoleAction and +devlore:surface=module produces RoleModule -- two vocabularies for one idea, connected only by a switch in generate.star. An author writes graph and the generated code says Action. The rename forces it: Graph becomes Definition, so surface=graph will 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 current word survives. The target +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 -- one or more type Placement uint8 VALUE -- exactly one 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, where flags.Surface() returning two things reads as a contradiction. Someone reading only the accessor signatures learns which zone is which. Distinct types per zone, following reflect, where flag.kind() returns Kind rather than another flag. That makes flags.Placement() == SurfaceScript 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. A deliberately 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 is the hard part, and it has no two-pass escape generate.star emits the constant names into every .gen.go. Renaming them breaks all 58 generated references at once; the tree stops compiling; star cannot rebuild; and codegen -- the only thing that could rewrite those files -- cannot run. Unlike #708 there is no ordering that avoids it, because the constant name and its generated use must change together. The LKG escape hatch is exactly this case: STAR resolves to build/star.lkg when it exists, and build/star: FORCE is never consulted, so a prebuilt star regenerates a tree it could not itself compile. cmd/devlore-inventory does not import pkg/op (verified), so make generate's inventory step survives too. make star-lkg is therefore step 1 and a PRECONDITION, not a convenience: taken after the rename begins it would snapshot a binary built from a tree that no longer compiles. Scope: ~400 references, 58 of them generated, and FOUR authored directive lines -- ui, plan, and flow are the only providers that declare anything.
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.
Plan only, no code. For #715, under epic #451.
Opened for design review before the implementation, because it moves ~400 references and the naming took a
dozen rounds to settle. Cheaper to review here than underneath the diff.
The defect
+devlore:surface=graphproducesRoleAction;+devlore:surface=moduleproducesRoleModule. Twovocabularies for one idea, connected only by a switch in
generate.star— an author writesgraphand thegenerated code says
Action.The
op → workflowrename forces it:GraphbecomesDefinition, sosurface=graphwill name a type thatno longer exists, and
moduleis Starlark's word for a namespace rather than a term in the new taxonomy.Neither current word survives.
The target
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()returningSurfaceScript|SurfaceWorkflowreads correctly;
flags.Surface()returning two things reads as a contradiction. Someone reading only theaccessor signatures learns which zone is which, without the doc comment.
Distinct types per zone.
flags.Placement() == SurfaceScriptbecomes a compile error rather than nonsensethat compiles.
PlacementQualified = 0x00is the zero value of an enumeration, not an absent flag — so nothing canexpress "promoted and qualified", not because a check rejects it but because the zone holds one value of a
type with two.
Three decisions worth pushing on
1.
ProviderFlagsis deliberately generic. The argument is thatProviderRolewas specific and wentstale — #677 changed the zone from invocation mode to surface eligibility, and
RoleAction,Dispatch(),and
ProviderRoleall outlived what they named. A generic name can't fail that way. But that's an argumentfrom one failure, and a reviewer might reasonably think a better specific name exists.
Precedent checked: 14
*Flag/*Flagstypes in Go's stdlib (ProgFlag,SectionFlag,FuncFlag, …), andC#'s
BindingFlags.2. Distinct zone types follow Go and contradict C#.
reflect'sflag.kind()returnsKind, a distincttype. C#'s
MethodAttributespacks aMemberAccessMaskzone and flag bits in one enum with no separatetype. Two respectable languages, two answers; Go's was taken for the compile error.
3.
make star-lkgis a precondition, not a convenience. See below.The bootstrap has no two-pass escape
generate.staremits the constant names into every.gen.go. Renaming them breaks all 58 generatedreferences at once, the tree stops compiling,
starcan't rebuild, and codegen — the only thing that couldrewrite those files — can't run. Unlike #708 there's no ordering that avoids it, because the constant name and
its generated use must change together.
The LKG escape hatch is exactly this case, and the Makefile documents it as such:
STARresolves tobuild/star.lkgwhen it exists andbuild/star: FORCEis never consulted, so a prebuiltstarregenerates atree it could not itself compile.
cmd/devlore-inventorydoes not importpkg/op(verified), somake generate's inventory step survives too.make star-lkgmust run while the tree is green. Taken after the rename begins, it would snapshot abinary built from a tree that no longer compiles. Everything after that step is recoverable; that step isn't.
Scope
~400 references, 58 of them generated — and four authored directive lines.
ui,plan, andflowarethe only providers that declare anything.
Test plan
Nine rows in the plan. Rows 6–8 are the regression guard that matters: this is a pure rename, so
ui,flow,and
planmust behave identically afterwards.uiis sharpest — it exercises both zones, and #717established that its root placement promotes six names into
plan.*as well as installing six globals.Row 5 is the one genuine semantic change:
PlacementQualifieddoesn't exist today, and naming the zero valuegets its own assertion rather than riding along.