Read the grant file on keycloak's moved path, so a consumer not moved is still made (issue 1332)
mesh/merge-gate head b9104454f9a5 merged into trunk 954f84ea19b5 — pass: builds keycloak, sent nowhere; no bus step; 1 wait(s) for a person; every machine …
mesh/repo-check head b9104454f9a5 merged into trunk 954f84ea19b5 — pass: its merge-check.sh passed, each part in its toolchain: merge-check.sh (go), merge-…
mesh/delivery delivered

mesh-mail-web, grafana and car-hunter are not moved, so keycloak wanted nothing for them: it never
made mesh_novox_mail_web, and held mesh_ace_grafana and mesh_ace_carhunt for retirement. Keycloak's
moved spec now asks for the grant file's consumers too (WithGrants: true), and the moved harness
reads MESH_RECEIVES exactly as the grant path does and as postgres's moved harness already did.
This commit is contained in:
jochen
2026-10-20 00:30:45 +02:00
parent 73a10fafc7
commit b9104454f9
2 changed files with 12 additions and 4 deletions
@@ -51,8 +51,8 @@ func main() {
say("%v — the provisioner cannot run without it", err)
} else if consumers := handedConsumersFile(os.Getenv, os.Stat); consumers != "" {
// Handed to the provisioner (novox/hq ADR 0373): the provider helper answers the consumers its
// machine's client fills the file with; the grant directory is not read. Retirement is the
// harness's, never run, so its guards and its tools stand (issue 805).
// machine's client fills the file with, and the grant file still gives the consumers not moved
// (issue 937, 1332). Retirement is the harness's, never run, so its guards and its tools stand (issue 805).
h = movedHarness(os.Getenv, provisioner{clients: OidcClients{KC: kc, Realm: realm}, guard: guard, announce: announce, log: logStderr})
run, p, bus, err := moved(consumers, h, issuer)
if err != nil {
@@ -96,10 +96,12 @@ func main() {
}
// movedHarness is the harness the moved path shares with the SDK's helper: what main wires together, pulled out so
// it can be built and inspected without starting the process (novox/hq issue 1332).
// it can be built and inspected without starting the process. Receives is MESH_RECEIVES, read exactly as the grant
// path reads it (novox/hq issue 937), so the grant file still gives every consumer not moved (novox/hq issue 1332).
func movedHarness(getenv func(string) string, adapter harness.Adapter) *harness.Harness {
return &harness.Harness{
Resource: ProvisionName,
Receives: getenv("MESH_RECEIVES"),
Adapter: adapter,
Log: logStderr,
Announce: announce,
@@ -43,10 +43,16 @@ func valuesOf(e provider.Entry) map[string]any {
// moved is keycloak handed to the provisioner: the SDK's moved path (harness.Moved) answering its consumers, and the
// harness (never run) whose retirement and tools it shares. What differs from postgres is only this declaration
// (issue 849).
//
// **A consumer not moved is still the grant file's** (issue 937, ADR 0349 clause 17, fixed here by issue 1332):
// only a moved consumer's plan names keycloak as its provider, so the controller still gives every other consumer
// through keycloak's grant file (MESH_RECEIVES) until R1 (issue 682) — mesh-mail-web, grafana and car-hunter among
// them. Each client it gives is made and checked by the harness's grant pass exactly as on the grant path; a client
// a plan names is the helper's alone.
func moved(consumersFile string, h *harness.Harness, issuer string) (*harness.Moved, *provider.Provider, provider.Bus, error) {
return harness.NewMoved(consumersFile, h, harness.MovedSpec{Module: "keycloak", Provision: ProvisionName,
Offer: provider.Offer{Credential: provider.PerConsumer, Serves: servedValues(issuer)},
Login: func(e provider.Entry) string { return e.As },
Values: valuesOf,
Noun: "client id", Made: "client", Backend: "Keycloak", WithGrants: false})
Noun: "client id", Made: "client", Backend: "Keycloak", WithGrants: true})
}