Skip to content

Component: SmrtSpace Management

Canonical source: SmrtApps/PythonApp/python_core/smrtspace_mgt/README.md (mirrored below)


python_core.smrtspace_mgt

Overview

  • Location: SmrtApps/PythonApp/python_core/smrtspace_mgt
  • Purpose: Create, persist, and inject SmrtSpace metadata and configuration for Python Core startup.

Responsibilities

  • Persist the active SmrtSpace name/root under %AppData%/SmrtHub/Config/smrt-space/active_smrtspace.json.
  • Load SmrtSpace metadata only when an explicit selection exists (no auto-creation).
  • Normalize user supplied paths before they are saved or injected.
  • Load SmrtSpace scoped configuration and merge it into runtime user_flags with guard rails.
  • Emit operational logs through python_core.utils.logger.get_logger_for("smrtspace") only; emojis remain in terminal streams but not in persisted logs.

Runtime Flow

  1. initialize_smrtspace_system() (exported from __init__.py) checks for an active selection and injects config only when available.
  2. Metadata helpers (load_smrtspace_meta, save_smrtspace_meta, get_smrtspace_root, get_smrtspace_name, try_get_smrtspace_selection) provide the persisted context to any caller.
  3. inject_smrtspace_config() loads SmrtSpace configuration and applies values to known user_flags keys while logging mismatches.
  4. get_config_bridge_status() surfaces diagnostics for telemetry and support tooling.

Key Functions

  • try_get_smrtspace_selection() — returns the active selection or None when no SmrtSpace is set.
  • ensure_smrtspace_initialized() — interactive helper used only for explicit creation flows (not invoked on startup).
  • save_smrtspace_meta(name, root) — writes metadata using an atomic temp-file swap and records the action to the smrtspace log.
  • _generate_unique_smrtspace_name() — produces the default NewSmrtSpace name with numeric suffixes if folders already exist.
  • _optional_dir_input(...) — shared prompt handler for collecting additional include/exclude directories.
  • _normalize_path(path_str) — converts user input into absolute paths, returning "" when normalization fails.
  • inject_smrtspace_config() — applies SmrtSpace overrides only for keys already present in user_flags; skips unknown keys and logs type mismatches.
  • get_config_bridge_status() — returns a dictionary with version info, supported flag counts, and whether a SmrtSpace config file was available.

Operational Notes

  • All filesystem access respects the Operational Data Policy; do not add new locations without architecture approval.
  • The configuration bridge is intended for single-threaded initialization; invoke it before background workers spawn.
  • SmrtSpace creation is explicit and UI-driven; Python core never auto-creates default SmrtSpaces on startup.
  • Consumers should treat README as the canonical documentation; inline docstrings intentionally remain concise.
  • Errors are logged and surfaced to support bundles; callers should not suppress the logger output.
  • README.Files/System/Policies/SmrtHub-Operational-Data-Policy-v1.0.README.md
  • README.Files/Reference-Guides/SmrtHub.Logging.README.md
  • SmrtApps/PythonApp/python_core/README.md