From c11d43424dac00aadd62b394de5d7399866a347a Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Wed, 28 Oct 2026 15:57:15 +0100 Subject: [PATCH] chore(api): deprecate the API surface that nothing produces or reads Several exported symbols describe a contract Compose never honors, and a reader of the package cannot tell: the stack status constants (Stack.Status is never one of them), ConfigOptions and ServiceStatus (no operation takes or returns them), the error sentinels ErrAlreadyExists, ErrForbidden, ErrUnknown and ErrUnsupportedFlag (never returned, with their Is helpers), and the ExitCodeLoginRequired exit code of the cloud login Compose no longer has. Mark them Deprecated, with no change of behavior, so that they can be removed with the next breaking release. Nothing in the repository uses them. Signed-off-by: Nicolas De Loof --- pkg/api/api.go | 16 ++++++++++++++++ pkg/api/errors.go | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/pkg/api/api.go b/pkg/api/api.go index f08a7f684..27f7000eb 100644 --- a/pkg/api/api.go +++ b/pkg/api/api.go @@ -487,6 +487,8 @@ type DownOptions struct { } // ConfigOptions group options of the Config API +// +// Deprecated: no operation of Compose takes these options, they will be removed. type ConfigOptions struct { // Format define the output format used to dump converted application model (json|yaml) Format string @@ -765,6 +767,8 @@ type ImageSummary struct { } // ServiceStatus hold status about a service +// +// Deprecated: no operation of Compose returns it, it will be removed. type ServiceStatus struct { ID string Name string @@ -823,16 +827,28 @@ type GenerateOptions struct { const ( // STARTING indicates that stack is being deployed + // + // Deprecated: Stack.Status never takes this value, it will be removed. STARTING string = "Starting" // RUNNING indicates that stack is deployed and services are running + // + // Deprecated: Stack.Status never takes this value, it will be removed. RUNNING string = "Running" // UPDATING indicates that some stack resources are being recreated + // + // Deprecated: Stack.Status never takes this value, it will be removed. UPDATING string = "Updating" // REMOVING indicates that stack is being deleted + // + // Deprecated: Stack.Status never takes this value, it will be removed. REMOVING string = "Removing" // UNKNOWN indicates unknown stack state + // + // Deprecated: Stack.Status never takes this value, it will be removed. UNKNOWN string = "Unknown" // FAILED indicates that stack deployment failed + // + // Deprecated: Stack.Status never takes this value, it will be removed. FAILED string = "Failed" ) diff --git a/pkg/api/errors.go b/pkg/api/errors.go index af88b79c8..ebe16c353 100644 --- a/pkg/api/errors.go +++ b/pkg/api/errors.go @@ -24,6 +24,8 @@ import ( const ( // ExitCodeLoginRequired exit code when command cannot execute because it requires cloud login // This will be used by VSCode to detect when creating context if the user needs to login first + // + // Deprecated: Compose has no cloud login anymore and never exits with this code, it will be removed. ExitCodeLoginRequired = 5 ) @@ -31,14 +33,22 @@ var ( // ErrNotFound is returned when an object is not found ErrNotFound = errors.New("not found") // ErrAlreadyExists is returned when an object already exists + // + // Deprecated: Compose never returns it, it will be removed. ErrAlreadyExists = errors.New("already exists") // ErrForbidden is returned when an operation is not permitted + // + // Deprecated: Compose never returns it, it will be removed. ErrForbidden = errors.New("forbidden") // ErrUnknown is returned when the error type is unmapped + // + // Deprecated: Compose never returns it, it will be removed. ErrUnknown = errors.New("unknown") // ErrNotImplemented is returned when a backend doesn't implement an action ErrNotImplemented = errors.New("not implemented") // ErrUnsupportedFlag is returned when a backend doesn't support a flag + // + // Deprecated: Compose never returns it, it will be removed. ErrUnsupportedFlag = errors.New("unsupported flag") // ErrCanceled is returned when the command was canceled by user ErrCanceled = errors.New("canceled") @@ -63,21 +73,29 @@ func IsNotFoundError(err error) bool { } // IsAlreadyExistsError returns true if the unwrapped error is ErrAlreadyExists +// +// Deprecated: ErrAlreadyExists is never returned, it will be removed. func IsAlreadyExistsError(err error) bool { return errors.Is(err, ErrAlreadyExists) } // IsForbiddenError returns true if the unwrapped error is ErrForbidden +// +// Deprecated: ErrForbidden is never returned, it will be removed. func IsForbiddenError(err error) bool { return errors.Is(err, ErrForbidden) } // IsUnknownError returns true if the unwrapped error is ErrUnknown +// +// Deprecated: ErrUnknown is never returned, it will be removed. func IsUnknownError(err error) bool { return errors.Is(err, ErrUnknown) } // IsErrUnsupportedFlag returns true if the unwrapped error is ErrUnsupportedFlag +// +// Deprecated: ErrUnsupportedFlag is never returned, it will be removed. func IsErrUnsupportedFlag(err error) bool { return errors.Is(err, ErrUnsupportedFlag) }