-
Notifications
You must be signed in to change notification settings - Fork 5
feat(saas): pre-claimed checkout, the gateway hands out an already-activated sandbox #896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
stubbi
wants to merge
13
commits into
main
Choose a base branch
from
feat/gateway-preclaimed-checkout
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f799ff9
docs(plan): pre-claimed checkout spec and implementation plan
44f6576
feat(saas): checkout buffer scaffold, config, and the eligibility gate
2bbeeeb
refactor(saas): extract createSandboxAndAwait for reuse by the checko…
3b5105a
feat(saas): serve eligible creates from the checkout buffer with one …
cc572be
feat(saas): checkout refill to a floor with capped backoff on failure
c49fe58
feat(saas): checkout adopt-on-restart, staleness reap, and the reconc…
9d3687c
feat(controller): propagate claim org label to the husk pod for check…
7575fba
feat(saas): gateway flags and startup wiring for the pre-claimed chec…
1144336
fix(controller): org propagation fills only an EMPTY pod label, never…
4d6db64
feat(chart): gateway.checkout values, RBAC patch verb, and the threat…
32317c2
test(saas): review follow-ups, flag-helper tests, error wrap, spec da…
b7787e0
Merge branch 'main' into feat/gateway-preclaimed-checkout
stubbi ce656a1
Merge branch 'main' into feat/gateway-preclaimed-checkout
stubbi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "testing" | ||
| "time" | ||
| ) | ||
|
|
||
| // TestSplitNonEmpty pins the checkout-pools flag parsing: comma separation, | ||
| // whitespace trimming, and empty items dropped (so a trailing comma or a bare | ||
| // value never enables a pool named ""). | ||
| func TestSplitNonEmpty(t *testing.T) { | ||
| cases := []struct { | ||
| in string | ||
| want []string | ||
| }{ | ||
| {"", nil}, | ||
| {" , ,", nil}, | ||
| {"python", []string{"python"}}, | ||
| {"python, node ,", []string{"python", "node"}}, | ||
| } | ||
| for _, tc := range cases { | ||
| got := splitNonEmpty(tc.in) | ||
| if len(got) != len(tc.want) { | ||
| t.Fatalf("splitNonEmpty(%q) = %v, want %v", tc.in, got, tc.want) | ||
| } | ||
| for i := range got { | ||
| if got[i] != tc.want[i] { | ||
| t.Fatalf("splitNonEmpty(%q) = %v, want %v", tc.in, got, tc.want) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // TestEnvHelpersKeepDefaultsOnGarbage pins that a malformed env value keeps | ||
| // the compiled-in default instead of zeroing a limit. | ||
| func TestEnvHelpersKeepDefaultsOnGarbage(t *testing.T) { | ||
| t.Setenv("TEST_CHECKOUT_INT", "not-a-number") | ||
| if got := envInt("TEST_CHECKOUT_INT", 7); got != 7 { | ||
| t.Fatalf("envInt(garbage) = %d, want the default 7", got) | ||
| } | ||
| t.Setenv("TEST_CHECKOUT_INT", "3") | ||
| if got := envInt("TEST_CHECKOUT_INT", 7); got != 3 { | ||
| t.Fatalf("envInt(3) = %d, want 3", got) | ||
| } | ||
| t.Setenv("TEST_CHECKOUT_DUR", "soon") | ||
| if got := envDuration("TEST_CHECKOUT_DUR", time.Minute); got != time.Minute { | ||
| t.Fatalf("envDuration(garbage) = %s, want the default 1m", got) | ||
| } | ||
| t.Setenv("TEST_CHECKOUT_DUR", "90s") | ||
| if got := envDuration("TEST_CHECKOUT_DUR", time.Minute); got != 90*time.Second { | ||
| t.Fatalf("envDuration(90s) = %s, want 90s", got) | ||
| } | ||
| if got := envInt("TEST_CHECKOUT_UNSET_KEY", 5); got != 5 { | ||
| t.Fatalf("envInt(unset) = %d, want 5", got) | ||
| } | ||
| } | ||
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Make the “unset” environment assertion deterministic.
envIntreads the process environment, so an externally definedTEST_CHECKOUT_UNSET_KEYcan make this test fail. Clear the key explicitly before asserting the default.Proposed fix
+ t.Setenv("TEST_CHECKOUT_UNSET_KEY", "") if got := envInt("TEST_CHECKOUT_UNSET_KEY", 5); got != 5 {📝 Committable suggestion
🤖 Prompt for AI Agents