From 7292c856dd9b9a6983c377e9f0344bd44faca99a Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Wed, 5 Nov 2025 00:40:51 -0800 Subject: [PATCH] Fix import to respect import.missing_parents config When --orphan-handling flag not specified, import was passing empty string instead of reading config or defaulting to 'allow'. This broke all imports with hierarchical IDs after git pull. Fix: Read import.missing_parents config, default to 'allow' if unset. Priority: flag > config > default Amp-Thread-ID: https://ampcode.com/threads/T-d089540c-c172-440f-88c9-ff06bde6504d Co-authored-by: Amp --- cmd/bd/import_shared.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/cmd/bd/import_shared.go b/cmd/bd/import_shared.go index 830edda0..bcee5e1f 100644 --- a/cmd/bd/import_shared.go +++ b/cmd/bd/import_shared.go @@ -192,6 +192,22 @@ type ImportResult struct { // - Displaying results to the user // - Setting metadata (e.g., last_import_hash) func importIssuesCore(ctx context.Context, dbPath string, store storage.Storage, issues []*types.Issue, opts ImportOptions) (*ImportResult, error) { + // Determine orphan handling: flag > config > default (allow) + orphanHandling := opts.OrphanHandling + if orphanHandling == "" && store != nil { + // Read from config if flag not specified + configValue, err := store.GetConfig(ctx, "import.missing_parents") + if err == nil && configValue != "" { + orphanHandling = configValue + } else { + // Default to allow (most permissive) + orphanHandling = "allow" + } + } else if orphanHandling == "" { + // No store available, default to allow + orphanHandling = "allow" + } + // Convert ImportOptions to importer.Options importerOpts := importer.Options{ DryRun: opts.DryRun, @@ -199,7 +215,7 @@ func importIssuesCore(ctx context.Context, dbPath string, store storage.Storage, Strict: opts.Strict, RenameOnImport: opts.RenameOnImport, SkipPrefixValidation: opts.SkipPrefixValidation, - OrphanHandling: importer.OrphanHandling(opts.OrphanHandling), + OrphanHandling: importer.OrphanHandling(orphanHandling), } // Delegate to the importer package