Skip to content

Commit 42107f2

Browse files
sametbasbugclaude
andcommitted
Find the staging owner by role, not by a provider number
Gecelik regresyonun staging provası, sahip hesabını bulamadığı için düştü: sorgu `provider='google' AND provider_user_id='126420524'` arıyordu ve bu hiçbir zaman var olmamış bir satır. 126420524 bir GitHub kullanıcı numarası. GitHub kaldırılırken (0040) sorgudaki sağlayıcı adı 'google' yapıldı, numara olduğu gibi bırakıldı — mekanik bir yeniden adlandırma. Hiçbir Google `sub` değeri o numaraya eşit olmuyor; üstelik 0040 GitHub satırlarını yeni tabloya hiç kopyalamıyor, yani eşleşecek bir aday bile yok. Sorgu boş döndü, `typeof owner` 'undefined' oldu. Doğrusu sağlayıcıya hiç bakmamak. Sahiplik zaten oradan gelmiyor: yetki `platform_owner` rol satırında ve uzun süredir öyle. Rolden okumak bugün doğru olmanın ötesinde, bir sonraki sağlayıcı değişiminde de sessizce yanlışa dönmüyor. LIMIT 1 yerine tam bir satır bekleniyor: ikinci bir aktif sahip çıkarsa prova hangi hesapla çalıştığını bilmiyor demektir ve bunu susarak seçmesindense düşmesi doğru. Aynı hata slice5 images prova betiğinde de vardı; o gecelik işte koşmadığı için kimse görmemişti. Orada ayrıca ölü iki değişken duruyordu — `ORBIT_GITHUB_CALLBACK_URL` ve `ORBIT_PLATFORM_OWNER_GITHUB_ID`; depoda başka hiçbir yerde okunmuyorlar — kaldırıldı. Yerel kanıt: sıfırdan kurulan bir D1'de eski sorgu 0 satır, yeni sorgu tam 1 satır döndürüyor. `npm run check` 0 hata, `production:config:check` 85 iddia. Staging'in kendisine karşı koşulmadı: bu makinede Cloudflare API erişimi yok, gerçek kanıt gecelik işin (veya workflow_dispatch'in) kendisi. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 9b2e45e commit 42107f2

2 files changed

Lines changed: 28 additions & 13 deletions

File tree

‎scripts/orbit-slice4-staging-e2e.ts‎

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,25 @@ const suffix = now.toString(36);
147147
const agentPepper = readStagingSecret('ORBIT_AGENT_CREDENTIAL_PEPPER_V1');
148148
const sessionPepper = readStagingSecret('ORBIT_SESSION_PEPPER_V1');
149149
const csrfPepper = readStagingSecret('ORBIT_CSRF_PEPPER_V1');
150-
const owner = execute(`
151-
SELECT a.id FROM accounts a JOIN auth_identities ai ON ai.account_id = a.id
152-
WHERE ai.provider = 'google' AND ai.provider_user_id = '126420524' LIMIT 1
153-
`)[0]?.id;
154-
assert.equal(typeof owner, 'string');
155-
const ownerId = String(owner);
150+
/* Sahip hesabı ROLÜNDEN bulunuyor, kimliğinden değil.
151+
*
152+
* Burası eskiden `provider='github' AND provider_user_id='126420524'`
153+
* sorguluyordu. GitHub kaldırılırken sağlayıcı adı 'google' yapıldı ama
154+
* numara olduğu gibi kaldı — o numara bir GitHub kullanıcı kimliği ve
155+
* hiçbir Google `sub` değeri ona eşit olmuyor. Üstelik 0040 GitHub
156+
* satırlarını yeni tabloya hiç kopyalamıyor, yani eşleşecek satır da yok.
157+
* Sorgu boş döndü ve gecelik prova buradan düştü.
158+
*
159+
* Yetki zaten sağlayıcıdan gelmiyor: `platform_owner` rol satırında.
160+
* Rolden okumak hem bugün doğru, hem de bir sonraki sağlayıcı değişiminde
161+
* sessizce yanlışa dönmüyor. Tek satır bekliyoruz — ikinci bir sahip
162+
* çıkarsa bu prova hangi hesapla çalıştığını bilmiyor demektir. */
163+
const owners = execute(`
164+
SELECT account_id FROM account_roles
165+
WHERE role = 'platform_owner' AND revoked_at IS NULL
166+
`);
167+
assert.equal(owners.length, 1, 'Staging does not have exactly one active platform owner.');
168+
const ownerId = String(owners[0].account_id);
156169
const direct = await seedAgent(ownerId, `slice4-direct-${suffix}`, 'direct_publish', agentPepper, now);
157170
const approval = await seedAgent(ownerId, `slice4-review-${suffix}`, 'approval_required', agentPepper, now + 1);
158171
const readonly = await seedAgent(ownerId, `slice4-readonly-${suffix}`, 'read_only', agentPepper, now + 2);

‎scripts/orbit-slice5-images-cpu-staging-e2e.ts‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,6 @@ try {
152152
ORBIT_ENVIRONMENT: 'test',
153153
ORBIT_DEPLOYMENT_MODE: 'live',
154154
ORBIT_ALLOWED_ORIGIN: origin,
155-
ORBIT_GITHUB_CALLBACK_URL: `${origin}/v1/auth/github/callback`,
156-
ORBIT_PLATFORM_OWNER_GITHUB_ID: '126420524',
157155
ORBIT_BACKUP_ENABLED: 'false',
158156
ORBIT_MEDIA_ENABLED: 'true',
159157
},
@@ -178,11 +176,15 @@ try {
178176
assert.ok(proofVersion);
179177
await waitReady();
180178

181-
const ownerId = String(execute(`
182-
SELECT a.id FROM accounts a JOIN auth_identities ai ON ai.account_id = a.id
183-
WHERE ai.provider = 'google' AND ai.provider_user_id = '126420524' LIMIT 1
184-
`)[0]?.id ?? '');
185-
assert.ok(ownerId);
179+
/* Sahip hesabı rolünden okunuyor; gerekçesi
180+
* orbit-slice4-staging-e2e.ts'de yazılı. Kısaca: buradaki numara bir
181+
* GitHub kimliğiydi, 0040 sonrası hiçbir satırla eşleşmiyor. */
182+
const owners = execute(`
183+
SELECT account_id FROM account_roles
184+
WHERE role = 'platform_owner' AND revoked_at IS NULL
185+
`);
186+
assert.equal(owners.length, 1, 'Staging does not have exactly one active platform owner.');
187+
const ownerId = String(owners[0].account_id);
186188
const agentPepper = secrets.ORBIT_AGENT_CREDENTIAL_PEPPER_V1;
187189
const credential = await createOpaqueToken('agent', agentPepper);
188190
agentId = createEntityId();

0 commit comments

Comments
 (0)