From 5bdabc95c8bc0453d51cd0cf985268df6b3554e3 Mon Sep 17 00:00:00 2001 From: Jaayden Halko Date: Tue, 11 Aug 2026 17:18:22 +0700 Subject: [PATCH] fix(codersdk/licenses.go): read trial claim instead of misspelled trail (#28014) ## What this fixes `codersdk.License.Trial()` looked up the JWT claim `"trail"` (a typo) instead of `"trial"`, the actual claim name set by license issuance (`enterprise/coderd/license/license.go`). Since no license contains a `"trail"` claim, the method always returned `false`. The only consumer is `coder licenses list` (via `cli/cliutil/license.go`), so the CLI never reported a license as a trial even when it was one. The web UI is unaffected because it reads `claims.trial` directly. ## Changes - Read the `"trial"` claim in `License.Trial()`. ## Testing - `go build` / `go vet` on `codersdk` and `cli/cliutil`. - `go test -run 'TestLicensesListFake|TestLicensesListReal' ./enterprise/cli` passes. --- codersdk/licenses.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codersdk/licenses.go b/codersdk/licenses.go index 24a8366b62..f2ccf00984 100644 --- a/codersdk/licenses.go +++ b/codersdk/licenses.go @@ -57,8 +57,8 @@ func (l *License) ExpiresAt() (time.Time, error) { } func (l *License) Trial() bool { - if trail, ok := l.Claims["trail"].(bool); ok { - return trail + if trial, ok := l.Claims["trial"].(bool); ok { + return trial } return false }