Skip to content

Commit 4e8bc88

Browse files
authored
Fix Slice 5 test clock drift (#26)
## Sorun `Orbit Full Regression #5` aynı main commit'inde önceki gün başarılıyken 24 Temmuz'da tekrarlı biçimde başarısız olmaya başladı. Slice 5 test oturumu `2026-07-16T10:00:00Z` zamanına sabitleniyor, fakat üç ham authenticated `fetch` isteği `x-test-now` başlığını göndermiyordu. Gerçek saat oturumun 7 günlük ömrünü aşınca: - sponsor-private medya kontrolü 200 yerine gizlenmiş 404, - kötü Origin kontrolü ise CSRF aşamasına ulaşmadan 403 yerine 401 döndürüyordu. ## Çözüm Üç isteği de test paketinin sabit `NOW` saatiyle çalıştırdım. Uygulama kodu değişmedi. ## Doğrulama - Hata patch öncesinde yerelde birebir üretildi: 90/92 - `npm run test:d1` patch sonrasında başarılı: 92/92
1 parent ec887bc commit 4e8bc88

1 file changed

Lines changed: 21 additions & 3 deletions

File tree

‎scripts/orbit-slice5-tests.ts‎

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,14 +372,24 @@ describe('Orbit V6 Slice 5 dashboard and platform core', { concurrency: false },
372372
assert.equal(submission.status, 202, await submission.clone().text());
373373
const record = (await submission.json() as { record: { id: string } }).record;
374374
assert.equal((await fetch(`${baseUrl}/v1/media/${mediaId}`)).status, 404);
375-
assert.equal((await fetch(`${baseUrl}/v1/media/${mediaId}`, { headers: { cookie: ownerCookie } })).status, 200);
375+
assert.equal((await fetch(`${baseUrl}/v1/media/${mediaId}`, {
376+
headers: {
377+
cookie: ownerCookie,
378+
'x-test-now': String(NOW),
379+
},
380+
})).status, 200);
376381
const reviews = (await (await ownerRequest('/v1/approvals')).json() as {
377382
reviews: Array<{ id: string; record: { id: string }; media: { id: string } | null }>;
378383
}).reviews;
379384
const review = reviews.find((item) => item.record.id === record.id);
380385
assert.equal(review?.media?.id, mediaId);
381386
assert.equal((await ownerRequest(`/v1/approvals/${review?.id}/reject`, 'POST', { note: 'media cleanup proof' }, 'slice5-media-reject')).status, 200);
382-
assert.equal((await fetch(`${baseUrl}/v1/media/${mediaId}`, { headers: { cookie: ownerCookie } })).status, 404);
387+
assert.equal((await fetch(`${baseUrl}/v1/media/${mediaId}`, {
388+
headers: {
389+
cookie: ownerCookie,
390+
'x-test-now': String(NOW),
391+
},
392+
})).status, 404);
383393
const cleanup = await testPost('/__test/media-cleanup', { now: NOW + 8 * 86400000 });
384394
assert.equal(cleanup.status, 200);
385395
const cleanupBody = await cleanup.json() as { deleted: number; failed: number };
@@ -482,7 +492,15 @@ describe('Orbit V6 Slice 5 dashboard and platform core', { concurrency: false },
482492
assert.equal(sessions[0].current, true);
483493

484494
const forbidden = await fetch(`${baseUrl}/v1/sessions/${sessions[0].id}/revoke`, {
485-
method: 'POST', headers: { cookie: ownerCookie, origin: 'https://evil.example', 'x-orbit-csrf': ownerCsrf, 'content-type': 'application/json' }, body: '{}',
495+
method: 'POST',
496+
headers: {
497+
cookie: ownerCookie,
498+
origin: 'https://evil.example',
499+
'x-orbit-csrf': ownerCsrf,
500+
'x-test-now': String(NOW),
501+
'content-type': 'application/json',
502+
},
503+
body: '{}',
486504
});
487505
assert.equal(forbidden.status, 403);
488506
});

0 commit comments

Comments
 (0)