Skip to content

Master#8

Merged
Magpiny merged 6 commits into
mainfrom
master
Jun 22, 2026
Merged

Master#8
Magpiny merged 6 commits into
mainfrom
master

Conversation

@Magpiny

@Magpiny Magpiny commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Something elegant

Summary by CodeRabbit

  • Chores

    • Updated licensing throughout the project from Apache-2.0 to GNU GPL v3, including refreshed file headers and updated About/License presentation.
    • Updated the README license badge and status badges accordingly.
  • Bug Fixes

    • Improved “New chat” behavior: clears current selection, focuses the new chat button, and reliably resets the chat view.
    • Strengthened session selection handling to prevent invalid loads.
    • Refined prompt submission: empty prompts are ignored, and session creation/reload behavior is more consistent.

Magpiny added 2 commits June 21, 2026 23:58
…enu routing

- Transitioned menu layout identifiers to explicit signed integer constants to eliminate type truncation and prevent stock ID collisions inside GTK layers.
- Resolved right-click assertion failures (`wxIsStockID` and `wxGetStockLabel`) by bypassing system-reserved macro tracking paths.
- Fixed selection event trapping on the "+ New Chat" action button to secure interface responsiveness.
- Enhanced new conversation metadata initialization to synchronize file records seamlessly without requiring an application restart.

TODO:
- Verify multi-byte text rendering consistency across various Linux theme configurations.
- Audit history manager memory footprints during high-throughput local inference streaming.
…enu routing

- Transitioned menu layout identifiers to explicit signed integer constants to eliminate type truncation and prevent stock ID collisions inside GTK layers.
- Resolved right-click assertion failures (`wxIsStockID` and `wxGetStockLabel`) by bypassing system-reserved macro tracking paths.
- Fixed selection event trapping on the "+ New Chat" action button to secure interface responsiveness.
- Enhanced new conversation metadata initialization to synchronize file records seamlessly without requiring an application restart.

TODO:
- Verify multi-byte text rendering consistency across various Linux theme configurations.
- Audit history manager memory footprints during high-throughput local inference streaming.
@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Magpiny, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 53 minutes and 16 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3bd91b7b-70ec-43fa-909e-29a2b5f08f54

📥 Commits

Reviewing files that changed from the base of the PR and between 8f7f4fb and 2a83ce2.

📒 Files selected for processing (1)
  • src/ui/main_frame.cpp
📝 Walkthrough

Walkthrough

The PR relicenses the project from Apache-2.0 to GPL-3.0-or-later by adding the full LICENSE file and updating SPDX headers across all source files. Concurrently, MainFrame and SidebarPanel are refactored: all method names move from PascalCase to snake_case, menu IDs change to wxID_HIGHEST+10..13, the constructor gains app data directory creation with HistoryManager initialization, and a new "New Chat" button is added to SidebarPanel emitting a new EVT_NEW_CHAT_REQUESTED event.

Changes

GPL-3.0 Relicense and README Updates

Layer / File(s) Summary
LICENSE and README badge updates
LICENSE, README.md
Full GPL v3 LICENSE file added with project-specific copyright notice to magpinybo (2026). README replaces the Apache-2.0 badge with GPL v3, adds C++23, Linux, wxWidgets, and CodeRabbit PR review badges, and inserts a "The UI" screenshot subsection.
SPDX header propagation
include/config/config_manager.hpp, include/engine/markdown/pipeline.hpp, include/engine/markdown/syntax_registry.hpp, include/utils/markdown_parser.hpp, src/common/constants.hpp, src/common/types.hpp, src/main.cpp, src/ui/main_frame.hpp, src/ui/sidebar_panel.cpp
All source and header files update top-of-file comment blocks from Apache-2.0 to GPL-3.0-or-later, adding author/date/copyright metadata and SPDX-License-Identifier where previously absent.

UI Refactor: snake_case, Session Management, New Chat Button

