Skip to content

Epic 10: Planning & Weekly Queue (Stories 10.1–10.5) - #36

Draft
don-petry wants to merge 41 commits into
epic8-guided-inspectionfrom
epic10-planning-queue
Draft

don-petry wants to merge 41 commits into
epic8-guided-inspectionfrom
epic10-planning-queue

Conversation

@don-petry

@don-petry don-petry commented Mar 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Stacked on #35 (Epic 9).

  • 10.1: Happy Context Homepage — greeting, weather/bloom/seasonal cards, Start Plan + View Apiaries CTAs
  • 10.2: Weekly Action Queue — apiary accordion, task rows with priority, overdue URGENT badges, catch-up guidance, materials checklist
  • 10.3: Task Actions — Did It / Not now mutations with cache invalidation
  • 10.4-10.5: Seasonal calendar and dynamic priority GraphQL operations

Test plan

  • 323 TypeScript tests pass (39 suites, 6 new homepage tests)
  • Go tests pass, lint clean

🤖 Generated with Claude Code

Problem

See the linked issue.

Risk

Medium — changes GitHub Actions workflow behavior, which is exercised only post-merge; verify via the affected workflow runs.

Test plan

Tests added/updated: tests/e2e/.gitkeep,tests/e2e/app-loads.spec.ts tests/e2e/onboarding-flow.spec.ts,tests/e2e/web-compatibility.spec.ts. Verification: bash scripts/dev-lead-lint.sh (shellcheck --severity=warning) ran pre-commit; the bats suite runs in CI.

Rollback

Revert this PR. No non-revertible side effects (no tags, migrations, or external state).

Monitoring

Watch the affected workflow run(s) in the Actions tab and this PR's Lint check for regressions.

Copilot AI review requested due to automatic review settings March 30, 2026 00:52
@coderabbitai

coderabbitai Bot commented Mar 30, 2026 •

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch epic10-planning-queue

























  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements the mobile UI + client-side plumbing for Epic 10’s planning surfaces (homepage context cards + weekly plan queue), including new GraphQL operations, React Query hooks, updated tab screens, and tests.

Changes:

  • Added planning GraphQL documents plus React Query hooks for weekly queue and task actions.
  • Replaced placeholder Home/Plan tab screens with a “Happy Context” homepage and a weekly plan queue UI.
  • Updated navigation tests and added dedicated homepage tests.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
apps/mobile/src/services/graphql/planning.ts Adds GraphQL queries/mutations for weekly queue, homepage context, task actions, and seasonal calendar.
apps/mobile/src/features/planning/hooks/use-weekly-queue.ts Adds React Query hooks for fetching the weekly queue and mutating task status.
apps/mobile/app/(tabs)/plan/index.tsx Implements Weekly Plan screen UI (materials checklist, apiary accordion, task action buttons).
apps/mobile/app/(tabs)/index.tsx Implements homepage greeting + context card UI + primary navigation CTAs.
apps/mobile/tests/navigation.test.tsx Updates screen stub expectations and adds mocks for new planning/auth dependencies.
apps/mobile/tests/homepage.test.tsx Adds tests for homepage greeting, cards, and CTA navigation.
_bmad-output/implementation-artifacts/sprint-status.yaml Updates sprint status tracking for Epic 10 items.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/mobile/app/(tabs)/plan/index.tsx Resolved
Comment thread apps/mobile/app/(tabs)/plan/index.tsx Resolved
@don-petry

Copy link
Copy Markdown
Contributor Author

Review — fix requested (cycle 1/3)

The automated review identified the following issues. Please address each one:

Findings to fix

  • [major] CI — SonarCloud Quality Gate failed: 0.0% coverage on new code (required ≥ 80%). Two new files — use-weekly-queue.ts (93 lines) and planning.ts (105 lines) — have zero test coverage. The six new homepage tests exercise only UI rendering, not the hook/service layer.
  • [major] apps/mobile/app/(tabs)/plan/index.tsx:102 — Unhandled promise rejections in ApiarySection: onComplete and onDismiss fire mutateAsync() inside non-async arrow callbacks. If the mutation throws, the rejection is unhandled and the UI shows no error state. Wrap in try/catch or use onError in mutation options.
  • [major] apps/mobile/app/(tabs)/index.tsx:56 — HOMEPAGE_CONTEXT_QUERY is defined in planning.ts but never called. The three context cards (Weather, Bloom Status, Seasonal Phase) permanently display hardcoded 'Loading...' placeholder strings with no hook or data-fetch wired up. This is a shipped stub disguised as a feature.
  • [minor] apps/mobile/src/features/planning/hooks/use-weekly-queue.ts:62 — useDeferTask hook is defined and exported but never imported anywhere in the PR. DEFER_TASK_MUTATION is also unused. Either note it as scaffolding for a later story or remove it.
  • [minor] apps/mobile/app/(tabs)/plan/index.tsx:41 — MaterialsChecklist uses array index as React key (key={i}). If the materials list order changes, React will mis-reconcile items. Use a stable unique key derived from material name + context string.

Additional tasks

  1. Resolve all unresolved review thread comments from other reviewers
  2. Ensure all CI checks pass after your changes (SonarCloud quality gate must pass)
  3. Rebase on epic9-recommendation-engine if the branch is behind
  4. Do NOT modify files unrelated to the findings above

The review cascade will automatically re-review after new commits are pushed.

@don-petry

Copy link
Copy Markdown
Contributor Author

@claude Please address all open review comments on this PR from CodeRabbit and Copilot.

@claude

claude Bot commented May 6, 2026 •

Copy link
Copy Markdown

Claude finished @don-petry's task in 5m 58s —— View job


Addressing Review Comments

All open Copilot and don-petry review findings addressed in commit b558bab.

Todo List

  • Read GraphQL schema and all changed files to understand current state
  • Fix planning.ts — align queries/mutations with actual schema
  • Fix use-weekly-queue.ts — correct types, groupByApiary helper, fix useDeferTask, remove useDismissTask
  • Fix plan/index.tsx — use useDeferTask, wrap mutations with error handling, handle isError state, fix React keys
  • Fix index.tsx — replace "Loading..." stubs with honest static placeholders
  • Update navigation.test.tsx — replace useDismissTask mock with useDeferTask
  • Add use-weekly-queue.test.ts — 9 tests for groupByApiary and type contract
  • Commit and push all fixes

What was fixed

apps/mobile/src/services/graphql/planning.ts

  • WEEKLY_QUEUE_QUERY — replaced non-existent weeklyQueue root field with tasks(status: PENDING, limit: 50), querying hive { id name apiary { id name } } for client-side grouping
  • HOMEPAGE_CONTEXT_QUERY — removed (field homepageContext does not exist in schema)
  • DEFER_TASK_MUTATION — fixed to use DeferTaskInput per schema: deferTask(id: $id, input: $input) where $input: DeferTaskInput; removed $newDueDate (not in DeferTaskInput)
  • DISMISS_TASK_MUTATION — removed (dismissTask mutation does not exist in schema; "Not now" now routes through deferTask)
  • SEASONAL_CALENDAR_QUERY — kept with an explicit scaffolding comment noting it requires Story 10.5 backend work

apps/mobile/src/features/planning/hooks/use-weekly-queue.ts

  • QueueTask.priority — changed from number to TaskPriority = 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW' (matches schema enum)
  • QueueTask.dueDate — changed from required string to string | null (schema: DateTime is nullable)
  • Removed requiredMaterials and recommendedAction (not on the Task type in schema)
  • Added groupByApiary(tasks: RawTask[]): ApiaryQueue[] — pure helper that transforms flat tasks query response into per-apiary groups
  • useWeeklyQueue — now calls tasks query and pipes through groupByApiary
  • useDeferTask — fixed variable shape to { id, input: { reason } } matching DeferTaskInput
  • useDismissTask — removed

apps/mobile/app/(tabs)/plan/index.tsx

  • Replaced useDismissTask import with useDeferTask; "Not now" defers with reason: 'not now'
  • onComplete / onDismiss callbacks now use mutate(…, { onError }) instead of bare mutateAsync, eliminating the unhandled promise rejection path
  • PlanScreen now destructures isError from useWeeklyQueue and renders a distinct error state (cloud-offline icon + retry message) instead of falling through to the empty-state "All caught up!" view
  • React key for materials list changed from array index i to stable ${m.material}-${m.context}

apps/mobile/app/(tabs)/index.tsx

  • Replaced all three "Loading…" placeholder strings with honest copy ("Weather data coming soon", "Bloom tracking coming soon", "Seasonal context coming soon") — these cards are not data-backed in the current schema and should not look like a broken loading state

apps/mobile/__tests__/navigation.test.tsx

  • Updated planning hook mock to export useDeferTask / mutate instead of useDismissTask / mutateAsync

apps/mobile/src/features/planning/hooks/use-weekly-queue.test.ts (new)

  • 9 tests covering groupByApiary: empty input, single task, same-apiary grouping, cross-apiary splitting, field mapping, null dueDate, catchUpGuidance, insertion-order preservation, and all four TaskPriority variants
    |

