fix(export): populate export_hashes after successful export (GH#1278) (#1286)

Child issues created with --parent were missing from export_hashes table,
which affects integrity tracking and future incremental export features.

This fix ensures SetExportHash() is called for all exported issues:
- Updated ExportResult to include IssueContentHashes map
- Updated finalizeExport() to call SetExportHash() for each exported issue
- Updated exportToJSONLDeferred() to collect content hashes during export
- Updated performIncrementalExport() to collect content hashes for dirty issues
- Updated exportToJSONLWithStore() to call SetExportHash() after export
- Updated daemon's handleExport() to call SetExportHash() after export

Added test TestExportPopulatesExportHashes to verify the fix works for
both regular and hierarchical (child) issue IDs.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Scott Nixon
2026-01-24 17:10:02 -08:00
committed by GitHub
parent fde40a79cf
commit 810192157c
4 changed files with 152 additions and 9 deletions

View File

@@ -138,6 +138,17 @@ func exportToJSONLWithStore(ctx context.Context, store storage.Storage, jsonlPat
return writeErr
}
// Update export_hashes for all exported issues (GH#1278)
// This ensures child issues created with --parent are properly registered
for _, issue := range issues {
if issue.ContentHash != "" {
if err := store.SetExportHash(ctx, issue.ID, issue.ContentHash); err != nil {
// Non-fatal warning - continue with other issues
fmt.Fprintf(os.Stderr, "Warning: failed to set export hash for %s: %v\n", issue.ID, err)
}
}
}
return nil
}