Skip to content

fix(core): treat empty notes content as no notes in task detail - #1161

Merged
Kohei-Wada merged 1 commit into
Kohei-Wada:mainfrom
Sanjays2402:fix/has-notes-after-delete
Jul 25, 2026
Merged

fix(core): treat empty notes content as no notes in task detail#1161
Kohei-Wada merged 1 commit into
Kohei-Wada:mainfrom
Sanjays2402:fix/has-notes-after-delete

Conversation

@Sanjays2402

Copy link
Copy Markdown
Contributor

Description

GetTaskDetailUseCase computed has_notes from notes_content is not None, but NotesController.delete_notes implements deletion as write_notes(task_id, ""), leaving an empty row behind. SqliteNotesRepository.has_notes and get_task_ids_with_notes both require content != "", so after deleting a note the two sources of truth disagreed: the task list showed no note indicator while show/detail reported has_notes=True with empty content. Fixed by using bool(notes_content).

Related Issue

Closes #1157

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Changes Made

  • get_task_detail.py: has_notes = bool(notes_content) so an empty (deleted) note counts as no notes, matching NotesRepository.has_notes().
  • Added test_execute_after_notes_deleted regression test.

Testing

Test Environment

  • OS: macOS
  • Python version: 3.14
  • UV version: N/A (pytest run directly against the source tree)

Tests Performed

  • Unit tests pass (make test)
  • Added new tests for new features
  • Manual testing completed
  • All affected commands work as expected

The new test fails without the source change (has_notes=True with notes_content='') and passes with it, verified by stashing the source file. Full taskdog-core suite: 1166 passed.

Code Quality Checklist

  • Linter passes (make lint)
  • Type checker passes (make typecheck)
  • Code is formatted (make format)
  • No new warnings introduced
  • Code follows project conventions

Ruff check and format are clean on both changed files.

Documentation

  • Updated README.md (if needed)
  • Updated CLAUDE.md (if architecture changed)
  • Updated CHANGELOG.md
  • Added/updated docstrings
  • Updated type hints

N/A — no user-facing API or architecture change.

Package Affected

  • taskdog-core

Breaking Changes

  • This PR includes breaking changes
  • Migration guide provided (if breaking changes)

Checklist

  • My code follows the coding standards of this project
  • I have performed a self-review of my own code
  • I have commented my code in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

The issue offered two directions; this takes the smaller one (bool(notes_content) in the use case) rather than changing delete_notes to drop the row, since the repository layer already treats empty content as "no notes".

GetTaskDetailUseCase computed has_notes from 'notes_content is not
None', but delete_notes implements deletion as write_notes(task_id, ""),
leaving an empty row behind. NotesRepository.has_notes and
get_task_ids_with_notes both require content != "", so after deleting a
note the task list showed no indicator while show/detail reported
has_notes=True with empty content.

Use bool(notes_content) so the use case agrees with the repository.

Closes Kohei-Wada#1157
@Kohei-Wada

Copy link
Copy Markdown
Owner

Thanks for the fix! Verified that the change aligns the use case with the repository's content-based notes semantics, and the regression test properly covers the delete-then-detail path. Much appreciated!

@Kohei-Wada
Kohei-Wada merged commit c7afe8f into Kohei-Wada:main Jul 25, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(core): has_notes inconsistent after note deletion (empty-row delete semantics)

2 participants