feat: validate project exists before creating tasks#121
Merged
Conversation
Add validation in CreateTask to ensure the specified project exists in the database before allowing task creation. This prevents orphaned tasks with non-existent project references. Changes: - Add ErrProjectNotFound error variable for consistent error handling - Validate project existence in CreateTask using GetProjectByName - Support project aliases in validation (existing functionality) - Default to 'personal' project (which is auto-created) when no project specified Tests: - Add TestCreateTaskRejectsNonExistentProject - Add TestCreateTaskAllowsExistingProject - Add TestCreateTaskAllowsProjectAlias - Add TestCreateTaskDefaultsToPersonal - Update existing tests to create required projects before tasks Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CreateTaskto ensure the specified project exists before allowing task creationproject not founderror when validation failsTest plan
go test ./...- all tests passTestCreateTaskRejectsNonExistentProject- verifies error on non-existent projectTestCreateTaskAllowsExistingProject- verifies success with valid projectTestCreateTaskAllowsProjectAlias- verifies aliases workTestCreateTaskDefaultsToPersonal- verifies default project behavior🤖 Generated with Claude Code