From f54b029335f752aa61d8bf0c1cdcc88e4a209406 Mon Sep 17 00:00:00 2001 From: Tanner Stirrat Date: Thu, 9 Oct 2025 07:56:34 -0600 Subject: [PATCH] breaking: Clean up deprecated functionality for v1 --- internal/cmd/cmd.go | 1 - internal/cmd/preview.go | 10 ---------- internal/commands/permission.go | 33 ------------------------------- internal/commands/relationship.go | 2 -- internal/commands/watch.go | 17 ---------------- 5 files changed, 63 deletions(-) diff --git a/internal/cmd/cmd.go b/internal/cmd/cmd.go index e9410bf0..23b91ae1 100644 --- a/internal/cmd/cmd.go +++ b/internal/cmd/cmd.go @@ -124,7 +124,6 @@ zed permission check --explain document:firstdoc writer user:emilia relCmd := commands.RegisterRelationshipCmd(rootCmd) - commands.RegisterWatchCmd(rootCmd) commands.RegisterWatchRelationshipCmd(relCmd) schemaCmd := commands.RegisterSchemaCmd(rootCmd) diff --git a/internal/cmd/preview.go b/internal/cmd/preview.go index 7f0230b4..37dc3fb5 100644 --- a/internal/cmd/preview.go +++ b/internal/cmd/preview.go @@ -6,19 +6,9 @@ import ( func registerPreviewCmd(rootCmd *cobra.Command) { rootCmd.AddCommand(previewCmd) - - previewCmd.AddCommand(schemaCmd) - - schemaCmd.AddCommand(schemaCompileCmd) } var previewCmd = &cobra.Command{ Use: "preview ", Short: "Experimental commands that have been made available for preview", } - -var schemaCmd = &cobra.Command{ - Use: "schema ", - Short: "Manage schema for a permissions system", - Deprecated: "please use `zed schema compile`", -} diff --git a/internal/commands/permission.go b/internal/commands/permission.go index db7b6c18..5b52c969 100644 --- a/internal/commands/permission.go +++ b/internal/commands/permission.go @@ -47,14 +47,6 @@ func consistencyFromCmd(cmd *cobra.Command) (c *v1.Consistency, err error) { c = &v1.Consistency{Requirement: &v1.Consistency_AtLeastAsFresh{AtLeastAsFresh: &v1.ZedToken{Token: atLeast}}} } - // Deprecated (hidden) flag. - if revision := cobrautil.MustGetStringExpanded(cmd, "revision"); revision != "" { - if c != nil { - return nil, ErrMultipleConsistencies - } - c = &v1.Consistency{Requirement: &v1.Consistency_AtLeastAsFresh{AtLeastAsFresh: &v1.ZedToken{Token: revision}}} - } - if exact := cobrautil.MustGetStringExpanded(cmd, "consistency-at-exactly"); exact != "" { if c != nil { return nil, ErrMultipleConsistencies @@ -73,8 +65,6 @@ func RegisterPermissionCmd(rootCmd *cobra.Command) *cobra.Command { permissionCmd.AddCommand(checkCmd) checkCmd.Flags().Bool("json", false, "output as JSON") - checkCmd.Flags().String("revision", "", "optional revision at which to check") - _ = checkCmd.Flags().MarkHidden("revision") checkCmd.Flags().Bool("explain", false, "requests debug information from SpiceDB and prints out a trace of the requests") checkCmd.Flags().Bool("schema", false, "requests debug information from SpiceDB and prints out the schema used") checkCmd.Flags().Bool("error-on-no-permission", false, "if true, zed will return exit code 1 if subject does not have unconditional permission") @@ -82,7 +72,6 @@ func RegisterPermissionCmd(rootCmd *cobra.Command) *cobra.Command { registerConsistencyFlags(checkCmd.Flags()) permissionCmd.AddCommand(checkBulkCmd) - checkBulkCmd.Flags().String("revision", "", "optional revision at which to check") checkBulkCmd.Flags().Bool("json", false, "output as JSON") checkBulkCmd.Flags().Bool("explain", false, "requests debug information from SpiceDB and prints out a trace of the requests") checkBulkCmd.Flags().Bool("schema", false, "requests debug information from SpiceDB and prints out the schema used") @@ -90,21 +79,10 @@ func RegisterPermissionCmd(rootCmd *cobra.Command) *cobra.Command { permissionCmd.AddCommand(expandCmd) expandCmd.Flags().Bool("json", false, "output as JSON") - expandCmd.Flags().String("revision", "", "optional revision at which to check") registerConsistencyFlags(expandCmd.Flags()) - // NOTE: `lookup` is an alias of `lookup-resources` (below) - // and must have the same list of flags in order for it to work. - permissionCmd.AddCommand(lookupCmd) - lookupCmd.Flags().Bool("json", false, "output as JSON") - lookupCmd.Flags().String("revision", "", "optional revision at which to check") - lookupCmd.Flags().String("caveat-context", "", "the caveat context to send along with the lookup, in JSON form") - lookupCmd.Flags().Uint32("page-limit", 0, "limit of relations returned per page") - registerConsistencyFlags(lookupCmd.Flags()) - permissionCmd.AddCommand(lookupResourcesCmd) lookupResourcesCmd.Flags().Bool("json", false, "output as JSON") - lookupResourcesCmd.Flags().String("revision", "", "optional revision at which to check") lookupResourcesCmd.Flags().String("caveat-context", "", "the caveat context to send along with the lookup, in JSON form") lookupResourcesCmd.Flags().Uint32("page-limit", 0, "limit of relations returned per page") lookupResourcesCmd.Flags().String("cursor", "", "resume pagination from a specific cursor token") @@ -113,7 +91,6 @@ func RegisterPermissionCmd(rootCmd *cobra.Command) *cobra.Command { permissionCmd.AddCommand(lookupSubjectsCmd) lookupSubjectsCmd.Flags().Bool("json", false, "output as JSON") - lookupSubjectsCmd.Flags().String("revision", "", "optional revision at which to check") lookupSubjectsCmd.Flags().String("caveat-context", "", "the caveat context to send along with the lookup, in JSON form") registerConsistencyFlags(lookupSubjectsCmd.Flags()) @@ -157,16 +134,6 @@ var lookupResourcesCmd = &cobra.Command{ RunE: lookupResourcesCmdFunc, } -var lookupCmd = &cobra.Command{ - Use: "lookup ", - Short: "Enumerates the resources of a given type for which the subject has permission", - Args: ValidationWrapper(cobra.ExactArgs(3)), - ValidArgsFunction: GetArgs(ResourceType, Permission, SubjectID), - RunE: lookupResourcesCmdFunc, - Deprecated: "prefer lookup-resources", - Hidden: true, -} - var lookupSubjectsCmd = &cobra.Command{ Use: "lookup-subjects ", Short: "Enumerates the subjects of a given type for which the subject has permission on the resource", diff --git a/internal/commands/relationship.go b/internal/commands/relationship.go index 0471f856..62c9a1e5 100644 --- a/internal/commands/relationship.go +++ b/internal/commands/relationship.go @@ -57,8 +57,6 @@ func RegisterRelationshipCmd(rootCmd *cobra.Command) *cobra.Command { bulkDeleteCmd.Flags().Bool("force", false, "force deletion of all elements in batches defined by ") bulkDeleteCmd.Flags().String("subject-filter", "", "optional subject filter") bulkDeleteCmd.Flags().Uint32("optional-limit", 1000, "the max amount of elements to delete. If you want to delete all in batches of size , set --force to true") - bulkDeleteCmd.Flags().Bool("estimate-count", true, "estimate the count of relationships to be deleted") - _ = bulkDeleteCmd.Flags().MarkDeprecated("estimate-count", "no longer used, make use of --optional-limit instead") return relationshipCmd } diff --git a/internal/commands/watch.go b/internal/commands/watch.go index 1e0313e9..7c0f149e 100644 --- a/internal/commands/watch.go +++ b/internal/commands/watch.go @@ -27,15 +27,6 @@ var ( watchRelationshipFilters []string ) -func RegisterWatchCmd(rootCmd *cobra.Command) *cobra.Command { - rootCmd.AddCommand(watchCmd) - - watchCmd.Flags().StringSliceVar(&watchObjectTypes, "object_types", nil, "optional object types to watch updates for") - watchCmd.Flags().StringVar(&watchRevision, "revision", "", "optional revision at which to start watching") - watchCmd.Flags().BoolVar(&watchTimestamps, "timestamp", false, "shows timestamp of incoming update events") - return watchCmd -} - func RegisterWatchRelationshipCmd(parentCmd *cobra.Command) *cobra.Command { parentCmd.AddCommand(watchRelationshipsCmd) watchRelationshipsCmd.Flags().StringSliceVar(&watchObjectTypes, "object_types", nil, "optional object types to watch updates for") @@ -45,14 +36,6 @@ func RegisterWatchRelationshipCmd(parentCmd *cobra.Command) *cobra.Command { return watchRelationshipsCmd } -var watchCmd = &cobra.Command{ - Use: "watch [object_types, ...] [start_cursor]", - Short: "Watches the stream of relationship updates and schema updates from the server", - Args: ValidationWrapper(cobra.RangeArgs(0, 2)), - RunE: watchCmdFunc, - Deprecated: "please use `zed relationships watch` instead", -} - var watchRelationshipsCmd = &cobra.Command{ Use: "watch [object_types, ...] [start_cursor]", Short: "Watches the stream of relationship updates and schema updates from the server",