Skip to content

Commit 735702a

Browse files
sametbasbugclaude
andcommitted
Catch a stale contract constant before it reaches production
The live contract checker keeps the expected guide version in a constant of its own. When the guide went to 3.6.0 that constant stayed at 3.5.0, and the deploy still passed: the live site was also still on 3.5.0 at the time, so the checker agreed with production about a version neither of them was about to have. The mismatch surfaced one deploy later, after the code was already live. The constant is corrected, and site:test now reads the version out of the published guide and requires the checker to carry the same one. The drift hits the local suite instead of a production gate. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 8e119e1 commit 735702a

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

‎scripts/orbit-live-contract-tests.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010

1111
const ORIGIN = process.env.ORBIT_LIVE_CONTRACT_ORIGIN || ORBIT_PRODUCTION_ORIGIN;
1212
const EXPECTED_API_VERSION = '1.5.0';
13-
const EXPECTED_GUIDE_VERSION = '3.5.0';
13+
const EXPECTED_GUIDE_VERSION = '3.6.0';
1414
let assertions = 0;
1515

1616
function check(condition, message) {

‎scripts/orbit-site-tests.mjs‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,19 @@ if (fs.existsSync(machineGuideFile)) {
113113
check(machineGuide.includes('PATCH /v1/agent/profile'), 'Makine rehberi profil güncelleme kontratını taşımıyor.');
114114
check(machineGuide.includes('"pinnedRecordId"'), 'Makine rehberi tek sabit gönderi kontratını taşımıyor.');
115115
check(machineGuide.includes('version: 3.6.0'), 'Makine rehberi güncel tam API sözleşmesi sürümünü taşımıyor.');
116+
/* Canlı sözleşme denetçisi rehber sürümünü kendi sabitinde tutuyor ve o
117+
* sabit bir kez sessizce geride kaldı: rehber 3.6.0'a çıktığında denetçi
118+
* 3.5.0'da kalmıştı, ama o turda canlı hâlâ 3.5.0 olduğu için deploy yeşil
119+
* geçti. Yanlış olduğu bir sonraki deploy'da, üstelik yayına çıktıktan
120+
* sonra ortaya çıktı. Burada iki sayıyı yayınlanan rehber üzerinden
121+
* eşliyoruz ki kayma canlıya değil buraya çarpsın. */
122+
const guideVersion = /^version:\s*(\S+)$/mu.exec(machineGuide)?.[1];
123+
check(Boolean(guideVersion), 'Makine rehberinde sürüm satırı bulunamadı.');
124+
const liveContractSource = fs.readFileSync(path.join(ROOT, 'scripts', 'orbit-live-contract-tests.mjs'), 'utf8');
125+
check(
126+
liveContractSource.includes(`const EXPECTED_GUIDE_VERSION = '${guideVersion}';`),
127+
`Canlı sözleşme denetçisi rehber sürümünün gerisinde: rehber ${guideVersion}.`,
128+
);
116129
check(machineGuide.includes('PUT /v1/agent/follows/'), 'Makine rehberi takip kontratını taşımıyor.');
117130
check(machineGuide.includes('GET /v1/agent/feed/following'), 'Makine rehberi takip akışı kontratını taşımıyor.');
118131
// Takip akışı public değil ve rehber bunu söylemek zorunda: ajan neyin

0 commit comments

Comments
 (0)