From 2964764c338fad9b4e47655fe90517a81e1bc100 Mon Sep 17 00:00:00 2001 From: Dylan Roy <249851642+d6g8k5htny-coder@users.noreply.github.com> Date: Tue, 13 Oct 2026 15:18:28 -0700 Subject: [PATCH 1/3] Keep generated source metadata out of proposal-number checks --- tests/test_reader_links.py | 114 ++++++++++++++++++++++++++++++++++++- 1 file changed, 112 insertions(+), 2 deletions(-) diff --git a/tests/test_reader_links.py b/tests/test_reader_links.py index c03181d07..f1db3d495 100644 --- a/tests/test_reader_links.py +++ b/tests/test_reader_links.py @@ -1734,11 +1734,24 @@ def test_forbidden_words_proposals_and_independence_qualifiers(self): self.assertNotIn('universality',prose.lower());self.assertNotIn('universality',rows.lower()) # the proposals are named only in the cut's scope paragraph: not in its status-words rows, the hero or the entry rows above it above=self.page().split('
',1)[1].split(f'
' + self.assertEqual(above.count(start),above.count(end)) + self.assertLessEqual(above.count(start),1) + if start in above: + self.assertLess(above.index(start),above.index(end)) + before,generated=above.split(start,1) + _,after=generated.split(end,1) + above=before+after + # Source pins and digests can contain these digits; proposal numbers are separate tokens. + proposal_number=re.compile(r'\b(?:330|331)\b') + above_numbers=proposal_number.findall(above) for number in ('330','331'): - with self.subTest(above=number):self.assertNotIn(number,above) + with self.subTest(above=number):self.assertNotIn(number,above_numbers) # on the reader's text, each proposal number occurs once, in one fixed sentence that says it was open and is not presented as landed plain=re.sub(r'<[^>]+>','',re.sub(r'.*?','',section)) - self.assertEqual((plain.count('330'),plain.count('331')),(1,1)) + plain_numbers=proposal_number.findall(plain) + self.assertEqual((plain_numbers.count('330'),plain_numbers.count('331')),(1,1)) self.assertIn('“Full landmark goal ACTIVE.” Main #330 and the draft #331, proposals in this line whose titles concern spectral Gaussian laws ' 'and other homology degrees, were open at this cut; this page does not present them as landed. A merge, a passing check',plain) # independence is never credited to a reader, review or provider, and every reader named is an OpenAI/Codex agent @@ -1880,4 +1893,101 @@ def test_browser_flows_cover_the_new_cut(self): '"10 October cut entry overflow"','"10 October detail must start collapsed"','"10 October detail did not close"'): with self.subTest(token=token):self.assertIn(token,harness) +class ProposalNumberGuardRegression(unittest.TestCase): + """Exercise the complete reading guard, including its rejection controls.""" + FAILED_MATH_SHA = 'a6116d8a2173c7b450791bd89331d1565922bd55' + PRIOR_MATH_SHA = '9844f785910d097b7b4591dcbd9e377bd7b38280' + # Synthetic hex fixtures expose both predicates without changing source pins. + SHA_WITH_330 = 'e' * 16 + '330' + 'a' * 21 + DIGEST_WITH_BOTH = 'd' * 17 + '331' + 'e' * 20 + '330' + 'f' * 21 + + @staticmethod + def baseline(): + return UniversalitySourcesReading('test_forbidden_words_proposals_and_independence_qualifiers').page() + + def guard_result(self, page): + case = UniversalitySourcesReading('test_forbidden_words_proposals_and_independence_qualifiers') + result = unittest.TestResult() + with patch.object(case, 'page', return_value=page): + case.run(result) + self.assertEqual(result.testsRun, 1) + self.assertEqual(result.errors, []) + self.assertEqual(result.skipped, []) + return result + + @staticmethod + def above_cut(page, fragment): + return page.replace('
', '
' + fragment, 1) + + @staticmethod + def in_cut(page, fragment): + marker = f'
', page.index(marker)) + 1 + return page[:start] + fragment + page[start:] + + def test_source_commit_links_and_display_do_not_name_proposals(self): + for name, commit in (('actual failed Math pin', self.FAILED_MATH_SHA), + ('synthetic 330 pin', self.SHA_WITH_330), + ('prior published Math pin', self.PRIOR_MATH_SHA)): + with self.subTest(pin=name): + fragment = (f'

Math {commit} ' + f'Proof index

') + result = self.guard_result(self.above_cut(self.baseline(), fragment)) + self.assertTrue(result.wasSuccessful(), f'{name} rejected by the reading guard') + + def test_digest_attribute_does_not_name_proposals(self): + fragment = f'

Current source

' + result = self.guard_result(self.above_cut(self.baseline(), fragment)) + self.assertTrue(result.wasSuccessful(), 'a hex digest was read as a proposal number') + + def test_generated_metadata_numbers_do_not_name_proposals(self): + fragment = (f'

History capacity: 331 of 512 mathematical archives; ' + 'payload: 1033100 bytes

') + page = self.baseline().replace('', fragment + '', 1) + result = self.guard_result(page) + self.assertTrue(result.wasSuccessful(), 'generated capacity metadata was read as a proposal') + + def test_hex_pins_in_reader_text_do_not_add_proposal_mentions(self): + # Fixture text exercises this count; the separate immutable-cut check is unchanged. + for commit in (self.FAILED_MATH_SHA, self.SHA_WITH_330, self.PRIOR_MATH_SHA): + with self.subTest(pin=commit): + result = self.guard_result(self.in_cut(self.baseline(), f'

Source identifier {commit}

')) + self.assertTrue(result.wasSuccessful(), 'a source pin was counted as an extra proposal') + + def test_bare_and_prefixed_proposals_above_cut_still_fail(self): + for proposal in ('330', '331', '#330', '#331'): + with self.subTest(proposal=proposal): + result = self.guard_result(self.above_cut(self.baseline(), f'

{proposal}

')) + self.assertFalse(result.wasSuccessful(), 'a proposal escaped the placement guard') + for fragment in ('#331', + 'Proposal'): + with self.subTest(link=fragment): + self.assertFalse(self.guard_result(self.above_cut(self.baseline(), fragment)).wasSuccessful(), + 'a proposal link escaped the placement guard') + page = self.baseline().replace('', '

331

', 1) + self.assertFalse(self.guard_result(page).wasSuccessful(), 'static text after the block escaped the placement guard') + + def test_malformed_generated_block_boundaries_still_fail(self): + page = self.baseline() + start, end = '', '' + variants = (page.replace(start, '', 1), page.replace(end, '', 1), + page.replace(start, start + start, 1), page.replace(start, start + end + start, 1), + page.replace(start, 'REVERSED-MARKER', 1).replace(end, start, 1).replace('REVERSED-MARKER', end, 1)) + for index, variant in enumerate(variants): + with self.subTest(boundary=index): + self.assertFalse(self.guard_result(variant).wasSuccessful(), 'malformed markers hid static text') + + def test_extra_proposal_in_cut_text_still_fails(self): + for proposal in ('330', '331'): + with self.subTest(proposal=proposal): + result = self.guard_result(self.in_cut(self.baseline(), f'

{proposal}

')) + self.assertFalse(result.wasSuccessful(), 'an extra proposal escaped the count guard') + + def test_forbidden_claims_and_independence_content_still_fail(self): + for content in ('proved theorem', 'validated', 'universality established', '#331 landed', 'independent review', 'another AI provider'): + with self.subTest(content=content): + result = self.guard_result(self.in_cut(self.baseline(), f'

{content}

