Skip to content

feat(topology): close cross-repo service topology (#684) - #751

Merged
kunaldhongade merged 1 commit into
mainfrom
feature/684-service-topology-close
Aug 6, 2026
Merged

feat(topology): close cross-repo service topology (#684)#751
kunaldhongade merged 1 commit into
mainfrom
feature/684-service-topology-close

Conversation

@kunaldhongade

Copy link
Copy Markdown
Member

Summary

Test plan

  • vitest service-topology + UAT-TOPOLOGY + MCP service_topology
  • tsc -p tsconfig.base.json --noEmit
  • built CLI topology --help
  • CI green on this PR

Closes #684

Made with Cursor

…PI adapters for #684

Add local contract adapters, incremental invalidation, CLI/MCP surfaces, agent tasks, and UAT-TOPOLOGY coverage without cloning, remote refs, or telemetry.
@github-actions github-actions Bot added documentation Improvements or additions to documentation type: test Test coverage, fixtures, or verification improvements area: cli CLI package or command behavior area: docs README, community files, or documentation area: mcp Model Context Protocol integration labels Aug 6, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

CodeDecay PR Check

Lead catch: Config area changed — packages/knowledge/src/topology/compose.ts:1

packages/knowledge/src/topology/compose.ts touches a config area and should be reviewed for regression impact.

Risk: Medium · Merge 69/100 · Decay 54/100 · Security 0/100

Full CodeDecay report

CodeDecay Report

Overall risk: Medium

Score Value
Merge risk 69/100
Decay risk 54/100
Security risk 0/100
Findings Count
High 8
Medium 9
Low 22

Changed Files

  • docs/service-topology.md modified (+39/-4)
  • packages/cli/src/commands/registry.ts modified (+5/-0)
  • packages/cli/src/commands/topology.ts added (+37/-0)
  • packages/cli/src/docs/command-docs/analysis.ts modified (+33/-0)
  • packages/cli/src/docs/command-docs/order.ts modified (+1/-1)
  • packages/cli/src/parsers/args.ts modified (+1/-0)
  • packages/cli/src/parsers/topology.ts added (+52/-0)
  • packages/cli/src/types/index.ts modified (+1/-0)
  • packages/cli/src/types/topology.ts added (+18/-0)
  • packages/knowledge/src/index.ts modified (+11/-0)
  • packages/knowledge/src/topology/compose.ts added (+396/-0)
  • packages/knowledge/src/topology/contracts/asyncapi.ts added (+186/-0)
  • packages/knowledge/src/topology/contracts/openapi.ts added (+132/-0)
  • packages/knowledge/test/service-topology-uat.test.ts added (+498/-0)
  • packages/mcp/src/handlers/service-topology.ts added (+47/-0)
  • packages/mcp/src/index.ts modified (+3/-0)
  • packages/mcp/src/tools/register-analysis.ts modified (+11/-2)
  • packages/mcp/src/tools/registry.ts modified (+3/-1)
  • packages/mcp/src/tools/schemas.ts modified (+16/-0)
  • packages/mcp/src/tools/types.ts modified (+16/-0)
  • ...and 1 more file(s)

Likely Impacted Areas

  • Medium Build and runtime configuration (config): packages/knowledge/src/topology/compose.ts
  • Low Documentation (docs): docs/service-topology.md, packages/cli/src/docs/command-docs/analysis.ts, packages/cli/src/docs/command-docs/order.ts
  • Low Source code (source): packages/cli/src/commands/registry.ts, packages/cli/src/commands/topology.ts, packages/cli/src/parsers/args.ts, packages/cli/src/parsers/topology.ts, packages/cli/src/types/index.ts, packages/cli/src/types/topology.ts, packages/knowledge/src/index.ts, packages/knowledge/src/topology/contracts/asyncapi.ts, packages/knowledge/src/topology/contracts/openapi.ts, packages/mcp/src/handlers/service-topology.ts, packages/mcp/src/index.ts, packages/mcp/src/tools/register-analysis.ts, packages/mcp/src/tools/registry.ts, packages/mcp/src/tools/schemas.ts, packages/mcp/src/tools/types.ts
  • Low Tests (test): packages/knowledge/test/service-topology-uat.test.ts, packages/mcp/test/mcp-service-topology.test.ts

Normalized Impact Graph

Graph artifact: .codedecay/local/impact-graph.json (4578 node(s), 9311 edge(s))

  • Confidence: Direct: 9311, inferred: 0, heuristic: 0
  • codedecay-js-babel-symbols via @babel/parser (available, adapter 1.0.0)
    • Limitation: Call expressions are not connected to target symbols in this adapter version.
    • Limitation: Only JavaScript and TypeScript files parsed by @babel/parser are represented.
    • Limitation: Static import resolution does not resolve runtime dependency injection or dynamic imports.
  • codedecay-python-lezer via @lezer/python (available, adapter 1.0.0)
    • Limitation: Dynamic imports, dependency injection, decorators without literal routes, and framework route registries are not resolved.
    • Limitation: Python impact evidence uses the @lezer/python grammar and conservative module-to-file resolution.
    • Limitation: Static test imports do not prove execution or assertion quality.
  • Graph limitation: A static test import does not prove the symbol executed or that assertions cover its behavior.

Symbol Impact Evidence

Graph artifact: .codedecay/local/symbol-impact-graph.json (956 file(s), 5769 edge(s))

  • packages/cli/src/commands/registry.ts#createCommandHandlers -> packages/cli/src/index.ts
  • packages/cli/src/commands/topology.ts#runTopologyCommand -> packages/cli/src/commands/registry.ts
  • packages/cli/src/docs/command-docs/analysis.ts#ANALYSIS_COMMAND_DOCS -> packages/cli/src/docs/commands.ts
  • packages/cli/src/docs/command-docs/order.ts#COMMAND_ORDER -> packages/cli/src/commands/help.ts, packages/cli/src/docs/commands.ts
  • packages/cli/src/parsers/args.ts#parseTopologyArgs -> packages/cli/src/commands/topology.ts
  • packages/cli/src/parsers/topology.ts#parseTopologyArgs -> packages/cli/src/commands/topology.ts, packages/cli/src/parsers/args.ts
  • packages/cli/src/types/topology.ts#TopologyOptions -> packages/cli/src/commands/topology.ts, packages/cli/src/parsers/topology.ts, packages/cli/src/types.ts, packages/cli/src/types/index.ts
  • packages/knowledge/src/index.ts#buildServiceTopologyReport -> packages/cli/src/commands/topology.ts, packages/knowledge/test/service-topology-uat.test.ts, packages/mcp/src/handlers/service-topology.ts
    • Likely tests: packages/knowledge/test/service-topology-uat.test.ts
  • packages/knowledge/src/index.ts#parseAsyncApiTopology -> packages/knowledge/test/service-topology-uat.test.ts
    • Likely tests: packages/knowledge/test/service-topology-uat.test.ts
  • packages/knowledge/src/index.ts#parseOpenApiTopology -> packages/knowledge/test/service-topology-uat.test.ts
    • Likely tests: packages/knowledge/test/service-topology-uat.test.ts
  • packages/knowledge/src/index.ts#renderServiceTopologyReportMarkdown -> packages/cli/src/commands/topology.ts, packages/mcp/src/handlers/service-topology.ts
  • packages/knowledge/src/topology/compose.ts#BuildServiceTopologyOptions -> packages/knowledge/src/index.ts
  • ...and 19 more symbol impact(s)

Language And Parser Coverage

  • Source files classified: 20
  • Fully supported parser files: 20
  • Limited files: 0
  • Unsupported files: 0

Merge Risk Breakdown

  • Score: 69/100
  • Raw score before dampeners: 100/100
  • Adjusted score before severity cap: 100/100
  • Highest contributing severity: Medium

Top contributors:

  • +18 Change size (structural): Changed lines amplify review cost across 21 file(s).
  • +16 Config area changed (direct): packages/knowledge/src/topology/compose.ts touches a config area and should be reviewed for regression impact.
  • +12 File spread (structural): Change breadth spans 21 file(s).
  • +10 Changed test looks happy-path only (heuristic): packages/mcp/test/mcp-service-topology.test.ts has assertions but no obvious negative, malformed, or boundary case coverage for risky source changes.
  • +4 Docs area changed (heuristic): docs/service-topology.md touches a docs area and should be reviewed for regression impact.

Notes:

  • Untrusted memory context is visible but contributes 0 score until trusted evidence corroborates it.

Decay Risk Breakdown

  • Score: 54/100
  • Raw score before dampeners: 100/100
  • Adjusted score before severity cap: 84/100
  • Highest contributing severity: High
  • Evidence mode: heuristic-only

Top contributors:

  • +18 Duplicated added logic (heuristic): A similar block of added logic appears 4 times across 4 file(s).
  • +18 Duplicated added logic (heuristic): A similar block of added logic appears 4 times across 4 file(s).
  • +18 High complexity in changed function (heuristic): parseTopologyArgs has estimated cyclomatic complexity 20.
  • +18 High complexity in changed function (heuristic): buildServiceTopologyReport has estimated cyclomatic complexity 24.
  • +18 High complexity in changed function (heuristic): parseAsyncApiTopology has estimated cyclomatic complexity 20.

Dampeners:

  • -16 Heuristic-only dampener: Decay stays conservative until direct evidence exists.

Notes:

  • Heuristic-only decay is capped at 54/100 until direct evidence exists.

Security Risk Breakdown

  • Score: 0/100
  • Raw score before dampeners: 0/100
  • Adjusted score before severity cap: 0/100

Security Matcher Coverage

  • Changed source files scanned: 18
  • Security candidates found: 0
  • Skipped files: 0

Test Evidence

  • Mode: heuristic-only
  • Sources: none
  • Changed source coverage:
  • packages/cli/src/commands/registry.ts: not measured (no measurable changed lines)
  • packages/cli/src/commands/topology.ts: not measured (no measurable changed lines)
  • packages/cli/src/docs/command-docs/analysis.ts: not measured (no measurable changed lines)
  • packages/cli/src/docs/command-docs/order.ts: not measured (no measurable changed lines)
  • packages/cli/src/parsers/args.ts: not measured (no measurable changed lines)
  • packages/cli/src/parsers/topology.ts: not measured (no measurable changed lines)
  • packages/cli/src/types/index.ts: not measured (no measurable changed lines)
  • packages/cli/src/types/topology.ts: not measured (no measurable changed lines)
  • Notes:
  • No runtime coverage artifact was found. Test audit remains heuristic-only.

Changed Path Test Proof

Status Count
Runtime-proven 0
Static-only 15
Weakened by mocks 0
Unproven 17
  • Unproven packages/cli/src/commands/registry.ts#createCommandHandlers (missing-proof, heuristic)
    • Evidence: No runtime coverage or static test reference was found for this changed path.
    • Repair task: Add an integration test that reaches packages/cli/src/commands/registry.ts#createCommandHandlers without mocking the changed boundary.
  • Static-only packages/cli/src/commands/topology.ts#runTopologyCommand (static-reference, deterministic)
    • Evidence: Referenced by packages/knowledge/test/service-topology-uat.test.ts, packages/mcp/test/mcp-service-topology.test.ts, but no runtime coverage artifact proves changed lines executed.
    • Static references: packages/knowledge/test/service-topology-uat.test.ts, packages/mcp/test/mcp-service-topology.test.ts
    • Repair task: Strengthen packages/knowledge/test/service-topology-uat.test.ts so it executes packages/cli/src/commands/topology.ts#runTopologyCommand with assertions; static import alone is not proof.
  • Unproven packages/cli/src/docs/command-docs/analysis.ts#ANALYSIS_COMMAND_DOCS (missing-proof, heuristic)
    • Evidence: No runtime coverage or static test reference was found for this changed path.
    • Repair task: Add an integration test that reaches packages/cli/src/docs/command-docs/analysis.ts#ANALYSIS_COMMAND_DOCS without mocking the changed boundary.
  • Unproven packages/cli/src/docs/command-docs/order.ts#COMMAND_ORDER (missing-proof, heuristic)
    • Evidence: No runtime coverage or static test reference was found for this changed path.
    • Repair task: Add an integration test that reaches packages/cli/src/docs/command-docs/order.ts#COMMAND_ORDER without mocking the changed boundary.
  • Unproven packages/cli/src/parsers/args.ts#parseTopologyArgs (missing-proof, heuristic)
    • Evidence: No runtime coverage or static test reference was found for this changed path.
    • Repair task: Add an integration test that reaches packages/cli/src/parsers/args.ts#parseTopologyArgs without mocking the changed boundary.
  • Static-only packages/cli/src/parsers/topology.ts#parseTopologyArgs (static-reference, deterministic)
    • Evidence: Referenced by packages/knowledge/test/service-topology-uat.test.ts, packages/mcp/test/mcp-service-topology.test.ts, but no runtime coverage artifact proves changed lines executed.
    • Static references: packages/knowledge/test/service-topology-uat.test.ts, packages/mcp/test/mcp-service-topology.test.ts
    • Repair task: Strengthen packages/knowledge/test/service-topology-uat.test.ts so it executes packages/cli/src/parsers/topology.ts#parseTopologyArgs with assertions; static import alone is not proof.
  • Unproven packages/cli/src/types/index.ts (missing-proof, heuristic)
    • Evidence: No runtime coverage or static test reference was found for this changed path.
    • Repair task: Add an integration test that reaches packages/cli/src/types/index.ts without mocking the changed boundary.
  • Static-only packages/cli/src/types/topology.ts#TopologyOptions (static-reference, deterministic)
    • Evidence: Referenced by packages/knowledge/test/service-topology-uat.test.ts, packages/mcp/test/mcp-service-topology.test.ts, but no runtime coverage artifact proves changed lines executed.
    • Static references: packages/knowledge/test/service-topology-uat.test.ts, packages/mcp/test/mcp-service-topology.test.ts
    • Repair task: Strengthen packages/knowledge/test/service-topology-uat.test.ts so it executes packages/cli/src/types/topology.ts#TopologyOptions with assertions; static import alone is not proof.
  • ...and 24 more changed path proof entries

Untrusted Memory Context

  • Project invariant may be impacted (packages/cli/src/commands/registry.ts:26): Untrusted memory context: invariant "No hidden cloud or model call" applies to this change. The OSS CLI must remain useful without telemetry, API keys, hosted services, required LLM calls, or CodeDecayCloud.
  • Project invariant may be impacted (packages/cli/src/commands/registry.ts:26): Untrusted memory context: invariant "Commands are explicit" applies to this change. CodeDecay must not run project commands unless they are configured and safety.allowCommands is true.
  • Project invariant may be impacted (docs/service-topology.md:3): Untrusted memory context: invariant "Tool evidence is separate from AI suggestions" applies to this change. Reports must not present agent/model suggestions as verified evidence unless backed by deterministic checks or command output.
  • Project invariant may be impacted (docs/service-topology.md:3): Untrusted memory context: invariant "Output must be actionable" applies to this change. Redteam reports and agent bundles should say what behavior to verify, which test proof is weak or missing, and what task a coding agent should perform.
  • Architecture note applies (packages/cli/src/commands/registry.ts:26): Untrusted architecture context: CLI is the published surface: The public npm package is @submuxhq/codedecay and the binary is codedecay. Internal workspace packages are implementation details.
  • Architecture note applies (packages/mcp/src/handlers/service-topology.ts:1): Untrusted architecture context: Agent-owned workflow: CodeDecay should produce evidence and task bundles that a user's own Codex, Claude Code, Cursor, OpenCode, Pi, desktop app, or MCP client can use.

High Risk Findings

  • Duplicated added logic (packages/cli/src/types/topology.ts:13): A similar block of added logic appears 4 times across 4 file(s).
  • Duplicated added logic (packages/cli/src/types/topology.ts:14): A similar block of added logic appears 4 times across 4 file(s).
  • High complexity in changed function (packages/cli/src/parsers/topology.ts:5): parseTopologyArgs has estimated cyclomatic complexity 20.
  • High complexity in changed function (packages/knowledge/src/topology/compose.ts:60): buildServiceTopologyReport has estimated cyclomatic complexity 24.
  • High complexity in changed function (packages/knowledge/src/topology/contracts/asyncapi.ts:23): parseAsyncApiTopology has estimated cyclomatic complexity 20.

Medium Risk Findings

  • Broad unrelated change set: This PR changes 18 files across 1 top-level areas and 3 risk categories.
  • Duplicated added logic (packages/cli/src/commands/topology.ts:1): A similar block of added logic appears 2 times across 2 file(s).
  • Duplicated added logic (packages/cli/src/commands/topology.ts:2): A similar block of added logic appears 2 times across 2 file(s).
  • Duplicated added logic (packages/cli/src/docs/command-docs/analysis.ts:50): A similar block of added logic appears 10 times across 1 file(s).
  • Changed test looks happy-path only (packages/mcp/test/mcp-service-topology.test.ts:72): packages/mcp/test/mcp-service-topology.test.ts has assertions but no obvious negative, malformed, or boundary case coverage for risky source changes.
  • High complexity in changed function (packages/knowledge/src/topology/contracts/openapi.ts:22): parseOpenApiTopology has estimated cyclomatic complexity 19.
  • Large changed function (packages/mcp/src/tools/register-analysis.ts:35): registerAnalysisMcpTools spans 134 lines, which increases review and regression risk.
  • Config area changed (packages/knowledge/src/topology/compose.ts:1): packages/knowledge/src/topology/compose.ts touches a config area and should be reviewed for regression impact.

Low Risk Findings

  • Docs area changed (docs/service-topology.md:3): docs/service-topology.md touches a docs area and should be reviewed for regression impact.
  • Docs area changed (packages/cli/src/docs/command-docs/analysis.ts:41): packages/cli/src/docs/command-docs/analysis.ts touches a docs area and should be reviewed for regression impact.
  • Docs area changed (packages/cli/src/docs/command-docs/order.ts:1): packages/cli/src/docs/command-docs/order.ts touches a docs area and should be reviewed for regression impact.
  • Source area changed (packages/cli/src/commands/registry.ts:26): packages/cli/src/commands/registry.ts touches a source area and should be reviewed for regression impact.
  • Source area changed (packages/cli/src/commands/topology.ts:1): packages/cli/src/commands/topology.ts touches a source area and should be reviewed for regression impact.
  • Source area changed (packages/cli/src/parsers/args.ts:22): packages/cli/src/parsers/args.ts touches a source area and should be reviewed for regression impact.
  • Source area changed (packages/cli/src/parsers/topology.ts:1): packages/cli/src/parsers/topology.ts touches a source area and should be reviewed for regression impact.
  • Source area changed (packages/cli/src/types/index.ts:24): packages/cli/src/types/index.ts touches a source area and should be reviewed for regression impact.
  • Source area changed (packages/cli/src/types/topology.ts:1): packages/cli/src/types/topology.ts touches a source area and should be reviewed for regression impact.
  • Source area changed (packages/knowledge/src/index.ts:54): packages/knowledge/src/index.ts touches a source area and should be reviewed for regression impact.
  • Source area changed (packages/knowledge/src/topology/contracts/asyncapi.ts:1): packages/knowledge/src/topology/contracts/asyncapi.ts touches a source area and should be reviewed for regression impact.
  • Source area changed (packages/knowledge/src/topology/contracts/openapi.ts:1): packages/knowledge/src/topology/contracts/openapi.ts touches a source area and should be reviewed for regression impact.
  • Source area changed (packages/mcp/src/handlers/service-topology.ts:1): packages/mcp/src/handlers/service-topology.ts touches a source area and should be reviewed for regression impact.
  • Source area changed (packages/mcp/src/index.ts:31): packages/mcp/src/index.ts touches a source area and should be reviewed for regression impact.
  • Source area changed (packages/mcp/src/tools/register-analysis.ts:15): packages/mcp/src/tools/register-analysis.ts touches a source area and should be reviewed for regression impact.
  • Source area changed (packages/mcp/src/tools/registry.ts:22): packages/mcp/src/tools/registry.ts touches a source area and should be reviewed for regression impact.
  • Source area changed (packages/mcp/src/tools/schemas.ts:118): packages/mcp/src/tools/schemas.ts touches a source area and should be reviewed for regression impact.
  • Source area changed (packages/mcp/src/tools/types.ts:48): packages/mcp/src/tools/types.ts touches a source area and should be reviewed for regression impact.
  • Test area changed (packages/knowledge/test/service-topology-uat.test.ts:1): packages/knowledge/test/service-topology-uat.test.ts touches a test area and should be reviewed for regression impact.
  • Test area changed (packages/mcp/test/mcp-service-topology.test.ts:1): packages/mcp/test/mcp-service-topology.test.ts touches a test area and should be reviewed for regression impact.

Recommended Checks

  • Add an integration test that reaches packages/cli/src/commands/registry.ts#createCommandHandlers without mocking the changed boundary.
  • Add an integration test that reaches packages/cli/src/docs/command-docs/analysis.ts#ANALYSIS_COMMAND_DOCS without mocking the changed boundary.
  • Add an integration test that reaches packages/cli/src/docs/command-docs/order.ts#COMMAND_ORDER without mocking the changed boundary.
  • Add an integration test that reaches packages/cli/src/parsers/args.ts#parseTopologyArgs without mocking the changed boundary.
  • Add an integration test that reaches packages/cli/src/types/index.ts without mocking the changed boundary.
  • Add an integration test that reaches packages/knowledge/src/index.ts#renderServiceTopologyReportMarkdown without mocking the changed boundary.
  • Add an integration test that reaches packages/knowledge/src/topology/compose.ts#BuildServiceTopologyOptions without mocking the changed boundary.
  • Add an integration test that reaches packages/knowledge/src/topology/compose.ts#createTopologyAgentTasks without mocking the changed boundary.
  • Add an integration test that reaches packages/knowledge/src/topology/compose.ts#mergeTopologyGraphs without mocking the changed boundary.
  • Add an integration test that reaches packages/knowledge/src/topology/compose.ts#renderServiceTopologyReportMarkdown without mocking the changed boundary.
  • Add an integration test that reaches packages/knowledge/src/topology/compose.ts#ServiceTopologyAgentTask without mocking the changed boundary.
  • Add an integration test that reaches packages/knowledge/src/topology/compose.ts#ServiceTopologyReport without mocking the changed boundary.

Notes

CodeDecay is deterministic and local-first. This report was generated without telemetry, API keys, LLMs, or model calls.


Found by CodeDecay - deterministic, local-first, no telemetry.

@kunaldhongade
kunaldhongade merged commit 3f57439 into main Aug 6, 2026
10 checks passed
@kunaldhongade
kunaldhongade deleted the feature/684-service-topology-close branch August 6, 2026 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI package or command behavior area: docs README, community files, or documentation area: mcp Model Context Protocol integration documentation Improvements or additions to documentation type: test Test coverage, fixtures, or verification improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(topology): model cross-repository services and deployment dependencies

1 participant