From 7889eea1d1729f74111a7656d8a4e003079d8905 Mon Sep 17 00:00:00 2001 From: marcuscastelo Date: Sat, 26 Jul 2025 22:52:23 -0300 Subject: [PATCH 1/2] fix(day-diet): refetch data after accepting day change - Add bootstrap() call to acceptDayChange() function to ensure day data is refetched when user accepts day change - Update test mocks to properly handle bootstrap function dependencies (showPromise and currentUserId) - Resolves issue where current day appears as non-existent after day change modal acceptance Fixes #1020 --- src/modules/diet/day-diet/application/dayDiet.ts | 1 + src/modules/diet/day-diet/tests/dayChangeDetection.test.ts | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/modules/diet/day-diet/application/dayDiet.ts b/src/modules/diet/day-diet/application/dayDiet.ts index 37ae79a91..431274f88 100644 --- a/src/modules/diet/day-diet/application/dayDiet.ts +++ b/src/modules/diet/day-diet/application/dayDiet.ts @@ -98,6 +98,7 @@ export function acceptDayChange() { if (changeData) { setTargetDay(changeData.newDay) setDayChangeData(null) + bootstrap() // Refetch day diets to ensure current day is available } } diff --git a/src/modules/diet/day-diet/tests/dayChangeDetection.test.ts b/src/modules/diet/day-diet/tests/dayChangeDetection.test.ts index da32921a8..23d09ea2b 100644 --- a/src/modules/diet/day-diet/tests/dayChangeDetection.test.ts +++ b/src/modules/diet/day-diet/tests/dayChangeDetection.test.ts @@ -5,11 +5,15 @@ import { dayChangeData, setDayChangeData, } from '~/modules/diet/day-diet/application/dayDiet' +import * as toastManager from '~/modules/toast/application/toastManager' +import * as user from '~/modules/user/application/user' import * as dateUtils from '~/shared/utils/date/dateUtils' describe('Day Change Detection', () => { it('should accept day change and navigate to new day', () => { vi.spyOn(dateUtils, 'getTodayYYYYMMDD').mockReturnValue('2024-01-16') + vi.spyOn(toastManager, 'showPromise').mockResolvedValue([]) + vi.spyOn(user, 'currentUserId').mockReturnValue(1) setDayChangeData({ previousDay: '2024-01-15', @@ -19,5 +23,6 @@ describe('Day Change Detection', () => { acceptDayChange() expect(dayChangeData()).toBeNull() + expect(toastManager.showPromise).toHaveBeenCalled() }) }) From d354adc954ba4662066588ce132d0cbe02a95a9c Mon Sep 17 00:00:00 2001 From: marcuscastelo Date: Sat, 26 Jul 2025 23:03:40 -0300 Subject: [PATCH 2/2] fix(workflow): prevent stable branch usage and heredoc issues in pull-request command --- .claude/commands/workflow/pull-request.md | 91 ++++++++++++++++++----- 1 file changed, 73 insertions(+), 18 deletions(-) diff --git a/.claude/commands/workflow/pull-request.md b/.claude/commands/workflow/pull-request.md index 371c83e39..72c916aaf 100644 --- a/.claude/commands/workflow/pull-request.md +++ b/.claude/commands/workflow/pull-request.md @@ -122,22 +122,34 @@ Closes #456 ## Shell and CLI Handling -### Multiline Content Management +### Multiline Content Management (CRITICAL - HEREDOC RULES) + +**🚨 MANDATORY HEREDOC FORMAT:** ```bash -# Uses cat with heredoc for proper shell escaping -cat <<'EOF' > /tmp/pr-description.md +# ALWAYS use single quotes around EOF delimiter to prevent variable expansion +cat << 'EOF' > /tmp/pr-description.md ## Summary -Comprehensive PR description with proper formatting. +Your PR description content here. + +## Implementation Details +- Bullet points work fine +- Code blocks with `backticks` are safe +- Variables like $VAR will NOT be expanded (good!) -## Details -- Multiple lines -- Code blocks with `backticks` -- No shell interpretation issues +Closes #123 EOF -gh pr create --title "feat: new feature" --body-file /tmp/pr-description.md +# THEN use the file with gh CLI +gh pr create --title "your title" --body-file /tmp/pr-description.md ``` +**🚨 CRITICAL RULES:** +1. **ALWAYS use `cat << 'EOF'`** (with single quotes) +2. **NEVER use `cat <