feat: integrate native diagnostics and coordinated CBB transactions

This commit is contained in:
阿白叔 committed 2026-11-05 23:18:00 +08:00
1 parent 9e230e1a46
commit da67de026f
91 files changed
+14370 -435

No files matched your search

+39
View File
@@ -290,6 +290,45 @@ def test_refresh_integration_skips_native_disabled_green_action():
assert pi.actions == []
@pytest.mark.parametrize('ces_allowed', [True, False])
def test_partial_sync_respects_protected_green_native_actions(ces_allowed):
class RestoredVerifiedBlock(GreenProjectIntegration):
IsForwardAnnotationAllowed = False
BackAnnotationStatus = 1
def ForwardAnnotate(self):
raise RuntimeError('Forward Annotation is not allowed on verified Reusable Blocks')
def BackAnnotate(self):
super().BackAnnotate()
self.BackAnnotationStatus = 2
return True
pi = RestoredVerifiedBlock()
pi.IsSynchCESAllowed = pi.IsLoadCESAllowed = ces_allowed
events = []
result = refresh_integration(pi, settle_seconds=0, emit=lambda **e: events.append(e))
assert set(result.values()) == {2}
assert pi.actions == (['SynchCES', 'LoadCES', 'BackAnnotate'] if ces_allowed else ['BackAnnotate'])
assert [e['action'] for e in events if e['stage'] == 'integration_action'] == pi.actions
def test_skipped_green_action_cannot_hide_a_later_required_native_gate():
class ChangedAfterCES(GreenProjectIntegration):
IsForwardAnnotationAllowed = False
BackAnnotationStatus = 1
def SynchCES(self):
super().SynchCES()
self.ForwardAnnotationStatus = 1
return True
pi = ChangedAfterCES()
with pytest.raises(IntegrationError, match='ForwardAnnotation: required but not allowed'):
refresh_integration(pi, settle_seconds=0)
assert pi.actions == ['SynchCES']
def test_refresh_integration_never_counts_rejected_green_action_as_completed():
class VerifiedProjectIntegration(GreenProjectIntegration):
def _blocked(self, action):