Skip to content

Commit bf5df4c

Browse files
committed
feat: persist per-module artifacts in modular migration
1 parent a5674c7 commit bf5df4c

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

crates/noricum-core/src/orchestrator.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,7 @@ pub async fn migrate_file(
692692
&provider_config,
693693
&analysis,
694694
difficulty,
695+
&artifacts,
695696
)
696697
.await?
697698
{
@@ -1557,6 +1558,7 @@ pub async fn migrate_file(
15571558
///
15581559
/// Each module gets its own repair loop with reasonable context size, solving the
15591560
/// core problem where repair of 4000+ LOC Rust is too large for the LLM to handle.
1561+
#[allow(clippy::too_many_arguments)]
15601562
async fn migrate_file_modular(
15611563
c_source: &str,
15621564
name: &str,
@@ -1565,6 +1567,7 @@ async fn migrate_file_modular(
15651567
provider_config: &noricum_agents::providers::ProviderConfig,
15661568
analysis: &noricum_agents::analysis::AnalysisResult,
15671569
difficulty: noricum_ir::Difficulty,
1570+
artifacts: &Option<crate::artifacts::ArtifactStore>,
15681571
) -> Result<ModularResult, CoreError> {
15691572
let modules = noricum_tools::ast::split_into_modules(c_source);
15701573

@@ -1691,6 +1694,13 @@ async fn migrate_file_modular(
16911694
mod_unit.rust_output = Some(rust_code);
16921695
mod_unit.state = MigrationState::Refined;
16931696

1697+
// Save per-module artifact
1698+
if let Some(store) = artifacts
1699+
&& let Some(rust) = &mod_unit.rust_output
1700+
{
1701+
let _ = store.save_translation_module(&module.name, rust);
1702+
}
1703+
16941704
// Validate this module (compile check + scoring, no diff test for modules)
16951705
let mod_validation =
16961706
noricum_validation::validate_with_threshold(&mod_unit, config.min_idiomatic_score)?;

0 commit comments

Comments
 (0)