**refactor(dynamic): add HTTP emulators for Pubsub, Rabbit, and NATS with publish/deliver/ack logic, extend event recording, endpoint rewriting, and SDK compatibility across Java, Go, Python, and Rust**

This commit is contained in:
elipeter 2026-05-27 11:29:07 -05:00
parent 57d3677bd4
commit a55849f1ca
7 changed files with 729 additions and 65 deletions

View file

@ -322,6 +322,11 @@ fn message_handler_remaining_brokers_emit_delivery_and_ack_events() {
h.source.contains(log_env),
"{adapter} harness must write the broker log env var",
);
let endpoint_env = log_env.replace("_LOG", "_ENDPOINT");
assert!(
h.source.contains(&endpoint_env),
"{adapter} harness must try the host-side broker endpoint {endpoint_env}",
);
assert!(
h.source.contains("\"deliver\"") || h.source.contains("'deliver'"),
"{adapter} harness must record delivery events: {}",
@ -335,6 +340,61 @@ fn message_handler_remaining_brokers_emit_delivery_and_ack_events() {
}
}
#[test]
fn message_handler_remaining_brokers_try_http_emulators_before_loopback() {
let cases = [
(
Lang::Python,
"pubsub_python",
"projects/p/subscriptions/s",
"callback",
"pubsub-python",
"_nyx_try_pubsub_http",
),
(
Lang::Python,
"rabbit_python",
"work",
"on_message",
"rabbit-python",
"_nyx_try_rabbit_http",
),
(
Lang::Java,
"rabbit_java",
"work",
"onMessage",
"rabbit-java",
"nyxTryRabbitHttp",
),
(
Lang::Go,
"pubsub_go",
"my-sub",
"OnMessage",
"pubsub-go",
"nyxFetchHttpBroker",
),
(
Lang::Go,
"nats_go",
"events",
"OnMessage",
"nats-go",
"nyxFetchHttpBroker",
),
];
for (lang, fixture, queue, handler, adapter, helper) in cases {
let spec = make_spec_with_adapter(lang, queue, handler, entry_file(fixture), adapter);
let h = lang::emit(&spec).expect("emit ok");
assert!(
h.source.contains(helper),
"{adapter} harness should call {helper}: {}",
h.source
);
}
}
// ── Framework-adapter assertions ──────────────────────────────────────────────
fn ts_language_for(lang: Lang) -> tree_sitter::Language {