Skip to main content

FixContext

Trait FixContext 

Source
pub trait FixContext: Send + Sync {
    // Required methods
    fn ruleset_name(&self) -> &str;
    fn migration_description(&self) -> &str;
    fn llm_constraints(&self) -> &[String];

    // Provided methods
    fn revert_warnings(&self) -> Option<&str> { ... }
    fn fix_priority(&self, _rule_id: &str) -> u8 { ... }
    fn change_type_examples(&self) -> &str { ... }
    fn verification_prompt(&self) -> Option<&str> { ... }
    fn llm_system_prompt(&self) -> String { ... }
}
Expand description

Trait that framework/ruleset-specific crates implement to provide LLM prompt context for the fix engine.

Implementations are registered in a FixContextRegistry and looked up by ruleset name at runtime.

Required Methods§

Source

fn ruleset_name(&self) -> &str

Unique name that matches the RuleSet.name field from Konveyor analysis output. Used for registry lookup.

Source

fn migration_description(&self) -> &str

Human-readable description of the migration (e.g., “PatternFly v5 to v6”). Used in LLM system prompts and prompt preambles.

Source

fn llm_constraints(&self) -> &[String]

Framework-specific constraints to include in LLM prompts. Each string is a single constraint line (will be prefixed with “- “).

Provided Methods§

Source

fn revert_warnings(&self) -> Option<&str>

Warning text about revert pitfalls for batch mode context sections. Shown when a batch prompt includes previously-applied fixes to warn the LLM about framework-specific patterns it should not undo.

Returns None if no revert warnings are needed.

Source

fn fix_priority(&self, _rule_id: &str) -> u8

Determine the processing priority of a fix request within a batch. Lower number = processed first. This ensures structural migration rules come before informational/review-only rules.

Default: all rules have equal priority (3).

Source

fn change_type_examples(&self) -> &str

Examples of change types for LLM prompt context.

Used in batch prompts to describe the kinds of changes the LLM should look for. Should be a parenthetical list of language-specific actions.

Default: generic description suitable for any language.

Source

fn verification_prompt(&self) -> Option<&str>

Optional verification instructions appended to the LLM batch prompt.

Framework-specific checks the LLM should perform after applying fixes. Returns None if no verification instructions are needed.

Source

fn llm_system_prompt(&self) -> String

System prompt for the OpenAI-compatible LLM client.

Default implementation builds a generic prompt from migration_description().

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§