fix: Surface a real error when persistence artifact export silently fails on Windows#486
Conversation
…ails on Windows Signed-off-by: mvanhorn <mvanhorn@gmail.com>
fabaa32 to
d4aae7e
Compare
|
Thanks @mvanhorn — the error-surfacing work here is solid, and the directory-as-blocker trick to force a rename failure is a clean reproduce-first test. Two things before merge:
Also FYI: #492 (the other #400 PR, now closed in favour of this one) used |
|
One more item from a closer pass, in addition to the header/error-propagation notes above: in |
- Declare cbm_artifact_export_last_error() in artifact.h and drop the ad-hoc forward declarations in pipeline.c and test_artifact.c so there is a single shared declaration. - Document that dump_and_persist_hashes now intentionally propagates a failed artifact export as a pipeline error (previously silently ignored), so the behavior change is recorded in-tree. - Use MoveFileExA(MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH) for the Windows replace in write_file_atomic instead of unlink+rename; it replaces the destination atomically (credit @Ayush7Ranjan, from DeusData#492). Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
|
Done in 44d5174.
The changed files compile clean under the project's -Werror flags and the artifact suite passes locally; the MoveFileExA branch is Windows-only so I'm leaning on CI for that path. Thanks for the thorough review. |
Summary
On Windows, index_repository with persistence:true reports status:indexed but artifact_present:false, and the /.codebase-memory directory is created with only ADR.md and no graph.db.zst, with no error surfaced. A second user (armandn) reproduced this on 2026-06-17 with a concrete index_repository response (nodes:1866, edges:5340, adr_present:true, artifact_present:false).
Changes
The artifact export lives in src/pipeline/artifact.c (referenced by pipeline.c, which sets artifact_present in the index_repository response). Audit the Windows code path for the zstd-compressed graph.db.zst write: a failed temp-file create/rename or path-separator/long-path handling likely returns early without propagating an error, leaving artifact_present:false and no log line.
Fixes #400