Skip to content

Menu bar fixes and additions; tests for untested code - #50

Merged
aleksandrychev merged 13 commits into
cfengine:mainfrom
aleksandrychev:fixes
Oct 13, 2026
Merged

aleksandrychev merged 13 commits into
cfengine:mainfrom
aleksandrychev:fixes

Conversation

@aleksandrychev

Copy link
Copy Markdown
Collaborator

Menu bar

Fixes:

  • ⌘R no longer drops unsaved work. Reload, Force Reload and DevTools are only in development builds; the reload skipped the unsaved-changes prompt.
  • The Edit menu acts on the canvas. The built-in Edit menu only edited text, so clicking Undo, Copy or Paste did nothing to blocks. Its items now go to the project view, which runs them on the canvas, or natively on the focused text field.

Additions:

  • File: Reload from Disk, Close Project, Show Project in Finder / Show Project Folder, each enabled only when it applies. Close and Reload ask about unsaved changes first.
  • Open Recent lists projects by folder (~/…) as VS Code does, keeps up to 10, and asks before clearing.
  • Edit: Delete, Select All, Group, Ungroup.
  • View: the four tabs on ⌘1–⌘4, zoom, Tidy Up, Toggle Maximized Canvas.
  • Help: Keyboard Shortcuts dialog, documentation and issue links, About on Windows/Linux.

The menu items were checked by clicking them through Electron's Menu API in the built app. Keyboard shortcuts couldn't be tested that way (Playwright's keys don't reach the native menu), so please try ⌘Z / ⌘C / ⌘V on the canvas and in a text field, and ⌘1–⌘4, with a real keyboard: one ⌘Z should undo one step.

Tests

For code nothing tested before:

  • the unsaved-changes prompt: Cancel, Don't Save, a Save that succeeds or fails, Reload from Disk, closing the window;
  • the main process's guards: external links (http/https only), navigation, IPC from other origins or iframes, and argument validation;
  • MCP canvas tools: overview, generated policy, remove, connect (and its refusals), disconnect, tidy;
  • moving files and folders; menu command routing (moved out of ProjectView into routeProjectCommand);
  • Python: read_dotenv, _compliance.

test:coverage now includes the integration tests, so Codecov sees the hub, git and sidecar code that is tested against a fake hub, real git and the real sidecar (hub.ts 73% → 100%). The coverage job now installs the sidecar with uv, like the integration job.

🤖 Generated with Claude Code

aleksandrychev and others added 13 commits October 13, 2026 11:30
⌘R reloaded the window and dropped unsaved changes without asking.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
The built-in Edit menu only edited text, so clicking Undo, Copy or Paste
did nothing to blocks. Its items now go to the project view, which runs
them on the canvas, or back to main for the focused text field. Adds
Delete, Select All, Group and Ungroup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
Entries show the folder (home as ~), so two projects with the same name
are told apart; the name is the tooltip. The menu keeps up to 10, the
start screen still shows 5, and Clear Recently Opened asks first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
Close Project goes back to the start screen, resetting every slice and
the undo history. Save, Close and Project Settings are enabled only with
a project open, Reload from Disk and Show Project Folder only when it has
a folder; the renderer reports both with the window's document state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
⌘1–⌘4 open the project's tabs. The zoom items show the shortcuts the
canvas already handles, so they are not registered a second time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
About is in it on Windows and Linux; macOS has it in the app menu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
Cancel, Don't Save, a Save that succeeds and one that fails, and that
closing a project leaves a store like a fresh one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
External links open only for http(s), navigation never leaves the app,
IPC from another origin or an iframe is refused, and native edits,
document state, layout settings and imported text are validated. Also
that a packaged View menu has no Reload or DevTools.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
…and layout

get_project_overview, get_generated_policy, remove_block, connect and its
refusals, disconnect and tidy_file, each change one undo step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
How an Edit or View menu click reaches the canvas (or the focused text
field) was inline in ProjectView; routeProjectCommand now decides it from
the view's state and actions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
The hub, git and sidecar code is tested against a fake hub, real git and
the real sidecar, which Codecov never saw: hub.ts read 73%, it's 100%.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ihor Aleksandrychiev <ihor.aleksandrychiev@northern.tech>
@aleksandrychev
aleksandrychev merged commit 8f2e034 into cfengine:main Oct 13, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant