From 2a523079a273db74c5c84d857fd584e00a60c80e Mon Sep 17 00:00:00 2001 From: Dr Alexander Mikhalev Date: Thu, 15 Oct 2026 08:40:00 +0100 Subject: [PATCH] fix: revalidate registry catalogs during release readback --- .../scripts/verify_registry.py | 2 + .../registries/openvsx-revalidated-014.json | 203 ++++++++++++++++++ .../registries/openvsx-stale-014.json | 124 +++++++++++ .../tests/verify_registry_test.py | 11 + 4 files changed, 340 insertions(+) create mode 100644 vs-code-terraphim-it/tests/fixtures/registries/openvsx-revalidated-014.json create mode 100644 vs-code-terraphim-it/tests/fixtures/registries/openvsx-stale-014.json diff --git a/vs-code-terraphim-it/scripts/verify_registry.py b/vs-code-terraphim-it/scripts/verify_registry.py index 960738bc5..99cc35785 100644 --- a/vs-code-terraphim-it/scripts/verify_registry.py +++ b/vs-code-terraphim-it/scripts/verify_registry.py @@ -173,6 +173,7 @@ def read_catalog(registry, manifest, root): "--connect-timeout", "15", "--max-time", "60", "--max-filesize", str(8 * 1024 * 1024), "--request", "POST", "--header", "Content-Type: application/json", "--header", "Accept: application/json;api-version=7.2-preview.1", + "--header", "Cache-Control: no-cache", "--data-binary", "@" + str(request), "--output", str(response), "--write-out", "%{http_code}", GALLERY_URLS[registry], ], text=True, capture_output=True, timeout=70, check=False) @@ -181,6 +182,7 @@ def read_catalog(registry, manifest, root): raw = response.read_bytes() metadata = json.loads(raw) return metadata, {"url": GALLERY_URLS[registry], "request": gallery_query(manifest), + "requestCacheControl": "no-cache", "responseSha256": hashlib.sha256(raw).hexdigest(), "responseBytes": len(raw), "responseBody": raw.decode("utf-8")} diff --git a/vs-code-terraphim-it/tests/fixtures/registries/openvsx-revalidated-014.json b/vs-code-terraphim-it/tests/fixtures/registries/openvsx-revalidated-014.json new file mode 100644 index 000000000..72344952c --- /dev/null +++ b/vs-code-terraphim-it/tests/fixtures/registries/openvsx-revalidated-014.json @@ -0,0 +1,203 @@ +{ + "results": [ + { + "extensions": [ + { + "extensionId": "01a1397c-abbb-7196-a7d0-5f21bae87581", + "extensionName": "terraphim-it", + "displayName": "Terraphim It", + "shortDescription": "Intelligent Markdown editor with alternatives, knowledge-graph synonyms and role-based suggestions", + "publisher": { + "displayName": "applied-knowledge-systems", + "publisherId": "01a1397c-abbf-7660-af01-72a592315dce", + "publisherName": "applied-knowledge-systems", + "domain": null, + "isDomainVerified": null + }, + "versions": [ + { + "version": "0.1.4", + "lastUpdated": "2026-10-15T07:26:45.552045Z", + "assetUri": "https://open-vsx.org/vscode/asset/applied-knowledge-systems/terraphim-it/0.1.4", + "fallbackAssetUri": "https://open-vsx.org/vscode/asset/applied-knowledge-systems/terraphim-it/0.1.4", + "files": [ + { + "assetType": "Microsoft.VisualStudio.Code.Manifest", + "source": "https://open-vsx.org/api/applied-knowledge-systems/terraphim-it/0.1.4/file/package.json" + }, + { + "assetType": "Microsoft.VisualStudio.Services.Content.Details", + "source": "https://open-vsx.org/api/applied-knowledge-systems/terraphim-it/0.1.4/file/readme.md" + }, + { + "assetType": "Microsoft.VisualStudio.Services.Content.License", + "source": "https://open-vsx.org/api/applied-knowledge-systems/terraphim-it/0.1.4/file/LICENSE.txt" + }, + { + "assetType": "Microsoft.VisualStudio.Services.VSIXPackage", + "source": "https://open-vsx.org/api/applied-knowledge-systems/terraphim-it/0.1.4/file/applied-knowledge-systems.terraphim-it-0.1.4.vsix" + }, + { + "assetType": "Microsoft.VisualStudio.Services.Content.Changelog", + "source": "https://open-vsx.org/api/applied-knowledge-systems/terraphim-it/0.1.4/file/changelog.md" + }, + { + "assetType": "Microsoft.VisualStudio.Services.VsixManifest", + "source": "https://open-vsx.org/api/applied-knowledge-systems/terraphim-it/0.1.4/file/extension.vsixmanifest" + }, + { + "assetType": "Microsoft.VisualStudio.Services.VsixSignature", + "source": "https://open-vsx.org/api/applied-knowledge-systems/terraphim-it/0.1.4/file/applied-knowledge-systems.terraphim-it-0.1.4.sigzip" + }, + { + "assetType": "Microsoft.VisualStudio.Services.PublicKey", + "source": "https://open-vsx.org/api/-/public-key/14ccb407-4e79-41ed-be5a-6d608325c45a" + } + ], + "properties": [ + { + "key": "Microsoft.VisualStudio.Services.Branding.Color", + "value": "" + }, + { + "key": "Microsoft.VisualStudio.Services.Branding.Theme", + "value": "" + }, + { + "key": "Microsoft.VisualStudio.Services.Links.Source", + "value": "https://github.com/terraphim/terraphim-ai.git" + }, + { + "key": "Microsoft.VisualStudio.Code.SponsorLink", + "value": "" + }, + { + "key": "Microsoft.VisualStudio.Code.Engine", + "value": "^1.126.0" + }, + { + "key": "Microsoft.VisualStudio.Code.ExtensionDependencies", + "value": "" + }, + { + "key": "Microsoft.VisualStudio.Code.ExtensionPack", + "value": "" + }, + { + "key": "Microsoft.VisualStudio.Code.LocalizedLanguages", + "value": "" + }, + { + "key": "Microsoft.VisualStudio.Code.PreRelease", + "value": "true" + } + ], + "targetPlatform": "universal" + }, + { + "version": "0.1.0", + "lastUpdated": "2026-10-14T08:17:11.286382Z", + "assetUri": "https://open-vsx.org/vscode/asset/applied-knowledge-systems/terraphim-it/0.1.0", + "fallbackAssetUri": "https://open-vsx.org/vscode/asset/applied-knowledge-systems/terraphim-it/0.1.0", + "files": [ + { + "assetType": "Microsoft.VisualStudio.Code.Manifest", + "source": "https://open-vsx.org/api/applied-knowledge-systems/terraphim-it/0.1.0/file/package.json" + }, + { + "assetType": "Microsoft.VisualStudio.Services.Content.Details", + "source": "https://open-vsx.org/api/applied-knowledge-systems/terraphim-it/0.1.0/file/readme.md" + }, + { + "assetType": "Microsoft.VisualStudio.Services.Content.License", + "source": "https://open-vsx.org/api/applied-knowledge-systems/terraphim-it/0.1.0/file/LICENSE.txt" + }, + { + "assetType": "Microsoft.VisualStudio.Services.VSIXPackage", + "source": "https://open-vsx.org/api/applied-knowledge-systems/terraphim-it/0.1.0/file/applied-knowledge-systems.terraphim-it-0.1.0.vsix" + }, + { + "assetType": "Microsoft.VisualStudio.Services.Content.Changelog", + "source": "https://open-vsx.org/api/applied-knowledge-systems/terraphim-it/0.1.0/file/changelog.md" + }, + { + "assetType": "Microsoft.VisualStudio.Services.VsixManifest", + "source": "https://open-vsx.org/api/applied-knowledge-systems/terraphim-it/0.1.0/file/extension.vsixmanifest" + }, + { + "assetType": "Microsoft.VisualStudio.Services.VsixSignature", + "source": "https://open-vsx.org/api/applied-knowledge-systems/terraphim-it/0.1.0/file/applied-knowledge-systems.terraphim-it-0.1.0.sigzip" + }, + { + "assetType": "Microsoft.VisualStudio.Services.PublicKey", + "source": "https://open-vsx.org/api/-/public-key/14ccb407-4e79-41ed-be5a-6d608325c45a" + } + ], + "properties": [ + { + "key": "Microsoft.VisualStudio.Services.Branding.Color", + "value": "" + }, + { + "key": "Microsoft.VisualStudio.Services.Branding.Theme", + "value": "" + }, + { + "key": "Microsoft.VisualStudio.Services.Links.Source", + "value": "https://github.com/terraphim/terraphim-ai.git" + }, + { + "key": "Microsoft.VisualStudio.Code.SponsorLink", + "value": "" + }, + { + "key": "Microsoft.VisualStudio.Code.Engine", + "value": "^1.126.0" + }, + { + "key": "Microsoft.VisualStudio.Code.ExtensionDependencies", + "value": "" + }, + { + "key": "Microsoft.VisualStudio.Code.ExtensionPack", + "value": "" + }, + { + "key": "Microsoft.VisualStudio.Code.LocalizedLanguages", + "value": "" + }, + { + "key": "Microsoft.VisualStudio.Code.PreRelease", + "value": "true" + } + ], + "targetPlatform": "universal" + } + ], + "statistics": [], + "tags": [], + "releaseDate": "2026-10-14T08:17:11.286382Z", + "publishedDate": "2026-10-14T08:17:11.286382Z", + "lastUpdated": "2026-10-15T07:28:03.027714Z", + "categories": [ + "AI", + "Other", + "Snippets" + ], + "flags": "" + } + ], + "resultMetadata": [ + { + "metadataType": "ResultCount", + "metadataItems": [ + { + "name": "TotalCount", + "count": 1 + } + ] + } + ] + } + ] +} diff --git a/vs-code-terraphim-it/tests/fixtures/registries/openvsx-stale-014.json b/vs-code-terraphim-it/tests/fixtures/registries/openvsx-stale-014.json new file mode 100644 index 000000000..8d3ef1e8b --- /dev/null +++ b/vs-code-terraphim-it/tests/fixtures/registries/openvsx-stale-014.json @@ -0,0 +1,124 @@ +{ + "results": [ + { + "extensions": [ + { + "extensionId": "01a1397c-abbb-7196-a7d0-5f21bae87581", + "extensionName": "terraphim-it", + "displayName": "Terraphim It", + "shortDescription": "Intelligent Markdown editor with alternatives, knowledge-graph synonyms and role-based suggestions", + "publisher": { + "displayName": "applied-knowledge-systems", + "publisherId": "01a1397c-abbf-7660-af01-72a592315dce", + "publisherName": "applied-knowledge-systems", + "domain": null, + "isDomainVerified": null + }, + "versions": [ + { + "version": "0.1.0", + "lastUpdated": "2026-10-14T08:17:11.286382Z", + "assetUri": "https://open-vsx.org/vscode/asset/applied-knowledge-systems/terraphim-it/0.1.0", + "fallbackAssetUri": "https://open-vsx.org/vscode/asset/applied-knowledge-systems/terraphim-it/0.1.0", + "files": [ + { + "assetType": "Microsoft.VisualStudio.Code.Manifest", + "source": "https://open-vsx.org/api/applied-knowledge-systems/terraphim-it/0.1.0/file/package.json" + }, + { + "assetType": "Microsoft.VisualStudio.Services.Content.Details", + "source": "https://open-vsx.org/api/applied-knowledge-systems/terraphim-it/0.1.0/file/readme.md" + }, + { + "assetType": "Microsoft.VisualStudio.Services.Content.License", + "source": "https://open-vsx.org/api/applied-knowledge-systems/terraphim-it/0.1.0/file/LICENSE.txt" + }, + { + "assetType": "Microsoft.VisualStudio.Services.VSIXPackage", + "source": "https://open-vsx.org/api/applied-knowledge-systems/terraphim-it/0.1.0/file/applied-knowledge-systems.terraphim-it-0.1.0.vsix" + }, + { + "assetType": "Microsoft.VisualStudio.Services.Content.Changelog", + "source": "https://open-vsx.org/api/applied-knowledge-systems/terraphim-it/0.1.0/file/changelog.md" + }, + { + "assetType": "Microsoft.VisualStudio.Services.VsixManifest", + "source": "https://open-vsx.org/api/applied-knowledge-systems/terraphim-it/0.1.0/file/extension.vsixmanifest" + }, + { + "assetType": "Microsoft.VisualStudio.Services.VsixSignature", + "source": "https://open-vsx.org/api/applied-knowledge-systems/terraphim-it/0.1.0/file/applied-knowledge-systems.terraphim-it-0.1.0.sigzip" + }, + { + "assetType": "Microsoft.VisualStudio.Services.PublicKey", + "source": "https://open-vsx.org/api/-/public-key/14ccb407-4e79-41ed-be5a-6d608325c45a" + } + ], + "properties": [ + { + "key": "Microsoft.VisualStudio.Services.Branding.Color", + "value": "" + }, + { + "key": "Microsoft.VisualStudio.Services.Branding.Theme", + "value": "" + }, + { + "key": "Microsoft.VisualStudio.Services.Links.Source", + "value": "https://github.com/terraphim/terraphim-ai.git" + }, + { + "key": "Microsoft.VisualStudio.Code.SponsorLink", + "value": "" + }, + { + "key": "Microsoft.VisualStudio.Code.Engine", + "value": "^1.126.0" + }, + { + "key": "Microsoft.VisualStudio.Code.ExtensionDependencies", + "value": "" + }, + { + "key": "Microsoft.VisualStudio.Code.ExtensionPack", + "value": "" + }, + { + "key": "Microsoft.VisualStudio.Code.LocalizedLanguages", + "value": "" + }, + { + "key": "Microsoft.VisualStudio.Code.PreRelease", + "value": "true" + } + ], + "targetPlatform": "universal" + } + ], + "statistics": [], + "tags": [], + "releaseDate": "2026-10-14T08:17:11.286382Z", + "publishedDate": "2026-10-14T08:17:11.286382Z", + "lastUpdated": "2026-10-14T08:20:45.453003Z", + "categories": [ + "AI", + "Other", + "Snippets" + ], + "flags": "" + } + ], + "resultMetadata": [ + { + "metadataType": "ResultCount", + "metadataItems": [ + { + "name": "TotalCount", + "count": 1 + } + ] + } + ] + } + ] +} diff --git a/vs-code-terraphim-it/tests/verify_registry_test.py b/vs-code-terraphim-it/tests/verify_registry_test.py index 8839cc3b7..5b1c223d0 100644 --- a/vs-code-terraphim-it/tests/verify_registry_test.py +++ b/vs-code-terraphim-it/tests/verify_registry_test.py @@ -29,6 +29,17 @@ def test_real_catalog_responses_bind_exact_version_channel_and_download(self): with self.assertRaises(registry.NotIndexed): registry.catalog_version(self.fixture(name), {**manifest, "version": "0.1.3"}, name) + def test_real_stale_and_revalidated_catalogs_do_not_conflate_publication_with_indexing(self): + manifest = {**verify_vsix_test.VsixTest.manifest, "version": "0.1.4"} + # Same public query captured consecutively; the default response was + # stale while Cache-Control:no-cache exposed the admitted version. + with self.assertRaises(registry.NotIndexed): + registry.catalog_version(self.fixture("openvsx-stale-014"), manifest, "openvsx") + selected = registry.catalog_version(self.fixture("openvsx-revalidated-014"), manifest, "openvsx") + self.assertEqual(selected["version"], "0.1.4") + self.assertEqual(registry.catalog_download(selected, manifest, "openvsx"), + "https://open-vsx.org/api/applied-knowledge-systems/terraphim-it/0.1.4/file/applied-knowledge-systems.terraphim-it-0.1.4.vsix") + def test_catalog_rejects_ambiguous_channel_platform_and_validation(self): original = self.fixture("marketplace") manifest = {**verify_vsix_test.VsixTest.manifest, "version": "0.1.3"}