Skip to content

Commit b2f8998

Browse files
committed
Pin consumed V46 replacement to exact source and compiler
1 parent 359ce80 commit b2f8998

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎tools/test_replace_v46.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ def test_restricted_version_hash_content_and_consumption(self):
1515
with tempfile.TemporaryDirectory() as tmp:
1616
lock=Path(tmp)/'manifest.json';lock.write_text(json.dumps(dict(dataVersion=46)))
1717
checksum=hashlib.sha256(lock.read_bytes()).hexdigest()
18-
manifest=dict(dataVersion=46,ruleCount=3041,contentSha256=update.NEW_CONTENT_SHA256)
18+
manifest=dict(dataVersion=46,ruleCount=3041,contentSha256=update.NEW_CONTENT_SHA256,sourceRevision=update.REPLACEMENT_SOURCE_REVISION,compilerRevision=update.REPLACEMENT_COMPILER_REVISION)
1919
with patch.object(update,'OLD_LOCK_SHA256',checksum):
2020
self.assertEqual(46,update.authorize_replacement(lock,manifest)['dataVersion'])
2121
with self.assertRaisesRegex(ValueError,'restricted'):update.authorize_replacement(lock,{**manifest,'dataVersion':47})
2222
with self.assertRaisesRegex(ValueError,'content'):update.authorize_replacement(lock,{**manifest,'contentSha256':'other'})
23+
with self.assertRaisesRegex(ValueError,'source/compiler'):update.authorize_replacement(lock,{**manifest,'sourceRevision':'wrong'})
24+
with self.assertRaisesRegex(ValueError,'source/compiler'):update.authorize_replacement(lock,{**manifest,'compilerRevision':'wrong'})
2325
lock.write_text(json.dumps(manifest))
2426
with self.assertRaisesRegex(ValueError,'consumed'):update.authorize_replacement(lock,manifest)

‎tools/update-rules-bundle.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import zipfile
1010

1111
REPLACEMENT_OPERATION = 'v46-replacement-20261011'
12+
REPLACEMENT_SOURCE_REVISION = '2de5986af14acbfce266b17633ef31ecb96b717e'
13+
REPLACEMENT_COMPILER_REVISION = 'd09fc13240cd92fca9c7b5abb2baf4f3a9c4122db1f1e67e110e336383b4e0c2'
1214
OLD_LOCK_SHA256 = '7622f0490d0c5108086df57ea3daf7eb74bd54ec1a3b73b45fd86a6a7ef8b734'
1315
NEW_CONTENT_SHA256 = 'b7b7d500ad48af2898f2e42724e8032f933cc0d61d5fc628a8acb725fbc89bda'
1416

@@ -18,6 +20,7 @@ def authorize_replacement(lock, manifest):
1820
previous = json.loads(lock.read_bytes())
1921
require(previous['dataVersion'] == manifest['dataVersion'] == 46, 'Replacement restricted to V46')
2022
require(manifest.get('contentSha256') == NEW_CONTENT_SHA256 and manifest.get('ruleCount') == 3041, 'Authorized V46 content mismatch')
23+
require(manifest.get('sourceRevision') == REPLACEMENT_SOURCE_REVISION and manifest.get('compilerRevision') == REPLACEMENT_COMPILER_REVISION, 'Authorized V46 source/compiler mismatch')
2124
return previous
2225

2326

0 commit comments

Comments
 (0)