Skip to content

fix: replace mutable default arguments with None#582

Merged
stepmikhaylov merged 2 commits into
rocketride-org:developfrom
charliegillet:fix/mutable-default-args
Apr 7, 2026
Merged

fix: replace mutable default arguments with None#582
stepmikhaylov merged 2 commits into
rocketride-org:developfrom
charliegillet:fix/mutable-default-args

Conversation

@charliegillet
Copy link
Copy Markdown
Contributor

@charliegillet charliegillet commented Mar 31, 2026

Summary

  • Replace mutable default arguments ([], {}) with None across 7 Python files in packages/ai/ and nodes/ to prevent shared state between function/method calls
  • Add Optional type annotations and None guards in method bodies to preserve existing behavior

Why this bug happens in this codebase

In Python, mutable default arguments (like [] and {}) are evaluated once at function definition time, not at each call. This means all callers that rely on the default share the same object in memory. The most critical instance was in packages/ai/src/ai/modules/remote/remote.py:11:

def __init__(self, apikey='', loader=None, input: List[str] = [], output: List[str] = [], usage: Dict[str, int] = {}):

Every Pipe instance created without explicit input/output args shared the same list. Appending to one instance's list would silently mutate all others — a classic Python footgun. The same pattern existed in 6 other files across the codebase.

Files changed

File Fix
packages/ai/src/ai/modules/remote/remote.py input=[], output=[], usage={}None
packages/ai/src/ai/modules/remote/__init__.py config={}None
packages/ai/src/ai/common/dap/dap_conn.py message={}None
packages/ai/src/ai/modules/task/task_conn.py message={}None
packages/ai/src/ai/account/keystore.py config={}None
packages/ai/src/ai/web/server.py config={}None (2 methods)
nodes/src/nodes/autopipe/IGlobal.py config={}None

Test plan

  • Verify ruff check and ruff format pass (confirmed locally)
  • Verify existing tests still pass — no behavioral change for callers that pass explicit arguments
  • Verify Pipe() instances have independent input/output/usage attributes

#Hack-with-bay-2

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Prevented unintended shared state by removing mutable default arguments across several modules.
  • Breaking Changes

    • Updated several initialization APIs; one parameter was renamed (caller updates may be required).

@github-actions github-actions Bot added module:nodes Python pipeline nodes module:vscode VS Code extension module:ai AI/ML modules labels Mar 31, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 31, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

A multi-file refactor replaces mutable default arguments (empty dicts and lists) with Optional[...] parameters defaulting to None, adding runtime guards that initialize fresh empty collections when needed and adjusting a few parameter/attribute names and one constructor call.

Changes

Cohort / File(s) Summary
Mutable Default Argument Fixes in Nodes & Core
nodes/src/nodes/autopipe/IGlobal.py, packages/ai/src/ai/account/keystore.py, packages/ai/src/ai/common/dap/dap_conn.py
Replaced mutable defaults with Optional[...] = None and added guards to normalize None to new empty collections. Removed one blank line in IGlobal.py. KeyStore.__init__ stops calling super().__init__() and assigns self.config directly.
Mutable Default Fixes in Web Server
packages/ai/src/ai/web/server.py
Changed WebServer.__init__ and WebServer.use to accept Optional[Dict] = None and normalize to {} before use or passing to modules.
Mutable Default Fixes in Remote Modules
packages/ai/src/ai/modules/remote/__init__.py, packages/ai/src/ai/modules/remote/remote.py
initModule second parameter changed to Optional[...] = None (unused). Pipe.__init__ parameters input/output/usage changed to Optional[...] (renamed inputinput_keys) and instance fields now initialize to fresh lists/dicts when None is provided.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

"I nibble on defaults, soft and bright,
I swap the shared crumbs for fresh delight,
None becomes a seed, then blooms anew,
Each call gets its bowl, no leftover stew,
Hooray — clean state hops into view! 🐇✨"

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main objective of the PR: systematically replacing mutable default arguments across multiple files with None and adding proper None guards.
Docstring Coverage ✅ Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@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: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/vscode/src/providers/views/PageStatus/styles.css`:
- Around line 309-313: The .action-btn.stopping-btn rule currently styles the
disabled Stopping... state but .action-btn:hover still applies lift/shadow;
update the CSS to override hover for this disabled variant by adding a selector
targeting .action-btn.stopping-btn:hover (or .action-btn.stopping-btn:disabled
if applicable) and suppress the hover effects (no transform, no box-shadow) and
keep cursor: not-allowed so the button remains visually non-interactive; modify
the rules near .action-btn.stopping-btn to include this hover override
referencing the .action-btn.stopping-btn selector.

In `@packages/ai/src/ai/modules/remote/__init__.py`:
- Line 9: Update the initModule signature to use a proper optional type and mark
the unused parameter to satisfy type checkers and lint: change the parameter
annotation from "config: Autopipe = None" to "config: Optional[Autopipe] = None"
(and add Optional to the imports) and rename the parameter to _config (or prefix
with _) so Ruff no longer flags it as unused; ensure the function name
initModule and its callers remain unchanged.

In `@packages/ai/src/ai/modules/remote/remote.py`:
- Line 13: Replace the Cyrillic capital ES (U+0421) at the start of the
docstring "Сreate an instance of the pipe context." with a Latin capital C
(U+0043) so the docstring reads "Create an instance of the pipe context.";
locate the exact docstring text in packages/ai/src/ai/modules/remote/remote.py
(search for "Сreate an instance of the pipe context.") and update the character
only, leaving the rest of the docstring and surrounding code (e.g., any function
or class that contains this docstring) unchanged.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: ab662dde-b9d3-4110-865a-af574fb17c3d

📥 Commits

Reviewing files that changed from the base of the PR and between b6b2dc1 and ca31e7d.

📒 Files selected for processing (9)
  • apps/vscode/src/providers/views/PageStatus/PageStatus.tsx
  • apps/vscode/src/providers/views/PageStatus/styles.css
  • nodes/src/nodes/autopipe/IGlobal.py
  • packages/ai/src/ai/account/keystore.py
  • packages/ai/src/ai/common/dap/dap_conn.py
  • packages/ai/src/ai/modules/remote/__init__.py
  • packages/ai/src/ai/modules/remote/remote.py
  • packages/ai/src/ai/modules/task/task_conn.py
  • packages/ai/src/ai/web/server.py

Comment thread apps/vscode/src/providers/views/PageStatus/styles.css
Comment thread packages/ai/src/ai/modules/remote/__init__.py Outdated
Comment thread packages/ai/src/ai/modules/remote/remote.py Outdated
@stepmikhaylov stepmikhaylov force-pushed the fix/mutable-default-args branch from ca31e7d to ff289fd Compare April 2, 2026 15:19
@github-actions github-actions Bot removed the module:vscode VS Code extension label Apr 2, 2026
stepmikhaylov
stepmikhaylov previously approved these changes Apr 2, 2026
@stepmikhaylov stepmikhaylov enabled auto-merge (squash) April 2, 2026 15:21
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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
nodes/src/nodes/autopipe/IGlobal.py (1)

49-56: ⚠️ Potential issue | 🟡 Minor

Add # noqa: A002 to suppress builtin shadowing on parameter id.

Line 49 shadows Python's builtin id, which Ruff flags as an error. Per established pattern in similar node files (agent_langchain, agent_deepagent), suppress the violation with a targeted noqa comment rather than renaming.

-        def getFilter(id: str, provider: str, config: Optional[Dict] = None):
+        def getFilter(id: str, provider: str, config: Optional[Dict] = None):  # noqa: A002
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@nodes/src/nodes/autopipe/IGlobal.py` around lines 49 - 56, The parameter name
id in function getFilter shadows the Python builtin and should be suppressed
with a targeted noqa rather than renamed; update the getFilter signature to
append the inline comment "# noqa: A002" (i.e., def getFilter(id: str, provider:
str, config: Optional[Dict] = None):  # noqa: A002) so Ruff ignores the A002
builtin-shadowing warning while leaving parameter name and logic in getFilter
unchanged.
♻️ Duplicate comments (1)
packages/ai/src/ai/modules/remote/__init__.py (1)

9-9: ⚠️ Potential issue | 🟡 Minor

Use an explicit optional annotation and mark the unused parameter intentionally.

Line 9 sets None as default while annotating Autopipe, and config is still unused. This keeps type-check/lint noise around.

Proposed fix
+from typing import Optional
 from ai.web import WebServer
 from ai.common.schema import Autopipe
@@
-def initModule(server: WebServer, config: Autopipe = None):
+def initModule(server: WebServer, _config: Optional[Autopipe] = None) -> None:
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ai/src/ai/modules/remote/__init__.py` at line 9, The function
initModule currently declares config: Autopipe = None and doesn't use it; change
the annotation to an explicit optional type and mark the parameter as
intentionally unused: annotate config as Optional[Autopipe] (import Optional if
needed) and either rename the parameter to _config or add a deliberate discard
(e.g., assign config to _ or add a comment/pragma) so linters/type-checkers stop
flagging it; refer to initModule, the config parameter, Autopipe and WebServer
when locating the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/ai/src/ai/account/keystore.py`:
- Line 35: KeyStore.__init__ currently calls super().__init__(config if config
is not None else {}, **kwargs) but KeyStore has no base class so this invokes
object.__init__ with arguments and raises TypeError; remove that
super().__init__ call and instead directly assign the resolved config to the
instance (e.g., set self.config or the appropriate attribute) inside
KeyStore.__init__, ensuring any kwargs are handled or rejected as needed.

In `@packages/ai/src/ai/modules/remote/remote.py`:
- Around line 11-19: The constructor parameter name input in remote.py's
__init__ shadows the built-in; rename the parameter (and internal attribute) to
inputs (or similar) in the __init__ signature and body (e.g., change input ->
inputs and self.input -> self.inputs) and update any other references to use the
new name (including usages of the attribute elsewhere in the module or project)
to eliminate the A002 shadowing warning while preserving the same default
behavior (use empty list when None).

---

Outside diff comments:
In `@nodes/src/nodes/autopipe/IGlobal.py`:
- Around line 49-56: The parameter name id in function getFilter shadows the
Python builtin and should be suppressed with a targeted noqa rather than
renamed; update the getFilter signature to append the inline comment "# noqa:
A002" (i.e., def getFilter(id: str, provider: str, config: Optional[Dict] =
None):  # noqa: A002) so Ruff ignores the A002 builtin-shadowing warning while
leaving parameter name and logic in getFilter unchanged.

---

Duplicate comments:
In `@packages/ai/src/ai/modules/remote/__init__.py`:
- Line 9: The function initModule currently declares config: Autopipe = None and
doesn't use it; change the annotation to an explicit optional type and mark the
parameter as intentionally unused: annotate config as Optional[Autopipe] (import
Optional if needed) and either rename the parameter to _config or add a
deliberate discard (e.g., assign config to _ or add a comment/pragma) so
linters/type-checkers stop flagging it; refer to initModule, the config
parameter, Autopipe and WebServer when locating 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 971b6bc9-676e-4238-8606-388641965c75

📥 Commits

Reviewing files that changed from the base of the PR and between ca31e7d and ff289fd.

📒 Files selected for processing (7)
  • nodes/src/nodes/autopipe/IGlobal.py
  • packages/ai/src/ai/account/keystore.py
  • packages/ai/src/ai/common/dap/dap_conn.py
  • packages/ai/src/ai/modules/remote/__init__.py
  • packages/ai/src/ai/modules/remote/remote.py
  • packages/ai/src/ai/modules/task/task_conn.py
  • packages/ai/src/ai/web/server.py

Comment thread packages/ai/src/ai/account/keystore.py Outdated
Comment thread packages/ai/src/ai/modules/remote/remote.py Outdated
Copy link
Copy Markdown
Collaborator

