Skip to content

feat: pipeline artifact persistence#10

Merged
JuanMarchetto merged 9 commits into
mainfrom
feat/artifact-persistence
Mar 20, 2026
Merged

feat: pipeline artifact persistence#10
JuanMarchetto merged 9 commits into
mainfrom
feat/artifact-persistence

Conversation

@JuanMarchetto

Copy link
Copy Markdown
Owner

Summary

  • Add ArtifactStore that persists every intermediate pipeline output to .noricum-artifacts/{name}-{timestamp}/
  • 17 save methods covering all pipeline stages: C source, analysis, c2rust, per-chunk translations, agreed signatures, foundation context, per-module translations, retranslations, initial validation, each repair iteration (accepted + rejected), best-version tracking, stall retranslations, final output, generated tests, and run manifest
  • Integrates into migrate_file() orchestrator with fire-and-forget pattern (artifact save failures never break the pipeline)
  • Returns per-chunk details from translate_chunked via new ChunkedTranslationResult type
  • Adds --artifacts-dir CLI flag (default: .noricum-artifacts/)
  • 24 new tests (19 unit + 5 integration), 419 total passing, 0 clippy warnings

Motivation

During expensive migrations ($5-10 in tokens), intermediate outputs were held only in memory and lost — each repair iteration overwrote the previous, per-chunk translations were combined and dropped, analysis results lived in local variables. This made debugging failed migrations impossible.

Test plan

  • Unit tests for every ArtifactStore method (content round-trips)
  • Integration tests simulating full pipeline, repair loop, chunked translation, modular migration, and retranslation scenarios
  • cargo clippy --workspace -- -D warnings passes (0 warnings)
  • cargo test --workspace passes (419 tests, 0 failures)
  • Path sanitization prevents directory traversal in user-provided names
  • UTC timestamps for cross-timezone consistency

Introduce ArtifactStore struct that persists every intermediate artifact
produced during a migration run to a timestamped directory. Includes 16
save methods covering all pipeline stages (C source, analysis, c2rust,
translation chunks/modules/signatures, validation, repair iterations,
best-version tracking, final output, tests, manifest) plus 19 unit tests.
Save every intermediate artifact throughout migrate_file(): C source,
C2Rust output, analysis JSON, translation, retranslations (stub/unsafe/
stall), initial validation, each repair iteration with its validation,
rejected repairs, best-version updates, final output, generated tests,
and a manifest summary. All saves are fire-and-forget (never fail the
pipeline). Add Serialize derive to ValidationResult for JSON persistence.
@JuanMarchetto JuanMarchetto merged commit 6c1fccc into main Mar 20, 2026
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant