feat(experiment): add apps.icon.set support for non-hosted app icons#469
feat(experiment): add apps.icon.set support for non-hosted app icons#469
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #469 +/- ##
==========================================
- Coverage 71.23% 71.15% -0.08%
==========================================
Files 222 222
Lines 18664 18684 +20
==========================================
Hits 13295 13295
- Misses 4189 4207 +18
- Partials 1180 1182 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
zimeg
left a comment
There was a problem hiding this comment.
🐣 A few quick comments and questions and I'm excited to test this next!
Co-authored-by: Eden Zimbelman <zim@o526.net>
zimeg
left a comment
There was a problem hiding this comment.
@srtaalej Right now I'm not having luck with this when testing in a shared team sandbox and the error isn't so obvious to me...
Let me know if this is something perhaps with the image I use? I'll include it here for testing and other reviewers:
| const ( | ||
| appIconMethod = "apps.hosted.icon" | ||
| // appIconSetMethod is the API method for setting app icons for non-hosted apps. | ||
| appIconSetMethod = "apps.icon.set" |
There was a problem hiding this comment.
🔬 issue: This outputs a warning to verbose logs and it's not clear what I might not be including?
uploading icon
icon error: https://slack.com/api/apps.icon.set error: missing_arguments
Error updating app icon: https://slack.com/api/apps.icon.set error: missing_arguments
Finished in 0.7s
There was a problem hiding this comment.
are you uploading through the manifest or is the image just in the root of the project?
There was a problem hiding this comment.
@srtaalej I saved this file to the root of the project 🌲 ✨
There was a problem hiding this comment.
the "file" fielf for the api request had the wrong name! can you try again ?
zimeg
left a comment
There was a problem hiding this comment.
@srtaalej Woot! Thanks for finding these fixes! 📸
I'm approving now with a few notes of follow up that might be interesting. But testing so far is alright for me and fast enough on initial upload and re-uploads at ~4 seconds and ~2 seconds! Caching might not be an immediate concern perhaps? Notes:
- The default "icon" field might be meaningful to add to the app manifest schema for developers with custom paths wanting editor hints?
- The
InstallLocalAppand theInstallfunctions are now so similar enough to perhaps collapse into one function? Not urgent but it'd be a meaningful follow up to remove more frompkginternal 🎁
IMHO logging is important to land before this exits experiments but no blockers for this PR outside of note to document the experiment! 📚
| clients.IO.PrintDebug(ctx, "uploading icon") | ||
| _, iconErr := clients.API().IconSet(ctx, clients.Fs, token, app.AppID, iconPath) |
There was a problem hiding this comment.
🔬 question: Could we match debug log outputs for the apps.icon.set method here? Right now I find this in verbose:
uploading icon
While other methods include various request and response details that are useful in debugging. I think edges in image upload might make verbose logging most important here!
There was a problem hiding this comment.
📚 note: Let's document this too!
https://docs.slack.dev/tools/slack-cli/reference/experiments
| require.NoError(t, err) | ||
| } | ||
|
|
||
| func TestClient_Icon(t *testing.T) { |
There was a problem hiding this comment.
🧪 praise: Thank you for updating existing tests to a familiar format!
| var part io.Writer | ||
| h := make(textproto.MIMEHeader) | ||
| h.Set("Content-Disposition", fmt.Sprintf(`form-data; name="%s"; filename="%s"`, "file", iconStat.Name())) | ||
| h.Set("Content-Disposition", fmt.Sprintf(`form-data; name="%s"; filename="%s"`, fileFieldName, iconStat.Name())) |
There was a problem hiding this comment.
| h.Set("Content-Disposition", fmt.Sprintf(`form-data; name="%s"; filename="%s"`, fileFieldName, iconStat.Name())) | |
| h.Set("Content-Disposition", fmt.Sprintf(`form-data; name="%s"; filename="%s"`, iconStat.Name())) |
🌚 suggestion: Let's revert the addition of fileFieldName here and in arguments too if this is static?
Changelog
Summary
This PR adds
IconSet()API method targeting theapps.icon.setendpoint for non-hosted (Bolt) app icons. Gated behind the set-icon experiment flag (--experiment=set-icon) (see Note)Expected Behavior / Test Plan
slack deploy→ updateIcon() uses Icon() (no experiment needed, hosted apps, existing behavior)slack deploy --experiment set-icon→ updateIcon() uses IconSet() (both app types)slack run --experiment set-icon→ InstallLocalApp icon block runs via IconSet() (both app types)slack run(no experiment) → no icon uploadMigration plan
When
apps.icon.setis generally available:set-iconexperiment gate fromupdateIconandInstallLocalAppIcon()calls withIconSet()Icon()method, its tests, mock, and theapps.hosted.iconconstantNote
Requirements