Skip to content

dev 02#2

Open
gamesguru wants to merge 73 commits intomasterfrom
dev
Open

dev 02#2
gamesguru wants to merge 73 commits intomasterfrom
dev

Conversation

@gamesguru
Copy link
Member

@gamesguru gamesguru commented Jan 21, 2026

Summary by cubic

Adds a database picker with recent files and a context menu to add foods to a meal from search results. Adds RDA and Profile settings, a Daily Log with macro progress bars, a Preferences dialog with usage stats and database sizes, a recipe builder to create and manage recipes, and an optional NLP ingredient parsing service.

  • New Features

    • Database picker: File menu with Open and Recent (last 5), plus startup browse prompt if not found; status bar shows DB connection state.
    • About dialog shows version (from git tag).
    • Search results context menu with Analyze and Add to Meal (weight dialog supports grams/oz/lb and serving sizes; adds to Meal Builder; can add to Daily Log); adds search history with autocomplete and deletion.
    • Daily Log tab with prev/next day navigation, today’s entries, calories, and macro progress bars.
    • Preferences dialog with Profile and RDA settings (overrides saved in user DB; %RDA now calculated), plus usage stats and database sizes; adds a general setting for search debounce.
    • Recipe builder: create, edit, and delete recipes; add ingredients from search; load recipes from CSV on startup.
    • Optional Python NLP microservice for ingredient parsing (can be enabled via settings).
  • Refactors

    • CMake: auto-detect version from git or NUTRA_VERSION, define NUTRA_VERSION_STRING, use GNUInstallDirs, generate nutra.desktop from a template with the correct Exec path, add an AppImage build target, and add a libkeyutils linkage workaround for affected systems.
    • Makefile: pass detected version to CMake and add an appimage target; script added for AppImage builds.
    • CI: add a manual version bump workflow (patch/minor/major) that tags releases, and a release build workflow that builds artifacts on tag pushes.
    • Submodules: move usdasqlite to lib/, and add ntsqlite and pylang_serv.
    • Tests: add initial unit tests for calculations, database manager, food repository, and recipes.

