Skip to content

feat: move display Godley table variable values as an attribute of Go…#662

Merged
highperformancecoder merged 5 commits into
masterfrom
ture-194-show-values-as-intrinsic
May 29, 2026
Merged

feat: move display Godley table variable values as an attribute of Go…#662
highperformancecoder merged 5 commits into
masterfrom
ture-194-show-values-as-intrinsic

Conversation

@highperformancecoder
Copy link
Copy Markdown
Owner

@highperformancecoder highperformancecoder commented May 29, 2026

…dleyIcon rather than system preference. For feature #194.


This change is Reviewable

Summary by CodeRabbit

  • Chores

    • Removed the global "Godley Table Show Values" preference and its checkbox from Preferences.
  • New Features

    • Each Godley table now has its own "Show values" toggle saved with the model; toggling refreshes the canvas and popups immediately.
  • Bug Fixes

    • Preferences now only manage the Godley table output style; related preference handling and UI have been simplified.

Review Change Stack

…dleyIcon rather than system preference. For feature #194.
Copilot AI review requested due to automatic review settings May 29, 2026 04:21
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 29, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a128e5b4-da94-46f1-a7b2-09d19b33cbcc

📥 Commits

Reviewing files that changed from the base of the PR and between 2d94995 and cbbd7b7.

📒 Files selected for processing (4)
  • gui-js/apps/minsky-electron/src/app/managers/StoreManager.ts
  • model/minsky.cc
  • model/minsky.h
  • test/00/godleyTableWindow.sh
💤 Files with no reviewable changes (3)
  • model/minsky.h
  • gui-js/apps/minsky-electron/src/app/managers/StoreManager.ts
  • model/minsky.cc

📝 Walkthrough

Walkthrough

This PR refactors the Godley table display-values setting from a global Minsky property to a per-icon GodleyIcon property, updating model, serialization, TypeScript wrappers, preferences UI, command/context handlers, and tests accordingly.

Changes

Godley Table Display Values Refactoring

Layer / File(s) Summary
Core C++ model refactoring
model/godleyIcon.h, model/minsky.h, model/minsky.cc, model/godleyTableWindow.cc, model/godleyTableWindow.h
GodleyIcon gains a displayValues boolean member (default false) and inline toggleDisplayValues() method. Minsky loses the displayValues member and setGodleyDisplayValue() method declaration/implementation. Table rendering in GodleyTableEditor::draw() now reads m_godleyIcon.displayValues instead of the global cminsky().displayValues for both standard and initial-condition-row value rendering.
Backend TypeScript API wrappers
gui-js/libs/shared/src/lib/backend/minsky.ts
GodleyIcon wrapper class gains displayValues() and toggleDisplayValues() methods delegating to $callMethod. Minsky wrapper class loses displayValues() and setGodleyDisplayValue() method wrappers.
Serialization schema updates
schema/schema3.h, schema/schema3.cc
schema3::Item struct adds optional displayValues boolean field. Constructor from GodleyIcon now initializes this field. populateItem() adds toggle logic to apply the serialized displayValues state during deserialization.
Remove global preference UI
gui-js/apps/minsky-electron/src/app/managers/StoreManager.ts, gui-js/libs/menu/src/lib/options/preferences/preferences.component.html, gui-js/libs/menu/src/lib/options/preferences/preferences.component.ts
MinskyPreferences interface removes godleyTableShowValues. Electron-store defaults remove the corresponding preference. Preferences template removes the "Godley Table Show Values" checkbox and the reactive form removes that control.
Update command handlers and context menus
gui-js/apps/minsky-electron/src/app/managers/CommandsManager.ts, gui-js/apps/minsky-electron/src/app/managers/GodleyMenuManager.ts, gui-js/apps/minsky-electron/src/app/managers/ContextMenuManager.ts
CommandsManager.applyPreferences() no longer reads godleyTableShowValues and replaces the setGodleyDisplayValue() call with displayStyle(). GodleyMenuManager.setGodleyPreferences() removes handling for godleyTableShowValues and updates minsky.displayStyle/minsky.multipleEquities only. ContextMenuManager checkbox handlers become async, awaiting toggleVariableDisplay()/toggleDisplayValues() and then calling minsky.canvas.requestRedraw().
sequenceDiagram
  participant ContextMenu
  participant GodleyIcon
  participant Canvas
  ContextMenu->>GodleyIcon: toggleDisplayValues()
  GodleyIcon-->>ContextMenu: done
  ContextMenu->>Canvas: requestRedraw()
Loading

"I’m a rabbit with a patch and a sprocket,
I hop on icons and give values a docket,
Per-icon they sparkle, no global more,
Saved and serialized, then shown at the core,
Hooray — redraw the canvas, let pixels rocket! 🐰✨"

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 36.36% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main architectural change: moving the Godley table display values setting from a system-level preference to a GodleyIcon-level attribute.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ture-194-show-values-as-intrinsic

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Moves the “show values” toggle for Godley tables from a global Minsky preference into a per-GodleyIcon attribute, persists it via schema 3, and surfaces it as a per-icon context menu checkbox while removing the global preferences UI/store entry. The Godley table output style (DRCR vs sign) remains a global setting.

Changes:

  • Add GodleyIcon::displayValues + toggleDisplayValues(), persist via schema3::Item, update popup rendering to read from the icon.
  • Remove global Minsky::displayValues and setGodleyDisplayValue, plus the GUI preferences form/HTML/store entry for godleyTableShowValues; rewire GodleyMenuManager/CommandsManager to use minsky.displayStyle().
  • Expose displayValues/toggleDisplayValues in the TS backend wrapper and add a per-icon “Display values” item to the Godley context menu.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