Layer / File(s) Summary
Header contracts: renamed methods, new event, MenuId enum
src/ui/main_frame.hpp, src/ui/sidebar_panel.hpp
main_frame.hpp renames all On*/Setup*/Bind* declarations to snake_case, adds <memory> include, and changes MenuId enum values to wxID_HIGHEST+10..13. sidebar_panel.hpp adds EVT_NEW_CHAT_REQUESTED event, declares on_new_chat_click and m_new_chat_btn_ptr, and renames all private methods to snake_case.
MainFrame constructor and initialization
src/ui/main_frame.cpp, src/engine/storage/history_manager.hpp
Constructor computes app_data_dir from $HOME/.local/share/malama with /tmp/malama fallback, creates sessions/ via std::filesystem::create_directories, instantiates m_history_manager_ptr, and calls renamed setup_menu_bar, setup_workspace_layout, and bind_action_events. Menu ID constants are introduced as inline constexpr id_menu_* values. HistoryManager header adds core/models.hpp include.
MainFrame menu setup, layout, and event wiring
src/ui/main_frame.cpp
setup_menu_bar uses id_menu_* constants with nothrow null checks for wxMenuBar/menu allocations, appending Settings, Exit, Licence, and About entries. setup_workspace_layout creates wxSplitterWindow with nothrow and early-returns if null before constructing sidebar/chat panels. bind_action_events rewires all menu and custom event bindings to lowercased handlers using id_menu_* IDs. on_load_session reads session ID from the event, sets m_current_session_id, and loads chat history.
MainFrame dialog handlers and user prompt submission
src/ui/main_frame.cpp
Dialog handlers (on_preferences_action, on_exit_action, on_about_action, on_licence_action) are renamed with updated display strings (Licence message now displays GNU GPL v3.0). on_user_prompt_submitted early-aborts if history manager is null or prompt is empty; when no current session exists, creates a new session, sets m_current_session_id, re-creates HistoryManager with recomputed app_data_dir, and repopulates sidebar. Invokes m_on_prompt_submit_callback only if set. on_new_chat_action clears m_current_session_id and resets chat panel to empty core::ChatSession{}.
SidebarPanel layout, binding, and population
src/ui/sidebar_panel.cpp
EVT_NEW_CHAT_REQUESTED event is declared; context-menu ID enum is replaced with inline constexpr int constants. setup_layout constructs the "+ New Chat" button with color theming. bind_events adds early-return null guards. populate_sidebar clears the list, resets m_active_metadata, applies list foreground/background colors, and repopulates session metadata with pinned/title formatting.
SidebarPanel session selection, new chat, and context menu
src/ui/sidebar_panel.cpp
on_new_chat_click clears list selection and sets focus before emitting EVT_NEW_CHAT_REQUESTED. on_session_selected validates index against m_active_metadata.size(). on_context_menu checks manager and selection presence before constructing menu. Context menu construction uses new constexpr IDs for pin/rename/delete; delete handler emits EVT_NEW_CHAT_REQUESTED after repopulating the sidebar to reset UI state.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant SidebarPanel
  participant MainFrame
  participant HistoryManager
  participant ChatPanel

  rect rgba(100, 149, 237, 0.5)
    Note over User, SidebarPanel: New Chat Flow
    User->>SidebarPanel: Click "+ New Chat"
    SidebarPanel->>SidebarPanel: on_new_chat_click() — clear selection
    SidebarPanel->>MainFrame: EVT_NEW_CHAT_REQUESTED
    MainFrame->>MainFrame: on_new_chat_action() — clear session ID
    MainFrame->>ChatPanel: load_history(empty ChatSession)
  end

  rect rgba(144, 238, 144, 0.5)
    Note over User, ChatPanel: First Prompt in New Session
    User->>MainFrame: EVT_USER_PROMPT
    MainFrame->>MainFrame: on_user_prompt_submitted()
    MainFrame->>HistoryManager: re-create with app_data_dir
    MainFrame->>HistoryManager: CreateSession(title)
    MainFrame->>SidebarPanel: populate_sidebar()
    MainFrame->>HistoryManager: AppendMessage(session_id, message)
    MainFrame->>ChatPanel: m_on_prompt_submit_callback() if set
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Magpiny/malama#3: Introduced SidebarPanel/ChatPanel and the splitter-based workspace in MainFrame; this PR directly renames those same methods and updates their wiring.
  • Magpiny/malama#7: Modified SidebarPanel session pinning/metadata UI in the same src/ui/sidebar_panel.hpp/.cpp files being refactored here.
  • Magpiny/malama#5: Introduced the EVT_USER_PROMPT / OnUserPromptSubmitted flow that this PR renames to on_user_prompt_submitted and rewrites for new session creation.

Suggested labels

enhancement

🐇 Hoppity hop, the license has changed,
From Apache to GPL, all rearranged!
Snake_case methods now slither with grace,
A "New Chat" button has found its place.
The sessions directory springs up fresh and neat —
What a tidy little warren, how discreet! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Master' is vague and generic, providing no meaningful information about the changeset. It fails to describe the primary changes (license migration to GPL v3, method naming refactoring, or UI improvements). Replace the title with a clear, specific summary of the main changes, such as 'Migrate license to GPL-3.0 and refactor method naming conventions' or similar.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch master

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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 10

🧹 Nitpick comments (2)
README.md (1)

6-8: 🧹 Nitpick | 🔵 Trivial | 💤 Low value

Consider adding target URLs for badge links or using plain text badges.

The C++23, Platform, and wxWidgets badges have empty link targets (href="#"), which markdownlint flags as no-empty-links. If these are informational-only badges without documentation targets, you can either:

  • Use plain badge images without links: ![C++23](https://img.shields.io/badge/...)
  • Add relevant documentation URLs (e.g., C++ standard docs, wxWidgets docs)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` around lines 6 - 8, The C++23, Platform: Linux, and wxWidgets
badges have empty link targets (href="#"), which markdownlint flags as
no-empty-links violations. To fix this, either remove the link syntax entirely
from these three badges to make them plain image badges without hyperlinks, or
replace the empty link targets with actual relevant documentation URLs such as
C++ standard references for the C++23 badge, platform-specific resources for the
Linux badge, and the official wxWidgets documentation for the UI badge.

Source: Linters/SAST tools

src/ui/main_frame.cpp (1)

31-34: 🧹 Nitpick | 🔵 Trivial

Remove the unused MenuId enum from the header.

The header defines enum class MenuId with values wxID_HIGHEST + 10..13, but the implementation uses inline constexpr constants id_menu_preferences (12001), id_menu_exit (12002), id_menu_about (12003), and id_menu_licence (12004). The enum is never referenced anywhere in the codebase and serves no purpose. Either remove it or consolidate on a single definition.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/ui/main_frame.cpp` around lines 31 - 34, The header file contains an
unused enum class MenuId that defines menu ID values using wxID_HIGHEST offsets,
but the actual implementation uses inline constexpr constants
(id_menu_preferences, id_menu_exit, id_menu_about, id_menu_licence) instead.
Remove the unused enum class MenuId definition from the header file since it is
never referenced anywhere in the codebase and the constexpr constants are the
single source of truth for menu identifiers. Verify that all menu ID usages
throughout the implementation reference the appropriate constexpr constant
names.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@include/config/config_manager.hpp`:
- Line 9: The SPDX-License-Identifier comment on line 9 of
include/config/config_manager.hpp declares GPL-3.0, but the license declaration
on line 6 states GPL-3.0-or-later. These are legally distinct licenses where
GPL-3.0 means only version 3 while GPL-3.0-or-later means version 3 or any later
version. Update the SPDX-License-Identifier from GPL-3.0 to GPL-3.0-or-later to
match the license declaration and ensure legal consistency.

In `@include/engine/markdown/pipeline.hpp`:
- Line 10: The SPDX license identifier on line 10 must be updated to match the
license declaration. Change the SPDX-License-Identifier from GPL-3.0 to
GPL-3.0-or-later to accurately reflect that the code is licensed under GPL
version 3 or later versions, as stated in the license declaration on line 7.

In `@include/engine/markdown/syntax_registry.hpp`:
- Line 10: The SPDX-License-Identifier tag on the line containing "//
SPDX-License-Identifier: GPL-3.0" does not match the license declaration
elsewhere in the file. Update the SPDX identifier from "GPL-3.0" to
"GPL-3.0-or-later" to align with the declared license text, as
"GPL-3.0-or-later" and "GPL-3.0" are semantically different and compliance
tooling relies on the SPDX identifier for accuracy.

In `@include/utils/markdown_parser.hpp`:
- Line 10: The SPDX-License-Identifier tag on line 10 declares "GPL-3.0" but the
Licence field on line 7 declares "GPL-3.0-or-later". These are semantically
different licenses and create a compliance mismatch. Update the
SPDX-License-Identifier tag to match the Licence field by changing it from
"GPL-3.0" to "GPL-3.0-or-later" to ensure consistency and proper license
compliance scanning.

In `@LICENSE`:
- Line 1: Replace the placeholder text in the LICENSE file copyright line that
currently reads `Copyright (C) <year> <name of author>` with the actual
copyright information referenced in lines 184-185 and 197 of the project. Update
the `<year>` and `<name of author>` placeholders with the correct year and
copyright holder name as specified in those reference lines.

In `@src/common/constants.hpp`:
- Line 7: The SPDX-License-Identifier declaration does not match the Licence
field in the file header. The Licence field has been updated to
"GPL-3.0-or-later", but the SPDX-License-Identifier still declares "Apache-2.0".
Update the SPDX-License-Identifier on the first line of the file to change
"Apache-2.0" to "GPL-3.0-or-later" to ensure consistency between the two license
declarations.

In `@src/engine/storage/history_manager.hpp`:
- Line 14: Remove the duplicate `#include` "core/models.hpp" directive from the
file since this header is already included elsewhere. Having the same include
statement appear multiple times is redundant and increases compile time
unnecessarily. Delete the duplicate `#include` "core/models.hpp" occurrence to
clean up the includes and maintain a single instance of each required header
file.

In `@src/ui/main_frame.cpp`:
- Around line 51-52: Rename the error_code variable `ec` to a longer, more
descriptive name such as `session_dir_error` or `creation_error` to comply with
readability standards. After the create_directories call that uses this renamed
error code variable, add a check to inspect whether the error code was set, and
if it was, log an appropriate error message to indicate that the sessions
directory creation failed. This ensures silent failures are caught and logged
rather than leaving the application in a broken state.
- Around line 185-188: Instead of destroying and recreating
m_history_manager_ptr after CreateSession returns, add a RefreshIndex() method
to the HistoryManager class that reloads the in-memory session index from disk.
After CreateSession completes, call m_history_manager_ptr->RefreshIndex() to
synchronize the existing manager's state. Additionally, remove the duplicate
app_data_dir computation by storing it as a member variable in the MainFrame
constructor and reusing it rather than recomputing the path with
std::getenv("HOME") at this location.
- Around line 172-179: Add braces around the single-statement blocks in the if
conditions (m_history_manager_ptr == nullptr check and prompt_text.empty()
check) to comply with coding standards. Additionally, extract the magic number
25 used in the prompt_text.substr operation as a named constant (e.g.,
MAX_SESSION_TITLE_LENGTH or similar) and use that constant instead of the
hardcoded value to improve code maintainability and clarity.

---

Nitpick comments:
In `@README.md`:
- Around line 6-8: The C++23, Platform: Linux, and wxWidgets badges have empty
link targets (href="#"), which markdownlint flags as no-empty-links violations.
To fix this, either remove the link syntax entirely from these three badges to
make them plain image badges without hyperlinks, or replace the empty link
targets with actual relevant documentation URLs such as C++ standard references
for the C++23 badge, platform-specific resources for the Linux badge, and the
official wxWidgets documentation for the UI badge.

In `@src/ui/main_frame.cpp`:
- Around line 31-34: The header file contains an unused enum class MenuId that
defines menu ID values using wxID_HIGHEST offsets, but the actual implementation
uses inline constexpr constants (id_menu_preferences, id_menu_exit,
id_menu_about, id_menu_licence) instead. Remove the unused enum class MenuId
definition from the header file since it is never referenced anywhere in the
codebase and the constexpr constants are the single source of truth for menu
identifiers. Verify that all menu ID usages throughout the implementation
reference the appropriate constexpr constant names.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3995bb57-d668-4cbe-bfe8-9d52ee946398

📥 Commits

Reviewing files that changed from the base of the PR and between 16b0b1d and c01114d.

⛔ Files ignored due to path filters (3)
  • assets/malama.png is excluded by !**/*.png
  • assets/malama_48x48.png is excluded by !**/*.png
  • assets/malama_icon.png is excluded by !**/*.png
📒 Files selected for processing (14)
  • LICENSE
  • README.md
  • include/config/config_manager.hpp
  • include/engine/markdown/pipeline.hpp
  • include/engine/markdown/syntax_registry.hpp
  • include/utils/markdown_parser.hpp
  • src/common/constants.hpp
  • src/common/types.hpp
  • src/engine/storage/history_manager.hpp
  • src/main.cpp
  • src/ui/main_frame.cpp
  • src/ui/main_frame.hpp
  • src/ui/sidebar_panel.cpp
  • src/ui/sidebar_panel.hpp

Comment thread include/config/config_manager.hpp Outdated
Comment thread include/engine/markdown/pipeline.hpp Outdated
Comment thread include/engine/markdown/syntax_registry.hpp Outdated
Comment thread include/utils/markdown_parser.hpp Outdated
Comment thread LICENSE Outdated
Comment thread src/common/constants.hpp
Comment thread src/engine/storage/history_manager.hpp Outdated
Comment thread src/ui/main_frame.cpp Outdated
Comment thread src/ui/main_frame.cpp Outdated
Comment thread src/ui/main_frame.cpp
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Note

Docstrings generation - SUCCESS
Generated docstrings for this pull request at #9

Docstrings generation was requested by @Magpiny.

* #8 (comment)

The following files were modified:

* `src/ui/main_frame.cpp`
* `src/ui/sidebar_panel.cpp`
* `src/ui/sidebar_panel.hpp`
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 8 file(s) based on 10 unresolved review comments.

Files modified:

  • LICENSE
  • include/config/config_manager.hpp
  • include/engine/markdown/pipeline.hpp
  • include/engine/markdown/syntax_registry.hpp
  • include/utils/markdown_parser.hpp
  • src/common/constants.hpp
  • src/engine/storage/history_manager.hpp
  • src/ui/main_frame.cpp

Commit: 30d70677fbc3755a9c24f2ecb6f12283b6d57ce4

The changes have been pushed to the master branch.

Time taken: 2m 21s

coderabbitai Bot and others added 2 commits June 22, 2026 02:54
Fixed 8 file(s) based on 10 unresolved review comments.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/ui/main_frame.cpp`:
- Line 131: Remove the stray XML closing tag `</function_to_document>` that
appears on line 131 in the main_frame.cpp file. This is not valid C++ syntax and
is breaking compilation. Simply delete this entire line as it appears to be
leftover documentation markup that was accidentally included in the source code.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d4d5d4bc-ae55-48e1-a888-5a8e65e15e26

📥 Commits

Reviewing files that changed from the base of the PR and between 30d7067 and 8f7f4fb.

📒 Files selected for processing (3)
  • src/ui/main_frame.cpp
  • src/ui/sidebar_panel.cpp
  • src/ui/sidebar_panel.hpp
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/ui/sidebar_panel.hpp
  • src/ui/sidebar_panel.cpp

Comment thread src/ui/main_frame.cpp Outdated
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@Magpiny Magpiny merged commit fc2ded4 into main Jun 22, 2026
2 checks passed
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