chore: make owner_name and owner_username consistent (#18081)

We've been using owner_name inconsistently as username. So this PR fixes
it by making the attribute naming more consistent.
This commit is contained in:
Bruno Quaresma
2025-05-28 17:25:32 -03:00
committed by GitHub
parent 3a2e36237d
commit 2ec7404197
53 changed files with 151 additions and 131 deletions
+2 -2
View File
@@ -104,10 +104,10 @@ type PostMetadataRequestDeprecated = codersdk.WorkspaceAgentMetadataResult
type Manifest struct {
AgentID uuid.UUID `json:"agent_id"`
AgentName string `json:"agent_name"`
// OwnerName and WorkspaceID are used by an open-source user to identify the workspace.
// OwnerUsername and WorkspaceID are used by an open-source user to identify the workspace.
// We do not provide insurance that this will not be removed in the future,
// but if it's easy to persist lets keep it around.
OwnerName string `json:"owner_name"`
OwnerUsername string `json:"owner_username"`
WorkspaceID uuid.UUID `json:"workspace_id"`
WorkspaceName string `json:"workspace_name"`
// GitAuthConfigs stores the number of Git configurations
+2 -2
View File
@@ -38,7 +38,7 @@ func ManifestFromProto(manifest *proto.Manifest) (Manifest, error) {
return Manifest{
AgentID: agentID,
AgentName: manifest.AgentName,
OwnerName: manifest.OwnerUsername,
OwnerUsername: manifest.OwnerUsername,
WorkspaceID: workspaceID,
WorkspaceName: manifest.WorkspaceName,
Apps: apps,
@@ -64,7 +64,7 @@ func ProtoFromManifest(manifest Manifest) (*proto.Manifest, error) {
return &proto.Manifest{
AgentId: manifest.AgentID[:],
AgentName: manifest.AgentName,
OwnerUsername: manifest.OwnerName,
OwnerUsername: manifest.OwnerUsername,
WorkspaceId: manifest.WorkspaceID[:],
WorkspaceName: manifest.WorkspaceName,
// #nosec G115 - Safe conversion for GitAuthConfigs which is expected to be small and positive
+2 -2
View File
@@ -21,7 +21,7 @@ func TestManifest(t *testing.T) {
manifest := agentsdk.Manifest{
AgentID: uuid.New(),
AgentName: "test-agent",
OwnerName: "test-owner",
OwnerUsername: "test-owner",
WorkspaceID: uuid.New(),
WorkspaceName: "test-workspace",
GitAuthConfigs: 3,
@@ -144,7 +144,7 @@ func TestManifest(t *testing.T) {
require.NoError(t, err)
require.Equal(t, manifest.AgentID, back.AgentID)
require.Equal(t, manifest.AgentName, back.AgentName)
require.Equal(t, manifest.OwnerName, back.OwnerName)
require.Equal(t, manifest.OwnerUsername, back.OwnerUsername)
require.Equal(t, manifest.WorkspaceID, back.WorkspaceID)
require.Equal(t, manifest.WorkspaceName, back.WorkspaceName)
require.Equal(t, manifest.GitAuthConfigs, back.GitAuthConfigs)