feat(jobs): use organization.allowedRegions for --run-region completion (Vibe Kanban)#28
Closed
ClayMav wants to merge 1 commit into
Closed
feat(jobs): use organization.allowedRegions for --run-region completion (Vibe Kanban)#28ClayMav wants to merge 1 commit into
ClayMav wants to merge 1 commit into
Conversation
Switch shell completion for --run-region from /notebooks/config-hint to the /organization endpoint's allowedRegions list. The previous source only filtered by `enabled`, which let DEGRADED/UNAVAILABLE/DISABLED regions through; allowedRegions is the authoritative list of regions the org can actually use and is simpler to consume. Runtime completion still uses /notebooks/config-hint (runtimes don't have an availability dimension, only enabled). Addresses review feedback on #26.
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
Addresses @sfishel18's review feedback on #26:
Switches shell completion for
--run-regionto source fromorganization.allowedRegionsinstead ofregions.hintin/notebooks/config-hint. PR #26 has already been merged; this PR is a follow-up implementing the reviewer's suggestion.What changed
--run-regioncompletion: now callsGET /organizationand readsallowedRegions[]. This is the authoritative list of regions the org can actually use.--runtimecompletion: unchanged source (GET /notebooks/config-hint→runtimes.hint[].id, filtered byenabled). Runtimes don't have an availability dimension, onlyenabled, so the previous filter was already correct for them.completeConfigHinthelper was generic over arrayPath/valueKey to share logic between regions and runtimes. With regions moving to a different endpoint and response shape, that abstraction no longer pulled its weight — replaced with a smallfetchForCompletionhelper (timeout + execOnce) and two focused completion functions.TestCompleteRegionsReturnsAllowedRegions,TestCompleteRegionsFailsOpenOnError, andTestCompleteRuntimesSkipsDisabled. Extracted the shared runtime spec used by the jobs test fixture into ajobsTestRuntimeSpechelper so the new tests can reuse it.Why
The old source (
regions.hint[].regionNamewith anenabledfilter) let through regions whoseavailabilityisDEGRADED,UNAVAILABLE, orDISABLED— those would surface in tab completion but fail at run time.organization.allowedRegionsis the list the backend uses to decide what's valid for this org, so completion now matches the runtime contract.Implementation notes
nilwithShellCompDirectiveNoFileComp, so completion never blocks the user.getOrganizationwas already a required dependency fornewJobsRunner(used for managed-storage resolution), so no new failure modes are introduced./notebooks/config-hintoperation is still loaded so runtime completion keeps working — it remains optional (completion no-ops when the op isn't in the spec).Test plan
go test ./...— all packages pass, including the three new completion tests.go vet ./...— clean.gofmt -l .— clean.This PR was written using Vibe Kanban