Critical fixes to context propagation implementation (bd-rtp, bd-yb8, bd-2o2): 1. Fix rootCtx lifecycle in main.go: - Removed premature defer rootCancel() from PersistentPreRun (line 132) - Added proper cleanup in PersistentPostRun (lines 544-547) - Context now properly spans from setup through command execution to cleanup 2. Fix test context contamination in cli_fast_test.go: - Reset rootCtx and rootCancel to nil in test cleanup (lines 139-140) - Prevents cancelled contexts from affecting subsequent tests 3. Fix export tests missing context in export_test.go: - Added rootCtx initialization in 5 export test subtests - Tests now properly set up context before calling exportCmd.Run() These fixes ensure: - Signal-aware contexts work correctly for graceful cancellation - Ctrl+C properly cancels import/export operations - Database integrity is maintained after cancellation - All cancellation tests pass (TestImportCancellation, TestExportCommand) Tested: - go build ./cmd/bd ✓ - go test ./cmd/bd -run TestImportCancellation ✓ - go test ./cmd/bd -run TestExportCommand ✓ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
10 KiB
10 KiB