From df8b11c03149d3995a0addd8b2fb8a03c2b32f62 Mon Sep 17 00:00:00 2001 From: Dylan Roy <249851642+d6g8k5htny-coder@users.noreply.github.com> Date: Tue, 6 Oct 2026 05:29:30 -0700 Subject: [PATCH] Reject unsupported plus repetition in the restricted legacy trigger parser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dylan Roy — delegated AI engineering; OpenAI / GPT-6 Astra Pro, qs-r13-legacy-parser-boundary-20261006, pickup361/6016146848. One-character parser amendment plus two new regression methods only. Original five methods and all workflow/numerical/source bytes preserved. Full seven-method predecessor regression fails four intended cases per mode; final seven methods pass normal and optimized. Optional successor, no parent hold. Scientific effect NONE. Separate review and actual hosted evidence still required. --- tests/test_legacy_workflow_triggers.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/tests/test_legacy_workflow_triggers.py b/tests/test_legacy_workflow_triggers.py index 296bd0893..0f61389a9 100644 --- a/tests/test_legacy_workflow_triggers.py +++ b/tests/test_legacy_workflow_triggers.py @@ -46,7 +46,7 @@ def trigger_paths(text): raise ValueError('unsupported path-list syntax') pattern = match[1] plain = pattern[:-3] if pattern.endswith('/**') else pattern - if any(c in plain for c in '*?[]{}!'): + if any(c in plain for c in '*?[]{}!+'): raise ValueError('unsupported path pattern') found.append(pattern) if not found or len(found) != len(set(found)): @@ -134,5 +134,29 @@ def test_limited_path_reader_rejects_unsupported_syntax(self): trigger_paths(template % rows) + def test_plus_repetition_operator_is_not_treated_as_literal(self): + template = "'on':\n pull_request:\n paths:\n - '%s'\n workflow_dispatch:\n" + for pattern in ('tools+.py', 'tools+/helper.py', + 'tools/legacy+/__init__.py', 'tools+/**'): + with self.subTest(pattern=pattern), self.assertRaises(ValueError): + trigger_paths(template % pattern) + + def test_supported_literal_and_subtree_patterns_keep_their_meaning(self): + patterns = ['tools.py', 'tools/**', '.github/workflows/local-pairing.yml', + 'checks/a-b_2.3.py'] + text = "'on':\n pull_request:\n paths:\n" + text += ''.join(" - '%s'\n" % pattern for pattern in patterns) + text += ' workflow_dispatch:\n' + self.assertEqual(trigger_paths(text), patterns) + for path in ('tools.py', 'tools/__init__.py', 'tools/nested/file.py', + '.github/workflows/local-pairing.yml', 'checks/a-b_2.3.py'): + with self.subTest(included=path): + self.assertTrue(covered(patterns, path)) + for path in ('tools_extra/file.py', 'other/tools.py', + 'other/tools/file.py', 'checks/a-b_2x3.py'): + with self.subTest(excluded=path): + self.assertFalse(covered(patterns, path)) + + if __name__ == '__main__': unittest.main()