refactor: remove internal/logger from platform deploy#384
Conversation
mwbrooks
left a comment
There was a problem hiding this comment.
Comments to guide the reviewers through this phase 🪵 🪓 of package logger
| case "on_app_package": | ||
| printDeployPackage(cmd, event) |
There was a problem hiding this comment.
note: Started the packaging spinner.
| case "on_app_package_completion": | ||
| printDeployPackageCompletion(cmd, event) |
There was a problem hiding this comment.
note: Stopped the packaging spinner.
| case "on_app_deploy_hosting": | ||
| printDeployHosting(cmd, event) |
There was a problem hiding this comment.
note: Started the deploy spinner. Stopping the spinner was handled by the print complete function after the command completes.
| func printDeployPackage(cmd *cobra.Command, event *logger.LogEvent) { | ||
| cmd.Println() | ||
| packageSpinner.Update("Packaging app for deployment", "").Start() | ||
| } |
| func printDeployPackageCompletion(cmd *cobra.Command, event *logger.LogEvent) { | ||
| packagedSize := event.DataToString("packagedSize") | ||
| packagedTime := event.DataToString("packagedTime") | ||
|
|
||
| deployPackageSuccessText := style.Sectionf(style.TextSection{ | ||
| Emoji: "gift", | ||
| Text: "App packaged and ready to deploy", | ||
| Secondary: []string{fmt.Sprintf("%s was packaged in %s", packagedSize, packagedTime)}, | ||
| }) | ||
| packageSpinner.Update(deployPackageSuccessText, "").Stop() | ||
| } |
| func printDeployHosting(cmd *cobra.Command, event *logger.LogEvent) { | ||
| deployHostingText := "Deploying to Slack Platform" + style.Secondary(" (this will take a moment)") | ||
| deploySpinner.Update(deployHostingText, "").Start() |
There was a problem hiding this comment.
🪓 praise: These are nice functions to be removing with these change!
| Secondary: []string{style.Mapf(parsedAppInfo)}, | ||
| }) | ||
|
|
||
| deploySpinner.Update(successfulDeployText, "").Stop() |
| event logger.LogData | ||
| expected []string | ||
| }{ | ||
| "information from a workspace deploy is printed": { |
There was a problem hiding this comment.
There was a problem hiding this comment.
🪬 question: In later changes do you think testing outputs remain useful? I understand this guards against regression but the slacktrace package might have nice patterns to support instead of "info" prints?
There was a problem hiding this comment.
That's something to think about. A few reason to test outputs might be:
- Outputs can be different based on scenarios: Enterprise vs Workspace for this PR
- TTY vs Non-TTY
- Confirming debug logs or error logs are printed
- Logs are important for... logging (logstash), so we'd want a few gut checks for sure
I think the main concern is brittle test based on specific text and redundant tests. So, we could ask ourselves how often we'd hit this situation.
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| package logger |
| } | ||
|
|
||
| func deployApp(ctx context.Context, clients *shared.ClientFactory, log *logger.Logger, app types.App) (types.App, error) { | ||
| func deployApp(ctx context.Context, clients *shared.ClientFactory, app types.App, manifest types.SlackYaml, authSession api.AuthSession) error { |
There was a problem hiding this comment.
note: Not ideal, but we now need to pass in the app manifest and auth session because we output the info in this method (it's where the spinner now resides).
There was a problem hiding this comment.
👁️🗨️ thought: These are meaningful values to pass to the "deploy" function IMO! But I'm realizing it isn't clear that these values aren't used for more than outputs. Still meaningful to me!
There was a problem hiding this comment.
Continuing your thought: I often feel like slackcontext could be used here. slackcontext.App(ctx) where App is a more complete struct that contains the App, User, and Team with rich metadata (not just IDs).
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #384 +/- ##
==========================================
- Coverage 65.42% 65.40% -0.03%
==========================================
Files 216 214 -2
Lines 17937 17847 -90
==========================================
- Hits 11736 11672 -64
+ Misses 5111 5087 -24
+ Partials 1090 1088 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
internal/pkg/platform/deploy_test.go
Outdated
| func strPtr(s string) *string { return &s } | ||
| func boolPtr(b bool) *bool { return &b } |
There was a problem hiding this comment.
🔍 question(non-blocking): Can we use the new constructor instead of these functions? I haven't explored this but it seems, new, to the latest releases:
The built-in new function, which creates a new variable, now allows its operand to be an expression, specifying the initial value of the variable.
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| package logger |
| event logger.LogData | ||
| expected []string | ||
| }{ | ||
| "information from a workspace deploy is printed": { |
There was a problem hiding this comment.
🪬 question: In later changes do you think testing outputs remain useful? I understand this guards against regression but the slacktrace package might have nice patterns to support instead of "info" prints?
| var packageSpinner *style.Spinner | ||
| var deploySpinner *style.Spinner |
There was a problem hiding this comment.
🌟 praise: These variables have been confusing to reason about across package log events in earlier changes I found! Thanks for finding a nice pattern for these!
| func printDeployHosting(cmd *cobra.Command, event *logger.LogEvent) { | ||
| deployHostingText := "Deploying to Slack Platform" + style.Secondary(" (this will take a moment)") | ||
| deploySpinner.Update(deployHostingText, "").Start() |
There was a problem hiding this comment.
🪓 praise: These are nice functions to be removing with these change!
| } | ||
|
|
||
| func deployApp(ctx context.Context, clients *shared.ClientFactory, log *logger.Logger, app types.App) (types.App, error) { | ||
| func deployApp(ctx context.Context, clients *shared.ClientFactory, app types.App, manifest types.SlackYaml, authSession api.AuthSession) error { |
There was a problem hiding this comment.
👁️🗨️ thought: These are meaningful values to pass to the "deploy" function IMO! But I'm realizing it isn't clear that these values aren't used for more than outputs. Still meaningful to me!
|
@zimeg Thanks for the quick review! This brings us to the end of removing the |
Changelog
Summary
This pull request is Part 5 of removing internal/logger package and is focused on the the
deploycommand.internal/pkg/platform/deploy.gocmd/more straight-forwardPreview
Note: Previews use an artificially long packaging time, so that you can see the spinner.
1. Deno + ROSI Deploy
2026-03-10-deno-deploy.mov
2. Deno + ROSI Re-Deploy
2026-03-10-deno-deploy-again.mov
3. Bolt + Deploy Script
2026-03-10-bolt-deploy.mov
Test Steps
There are 3 test scenarios:
1. Deno + ROSI Deploy
2. Deno + ROSI Re-Deploy
3. Bolt + Deploy Script
Requirements