-
Notifications
You must be signed in to change notification settings - Fork 3
Fix: Preserve filename when closing/reopening issues #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Modified MoveIssue to update the 'updated' timestamp after successfully moving the issue file. This ensures the timestamp reflects the actual state change while preserving the original filename.
Removed SaveIssue calls that were creating duplicate files with new slugs when issue titles were modified. MoveIssue now handles timestamp updates internally, preserving original filenames. This fixes bugs where: - Korean/special character titles generated malformed filenames (e.g., "001-.md") - Modified titles created duplicate files with new slugs
Added tests to verify: - MoveIssue updates timestamp after relocation - Filename is preserved when title contains Korean/special characters - Filename is preserved when title is modified after creation - No duplicate or malformed files are created These tests prevent regression of the filename preservation bug.
WalkthroughThis pull request fixes a filename preservation bug when closing or opening issues. The core change relocates timestamp update logic into the Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Areas requiring extra attention:
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
.issues/.counter(1 hunks).issues/closed/013-fix-filename-preservation-bug-when-closingopening.md(1 hunks)cmd/close.go(2 hunks)cmd/close_test.go(2 hunks)cmd/open.go(2 hunks)cmd/open_test.go(2 hunks)pkg/storage.go(3 hunks)pkg/storage_test.go(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (6)
cmd/open_test.go (2)
pkg/storage.go (5)
FindIssueFile(248-262)LoadIssue(143-163)OpenDir(14-14)ListIssues(213-244)ClosedDir(15-15)pkg/parser.go (1)
SerializeIssue(52-76)
pkg/storage_test.go (1)
pkg/storage.go (4)
LoadIssue(143-163)MoveIssue(166-210)OpenDir(14-14)ClosedDir(15-15)
cmd/open.go (1)
pkg/storage.go (1)
LoadIssue(143-163)
cmd/close.go (1)
pkg/storage.go (1)
LoadIssue(143-163)
cmd/close_test.go (2)
pkg/storage.go (5)
FindIssueFile(248-262)LoadIssue(143-163)ClosedDir(15-15)ListIssues(213-244)OpenDir(14-14)pkg/parser.go (1)
SerializeIssue(52-76)
pkg/storage.go (1)
pkg/parser.go (2)
ParseMarkdown(14-49)SerializeIssue(52-76)
🔇 Additional comments (11)
.issues/.counter (1)
1-1: LGTM!Counter increment is appropriate for the new issue created in this PR.
pkg/storage.go (1)
165-165: LGTM!Comment updates accurately describe the new behavior: filename preservation and timestamp update after move.
Also applies to: 178-178
pkg/storage_test.go (1)
179-207: LGTM!The test correctly verifies that
MoveIssueupdates the timestamp. The sleep ensures a measurable time difference, and the assertion properly checks that the post-move timestamp is after the pre-move timestamp.cmd/open.go (1)
28-42: LGTM!The simplified flow correctly delegates timestamp updates to
MoveIssueand eliminates the redundantSaveIssuecall that was causing filename regeneration issues. The status check usingLoadIssueis appropriate.cmd/close.go (2)
30-44: LGTM!The refactored close flow mirrors the open command improvements: status check via
LoadIssue, directMoveIssuecall, and removal of the problematicSaveIssuethat was regenerating filenames.
59-91: LGTM!Git integration functions are well-implemented with appropriate error handling and clear separation of concerns.
.issues/closed/013-fix-filename-preservation-bug-when-closingopening.md (1)
1-61: LGTM!Well-documented issue description that clearly explains the problem, root cause, solution approach, and testing results.
cmd/close_test.go (2)
122-180: LGTM!This regression test effectively validates that closing an issue with a Korean title preserves the original English-derived filename and doesn't create malformed files like
001-.md. The test structure is clear and comprehensive.
182-243: LGTM!This regression test properly validates that title modifications don't cause filename regeneration or duplicate files when closing issues. The assertions correctly verify both positive (original filename preserved) and negative (new title not in filename) cases.
cmd/open_test.go (2)
141-201: LGTM!This test effectively validates filename preservation when reopening issues with Korean titles. The test follows a clear arrange-act-assert pattern and properly verifies both the filename and directory state.
203-266: LGTM!This test comprehensively validates that reopening issues after title modifications preserves the original filename. The assertions correctly check for both the preserved original filename and the absence of the modified title in the filename.
Problem
Closing/reopening issues with modified titles created duplicate or malformed files:
013-.mdmalformed filesRoot Cause
close/opencommands calledSaveIssue()which regenerates filenames from modified titles.Solution
MoveIssue()to update timestamps after moving filesSaveIssue()calls fromclose.goandopen.goTesting
Added regression tests for both scenarios. Coverage: 86.7% (cmd), 76.0% (pkg)
Closes #13
Summary by CodeRabbit
Bug Fixes
Tests