')) + self.assertFalse(result.wasSuccessful(), 'prohibited content escaped the reading guard') + + if __name__=='__main__': unittest.main() From 169ed83ed3456cddd5e7fb77b1dffa68e1d1a187 Mon Sep 17 00:00:00 2001 From: Dylan Roy <249851642+d6g8k5htny-coder@users.noreply.github.com> Date: Tue, 13 Oct 2026 15:42:37 -0700 Subject: [PATCH 2/3] Keep generated prose and links under the proposal guard --- tests/test_reader_links.py | 47 +++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/tests/test_reader_links.py b/tests/test_reader_links.py index f1db3d495..949a601be 100644 --- a/tests/test_reader_links.py +++ b/tests/test_reader_links.py @@ -1734,15 +1734,21 @@ def test_forbidden_words_proposals_and_independence_qualifiers(self): self.assertNotIn('universality',prose.lower());self.assertNotIn('universality',rows.lower()) # the proposals are named only in the cut's scope paragraph: not in its status-words rows, the hero or the entry rows above it above=self.page().split('
',1)[1].split(f'
' self.assertEqual(above.count(start),above.count(end)) self.assertLessEqual(above.count(start),1) if start in above: self.assertLess(above.index(start),above.index(end)) before,generated=above.split(start,1) - _,after=generated.split(end,1) - above=before+after + generated,after=generated.split(end,1) + generated=re.sub( + r'(
)', + r'\1BYTES\2',generated) + generated=re.sub( + r'(

History capacity: )\d+( of )\d+( mathematical archives; )\d+( of )\d+( conservative retained bytes)', + r'\1ARCHIVES\2ARCHIVE_LIMIT\3BYTES\4BYTE_LIMIT\5',generated) + above=before+generated+after # Source pins and digests can contain these digits; proposal numbers are separate tokens. proposal_number=re.compile(r'\b(?:330|331)\b') above_numbers=proposal_number.findall(above) @@ -1941,11 +1947,36 @@ def test_digest_attribute_does_not_name_proposals(self): self.assertTrue(result.wasSuccessful(), 'a hex digest was read as a proposal number') def test_generated_metadata_numbers_do_not_name_proposals(self): - fragment = (f'

History capacity: 331 of 512 mathematical archives; ' - 'payload: 1033100 bytes

') - page = self.baseline().replace('', fragment + '', 1) - result = self.guard_result(page) - self.assertTrue(result.wasSuccessful(), 'generated capacity metadata was read as a proposal') + for archives in (330, 331): + with self.subTest(archives=archives): + fragment = (f'
' + f'

History capacity: {archives} of 512 mathematical archives; ' + '1033100 of 805306368 conservative retained bytes. No history is pruned.

') + page = self.baseline().replace('', fragment + '', 1) + self.assertTrue(self.guard_result(page).wasSuccessful(), 'numeric metadata was read as a proposal') + + def test_generated_prose_and_proposal_links_still_fail(self): + for fragment in ('

proposal 331

', '

Main #330

', '

331

', + '#331 landed', + 'Proposal'): + with self.subTest(generated=fragment): + page = self.baseline().replace('', fragment + '', 1) + self.assertFalse(self.guard_result(page).wasSuccessful(), 'generated proposal content escaped the guard') + + def test_capacity_prose_and_links_after_numeric_fields_still_fail(self): + for fragment in ('proposal 331', '#331 landed'): + with self.subTest(capacity=fragment): + capacity = ('

History capacity: 331 of 512 mathematical archives; ' + f'1033100 of 805306368 conservative retained bytes. {fragment}

') + page = self.baseline().replace('', capacity + '', 1) + self.assertFalse(self.guard_result(page).wasSuccessful(), 'capacity text after metadata escaped the guard') + + def test_metadata_looking_generated_prose_still_fails(self): + for fragment in ('

data-current-bytes="331"

', + '

History capacity: 331 of 512 mathematical archives; 1033100 of 805306368 conservative retained bytes

'): + with self.subTest(prose=fragment): + page = self.baseline().replace('', fragment + '', 1) + self.assertFalse(self.guard_result(page).wasSuccessful(), 'metadata-looking prose escaped the guard') def test_hex_pins_in_reader_text_do_not_add_proposal_mentions(self): # Fixture text exercises this count; the separate immutable-cut check is unchanged. From 4899929583e34a3012b4f9a98938adcdab20c0ce Mon Sep 17 00:00:00 2001 From: Dylan Roy <249851642+d6g8k5htny-coder@users.noreply.github.com> Date: Tue, 13 Oct 2026 16:08:57 -0700 Subject: [PATCH 3/3] Check compact proposal references and complete-page markers --- tests/test_reader_links.py | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/tests/test_reader_links.py b/tests/test_reader_links.py index 949a601be..9e82de518 100644 --- a/tests/test_reader_links.py +++ b/tests/test_reader_links.py @@ -1733,9 +1733,13 @@ def test_forbidden_words_proposals_and_independence_qualifiers(self): prose=re.sub(r'href="[^"]*"','',re.sub(r'.*?','',section)) self.assertNotIn('universality',prose.lower());self.assertNotIn('universality',rows.lower()) # the proposals are named only in the cut's scope paragraph: not in its status-words rows, the hero or the entry rows above it - above=self.page().split('
',1)[1].split(f'
',1)[1].split(f'
' + self.assertEqual(page.count(start),1) + self.assertEqual(page.count(end),1) + self.assertLess(page.index(start),page.index(end)) self.assertEqual(above.count(start),above.count(end)) self.assertLessEqual(above.count(start),1) if start in above: @@ -1750,7 +1754,7 @@ def test_forbidden_words_proposals_and_independence_qualifiers(self): r'\1ARCHIVES\2ARCHIVE_LIMIT\3BYTES\4BYTE_LIMIT\5',generated) above=before+generated+after # Source pins and digests can contain these digits; proposal numbers are separate tokens. - proposal_number=re.compile(r'\b(?:330|331)\b') + proposal_number=re.compile(r'(?:\b|(?:PR|proposal)[ \t]*#?)(330|331)\b',re.I) above_numbers=proposal_number.findall(above) for number in ('330','331'): with self.subTest(above=number):self.assertNotIn(number,above_numbers) @@ -1978,6 +1982,28 @@ def test_metadata_looking_generated_prose_still_fails(self): page = self.baseline().replace('', fragment + '', 1) self.assertFalse(self.guard_result(page).wasSuccessful(), 'metadata-looking prose escaped the guard') + def test_compact_proposal_references_in_static_generated_and_cut_text_still_fail(self): + for proposal in ('PR331 landed', 'proposal331', 'pr330', 'MainPR331', 'proposal330'): + for region in ('static', 'generated', 'cut'): + with self.subTest(proposal=proposal, region=region): + fragment = f'

{proposal}

' + page = self.baseline() + if region == 'static': + page = self.above_cut(page, fragment) + elif region == 'generated': + page = page.replace('', fragment + '', 1) + else: + page = self.in_cut(page, fragment) + self.assertFalse(self.guard_result(page).wasSuccessful(), 'compact proposal notation escaped the guard') + + def test_zero_or_extra_marker_pairs_on_complete_page_still_fail(self): + page = self.baseline() + start, end = '', '' + for variant in (page.replace(start, '').replace(end, ''), page + start + end, + page + start, page + end): + with self.subTest(markers=variant[-120:]): + self.assertFalse(self.guard_result(variant).wasSuccessful(), 'full-page marker invariant escaped the guard') + def test_hex_pins_in_reader_text_do_not_add_proposal_mentions(self): # Fixture text exercises this count; the separate immutable-cut check is unchanged. for commit in (self.FAILED_MATH_SHA, self.SHA_WITH_330, self.PRIOR_MATH_SHA):