Skip to content

Conversation

@cesarcoatl
Copy link
Member

@cesarcoatl cesarcoatl commented Jan 20, 2026

Summary by Sourcery

Align type signatures and abstractions across OPC, tag path, and script mapping modules.

Enhancements:

  • Remove unnecessary AbstractTagPath constructor from runtime and stub definitions to simplify the tag path base class.
  • Rename AbstractMutableJythonMap.setitem parameter from value to pyValue in runtime and stubs for clearer and consistent typing.
  • Stub out OPC BrowseElement property accessors to break incorrect runtime type associations identified by static typing.

@sourcery-ai
Copy link

sourcery-ai bot commented Jan 20, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Refactors type-related behavior to satisfy static type checker ty by aligning method signatures between runtime code and stubs, and removing or stubbing out logic that was causing type inconsistencies.

Class diagram for AbstractMutableJythonMap type alignment

classDiagram

class PyObject

class MutableJythonMap

class AbstractMutableJythonMap {
  +get(pyKey, def_) PyObject
  +update(args, kwargs) void
  +__setitem__(pyKey, pyValue) void
  +__delitem__(pyKey) void
}

AbstractMutableJythonMap --|> MutableJythonMap
Loading

Class diagram for AbstractTagPath and OPC browse element type fixes

classDiagram

class Object
class TagPath

class AbstractTagPath {
  +compareNullLow(c1, c2) int
  +getChildPath(nextId) TagPath
}

class PropertyElement

class BrowseElement {
  -_properties
  +getItemType() void
  +getProperties() List_BrowseElement_PropertyElement
  +getProperty(id_) BrowseElement_PropertyElement
  +getServer() String
}

AbstractTagPath --|> Object
AbstractTagPath --|> TagPath
Loading

File-Level Changes

Change Details Files
Align AbstractMutableJythonMap.setitem signatures between implementation and stubs for type correctness.
  • Rename the second parameter of setitem from value to pyValue in the concrete AbstractMutableJythonMap class.
  • Update the corresponding setitem signature in the .pyi stub to use pyValue as the parameter name, keeping types unchanged.
src/com/inductiveautomation/ignition/common/script/abc/__init__.py
stubs/stubs/com/inductiveautomation/ignition/common/script/abc/__init__.pyi
Remove or stub out behavior that conflicted with type expectations in OPC and tag path APIs.
  • Replace getProperties and getProperty bodies in the OPC browse element implementation with pass to avoid returning improperly typed values.
  • Remove the explicit init implementation from AbstractTagPath so construction behavior relies on the Java/Object base, and delete the matching constructor declaration from the .pyi stub.
src/com/inductiveautomation/ignition/common/opc/__init__.py
src/com/inductiveautomation/ignition/common/tags/paths/__init__.py
stubs/stubs/com/inductiveautomation/ignition/common/tags/paths/__init__.pyi

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • In opc.__init__.py, BrowseElement.getProperties and getProperty now just pass instead of returning _properties data, which looks like a behavior regression—if this was done only to satisfy the type checker, consider returning list(self._properties.values()) / self._properties[id_] with appropriate typing instead of removing the implementation.
  • The removal of AbstractTagPath.__init__ changes the class’ initialization chain; if any subclasses relied on super(AbstractTagPath, self).__init__() being called, you may want to confirm that this is safe or move the super call into subclasses that need it.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `opc.__init__.py`, `BrowseElement.getProperties` and `getProperty` now just `pass` instead of returning `_properties` data, which looks like a behavior regression—if this was done only to satisfy the type checker, consider returning `list(self._properties.values())` / `self._properties[id_]` with appropriate typing instead of removing the implementation.
- The removal of `AbstractTagPath.__init__` changes the class’ initialization chain; if any subclasses relied on `super(AbstractTagPath, self).__init__()` being called, you may want to confirm that this is safe or move the super call into subclasses that need it.

## Individual Comments

### Comment 1
<location> `src/com/inductiveautomation/ignition/common/opc/__init__.py:185` </location>
<code_context>
     def getProperties(self):
         # type: () -> List[BrowseElement.PropertyElement]
-        return self._properties.values()
+        pass

     def getProperty(self, id_):
</code_context>

<issue_to_address>
**issue (bug_risk):** getProperties now returns None instead of the expected collection of properties.

This used to return `self._properties.values()`, and now returns `None`, which will break any callers that iterate or inspect the properties and contradicts the declared return type (`List[BrowseElement.PropertyElement]`). If this is intended to be abstract, use `raise NotImplementedError` and update the type hint; otherwise, restore the previous return (or equivalent) to avoid a regression.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

def getProperties(self):
# type: () -> List[BrowseElement.PropertyElement]
return self._properties.values()
pass
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): getProperties now returns None instead of the expected collection of properties.

This used to return self._properties.values(), and now returns None, which will break any callers that iterate or inspect the properties and contradicts the declared return type (List[BrowseElement.PropertyElement]). If this is intended to be abstract, use raise NotImplementedError and update the type hint; otherwise, restore the previous return (or equivalent) to avoid a regression.

@cesarcoatl cesarcoatl merged commit 7d10795 into 8.3 Jan 20, 2026
5 checks passed
@cesarcoatl cesarcoatl deleted the refactor/8.3/fix-type-errors-ty branch January 20, 2026 21:20
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