Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/guides/dev/behaviour-drivers.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ The suite uses a single unified `install.Driver` constructed via `install.Factor

| Environment | Factory | Mint | Org | Install mode |
|-------------|---------|------|-----|-------------|
| `dev` (default) | `NewRepoPoolCFMintPreviews` | One public CF Worker preview per mint group leased in the run (two at 12 slots per org) | Pool orgs `halfsend-01` … `halfsend-12` | Vendored binary |
| `dev` (default) | `NewRepoPoolCFMintPreviews` | One public CF Worker preview per mint group leased in the run (four at 12 slots per org) | Pool orgs `halfsend-01` … `halfsend-22` | Vendored binary |
| `stage` | `NewRepoPoolCFMintStage` | Durable CF Worker at `stage-mint.fullsend.sh` | `halfsend` (single unsuffixed org) | Non-vendored, `--fullsend-ref=main` |

Each factory returns the same shared slot driver (`composed.go`), which owns the full lifecycle:
Expand All @@ -59,7 +59,7 @@ The Factory takes an `install.PoolConfig`: the pool layout, a per-org token sour

Pool orgs must already have the six `fullsend-test-*` role apps and the production `fullsend-ai-e2e` app installed, plus per-repo mint enrollment for each numbered repo (one-time GCP admin step on the hosted mint project). The driver does not run `fullsend admin install` or `fullsend mint enroll`. See [e2e-testing.md](e2e-testing.md#behaviour-tests-and-per-repo-mint-enrollment).

The two CF mint drivers compute mint groups from the pool layout on every run (`planMintGroups` in `mint_groups.go`); there is no hardcoded org-to-mint list. A group's `--workflow-host-repos` lists its orgs' pool repos plus each slot's mint-probe host `<org>/test-repo-NN-mint-host` (`install.MintProbeHostRepoSuffix`). The driver packs orgs in order into the fewest groups whose actual serialized list stays within 5,000 bytes, a margin under Cloudflare's 5 KB per-variable limit. At 12 slots per org a list for six orgs is 4,319 bytes and for seven is 5,039 bytes, so the 12 DEV orgs use two mints. A changed slot or org count regroups automatically. If one org's list alone exceeds the limit, the factory fails and names the org (one org's slots are not split across mints). The [GitHub mint scope scenarios](behaviour-testing.md#github-mint-scope-scenarios) create and delete the probe hosts per scenario. Because the lists are deploy flags, a change takes effect on the next suite run's mint deploy, with no GCP enrollment step.
The two CF mint drivers compute mint groups from the pool layout on every run (`planMintGroups` in `mint_groups.go`); there is no hardcoded org-to-mint list. A group's `--workflow-host-repos` lists its orgs' pool repos plus each slot's mint-probe host `<org>/test-repo-NN-mint-host` (`install.MintProbeHostRepoSuffix`). The driver packs orgs in order into the fewest groups whose actual serialized list stays within 5,000 bytes, a margin under Cloudflare's 5 KB per-variable limit. At 12 slots per org a list for six orgs is 4,319 bytes and for seven is 5,039 bytes, so the 22 DEV orgs use four mints. A changed slot or org count regroups automatically. If one org's list alone exceeds the limit, the factory fails and names the org (one org's slots are not split across mints). The [GitHub mint scope scenarios](behaviour-testing.md#github-mint-scope-scenarios) create and delete the probe hosts per scenario. Because the lists are deploy flags, a change takes effect on the next suite run's mint deploy, with no GCP enrollment step.

RepoPoolCFMintPreviews deploys its previews with `--public` (`PER_REPO_WIF_REPOS=*`) instead of `--per-repo-wif-repos`, so no caller list has to fit in a Worker variable or be kept enrolled. RepoPoolCFMintStage keeps `--per-repo-wif-repos` for its durable mint. See [Public preview mints](behaviour-testing.md#public-preview-mints) for the accepted trade-off.

Expand Down
6 changes: 3 additions & 3 deletions docs/guides/dev/behaviour-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,10 @@ In CI, the test runner mints cross-org `e2e` installation tokens via OIDC for Gi

### Repo allocation via the shared slot driver

`RunSuite` and `RunPlaybackSuite` build one shared install driver (`install.Factory` over an `install.PoolConfig`) for the environment's pool. On `dev` the pool is the derived orgs `halfsend-01` … `halfsend-12`, and on `stage` it is the single unsuffixed `halfsend` org, each with `test-repo-01` … `test-repo-NN` slots (`install.PoolLayoutForEnvironment`; `BEHAVIOUR_POOL_SIZE` sets the slots per org). The driver resolves one installation token per org (`e2etest.TokenForOrg`, minted once per org and kept for the run, since a token outlives the 45-minute job). It builds one forge client per org from that token. The `Given the enrolled test repository` step calls `install.LeaseDriver.AllocateLease(ctx)`, which:
`RunSuite` and `RunPlaybackSuite` build one shared install driver (`install.Factory` over an `install.PoolConfig`) for the environment's pool. On `dev` the pool is the derived orgs `halfsend-01` … `halfsend-22`, and on `stage` it is the single unsuffixed `halfsend` org, each with `test-repo-01` … `test-repo-NN` slots (`install.PoolLayoutForEnvironment`; `BEHAVIOUR_POOL_SIZE` sets the slots per org). The driver resolves one installation token per org (`e2etest.TokenForOrg`, minted once per org and kept for the run, since a token outlives the 45-minute job). It builds one forge client per org from that token. The `Given the enrolled test repository` step calls `install.LeaseDriver.AllocateLease(ctx)`, which:

1. Claims a free slot through the cross-org allocator (`slotpool.go`), blocking until one is free or ctx is cancelled. The claim *creates* the slot repo (the forge's `auto_init` provides the initial commit). A slot whose repo already exists belongs to another holder, possibly another suite. It is skipped for the whole of provisioning and is never reset or deleted. Orgs whose installation's rate-limit headers show the quota nearly spent are skipped until their reset, so leases move to orgs with quota left.
2. On the first lease in any org of a mint group, deploys the group's mint: a public preview mint on `dev` and the durable STAGE mint on `stage`. The driver packs the pool orgs into the fewest groups whose `WORKFLOW_HOST_REPOS` fits in 5,000 bytes, recomputed from the layout on every run (two groups for the 12 DEV orgs at 12 slots each, one for STAGE). Every mint's `--status-github-group` is the `mint-status` team of one pool org, picked at random once per job. Concurrent first leases in a group share one deploy. A failed deploy is torn down and retried by the group's next lease, and `Finalize` tears each deployed mint down once.
2. On the first lease in any org of a mint group, deploys the group's mint: a public preview mint on `dev` and the durable STAGE mint on `stage`. The driver packs the pool orgs into the fewest groups whose `WORKFLOW_HOST_REPOS` fits in 5,000 bytes, recomputed from the layout on every run (four groups for the 22 DEV orgs at 12 slots each, one for STAGE). Every mint's `--status-github-group` is the `mint-status` team of one pool org, picked at random once per job. Concurrent first leases in a group share one deploy. A failed deploy is torn down and retried by the group's next lease, and `Finalize` tears each deployed mint down once.
3. Installs fullsend into the claimed repo with the org's credential and mint URL. It deletes a leftover `{name}-fork` from an earlier holder of the slot, then runs `fullsend github setup` (after resolving the inference WIF provider when configured) and the post-install checks. If the install fails, the slot is released, deleting only this lease's own repo.
4. Returns an `install.RepoLease` with the org, repo, the org's token and client, and its group's mint URL, status group and workflow hosts. The step rebinds the scenario `World` to that org: `Org`, `RepoOwner`, `Token`, `MintURL`, `MintStatusGroup`, `MintWorkflowHostRepos`, and SCM/CI drivers rebuilt through `World.OrgDrivers` from the lease's client. Every step and the scenario's cleanup then act in the leased org with its credentials.

Expand All @@ -337,7 +337,7 @@ The `dev` preview mints are deployed with `--public` (`PER_REPO_WIF_REPOS=*`), w

Godog concurrency stays independent of slot capacity. The default is the
slots per org (12), and `GODOG_CONCURRENCY` overrides it. Capacity is every
slot of the pool (144 on `dev`), and a concurrency above capacity only makes
slot of the pool (264 on `dev`), and a concurrency above capacity only makes
workers wait. The allocator logs each claim and release with its org/repo and
that org's quota
(`[slots] claimed halfsend-03/test-repo-05 (quota …)`). An exhausted pass logs
Expand Down
24 changes: 17 additions & 7 deletions docs/guides/dev/e2e-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Playwright or stored sessions.

Before running e2e locally or in CI:

1. **Pool orgs** (`halfsend-01` … `halfsend-12`) provisioned per [Pool org provisioning](#pool-org-provisioning) below
1. **Pool orgs** (`halfsend-01` … `halfsend-22`) provisioned per [Pool org provisioning](#pool-org-provisioning) below
2. **Mint** deployed with `e2e` role enrolled and the requesting repository `fullsend-ai/fullsend` enrolled in `PER_REPO_WIF_REPOS` (or the mint explicitly in public mode, `PER_REPO_WIF_REPOS=*`)
3. **CI only:** pool orgs with `FULLSEND_FOREIGN_E2E_REPOS` authorizing `fullsend-ai/fullsend`
4. **Local only:** `gh auth login` (or `GH_TOKEN` / `GITHUB_TOKEN`) with admin access on pool orgs
Expand Down Expand Up @@ -76,7 +76,7 @@ Optional environment variables:
Behaviour tests use the pool orgs (for `ENVIRONMENT=dev`) and install fullsend per-repo via `fullsend github setup`. When `ENVIRONMENT=stage`, the suite uses the `halfsend` org with a durable CF Worker mint instead of a pool org. See [behaviour-testing.md](behaviour-testing.md) and [behaviour-drivers.md](behaviour-drivers.md).

The behaviour and playback suites lease `(org, test-repo-NN)` slots across the
pool orgs (`halfsend-01` … `halfsend-12` for DEV, or `halfsend` for STAGE)
pool orgs (`halfsend-01` … `halfsend-22` for DEV, or `halfsend` for STAGE)
instead of locking a whole org; see
[behaviour-testing.md](behaviour-testing.md#repo-allocation-via-the-shared-slot-driver).
Other e2e tests still acquire an exclusive lock on one pool org — see
Expand Down Expand Up @@ -144,7 +144,7 @@ One-time enrollment for all pool orgs (idempotent). Enroll the singular `test-re

