Skip to content

Commit 38f720f

Browse files
committed
fix: refuse manifest sync when project source is remote
Manifest sync would write to manifest.json regardless of the project's configured manifest source. Projects with ManifestSourceRemote treat app settings as the source of truth, so writing locally creates divergence. Refuse early with a clear remediation pointing at slack app settings.
1 parent cd86717 commit 38f720f

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

internal/pkg/manifest/sync.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66

7+
"github.com/slackapi/slack-cli/internal/config"
78
"github.com/slackapi/slack-cli/internal/shared"
89
"github.com/slackapi/slack-cli/internal/shared/types"
910
"github.com/slackapi/slack-cli/internal/slackerror"
@@ -21,6 +22,19 @@ type SyncResult struct {
2122
// both manifests, computes diffs, prompts the user for resolution, writes
2223
// the merged result to both the API and the local file, and returns the result.
2324
func Sync(ctx context.Context, clients *shared.ClientFactory, app types.App, auth types.SlackAuth) (*SyncResult, error) {
25+
manifestSource, err := clients.Config.ProjectConfig.GetManifestSource(ctx)
26+
if err != nil {
27+
return nil, err
28+
}
29+
if manifestSource.Equals(config.ManifestSourceRemote) {
30+
return nil, slackerror.New(slackerror.ErrAppManifestUpdate).
31+
WithMessage("Manifest sync is unavailable for projects with remote source of truth").
32+
WithRemediation("This project's manifest source is %s. Edit the manifest at %s.",
33+
config.ManifestSourceRemote.Human(),
34+
style.CommandText("slack app settings"),
35+
)
36+
}
37+
2438
localManifest, err := clients.AppClient().Manifest.GetManifestLocal(ctx, clients.SDKConfig, clients.HookExecutor)
2539
if err != nil {
2640
return nil, slackerror.New("Failed to get local manifest").WithRootCause(err).WithCode(slackerror.ErrInvalidManifest)

0 commit comments

Comments
 (0)