diff --git a/cmd/profile/list.go b/cmd/profile/list.go index 20210e606..0c60b1534 100644 --- a/cmd/profile/list.go +++ b/cmd/profile/list.go @@ -20,8 +20,8 @@ type profileListItem struct { AppID string `json:"appId"` Brand core.LarkBrand `json:"brand"` Active bool `json:"active"` - User string `json:"user"` - TokenStatus string `json:"tokenStatus"` + User string `json:"user,omitempty"` + TokenStatus string `json:"tokenStatus,omitempty"` } // NewCmdProfileList creates the profile list subcommand. diff --git a/cmd/service/service.go b/cmd/service/service.go index 17c7641b0..89870bac5 100644 --- a/cmd/service/service.go +++ b/cmd/service/service.go @@ -256,6 +256,9 @@ func serviceMethodRun(opts *ServiceMethodOptions) error { // checkServiceScopes pre-checks user scopes before making the API call. func checkServiceScopes(ctx context.Context, cred *credential.CredentialProvider, identity core.Identity, config *core.CliConfig, method map[string]interface{}, scopes []interface{}) error { + if ctx.Err() != nil { + return ctx.Err() + } result, err := cred.ResolveToken(ctx, credential.NewTokenSpec(identity, config.AppID)) if err != nil || result == nil || result.Scopes == "" { return nil //nolint:nilerr // skip scope check when token resolution fails or has no scopes diff --git a/internal/registry/remote_test.go b/internal/registry/remote_test.go index a24d3ee66..356bac07c 100644 --- a/internal/registry/remote_test.go +++ b/internal/registry/remote_test.go @@ -29,8 +29,8 @@ func resetInit() { testMetaURL = "" } -// hasEmbeddedData returns true if meta_data.json with real services is compiled in. -func hasEmbeddedData() bool { +// hasEmbeddedServices returns true if meta_data.json with real services is compiled in. +func hasEmbeddedServices() bool { if len(embeddedMetaJSON) == 0 { return false } @@ -83,7 +83,7 @@ func testEnvelopeNotModifiedJSON() []byte { } func TestColdStart_UsesEmbedded(t *testing.T) { - if !hasEmbeddedData() { + if !hasEmbeddedServices() { t.Skip("no embedded from_meta data") } resetInit() @@ -104,7 +104,7 @@ func TestColdStart_UsesEmbedded(t *testing.T) { } func TestColdStart_NoEmbedded_SyncFetch(t *testing.T) { - if hasEmbeddedData() { + if hasEmbeddedServices() { t.Skip("embedded data present, skipping no-embedded test") } resetInit() @@ -175,7 +175,7 @@ func TestCacheHit_WithinTTL(t *testing.T) { t.Error("expected custom_svc from cache overlay") } // Embedded projects should still be present (if compiled in) - if hasEmbeddedData() { + if hasEmbeddedServices() { if spec := LoadFromMeta("calendar"); spec == nil { t.Error("expected calendar from embedded data") } diff --git a/shortcuts/common/runner.go b/shortcuts/common/runner.go index 0dcd62bc9..a975f523e 100644 --- a/shortcuts/common/runner.go +++ b/shortcuts/common/runner.go @@ -526,7 +526,10 @@ func resolveInputFlags(rctx *RuntimeContext, flags []Flag) error { if len(fl.Input) == 0 { continue } - raw, _ := rctx.Cmd.Flags().GetString(fl.Name) + raw, err := rctx.Cmd.Flags().GetString(fl.Name) + if err != nil { + return FlagErrorf("--%s: Input is only supported for string flags", fl.Name) + } if raw == "" { continue }