```bash
export GCP_PROJECT=it-gcp-konflux-dev-fullsend
for i in $(seq -w 1 12); do
for i in $(seq -w 1 22); do
go run ./cmd/fullsend mint enroll "halfsend-${i}/test-repo" \
--project="$GCP_PROJECT" --region=us-central1
for j in $(seq -w 1 12); do
Expand Down Expand Up @@ -192,7 +192,7 @@ go run ./cmd/fullsend admin foreign list --org halfsend-01
# expect e2e → fullsend-ai/fullsend
```

Existing pool orgs (`halfsend-01` … `halfsend-12`) need a one-time operator pass: install the e2e app (if missing) and run:
Existing pool orgs (`halfsend-01` … `halfsend-22`) need a one-time operator pass: install the e2e app (if missing) and run:

```bash
go run ./cmd/fullsend admin foreign allow --org halfsend-NN --role e2e --caller fullsend-ai/fullsend
Expand Down Expand Up @@ -281,6 +281,16 @@ a closed team.
| `halfsend-10` | `halfsend-10/mint-status` |
| `halfsend-11` | `halfsend-11/mint-status` |
| `halfsend-12` | `halfsend-12/mint-status` |
| `halfsend-13` | `halfsend-13/mint-status` |
| `halfsend-14` | `halfsend-14/mint-status` |
| `halfsend-15` | `halfsend-15/mint-status` |
| `halfsend-16` | `halfsend-16/mint-status` |
| `halfsend-17` | `halfsend-17/mint-status` |
| `halfsend-18` | `halfsend-18/mint-status` |
| `halfsend-19` | `halfsend-19/mint-status` |
| `halfsend-20` | `halfsend-20/mint-status` |
| `halfsend-21` | `halfsend-21/mint-status` |
| `halfsend-22` | `halfsend-22/mint-status` |

The STAGE and numbered test mints take these values as
`--status-github-group=ORG/mint-status`. The behaviour suite's CF mint
Expand Down Expand Up @@ -623,7 +633,7 @@ The generated config (print it with `--print-config`):
[ADR 0137](../../ADRs/0137-inference-gateway-credential-route.md).
- authorises each model with an exact-match list of `jwt.repository` values.
The list covers `test-repo-01` to `test-repo-12` in `halfsend-01` to
`halfsend-12` and in the STAGE org `halfsend`: 156 repositories. It
`halfsend-22` and in the STAGE org `halfsend`: 276 repositories. It
matches names, so keep the pool orgs registered: whoever owns a pool org
name can call the gateway. A model that a configured key may call also
admits that key's `apiKey.purpose`.
Expand Down Expand Up @@ -873,7 +883,7 @@ The `fix` role reuses the coder app (`fullsend-test-coder`) and
### Installation targets

All six test apps are installed with access to **all repositories** on
`halfsend-01` through `halfsend-12` and on `halfsend` (used by the STAGE driver).
`halfsend-01` through `halfsend-22` and on `halfsend` (used by the STAGE driver).
The production `fullsend-ai-e2e` app is installed on the same organizations for
cross-org suite control and minting. The other production agent apps are not
required for the normal behaviour or playback suites and are intentionally not
Expand Down Expand Up @@ -911,7 +921,7 @@ App registration in that setup. Per-repo setup may still request the literal
**Permission rollout for the coder App:** When adding a permission such as
`packages:read`, update the `fullsend-test-coder` App registration first. Then
have the installation owner for each existing pool org (`halfsend-01` through
`halfsend-12`) Accept the pending permission update. New pool-org installs
`halfsend-22`) Accept the pending permission update. New pool-org installs
receive the permission during installation; existing installs may otherwise
continue using the mint's rollout warning path.

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/infrastructure/infrastructure-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ Recommended operator order for adding **`packages:read`** to `coder` (code / fix
(hosted: `https://github.com/organizations/fullsend-ai/settings/apps/<app-slug>/permissions`).
Optionally include a short note to users explaining why.
2. Update the App used by the pool installations as well, and have each
`halfsend-01` … `halfsend-12` and `halfsend` installation owner Accept its pending update.
`halfsend-01` … `halfsend-22` and `halfsend` installation owner Accept its pending update.
For the test-app setup, including the e2e pool organizations, that is
`fullsend-test-coder`. Neither app set should be left permanently on
permission-drop warnings.
Expand Down
2 changes: 1 addition & 1 deletion hack/setup-e2e-inference-gateway.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ set -euo pipefail
# Keep in sync with orgPool in internal/e2etest/testutil.go (plus the STAGE
# org halfsend) and DefaultPoolSize in pkg/behaviourtest/drivers/install/
# driver.go. A pool change is an edit here plus a re-run.
POOL_ORGS=(halfsend-01 halfsend-02 halfsend-03 halfsend-04 halfsend-05 halfsend-06 halfsend-07 halfsend-08 halfsend-09 halfsend-10 halfsend-11 halfsend-12 halfsend)
POOL_ORGS=(halfsend-01 halfsend-02 halfsend-03 halfsend-04 halfsend-05 halfsend-06 halfsend-07 halfsend-08 halfsend-09 halfsend-10 halfsend-11 halfsend-12 halfsend-13 halfsend-14 halfsend-15 halfsend-16 halfsend-17 halfsend-18 halfsend-19 halfsend-20 halfsend-21 halfsend-22 halfsend)
POOL_REPOS=(test-repo-01 test-repo-02 test-repo-03 test-repo-04 test-repo-05 test-repo-06 test-repo-07 test-repo-08 test-repo-09 test-repo-10 test-repo-11 test-repo-12)

# A repository outside the pool. Only it may use the echo-denied model, so a
Expand Down
4 changes: 2 additions & 2 deletions hack/setup-e2e-inference-gateway_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,9 @@ expect_out "prints the x-api-key probe" "x-api-key only: GET /v1/models -> HTTP
CFG="${STATE}/secrets/${CFG_SECRET}.v1"
if [[ "$(cat "${STATE}/secrets/${KEY_SECRET}.v1")" == "e2e-stub-upstream-key" ]]; then
pass "stub key holds the fixed value"; else fail "stub key value"; fi
if [[ "$(grep -o '"halfsend[-0-9]*/test-repo-[0-9][0-9]"' "${CFG}" | sort -u | wc -l | tr -d ' ')" == "156" ]] \
if [[ "$(grep -o '"halfsend[-0-9]*/test-repo-[0-9][0-9]"' "${CFG}" | sort -u | wc -l | tr -d ' ')" == "276" ]] \
&& grep -q '"halfsend/test-repo-12"' "${CFG}"; then
pass "config allows the 13 x 12 pool repositories"; else fail "pool allowlist"; fi
pass "config allows the 23 x 12 pool repositories"; else fail "pool allowlist"; fi
if grep -q 'mode: strict' "${CFG}" && grep -q 'audiences: \[fullsend-e2e-gateway\]' "${CFG}" \
&& ! grep -q 'preserveToken: true' "${CFG}"; then
pass "config validates GitHub OIDC strictly with the fixed audience"; else fail "jwtAuth"; fi
Expand Down
10 changes: 10 additions & 0 deletions internal/e2etest/testutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ var orgPool = []string{
"halfsend-10",
"halfsend-11",
"halfsend-12",
"halfsend-13",
"halfsend-14",
"halfsend-15",
"halfsend-16",
"halfsend-17",
"halfsend-18",
"halfsend-19",
"halfsend-20",
"halfsend-21",
"halfsend-22",
}

