fix(jobs): correct config-hint path and honor --dry-run on curated commands#29
Merged
Merged
Conversation
…mmands Both bugs surfaced while smoke-testing the BYOC runtime/region default rollout in PR #26. 1. Shell completion for --runtime and --run-region looked up the wrong API path (/notebooks/config-hint instead of /me/jupyter/lab/config-hint), so findOperation returned nil and completion silently produced no suggestions. 2. The global --dry-run flag was respected only by dynamic API commands. Curated job-runs commands (create, list, logs, metrics) called execOnce/execWithRetry directly and so submitted real requests even with --dry-run set — meaning "wherobots job-runs create ... --dry-run" could submit a real job. Introduce an executeOrDryRun helper that prints the curl equivalent and returns (nil, nil) when --dry-run is set; route all curated commands through it. For create, also skip the script-upload step so dry-run produces no side effects at all.
4b5dcbd to
ebb36c7
Compare
sfishel18
approved these changes
May 28, 2026
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.
Summary
Two independent bugs surfaced while smoke-testing the BYOC runtime/region default rollout in PR #26. Neither was caught by CI because both fail silently.
BUG 1 — completion lookups used the wrong API path
internal/commands/jobs.golooked up/notebooks/config-hintfor the--runtime/--run-regiontab-completion. The actual studio-backend endpoint is/me/jupyter/lab/config-hint.findOperationreturnednil, socompleteConfigHintreturned an empty slice — completion failed open and tab-completion silently produced no suggestions.BUG 2 — curated
job-runs create(and siblings) ignored--dry-runThe global
--dry-runflag (registered inbuilder.go) was honored only by dynamic API commands. Curatedjob-runs create/list/logs/metricscalledexecOnce/execWithRetrydirectly, sowherobots job-runs create ... --dry-runwould actually submit a job (confirmed empirically on staging).The fix introduces a small
executeOrDryRunhelper onjobsRunnerthat prints the curl equivalent and returns(nil, nil)when--dry-runis set. All four curated entry points (create,logs,list,metrics) now route their primary request through it and short-circuit onnilrespBody. Forcreatespecifically,prepareScript(org lookup + presigned-URL upload) is also skipped so dry-run produces no side effects at all.Test plan
go test ./...passes.TestJobsCompletionUsesConfigHintPath— asserts__complete job-runs create ... --run-region ""hits/me/jupyter/lab/config-hintand emits the seeded regions.TestJobsCreateDryRunSkipsRequest— assertsjob-runs create ... --dry-runissues zero HTTP requests and emits the expectedcurl -X POST '…/runs'line.TestJobsListDryRunSkipsRequest— same shape for the read-onlylistpath.WHEROBOTS_API_URL=…staging… ./bin/wherobots __complete job-runs create s3://x.py --name x --run-region ""returns the four org regions + completion directive4.WHEROBOTS_API_URL=…staging… ./bin/wherobots job-runs create s3://fake-bucket/x.py --name dryrun-test --dry-run -yprints a curl line and creates no run.