refactor: merge Install and InstallLocalApp into a single function - #626
Draft
zimeg wants to merge 9 commits into
Draft
refactor: merge Install and InstallLocalApp into a single function#626zimeg wants to merge 9 commits into
zimeg wants to merge 9 commits into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #626 +/- ##
==========================================
+ Coverage 72.24% 72.31% +0.06%
==========================================
Files 238 238
Lines 20072 19958 -114
==========================================
- Hits 14502 14433 -69
+ Misses 4299 4275 -24
+ Partials 1271 1250 -21 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The Install (slack deploy) and InstallLocalApp (slack run) functions in internal/pkg/apps were ~90% identical. Collapse them into one Install function driven by a dev bool toggle. - dev switches display name, hosted manifest defaults, persistence (SaveLocal vs SaveDeployed), IsDev, and env-token handling. - Drop the dead onlyCreateUpdateAppManifest parameter and its CreateAppManifestOnly/CreateAppManifestAndInstall constants; nothing passed CreateAppManifestOnly, so the early-return branch was unreachable. - Unify accidental gaps: both paths now set EnterpriseID and UserID on new-app creation inside nil guards (deploy previously left these as TODOs; local dereferenced UserID unconditionally). Enterprise ID is also now correctly propagated on the context for the deploy path. - Return the superset (App, DeveloperAppInstallResult, InstallState, error); only the dev path consumes the result (socket-mode wiring). Update the three callers (add.go, run.go, localserver.go) and the cmd/app func var to the merged signature.
zimeg
force-pushed
the
merge-install-functions
branch
from
August 8, 2026 19:43
627824d to
aab16fa
Compare
Replace the trailing (orgGrantWorkspaceID string, dev bool) parameters
with an apps.InstallOptions struct so call sites read clearly instead of
passing an opaque trailing bool:
apps.Install(ctx, clients, auth, app, apps.InstallOptions{Dev: true})
Also rename the cmd/app appInstallDevAppFunc test var to appInstallFunc
and note that appInstallProdAppFunc points at apps.Add.
apps.Add creates, installs, and adds the app to the project, not just adds it to the project.
The return type already documents the DeveloperAppInstallResult; the note about which caller consumes it would go stale.
The merged auth-failure early return now returns types.App{} like the
other pre-install error returns, matching the original deploy-path
Install behavior rather than the InstallLocalApp form.
Drop the redundant opts.Dev prefix. A dev run of a hosted app already has its runtime rewritten to local by configureLocalManifest, so it is never SlackHosted at this point; the runtime check alone is sufficient.
The merged manifestUpdates error branch carried a "failed updating app" PrintDebug from the old InstallLocalApp, which the deploy-path Install never had. The error is already returned to the caller, so drop the log to keep the merge faithful to the original deploy behavior.
Collapse the two near-identical install test suites into a single TestInstall table driven by a dev bool per case, sharing one runner. Case names are prefixed deploy:/dev:. The runner sources one manifest for both local and remote on dev installs, and distinguishes them on deploy.
Wire GetManifestLocal/GetManifestRemote directly to the per-case mockManifestAppLocal/mockManifestAppRemote fields instead of branching on tc.dev; dev cases now set both fields. Drop the redundant dev: false from deploy cases since false is the zero value. The exported manifest is inert in these tests (NewManifestHash is mocked), so ExportAppManifest returns an empty result.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog
No user-facing change. Internal refactor merging two near-identical app-install functions. (One subtle improvement: newly created deployed apps now record their
EnterpriseID/UserIDin the project's apps file, matching the local path.)Summary
This pull request merges the
Install(slack deploy) andInstallLocalApp(slack run) functions ininternal/pkg/appsinto a singleInstalldriven by adev booltoggle.devswitches the display name ((local)suffix), hosted manifest defaults (configureLocalManifestvsconfigureHostedManifest), persistence (SaveLocalvsSaveDeployed),IsDev, and environment-token handling.onlyCreateUpdateAppManifestparameter and itsCreateAppManifestOnly/CreateAppManifestAndInstallconstants — nothing passedCreateAppManifestOnly, so its early-return branch was unreachable.EnterpriseIDandUserIDon new-app creation insidenilguards (deploy previously left these as TODOs; local dereferencedUserIDunconditionally). Enterprise ID is now also correctly propagated on the context for the deploy path (the old code discarded the returnedctx).(App, DeveloperAppInstallResult, InstallState, error); only the dev path consumes the result (socket-mode token wiring inrun.go).add.go,run.go,localserver.go) and thecmd/apptest func var to the merged signature.Preview
n/a — no user-visible output changes.
Testing
slack runa local app and confirm it installs, appends(local)to the display name, and connects over socket mode.slack deployan app and confirm it installs to the workspace as before.slack deployand confirm the entry in the project's apps file now includes the user and enterprise IDs.Notes
(ctx, clients, auth, app, orgGrantWorkspaceID, dev)— chosen for readability, since the two original functions disagreed on parameter order.TestInstallLocalApptest was renamed toTestInstallDevAppand now calls the mergedInstallwithdev=true.Requirements