Base automatically changed from epic9-recommendation-engine to epic8-guided-inspection May 11, 2026 05:08
@donpetry-bot

Copy link
Copy Markdown
Contributor

Review — fix requested (cycle 2/3)

The automated review identified the following issues. Please address each one:

Findings to fix

[Findings would be inserted here]

Additional tasks

  1. Resolve all unresolved review thread comments from other reviewers
  2. Ensure all CI checks pass after your changes
  3. Rebase on the target branch if behind
  4. Do NOT modify files unrelated to the findings above

The review cascade will automatically re-review after new commits are pushed.

4 similar comments
@donpetry-bot

Copy link
Copy Markdown
Contributor

Review — fix requested (cycle 2/3)

The automated review identified the following issues. Please address each one:

Findings to fix

[Findings would be inserted here]

Additional tasks

  1. Resolve all unresolved review thread comments from other reviewers
  2. Ensure all CI checks pass after your changes
  3. Rebase on the target branch if behind
  4. Do NOT modify files unrelated to the findings above

The review cascade will automatically re-review after new commits are pushed.

@donpetry-bot

Copy link
Copy Markdown
Contributor

Review — fix requested (cycle 2/3)

The automated review identified the following issues. Please address each one:

Findings to fix

[Findings would be inserted here]

Additional tasks

  1. Resolve all unresolved review thread comments from other reviewers
  2. Ensure all CI checks pass after your changes
  3. Rebase on the target branch if behind
  4. Do NOT modify files unrelated to the findings above

The review cascade will automatically re-review after new commits are pushed.

@donpetry-bot

Copy link
Copy Markdown
Contributor

Review — fix requested (cycle 2/3)

The automated review identified the following issues. Please address each one:

Findings to fix

[Findings would be inserted here]

Additional tasks

  1. Resolve all unresolved review thread comments from other reviewers
  2. Ensure all CI checks pass after your changes
  3. Rebase on the target branch if behind
  4. Do NOT modify files unrelated to the findings above

The review cascade will automatically re-review after new commits are pushed.

@donpetry-bot

Copy link
Copy Markdown
Contributor

Review — fix requested (cycle 2/3)

The automated review identified the following issues. Please address each one:

Findings to fix

[Findings would be inserted here]

Additional tasks

  1. Resolve all unresolved review thread comments from other reviewers
  2. Ensure all CI checks pass after your changes
  3. Rebase on the target branch if behind
  4. Do NOT modify files unrelated to the findings above

The review cascade will automatically re-review after new commits are pushed.

@donpetry-bot
donpetry-bot requested a review from a team May 11, 2026 21:59
@donpetry-bot

Copy link
Copy Markdown
Contributor

Review — fix requested (cycle 2/3)

The automated review identified the following issues. Please address each one:

Findings to fix

[Findings would be inserted here]

Additional tasks

  1. Resolve all unresolved review thread comments from other reviewers
  2. Ensure all CI checks pass after your changes
  3. Rebase on the target branch if behind
  4. Do NOT modify files unrelated to the findings above

The review cascade will automatically re-review after new commits are pushed.

1 similar comment
@donpetry-bot

Copy link
Copy Markdown
Contributor

Review — fix requested (cycle 2/3)

The automated review identified the following issues. Please address each one:

Findings to fix

[Findings would be inserted here]

Additional tasks

  1. Resolve all unresolved review thread comments from other reviewers
  2. Ensure all CI checks pass after your changes
  3. Rebase on the target branch if behind
  4. Do NOT modify files unrelated to the findings above

The review cascade will automatically re-review after new commits are pushed.

@don-petry
don-petry marked this pull request as draft May 21, 2026 00:36
@sonarqubecloud

sonarqubecloud Bot commented Jun 4, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)
D Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

CI Failure: SonarCloud Code Analysis

Step: SonarCloud Code Analysis (external quality gate)
Root cause: Build error

SonarCloud triggered a quality gate failure on this PR. The PR adds --coverage --coverageReporters=lcov to the TypeScript test step, which feeds a coverage report to SonarCloud — if new or changed code is not sufficiently covered by tests, the quality gate will block the PR. SonarCloud evaluates new code against configured thresholds (e.g. minimum coverage, allowed code smells), and any violation causes the check to fail.

Suggested fix: Open the SonarCloud dashboard for this PR, identify which quality gate condition failed (coverage below threshold, new bugs, or code smells), then either add tests to cover the flagged uncovered code or adjust the sonar-project.properties thresholds if they are misconfigured.

View run logs

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

CI Failure: SonarCloud Code Analysis

