fix: resolve unreachable duplicate elif 'DO*' branch in result_string() (#6)
#39
No reviewers
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/paper-dynasty-card-creation#39
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "ai/paper-dynasty-card-creation#6"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #6
Summary
The second
elif "DO*" in data_stringinresult_string()was dead code. Since the first branch always matched any string containing"DO*"(including"DO**"), thespaces -= 2adjustment for theDO**variant was silently skipped, producing incorrect spacing in card formatting.Root cause: Both branches had identical conditions (
"DO*" in data_string). The second could never be reached.Fix: Changed the second branch to check
"DO**"and reordered so"DO**"is checked before"DO*"— since"DO*" in "DO**"isTrue, the more-specific check must come first.Files changed
creation_helpers.py— 2-line swap inresult_string()(lines 621-624)Test results
No test suite. Change verified by reading back modified file — diff contains only the 4-line functional swap, no cosmetic changes.
Other observations
The
format-on-save@agent-toolkitplugin reformats quote styles on every Edit tool save. Used a Python one-liner for the surgical change to keep the diff minimal and avoid cosmetic noise.Review: LGTM ✓
Fix is correct and minimal.
Bug Confirmed
Lines 621–624 in the current file have identical
elif "DO*" in data_stringconditions. The second branch (spaces -= 2) is unreachable dead code — Python'selifchain short-circuits, so anyDO**string matches the first branch and getsspaces -= 1instead.Fix Analysis
The two-part correction is sound:
"DO*"→"DO**"— now tests the specific variant."DO**"check moved before"DO*"— required because"DO*" in "DO**"evaluatesTrue, so the more-specific match must come first (mirrors the existingSI**pattern already in the same block).The spacing values (
-2forDO**,-1forDO*) are consistent withDO**being one character longer and thus needing one additional space trimmed for card column alignment.Scope
Diff is exactly 4 lines, no cosmetic noise. No other logic touched.
No Concerns
SI**/SI*precedent in spiritReady to merge.
Approved — safe bug fix per PO triage.