docs: Complete import.orphan_handling documentation (bd-9cdc)

Added comprehensive documentation for import orphan handling configuration
across all relevant documentation files:

- AGENTS.md: Added "Import Configuration" section with detailed mode
  explanations and usage guidance
- README.md: Documented orphan handling in Export/Import section with
  examples of all four modes
- TROUBLESHOOTING.md: Added "Import fails with missing parent errors"
  troubleshooting section with resurrection examples and prevention tips
- CLI_REFERENCE.md: Expanded Import/Export section with --orphan-handling
  flag documentation and cross-references

Documented resurrection behavior:
- Tombstone creation (Status=Closed, Priority=4)
- JSONL history search for deleted parents
- Best-effort dependency resurrection
- Hierarchical ancestor chain handling

Closes bd-9cdc

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-11-24 01:07:50 -08:00
parent 5d11cf1842
commit e0e6dff87f
5 changed files with 160 additions and 39 deletions

View File

@@ -160,6 +160,57 @@ rm .beads/*.db
bd import -i .beads/issues.jsonl
```
### Import fails with missing parent errors
If you see errors like `parent issue bd-abc does not exist` when importing hierarchical issues (e.g., `bd-abc.1`, `bd-abc.2`), this means the parent issue was deleted but children still reference it.
**Quick fix using resurrection:**
```bash
# Auto-resurrect deleted parents from JSONL history
bd import -i issues.jsonl --orphan-handling resurrect
# Or set as default behavior
bd config set import.orphan_handling "resurrect"
bd sync # Now uses resurrect mode
```
**What resurrection does:**
1. Searches the full JSONL file for the missing parent issue
2. Recreates it as a tombstone (Status=Closed, Priority=4)
3. Preserves the parent's original title and description
4. Maintains referential integrity for hierarchical children
5. Also resurrects dependencies on best-effort basis
**Other handling modes:**
```bash
# Allow orphans (default) - import without validation
bd config set import.orphan_handling "allow"
# Skip orphans - partial import with warnings
bd config set import.orphan_handling "skip"
# Strict - fail fast on missing parents
bd config set import.orphan_handling "strict"
```
**When this happens:**
- Parent issue was deleted using `bd delete`
- Branch merge where one side deleted the parent
- Manual JSONL editing that removed parent entries
- Database corruption or incomplete import
**Prevention:**
- Use `bd delete --cascade` to also delete children
- Check for orphans before cleanup: `bd list --id bd-abc.*`
- Review impact before deleting epic/parent issues
See [docs/CONFIG.md](docs/CONFIG.md#example-import-orphan-handling) for complete configuration documentation.
### Database corruption
**Important**: Distinguish between **logical consistency issues** (ID collisions, wrong prefixes) and **physical SQLite corruption**.