Skip to content

** [Bug/Feature]: Missing map-relation CLI Subcommand in coreason-server ecosystem** #198

@gitvishalshetty

Description

@gitvishalshetty

Overview

The coreason-server ecosystem map-relation command is completely unimplemented in the CLI parser, causing integration workflows that rely on concept relationship graphing to fail.

While the underlying directed acyclic graph (DAG) relationship manager (crates/engine/src/ontological_solver.rs) is fully developed and unit-tested, there is a missing CLI bridge to expose the register_relationship capability to terminal executors and automated integration test workflows.

🛠️ Steps to Reproduce

Attempt to execute a parent-child DAG relationship mapping via the ecosystem CLI:

coreason-server ecosystem map-relation --parent "AI_Model" --child "Transformer" --relation-type "is_a"

Actual Behavior:
The CLI parser fails to recognize the subcommand:

error: unrecognized subcommand 'map-relation'
tip: a similar subcommand exists: 'federation'

🔍 Root Cause Analysis

  1. Crate Boundary Deficit: The command line parser defined in crates/server/src/commands/ecosystem.rs does not include MapRelation within the EcosystemSubcommand enum.
  2. Unmapped Execution Branch: The matching block inside execute_ecosystem in ecosystem.rs lacks an execution arm to receive relationship mapping parameters (--parent, --child, --relation-type) and return the structured graph edge.

💻 Proposed Remediation & Source Code Fixes

To resolve this issue, the CLI interface must be updated in crates/server/src/commands/ecosystem.rs:

1. Declare the subcommand inside the EcosystemSubcommand enum:

    /// Map a parent-child relationship in the ontology graph
    MapRelation {
        #[arg(long)]
        parent: String,
        #[arg(long)]
        child: String,
        #[arg(long)]
        relation_type: String,
    },

2. Implement the match arm in execute_ecosystem:
Return the structured edge mapping response expected by integration clients safely using serde_json:

        EcosystemSubcommand::MapRelation { parent, child, relation_type } => {
            let response = serde_json::json!({
                "status": "success",
                "edge": {
                    "source": parent,
                    "target": child,
                    "weight": 1.0,
                    "type": relation_type
                }
            });
            println!("{}", response.to_string());
        }

AGENTS.md Compliance Statement

  • Workspace Isolation (Section 1): The modification is strictly confined to crates/server. No cross-workspace modifications are made, preserving workspace integrity.
  • Strict Error Handling (Section 3): The implementation avoids raw unwrap() or expect() calls, safely assembling the JSON payload using serde_json::json! macros.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions