Skip to content

Refresh PR #881 against upstream master#19

Closed
kendonB wants to merge 4 commits into
masterfrom
pr-881
Closed

Refresh PR #881 against upstream master#19
kendonB wants to merge 4 commits into
masterfrom
pr-881

Conversation

@kendonB

@kendonB kendonB commented Mar 24, 2026

Copy link
Copy Markdown
Owner

This updates the old dictation-toolbox#881 work on top of current upstream/master.

What remains from the original PR:

  • title-based window switch <windows>
  • window switch show
  • a shared messaging-window helper used by the status-window code

What was dropped as redundant with upstream/master:

  • older restore-window changes already present upstream
  • older inline Natlink status-window handling that upstream has since rewritten

Verification:

  • formatted the touched files with yapf
  • py_compile passed for the touched files
  • pylint -E passed for the touched files
  • full tests/testrunner.py was not runnable here because the available local Python is 3.14 and upstream dragonfly2 still relies on inspect.getargspec

Note

Medium Risk
Medium risk because it introduces a new background timer/window-enumeration path for navigation commands and changes dependency/version detection logic, which may behave differently across platforms/environments.

Overview
Adds voice commands for keyword-driven window switching (e.g., window switch <windows> and window switch show) backed by a new window_mgmt_rule_support.py that maintains a live DictList of open windows via a Dragonfly timer and handles ambiguous/no-match cases.

Reworks dependency detection in dependencies.py to use importlib.metadata/packaging.version instead of pkg_resources, updates formatting activation handling to clear formats on deactivation, and makes EngineModesManager tolerate missing get_current_engine() (defaulting to text) with corresponding test harness initialization (tests/conftest.py, test setup).

Written by Cursor Bugbot for commit df3c3fd. This will update automatically on new commits. Configure here.

Replace deprecated pkg_resources with importlib.metadata for package
detection and version checking in dependencies.py.
* Fix EngineModesManager test failures

- Handle get_current_engine() returning None in constructor
- Move manager creation from class scope to setUp for test isolation
- Add conftest.py to initialize dragonfly text engine for pytest
…dictation-toolbox#957)

FormattingHook.run() treated the event as a dictionary, but
HooksRunner passes a RuleActivationEvent object. Access
event.rule_class_name and event.active attributes instead.
_apply_format(pronunciation)
def run(self, event):
if event.active:
_apply_format(event.rule_class_name)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Format hook uses class name instead of pronunciation

High Severity

_apply_format(event.rule_class_name) passes the Python class name (e.g., "CPP", "CSharp", "SQL", "Matlab") to _apply_format, but settings.SETTINGS["formats"] is keyed by pronunciation strings (e.g., "C plus plus", "C sharp", "sequel", "matlab"). For any rule where the class name differs from the pronunciation, the lookup silently fails and text formatting is cleared instead of being applied.

Fix in Cursor Fix in Web

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 63541e38b8

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 39 to +41
dep = dep.split(">=", 1)[0]
try:
pkg_resources.require("{}".format(dep))
except VersionConflict:
pass
except DistributionNotFound:
missing_list.append('{0}'.format(dep))
version(dep)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Normalize requirement names before calling metadata lookup

dep_missing() now passes raw requirement strings to importlib.metadata.version(), but only strips ">=" first. Entries like pillow==9.5.0 in requirements.txt and dragonfly2[kaldi] in requirements-mac-linux.txt are not valid distribution names for version(), so they are always treated as missing even when installed. In classic installs this causes persistent false missing-dependency warnings (and the 10-second sleep) on every startup.

Useful? React with 👍 / 👎.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

missing_list.append('{0}'.format(dep))
version(dep)
except PackageNotFoundError:
missing_list.append(dep)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Version specifier not stripped from package name lookup

High Severity

The dep_missing() function only splits on >= (dep.split(">=", 1)[0]) but requirements.txt also contains == pinned packages like pillow==9.5.0 and pyvda==0.0.8. The old pkg_resources.require() understood version specifiers natively, but importlib.metadata.version() expects a bare package name. Passing "pillow==9.5.0" to version() always raises PackageNotFoundError, causing these installed packages to be falsely reported as missing on every startup (with a 10-second sleep).

Fix in Cursor Fix in Web

@kendonB kendonB closed this Mar 24, 2026
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