Skip to content

The cache returns mutable data structures (dictionaries and lists) directly without copying. This means callers can inadvertently modify the cached data, affecting subsequent calls. #19

@DYAI2025

Description

@DYAI2025

The cache returns mutable data structures (dictionaries and lists) directly without copying. This means callers can inadvertently modify the cached data, affecting subsequent calls.

For example:

session1 = bridge.get_current_session()
session1["patterns"].append({"new": "pattern"})  # Modifies cache!
session2 = bridge.get_current_session()  # Returns modified data

Consider returning deep copies of cached data to prevent unintended mutations:

import copy
return copy.deepcopy(entry["data"])

Originally posted by @Copilot in #17 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions