Skip to content

Commit 5cc1e70

Browse files
authored
Refresh stale SDK indexes before scheduled validation (#1389)
1 parent b6a7e92 commit 5cc1e70

3 files changed

Lines changed: 37 additions & 0 deletions

File tree

‎.github/workflows/update_sdk_details.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ jobs:
3535
python -m pip install --upgrade pip
3636
pip install requests
3737
38+
- name: Refresh indexes from checked-out SDK data
39+
run: python sdk-details/tools/build_indexes.py
40+
3841
- name: Test SDK details tooling
3942
run: python sdk-details/tools/test.py
4043

‎sdk-details/sdks/flutter/data/index.json‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5147,6 +5147,18 @@
51475147
}
51485148
]
51495149
},
5150+
{
5151+
"engine": "af7e796e161ae0bb1ff0758c71a7105418bd9ded",
5152+
"releases": [
5153+
{
5154+
"flutter": "3.47.5",
5155+
"dart": "3.13.4",
5156+
"channel": "stable",
5157+
"framework": "6a19cca56475dbfba1478ee68d7bd0c2ef891da1",
5158+
"release_date": "2026-09-18T20:36:35.413968Z"
5159+
}
5160+
]
5161+
},
51505162
{
51515163
"engine": "b04955656c87de0d80d259792e3a0e4a23b7c260",
51525164
"releases": [

‎sdk-details/tools/tests/test_indexes.py‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import copy
22
import json
33
import re
4+
import tempfile
5+
from unittest.mock import patch
46
from pathlib import Path
57
import sys
68
import unittest
@@ -31,3 +33,23 @@ def test_real_indexes_and_staged_definitions(self):
3133
self.assertIn('path_template',active['lookups'][0])
3234
bad=copy.deepcopy(definition);bad['lookups'][0]['index_path']='sdk-details/{value}.json'
3335
with self.assertRaises(ValueError):validate.validate_definition(candidate,bad)
36+
37+
def test_refresh_repairs_index_after_provider_data_changes(self):
38+
with tempfile.TemporaryDirectory() as directory:
39+
root=Path(directory)
40+
sdk=root/'sdks/flutter';(sdk/'data/engine').mkdir(parents=True)
41+
(sdk/'definition.json').write_text(json.dumps({'lookups':[]}))
42+
(sdk/'data/engine/first.json').write_text(json.dumps({'engine':'first','releases':[]}))
43+
original_outputs=build_indexes.outputs
44+
with patch.object(build_indexes,'SOURCES',{'flutter':('engine','engine')}), patch.object(build_indexes,'outputs',lambda:original_outputs(root)):
45+
build_indexes.build()
46+
build_indexes.build(check=True)
47+
(sdk/'data/engine/second.json').write_text(json.dumps({'engine':'second','releases':[]}))
48+
with self.assertRaisesRegex(ValueError,'Stale SDK index'):
49+
build_indexes.build(check=True)
50+
build_indexes.build()
51+
build_indexes.build(check=True)
52+
index=sdk/'data/index.json';before=index.read_bytes()
53+
self.assertEqual(['first','second'],[entry['engine'] for entry in json.loads(before)['entries']])
54+
build_indexes.build()
55+
self.assertEqual(before,index.read_bytes())

0 commit comments

Comments
 (0)