BE-M1-02 · The ended E2E delegation on staging
Why: the Delegasi section on /profile and the Ubah akses Sheet show an ended delegation, and the journeys that prove it find one made by tools/db/create-e2e-users.mjs (#686). The local stack gets it on every run of the script; staging gets it only when zuki runs the script against staging (L0).
ID BE-M1-02 · Level L0 · Issue #693
Staging's E2E checker holds one ended delegation: gate_service:approve at E2B, given by the E2E admin_fleet, reason E2E ended, last day 2026-01-01 (R-ACC-281). It gives nothing (R-ACC-233). This step changes no file in the repository; .env.e2e keeps its lines.
Before
Section titled “Before”- #693's pull request is merged, so main's
tools/db/create-e2e-users.mjsmakes the delegation and main's migrations holdpublic.my_delegations(). - Staging holds main's migrations: BE-M0-33 was run after the merge. BE-M0-33 ends by running this same script, so if it ran after the merge, run only the Check below.
- BE-M0-30 is Done: staging has the eleven E2E logins, and .env.e2e and .env.staging are in place.
- The password manager is open on the "Opleet v2 staging" entry. The check asks for the publishable key, which starts with sb_publishable_. It's public by design (D13).
1 · From main, clean, and linked to staging
Section titled “1 · From main, clean, and linked to staging”cd ~/opleet-v2/opleetgit switch main && git pullgit status --shortref="$(cat supabase/.temp/project-ref)"; want="$(sed -n 's/^STAGING_PROJECT_REF=//p' .env.staging)"; [ -n "$ref" ] && [ "$ref" = "$want" ] && echo "linked to staging" || echo "STOP: not linked to staging"2 · Run the script against staging
Section titled “2 · Run the script against staging”It reads SUPABASE_URL, SUPABASE_SECRET_KEY and STAGING_PROJECT_REF from .env.staging and refuses any host but <STAGING_PROJECT_REF>.supabase.co. It never prints the password. Running it again is safe: nothing is doubled.
node tools/db/create-e2e-users.mjs --stagingExpect
Section titled “Expect”-
Block 1:
git status --shortprints nothing, then "linked to staging". -
Block 2: eleven lines starting with "kept", one per role from super_admin to viewer, then
kept invitation expired@example.test (expired), then exactly:made delegation gate_service:approve at E2B (ended)11 logins in the E2E organization, all pools. .env.e2e updated (password not shown).On a later run the delegation line says "kept" instead of "made".
The E2E checker signs in against staging and lists its own delegations. It runs in a subshell, so the keys, the password and the token are gone when it ends; none of them is printed.
( set -a; . ./.env.staging; . ./.env.e2e; set +a read -r "PK?Staging publishable key (sb_publishable_…): " token=$(curl -s "$SUPABASE_URL/auth/v1/token?grant_type=password" -H "apikey: $PK" -H "Content-Type: application/json" -d "{\"email\":\"$E2E_CHECKER_EMAIL\",\"password\":\"$E2E_PASSWORD\"}" | python3 -c 'import json, sys; print(json.load(sys.stdin).get("access_token", ""))') curl -s -X POST "$SUPABASE_URL/rest/v1/rpc/my_delegations" -H "apikey: $PK" -H "Authorization: Bearer $token" | python3 -c 'import json, sys; d = json.load(sys.stdin); [print(r["pool_code"], r["permission_code"], r["reason"], r["ends_on"], "live" if r["is_live"] else "ended") for r in d] if isinstance(d, list) else print("error", d.get("code"))')Exactly this one line:
E2B gate_service:approve E2E ended 2026-01-01 endedIf it fails
Section titled “If it fails”- "refusing …" or "--staging needs …": as in BE-M0-30's If it fails. Paste the line, not the file. Don't change the script.
- An error naming the column
delegatedorends_at, or a 4xx with/rest/v1/member_permission_overrides: staging doesn't hold the delegations migration yet. Run BE-M0-33 first, then this step's Check. - "the E2E checker has no membership": the logins are incomplete. Run BE-M0-30 again, then block 2.
- The check prints "error PGRST202": staging doesn't hold
my_delegations(): #693's migrations aren't there. Run BE-M0-33. - The check prints "error" with another code, or nothing: the checker didn't sign in. Run block 2 again, which resets every login's password to the one in .env.e2e, then the check. If it still fails, paste the check's output only.
- The line says "live", or a date other than 2026-01-01: stop and paste the line on #693; that is a bug in the script, not something to fix on staging.
Not needed: the delegation is ended and gives nothing. To remove it, rebuild staging with BE-M0-33, which makes it again; ask zuki first if it must be gone.
Log each run as a comment on #693: the date, block 2's delegation line and the check's line. Never paste the password, a token, the secret key or anything else from .env.staging or .env.e2e.