var (
Expand Down
21 changes: 12 additions & 9 deletions pkg/behaviourtest/drivers/install/mint_groups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ func assertPacked(t *testing.T, layout PoolLayout, groups []mintGroup, maxBytes
assert.Equal(t, layout.Orgs(), all)
}

func TestPlanMintGroups_DevPoolTwoMints(t *testing.T) {
layout := DevPoolLayout(DefaultPoolSize) // 12 orgs × 12 slots
func TestPlanMintGroups_DevPoolFourMints(t *testing.T) {
layout := DevPoolLayout(DefaultPoolSize) // 22 orgs × 12 slots
groups, err := planMintGroups(layout, maxWorkerVarBytes)
require.NoError(t, err)
require.Len(t, groups, 2)
require.Len(t, groups, 4)
assertPacked(t, layout, groups, maxWorkerVarBytes)
assert.Equal(t, layout.Orgs()[:6], groups[0].orgs)
assert.Equal(t, layout.Orgs()[6:], groups[1].orgs)
assert.Equal(t, layout.Orgs()[6:12], groups[1].orgs)
assert.Equal(t, layout.Orgs()[12:18], groups[2].orgs)
assert.Equal(t, layout.Orgs()[18:], groups[3].orgs)
// The serialized sizes cited in #8681: six orgs fit, seven do not.
assert.Len(t, groups[0].workflowHostRepos, 4319)
assert.Len(t, groupWorkflowHostRepos(layout.Orgs()[:7], DefaultPoolSize), 5039)
Expand All @@ -56,12 +58,12 @@ func TestPlanMintGroups_NearByteLimit(t *testing.T) {

groups, err := planMintGroups(layout, six)
require.NoError(t, err)
assert.Equal(t, []int{6, 6}, groupSizes(groups), "a list exactly at the limit fits")
assert.Equal(t, []int{6, 6, 6, 4}, groupSizes(groups), "a list exactly at the limit fits")
assertPacked(t, layout, groups, six)

groups, err = planMintGroups(layout, six-1)
require.NoError(t, err)
assert.Equal(t, []int{5, 5, 2}, groupSizes(groups), "one byte over moves an org to the next mint")
assert.Equal(t, []int{5, 5, 5, 5, 2}, groupSizes(groups), "one byte over moves an org to the next mint")
assertPacked(t, layout, groups, six-1)
}

Expand All @@ -79,8 +81,8 @@ func TestPlanMintGroups_RecomputedForPoolChanges(t *testing.T) {
layout PoolLayout
sizes []int
}{
{"fewer slots per org", DevPoolLayout(6), []int{12}},
{"more slots per org", DevPoolLayout(20), []int{4, 4, 4}},
{"fewer slots per org", DevPoolLayout(6), []int{13, 9}},
{"more slots per org", DevPoolLayout(20), []int{4, 4, 4, 4, 4, 2}},
{"fewer orgs", PoolLayout{FirstOrgIndex: 1, OrgCount: 4, SlotsPerOrg: DefaultPoolSize}, []int{4}},
{"more orgs", PoolLayout{FirstOrgIndex: 1, OrgCount: 13, SlotsPerOrg: DefaultPoolSize}, []int{6, 6, 1}},
{"stage", StagePoolLayout(DefaultPoolSize), []int{1}},
Expand Down Expand Up @@ -118,7 +120,8 @@ func TestPlanCFMints_StatusGroupPickedOnce(t *testing.T) {
assert.Equal(t, 1, calls, "one status team per job")
assert.Equal(t, DevPoolLayout(DefaultPoolSize).Orgs(), offered, "eligible teams are the pool orgs'")
assert.Equal(t, "halfsend-10/mint-status", plan.statusGroup)
assert.Equal(t, [][]string{DevPoolLayout(DefaultPoolSize).Orgs()[:6], DevPoolLayout(DefaultPoolSize).Orgs()[6:]}, groupOrgs(plan.groups))
orgs := DevPoolLayout(DefaultPoolSize).Orgs()
assert.Equal(t, [][]string{orgs[:6], orgs[6:12], orgs[12:18], orgs[18:]}, groupOrgs(plan.groups))
assert.Equal(t, 0, plan.groupOf["halfsend-01"])
assert.Equal(t, 1, plan.groupOf["halfsend-12"])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ func TestNewRepoPoolCFMintPreviews_DerivedDevOrgs(t *testing.T) {
assert.Equal(t, DevPoolOrgCount*2, d.Capacity())
orgs := d.(*composedDriver).alloc.layout.Orgs()
assert.Equal(t, "halfsend-01", orgs[0])
assert.Equal(t, "halfsend-12", orgs[len(orgs)-1])
assert.Equal(t, "halfsend-22", orgs[len(orgs)-1])
}

// --- setupCFMintPEMDir tests ---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const (
StageMintWorkerName = "stage-mint"

// StageOrg is the GitHub org used for STAGE behaviour tests.
// Unlike the DEV pool orgs (halfsend-01 … halfsend-12), the STAGE
// Unlike the DEV pool orgs (halfsend-01 … halfsend-22), the STAGE
// driver uses a single org. Within this org, a repo pool is used
// just like in the DEV drivers.
StageOrg = "halfsend"
Expand Down
Loading
Loading