fix(pipeline,api): write the source page last; say how to clear an unreadable note (review of #211, pass 4)
The source page carries source_hash, which the drift check trusts. Written first, a batch that failed midway left a hash behind, so re-ingesting the same content was skipped and the rest of the batch was lost for good. In a wing it is now written last. An over-cap note in brain_pending says promote/reject cannot act on it and to delete or move it by hand. Mutation-checked. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/mathiasbq/hyperguild/ingestion/internal/brainfs"
|
||||
"io/fs"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -166,6 +167,12 @@ func buildAndWrite(ctx context.Context, wing string, rawPages []RawPage, sourceS
|
||||
warnings = append(warnings, clashWarnings...)
|
||||
}
|
||||
|
||||
if wing != "" {
|
||||
// The source page carries source_hash, which the drift check trusts: it
|
||||
// goes last, so a batch that fails midway leaves nothing to hide behind.
|
||||
sort.SliceStable(merged, func(i, j int) bool { return !isSourcePath(merged[i].Path) && isSourcePath(merged[j].Path) })
|
||||
}
|
||||
|
||||
var written []string
|
||||
for _, page := range merged {
|
||||
if !dryRun {
|
||||
|
||||
Reference in New Issue
Block a user