From 5ed19a264e37c2ad38386afda9f41ba9e09b6ef2 Mon Sep 17 00:00:00 2001 From: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Date: Wed, 12 Aug 2026 08:56:24 -0700 Subject: [PATCH] fix: refresh the artifact on both incremental paths cbm_pipeline_refresh_artifact already encodes the policy this PR was written to add: it exports when persistence is on even with no artifact present, picks BEST over FAST for that first export, and propagates an export failure. The full path and the semantic_manifest_equal no-op already call it; the other two incremental exits did not. The no_changes no-op returned 0 without refreshing, so a run that changed nothing never created the first artifact. The dump path hand-rolled an exists-only FAST export and discarded its result. Both now route through the helper, which is also why this diff is much smaller than the original branch. Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> --- src/pipeline/pipeline_incremental.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/pipeline/pipeline_incremental.c b/src/pipeline/pipeline_incremental.c index 3e4610677..2295006eb 100644 --- a/src/pipeline/pipeline_incremental.c +++ b/src/pipeline/pipeline_incremental.c @@ -1493,10 +1493,6 @@ static int dump_and_persist(cbm_gbuf_t *gbuf, const char *db_path, const char *p return rc; } - /* Auto-update artifact if one already exists (persistence was enabled previously) */ - if (repo_path && cbm_artifact_exists(repo_path)) { - cbm_artifact_export(db_path, repo_path, project, CBM_ARTIFACT_FAST); - } return 0; } @@ -2488,7 +2484,9 @@ int cbm_pipeline_run_incremental(cbm_pipeline_t *p, const char *db_path, cbm_fil free_mode_skipped(mode_skipped, mode_skipped_count); cbm_store_free_file_hashes(stored, stored_count); cbm_store_close(store); - return 0; + /* Same contract as the semantic_manifest_equal no-op above: a run that + * changed nothing still owes the first artifact when persistence is on. */ + return cbm_pipeline_refresh_artifact(p, db_path); } #if defined(CBM_INCREMENTAL_TEST_API) && CBM_INCREMENTAL_TEST_API @@ -2859,5 +2857,11 @@ int cbm_pipeline_run_incremental(cbm_pipeline_t *p, const char *db_path, cbm_fil cbm_gbuf_free(existing); cbm_log_info("incremental.done", "elapsed_ms", itoa_buf((int)elapsed_ms(t0))); - return persist_rc; + if (persist_rc != 0) { + return persist_rc; + } + /* Mirrors the full path: publication succeeded, so refresh the artifact. + * The helper creates the FIRST one when persistence is on and propagates + * an export failure instead of leaving the run looking successful. */ + return cbm_pipeline_refresh_artifact(p, db_path); }