Skip to content

Commit 748bef4

Browse files
masnwilliamsclaude
andcommitted
Drop KERNEL_PROJECT_ID fallback
Projects is a brand new feature — KERNEL_PROJECT_ID was never in production, so there's no legacy to preserve. Only read KERNEL_PROJECT. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent a20844d commit 748bef4

2 files changed

Lines changed: 4 additions & 16 deletions

File tree

cmd/root.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,14 @@ func resolveProjectSelection(projectFlag string) string {
105105
if projectFlag != "" {
106106
return projectFlag
107107
}
108-
if projectEnv := os.Getenv("KERNEL_PROJECT"); projectEnv != "" {
109-
return projectEnv
110-
}
111-
return os.Getenv("KERNEL_PROJECT_ID")
108+
return os.Getenv("KERNEL_PROJECT")
112109
}
113110

114111
func init() {
115112
rootCmd.PersistentFlags().BoolP("version", "v", false, "Print the CLI version")
116113
rootCmd.PersistentFlags().BoolP("no-color", "", false, "Disable color output")
117114
rootCmd.PersistentFlags().String("log-level", "warn", "Set the log level (trace, debug, info, warn, error, fatal, print)")
118-
rootCmd.PersistentFlags().String("project", "", "Project ID to scope all requests to (or set KERNEL_PROJECT or KERNEL_PROJECT_ID env var)")
115+
rootCmd.PersistentFlags().String("project", "", "Project ID or name to scope all requests to (or set KERNEL_PROJECT env var)")
119116
rootCmd.SilenceUsage = true
120117
rootCmd.SilenceErrors = true
121118
cobra.OnInitialize(initConfig)

cmd/root_test.go

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,27 +79,18 @@ func TestIsAuthExempt(t *testing.T) {
7979
}
8080

8181
func TestResolveProjectSelection(t *testing.T) {
82-
t.Run("flag value wins over env vars", func(t *testing.T) {
82+
t.Run("flag value wins over env var", func(t *testing.T) {
8383
t.Setenv("KERNEL_PROJECT", "env-project")
84-
t.Setenv("KERNEL_PROJECT_ID", "env-project-id")
8584
assert.Equal(t, "flag-project", resolveProjectSelection("flag-project"))
8685
})
8786

88-
t.Run("new env var wins over legacy env var", func(t *testing.T) {
87+
t.Run("env var used when no flag", func(t *testing.T) {
8988
t.Setenv("KERNEL_PROJECT", "env-project")
90-
t.Setenv("KERNEL_PROJECT_ID", "env-project-id")
9189
assert.Equal(t, "env-project", resolveProjectSelection(""))
9290
})
9391

94-
t.Run("legacy env var used as fallback", func(t *testing.T) {
95-
t.Setenv("KERNEL_PROJECT", "")
96-
t.Setenv("KERNEL_PROJECT_ID", "env-project-id")
97-
assert.Equal(t, "env-project-id", resolveProjectSelection(""))
98-
})
99-
10092
t.Run("empty when no flag or env var", func(t *testing.T) {
10193
t.Setenv("KERNEL_PROJECT", "")
102-
t.Setenv("KERNEL_PROJECT_ID", "")
10394
assert.Equal(t, "", resolveProjectSelection(""))
10495
})
10596
}

0 commit comments

Comments
 (0)