tests: audit task argument identities and source error boundaries

This commit is contained in:
dev committed 2026-10-08 20:57:51 +03:00
1 parent fd92604f36
commit 2742867ef7
18 files changed
+344 -20

No files matched your search

+52
View File
@@ -46,6 +46,58 @@ class CoverageFailures(unittest.TestCase):
def test_valid_pair_survives_changed_file_and_ssa_identity(self):
self.verify_fake(self.fake_pair())
def test_share_pair_survives_worker_and_argument_renaming(self):
row = self.fake_pair(source_path='source/layer7/reject/not_share.aji',
air_path='phase3/reject/tasks_not_share.air')
p = self.corpus / 's.aji'
text = p.read_text().replace('look', 'inspect_region')
p.write_text(re.sub(r'\br\b', 'arena_owner', text))
self.verify_fake(row)
def test_same_share_code_does_not_hide_a_different_parameter_type(self):
row = self.fake_pair(source_path='source/layer9/reject/lend_island.aji',
air_path='phase3/reject/tasks_not_share.air')
with self.assertRaisesRegex(ValueError, 'different offending operation/rule facts'):
self.verify_fake(row)
def test_same_send_code_does_not_hide_a_different_task_handle_type(self):
row = self.fake_pair(source_path='source/reject_twins/task_handle_not_send.aji',
air_path='phase3/reject/tasks_not_send.air')
p = self.corpus / 's.aji'
p.write_text(p.read_text().replace('u8', 'u64'))
with self.assertRaisesRegex(ValueError, 'different offending operation/rule facts'):
self.verify_fake(row)
def test_changed_argument_identity_cannot_survive_source_mapping(self):
row = self.fake_pair(source_path='source/layer7/reject/not_share.aji',
air_path='phase3/reject/tasks_not_share.air')
real_command = twins.command
def changed(aji, *args, status):
result = real_command(aji, *args, status=status)
if args[0] == 'check' and Path(args[1]) == self.corpus / 's.aji':
ds = [json.loads(line) for line in result.splitlines()]
ds[0]['argument'] = '%wrong'
return '\n'.join(json.dumps(d) for d in ds) + '\n'
return result
with patch.object(twins, 'command', changed):
with self.assertRaisesRegex(ValueError, 'mapping changed diagnostic identities'):
self.verify_fake(row)
def test_changed_related_value_cannot_survive_source_mapping(self):
row = self.fake_pair(source_path='source/layer34/reject/borrow_conflict.aji',
air_path='phase1/reject/mut_and_shared.air')
real_command = twins.command
def changed(aji, *args, status):
result = real_command(aji, *args, status=status)
if args[0] == 'check' and Path(args[1]) == self.corpus / 's.aji':
ds = [json.loads(line) for line in result.splitlines()]
ds[0]['related_locations'][0]['value'] = '%wrong'
return '\n'.join(json.dumps(d) for d in ds) + '\n'
return result
with patch.object(twins, 'command', changed):
with self.assertRaisesRegex(ValueError, 'mapping changed related identity'):
self.verify_fake(row)
def test_graph_borrow_pair_survives_renamed_bindings(self):
row = self.fake_pair(source_path='source/layer9/reject/two_mut_access.aji',
air_path='phase4/reject/island_two_mut.air')