Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
feat: renamed variables by review
=426d18831211
diff --git a/tests/CLAUDE.md b/tests/CLAUDE.mdindex 4e6972be2d..f5fb110390 100644--- a/tests/CLAUDE.md+++ b/tests/CLAUDE.md@@ -271,10 +271,10 @@ has one, they have stopped meaning anything.h := harness.From(t) // the stack this package's TestMain builttn := h.NewTenant(t) // fresh organization with its own admintn.Admin // *Principal: .API, .Token, .Email, .Kind, .ID-tn.Address("alice") // alice@<tenant-nonce>.test+tn.Email("alice") // alice@<tenant-nonce>.testtn.NewUser(t, harness.WithName("alice")) // real user, invited through mail-tn.NewIdentity(t, harness.OrgRole("admin")) // machine identity+tn.NewMachineIdentity(t, harness.OrgRole("admin"))tn.Mail(t).Expect(t, addr, smtp.Subject("x")) // waits on this tenant's mailtn.SetPlan(t, license.Enterprise().Without(license.RBAC))tn.Client(t, token) // a client on this tenant's bucketdiff --git a/tests/fakes/github/handle.go b/tests/fakes/github/controlplane.gosimilarity index 66%rename from tests/fakes/github/handle.gorename to tests/fakes/github/controlplane.goindex dca7034971..0c2bbed96e 100644--- a/tests/fakes/github/handle.go+++ b/tests/fakes/github/controlplane.go@@ -6,11 +6,11 @@ import ("github.com/Infisical/infisical/tests/infra/fakenet")-// Handle is a test's view of one GitHub account inside fakenet.+// ControlPlane is a test's view of one GitHub account inside fakenet.//// Everything generic comes from the embedded Scope: State, Seed, Fail, Calls,// Received, and cleanup. Only the naming below is specific to GitHub.-type Handle struct {+type ControlPlane struct {*fakenet.Scope[Account]}@@ -18,28 +18,28 @@ type Handle struct {//// The caller passes the credential rather than the fixture, so this package stays// independent of how a connection was created.-func Open(tt *testing.T, adminURL, credential string) *Handle {+func Open(tt *testing.T, adminURL, credential string) *ControlPlane {tt.Helper()- return &Handle{fakenet.Open[Account](tt, adminURL, Service.Host(), credential)}+ return &ControlPlane{fakenet.Open[Account](tt, adminURL, Service.Host(), credential)}}// Repo is a repository's secrets. Nil when the sync has never touched it, which is// itself the assertion in a test about a sync that should not have run.-func (h *Handle) Repo(tt *testing.T, full string) *Store {+func (cp *ControlPlane) Repo(tt *testing.T, full string) *Store {tt.Helper()- return h.State(tt).Stores["repos/"+full]+ return cp.State(tt).Stores["repos/"+full]}// OrgSecrets is an organization's secrets.-func (h *Handle) OrgSecrets(tt *testing.T, org string) *Store {+func (cp *ControlPlane) OrgSecrets(tt *testing.T, org string) *Store {tt.Helper()- return h.State(tt).Stores["orgs/"+org]+ return cp.State(tt).Stores["orgs/"+org]}// Env is a repository environment's secrets.-func (h *Handle) Env(tt *testing.T, full, env string) *Store {+func (cp *ControlPlane) Env(tt *testing.T, full, env string) *Store {tt.Helper()- return h.State(tt).Stores["repos/"+full+"/envs/"+env]+ return cp.State(tt).Stores["repos/"+full+"/envs/"+env]}// RepoSecret seeds a secret that is already at the destination before Infisicaldiff --git a/tests/fakes/license/handle.go b/tests/fakes/license/controlplane.gosimilarity index 100%rename from tests/fakes/license/handle.gorename to tests/fakes/license/controlplane.godiff --git a/tests/fakes/smtp/handle.go b/tests/fakes/smtp/controlplane.gosimilarity index 98%rename from tests/fakes/smtp/handle.gorename to tests/fakes/smtp/controlplane.goindex f256bf3008..da1744ab18 100644--- a/tests/fakes/smtp/handle.go+++ b/tests/fakes/smtp/controlplane.go@@ -40,7 +40,7 @@ func (in *Inbox) Expect(tt *testing.T, addr string, filters ...Filter) Message {addr = strings.ToLower(addr)if !strings.HasSuffix(addr, "@"+in.domain) {tt.Fatalf("smtp: this inbox is scoped to @%s but was asked for %s.\n"+- "Reading another tenant's mail would make the test order-dependent; use tn.Address(local)",+ "Reading another tenant's mail would make the test order-dependent; use tn.Email(local)",in.domain, addr)}return in.ExpectEvent[MessageReceived](tt, func(e MessageReceived) bool {diff --git a/tests/fixture/project.go b/tests/fixture/project.goindex f8e99b16a7..07e5a34516 100644--- a/tests/fixture/project.go+++ b/tests/fixture/project.go@@ -95,7 +95,7 @@ func newPrincipalConfig(opts []PrincipalOption) principalConfig {return cfg}-func (p *Project) NewIdentity(tt *testing.T, opts ...PrincipalOption) *harness.Principal {+func (p *Project) NewMachineIdentity(tt *testing.T, opts ...PrincipalOption) *harness.Principal {tt.Helper()cfg := newPrincipalConfig(opts)@@ -119,7 +119,7 @@ func (p *Project) NewIdentity(tt *testing.T, opts ...PrincipalOption) *harness.Prequire.NoErrorf(tt, err, "creating identity %s in %s", cfg.name, p.Slug)require.NotNilf(tt, res.JSON200, "creating identity %s in %s returned %d: %s",cfg.name, p.Slug, res.StatusCode(), apierr.Body(res.Body))- return p.tn.LoginIdentity(tt, res.JSON200.Identity.Id, cfg.name)+ return p.tn.LoginWithUniversalAuth(tt, res.JSON200.Identity.Id, cfg.name)}func (p *Project) NewUser(tt *testing.T, opts ...PrincipalOption) *harness.Principal {@@ -159,7 +159,7 @@ func (p *Project) Grant(tt *testing.T, pr *harness.Principal, roles ...string) {require.Equalf(tt, http.StatusOK, res.StatusCode(), "adding %s to %s: %s",pr.Email, p.Slug, apierr.Body(res.Body))- case harness.Identity:+ case harness.MachineIdentity:items := make([]api.CreateProjectIdentityMembershipJSONBody_Roles_Item, 0, len(roles))for _, slug := range roles {var item api.CreateProjectIdentityMembershipJSONBody_Roles_Itemdiff --git a/tests/harness/harness.go b/tests/harness/harness.goindex 26a17d1445..3e6778d368 100644--- a/tests/harness/harness.go+++ b/tests/harness/harness.go@@ -32,7 +32,7 @@ var current *Stack// Stack is a running Infisical and everything around it.type Stack struct {profile Profile- modules map[infra.Key]infra.Handle+ modules map[infra.ModuleKey]infra.Handlelog infra.Loggerpkg stringmainFile string@@ -180,7 +180,7 @@ func bringUp(ctx context.Context, profile Profile, cfg *config, pkg string) (*St// network, and its containers are package-qualified by name anyway.stackNet := infra.NetworkName- handles := map[infra.Key]infra.Handle{}+ handles := map[infra.ModuleKey]infra.Handle{}var owned []infra.Handlefor _, mod := range plan.Modules() {@@ -233,7 +233,7 @@ func From(t *testing.T) *Stack {func (s *Stack) App() *infisical.Handle { return s.app }// Require returns a module handle, or fails the test naming the option to add.-func (s *Stack) Require(t *testing.T, key infra.Key, option string) infra.Handle {+func (s *Stack) Require(t *testing.T, key infra.ModuleKey, option string) infra.Handle {t.Helper()h, ok := s.modules[key]if !ok {@@ -281,19 +281,19 @@ func (s *Stack) InstanceAdmin(t *testing.T) *Principal {s.adminOnce.Do(func() {ip := newIP()- token := s.root.IdentityToken+ token := s.root.MachineIdentityTokenif token == "" {token = s.rootToken(t, ip)}s.instanceAdmin = &Principal{- Kind: Identity,- ID: s.root.IdentityID,+ Kind: MachineIdentity,+ ID: s.root.MachineIdentityID,Name: "instance-admin",Token: token,API: s.client(t, token, ip),ip: ip,}- if s.root.IdentityToken == "" {+ if s.root.MachineIdentityToken == "" {s.instanceAdmin.Kind = Users.instanceAdmin.ID = s.root.UserIDs.instanceAdmin.Email = s.root.Emaildiff --git a/tests/harness/infisical/bootstrap.go b/tests/harness/infisical/bootstrap.goindex d4a9cef563..e6e0e9b710 100644--- a/tests/harness/infisical/bootstrap.go+++ b/tests/harness/infisical/bootstrap.go@@ -35,12 +35,12 @@ const (// level suites get.// - The organization it creates is incidental. Tenants make their own.type Root struct {- UserID uuid.UUID- Email string- Password string- OrgID uuid.UUID- IdentityID uuid.UUID- IdentityToken string+ UserID uuid.UUID+ Email string+ Password string+ OrgID uuid.UUID+ MachineIdentityID uuid.UUID+ MachineIdentityToken string}// Bootstrap prepares a freshly migrated instance.@@ -68,31 +68,31 @@ func Bootstrap(ctx context.Context, baseURL string) (Root, error) {case alreadyBootstrapped(res.StatusCode(), res.Body):// An adopted instance. The credentials are constants, so this is recoverable// rather than fatal: log in and carry on with what the first caller created.- return adopt(ctx, c)+ return loginAsRoot(ctx, c)default:return Root{}, apiError("bootstrap", res.StatusCode(), res.Body)}body := res.JSON200root := Root{- UserID: body.User.Id,- Email: RootEmail,- Password: RootPassword,- OrgID: body.Organization.Id,- IdentityID: body.Identity.Id,- IdentityToken: body.Identity.Credentials.Token,+ UserID: body.User.Id,+ Email: RootEmail,+ Password: RootPassword,+ OrgID: body.Organization.Id,+ MachineIdentityID: body.Identity.Id,+ MachineIdentityToken: body.Identity.Credentials.Token,}// bootstrapInstance sets allowSignUp:false whenever the instance is not cloud.// Without turning it back on, creating a second real user is impossible, and that// is the only path to a non-administrator principal.- if err := allowSignUp(ctx, baseURL, root.IdentityToken); err != nil {+ if err := allowSignUp(ctx, baseURL, root.MachineIdentityToken); err != nil {return Root{}, err}return root, nil}-func adopt(ctx context.Context, c *api.ClientWithResponses) (Root, error) {+func loginAsRoot(ctx context.Context, c *api.ClientWithResponses) (Root, error) {res, err := c.LoginV3WithResponse(ctx, api.LoginV3JSONRequestBody{Email: RootEmail,Password: RootPassword,diff --git a/tests/harness/infisical/bootstrap_test.go b/tests/harness/infisical/bootstrap_test.goindex 34ade81688..f9541c148c 100644--- a/tests/harness/infisical/bootstrap_test.go+++ b/tests/harness/infisical/bootstrap_test.go@@ -20,8 +20,8 @@ func TestBootstrap(t *testing.T) {require.NoError(t, err)t.Run("should yield an instance admin identity token", func(t *testing.T) {- require.NotEmpty(t, root.IdentityToken, "instance-level suites have no principal")- require.NotEqual(t, uuid.Nil, root.IdentityID)+ require.NotEmpty(t, root.MachineIdentityToken, "instance-level suites have no principal")+ require.NotEqual(t, uuid.Nil, root.MachineIdentityID)})t.Run("should keep the root user credentials", func(t *testing.T) {diff --git a/tests/harness/infisical/infisical.go b/tests/harness/infisical/infisical.goindex 9be8890d3d..eb52f3d876 100644--- a/tests/harness/infisical/infisical.go+++ b/tests/harness/infisical/infisical.go@@ -18,7 +18,7 @@ import ()const (- Key = infra.Key("infisical")+ Key = infra.ModuleKey("infisical")// backend/Dockerfile: ENV HOST=0.0.0.0, EXPOSE 4000. The standalone image uses// 8080; this is not that image.@@ -63,17 +63,17 @@ func Module(opts ...Option) infra.Module {return m}-func (m *module) Key() infra.Key { return Key }+func (m *module) Key() infra.ModuleKey { return Key }// Requires is the hard floor. env.ts enforces Redis with a zod refine, and the// database URI has a default that resolves to a literal "undefined" host, so both// fail at connect time rather than parse time if absent.-func (m *module) Requires() []infra.Key { return []infra.Key{postgres.Key, redis.Key} }+func (m *module) Requires() []infra.ModuleKey { return []infra.ModuleKey{postgres.Key, redis.Key} }// Optional is consumed if declared. fakenet is what makes outbound calls, mail and// entitlements controllable, and mail is what makes user creation possible at all.-func (m *module) Optional() []infra.Key {- return []infra.Key{fakenet.Key}+func (m *module) Optional() []infra.ModuleKey {+ return []infra.ModuleKey{fakenet.Key}}func (m *module) Name() infra.NameParts {diff --git a/tests/harness/infisical/infisical_test.go b/tests/harness/infisical/infisical_test.goindex 67cd0b7f59..fef443bf79 100644--- a/tests/harness/infisical/infisical_test.go+++ b/tests/harness/infisical/infisical_test.go@@ -34,7 +34,7 @@ func bootStack(t *testing.T, opts ...infisical.Option) *infisical.Handle {mods := []infra.Module{postgres.Module(), redis.Module(),infisical.Module(append([]infisical.Option{infisical.WithImage(img)}, opts...)...)}- scopes := map[infra.Key]infra.Scope{}+ scopes := map[infra.ModuleKey]infra.Scope{}for _, m := range mods {scopes[m.Key()] = infra.Shared}@@ -44,7 +44,7 @@ func bootStack(t *testing.T, opts ...infisical.Option) *infisical.Handle {runner := infra.NewRunner(infra.Workspace(), log)require.NoError(t, runner.Network(ctx, infra.NetworkName))- handles := map[infra.Key]infra.Handle{}+ handles := map[infra.ModuleKey]infra.Handle{}for _, m := range plan.Modules() {name := m.Name()name.Scope = infra.Testdiff --git a/tests/harness/principal.go b/tests/harness/principal.goindex 038aa886ff..60047952ef 100644--- a/tests/harness/principal.go+++ b/tests/harness/principal.go@@ -79,7 +79,7 @@ func (t *Tenant) NewUser(tt *testing.T, opts ...PrincipalOption) *Principal {tt.Helper()cfg := newPrincipalConfig("u", opts)ctx := tt.Context()- addr := t.Address(cfg.name)+ addr := t.Email(cfg.name)// The new user's own bucket, not the tenant's: the invite goes through// smtpRateLimit, which is a hardcoded two per forty seconds keyed on the source@@ -173,11 +173,11 @@ func (s *Stack) completeAccount(tt *testing.T, verifiedToken, ip string, body apreturn res.JSON200.User.Id, res.JSON200.Token}-// NewIdentity creates a machine identity with universal auth and logs it in.+// NewMachineIdentity creates a machine identity with universal auth and logs it in.//// Four calls and no mail, so it is much cheaper than a user. Reach for this unless// the behaviour under test is specific to a human actor.-func (t *Tenant) NewIdentity(tt *testing.T, opts ...PrincipalOption) *Principal {+func (t *Tenant) NewMachineIdentity(tt *testing.T, opts ...PrincipalOption) *Principal {tt.Helper()cfg := newPrincipalConfig("i", opts)@@ -187,20 +187,20 @@ func (t *Tenant) NewIdentity(tt *testing.T, opts ...PrincipalOption) *PrincipalRole: &cfg.orgRole,})if err != nil {- tt.Fatalf("harness: creating identity %s: %v", cfg.name, err)+ tt.Fatalf("harness: creating machine identity %s: %v", cfg.name, err)}if res.JSON200 == nil {- tt.Fatalf("harness: creating identity %s returned %d: %s", cfg.name, res.StatusCode(), apierr.Body(res.Body))+ tt.Fatalf("harness: creating machine identity %s returned %d: %s", cfg.name, res.StatusCode(), apierr.Body(res.Body))}- return t.LoginIdentity(tt, res.JSON200.Identity.Id, cfg.name)+ return t.LoginWithUniversalAuth(tt, res.JSON200.Identity.Id, cfg.name)}-// LoginIdentity attaches universal auth to an existing identity and exchanges the-// credentials for an access token.+// LoginWithUniversalAuth attaches universal auth to an existing machine identity and+// exchanges the credentials for an access token.//-// Exported for fixture packages that create an identity through a product route ---// a project, say -- and still need it to be able to authenticate.-func (t *Tenant) LoginIdentity(tt *testing.T, id uuid.UUID, name string) *Principal {+// Exported for fixture packages that create a machine identity through a product+// route -- a project, say -- and still need it to be able to authenticate.+func (t *Tenant) LoginWithUniversalAuth(tt *testing.T, id uuid.UUID, name string) *Principal {tt.Helper()ctx := tt.Context()@@ -243,7 +243,7 @@ func (t *Tenant) LoginIdentity(tt *testing.T, id uuid.UUID, name string) *Princi}return &Principal{- Kind: Identity,+ Kind: MachineIdentity,ID: id,Name: name,Token: login.JSON200.AccessToken,diff --git a/tests/harness/profile.go b/tests/harness/profile.goindex 2c6e093585..2134f61ca8 100644--- a/tests/harness/profile.go+++ b/tests/harness/profile.go@@ -38,7 +38,7 @@ func (p Profile) String() string {// shared container is adopted by name and takes its environment at creation, so if// one package declared WireMock and another did not, whichever started the instance// first would silently decide whether it runs in cloud mode for everyone.-func (p Profile) modules(img infisical.Image, fnImg fakenet.Image, caFile string, extra ...infra.Module) ([]infra.Module, map[infra.Key]infra.Scope) {+func (p Profile) modules(img infisical.Image, fnImg fakenet.Image, caFile string, extra ...infra.Module) ([]infra.Module, map[infra.ModuleKey]infra.Scope) {own := infra.Sharedif p == Isolated {own = infra.Package@@ -50,7 +50,7 @@ func (p Profile) modules(img infisical.Image, fnImg fakenet.Image, caFile stringfakenet.Module(fakenet.WithImage(fnImg), fakenet.WithCAFile(caFile)),infisical.Module(infisical.WithImage(img)),}- scopes := map[infra.Key]infra.Scope{+ scopes := map[infra.ModuleKey]infra.Scope{postgres.Key: own,redis.Key: own,// Shared even under Isolated: it holds a fixed address on the network, anddiff --git a/tests/harness/tenant.go b/tests/harness/tenant.goindex 758ee3a9ce..c67617e00d 100644--- a/tests/harness/tenant.go+++ b/tests/harness/tenant.go@@ -53,12 +53,12 @@ type Kind intconst (User Kind = iota- Identity+ MachineIdentity)func (k Kind) String() string {- if k == Identity {- return "identity"+ if k == MachineIdentity {+ return "machine identity"}return "user"}@@ -79,9 +79,9 @@ type Principal struct {ip string}-// Address returns a mailbox inside this tenant's own domain, so two parallel tests+// Email returns a mailbox inside this tenant's own domain, so two parallel tests// inviting "alice" never collide.-func (t *Tenant) Address(local string) string {+func (t *Tenant) Email(local string) string {return local + "@" + t.mailDomain}@@ -135,7 +135,7 @@ func (s *Stack) NewTenant(t *testing.T, opts ...TenantOption) *Tenant {func (t *Tenant) signUpAdmin(tt *testing.T, orgName string) *Principal {tt.Helper()ctx := tt.Context()- addr := t.Address("admin")+ addr := t.Email("admin")// Its own bucket: the signup mail goes through smtpRateLimit.ip := newIP()@@ -344,7 +344,7 @@ func (t *Tenant) Client(tt *testing.T, token string) *api.ClientWithResponses {// Module returns a container handle, or fails the test naming the profile to use.//// A fixture that stubs or reads mail needs this; option is what to put in TestMain.-func (t *Tenant) Module(tt *testing.T, key infra.Key, option string) infra.Handle {+func (t *Tenant) Module(tt *testing.T, key infra.ModuleKey, option string) infra.Handle {tt.Helper()return t.stack.Require(tt, key, option)}diff --git a/tests/harnesstest/shared/principal_test.go b/tests/harnesstest/shared/principal_test.goindex d76bdea05d..e04c413211 100644--- a/tests/harnesstest/shared/principal_test.go+++ b/tests/harnesstest/shared/principal_test.go@@ -18,7 +18,7 @@ func TestIdentity_HonoursItsOrgRole(t *testing.T) {// Setuptn := harness.From(t).NewTenant(t)- identity := tn.NewIdentity(t, harness.OrgRole("no-access"))+ identity := tn.NewMachineIdentity(t, harness.OrgRole("no-access"))// Actionres, err := identity.API.CreateProjectWithResponse(t.Context(), api.CreateProjectJSONRequestBody{@@ -46,7 +46,7 @@ func TestUser_IsInvitedThroughMail(t *testing.T) {alice := tn.NewUser(t, harness.WithName("alice"))// Assert- require.Equal(t, tn.Address("alice"), alice.Email)+ require.Equal(t, tn.Email("alice"), alice.Email)res, err := alice.API.GetOrganizationPlanWithResponse(t.Context(), tn.OrgID.String(), nil)require.NoError(t, err)require.Equal(t, http.StatusOK, res.StatusCode(), "an invited user cannot reach the organization")diff --git a/tests/infra/fakenet/module.go b/tests/infra/fakenet/module.goindex e158cb9acf..ac977abfa4 100644--- a/tests/infra/fakenet/module.go+++ b/tests/infra/fakenet/module.go@@ -16,7 +16,7 @@ import ()const (- Key = infra.Key("fakenet")+ Key = infra.ModuleKey("fakenet")adminPort = 8080httpsPort = 443@@ -144,9 +144,9 @@ func Module(opts ...Option) infra.Module {return m}-func (m *module) Key() infra.Key { return Key }-func (m *module) Requires() []infra.Key { return nil }-func (m *module) Optional() []infra.Key { return nil }+func (m *module) Key() infra.ModuleKey { return Key }+func (m *module) Requires() []infra.ModuleKey { return nil }+func (m *module) Optional() []infra.ModuleKey { return nil }func (m *module) Name() infra.NameParts {return infra.NameParts{Module: "fakenet", Fingerprint: m.image.ShortID()}diff --git a/tests/infra/module.go b/tests/infra/module.goindex 24e7fa2165..67ab7319de 100644--- a/tests/infra/module.go+++ b/tests/infra/module.go@@ -7,15 +7,15 @@ import ("strings")-// Key identifies a module for lookup. A module that can appear more than once+// ModuleKey identifies a module for lookup. A module that can appear more than once// qualifies its key with the instance name, so postgres.Module(postgres.Named(// "rotation")) is "postgres:rotation" and does not collide with "postgres".-type Key string+type ModuleKey string// Module is a container the harness can start. Implementations live in// infra/<name> and are about thirty lines each, because Deps.Run does the work.type Module interface {- Key() Key+ Key() ModuleKey// Name is the identity-bearing part of the container name. The harness supplies// scope and scope id; a module supplies its own module name, instance, and a@@ -25,10 +25,10 @@ type Module interface {// Requires lists modules this one cannot start without. Validated before// anything starts, so a missing dependency fails immediately rather than as a// connection timeout ninety seconds later.- Requires() []Key+ Requires() []ModuleKey// Optional lists modules this one consumes if present and ignores if not.- Optional() []Key+ Optional() []ModuleKeyStart(context.Context, Deps) (Handle, error)}@@ -42,7 +42,7 @@ type Handle interface {// Deps is what a module sees during Start: every module that has already started,// plus the network they share.type Deps struct {- handles map[Key]Handle+ handles map[ModuleKey]Handlenetwork stringworkspace stringname NameParts@@ -76,7 +76,7 @@ func (d Deps) Run(ctx context.Context, spec ContainerSpec) (Container, error) {}// NewDeps builds the Deps handed to one module's Start.-func NewDeps(handles map[Key]Handle, network, workspace string, name NameParts, r Runner, log Logger) Deps {+func NewDeps(handles map[ModuleKey]Handle, network, workspace string, name NameParts, r Runner, log Logger) Deps {if log == nil {log = NewLogger()}@@ -89,7 +89,7 @@ func (d Deps) Log() Logger { return d.log }//// A generic method rather than a package function, which Go 1.27 allows. Modules// still wrap it (wiremock.From, postgres.MustFrom) so call sites read as prose.-func (d Deps) Get[H Handle](k Key) (H, bool) {+func (d Deps) Get[H Handle](k ModuleKey) (H, bool) {h, ok := d.handles[k]if !ok {var zero H@@ -102,19 +102,19 @@ func (d Deps) Get[H Handle](k Key) (H, bool) {// Plan is a validated, ordered set of modules ready to start.type Plan struct {modules []Module- scopes map[Key]Scope+ scopes map[ModuleKey]Scope}-func (p Plan) Modules() []Module { return p.modules }-func (p Plan) Scope(k Key) Scope { return p.scopes[k] }-func (p Plan) Declared(k Key) bool { _, ok := p.scopes[k]; return ok }+func (p Plan) Modules() []Module { return p.modules }+func (p Plan) Scope(k ModuleKey) Scope { return p.scopes[k] }+func (p Plan) Declared(k ModuleKey) bool { _, ok := p.scopes[k]; return ok }// Resolve validates a module set and returns it in dependency order.//// Everything here runs before a single container starts, so every failure below is// instant and names the fix.-func Resolve(modules []Module, scopes map[Key]Scope) (Plan, error) {- byKey := make(map[Key]Module, len(modules))+func Resolve(modules []Module, scopes map[ModuleKey]Scope) (Plan, error) {+ byKey := make(map[ModuleKey]Module, len(modules))for _, m := range modules {if _, dup := byKey[m.Key()]; dup {return Plan{}, fmt.Errorf("infra: module %q declared twice; use Named() to run a second instance", m.Key())@@ -144,12 +144,12 @@ func Resolve(modules []Module, scopes map[Key]Scope) (Plan, error) {// itself. This is not hypothetical: a Shared Infisical takes HTTP_PROXY at container// start, so pointing it at a Package-scoped WireMock breaks every other package the// moment that one finishes.-func checkLifetimes(m Module, scopes map[Key]Scope, byKey map[Key]Module) error {+func checkLifetimes(m Module, scopes map[ModuleKey]Scope, byKey map[ModuleKey]Module) error {mine, ok := scopes[m.Key()]if !ok {return fmt.Errorf("infra: no scope declared for %s", m.Key())}- for _, dep := range append(append([]Key{}, m.Requires()...), m.Optional()...) {+ for _, dep := range append(append([]ModuleKey{}, m.Requires()...), m.Optional()...) {if _, declared := byKey[dep]; !declared {continue // optional and absent}@@ -166,15 +166,15 @@ func checkLifetimes(m Module, scopes map[Key]Scope, byKey map[Key]Module) errorreturn nil}-func topoSort(modules []Module, byKey map[Key]Module) ([]Module, error) {+func topoSort(modules []Module, byKey map[ModuleKey]Module) ([]Module, error) {const (unvisited = iotainProgressdone)- state := make(map[Key]int, len(modules))+ state := make(map[ModuleKey]int, len(modules))out := make([]Module, 0, len(modules))- var path []Key+ var path []ModuleKeyvar visit func(m Module) errorvisit = func(m Module) error {@@ -187,7 +187,7 @@ func topoSort(modules []Module, byKey map[Key]Module) ([]Module, error) {state[m.Key()] = inProgresspath = append(path, m.Key())- deps := append(append([]Key{}, m.Requires()...), m.Optional()...)+ deps := append(append([]ModuleKey{}, m.Requires()...), m.Optional()...)sort.Slice(deps, func(i, j int) bool { return deps[i] < deps[j] })for _, k := range deps {if dep, ok := byKey[k]; ok {@@ -213,7 +213,7 @@ func topoSort(modules []Module, byKey map[Key]Module) ([]Module, error) {return out, nil}-func joinKeys(ks []Key) string {+func joinKeys(ks []ModuleKey) string {s := make([]string, len(ks))for i, k := range ks {s[i] = string(k)diff --git a/tests/infra/module_test.go b/tests/infra/module_test.goindex 3fae257667..4899ea7a44 100644--- a/tests/infra/module_test.go+++ b/tests/infra/module_test.go@@ -9,17 +9,17 @@ import ()type fakeModule struct {- key Key- requires []Key- optional []Key+ key ModuleKey+ requires []ModuleKey+ optional []ModuleKey}-func (f fakeModule) Key() Key { return f.key }+func (f fakeModule) Key() ModuleKey { return f.key }func (f fakeModule) Name() NameParts {return NameParts{Module: string(f.key)}}-func (f fakeModule) Requires() []Key { return f.requires }-func (f fakeModule) Optional() []Key { return f.optional }+func (f fakeModule) Requires() []ModuleKey { return f.requires }+func (f fakeModule) Optional() []ModuleKey { return f.optional }func (f fakeModule) Start(context.Context, Deps) (Handle, error) {return nil, nil}@@ -35,17 +35,17 @@ func TestResolve(t *testing.T) {// Actionplan, err := Resolve(mods(- fakeModule{key: "infisical", requires: []Key{"postgres", "redis"}},+ fakeModule{key: "infisical", requires: []ModuleKey{"postgres", "redis"}},fakeModule{key: "postgres"},fakeModule{key: "redis"},),- map[Key]Scope{"infisical": Shared, "postgres": Shared, "redis": Shared},+ map[ModuleKey]Scope{"infisical": Shared, "postgres": Shared, "redis": Shared},)// Assertrequire.NoError(t, err)got := keysOf(plan.Modules())- require.Equal(t, Key("infisical"), got[len(got)-1], "infisical must start last")+ require.Equal(t, ModuleKey("infisical"), got[len(got)-1], "infisical must start last")})t.Run("should accept an optional dependency that is absent", func(t *testing.T) {@@ -53,8 +53,8 @@ func TestResolve(t *testing.T) {// Action_, err := Resolve(- mods(fakeModule{key: "infisical", optional: []Key{"fakenet"}}),- map[Key]Scope{"infisical": Shared},+ mods(fakeModule{key: "infisical", optional: []ModuleKey{"fakenet"}}),+ map[ModuleKey]Scope{"infisical": Shared},)// Assert@@ -66,8 +66,8 @@ func TestResolve(t *testing.T) {// Action_, err := Resolve(- mods(fakeModule{key: "infisical", requires: []Key{"postgres"}}),- map[Key]Scope{"infisical": Shared},+ mods(fakeModule{key: "infisical", requires: []ModuleKey{"postgres"}}),+ map[ModuleKey]Scope{"infisical": Shared},)// Assert@@ -82,10 +82,10 @@ func TestResolve(t *testing.T) {// Action_, err := Resolve(mods(- fakeModule{key: "infisical", optional: []Key{"fakenet"}},+ fakeModule{key: "infisical", optional: []ModuleKey{"fakenet"}},fakeModule{key: "fakenet"},),- map[Key]Scope{"infisical": Shared, "fakenet": Package},+ map[ModuleKey]Scope{"infisical": Shared, "fakenet": Package},)// Assert@@ -101,10 +101,10 @@ func TestResolve(t *testing.T) {// Action_, err := Resolve(mods(- fakeModule{key: "infisical", optional: []Key{"fakenet"}},+ fakeModule{key: "infisical", optional: []ModuleKey{"fakenet"}},fakeModule{key: "fakenet"},),- map[Key]Scope{"infisical": Package, "fakenet": Shared},+ map[ModuleKey]Scope{"infisical": Package, "fakenet": Shared},)// Assert@@ -117,7 +117,7 @@ func TestResolve(t *testing.T) {// Action_, err := Resolve(mods(fakeModule{key: "postgres"}, fakeModule{key: "postgres"}),- map[Key]Scope{"postgres": Shared},+ map[ModuleKey]Scope{"postgres": Shared},)// Assert@@ -130,10 +130,10 @@ func TestResolve(t *testing.T) {// Action_, err := Resolve(mods(- fakeModule{key: "a", requires: []Key{"b"}},- fakeModule{key: "b", requires: []Key{"a"}},+ fakeModule{key: "a", requires: []ModuleKey{"b"}},+ fakeModule{key: "b", requires: []ModuleKey{"a"}},),- map[Key]Scope{"a": Shared, "b": Shared},+ map[ModuleKey]Scope{"a": Shared, "b": Shared},)// Assert@@ -145,7 +145,7 @@ func TestDepsGet(t *testing.T) {t.Parallel()type pgHandle struct{ Handle }- deps := Deps{handles: map[Key]Handle{"postgres": pgHandle{}}}+ deps := Deps{handles: map[ModuleKey]Handle{"postgres": pgHandle{}}}t.Run("should return a declared module typed", func(t *testing.T) {t.Parallel()@@ -160,8 +160,8 @@ func TestDepsGet(t *testing.T) {})}-func keysOf(ms []Module) []Key {- out := make([]Key, len(ms))+func keysOf(ms []Module) []ModuleKey {+ out := make([]ModuleKey, len(ms))for i, m := range ms {out[i] = m.Key()}diff --git a/tests/infra/postgres/postgres.go b/tests/infra/postgres/postgres.goindex 4a58244a8c..8e96fcbe97 100644--- a/tests/infra/postgres/postgres.go+++ b/tests/infra/postgres/postgres.go@@ -12,7 +12,7 @@ const (// Key is the default instance. A Named() instance qualifies it, so// postgres.Module(postgres.Named("rotation")) is "postgres:rotation" and cannot// collide with the app's own database.- Key = infra.Key("postgres")+ Key = infra.ModuleKey("postgres")port = 5432user = "infisical"@@ -49,15 +49,15 @@ func Module(opts ...Option) infra.Module {return m}-func (m *module) Key() infra.Key {+func (m *module) Key() infra.ModuleKey {if m.instance == "" {return Key}- return Key + infra.Key(":"+m.instance)+ return Key + infra.ModuleKey(":"+m.instance)}-func (m *module) Requires() []infra.Key { return nil }-func (m *module) Optional() []infra.Key { return nil }+func (m *module) Requires() []infra.ModuleKey { return nil }+func (m *module) Optional() []infra.ModuleKey { return nil }func (m *module) Name() infra.NameParts {return infra.NameParts{Module: "postgres", Instance: m.instance}@@ -115,9 +115,9 @@ func MustFrom(d infra.Deps, instance ...string) *Handle {return h}-func key(instance ...string) infra.Key {+func key(instance ...string) infra.ModuleKey {if len(instance) == 0 || instance[0] == "" {return Key}- return Key + infra.Key(":"+instance[0])+ return Key + infra.ModuleKey(":"+instance[0])}diff --git a/tests/infra/redis/redis.go b/tests/infra/redis/redis.goindex 0c2a6795d7..c87bca7046 100644--- a/tests/infra/redis/redis.go+++ b/tests/infra/redis/redis.go@@ -9,7 +9,7 @@ import ()const (- Key = infra.Key("redis")+ Key = infra.ModuleKey("redis")port = 6379)@@ -31,15 +31,15 @@ func Module(opts ...Option) infra.Module {return m}-func (m *module) Key() infra.Key {+func (m *module) Key() infra.ModuleKey {if m.instance == "" {return Key}- return Key + infra.Key(":"+m.instance)+ return Key + infra.ModuleKey(":"+m.instance)}-func (m *module) Requires() []infra.Key { return nil }-func (m *module) Optional() []infra.Key { return nil }+func (m *module) Requires() []infra.ModuleKey { return nil }+func (m *module) Optional() []infra.ModuleKey { return nil }func (m *module) Name() infra.NameParts {return infra.NameParts{Module: "redis", Instance: m.instance}}diff --git a/tests/infra/stack_test.go b/tests/infra/stack_test.goindex 4618e4412f..81896261ce 100644--- a/tests/infra/stack_test.go+++ b/tests/infra/stack_test.go@@ -14,11 +14,11 @@ import (// startAll resolves and starts a module set the way the harness will, so this// exercises the graph, the runner and every module together rather than one at a// time.-func startAll(t *testing.T, mods []infra.Module, scope infra.Scope) map[infra.Key]infra.Handle {+func startAll(t *testing.T, mods []infra.Module, scope infra.Scope) map[infra.ModuleKey]infra.Handle {t.Helper()ctx := t.Context()- scopes := make(map[infra.Key]infra.Scope, len(mods))+ scopes := make(map[infra.ModuleKey]infra.Scope, len(mods))for _, m := range mods {scopes[m.Key()] = scope}@@ -29,7 +29,7 @@ func startAll(t *testing.T, mods []infra.Module, scope infra.Scope) map[infra.Kerunner := infra.NewRunner(infra.Workspace(), log)require.NoError(t, runner.Network(ctx, infra.NetworkName))- handles := map[infra.Key]infra.Handle{}+ handles := map[infra.ModuleKey]infra.Handle{}for _, m := range plan.Modules() {name := m.Name()name.Scope = infra.Testdiff --git a/tests/suites/secretmanager/syncs/github_test.go b/tests/suites/secretmanager/syncs/github_test.goindex 6f7bdbf5f4..b06b735755 100644--- a/tests/suites/secretmanager/syncs/github_test.go+++ b/tests/suites/secretmanager/syncs/github_test.go@@ -15,7 +15,7 @@ import ()// setup returns a project, a GitHub connection, and a handle on the account it uses.-func setup(t *testing.T) (*fixture.Project, *fixture.AppConnection, *github.Handle) {+func setup(t *testing.T) (*fixture.Project, *fixture.AppConnection, *github.ControlPlane) {t.Helper()tn := harness.From(t).NewTenant(t)proj := fixture.NewProject(t, tn, fixture.WithProjectType("secret-manager"))