Skip to main content

ryo_executor/executor/registry/converters/
plugin.rs

1//! PluginConverter: Converts PluginTransform MutationSpec to WASM plugin execution
2//!
3//! This is a skeleton implementation for future WASM plugin support.
4//! The actual WASM runtime integration will be implemented when the
5//! plugin infrastructure is ready.
6//!
7//! See docs/wasm-plugin-architecture.md for the full design.
8
9use crate::engine::ASTRegApply;
10use crate::executor::registry::converter::{ConvertError, MutationConverter};
11use crate::executor::registry::converters::ResolveTargetSymbol;
12use crate::executor::spec::MutationSpec;
13use ryo_analysis::AnalysisContext;
14
15/// Converter for PluginTransform MutationSpec
16///
17/// This converter handles WASM plugin-based transformations.
18/// Currently returns a "not implemented" error as the WASM runtime
19/// is not yet integrated.
20pub struct PluginConverter;
21
22impl PluginConverter {
23    pub fn new() -> Self {
24        Self {}
25    }
26}
27
28// PluginConverter uses the default implementation of ResolveTargetSymbol
29impl ResolveTargetSymbol for PluginConverter {}
30
31impl Default for PluginConverter {
32    fn default() -> Self {
33        Self::new()
34    }
35}
36
37impl MutationConverter for PluginConverter {
38    fn spec_kinds(&self) -> &'static [&'static str] {
39        &["PluginTransform"]
40    }
41
42    fn convert_v2(
43        &self,
44        _spec: &MutationSpec,
45        _ctx: &AnalysisContext,
46    ) -> Result<Vec<Box<dyn ASTRegApply>>, ConvertError> {
47        // WASM plugin runtime not yet implemented
48        Err(ConvertError::V2NotSupported)
49    }
50}
51
52#[cfg(test)]
53mod tests {
54    use super::*;
55
56    #[test]
57    fn test_plugin_converter_spec_kinds() {
58        let converter = PluginConverter::new();
59        assert_eq!(converter.spec_kinds(), &["PluginTransform"]);
60    }
61}