From c2f41850e03d3cc223c4515038ff38366983d3ce Mon Sep 17 00:00:00 2001 From: bewaterhere-coder Date: Sun, 1 Nov 2026 19:45:33 +0800 Subject: [PATCH 1/3] test: deduplicate plugin extension regression cases --- tests/test_plugin_extension.py | 49 ++++------------------------------ 1 file changed, 5 insertions(+), 44 deletions(-) diff --git a/tests/test_plugin_extension.py b/tests/test_plugin_extension.py index d37c353..b3c9988 100644 --- a/tests/test_plugin_extension.py +++ b/tests/test_plugin_extension.py @@ -52,15 +52,17 @@ def test_manifest_paths_reject_windows_backslash_traversal(self): with self.assertRaisesRegex(ValueError, 'Invalid plugin detection'): manifests(self.plugins) + def test_manifest_paths_reject_windows_drive_prefix(self): + self.add('drive-path', {'id': 'drive-path', 'version': '1.0.0', 'domain': 'code', 'standards': ['architecture'], 'detection': [['C:/outside/project']]}) + with self.assertRaisesRegex(ValueError, 'Invalid plugin detection'): + manifests(self.plugins) + def test_manifest_paths_reject_nul_character(self): self.add('nul-path', {'id': 'nul-path', 'version': '1.0.0', 'domain': 'code', 'standards': ['architecture'], 'detection': [['bad\x00path']]}) with self.assertRaisesRegex(ValueError, 'Invalid plugin detection'): manifests(self.plugins) def test_manifest_paths_reject_windows_drive_prefix(self): - self.add('drive-path', {'id': 'drive-path', 'version': '1.0.0', 'domain': 'code', 'standards': ['architecture'], 'detection': [['C:/outside/project']]}) - with self.assertRaisesRegex(ValueError, 'Invalid plugin detection'): - manifests(self.plugins) def test_manifest_sources_validate_required_fields_and_date(self): self.add('bad-source', {'id': 'bad-source', 'version': '1.0.0', 'domain': 'code', 'standards': ['architecture'], 'detection': [['custom.project']], 'sources': [{'publisher': 'Example', 'title': 'Guide', 'url': 'https://example.com', 'engine_versions': '1.x', 'accessed': 'not-a-date'}]}) @@ -136,44 +138,3 @@ def test_symlink_outside_project_not_detected(self): self.add('drive-path', {'id': 'drive-path', 'version': '1.0.0', 'domain': 'code', 'standards': ['architecture'], 'detection': [['C:/outside/project']]}) with self.assertRaisesRegex(ValueError, 'Invalid plugin detection'): manifests(self.plugins) - - def test_manifest_sources_validate_required_fields_and_date(self): - self.add('bad-source', {'id': 'bad-source', 'version': '1.0.0', 'domain': 'code', 'standards': ['architecture'], 'detection': [['custom.project']], 'sources': [{'publisher': 'Example', 'title': 'Guide', 'url': 'https://example.com', 'engine_versions': '1.x', 'accessed': 'not-a-date'}]}) - with self.assertRaisesRegex(ValueError, 'Invalid plugin source date'): - manifests(self.plugins) - - def test_bad_manifest_rejected(self): - self.add('broken', {'id': 'broken', 'version':'1.0.0', 'domain':'code', 'standards':'not-a-list', 'detection':[]}) - with self.assertRaisesRegex(ValueError, 'Invalid plugin manifest'): - manifests(self.plugins) - - def test_nonexistent_extension_dir_rejected(self): - with self.assertRaisesRegex(ValueError, 'Plugin directory missing'): - manifests(self.root / 'missing') - - def test_project_not_mutated(self): - self.add() - prior = sorted(p.relative_to(self.root).as_posix() for p in self.root.rglob('*') if p.is_file()) - inspect(self.root, self.plugins) - after = sorted(p.relative_to(self.root).as_posix() for p in self.root.rglob('*') if p.is_file()) - self.assertEqual(prior, after) - - def test_escape_marker_rejected(self): - self.add('escape', {'id':'escape','version':'1.0.0','domain':'code','standards':['architecture'],'detection':[['../outside']]}) - with self.assertRaisesRegex(ValueError, 'Invalid plugin'): - manifests(self.plugins) - - def test_absolute_marker_rejected(self): - self.add('absolute', {'id':'absolute','version':'1.0.0','domain':'code','standards':['architecture'],'detection':[['/etc/passwd']]}) - with self.assertRaisesRegex(ValueError, 'Invalid plugin'): - manifests(self.plugins) - - def test_symlink_outside_project_not_detected(self): - outside = self.root.parent / ('frameforge-outside-' + self.root.name) - outside.write_text('x') - try: - (self.root/'custom.project').symlink_to(outside) - self.add() - self.assertNotIn('custom', [p['plugin_id'] for p in inspect(self.root, self.plugins)['suggested_plugins']]) - finally: - outside.unlink() From 23e98f7d793d02026a310259335e9d5798e93dcc Mon Sep 17 00:00:00 2001 From: bewaterhere-coder Date: Sun, 1 Nov 2026 19:46:03 +0800 Subject: [PATCH 2/3] test: isolate path rejection cases and remove nested duplicate --- tests/test_plugin_extension.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/test_plugin_extension.py b/tests/test_plugin_extension.py index b3c9988..f5f9519 100644 --- a/tests/test_plugin_extension.py +++ b/tests/test_plugin_extension.py @@ -62,8 +62,6 @@ def test_manifest_paths_reject_nul_character(self): with self.assertRaisesRegex(ValueError, 'Invalid plugin detection'): manifests(self.plugins) - def test_manifest_paths_reject_windows_drive_prefix(self): - def test_manifest_sources_validate_required_fields_and_date(self): self.add('bad-source', {'id': 'bad-source', 'version': '1.0.0', 'domain': 'code', 'standards': ['architecture'], 'detection': [['custom.project']], 'sources': [{'publisher': 'Example', 'title': 'Guide', 'url': 'https://example.com', 'engine_versions': '1.x', 'accessed': 'not-a-date'}]}) with self.assertRaisesRegex(ValueError, 'Invalid plugin source date'): @@ -135,6 +133,4 @@ def test_symlink_outside_project_not_detected(self): self.assertNotIn('custom', [p['plugin_id'] for p in inspect(self.root, self.plugins)['suggested_plugins']]) finally: outside.unlink() - self.add('drive-path', {'id': 'drive-path', 'version': '1.0.0', 'domain': 'code', 'standards': ['architecture'], 'detection': [['C:/outside/project']]}) - with self.assertRaisesRegex(ValueError, 'Invalid plugin detection'): - manifests(self.plugins) + self.add('drive-path', {'id': 'drive-path', 'version': ' From 2d83b7c176b01a0db211af5f313b74bf08929683 Mon Sep 17 00:00:00 2001 From: bewaterhere-coder Date: Sun, 1 Nov 2026 19:46:18 +0800 Subject: [PATCH 3/3] test: remove stray fragment after symlink regression --- tests/test_plugin_extension.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_plugin_extension.py b/tests/test_plugin_extension.py index f5f9519..e15b30f 100644 --- a/tests/test_plugin_extension.py +++ b/tests/test_plugin_extension.py @@ -133,4 +133,3 @@ def test_symlink_outside_project_not_detected(self): self.assertNotIn('custom', [p['plugin_id'] for p in inspect(self.root, self.plugins)['suggested_plugins']]) finally: outside.unlink() - self.add('drive-path', {'id': 'drive-path', 'version': '