Skip to content

Conversation

@jackmisner
Copy link
Owner

@jackmisner jackmisner commented Nov 30, 2025

Summary by CodeRabbit

  • New Features

    • AI Analysis button now detects network connectivity, shows "Go Online to Analyse with AI" when offline, and disables analysis without a connection.
  • Improvements

    • Offline brewing metrics refined so final gravity defaults more accurately when yeast data is missing.
  • Chores

    • App version bumped to 3.2.6 (build 191).

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 30, 2025

Walkthrough

Bumps app version metadata to 3.2.6 (Android versionCode 190→191), updates resource/runtime version strings, adds offline-aware logic to the AI analysis button, and changes default attenuation to 0% when no yeast entries exist for FG calculation.

Changes

Cohort / File(s) Summary
Version metadata
android/app/build.gradle, android/app/src/main/res/values/strings.xml, app.json, package.json
Incremented app version from 3.2.5 → 3.2.6 and Android versionCode 190 → 191; updated expo_runtime_version, expo.version, and expo.runtimeVersion strings to match.
Offline-aware UI
src/components/recipes/AIAnalysisButton.tsx
Uses NetworkContext to detect offline state; button disables when offline and shows "Go Online to Analyse with AI" (loading label preserved).
Brewing metrics
src/services/brewing/OfflineMetricsCalculator.ts
Default attenuation when no yeast entries exist changed from 75% → 0%, causing FG to equal OG in that case.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Pay attention to NetworkContext usage and UI state transitions in AIAnalysisButton.tsx.
  • Validate FG calculation logic and unit implications in OfflineMetricsCalculator.ts.

Possibly related issues

Possibly related PRs

Poem

🐇 I hopped a bump from three-point-five to six,

The AI waits—go online to get your fix.
No yeast to tinker? Gravity stays true,
OG and FG now match—just for you.
A tiny hop, a careful tweak—hip hip hop hooray!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the two main changes: adding offline awareness to the AI button component and updating the offline FG calculation logic in the metrics service.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch offline-recipe-creation-improvements

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a21593d and 257b8a1.

📒 Files selected for processing (1)
  • src/components/recipes/AIAnalysisButton.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/recipes/AIAnalysisButton.tsx

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/components/recipes/AIAnalysisButton.tsx (1)

126-154: Consider adding offline awareness to AIAnalysisIconButton.

The main AIAnalysisButton component now includes offline detection, but AIAnalysisIconButton does not (Line 134 still uses const isDisabled = disabled || loading; without checking isOffline). This inconsistency means the icon button could be enabled while offline.

If both components should respect offline state, apply similar logic to AIAnalysisIconButton:

 export function AIAnalysisIconButton({
   loading = false,
   disabled = false,
   onPress,
   testID = TEST_IDS.ai.analysisIconButton,
 }: Pick<AIAnalysisButtonProps, "loading" | "disabled" | "onPress" | "testID">) {
   const theme = useTheme();
   const styles = createAIStyles(theme);
-  const isDisabled = disabled || loading;
+  const { isOffline } = useNetwork();
+  const isDisabled = disabled || isOffline || loading;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 572a4b1 and a21593d.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (6)
  • android/app/build.gradle (1 hunks)
  • android/app/src/main/res/values/strings.xml (1 hunks)
  • app.json (3 hunks)
  • package.json (1 hunks)
  • src/components/recipes/AIAnalysisButton.tsx (2 hunks)
  • src/services/brewing/OfflineMetricsCalculator.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/components/recipes/AIAnalysisButton.tsx (1)
src/contexts/NetworkContext.tsx (1)
  • useNetwork (100-106)
🔇 Additional comments (6)
package.json (1)

4-4: LGTM!

Version bump is consistent with the other files in the PR.

app.json (1)

6-6: LGTM!

Version metadata updates are consistent across the app configuration, Android build files, and package manifest.

Also applies to: 19-19, 61-61

android/app/src/main/res/values/strings.xml (1)

4-4: LGTM!

Runtime version string correctly updated to match the version bump across the project.

src/services/brewing/OfflineMetricsCalculator.ts (1)

107-110: Excellent improvement to brewing science accuracy.

Changing the default attenuation from 75% to 0% when no yeast is present is scientifically correct—without yeast, there's no fermentation, so FG should equal OG. This properly aligns the offline calculator with backend behavior.

android/app/build.gradle (1)

95-96: LGTM!

Version code and name correctly incremented to align with the 3.2.6 release.

src/components/recipes/AIAnalysisButton.tsx (1)

82-86: Well-designed offline user experience.

The conditional label logic clearly communicates to users why the AI feature is unavailable when offline, improving the overall UX. The fallback to offline mode when the context is unavailable is also a sensible defensive approach.

- Add offline awareness to AIAnalysisIconButton
@jackmisner jackmisner merged commit d16f3d5 into main Nov 30, 2025
2 checks passed
@jackmisner jackmisner deleted the offline-recipe-creation-improvements branch November 30, 2025 12:09
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.

Offline metric calculation - OG calculation seems fine, but has somehow calculated FG without yeast ingredient present

2 participants