console: config versions, digests and the effective view (#522 plan 1 task 3)
GET /config now carries the bundle's version and a digest per var, both from the one LoadLayer read. New GET .../config/effective?host= shows one route's three stored layers with their versions and, per key, the layer it comes from and the lower layers it shadows. The host resolves only through this app's instance record; anything else is the gate's own 404. Plain cliRoute, so team credentials are refused as on config/sync. appconfig.LoadHostLayers merges with the box's own code: the two-layer rule is split out of loadMergedETags as mergeEnvironment (behaviour unchanged) and the overlay goes through applyInstanceOverlay. TestLoadHostLayersMatchesBoxMerge holds it to LoadMergedHost. The new door is added to the claim route census, claim fixtures and read probes, and to the team role's closed list.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 files changed,
+803
−27
internal/appconfig/environments.go+38 −15internal/appconfig/observe.go+129 −0internal/appconfig/observe_test.go+206 −0internal/console/apiconfig.go+16 −12internal/console/apiconfig_observe_test.go+295 −0internal/console/apiconfigeffective.go+108 −0internal/console/authcli.go+5 −0internal/console/claim_invariant_fixtures_test.go+1 −0internal/console/claim_invariant_probes_read_test.go+2 −0internal/console/teamdoors_test.go+2 −0internal/console/testdata/claim-routes.txt+1 −0
CI failed — run details
diff --git a/internal/appconfig/environments.go b/internal/appconfig/environments.go| index 5bc1b7668..28e28524f 100644 |
| --- a/internal/appconfig/environments.go |
| +++ b/internal/appconfig/environments.go |
| @@ -208,28 +208,51 @@ func loadMergedETags(ctx context.Context, s release.Store, acct, app, envName st |
| if err != nil { |
| return nil, "", "", err |
| } |
| - if envName == "" { |
| - if !defFound { |
| - return &Manifest{Schema: 1, App: app, Vars: map[string]Var{}}, "", "", nil |
| + if envName != "" { |
| + if !envRead { |
| + return nil, "", "", fmt.Errorf("config: invalid environment name %q", envName) |
| + } |
| + if err := envErr; err != nil { |
| + return nil, "", "", err |
| } |
| - return def, defETag, "", nil |
| - } |
| - if !envRead { |
| - return nil, "", "", fmt.Errorf("config: invalid environment name %q", envName) |
| } |
| - if err := envErr; err != nil { |
| + merged, err := mergeEnvironment(acct, app, envName, def, defFound, env, envFound) |
| + if err != nil { |
| return nil, "", "", err |
| } |
| + switch { |
| + case envName == "": |
| + return merged, defETag, "", nil |
| + case env.Owned(): |
| + // The default's etag is reported as "" because that layer was no |
| + // part of the merge (see mergeEnvironment's standalone branch). |
| + return merged, "", envETag, nil |
| + } |
| + return merged, defETag, envETag, nil |
| +} |
| + |
| +// mergeEnvironment is the two-layer rule once both reads are in: the |
| +// default bundle alone for an unbound route, a named environment over it |
| +// per key, an owned environment alone. It is split out of loadMergedETags |
| +// so the console's effective view (LoadHostLayers) merges with the very |
| +// code a box renders with rather than a copy of it. def and env may be nil |
| +// when their found flag is false; env is not consulted for envName "". |
| +func mergeEnvironment(acct, app, envName string, def *Manifest, defFound bool, env *Manifest, envFound bool) (*Manifest, error) { |
| + if envName == "" { |
| + if !defFound { |
| + return &Manifest{Schema: 1, App: app, Vars: map[string]Var{}}, nil |
| + } |
| + return def, nil |
| + } |
| if !envFound { |
| - return nil, "", "", fmt.Errorf("config: environment %q not found for %s/%s — bound but never created (`carlos env set --app %s --environment %s ...`)", envName, acct, app, app, envName) |
| + return nil, fmt.Errorf("config: environment %q not found for %s/%s — bound but never created (`carlos env set --app %s --environment %s ...`)", envName, acct, app, app, envName) |
| } |
| // THE STANDALONE BRANCH (team-scoped credentials §3, round 1 P1-1): an |
| - // owned environment renders from itself ALONE. The default bundle was |
| - // read beside it (the read above is one call either way) and is |
| + // owned environment renders from itself ALONE. Every caller reads the |
| + // default bundle beside it (one call either way), and it is |
| // deliberately not folded in: a team credential controls the other |
| // variables of the same process, and any inherited secret would be one |
| - // it could make the app hand to a host of its choosing. The default's |
| - // etag is reported as "" because that layer was no part of the merge. |
| + // it could make the app hand to a host of its choosing. |
| // TestLoadMergedOwnedEnvironmentIsStandalone fails if this branch is |
| // removed. |
| if env.OwnerScope != "" { |
| @@ -238,7 +261,7 @@ func loadMergedETags(ctx context.Context, s release.Store, acct, app, envName st |
| for k, v := range env.Vars { |
| merged.Vars[k] = v |
| } |
| - return merged, "", envETag, nil |
| + return merged, nil |
| } |
| merged := &Manifest{Schema: 1, App: app, Vars: map[string]Var{}} |
| if defFound { |
| @@ -249,7 +272,7 @@ func loadMergedETags(ctx context.Context, s release.Store, acct, app, envName st |
| for k, v := range env.Vars { |
| merged.Vars[k] = v |
| } |
| - return merged, defETag, envETag, nil |
| + return merged, nil |
| } |
| func SaveEnvironment(ctx context.Context, s release.Store, acct, app, envName string, sets map[string]Var, unsets []string) (claimResult0 error) { |
| claimResult0 = release.WithAppMutation(ctx, s, acct, app, "appconfig.SaveEnvironment", func(claimContext context.Context) error { |
diff --git a/internal/appconfig/observe.go b/internal/appconfig/observe.go| index e96d64d49..2d558d506 100644 |
| --- a/internal/appconfig/observe.go |
| +++ b/internal/appconfig/observe.go |
| @@ -185,3 +185,132 @@ func applyToManifest(m *Manifest, sets map[string]Var, unsets []string) Receipt |
| sort.Strings(r.UnsetAbsent) |
| return r |
| } |
| + |
| +// The layers an effective var can come from, as the console names them. |
| +const ( |
| + FromDefault = "default" |
| + FromEnvironment = "environment" |
| + FromOverlay = "overlay" |
| +) |
| + |
| +// EffectiveVar is one key of a route's merged config and where it came |
| +// from: From is the layer whose value the route gets, Shadows the lower |
| +// layers that also set the key, nearest first. Value is set only for a |
| +// plain var from the default or environment layer; an overlay is written by |
| +// the platform, and no owner read shows its plain values today, so the |
| +// effective view does not start (spec §4.4). Shadows is never nil. |
| +type EffectiveVar struct { |
| + Key, Kind, Digest, From, Value string |
| + Shadows []string |
| +} |
| + |
| +// HostLayers is one route's three stored layers, each with the version of |
| +// the bytes it was read from, and the merge a box renders from them. For an |
| +// owned environment Default is the zero Layer: the merge never consults it, |
| +// so neither does anything describing the merge. Environment is the zero |
| +// Layer for a route bound to no environment. Vars is sorted by key. |
| +type HostLayers struct { |
| + EnvName string |
| + Owned bool |
| + Default, Environment, Overlay Layer |
| + Vars []EffectiveVar |
| +} |
| + |
| +// LoadHostLayers reads the layers a route resolves through and merges them |
| +// with the box's own rules (mergeEnvironment, applyInstanceOverlay), so the |
| +// view cannot drift from what a box renders; TestLoadHostLayersMatchesBoxMerge |
| +// holds the two together. It refuses what LoadMergedHostVersions refuses, |
| +// a bound environment that was never created included: the box renders |
| +// nothing for that route, and a view that showed a merge would be a merge |
| +// no process runs with. |
| +// |
| +// Each layer is read with LoadLayer, one Get per layer, so a layer's |
| +// version and the vars it contributes come from the same bytes. The reads |
| +// are not a snapshot across layers; nor are the box's. |
| +func LoadHostLayers(ctx context.Context, s release.Store, acct, app, envName, host string) (*HostLayers, error) { |
| + if !release.ValidAccount(acct) { |
| + return nil, fmt.Errorf("config: invalid account %q", acct) |
| + } |
| + if !release.ValidApp(app) { |
| + return nil, fmt.Errorf("config: invalid app %q", app) |
| + } |
| + if !ValidInstanceHost(host) { |
| + return nil, fmt.Errorf("config: invalid instance host %q", host) |
| + } |
| + if envName != "" && !ValidEnvironmentName(envName) { |
| + return nil, fmt.Errorf("config: invalid environment name %q", envName) |
| + } |
| + def, err := LoadLayer(ctx, s, Key(acct, app), app) |
| + if err != nil { |
| + return nil, err |
| + } |
| + var env Layer |
| + if envName != "" { |
| + if env, err = LoadLayer(ctx, s, EnvironmentKey(acct, app, envName), app); err != nil { |
| + return nil, err |
| + } |
| + } |
| + overlay, err := LoadLayer(ctx, s, InstanceConfigKey(acct, app, host), app) |
| + if err != nil { |
| + return nil, err |
| + } |
| + base, err := mergeEnvironment(acct, app, envName, def.Manifest, def.Found, env.Manifest, env.Found) |
| + if err != nil { |
| + return nil, err |
| + } |
| + // The box lays an overlay on only when one exists (LoadMergedHostVersions' |
| + // !found path), and applyInstanceOverlay returns base untouched for nil. |
| + var inst *Manifest |
| + if overlay.Found { |
| + inst = overlay.Manifest |
| + } |
| + merged := applyInstanceOverlay(app, base, inst) |
| + |
| + hl := &HostLayers{EnvName: envName, Owned: env.Found && env.Manifest.Owned(), Environment: env, Overlay: overlay} |
| + if !hl.Owned { |
| + hl.Default = def |
| + } |
| + // Highest layer first; a layer that is absent, unbound or (for an owned |
| + // environment) not part of the merge is left out, so it can be neither |
| + // a source nor shadowed. Indexing a nil Vars map is safe and reads as |
| + // "not set", which covers a stored object with no "vars" key. |
| + type source struct { |
| + name string |
| + m *Manifest |
| + } |
| + var order []source |
| + if overlay.Found { |
| + order = append(order, source{FromOverlay, overlay.Manifest}) |
| + } |
| + if envName != "" { |
| + order = append(order, source{FromEnvironment, env.Manifest}) |
| + } |
| + if !hl.Owned && def.Found { |
| + order = append(order, source{FromDefault, def.Manifest}) |
| + } |
| + keys := make([]string, 0, len(merged.Vars)) |
| + for k := range merged.Vars { |
| + keys = append(keys, k) |
| + } |
| + sort.Strings(keys) |
| + hl.Vars = make([]EffectiveVar, 0, len(keys)) |
| + for _, k := range keys { |
| + v := merged.Vars[k] |
| + ev := EffectiveVar{Key: k, Kind: v.Kind, Digest: Digest(v), Shadows: []string{}} |
| + for _, src := range order { |
| + if _, ok := src.m.Vars[k]; !ok { |
| + continue |
| + } |
| + if ev.From == "" { |
| + ev.From = src.name |
| + } else { |
| + ev.Shadows = append(ev.Shadows, src.name) |
| + } |
| + } |
| + if v.Kind == "env" && ev.From != FromOverlay { |
| + ev.Value = v.Value |
| + } |
| + hl.Vars = append(hl.Vars, ev) |
| + } |
| + return hl, nil |
| +} |
diff --git a/internal/appconfig/observe_test.go b/internal/appconfig/observe_test.go| index ba50bb582..b19d27271 100644 |
| --- a/internal/appconfig/observe_test.go |
| +++ b/internal/appconfig/observe_test.go |
| @@ -150,3 +150,209 @@ func TestLoadLayerRefusesNewerSchema(t *testing.T) { |
| t.Fatalf("LoadLayer on schema 99: err = %v, want newer-schema refusal", err) |
| } |
| } |
| + |
| +// hostLayersWorld is the three-layer fixture of the effective view's tests: |
| +// the default bundle sets A and B, the environment prod sets B and C, and |
| +// the overlay of hostLayersHost sets C. |
| +const hostLayersHost = "shop.example.com" |
| + |
| +func hostLayersWorld(t *testing.T) (context.Context, release.Store) { |
| + t.Helper() |
| + s := release.NewDirStore(t.TempDir()) |
| + ctx := context.Background() |
| + if err := SetEnv(ctx, s, "acct", "shop", map[string]string{"A": "def-a", "B": "def-b"}); err != nil { |
| + t.Fatal(err) |
| + } |
| + if err := SaveEnvironment(ctx, s, "acct", "shop", "prod", |
| + map[string]Var{"B": {Kind: "env", Value: "env-b"}, "C": {Kind: "env", Value: "env-c"}}, nil); err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, _, err := ApplyInstance(ctx, s, "acct", "shop", hostLayersHost, |
| + map[string]Var{"C": {Kind: "env", Value: "inst-c"}}, nil); err != nil { |
| + t.Fatal(err) |
| + } |
| + return ctx, s |
| +} |
| + |
| +func effectiveByKey(hl *HostLayers) map[string]EffectiveVar { |
| + out := map[string]EffectiveVar{} |
| + for _, v := range hl.Vars { |
| + out[v.Key] = v |
| + } |
| + return out |
| +} |
| + |
| +func TestLoadHostLayersFromAndShadows(t *testing.T) { |
| + ctx, s := hostLayersWorld(t) |
| + hl, err := LoadHostLayers(ctx, s, "acct", "shop", "prod", hostLayersHost) |
| + if err != nil { |
| + t.Fatalf("LoadHostLayers: %v", err) |
| + } |
| + if hl.EnvName != "prod" || hl.Owned { |
| + t.Fatalf("EnvName/Owned = %q/%v, want prod/false", hl.EnvName, hl.Owned) |
| + } |
| + for _, c := range []struct { |
| + name string |
| + key string |
| + layer Layer |
| + }{ |
| + {"default", Key("acct", "shop"), hl.Default}, |
| + {"environment", EnvironmentKey("acct", "shop", "prod"), hl.Environment}, |
| + {"overlay", InstanceConfigKey("acct", "shop", hostLayersHost), hl.Overlay}, |
| + } { |
| + want, err := LoadLayer(ctx, s, c.key, "shop") |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if c.layer.Version != want.Version || !c.layer.Found || c.layer.Version == VersionNone { |
| + t.Errorf("%s version = %q (found %v), want %q", c.name, c.layer.Version, c.layer.Found, want.Version) |
| + } |
| + } |
| + by := effectiveByKey(hl) |
| + if len(by) != 3 { |
| + t.Fatalf("vars = %+v, want A, B, C", hl.Vars) |
| + } |
| + want := map[string]struct { |
| + from, value string |
| + shadows []string |
| + }{ |
| + "A": {"default", "def-a", []string{}}, |
| + "B": {"environment", "env-b", []string{"default"}}, |
| + "C": {"overlay", "", []string{"environment"}}, |
| + } |
| + for k, w := range want { |
| + v := by[k] |
| + if v.From != w.from || v.Value != w.value || strings.Join(v.Shadows, ",") != strings.Join(w.shadows, ",") || v.Shadows == nil { |
| + t.Errorf("%s = %+v, want from %s value %q shadows %v", k, v, w.from, w.value, w.shadows) |
| + } |
| + if v.Kind != "env" { |
| + t.Errorf("%s kind = %q, want env", k, v.Kind) |
| + } |
| + } |
| + if by["C"].Digest != Digest(Var{Kind: "env", Value: "inst-c"}) { |
| + t.Errorf("C digest = %q, want the overlay var's digest", by["C"].Digest) |
| + } |
| + if hl.Vars[0].Key != "A" || hl.Vars[1].Key != "B" || hl.Vars[2].Key != "C" { |
| + t.Errorf("vars not sorted by key: %+v", hl.Vars) |
| + } |
| +} |
| + |
| +// An overlay shadowing both lower layers lists them nearest first, and a |
| +// route with no overlay object reads the overlay as absent. |
| +func TestLoadHostLayersShadowOrderAndAbsentOverlay(t *testing.T) { |
| + ctx, s := hostLayersWorld(t) |
| + if _, _, err := ApplyInstance(ctx, s, "acct", "shop", hostLayersHost, |
| + map[string]Var{"B": {Kind: "env", Value: "inst-b"}}, nil); err != nil { |
| + t.Fatal(err) |
| + } |
| + hl, err := LoadHostLayers(ctx, s, "acct", "shop", "prod", hostLayersHost) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if b := effectiveByKey(hl)["B"]; b.From != "overlay" || strings.Join(b.Shadows, ",") != "environment,default" { |
| + t.Errorf("B = %+v, want from overlay shadowing environment then default", b) |
| + } |
| + hl, err = LoadHostLayers(ctx, s, "acct", "shop", "prod", "other.example.com") |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if hl.Overlay.Version != VersionNone || hl.Overlay.Found { |
| + t.Errorf("absent overlay = %+v, want none", hl.Overlay) |
| + } |
| + if c := effectiveByKey(hl)["C"]; c.From != "environment" || c.Value != "env-c" { |
| + t.Errorf("C without an overlay = %+v, want the environment's", c) |
| + } |
| +} |
| + |
| +func TestLoadHostLayersOwned(t *testing.T) { |
| + ctx, s, _ := ownedWorld(t) |
| + // The default bundle sets SHARED; the owned environment sets it too, so |
| + // a standalone merge must not report the default as shadowed either. |
| + if _, err := ApplyEnvironmentOwned(ctx, s, "bab", "docs", "team", "alta", |
| + map[string]Var{"SHARED": {Kind: "env", Value: "team"}}, nil); err != nil { |
| + t.Fatal(err) |
| + } |
| + hl, err := LoadHostLayers(ctx, s, "bab", "docs", "team", "one.docs.example") |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if !hl.Owned { |
| + t.Fatal("Owned = false for an owned environment") |
| + } |
| + if hl.Default.Version != "" || hl.Default.Found || hl.Default.Manifest != nil { |
| + t.Errorf("Default = %+v, want the zero Layer", hl.Default) |
| + } |
| + for _, v := range hl.Vars { |
| + if v.From == "default" { |
| + t.Errorf("%s from default in an owned environment", v.Key) |
| + } |
| + for _, sh := range v.Shadows { |
| + if sh == "default" { |
| + t.Errorf("%s shadows default in an owned environment", v.Key) |
| + } |
| + } |
| + } |
| + by := effectiveByKey(hl) |
| + if _, ok := by["OWNER_CANARY"]; ok { |
| + t.Errorf("owned view carries the default's OWNER_CANARY: %+v", hl.Vars) |
| + } |
| + if by["SHARED"].Value != "team" || by["TEAM_ONLY"].From != "environment" { |
| + t.Errorf("owned vars = %+v", hl.Vars) |
| + } |
| +} |
| + |
| +// The effective view is the box's merge: for the same layers, the merged |
| +// key, kind and value set equals LoadMergedHost's, for a bound route, an |
| +// unbound one and an owned one. Drift between the two is what this guards. |
| +func TestLoadHostLayersMatchesBoxMerge(t *testing.T) { |
| + ctx, s := hostLayersWorld(t) |
| + if _, err := ApplyEnvironmentOwned(ctx, s, "acct", "shop", "team", "alta", |
| + map[string]Var{"B": {Kind: "env", Value: "team-b"}}, nil); err != nil { |
| + t.Fatal(err) |
| + } |
| + for _, envName := range []string{"prod", "", "team"} { |
| + box, _, err := LoadMergedHost(ctx, s, "acct", "shop", envName, hostLayersHost) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + hl, err := LoadHostLayers(ctx, s, "acct", "shop", envName, hostLayersHost) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if len(hl.Vars) != len(box.Vars) { |
| + t.Fatalf("env %q: %d vars, box merge has %d", envName, len(hl.Vars), len(box.Vars)) |
| + } |
| + for _, v := range hl.Vars { |
| + bv, ok := box.Vars[v.Key] |
| + if !ok || bv.Kind != v.Kind || Digest(bv) != v.Digest { |
| + t.Errorf("env %q: %s = %+v, box merge has %+v", envName, v.Key, v, bv) |
| + } |
| + if v.From != "overlay" && v.Value != bv.Value { |
| + t.Errorf("env %q: %s value %q, box merge %q", envName, v.Key, v.Value, bv.Value) |
| + } |
| + } |
| + } |
| + // A bound environment that was never created is the box merge's error. |
| + if _, _, err := LoadMergedHost(ctx, s, "acct", "shop", "gone", hostLayersHost); err == nil { |
| + t.Fatal("box merge accepted a missing environment") |
| + } |
| + if _, err := LoadHostLayers(ctx, s, "acct", "shop", "gone", hostLayersHost); err == nil { |
| + t.Fatal("LoadHostLayers accepted a missing environment the box refuses") |
| + } |
| +} |
| + |
| +// A layer stored without a "vars" key parses with a nil map; the view |
| +// ranges it as empty rather than failing. |
| +func TestLoadHostLayersNilVars(t *testing.T) { |
| + ctx, s := hostLayersWorld(t) |
| + if _, err := s.Put(ctx, InstanceConfigKey("acct", "shop", "bare.example.com"), []byte(`{"schema":1,"app":"shop"}`), ""); err != nil { |
| + t.Fatal(err) |
| + } |
| + hl, err := LoadHostLayers(ctx, s, "acct", "shop", "prod", "bare.example.com") |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if !hl.Overlay.Found || len(hl.Vars) != 3 { |
| + t.Fatalf("bare overlay view = %+v", hl) |
| + } |
| +} |
diff --git a/internal/console/apiconfig.go b/internal/console/apiconfig.go| index db12b0916..5a449d22a 100644 |
| --- a/internal/console/apiconfig.go |
| +++ b/internal/console/apiconfig.go |
| @@ -177,10 +177,13 @@ func (s *Server) configStoreError(w http.ResponseWriter, what string, err error) |
| // An app that has never been configured answers as an empty bundle rather |
| // than a 404 — appconfig.Get's own "never configured is not an error" |
| // convention, which `list` needs since it has nothing to print either way. |
| -// The same is true of a NAMED bundle: appconfig.LoadEnvironment returns an |
| -// empty manifest and a nil error when the object is absent (environments.go), |
| -// so there is no not-found case to translate here — a bundle you haven't |
| -// created yet lists empty. |
| +// The same is true of a NAMED bundle: appconfig.LoadLayer returns an empty |
| +// manifest and a nil error when the object is absent, so there is no |
| +// not-found case to translate here — a bundle you haven't created yet lists |
| +// empty, at version "none". |
| +// |
| +// The bundle's version and each var's digest (#522) let a caller tell later |
| +// whether the bundle, or one var, has moved since this read. |
| func (s *Server) handleAPIConfigGet(w http.ResponseWriter, r *http.Request) { |
| _, acct, app, ok := s.apiAccountApp(w, r) |
| if !ok { |
| @@ -200,13 +203,11 @@ func (s *Server) handleAPIConfigGet(w http.ResponseWriter, r *http.Request) { |
| } |
| ctx, cancel := context.WithTimeout(r.Context(), configStoreTimeout) |
| defer cancel() |
| - var m *appconfig.Manifest |
| - var err error |
| - if envName == "" { |
| - m, err = appconfig.Get(ctx, s.cfg.Releases, acct.Sqid, app) |
| - } else { |
| - m, err = appconfig.LoadEnvironment(ctx, s.cfg.Releases, acct.Sqid, app, envName) |
| - } |
| + // One read gives the vars and the version of the bytes they came from |
| + // (#522): a version taken from a second read could describe a bundle |
| + // written in between. An absent bundle lists empty, version "none". |
| + layer, err := appconfig.LoadLayer(ctx, s.cfg.Releases, appconfig.BundleKey(acct.Sqid, app, envName), app) |
| + m := layer.Manifest |
| if err != nil { |
| log.Printf("console: api config get %s/%s (%s): %v", acct.Sqid, app, configBundleName(envName), err) |
| jsonError(w, http.StatusBadGateway, "could not read the config — try again") |
| @@ -237,7 +238,9 @@ func (s *Server) handleAPIConfigGet(w http.ResponseWriter, r *http.Request) { |
| vars := make([]map[string]any, 0, len(keys)) |
| for _, k := range keys { |
| v := m.Vars[k] |
| - row := map[string]any{"key": k, "kind": v.Kind} |
| + // The digest is taken over the stored var, envelope included for a |
| + // secret; the envelope itself still has no field here. |
| + row := map[string]any{"key": k, "kind": v.Kind, "digest": appconfig.Digest(v)} |
| if v.Kind == "env" { |
| row["value"] = v.Value |
| } |
| @@ -245,6 +248,7 @@ func (s *Server) handleAPIConfigGet(w http.ResponseWriter, r *http.Request) { |
| } |
| out := map[string]any{ |
| "bundle": configBundleName(envName), |
| + "version": layer.Version, |
| "environments": envs, |
| "vars": vars, |
| } |
diff --git a/internal/console/apiconfig_observe_test.go b/internal/console/apiconfig_observe_test.go| new file mode 100644 |
| index 000000000..31e8a8e4a |
| --- /dev/null |
| +++ b/internal/console/apiconfig_observe_test.go |
| @@ -0,0 +1,295 @@ |
| +package console |
| + |
| +// Config versions, digests and the effective view (#522 plan 1, spec §4.4, |
| +// §4.8): what the GET door adds, and the config/effective door's answer and |
| +// gate. |
| + |
| +import ( |
| + "context" |
| + "net/http" |
| + "net/url" |
| + "strings" |
| + "testing" |
| + "time" |
| + |
| + "github.com/carlosframework/platform/internal/appconfig" |
| + "github.com/carlosframework/platform/internal/provision" |
| + "github.com/carlosframework/platform/internal/release" |
| +) |
| + |
| +// storedVersion is the version of the bytes stored at key, read straight out |
| +// of the bucket the way the console must not: the independent answer. |
| +func storedVersion(t *testing.T, fx *consoleFixture, key string) string { |
| + t.Helper() |
| + raw, _, err := fx.rel.Get(context.Background(), key) |
| + if err != nil { |
| + t.Fatalf("stored %s: %v", key, err) |
| + } |
| + return appconfig.Version(raw, true) |
| +} |
| + |
| +// effectiveURL is the effective view of host for one app in the fixture's |
| +// account. |
| +func effectiveURL(fx *consoleFixture, app, host string) string { |
| + return fx.ts.URL + "/api/cli/apps/bab/" + app + "/config/effective?host=" + url.QueryEscape(host) |
| +} |
| + |
| +// putInstanceRecord writes an instance record for host straight into the bucket, |
| +// bound to envName, as newTeamWorld does. |
| +func putInstanceRecord(t *testing.T, fx *consoleFixture, app, host, envName string) { |
| + t.Helper() |
| + rec := provision.Record{Schema: 1, Host: host, Slug: strings.SplitN(host, ".", 2)[0], App: app, Account: "bab", |
| + Pool: "tito", Region: "ie", Channel: "stable", Environment: envName, |
| + CreatedAt: time.Now().UTC(), CreatedBy: "alice@keymail.dev"} |
| + if err := provision.CreateRecord(context.Background(), fx.rel, rec); err != nil { |
| + t.Fatal(err) |
| + } |
| +} |
| + |
| +func TestAPIConfigGetVersionAndDigests(t *testing.T) { |
| + fx, token := configFixture(t, "code-config-version") |
| + _, _, envelope := sealedFor(t, "never-relayed") |
| + if status, out := putJSON(t, configURL(fx, "titogo"), map[string]any{ |
| + "set": map[string]any{ |
| + "PORT": map[string]any{"kind": "env", "value": "8080"}, |
| + "BANK_KEY": map[string]any{"kind": "secret", "envelope": envelope}, |
| + }, |
| + }, token); status != http.StatusOK { |
| + t.Fatalf("PUT = %d %v", status, out) |
| + } |
| + status, out := getJSON(t, configURL(fx, "titogo"), token) |
| + if status != http.StatusOK { |
| + t.Fatalf("GET = %d %v", status, out) |
| + } |
| + if got, want := str(t, out, "version"), storedVersion(t, fx, appconfig.Key(release.OpsAccount, "titogo")); got != want { |
| + t.Fatalf("version = %q, want %q (the stored bytes')", got, want) |
| + } |
| + stored, _ := storedManifest(t, fx, "titogo") |
| + byKey := varsByKey(t, out) |
| + for k, v := range stored.Vars { |
| + if got := str(t, byKey[k], "digest"); got != appconfig.Digest(v) { |
| + t.Errorf("%s digest = %q, want %q", k, got, appconfig.Digest(v)) |
| + } |
| + } |
| + bank := byKey["BANK_KEY"] |
| + for _, field := range []string{"value", "envelope"} { |
| + if _, ok := bank[field]; ok { |
| + t.Errorf("secret row carries %q: %v", field, bank) |
| + } |
| + } |
| + if str(t, byKey["PORT"], "value") != "8080" { |
| + t.Errorf("PORT = %v, want its value kept", byKey["PORT"]) |
| + } |
| +} |
| + |
| +func TestAPIConfigGetVersionNone(t *testing.T) { |
| + fx, token := configFixture(t, "code-config-version-none") |
| + for _, q := range []string{"", "?environment=prod"} { |
| + status, out := getJSON(t, configURL(fx, "titogo")+q, token) |
| + if status != http.StatusOK || str(t, out, "version") != "none" { |
| + t.Errorf("GET%s = %d version %v, want 200 and none", q, status, out["version"]) |
| + } |
| + } |
| +} |
| + |
| +// effectiveWorld is configFixture with the default bundle setting A and the |
| +// secret S, the environment prod setting A and B, and the overlay of |
| +// effectiveHost setting B, bound to prod by its record. |
| +const effectiveHost = "a.titogo.example.com" |
| + |
| +func effectiveWorld(t *testing.T, code string) (*consoleFixture, string) { |
| + t.Helper() |
| + fx, token := configFixture(t, code) |
| + _, _, envelope := sealedFor(t, "never-relayed") |
| + if status, out := putJSON(t, configURL(fx, "titogo"), map[string]any{ |
| + "set": map[string]any{ |
| + "A": map[string]any{"kind": "env", "value": "def-a"}, |
| + "S": map[string]any{"kind": "secret", "envelope": envelope}, |
| + }, |
| + }, token); status != http.StatusOK { |
| + t.Fatalf("PUT default = %d %v", status, out) |
| + } |
| + if status, out := putJSON(t, configURL(fx, "titogo"), map[string]any{ |
| + "environment": "prod", |
| + "set": map[string]any{ |
| + "A": map[string]any{"kind": "env", "value": "env-a"}, |
| + "B": map[string]any{"kind": "env", "value": "env-b"}, |
| + }, |
| + }, token); status != http.StatusOK { |
| + t.Fatalf("PUT prod = %d %v", status, out) |
| + } |
| + if _, _, err := appconfig.ApplyInstance(context.Background(), fx.rel, release.OpsAccount, "titogo", effectiveHost, |
| + map[string]appconfig.Var{"B": {Kind: "env", Value: "platform-b"}}, nil); err != nil { |
| + t.Fatal(err) |
| + } |
| + putInstanceRecord(t, fx, "titogo", effectiveHost, "prod") |
| + return fx, token |
| +} |
| + |
| +func TestAPIConfigEffective(t *testing.T) { |
| + fx, token := effectiveWorld(t, "code-config-effective") |
| + status, out := getJSON(t, effectiveURL(fx, "titogo", effectiveHost), token) |
| + if status != http.StatusOK { |
| + t.Fatalf("GET effective = %d %v", status, out) |
| + } |
| + if str(t, out, "host") != effectiveHost || str(t, out, "environment") != "prod" || out["owned"] != false { |
| + t.Fatalf("head = %v", out) |
| + } |
| + layers, _ := out["layers"].(map[string]any) |
| + def, _ := layers["default"].(map[string]any) |
| + env, _ := layers["environment"].(map[string]any) |
| + ov, _ := layers["overlay"].(map[string]any) |
| + if str(t, def, "version") != storedVersion(t, fx, appconfig.Key(release.OpsAccount, "titogo")) { |
| + t.Errorf("layers.default = %v", def) |
| + } |
| + if str(t, env, "name") != "prod" || str(t, env, "version") != storedVersion(t, fx, appconfig.EnvironmentKey(release.OpsAccount, "titogo", "prod")) { |
| + t.Errorf("layers.environment = %v", env) |
| + } |
| + if str(t, ov, "version") != storedVersion(t, fx, appconfig.InstanceConfigKey(release.OpsAccount, "titogo", effectiveHost)) { |
| + t.Errorf("layers.overlay = %v", ov) |
| + } |
| + byKey := varsByKey(t, out) |
| + if len(byKey) != 3 { |
| + t.Fatalf("vars = %v, want A, B, S", out["vars"]) |
| + } |
| + shadows := func(row map[string]any) string { |
| + list, ok := row["shadows"].([]any) |
| + if !ok { |
| + t.Fatalf("row %v has no shadows list", row) |
| + } |
| + parts := make([]string, 0, len(list)) |
| + for _, s := range list { |
| + parts = append(parts, s.(string)) |
| + } |
| + return strings.Join(parts, ",") |
| + } |
| + a, b, s := byKey["A"], byKey["B"], byKey["S"] |
| + if str(t, a, "from") != "environment" || shadows(a) != "default" || str(t, a, "value") != "env-a" { |
| + t.Errorf("A = %v", a) |
| + } |
| + if str(t, b, "from") != "overlay" || shadows(b) != "environment" { |
| + t.Errorf("B = %v", b) |
| + } |
| + if _, ok := b["value"]; ok || str(t, b, "digest") != appconfig.Digest(appconfig.Var{Kind: "env", Value: "platform-b"}) { |
| + t.Errorf("overlay var B = %v, want its digest and no value", b) |
| + } |
| + stored, _ := storedManifest(t, fx, "titogo") |
| + if str(t, s, "from") != "default" || str(t, s, "kind") != "secret" || str(t, s, "digest") != appconfig.Digest(stored.Vars["S"]) { |
| + t.Errorf("S = %v", s) |
| + } |
| + for _, field := range []string{"value", "envelope"} { |
| + if _, ok := s[field]; ok { |
| + t.Errorf("secret row carries %q: %v", field, s) |
| + } |
| + } |
| +} |
| + |
| +// An owned environment's view has no default layer and no var from or |
| +// shadowing it; an unbound route's has no environment layer. |
| +func TestAPIConfigEffectiveOwnedAndUnbound(t *testing.T) { |
| + w := newTeamWorld(t, "code-config-effective-owned") |
| + status, out := getJSON(t, w.url("/config/effective?host=mine.go.tito.io"), w.member) |
| + if status != http.StatusOK { |
| + t.Fatalf("owned = %d %v", status, out) |
| + } |
| + layers, _ := out["layers"].(map[string]any) |
| + if out["owned"] != true || str(t, out, "environment") != "team" { |
| + t.Errorf("owned head = %v", out) |
| + } |
| + if _, ok := layers["default"]; ok { |
| + t.Errorf("owned layers = %v, want no default", layers) |
| + } |
| + byKey := varsByKey(t, out) |
| + if _, ok := byKey["OWNER_CANARY"]; ok || str(t, byKey["TEAM_ONLY"], "from") != "environment" { |
| + t.Errorf("owned vars = %v", out["vars"]) |
| + } |
| + if raw := mustRaw(t, w.url("/config/effective?host=mine.go.tito.io"), w.member); strings.Contains(raw, `"default"`) { |
| + t.Errorf("owned view names the default layer: %s", raw) |
| + } |
| + |
| + status, out = getJSON(t, w.url("/config/effective?host=def.go.tito.io"), w.member) |
| + if status != http.StatusOK { |
| + t.Fatalf("unbound = %d %v", status, out) |
| + } |
| + layers, _ = out["layers"].(map[string]any) |
| + if _, ok := layers["environment"]; ok || str(t, out, "environment") != "" || out["owned"] != false { |
| + t.Errorf("unbound = %v, want no environment layer", out) |
| + } |
| + if str(t, varsByKey(t, out)["OWNER_CANARY"], "from") != "default" { |
| + t.Errorf("unbound vars = %v", out["vars"]) |
| + } |
| +} |
| + |
| +func mustRaw(t *testing.T, u, bearer string) string { |
| + t.Helper() |
| + _, body := getRaw(t, u, bearer) |
| + return body |
| +} |
| + |
| +func TestAPIConfigEffectiveGate(t *testing.T) { |
| + fx, token := effectiveWorld(t, "code-config-effective-gate") |
| + eve := cliToken(t, fx, "eve@keymail.dev", "code-config-effective-gate-eve") |
| + if _, err := fx.st.CreateAppIn(OpsAccountID, "other", "paul@keymail.dev", time.Now()); err != nil { |
| + t.Fatal(err) |
| + } |
| + putInstanceRecord(t, fx, "other", "x.other.example.com", "") |
| + want := canonicalNotFound(t) |
| + for _, c := range []struct { |
| + what, u, bearer string |
| + }{ |
| + {"unknown host", effectiveURL(fx, "titogo", "nobody.titogo.example.com"), token}, |
| + {"bad host shape", effectiveURL(fx, "titogo", "../config"), token}, |
| + {"another app's host", effectiveURL(fx, "titogo", "x.other.example.com"), token}, |
| + {"a member of nothing", effectiveURL(fx, "titogo", effectiveHost), eve}, |
| + {"another account", fx.ts.URL + "/api/cli/apps/zzzz/titogo/config/effective?host=" + effectiveHost, token}, |
| + {"an unknown app", effectiveURL(fx, "ghost-app", effectiveHost), token}, |
| + } { |
| + status, h, body := rawReq(t, http.MethodGet, c.u, c.bearer, "") |
| + assertNotFound(t, c.what, want, status, h, body) |
| + } |
| + status, out := getJSON(t, fx.ts.URL+"/api/cli/apps/bab/titogo/config/effective", token) |
| + if status != http.StatusBadRequest || str(t, out, "error") != "host is required" { |
| + t.Errorf("missing host = %d %v, want 400", status, out) |
| + } |
| +} |
| + |
| +// A team credential never reaches the effective view: it gets exactly what |
| +// it gets on the sync door, another plain cliRoute. |
| +func TestAPIConfigEffectiveTeamRefused(t *testing.T) { |
| + w := newTeamWorld(t, "code-config-effective-team") |
| + wantStatus, wantH, wantBody := rawReq(t, http.MethodPost, w.url("/config/sync"), w.team, `{}`) |
| + status, h, body := rawReq(t, http.MethodGet, w.url("/config/effective?host=mine.go.tito.io"), w.team, "") |
| + if status != wantStatus || body != wantBody || h.Get("Content-Type") != wantH.Get("Content-Type") { |
| + t.Fatalf("team effective = %d %q, want sync's %d %q", status, body, wantStatus, wantBody) |
| + } |
| + if status == http.StatusOK { |
| + t.Fatal("a team credential read the effective view") |
| + } |
| +} |
| + |
| +// A team's GET of its owned environment carries that bundle's version and |
| +// digests, and nothing of the default bundle: not its vars, not its version. |
| +func TestAPIConfigTeamGetOwnedVersion(t *testing.T) { |
| + w := newTeamWorld(t, "code-config-team-version") |
| + status, body := getRaw(t, w.url("/config?environment=team"), w.team) |
| + if status != http.StatusOK { |
| + t.Fatalf("team GET = %d %s", status, body) |
| + } |
| + _, out := getJSON(t, w.url("/config?environment=team"), w.team) |
| + if got, want := str(t, out, "version"), storedVersion(t, w.fx, appconfig.EnvironmentKey(release.OpsAccount, "titogo", "team")); got != want { |
| + t.Fatalf("version = %q, want %q", got, want) |
| + } |
| + m, _, _, err := appconfig.GetEnvironment(context.Background(), w.fx.rel, "bab", "titogo", "team") |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if got := str(t, varsByKey(t, out)["TEAM_ONLY"], "digest"); got != appconfig.Digest(m.Vars["TEAM_ONLY"]) { |
| + t.Errorf("TEAM_ONLY digest = %q", got) |
| + } |
| + defVersion := storedVersion(t, w.fx, appconfig.Key(release.OpsAccount, "titogo")) |
| + for _, leak := range []string{defVersion, "OWNER_CANARY", `"layers"`, `"default"`} { |
| + if strings.Contains(body, leak) { |
| + t.Errorf("team GET carries %q: %s", leak, body) |
| + } |
| + } |
| +} |
diff --git a/internal/console/apiconfigeffective.go b/internal/console/apiconfigeffective.go| new file mode 100644 |
| index 000000000..bc5592cfa |
| --- /dev/null |
| +++ b/internal/console/apiconfigeffective.go |
| @@ -0,0 +1,108 @@ |
| +package console |
| + |
| +import ( |
| + "context" |
| + "errors" |
| + "log" |
| + "net/http" |
| + "os" |
| + "strings" |
| + |
| + "github.com/carlosframework/platform/internal/appconfig" |
| + "github.com/carlosframework/platform/internal/provision" |
| +) |
| + |
| +// handleAPIConfigEffective answers what one route's config resolves to and |
| +// where each key comes from (#522, spec §4.4): the default bundle, the |
| +// route's environment and the platform's overlay for its host, each with |
| +// the version of the bytes read, merged by the box's own rules |
| +// (appconfig.LoadHostLayers). This is how an owner sees a key it set in the |
| +// default bundle overridden above it. |
| +// |
| +// The host is resolved only through this app's instance record, the same |
| +// way the instance doors resolve one: a host the app has no record for |
| +// (hand-routed, another app's, or no route at all) is the gate's own |
| +// byte-identical 404, so this door cannot be used to learn which hosts |
| +// exist elsewhere. The environment comes from that record, never from the |
| +// caller. |
| +// |
| +// It is registered on a plain cliRoute, so a team credential never reaches |
| +// it: a team reads its owned environment through the GET door and never |
| +// sees the default bundle or an overlay, not even their versions (§4.8). |
| +// |
| +// It shows the stored layers only. What a box adds on top at run time (an |
| +// exec instance's own env file, agent-owned control variables) is not in |
| +// the bucket and so not here. |
| +func (s *Server) handleAPIConfigEffective(w http.ResponseWriter, r *http.Request) { |
| + _, acct, app, ok := s.apiAccountApp(w, r) |
| + if !ok { |
| + return |
| + } |
| + host := strings.TrimSpace(r.URL.Query().Get("host")) |
| + if host == "" { |
| + jsonError(w, http.StatusBadRequest, "host is required") |
| + return |
| + } |
| + // Shape-checked before the key builder, for the instance GET's reason; |
| + // a host no record could carry is simply not one of this app's. |
| + if !provision.ValidHostShape(host) { |
| + http.NotFound(w, r) |
| + return |
| + } |
| + ctx, cancel := context.WithTimeout(r.Context(), configStoreTimeout) |
| + defer cancel() |
| + rec, _, err := s.readRecord(ctx, acct.Sqid, app, host) |
| + if errors.Is(err, os.ErrNotExist) { |
| + http.NotFound(w, r) |
| + return |
| + } |
| + if err != nil { |
| + log.Printf("console: api config effective %s/%s: record: %v", acct.Sqid, app, err) |
| + jsonError(w, http.StatusBadGateway, "could not read the config — try again") |
| + return |
| + } |
| + hl, err := appconfig.LoadHostLayers(ctx, s.cfg.Releases, acct.Sqid, app, rec.Environment, host) |
| + if err != nil { |
| + log.Printf("console: api config effective %s/%s (%s): %v", acct.Sqid, app, configBundleName(rec.Environment), err) |
| + jsonError(w, http.StatusBadGateway, "could not read the config — try again") |
| + return |
| + } |
| + writeJSON(w, http.StatusOK, effectiveView(host, hl)) |
| +} |
| + |
| +// effectiveView is the wire form of hl (spec §4.4). A layer that is no part |
| +// of the merge has no entry at all rather than an empty one: the default |
| +// for an owned environment, which never folds it in, and the environment |
| +// for a route bound to none. An absent layer that IS part of the merge |
| +// reads as version "none". |
| +// |
| +// Rows follow the GET door's rule for secrets: no envelope field exists to |
| +// fill. A value appears only where LoadHostLayers set one (a plain var from |
| +// the default or environment layer), so an overlay's plain value shows as |
| +// its digest alone. |
| +func effectiveView(host string, hl *appconfig.HostLayers) map[string]any { |
| + layers := map[string]any{ |
| + "overlay": map[string]any{"version": hl.Overlay.Version}, |
| + } |
| + if !hl.Owned { |
| + layers["default"] = map[string]any{"version": hl.Default.Version} |
| + } |
| + if hl.EnvName != "" { |
| + layers["environment"] = map[string]any{"name": hl.EnvName, "version": hl.Environment.Version} |
| + } |
| + vars := make([]map[string]any, 0, len(hl.Vars)) |
| + for _, v := range hl.Vars { |
| + row := map[string]any{"key": v.Key, "kind": v.Kind, "digest": v.Digest, "from": v.From, "shadows": v.Shadows} |
| + if v.Kind == "env" && v.From != appconfig.FromOverlay { |
| + row["value"] = v.Value |
| + } |
| + vars = append(vars, row) |
| + } |
| + return map[string]any{ |
| + "host": host, |
| + "environment": hl.EnvName, |
| + "owned": hl.Owned, |
| + "layers": layers, |
| + "vars": vars, |
| + } |
| +} |
diff --git a/internal/console/authcli.go b/internal/console/authcli.go| index 6c4607db8..57cab8b93 100644 |
| --- a/internal/console/authcli.go |
| +++ b/internal/console/authcli.go |
| @@ -960,6 +960,11 @@ func (s *Server) registerCLIRoutes() { |
| // and fork. Closed to every service role, owner-gated inside. |
| s.registerEnvironmentRoutes() |
| s.cliRoute("POST /api/cli/apps/{account}/{app}/config/sync", svcrole.Allow(svcrole.Operate), s.handleAPIConfigSync) |
| + // The effective view of one route (apiconfigeffective.go, #522): which |
| + // layer each key comes from. A plain cliRoute, not a scoped one, so a |
| + // team credential is refused here as on sync: a team never sees the |
| + // default bundle or an overlay, not even their versions. |
| + s.cliRoute("GET /api/cli/apps/{account}/{app}/config/effective", svcrole.Allow(svcrole.Operate), s.handleAPIConfigEffective) |
| // The routes read (apiroutes.go, issue #64) — the member-only door onto |
| // this box's registry rows for one app, so a route's environment |
| // binding can be read back without a box shell. |
diff --git a/internal/console/claim_invariant_fixtures_test.go b/internal/console/claim_invariant_fixtures_test.go| index ae025c3d4..dd868a9e4 100644 |
| --- a/internal/console/claim_invariant_fixtures_test.go |
| +++ b/internal/console/claim_invariant_fixtures_test.go |
| @@ -843,6 +843,7 @@ var claimFixtures = map[string]claimFixture{ |
| "route GET /api/cli/apps/{account}/{app}/availability": claimRead("reads availability counts"), |
| "route GET /api/cli/apps/{account}/{app}/channels": claimRead("reads channel pointers"), |
| "route GET /api/cli/apps/{account}/{app}/config": claimRead("reads app config metadata (never secret values)"), |
| + "route GET /api/cli/apps/{account}/{app}/config/effective": claimRead("reads one route's config layers, versions and digests (never secret values)"), |
| "route GET /api/cli/apps/{account}/{app}/db/{host}/ltx/{level}": claimRead("serves exact LTX versions through lease.VersionedStore reads only"), |
| "route GET /api/cli/apps/{account}/{app}/domains": claimRead("lists domain claims"), |
| "route GET /api/cli/apps/{account}/{app}/domains/{host}": claimRead("reads one domain claim and its DNS status"), |
diff --git a/internal/console/claim_invariant_probes_read_test.go b/internal/console/claim_invariant_probes_read_test.go| index f0adf4e6c..e34977907 100644 |
| --- a/internal/console/claim_invariant_probes_read_test.go |
| +++ b/internal/console/claim_invariant_probes_read_test.go |
| @@ -265,6 +265,8 @@ var claimReadProbes = map[string]claimProbe{ |
| "route GET /api/cli/apps/{account}/{app}/availability": claimAPIRead(nil, "/api/cli/apps/bab/titogo/availability", `"groups"`), |
| "route GET /api/cli/apps/{account}/{app}/channels": claimAPIRead(nil, "/api/cli/apps/bab/kass/channels", `"stable"`), |
| "route GET /api/cli/apps/{account}/{app}/config": claimAPIRead(nil, "/api/cli/apps/bab/titogo/config", `"bundle"`), |
| + "route GET /api/cli/apps/{account}/{app}/config/effective": claimAPIRead(claimWorldInstance, |
| + "/api/cli/apps/bab/titogo/config/effective?host=acme.go.tito.io", `"host":"acme.go.tito.io"`), |
| "route GET /api/cli/apps/{account}/{app}/db/{host}/ltx/{level}": claimAPIRead(func(t *testing.T, cx *claimCase) { cx.dbWorld(t) }, |
| "/api/cli/apps/bab/titogo/db/"+claimDBHost+"/ltx/0", `"files"`, `"handle"`, `"min_txid":1`), |
| "route GET /api/cli/apps/{account}/{app}/domains": claimAPIRead(claimWorldAlias, "/api/cli/apps/bab/titogo/domains", "tickets.example.com"), |
diff --git a/internal/console/teamdoors_test.go b/internal/console/teamdoors_test.go| index aaf771069..ed80d1bd6 100644 |
| --- a/internal/console/teamdoors_test.go |
| +++ b/internal/console/teamdoors_test.go |
| @@ -61,6 +61,8 @@ var teamDoors = []string{ |
| // scoped registration has to argue with the words next to it. |
| var teamClosed = []string{ |
| "POST /api/cli/apps/{account}/{app}/config/sync", |
| + // The effective view (#522) shows the default bundle and overlays. |
| + "GET /api/cli/apps/{account}/{app}/config/effective", |
| "POST /api/cli/apps/{account}/{app}/restart", |
| "GET /api/cli/apps", |
| "GET /api/cli/apps/{account}/{app}/regions", |
diff --git a/internal/console/testdata/claim-routes.txt b/internal/console/testdata/claim-routes.txt| index 46cfd744c..63dccb154 100644 |
| --- a/internal/console/testdata/claim-routes.txt |
| +++ b/internal/console/testdata/claim-routes.txt |
| @@ -71,6 +71,7 @@ route GET /api/cli/apps/{account}/{app}/assets |
| route GET /api/cli/apps/{account}/{app}/availability |
| route GET /api/cli/apps/{account}/{app}/channels |
| route GET /api/cli/apps/{account}/{app}/config |
| +route GET /api/cli/apps/{account}/{app}/config/effective |
| route GET /api/cli/apps/{account}/{app}/db/{host}/ltx/{level} |
| route GET /api/cli/apps/{account}/{app}/db/{host}/ltx/{level}/{span} |
| route GET /api/cli/apps/{account}/{app}/domains |