fix(towercore): preserve context export

- Allow opcode 0x23 inventory requests used by EXPORT_CONTEXT.
- Continue rejecting duplicate subscriber selectors on opcode 0x21 reads.
This commit is contained in:
TakuyaYagam1 committed 2026-11-29 15:29:40 +03:00
1 parent caf9b2fc39
commit 3b1bdc9739
2 files changed
+4 -10

No files matched your search

+3 -5
View File
@@ -12,12 +12,10 @@ def frame(opcode: int, fields: list[tuple[int, bytes]]) -> bytes:
class GuardTests(unittest.TestCase):
def test_blocks_cross_subscriber_bulk_read(self) -> None:
guard = importlib.util.find_spec("guard")
self.assertIsNotNone(guard, "Towercore guard is not implemented")
def test_allows_single_subscriber_inventory(self) -> None:
module = importlib.import_module("guard")
request = frame(0x23, [(0x0B, b"victim01"), (0x0B, b"victim02")])
self.assertTrue(module.should_block(request))
request = frame(0x23, [(0x0B, b"victim01")])
self.assertFalse(module.should_block(request))
def test_blocks_duplicate_subscriber_override_on_read(self) -> None:
module = importlib.import_module("guard")