From 259587c8f2721bb0f6d83ea695c609a07701f695 Mon Sep 17 00:00:00 2001 From: AIOSAI Date: Wed, 22 Apr 2026 10:13:41 -0700 Subject: [PATCH] feat(flow): feat(flow): eliminate cross-handler imports in dashboard handlers, add prax logger to aggregate_central, update README date (DPLAN-0141 Phase 3) Co-Authored-By: @flow --- src/aipass/flow/README.md | 2 +- .../dashboard/push_branch_dashboard.py | 28 ++++++++++--------- .../apps/handlers/dashboard/update_local.py | 25 ++++++++++------- .../flow/apps/modules/aggregate_central.py | 2 ++ 4 files changed, 33 insertions(+), 24 deletions(-) diff --git a/src/aipass/flow/README.md b/src/aipass/flow/README.md index a343f1d5..5c8a1827 100644 --- a/src/aipass/flow/README.md +++ b/src/aipass/flow/README.md @@ -5,7 +5,7 @@ **Purpose:** Unified plan lifecycle management for AIPass. Creates, tracks, closes, and archives numbered work plans across multiple plan types via a filesystem-driven template registry. Foreground archival with vector intake verification, cross-branch aggregation, and self-healing registries. **Module:** `aipass.flow` **Created:** 2025-11-15 -**Last Updated:** 2026-04-07 +**Last Updated:** 2026-04-22 --- diff --git a/src/aipass/flow/apps/handlers/dashboard/push_branch_dashboard.py b/src/aipass/flow/apps/handlers/dashboard/push_branch_dashboard.py index 9d678164..fe4e1ecd 100644 --- a/src/aipass/flow/apps/handlers/dashboard/push_branch_dashboard.py +++ b/src/aipass/flow/apps/handlers/dashboard/push_branch_dashboard.py @@ -200,21 +200,23 @@ def _calculate_quick_status(sections: Dict[str, Any]) -> Dict[str, Any]: def _get_all_registry_files() -> List[str]: - """Return per-type registry filenames via plan-type discovery.""" + """Return per-type registry filenames from template_registry.json.""" try: - from aipass.flow.apps.handlers.template.plan_type_loader import discover_plan_types - - files: List[str] = [] - for _key, config in discover_plan_types().items(): - rf = config.get("registry_file") - if rf and rf not in files: - files.append(rf) - if files: - return files + template_reg = FLOW_JSON_DIR / "template_registry.json" + if template_reg.exists(): + with open(template_reg, "r", encoding="utf-8") as f: + data = json.load(f) + files: List[str] = [] + for _key, type_cfg in data.get("types", {}).items(): + prefix = type_cfg.get("prefix", "") + if prefix: + rf = f"{prefix.lower()}_registry.json" + if rf not in files: + files.append(rf) + if files: + return files except Exception as exc: - logger.warning( - "[push_branch_dashboard] Failed to discover plan types, falling back to default registry: %s", exc - ) + logger.warning("[push_branch_dashboard] Failed to read template registry, falling back to default: %s", exc) return [REGISTRY_FILE.name] diff --git a/src/aipass/flow/apps/handlers/dashboard/update_local.py b/src/aipass/flow/apps/handlers/dashboard/update_local.py index 7edd4e65..cac39c7a 100644 --- a/src/aipass/flow/apps/handlers/dashboard/update_local.py +++ b/src/aipass/flow/apps/handlers/dashboard/update_local.py @@ -93,20 +93,25 @@ DASHBOARD_FILE = FLOW_ROOT / "DASHBOARD.local.json" def _get_all_registry_files() -> List[str]: - """Return per-type registry filenames via plan-type discovery.""" + """Return per-type registry filenames from template_registry.json.""" + template_reg = FLOW_JSON_DIR / "template_registry.json" + if not template_reg.exists(): + return [REGISTRY_FILE.name] try: - from aipass.flow.apps.handlers.template.plan_type_loader import discover_plan_types - + with open(template_reg, "r", encoding="utf-8") as f: + data = json.load(f) files: List[str] = [] - for _key, config in discover_plan_types().items(): - rf = config.get("registry_file") - if rf and rf not in files: + for _key, type_cfg in data.get("types", {}).items(): + prefix = type_cfg.get("prefix", "") + if not prefix: + continue + rf = f"{prefix.lower()}_registry.json" + if rf not in files: files.append(rf) - if files: - return files + return files if files else [REGISTRY_FILE.name] except Exception as exc: - logger.warning("[update_local] Failed to discover plan types, falling back to default registry: %s", exc) - return [REGISTRY_FILE.name] + logger.warning("[update_local] Failed to read template registry, falling back to default: %s", exc) + return [REGISTRY_FILE.name] # ============================================= diff --git a/src/aipass/flow/apps/modules/aggregate_central.py b/src/aipass/flow/apps/modules/aggregate_central.py index ce94976a..32859104 100755 --- a/src/aipass/flow/apps/modules/aggregate_central.py +++ b/src/aipass/flow/apps/modules/aggregate_central.py @@ -38,6 +38,7 @@ _PKG_ROOT = Path(__file__).resolve().parents[3] # file.py -> modules/ -> apps/ FLOW_ROOT = _PKG_ROOT / "flow" from aipass.cli.apps.modules import console +from aipass.prax.apps.modules.logger import system_logger as logger # JSON handler for operation tracking from aipass.flow.apps.handlers.json import json_handler @@ -167,6 +168,7 @@ def handle_command(command: str, args: List[str]) -> bool: if result: console.print("[green]Central plans aggregated successfully[/green]") else: + logger.error("[aggregate_central] Central plans aggregation failed") console.print("[red]Central plans aggregation failed[/red]") return result