Skip to content

fix(merge): accept batch-existing.json in incremental updates#410

Open
s870488-dev wants to merge 1 commit into
Egonex-AI:mainfrom
s870488-dev:fix/402-incremental-batch-existing
Open

fix(merge): accept batch-existing.json in incremental updates#410
s870488-dev wants to merge 1 commit into
Egonex-AI:mainfrom
s870488-dev:fix/402-incremental-batch-existing

Conversation

@s870488-dev

Copy link
Copy Markdown

Summary

Fixes #402 — incremental updates silently lose all unchanged nodes because merge-batch-graphs.py drops batch-existing.json (regex only matches numeric batch indices).

Root Cause

Lines 1036, 1089-1093: regex batch-(\d+)(?:-part-(\d+))?\.json excludes batch-existing.json, causing it to be added to unrecognized_batch_files and skipped during load.

Fix

  • Replace regex filtering with glob + explicit batch_sort_key()
  • batch-existing.json sorts FIRST (key=-1) as base graph
  • Numbered batches sort numerically; multi-part batches by part number
  • Unrecognized patterns load last (defensive), not dropped

Verification

Ran end-to-end test with synthetic batches:

batch-existing.json: 50 nodes, 49 edges
batch-1.json: 3 nodes, 0 edges
batch-2-part-1.json: 1 nodes, 0 edges
batch-2-part-2.json: 1 nodes, 0 edges
batch-fused-8-13.json: 1 nodes, 0 edges

Output: 53 nodes, 49 edges  ✅ (was 3 nodes before fix)

Checklist

- Replace regex-based batch filtering with glob + explicit sort key
- batch-existing.json now loads FIRST as base graph (sort key -1)
- Numbered batches and multi-part batches sort numerically
- Unrecognized patterns load last (defensive), not dropped
- Fixes Lum1104#402: incremental updates silently lose all unchanged nodes

Tested: synthetic end-to-end test with batch-existing (50 nodes) +
batch-1 (3 updates) + batch-2-part-1/2 (2 new) + batch-fused-8-13 (1 new)
→ Output 53 nodes (was 3 before fix due to dropping batch-existing)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incremental updates silently lose all unchanged nodes — merge-batch-graphs.py drops batch-existing.json

1 participant