feat(flatfile): warn on missing or mismatched log format-version

This commit is contained in:
2026-05-04 17:17:33 +03:00
parent a9b181beb7
commit 48b89460b7
3 changed files with 65 additions and 2 deletions

View File

@@ -205,6 +205,15 @@ _ff_state_build(ff_contact_state_t* state)
state->bom_len = ff_skip_bom(fp);
int file_version = ff_read_format_version(fp);
if (file_version == 0) {
log_warning("flatfile: %s has no format-version marker, expected %d",
state->filepath, FLATFILE_FORMAT_VERSION);
} else if (file_version != FLATFILE_FORMAT_VERSION) {
log_warning("flatfile: %s format-version %d does not match expected %d",
state->filepath, file_version, FLATFILE_FORMAT_VERSION);
}
state->n_entries = 0;
state->total_lines = 0;