Thread context through link policy and symbolic enum expansion

Use machine event type and CodebaseContext for trusted valueOf widen checks and resolveLinkResolution, and apply context-aware enum type matching when expanding symbolic polymorphic placeholders.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-14 06:17:30 +02:00
parent 5bc65be30d
commit 57686c575e
4 changed files with 63 additions and 8 deletions

View File

@@ -74,6 +74,23 @@ class CallChainLinkPolicyTest {
trigger, "com.example.OrderEvent")).isFalse();
}
@Test
void shouldResolveLinkWhenTrustedWidenPassesUsingMachineEventType() {
TriggerPoint trigger = TriggerPoint.builder()
.ambiguous(false)
.event("OrderEvent.valueOf(eventStr)")
.polymorphicEvents(List.of("com.example.OrderEvent.PAY", "com.example.OrderEvent.SHIP"))
.build();
assertThat(CallChainLinkPolicy.resolveLinkResolution(
trigger,
List.of(),
false,
"com.example.OrderEvent")).isEqualTo(LinkResolution.NO_MATCH);
assertThat(CallChainLinkPolicy.shouldFailClosedOnAmbiguousCallGraphWiden(
trigger, "com.example.OrderEvent")).isFalse();
}
@Test
void shouldNotTrustImportStylePolymorphicWidenWithoutPackage() {
TriggerPoint trigger = TriggerPoint.builder()