model/godleyIcon.h Adds per-icon displayValues field and toggle.
model/godleyTableWindow.cc Reads display flag from owning GodleyIcon instead of global.
model/godleyTableWindow.h Adds explanatory comment for godleyIcon() accessor.
model/minsky.h Removes global displayValues member; comments out setGodleyDisplayValue declaration.
model/minsky.cc Comments out old setGodleyDisplayValue implementation.
schema/schema3.h Adds displayValues to schema and pack constructor.
schema/schema3.cc Unpacks displayValues via toggleDisplayValues.
gui-js/libs/shared/src/lib/backend/minsky.ts Moves displayValues/adds toggleDisplayValues from Minsky to GodleyIcon; drops setGodleyDisplayValue.
gui-js/libs/menu/.../preferences.component.ts/.html Removes global godleyTableShowValues form control & UI.
gui-js/apps/minsky-electron/.../StoreManager.ts Comments out godleyTableShowValues from persisted preferences.
gui-js/apps/minsky-electron/.../GodleyMenuManager.ts Drops godleyTableShowValues branch; switches output-style to minsky.displayStyle().
gui-js/apps/minsky-electron/.../CommandsManager.ts Drops godleyTableShowValues from applyPreferences.
gui-js/apps/minsky-electron/.../ContextMenuManager.ts Adds per-icon “Display values” menu item; redraws canvas on toggle.

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

Comment on lines +694 to +697
click: async () => {
await godley.toggleDisplayValues();
await minsky.canvas.requestRedraw();
},
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Popups no longer use this code, but rather HTML table rendering.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

I should remove the no longer used popup member, but that is for a later refactor.

Comment thread gui-js/apps/minsky-electron/src/app/managers/ContextMenuManager.ts Outdated
Copy link
Copy Markdown
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: 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 `@model/godleyIcon.h`:
- Around line 86-88: toggleDisplayValues currently only flips the displayValues
flag and doesn't trigger a visual update; update toggleDisplayValues() in
GodleyIcon to call the popup redraw path after flipping the flag (e.g., if the
associated popup/window for this Godley table exists/is open, call
popup.requestRedraw() or the equivalent method used elsewhere to force a
repaint) so open popups immediately reflect the change.
🪄 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: 5ab76cab-6ee1-4eb9-9761-e1d02f499a8a

📥 Commits

Reviewing files that changed from the base of the PR and between 57b1135 and 6e7cf4d.

📒 Files selected for processing (14)
  • gui-js/apps/minsky-electron/src/app/managers/CommandsManager.ts
  • gui-js/apps/minsky-electron/src/app/managers/ContextMenuManager.ts
  • gui-js/apps/minsky-electron/src/app/managers/GodleyMenuManager.ts
  • gui-js/apps/minsky-electron/src/app/managers/StoreManager.ts
  • gui-js/libs/menu/src/lib/options/preferences/preferences.component.html
  • gui-js/libs/menu/src/lib/options/preferences/preferences.component.ts
  • gui-js/libs/shared/src/lib/backend/minsky.ts
  • model/godleyIcon.h
  • model/godleyTableWindow.cc
  • model/godleyTableWindow.h
  • model/minsky.cc
  • model/minsky.h
  • schema/schema3.cc
  • schema/schema3.h
💤 Files with no reviewable changes (2)
  • gui-js/libs/menu/src/lib/options/preferences/preferences.component.ts
  • gui-js/libs/menu/src/lib/options/preferences/preferences.component.html

Comment thread model/godleyIcon.h
Comment on lines +86 to +88
/// whether to display values in this table
bool displayValues=false;
void toggleDisplayValues() {displayValues=!displayValues;}
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot May 29, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Redraw the popup when this flag changes.

toggleDisplayValues() only flips the bit. If this Godley table is already open in its popup window, it will keep showing the old rendering until some unrelated event triggers popup.requestRedraw(). The previous global path handled that redraw, so this refactor regresses live updates for open tables unless the per-icon toggle path does it too.

Suggested fix
-    void toggleDisplayValues() {displayValues=!displayValues;}
+    void toggleDisplayValues()
+    {
+      displayValues=!displayValues;
+      popup.requestRedraw();
+    }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/// whether to display values in this table
bool displayValues=false;
void toggleDisplayValues() {displayValues=!displayValues;}
/// whether to display values in this table
bool displayValues=false;
void toggleDisplayValues()
{
displayValues=!displayValues;
popup.requestRedraw();
}
🤖 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 `@model/godleyIcon.h` around lines 86 - 88, toggleDisplayValues currently only
flips the displayValues flag and doesn't trigger a visual update; update
toggleDisplayValues() in GodleyIcon to call the popup redraw path after flipping
the flag (e.g., if the associated popup/window for this Godley table exists/is
open, call popup.requestRedraw() or the equivalent method used elsewhere to
force a repaint) so open popups immediately reflect the change.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Popups no longer use this code. I'll add a ticket to refactor this member away.

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.

@highperformancecoder, thanks for the clarification — that makes sense. Would you like me to open a GitHub issue to track the refactoring of the popup member away from this code path?

highperformancecoder and others added 4 commits May 29, 2026 14:28
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…rformancecoder/minsky into ture-194-show-values-as-intrinsic
@highperformancecoder highperformancecoder merged commit 0404fbd into master May 29, 2026
7 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.

2 participants