Step: SonarCloud Quality Gate
Root cause: Test failure

This PR adds ~1943 lines of new code while introducing --coverageReporters=lcov for the first time to feed SonarCloud coverage data. The quality gate most likely failed because the new code does not meet the configured coverage threshold — SonarCloud enforces a minimum coverage percentage on new code, and with only 6 new tests added for the homepage features (10.1–10.2), the uncovered surface across the weekly queue mutations, seasonal calendar, and GraphQL operations likely pushed the new-code coverage below the gate threshold.

Suggested fix: Add unit tests for the Did It / Not now mutations and the weekly queue task rows, then re-check the SonarCloud dashboard to confirm new-code coverage meets the project gate (typically ≥ 80%).

View run logs

@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — fix-bot-comment (applied)

Changes committed and pushed.

Comment thread .github/workflows/sonarcloud.yml Fixed
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

CI Failure: SonarCloud Code Analysis

Step: SonarCloud Quality Gate
Root cause: Test failure

This PR adds sonar.javascript.lcov.reportPaths=apps/mobile/coverage/lcov.info to sonar-project.properties, reporting JavaScript test coverage to SonarCloud for the first time. The PR introduces 1,964 new lines of TypeScript (Epic 10 features) but only 6 new tests — the coverage on new code is almost certainly below SonarCloud's default "Sonar way" quality gate threshold (typically 80% on new code). Previously SonarCloud only received Go coverage, so this gate was not triggered.

Suggested fix: Add unit tests targeting the new Epic 10 components (HomepageScreen, WeeklyQueue, task action mutations) until pnpm run test -- --coverage shows ≥80% coverage on the new files, then re-push.

View run logs

@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — fix-bot-comment (applied)

Changes committed and pushed.

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

CI Failure: SonarCloud Code Analysis

Step: SonarCloud Scan
Root cause: Config error

The Quality Gate failed on two conditions: 0.0% Coverage on New Code (required ≥ 80%) and C Security Rating on New Code (required ≥ A). The coverage is 0.0% because this PR adds --coverageReporters=lcov to the test command but sonar-project.properties does not include sonar.javascript.lcov.reportPaths, so SonarCloud cannot locate the generated lcov.info file and reports zero coverage. The security rating failure indicates SonarCloud also detected one or more security hotspots or vulnerabilities in the new code added by this PR.

Suggested fix: Add sonar.javascript.lcov.reportPaths=apps/mobile/coverage/lcov.info to sonar-project.properties so SonarCloud picks up the coverage report generated by the updated test step, then review the Security issues on SonarCloud for the specific finding to resolve.

View run logs

@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — fix-bot-comment (applied)

Changes committed and pushed.

@sonarqubecloud

sonarqubecloud Bot commented Jun 8, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Comment thread .github/workflows/ci.yml
echo "EXPO_PUBLIC_API_URL=${EXPO_PUBLIC_API_URL}" >> .env

- name: Inject native Firebase config (Android)
if: env.GOOGLE_SERVICES_JSON != ''

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In GitHub Actions, step-level env: is not populated when the step's if: condition is evaluated, so if: env.GOOGLE_SERVICES_JSON != '' (and if: env.GOOGLE_SERVICE_INFO_PLIST != '' on line 263) will always evaluate to false unless those variables are defined at the job/workflow level. In addition, mobile-build writes .env and native config files but never runs a build or bundle verification step afterward.

@@ -0,0 +1,43 @@
import { gql } from 'urql';

export const NOTIFICATIONS_QUERY = gql`

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of the GraphQL operations in this file (notifications, markNotificationRead, unreadNotificationCount, updateNotificationPreferences, NotificationPreferencesInput) exist in apps/api/graph/schema/*.graphql, and the preference fields (enabled, quietHoursStart, quietHoursEnd) do not match the notification_preferences schema in 000005_skill_notifications.up.sql (sensitivity_level, suppression_window_start, suppression_window_end). Any runtime call to these documents will fail GraphQL validation against the API.

<Text size="md" className="font-medium">{task.title}</Text>
<Text size="xs" className="text-typography-400">{task.hiveName}</Text>
</View>
{task.isOverdue && (

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TaskRow never inspects task.priority (CRITICAL / HIGH / MEDIUM / LOW) and instead renders the URGENT badge solely when task.isOverdue is true. As a result, a non-overdue CRITICAL task shows no priority indicator, while an overdue LOW priority task is labeled URGENT (note that plan-screen.test.tsx:578 comments // Only critical should be URGENT, which only passed because task-1 in MOCK_QUEUES happened to have isOverdue: true).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants