Repository navigation
feat(tasks): accept journalDate on task update to plan a task (#352) - #377
Merged
Merged
Conversation
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
PUTandPATCH /api/v1/TaskItems/{id}now accept an optionaljournalDate, mirroring create. A client can change a task's fields and plan it on a day's journal in one atomic request.DELETE /JournalEntries/{entryId}/todos/{taskItemId}).MoveCount+1,FirstTaggedDatekept,ReassignedToJournalDayevent). A first assignment is not a move, soMoveCountstays 0, as on the todos endpoint.TimezoneOffsetMinutes, UTC fallback): 422TASK_CREATION_PAST_DAY_NOT_ALLOWEDwith the message "You cannot plan a task on a past journal day.", and nothing is changed.ITaskRepository.BeginTransactionAsync/IRepositoryTransaction). If the link fails, everything rolls back, including a newly created empty entry. A race-onlyAlreadyLinkedreturns 409TASK_JOURNAL_ASSIGNMENT_CONFLICT. No transaction is opened when no planning is needed.useUpdateTaskMutationstill sends nojournalDate).Fixes and behavior changes to review
AssignToJournalDateAsyncnow returnsAddTodoResult. This fixes the known defect where thePastDayNotAllowedresult was ignored. Create still ignores the result on purpose (the task is already committed, so the 201 is unchanged), with a comment saying why.JournalEntryRepository.AddAsyncleft the failed duplicate entry tracked. The next save re-attempted that insert, the catch-all turned the failure intoAlreadyLinked, and the link was silently lost. The entry is now detached on a duplicate. A real-SQLite test fails without the fix.AddTodoAsynccatch narrowed to unique-constraint violations.POST .../todosnow returns 500 instead of a misleading 409 for otherDbUpdateExceptions.IsUniqueConstraintViolationalso recognises SQLite extended code 1555 (primary-key constraint). The join table's composite key raises 1555 rather than 2067, so the real concurrent-link race would otherwise escape as a 500.AddAsync's behavior for theJournalEntries.Dateindex is unchanged.SQLITE_BUSYunder concurrent writes. This is unlikely for a single-user app.Files changed
TaskItemsController.cs,UpdateTaskItemDto.cs,PatchTaskItemDto.cs,ITaskRepository.cs,TaskRepository.cs,IRepositoryTransaction.cs(new),JournalEntryRepository.csTaskFlow.Web/src/api/client/types.gen.ts(+2 lines,journalDateonUpdateTaskItemDtoandPatchTaskItemDto), regenerated and not hand-editeddocs/API.md(create, reopen/offset, PUT and PATCH sections; the PUT section'sstatusIdis corrected tostatus)TaskItemsControllerJournalDateMockedTests.cs(new),TaskItemsControllerJournalDateRealStackTests.cs(new),TaskRepositoryTransactionTests.cs(new),JournalEntryRepositoryTests.cs,JsonSerializerOptionsProviderTests.csTest results
dotnet build -c Release: 0 warnings, 0 errorsdotnet test --project TaskFlow.Api.Tests: 829 of 829 pass (47 new), 94.43% line coveragedotnet format TaskFlow.sln --verify-no-changes: cleannpm run type-check: passnpm run test -- --run --coverage: 1567 tests pass, 97.31% linesResidual findings (Minor, for awareness)
PastDayNotAllowedmapping and a real repository-raisedAlreadyLinkedinside the controller transaction are covered by Moq tests, not against the real SQLite stack. Rollback itself is proven on SQLite.TryAutoCompleteParentAsyncruns after the transaction commits. This is unchanged from the existing behavior.CurrentJournalEntryId, whileAddTodoAsyncchecks the join row. Legacy data where the two disagree would get a 409 on a same-day re-send. This is speculative.Part of #366. Closes #352