From a1975dd5f1bdf5e7fbec658cd17973ec650786b7 Mon Sep 17 00:00:00 2001 From: Dylan Roy <249851642+d6g8k5htny-coder@users.noreply.github.com> Date: Mon, 5 Oct 2026 21:02:14 -0700 Subject: [PATCH 1/2] fix: match navigation verdict families at lexical boundaries Dylan Roy delegated AI engineering. Actual author OpenAI / GPT-6 Astra Pro, navigation-verdict-boundary-20261006, pickup336/6009012168. Isolated follow-on to frozen336 source30d92498; no source document, workflow, mathematical or scientific-status edit. Preserve explicit inflections and uppercase scoped tags; reject embedded lookalikes such as UNVERIFIED supporting VERIFIED. Test-first31-method focused suite: predecessor98 assertion failures/no errors in each mode, successor31/31 passes in each. No semantic-entailment claim and no author self-merge. --- tests/test_navigation_quotes.py | 138 ++++++++++++++++++++++++++++++++ tools/check_doc_quotes.py | 19 ++++- 2 files changed, 153 insertions(+), 4 deletions(-) diff --git a/tests/test_navigation_quotes.py b/tests/test_navigation_quotes.py index 03f6fd8f4..f292319e7 100644 --- a/tests/test_navigation_quotes.py +++ b/tests/test_navigation_quotes.py @@ -122,5 +122,143 @@ def test_header_row_quotation_marks_are_ignored(self): self.assertEqual((report['quotes'], report['summaries']), (0, 1)) +class VerdictVocabulary(unittest.TestCase): + """Lexical family checks, not semantic entailment or scope verification.""" + + def setUp(self): + self.tmp = tempfile.TemporaryDirectory(prefix='verdict-vocabulary-') + self.addCleanup(self.tmp.cleanup) + self.root = pathlib.Path(self.tmp.name) + self.source = self.root / 'record.md' + self.doc = self.root / 'nav.md' + + def _report(self, body, summary): + self.source.write_text(body, encoding='utf-8') + self.doc.write_text(HEADER + '| #1 | [r](record.md) — summary: ' + + summary + ' |\n', encoding='utf-8') + return check_doc_quotes.check_document(str(self.doc), str(self.root)) + + def _rejected(self, body, word): + report = self._report(body, word) + self.assertEqual([f[0] for f in report['failures']], + ['verdict-word-not-in-source']) + self.assertTrue(report['failures'][0][2].startswith(word + ': ')) + self.assertEqual((report['checked'], report['summaries']), (1, 1)) + + def test_all_bare_verdicts_remain_valid(self): + for word in check_doc_quotes.VERDICT: + with self.subTest(word=word): + self.assertEqual(self._report(word, word)['failures'], []) + + def test_inflected_verdicts_share_the_explicit_family(self): + for root in ('ACCEPT', 'AMEND', 'REJECT'): + for body in (root, root + 'ED'): + for summary in (root, root + 'ED'): + with self.subTest(body=body, summary=summary): + self.assertEqual(self._report(body, summary)['failures'], []) + + def test_uppercase_scope_tags_remain_valid(self): + for word in check_doc_quotes.VERDICT: + for suffix in ('_SCOPED', '_ENGINEERING_SCOPED', '_R1', '_A_23'): + with self.subTest(word=word, suffix=suffix): + self.assertEqual(self._report(word + suffix, word)['failures'], []) + self.assertEqual(self._report(word, word + suffix)['failures'], []) + + def test_embedded_word_prefixes_cannot_supply_a_verdict(self): + for word in check_doc_quotes.VERDICT: + for prefix in ('UN', 'PRE', 'x'): + with self.subTest(word=word, prefix=prefix): + self._rejected(prefix + word, word) + + def test_embedded_word_suffixes_cannot_supply_a_verdict(self): + for word in check_doc_quotes.VERDICT: + for suffix in ('NESS', 'LIKE', 'x'): + with self.subTest(word=word, suffix=suffix): + self._rejected(word + suffix, word) + + def test_underscore_prefixes_cannot_supply_a_verdict(self): + for word in check_doc_quotes.VERDICT: + for prefix in ('NOT_', 'OTHER_', '_'): + with self.subTest(word=word, prefix=prefix): + self._rejected(prefix + word, word) + + def test_unicode_word_boundaries_are_preserved(self): + for word in check_doc_quotes.VERDICT: + for body in ('α' + word, word + 'β', '9' + word): + with self.subTest(body=body): + self._rejected(body, word) + + def test_malformed_scope_tags_cannot_supply_a_verdict(self): + for word in check_doc_quotes.VERDICT: + for suffix in ('_', '__SCOPED', '_scoped'): + with self.subTest(word=word, suffix=suffix): + self._rejected(word + suffix, word) + + def test_nonverdict_summary_words_do_not_invent_status_claims(self): + for word in check_doc_quotes.VERDICT: + for summary in ('UN' + word, word + 'NESS', 'NOT_' + word): + with self.subTest(summary=summary): + self.assertEqual(self._report('No status supplied.', summary)['failures'], []) + + def test_different_verdict_families_still_reject(self): + for body in check_doc_quotes.VERDICT: + for summary in check_doc_quotes.VERDICT: + if body != summary: + with self.subTest(body=body, summary=summary): + self._rejected(body, summary) + + def test_each_claimed_family_is_checked(self): + report = self._report('ACCEPT_SCOPED', 'ACCEPT; HOLD; VERIFIED') + self.assertEqual([f[2].split(':', 1)[0] for f in report['failures']], + ['HOLD', 'VERIFIED']) + + def test_markdown_and_punctuation_do_not_hide_real_tokens(self): + for word in check_doc_quotes.VERDICT: + for wrapped in ('**' + word + '**', '`' + word + '`', '(' + word + ')'): + with self.subTest(wrapped=wrapped): + self.assertEqual(self._report(wrapped, wrapped)['failures'], []) + + def test_quotation_matching_is_unchanged(self): + self.source.write_text('Recorded word UNVERIFIED.', encoding='utf-8') + self.doc.write_text(HEADER + '| #1 | [r](record.md) — “UNVERIFIED.” |\n', + encoding='utf-8') + report = check_doc_quotes.check_document(str(self.doc), str(self.root)) + self.assertEqual(report['failures'], []) + self.assertEqual((report['quotes'], report['summaries']), (1, 0)) + + def test_offline_links_remain_explicitly_unchecked(self): + self.doc.write_text(HEADER + '| #1 | [r](https://github.com/o/r/pull/1' + '#issuecomment-2) — summary: VERIFIED |\n', encoding='utf-8') + report = check_doc_quotes.check_document(str(self.doc), str(self.root)) + self.assertEqual((report['checked'], report['unchecked_offline']), (0, 1)) + self.assertEqual(report['failures'], []) + + def test_fetched_source_uses_the_same_lexical_boundary(self): + # Synthetic source transport only; not an actual remote verification. + from unittest.mock import patch + self.doc.write_text(HEADER + '| #1 | [r](https://github.com/o/r/pull/1' + '#issuecomment-2) — summary: VERIFIED |\n', encoding='utf-8') + with patch.object(check_doc_quotes.Sources, '_fetch', return_value=('UNVERIFIED', 'ok')): + report = check_doc_quotes.check_document(str(self.doc), str(self.root), github=True) + self.assertEqual(report['unchecked_offline'], 0) + self.assertEqual([f[0] for f in report['failures']], ['verdict-word-not-in-source']) + + def test_cli_fails_for_a_lookalike_source(self): + import contextlib + import io + import json + self._report('UNVERIFIED', 'VERIFIED') + output = io.StringIO() + with contextlib.redirect_stdout(output): + rc = check_doc_quotes.main([str(self.doc), '--root', str(self.root)]) + self.assertEqual(rc, 1) + self.assertFalse(json.loads(output.getvalue())['passed']) + + def test_negation_and_scope_entailment_are_not_claimed(self): + # This comparator checks vocabulary presence only, not what it means. + self.assertEqual(self._report('not VERIFIED', 'VERIFIED')['failures'], []) + self.assertEqual(self._report('AMEND_ENGINEERING_SCOPED', 'AMEND')['failures'], []) + + if __name__ == '__main__': unittest.main() diff --git a/tools/check_doc_quotes.py b/tools/check_doc_quotes.py index 635505b48..a3f6f0e97 100644 --- a/tools/check_doc_quotes.py +++ b/tools/check_doc_quotes.py @@ -13,8 +13,11 @@ * a GitHub pull-request review / comment link is checked against the live body only with ``--github`` (token read from ``GITHUB_TOKEN``); without it the passage is reported as ``unchecked_offline`` and does not fail the check; -* a ``summary:`` passage must not use a verdict word (ACCEPT, AMEND, HOLD, CONFIRMED, - VERIFIED, REJECT) that the linked record does not use, under the same offline rule; +* a ``summary:`` passage must not use a verdict family (ACCEPT/ACCEPTED, + AMEND/AMENDED, HOLD, CONFIRMED, VERIFIED, REJECT/REJECTED) absent from the linked + record, under the same offline rule. Complete tokens may have underscore-delimited + uppercase alphanumeric scope tags; embedded lookalikes such as UNVERIFIED do not + supply VERIFIED. This is lexical presence, not negation or scope entailment; * a passage with no preceding link in its segment fails (``no-source-link``). Header and separator rows are skipped. Exit status 0 only when no checked passage fails; @@ -36,6 +39,14 @@ QUOTE = re.compile(r'“([^”]*)”') SUMMARY = re.compile(r'(? Date: Mon, 5 Oct 2026 21:12:31 -0700 Subject: [PATCH 2/2] fix: retain compact verdict record references without substring matches Dylan Roy delegated AI engineering. OpenAI / GPT-6 Astra Pro, navigation-verdict-boundary-20261006. Actual online run37411867548 caught two historical AMEND534... references omitted by the initial grammar; both native review bodies authenticated before correction. Allow optional ASCII decimal record suffix with final word boundary, not arbitrary word suffixes. Four added methods first yielded41 assertions/no errors per mode at a1975dd5, then35/35 focused methods pass normally and optimized. Preserve original false-alarm run, all documents and mathematical/status/workflow sources. Scientific effect NONE; no self-merge. --- tests/test_navigation_quotes.py | 32 ++++++++++++++++++++++++++++++++ tools/check_doc_quotes.py | 7 ++++--- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/tests/test_navigation_quotes.py b/tests/test_navigation_quotes.py index f292319e7..899c3cb53 100644 --- a/tests/test_navigation_quotes.py +++ b/tests/test_navigation_quotes.py @@ -254,6 +254,38 @@ def test_cli_fails_for_a_lookalike_source(self): self.assertEqual(rc, 1) self.assertFalse(json.loads(output.getvalue())['passed']) + def test_compact_decimal_record_references_remain_valid(self): + for word in check_doc_quotes.VERDICT: + for number in ('1', '5344158101', '5344767944'): + for suffix in ('', '_SCOPED'): + with self.subTest(word=word, number=number, suffix=suffix): + compact = word + number + suffix + self.assertEqual(self._report(compact, word)['failures'], []) + self.assertEqual(self._report(word, compact)['failures'], []) + + def test_actual_compact_amend_review_openings(self): + for body, summary in ( + ('Catalog AMEND5344158101 is addressed at exact head9baa6609.', + 'Catalog AMEND 5344158101 is addressed at exact head 9baa6609'), + ('AMEND5344767944 addressed at exact head077e3d5.', + 'AMEND 5344767944 addressed at exact head 077e3d5'), + ): + with self.subTest(body=body): + self.assertEqual(self._report(body, summary)['failures'], []) + + def test_compact_reference_inflections_share_the_family(self): + for word in ('ACCEPT', 'AMEND', 'REJECT'): + with self.subTest(word=word): + self.assertEqual(self._report(word + 'ED123', word)['failures'], []) + self.assertEqual(self._report(word, word + 'ED123')['failures'], []) + + def test_reference_suffix_does_not_allow_word_lookalikes(self): + for word in check_doc_quotes.VERDICT: + for body in ('UN' + word + '123', 'NOT_' + word + '123', + word + '123abc', word + '123β', word + '123'): + with self.subTest(body=body): + self._rejected(body, word) + def test_negation_and_scope_entailment_are_not_claimed(self): # This comparator checks vocabulary presence only, not what it means. self.assertEqual(self._report('not VERIFIED', 'VERIFIED')['failures'], []) diff --git a/tools/check_doc_quotes.py b/tools/check_doc_quotes.py index a3f6f0e97..d0f36bc2e 100644 --- a/tools/check_doc_quotes.py +++ b/tools/check_doc_quotes.py @@ -15,8 +15,9 @@ ``unchecked_offline`` and does not fail the check; * a ``summary:`` passage must not use a verdict family (ACCEPT/ACCEPTED, AMEND/AMENDED, HOLD, CONFIRMED, VERIFIED, REJECT/REJECTED) absent from the linked - record, under the same offline rule. Complete tokens may have underscore-delimited - uppercase alphanumeric scope tags; embedded lookalikes such as UNVERIFIED do not + record, under the same offline rule. Complete tokens may carry a decimal record + reference (AMEND123) and uppercase alphanumeric underscore-delimited scope tags; + embedded lookalikes such as UNVERIFIED do not supply VERIFIED. This is lexical presence, not negation or scope entailment; * a passage with no preceding link in its segment fails (``no-source-link``). @@ -44,7 +45,7 @@ VERDICT_PATTERNS = { word: re.compile(r'(?