Skip to content

ProviderFlags: a Surfaces bit field and a Placement value, each distinctly typed - #726

Merged
David-Noble-at-work merged 1 commit into
developfrom
provider-flags
Aug 28, 2026
Merged

David-Noble-at-work merged 1 commit into
developfrom
provider-flags

Conversation

@David-Noble-at-work

Copy link
Copy Markdown
Contributor

Closes #715. Plan: docs/plans/role-vocabulary.md (merged as #723).

Breaking. ProviderRole, RoleModule, RoleAction, RoleRoot, Dispatch(), Roles(), Modules(),
Actions(), and RootProviders() are all replaced.

The defect

+devlore:surface=graph produced RoleAction; +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 it: 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.

+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

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. 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 and not 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 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.

Dispatch() → Surfaces() for the same reason.

The bootstrap had no two-pass escape

generate.star emits the constant names into every .gen.go. 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 unrecoverable without it. The LKG was then removed, and a source-built star reproduced all 159 files
identically, 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 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.

It also failed on first run for the wrong reason: ui was not announced in that test binary, since plan
imports flow directly but not ui. 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. A
word-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 notes
explaining why the rename happened.

Also

The accessors mask explicitly rather than relying on the conversion to truncate — gosec G115 caught that the
bare 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 current develop tip (a3b4d7b8,
after #719).

…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.
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.

Rename the provider roles: surface=graph produces RoleAction, and the rename retires both words

1 participant