Written for commit 8165199. Summary will update on new commits.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 7 files

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 9 files

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 12 files (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="src/db/foodrepository.cpp">

<violation number="1" location="src/db/foodrepository.cpp:152">
P2: This function accesses `m_rdas` without first calling `ensureCacheLoaded()`. If `getFoodNutrients()` is called before the cache is loaded, `m_rdas` will be empty and all RDA percentages will incorrectly be 0.0. Consider adding `ensureCacheLoaded()` at the start of this function, similar to how `searchFoods()` does.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

5 issues found across 31 files (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="src/db/mealrepository.cpp">

<violation number="1" location="src/db/mealrepository.cpp:151">
P2: Missing error handling for `query.exec()`. Unlike `addFoodLog()` and `clearDailyLogs()` which log errors on failure, this will fail silently if the delete operation fails, leaving users unaware that the entry wasn't removed.</violation>
</file>

<file name="src/db/foodrepository.cpp">

<violation number="1" location="src/db/foodrepository.cpp:251">
P2: The return value of `query.prepare()` is not checked before calling `bindValue()` and `exec()`. If prepare fails (e.g., table doesn't exist), the error won't be properly handled. This is inconsistent with other functions in this file that check the prepare result.</violation>
</file>

<file name="src/db/databasemanager.cpp">

<violation number="1" location="src/db/databasemanager.cpp:20">
P2: Resource leak: `m_userDb` is opened in `initUserDatabase()` but never closed in the destructor. Add cleanup for the user database connection.</violation>

<violation number="2" location="src/db/databasemanager.cpp:76">
P1: Missing directory creation: The `~/.nutra/` directory may not exist on first run. SQLite cannot create parent directories, causing `m_userDb.open()` to fail. Use `QDir().mkpath()` to ensure the directory exists.</violation>
</file>

<file name="CMakeLists.txt">

<violation number="1" location="CMakeLists.txt:16">
P2: `file(GLOB_RECURSE ...)` won’t trigger reconfiguration when new files are added unless `CONFIGURE_DEPENDS` is specified, so new sources can be silently omitted from builds. Add `CONFIGURE_DEPENDS` or list sources explicitly.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

4 issues found across 11 files (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name=".github/workflows/version-bump.yml">

<violation number="1" location=".github/workflows/version-bump.yml:99">
P1: `${{ env.NEW_TAG }}` will be empty because environment variables set via `$GITHUB_ENV` are only available in subsequent steps, not the current step. Use the shell variable `$NEW_TAG` directly instead.</violation>
</file>

<file name="src/widgets/searchwidget.cpp">

<violation number="1" location="src/widgets/searchwidget.cpp:102">
P2: The description column is no longer populated, so descItem is null and double-click/context menu actions will no-op. Add the description item back when populating the row.</violation>
</file>

<file name="src/db/mealrepository.cpp">

<violation number="1" location="src/db/mealrepository.cpp:151">
P2: The query has one placeholder, but the new line binds a second parameter. This can break execution with a parameter count mismatch. Remove the extra bind.</violation>
</file>

<file name="src/widgets/dailylogwidget.cpp">

<violation number="1" location="src/widgets/dailylogwidget.cpp:153">
P2: Progress bar color is never reset after exceeding 100%. Once any bar turns purple (when pct > 100), it remains purple even when the percentage later drops below 100%, because the else branch is commented out. The bars should be reset to their original colors when below 100%.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

4 issues found across 13 files (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="src/db/mealrepository.cpp">

<violation number="1" location="src/db/mealrepository.cpp:151">
P2: Binding the same parameter twice for a single placeholder supplies too many bound values, which can make the DELETE fail or behave unexpectedly. Only bind the value once.</violation>
</file>

<file name="src/widgets/dailylogwidget.cpp">

<violation number="1" location="src/widgets/dailylogwidget.cpp:155">
P2: Progress bar color is never reset after exceeding 100%. When `pct` drops back below 100%, the bar remains purple because the style reset is commented out. Consider storing original colors and setting the appropriate color on each update.</violation>
</file>

<file name=".github/workflows/release.yml">

<violation number="1" location=".github/workflows/release.yml:170">
P1: Release step points to artifact paths that don’t include the download directory. The files are downloaded under `artifacts/<name>/...`, so the current paths will fail to resolve and the release will not attach the artifacts.</violation>
</file>

<file name="src/widgets/searchwidget.cpp">

<violation number="1" location="src/widgets/searchwidget.cpp:102">
P2: The Description column is no longer populated; the new block never sets column 1, so search results will show empty descriptions.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

5 issues found across 13 files (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="src/widgets/dailylogwidget.cpp">

<violation number="1" location="src/widgets/dailylogwidget.cpp:153">
P2: Progress bar color is never reset after exceeding 100%. Once `pct > 100` turns the bar purple, it stays purple even when the value drops back below 100% because the reset logic is commented out. The original color should be restored in the else branch.</violation>
</file>

<file name="src/db/mealrepository.cpp">

<violation number="1" location="src/db/mealrepository.cpp:151">
P2: The query only has one placeholder, but you now bind two values. This can cause parameter count mismatch errors or ignore the intended value. Remove the extra bind.</violation>
</file>

<file name=".github/workflows/version-bump.yml">

<violation number="1" location=".github/workflows/version-bump.yml:99">
P0: Environment variable `env.NEW_TAG` is not available in the same step where it's set. Variables written to `$GITHUB_ENV` are only available in subsequent steps. Use the shell variable `$NEW_TAG` directly instead.</violation>
</file>

<file name=".github/workflows/release.yml">

<violation number="1" location=".github/workflows/release.yml:169">
P2: Release assets are referenced without the `artifacts/` prefix even though `download-artifact` extracts under that directory. The release step will not find the files.</violation>
</file>

<file name="src/widgets/searchwidget.cpp">

<violation number="1" location="src/widgets/searchwidget.cpp:102">
P2: The Description column is no longer populated because the new logic omits setting column 1. This leaves the Description column blank in the results table.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 3 files (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="CMakeLists.txt">

<violation number="1" location="CMakeLists.txt:61">
P2: Quote the CMAKE_BINARY_DIR paths in the new file() calls to avoid failures when the build directory contains spaces.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="src/db/databasemanager.cpp">

<violation number="1" location="src/db/databasemanager.cpp:198">
P2: Inline trailing comments after a semicolon (e.g., `...; -- comment`) will now be executed as a separate SQL statement, causing schema init warnings/errors. Keep skipping statements that start with `--`.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 9 files (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="scripts/ci-version-bump.sh">

<violation number="1" location="scripts/ci-version-bump.sh:12">
P2: Flag parsing treats `--tag`/`--push` as the pre-release type when the caller omits the second positional argument (e.g., `minor --tag`), producing malformed tags and skipping the flag behavior. Handle optional pre-release values before shifting/flag parsing.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name=".github/workflows/ci-full.yml">

<violation number="1" location=".github/workflows/ci-full.yml:29">
P1: Downloading and executing AppImages from a moving "continuous" release without checksum/signature verification introduces a supply-chain risk. Pin to a specific release and verify its checksum/signature before executing.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

[appimage/stdout] /home/runner/work/gui/gui/build/AppDir/nutra.desktop: hint: value item "Database" in key "Categories" in group "Desktop Entry" can be extended with another category among the following categories: Office, or Development, or AudioVideo
[appimage/stdout] /home/runner/work/gui/gui/build/AppDir/nutra.desktop: error: value "Utility;Database;Health;" for key "Categories" in group "Desktop Entry" contains an unregistered value "Health"; values extending the format should start with "X-"
[appimage/stderr] appimagetool, continuous build (git version 8c8c91f), build 295 built on 2025-12-04 17:56:36 UTC
[appimage/stderr] ERROR: Desktop file contains errors. Please fix them. Please see
[appimage/stderr]        https://specifications.freedesktop.org/desktop-entry-spec/latest/index.html       for more information.
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.

1 participant

Comments