@stepmikhaylov stepmikhaylov left a comment

Choose a reason for hiding this comment

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

Hey @charliegillet ,

Thank you for this refactor of python defaults. CodeRabbit reported critical issues. Would you have a chance to take a look?

charliegillet added a commit to charliegillet/rocketride-server that referenced this pull request Apr 3, 2026
- Fix invalid super().__init__ call in KeyStore (TypeError at runtime)
- Fix type annotation: use Optional[Autopipe] and prefix unused config param
- Fix Cyrillic 'С' typo in docstring (RUF002)
- Rename 'input' parameter to 'input_keys' to avoid shadowing builtin (A002)
- Add hover override for disabled stopping button CSS

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
auto-merge was automatically disabled April 3, 2026 03:17

Head branch was pushed to by a user without write access

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/ai/src/ai/modules/remote/__init__.py (1)

17-19: ⚠️ Potential issue | 🟡 Minor

Docstring references stale parameter name.

The docstring still documents config but the parameter was renamed to _config.

Proposed fix
     Args:
         server (WebServer): The web server instance where routes will be registered.
-        config (Dict[str, Any]): Configuration settings for the module.
+        _config (Optional[Autopipe]): Configuration settings for the module (unused).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ai/src/ai/modules/remote/__init__.py` around lines 17 - 19, The
docstring in packages/ai/src/ai/modules/remote/__init__.py refers to a parameter
named `config` that was renamed to `_config`; update the Args section to
reference `_config` (and adjust its description if needed) so it matches the
actual function signature (e.g., the constructor or register function that
accepts `server` and `_config`), and ensure any other occurrences of `config` in
that docstring are replaced with `_config`.
♻️ Duplicate comments (1)
packages/ai/src/ai/account/keystore.py (1)

19-27: ⚠️ Potential issue | 🟡 Minor

Reject unknown **kwargs or remove them from the signature.

Now that super().__init__(..., **kwargs) is gone, extra keywords are accepted and then ignored. That turns misspelled options into silent no-ops. If KeyStore is not required to keep a variadic constructor, drop **kwargs; otherwise fail when it is non-empty.

🛠️ Proposed fix if unknown kwargs should be rejected
-    def __init__(self, config: Optional[Dict[str, Any]] = None, **kwargs) -> None:
+    def __init__(self, config: Optional[Dict[str, Any]] = None, **kwargs: Any) -> None:
         """
         Initialize the keystore with configuration and optional parameters.

         Args:
             config (Dict[str, Any]): Configuration dictionary for the server.
             **kwargs: Additional keyword arguments for customization.
         """
+        if kwargs:
+            unexpected = ", ".join(sorted(kwargs))
+            raise TypeError(f'Unexpected keyword arguments: {unexpected}')
+
         # Create the token map
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ai/src/ai/account/keystore.py` around lines 19 - 27, The __init__ of
KeyStore currently accepts **kwargs but ignores them (super().__init__(...,
**kwargs) was removed), which hides misspelled options; either remove the
**kwargs parameter from KeyStore.__init__ so unknown keywords are not accepted,
or if variadic kwargs must remain, add explicit validation at the top of
KeyStore.__init__ to raise a TypeError when kwargs is non-empty (e.g.,
"Unexpected keyword arguments: {list(kwargs.keys())}"), ensuring callers and
typos fail fast rather than becoming silent no-ops.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/ai/src/ai/modules/remote/remote.py`:
- Line 1: Update the imports and type hints in remote.py to use Python 3.12
built-in generics: change the top-level import "from typing import Any, Dict,
List, Optional" to "from typing import Any" and then replace all occurrences of
Dict[...] with dict[...], List[...] with list[...], and Optional[T] with T |
None (or the equivalent union) in function signatures, method annotations, and
class attributes (e.g., any functions or classes that reference Dict, List,
Optional in remote.py).

---

Outside diff comments:
In `@packages/ai/src/ai/modules/remote/__init__.py`:
- Around line 17-19: The docstring in
packages/ai/src/ai/modules/remote/__init__.py refers to a parameter named
`config` that was renamed to `_config`; update the Args section to reference
`_config` (and adjust its description if needed) so it matches the actual
function signature (e.g., the constructor or register function that accepts
`server` and `_config`), and ensure any other occurrences of `config` in that
docstring are replaced with `_config`.

---

Duplicate comments:
In `@packages/ai/src/ai/account/keystore.py`:
- Around line 19-27: The __init__ of KeyStore currently accepts **kwargs but
ignores them (super().__init__(..., **kwargs) was removed), which hides
misspelled options; either remove the **kwargs parameter from KeyStore.__init__
so unknown keywords are not accepted, or if variadic kwargs must remain, add
explicit validation at the top of KeyStore.__init__ to raise a TypeError when
kwargs is non-empty (e.g., "Unexpected keyword arguments:
{list(kwargs.keys())}"), ensuring callers and typos fail fast rather than
becoming silent no-ops.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0c1a01af-90e1-41c2-8341-eed872f53d02

📥 Commits

Reviewing files that changed from the base of the PR and between ff289fd and d4b1229.

📒 Files selected for processing (3)
  • packages/ai/src/ai/account/keystore.py
  • packages/ai/src/ai/modules/remote/__init__.py
  • packages/ai/src/ai/modules/remote/remote.py

Comment thread packages/ai/src/ai/modules/remote/remote.py
@charliegillet
Copy link
Copy Markdown
Contributor Author

Addressed all review feedback (CodeRabbit critical issues):

  • Fixed invalid super().__init__ call in KeyStore — replaced with direct self.config assignment to avoid TypeError at runtime
  • Renamed input parameter to input_keys in Pipe.__init__ to avoid shadowing Python builtin (Ruff A002)
  • Fixed Cyrillic 'С' (U+0421) to Latin 'C' in docstring (Ruff RUF002)
  • Renamed unused config parameter to _config in initModule (Ruff ARG001)

Thanks for flagging the CodeRabbit issues!

stepmikhaylov
stepmikhaylov previously approved these changes Apr 6, 2026
@stepmikhaylov
Copy link
Copy Markdown
Collaborator

@charliegillet,

Thank you for addressing CodeRabbit concerns. It's almost fine, the only conflict needs resolution to makes this ready to go.

@charliegillet charliegillet force-pushed the fix/mutable-default-args branch from d4b1229 to a44e5e4 Compare April 6, 2026 18:12
charliegillet added a commit to charliegillet/rocketride-server that referenced this pull request Apr 6, 2026
- Fix invalid super().__init__ call in KeyStore (TypeError at runtime)
- Fix type annotation: use Optional[Autopipe] and prefix unused config param
- Fix Cyrillic 'С' typo in docstring (RUF002)
- Rename 'input' parameter to 'input_keys' to avoid shadowing builtin (A002)
- Add hover override for disabled stopping button CSS

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@charliegillet
Copy link
Copy Markdown
Contributor Author

Rebased on develop and resolved the merge conflict in packages/ai/src/ai/modules/task/task_conn.py. The conflict was between the new connection tracking fields added to develop and this PR's mutable default arg fix — kept both changes. Ready for merge. Thanks @stepmikhaylov!

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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/ai/src/ai/modules/remote/__init__.py (1)

11-20: ⚠️ Potential issue | 🟡 Minor

Sync the docstring with the new _config signature.

Line 11 renamed the parameter, but the docstring still documents config and unrelated /api/v0 routes. Please update the summary and Args section so help text matches the actual remote module registration.

📝 Suggested docstring update
 def initModule(server: WebServer, _config: Optional[Autopipe] = None):
     """
-    Initialize the module by registering API routes for search and configuration.
-
-    Route GET, POST `/api/v0`: Calls `api_v0` for handling API requests.
+    Initialize the remote module routes.
 
     Args:
         server (WebServer): The web server instance where routes will be registered.
-        config (Dict[str, Any]): Configuration settings for the module.
+        _config (Optional[Autopipe]): Optional module configuration. Unused here.
     """
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ai/src/ai/modules/remote/__init__.py` around lines 11 - 20, Update
the docstring for initModule to reflect the actual signature and
responsibilities: change the summary to say it initializes the remote module by
registering its routes, remove the stale mention of GET/POST `/api/v0`, and
update the Args to document server: WebServer and _config: Optional[Autopipe]
(describe its purpose or that it may be None), replacing the old `config:
Dict[str, Any]` entry; keep the brief one-line description of behavior and any
return/side-effect notes about route registration.
nodes/src/nodes/autopipe/IGlobal.py (1)

49-55: ⚠️ Potential issue | 🟡 Minor

Fix the helper signature to resolve Ruff A002 and ANN202.

The parameter id shadows Python's builtin. Rename it to filter_id and add the missing return annotation -> Dict[str, Any] to match the pattern already used elsewhere in this file (e.g., pushLocal, pushRemote).

Minimal fix
-        def getFilter(id: str, provider: str, config: Optional[Dict] = None):
+        def getFilter(filter_id: str, provider: str, config: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
             if config is None:
                 config = {}
             filter = {}
-            filter['id'] = id
+            filter['id'] = filter_id
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@nodes/src/nodes/autopipe/IGlobal.py` around lines 49 - 55, Rename the
parameter id to filter_id in the getFilter function and update internal uses
(change filter['id'] = id to filter['id'] = filter_id), add the missing return
type annotation -> Dict[str, Any] to the getFilter signature to satisfy ANN202,
and ensure Any is imported from typing if not already present; also return the
built dict at the end of getFilter (e.g., return filter).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@nodes/src/nodes/autopipe/IGlobal.py`:
- Around line 49-55: Rename the parameter id to filter_id in the getFilter
function and update internal uses (change filter['id'] = id to filter['id'] =
filter_id), add the missing return type annotation -> Dict[str, Any] to the
getFilter signature to satisfy ANN202, and ensure Any is imported from typing if
not already present; also return the built dict at the end of getFilter (e.g.,
return filter).

In `@packages/ai/src/ai/modules/remote/__init__.py`:
- Around line 11-20: Update the docstring for initModule to reflect the actual
signature and responsibilities: change the summary to say it initializes the
remote module by registering its routes, remove the stale mention of GET/POST
`/api/v0`, and update the Args to document server: WebServer and _config:
Optional[Autopipe] (describe its purpose or that it may be None), replacing the
old `config: Dict[str, Any]` entry; keep the brief one-line description of
behavior and any return/side-effect notes about route registration.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: bfcef882-d56b-4be6-bc0c-4a17ffc1e031

📥 Commits

Reviewing files that changed from the base of the PR and between d4b1229 and a44e5e4.

📒 Files selected for processing (6)
  • nodes/src/nodes/autopipe/IGlobal.py
  • packages/ai/src/ai/account/keystore.py
  • packages/ai/src/ai/common/dap/dap_conn.py
  • packages/ai/src/ai/modules/remote/__init__.py
  • packages/ai/src/ai/modules/remote/remote.py
  • packages/ai/src/ai/web/server.py

charliegillet and others added 2 commits April 7, 2026 11:05
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix invalid super().__init__ call in KeyStore (TypeError at runtime)
- Fix type annotation: use Optional[Autopipe] and prefix unused config param
- Fix Cyrillic 'С' typo in docstring (RUF002)
- Rename 'input' parameter to 'input_keys' to avoid shadowing builtin (A002)
- Add hover override for disabled stopping button CSS

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@stepmikhaylov stepmikhaylov force-pushed the fix/mutable-default-args branch from a44e5e4 to fad1d66 Compare April 7, 2026 09:06
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2026

No description provided.

@stepmikhaylov
Copy link
Copy Markdown
Collaborator

ℹ️ branch rebased to fix build failures

@stepmikhaylov stepmikhaylov enabled auto-merge (squash) April 7, 2026 09:07
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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
nodes/src/nodes/autopipe/IGlobal.py (1)

49-56: 🧹 Nitpick | 🔵 Trivial

Mutable default argument fix looks correct.

The change from config: Dict = {} to config: Optional[Dict] = None with the guard at lines 50-51 correctly prevents shared state between function calls. This is a proper fix for the mutable default argument issue.

However, note that id shadows the Python builtin (Ruff A002). Consider renaming to filter_id for clarity.

Optional fix for builtin shadowing
-        def getFilter(id: str, provider: str, config: Optional[Dict] = None):
+        def getFilter(filter_id: str, provider: str, config: Optional[Dict] = None):
             if config is None:
                 config = {}
             filter = {}
-            filter['id'] = id
+            filter['id'] = filter_id
             filter['provider'] = provider
             filter[provider] = config
             return filter

,

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@nodes/src/nodes/autopipe/IGlobal.py` around lines 49 - 56, getFilter
currently uses a parameter named id which shadows the Python builtin; rename the
parameter to filter_id (and update the internal assignment filter['id'] =
filter_id) in the getFilter function to avoid Ruff A002, and then update any
callers of getFilter to pass the new filter_id argument name (or positional
argument) accordingly; ensure you also update any references to the old
parameter name within the function body.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@nodes/src/nodes/autopipe/IGlobal.py`:
- Around line 49-56: getFilter currently uses a parameter named id which shadows
the Python builtin; rename the parameter to filter_id (and update the internal
assignment filter['id'] = filter_id) in the getFilter function to avoid Ruff
A002, and then update any callers of getFilter to pass the new filter_id
argument name (or positional argument) accordingly; ensure you also update any
references to the old parameter name within the function body.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 06edb0bc-a30d-4d83-a4d6-a66973385a2f

📥 Commits

Reviewing files that changed from the base of the PR and between a44e5e4 and fad1d66.

📒 Files selected for processing (6)
  • nodes/src/nodes/autopipe/IGlobal.py
  • packages/ai/src/ai/account/keystore.py
  • packages/ai/src/ai/common/dap/dap_conn.py
  • packages/ai/src/ai/modules/remote/__init__.py
  • packages/ai/src/ai/modules/remote/remote.py
  • packages/ai/src/ai/web/server.py

@stepmikhaylov stepmikhaylov merged commit d6fd720 into rocketride-org:develop Apr 7, 2026
17 checks passed
shashidharbabu pushed a commit that referenced this pull request Apr 7, 2026
* fix: replace mutable default arguments with None to prevent shared state

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address CodeRabbit feedback on PR #582

- Fix invalid super().__init__ call in KeyStore (TypeError at runtime)
- Fix type annotation: use Optional[Autopipe] and prefix unused config param
- Fix Cyrillic 'С' typo in docstring (RUF002)
- Rename 'input' parameter to 'input_keys' to avoid shadowing builtin (A002)
- Add hover override for disabled stopping button CSS

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ryan-t-christensen pushed a commit that referenced this pull request Apr 8, 2026
* fix: replace mutable default arguments with None to prevent shared state

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address CodeRabbit feedback on PR #582

- Fix invalid super().__init__ call in KeyStore (TypeError at runtime)
- Fix type annotation: use Optional[Autopipe] and prefix unused config param
- Fix Cyrillic 'С' typo in docstring (RUF002)
- Rename 'input' parameter to 'input_keys' to avoid shadowing builtin (A002)
- Add hover override for disabled stopping button CSS

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:ai AI/ML modules module:nodes Python pipeline nodes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants