Skip to content

❤️ (VCS/VTC) Immutable Conduit Map #25

@OppaAI

Description

@OppaAI

⚠️ Issue: Mutable Configuration State (Runtime Map Corruption)

The _CONDUIT_MAP is currently stored as a standard Python dictionary/list. In a MultiThreadedExecutor, there is a risk—however small—that a logic error or a "rogue" thread could modify the paths, active flags, or collection points during runtime. This would lead to non-deterministic harvesting errors that are nearly impossible to trace.

🎯 Location:

robot/vtc/pump.py -> self._CONDUIT_MAP

🦠 Symptoms:

  • A sensor suddenly stops updating because its "path" was accidentally modified in memory.
  • KeyError exceptions mid-mission for keys that passed the "Smoke Test."
  • Memory bloat if the map is being reconstructed unnecessarily.

🩺 Diagnosis:

  • Python dictionaries are Mutable. While we trust our own code, "Defensive Programming" dictates that static configurations should be stored in immutable structures. This prevents any part of the program from changing the "Rules of the Game" after the game has started.

💡 Proposal:

Immutable Conduit Mapping
Once the YAML is validated and the "Fail-Fast" check passes, convert the internal conduit mapping into an immutable structure.

  • NamedTuples or MappingProxy: Use collections.namedtuple for individual conduit entries and types.MappingProxyType for the top-level dictionary.
  • Tuple-Based Paths: Ensure the path (the list of keys) is converted from a list to a tuple.
  • Read-Only Enforcement: If any code tries to write to self._CONDUIT_MAP after initialization, Python will raise an AttributeError immediately.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Status

Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions