Skip to content

Plan: ProviderFlags — a Surfaces bit field and a Placement value - #723

Merged
David-Noble-at-work merged 1 commit into
developfrom
role-vocabulary
Aug 28, 2026
Merged

David-Noble-at-work merged 1 commit into
developfrom
role-vocabulary

Conversation

@David-Noble-at-work

Copy link
Copy Markdown
Contributor

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=graph produces RoleAction; +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 op → workflow 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

func (f ProviderFlags) Surfaces() Surfaces   { ... }
func (f ProviderFlags) Placement() Placement { ... }

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 reads as a contradiction. Someone reading only the
accessor signatures learns which zone is which, without the doc comment.

Distinct types per zone. flags.Placement() == SurfaceScript becomes a compile error rather than nonsense
that compiles.

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.

Three decisions worth pushing on

1. ProviderFlags is deliberately generic. The argument is that 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 generic name can't fail that way. But that's an argument
from one failure, and a reviewer might reasonably think a better specific name exists.

Precedent checked: 14 *Flag/*Flags types in Go's stdlib (ProgFlag, SectionFlag, FuncFlag, …), and
C#'s BindingFlags.

2. Distinct zone types follow Go and contradict C#. reflect's flag.kind() returns Kind, a distinct
type. C#'s MethodAttributes packs a MemberAccessMask zone and flag bits in one enum with no separate
type. Two respectable languages, two answers; Go's was taken for the compile error.

3. make star-lkg is a precondition, not a convenience. See below.

The bootstrap 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 can't rebuild, and codegen — the only thing that could
rewrite 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: 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 must run while the tree is green. Taken after the rename begins, it would snapshot a
binary 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, and flow are
the 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 plan must behave identically afterwards. ui is sharpest — it exercises both zones, and #717
established that its root placement promotes six names into plan.* as well as installing six globals.

Row 5 is the one genuine semantic change: PlacementQualified doesn't exist today, and naming the zero value
gets its own assertion rather than riding along.

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.
@David-Noble-at-work David-Noble-at-work self-assigned this Aug 28, 2026
@David-Noble-at-work
David-Noble-at-work merged commit 9fdc47e into develop Aug 28, 2026
12 checks passed
@David-Noble-at-work
David-Noble-at-work deleted the role-vocabulary branch August 28, 2026 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant