Skip to content

fix(macro): ignore Add with nothing chosen in the macro builder - #2125

Merged
chhoumann merged 1 commit into
masterfrom
2122-macro-builder-add-with-nothing-chosen-shows-error-notices
Oct 1, 2026
Merged

chhoumann merged 1 commit into
masterfrom
2122-macro-builder-add-with-nothing-chosen-shows-error-notices

Conversation

@chhoumann

@chhoumann chhoumann commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

In the Macro builder, clicking Add in the Obsidian command, Editor commands or Choices row before choosing anything now does nothing. Before, it showed error notices: two for Editor commands ("invalid editor command type" and "A QuickAdd action failed: invalid editor command type") plus an uncaught console error, Could not find Obsidian command with name "" for Obsidian command, and No choice named "". for Choices. The User scripts row already behaved this way.

Found in a fresh-vault pass of "Set up your first macro": step 3 says "Add an Editor commands entry and choose Move cursor to file end", so clicking Add first is a natural move on someone's first macro.

Repro (master 6082143 and 2.29.0, Obsidian 1.13.7): Settings > QuickAdd > New choice > Macro, click Add in the Editor commands row. With this branch, real Obsidian shows no notice and dev:errors stays empty for all three rows; choosing "Copy" and clicking Add still adds the step, and a typed name that matches nothing still reports it.

The test stub's DropdownComponent gains getValue(), which Obsidian's has; the new test needs it.

Checks: pnpm run build-with-lint, pnpm run test (6604 passed), .agents/run-e2e on a clean vault (397 passed, 24 Templater-only skipped). No release or migration impact.

Fixes #2122

Note

Ignore empty Add input in macro builder's CommandSequenceEditor

Adds early returns so the Obsidian-command, editor-command, and Choice Add controls do nothing when their input is empty, whitespace-only, or unselected. Previously these Add clicks could modify the command sequence. Adds a regression test in CommandSequenceEditor.audit-macro.test.ts asserting no callback, notice, or error fires on empty Add clicks, and exposes DropdownComponent.getValue in the test stub.

Macroscope summarized 9c658c6.

Summary by CodeRabbit

  • Bug Fixes
    • Prevented blank or whitespace-only selections from being added as commands.
    • Avoided error logs and missing-choice notices when adding a command without a selection.

Clicking Add in the Obsidian command, Editor commands or Choices row
before picking anything showed error notices (two for Editor commands,
plus an uncaught error). It now does nothing, as the User scripts row
already did.

Fixes #2122
@chhoumann chhoumann linked an issue Oct 1, 2026 that may be closed by this pull request
@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 74ce22eb-6c69-4781-8ca2-76e72d21735f

📥 Commits

Reviewing files that changed from the base of the PR and between 6082143 and 9c658c6.

📒 Files selected for processing (3)
  • src/gui/MacroGUIs/CommandSequenceEditor.audit-macro.test.ts
  • src/gui/MacroGUIs/CommandSequenceEditor.ts
  • tests/obsidian-stub.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The command-sequence editor now ignores empty or whitespace-only input for Obsidian commands, editor commands, and choices. A regression test checks that clicking Add with no selection produces no command, notice, or error log.

Changes

Empty command selection handling

Layer / File(s) Summary
Guard empty command inputs
src/gui/MacroGUIs/CommandSequenceEditor.ts, tests/obsidian-stub.ts, src/gui/MacroGUIs/CommandSequenceEditor.audit-macro.test.ts
The three handlers return when their input is empty or whitespace-only. The dropdown stub exposes its current value. The regression test checks that Add with no selection does not add a command, show a notice, or log an error.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 9c658

Empty Add clicks leave the macro unchanged without errors, while selected items still follow the existing add path. No actionable merge risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: the macro builder ignores Add actions when no item is selected.
Linked Issues check ✅ Passed Issue #2122 requires Add with no selection to do nothing for Editor commands, Obsidian command, and Choices. src/gui/MacroGUIs/CommandSequenceEditor.ts now returns for blank or whitespace-only input…
Out of Scope Changes check ✅ Passed The changes are limited to the three Macro builder handlers, regression tests, and the test stub method required to read dropdown values. These changes directly support Issue #2122 and do not show unr…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3…
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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

A rabbit taps Add, then waits,
No choice? No errors at the gates.
The empty fields stay still,
No notice sounds its shrill,
Three quiet controls, and all is well.

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

@chhoumann
chhoumann marked this pull request as ready for review October 1, 2026 14:01
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-01T14:03:03.161415Z 9c658c6 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chhoumann
chhoumann merged commit 5d7dc79 into master Oct 1, 2026
15 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.

Macro builder: Add with nothing chosen shows error notices

1 participant