feat(experiment): create and delete developer sandboxes#389
Conversation
…geris-sandbox-integration
6a724f1 to
37c62fb
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #389 +/- ##
==========================================
+ Coverage 68.62% 68.93% +0.30%
==========================================
Files 218 220 +2
Lines 18162 18446 +284
==========================================
+ Hits 12464 12716 +252
- Misses 4538 4558 +20
- Partials 1160 1172 +12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
98ecc15 to
f200970
Compare
f200970 to
cea2bcd
Compare
…geris-sandbox-integration-create-delete
| }, | ||
| })) | ||
| clients.IO.PrintInfo(ctx, false, "Manage this sandbox from the CLI or visit\n%s", style.Secondary("https://api.slack.com/developer-program/sandboxes")) | ||
| } |
There was a problem hiding this comment.
Preview:
% hermes sandbox create --experiment=sandboxes --name "EV test box 7245" --password "jhsdjdkhfkdfgkgd"
🏖️ Sandbox Created
Team ID: E0197Q6CTV1
URL: https://ev-test-box-7245.enterprise.dev.slack.com/
Manage this sandbox from the CLI or visit
https://api.slack.com/developer-program/sandboxes
There was a problem hiding this comment.
praise: Excellent formatting choice!
| } | ||
|
|
||
| return nil | ||
| } |
There was a problem hiding this comment.
Preview:
% hermes sandbox delete --experiment=sandboxes --sandbox-id E0196ATAVGT
Choose a Slack team where your email address matches your Slack developer account
? Select a team for authentication slackforceorg E014LMDF01H
⚠️ Danger zone
Sandbox (E0196ATAVGT) and all of its data will be permanently deleted
This cannot be undone
? Are you sure you want to delete the sandbox? Yes
✅ Sandbox deleted
Sandbox E0196ATAVGT has been permanently deleted
🏖️ Developer Sandboxes
Owned by Slack developer account ev@mail.com
EV test box 8274368 (E0123456)
URL: https://ev-test-box-29378.slack.com
Status: ACTIVE
Created: 2026-03-12
Expires: 2026-09-12
Learn more at https://docs.slack.dev/tools/developer-sandboxes
There was a problem hiding this comment.
🫧 thought: This is solid! I'm optimistic that a conclusion of the charm experiment might let us hide selections and warnings earlier for outputs that are focused on the result, but nothing to think about in this PR!
There was a problem hiding this comment.
praise: Excellent formatting choice!
b23fbe4 to
a35fbc3
Compare
zimeg
left a comment
There was a problem hiding this comment.
@vegeris LGTM! Thanks for bringing a complete sandbox experiment to scripting. I'm excited for these options 🌈 ✨
A few comments that follow are quibbles to implementation but nothing that ought block this from merging. It might be nice to add more tests to API methods, but we can explore some of this in future changes of course 🚢 💨
| // Sandbox represents a Slack Developer Sandbox | ||
| type Sandbox struct { | ||
| DateArchived int64 `json:"date_archived"` // When the developer sandbox is or will be archived, as epoch seconds | ||
| DateCreated int64 `json:"date_created"` // When the developer sandbox was created, as epoch seconds |
| } | ||
|
|
||
| return nil | ||
| } |
There was a problem hiding this comment.
🫧 thought: This is solid! I'm optimistic that a conclusion of the charm experiment might let us hide selections and warnings earlier for outputs that are focused on the result, but nothing to think about in this PR!
cmd/sandbox/create.go
Outdated
| if err := cmd.MarkFlagRequired("name"); err != nil { | ||
| panic(err) | ||
| } | ||
| if err := cmd.MarkFlagRequired("password"); err != nil { | ||
| panic(err) | ||
| } |
There was a problem hiding this comment.
🏁 issue(non-blocking): We might want prompt alternatives for required flags but no blocker for this PR!
There was a problem hiding this comment.
I went ahead and added those prompts 👀
cmd/sandbox/create.go
Outdated
| } | ||
|
|
||
| cmd.Flags().StringVar(&createCmdFlags.name, "name", "", "Organization name for the new sandbox") | ||
| cmd.Flags().StringVar(&createCmdFlags.domain, "domain", "", "Team domain (e.g., pizzaknifefight). If not provided, derived from org name") |
There was a problem hiding this comment.
🍕 praise: Toward common workplace shenanigan IIRC!
There was a problem hiding this comment.
I changed this line to just Team domain. If not provided, will be derived from org name, thinking we don't need to give an example of a domain. If it makes the messaging more fun / Slack-y I can bring it back!
cmd/sandbox/create_test.go
Outdated
| tests := []struct { | ||
| name string |
There was a problem hiding this comment.
| tests := []struct { | |
| name string | |
| tests := map[string]struct { |
🧪 quibble: Let's use table tests here! I was confused in thinking "24h" was both the expected case and actual result at a glance...
There was a problem hiding this comment.
👾 ramble: And perhaps a bounds of expected archive date might be most confident in testing? Like, some "24h" is greater than now but less than "48h" from now?
There was a problem hiding this comment.
Agreed, we have a standard table test format now and all of our other tests have been updated to use it. Let's use it here too.
mwbrooks
left a comment
There was a problem hiding this comment.
✅ Looking good @vegeris! Thank you for adding the sandbox create and sandbox delete commands.
🧪 Local testing works well!
✏️ I've left some suggestions that I'd appreciate you handle before merging this PR. The 🔡 alphabetical ones feel like nits but go a long way for future maintainers who need to read and find content.
cmd/sandbox/create.go
Outdated
| cmd.Flags().StringVar(&createCmdFlags.locale, "locale", "", "Locale (eg. en-us, languageCode-countryCode)") | ||
| cmd.Flags().StringVar(&createCmdFlags.template, "template", "", "Template ID for pre-defined data to preload") | ||
| cmd.Flags().StringVar(&createCmdFlags.eventCode, "event-code", "", "Event code for the sandbox") | ||
| cmd.Flags().StringVar(&createCmdFlags.archiveTTL, "archive-ttl", "", "Time-to-live duration; sandbox will be archived at end of day after this period (e.g., 2h, 1d, 7d)") |
There was a problem hiding this comment.
suggestion: In the Long Description can be list all of the available formats for TTL? 1h, 1d, 1w?, 1m? 1y?, etc
There was a problem hiding this comment.
Good point; I also updated the parsing of archiveTTL to only recognize day/week/month; no 'hour' option (though we'll likely look at adding support for these shorter archive times in the future)
| }, | ||
| })) | ||
| clients.IO.PrintInfo(ctx, false, "Manage this sandbox from the CLI or visit\n%s", style.Secondary("https://api.slack.com/developer-program/sandboxes")) | ||
| } |
There was a problem hiding this comment.
praise: Excellent formatting choice!
Co-authored-by: Eden Zimbelman <eden.zimbelman@salesforce.com>
| eventCode string | ||
| archiveTTL string // TTL duration, e.g. 1d, 2h | ||
| archiveDate string // explicit date yyyy-mm-dd | ||
| partner bool |
There was a problem hiding this comment.
Decided to include support for the partner flag, since we have validation on the backend to make sure only partner developers can create partner sandboxes
…geris-sandbox-integration-create-delete
| } | ||
| if target.After(maxAllowed) { | ||
| return 0, slackerror.New(slackerror.ErrInvalidArchiveTTL) | ||
| } |
There was a problem hiding this comment.
🏁 I added some basic validation around acceptable archive dates but I'm not sure if we want to keep this in the CI; the backend will error out if an invalid date is provided but the error message isn't particularly user friendly (it's the generic 'invalid_args' response). This at least highlights which arg is invalid
There was a problem hiding this comment.
Actually, I think I'll just include validation for 'date cannot be in the past' for the --archive-date flag and that's it. It's not possible to provide a date in the past for --archive-ttl anyway. This just leaves out any extra validation for max archive date (backend will return invalid_args)
edcda2b to
f6b4d21
Compare
cf4078f to
1b65aa8
Compare
|
I'm going to go ahead and merge but happy to do a follow up if anything else comes up 🚀 |
Changelog
Summary
This PR adds
sandbox createandsandbox deletecommands, which allow one to create or delete a sandbox from the CLI.Follow up to #379
Testing
Try out the commands:
Requirements