Skip to content

Add component dependency tree API#621

Merged
localgod merged 3 commits into
mainfrom
feature/component-dependency-tree-api
Jun 3, 2026
Merged

Add component dependency tree API#621
localgod merged 3 commits into
mainfrom
feature/component-dependency-tree-api

Conversation

@localgod

@localgod localgod commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Description

Adds GET /api/components/{key}/dependencies to return a bounded dependency tree for a component, including direct and transitive dependencies, depth metadata, cycle flags, truncation metadata, and optional system-scoped scope filtering.

The endpoint requires system when scope is provided because dependency scope is stored on System -[:USES]-> Component relationships rather than on DEPENDS_ON edges.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Schema update (changes to database schemas)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Configuration or build changes

Related Issues

Fixes #616
Relates to #616

Changes Made

  • Added a recursive, bounded DEPENDS_ON query for component dependency trees.
  • Added repository, service, and API endpoint support for dependency tree responses.
  • Added API types and OpenAPI schemas for DependencyNode and DependencyTreeResponse.
  • Added tests for tree generation, cycle detection, system/scope filtering, validation, and empty/missing states.

Screenshots

Not applicable.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my changes
  • I have commented my code where necessary
  • My changes generate no new warnings or errors
  • I have run npm run lint and fixed any issues
  • I have tested my changes locally with npm run dev
  • I have tested the build with npm run build
  • I have updated documentation if needed

Additional Notes

Verification run locally:

  • npm run test
  • npm run lint
  • npm run mdlint
  • npm run docs:api

Co-authored-by: Codex <noreply@openai.com>
Copilot AI review requested due to automatic review settings June 3, 2026 13:33
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 68.85% 1081 / 1570
🔵 Statements 67.75% 1158 / 1709
🔵 Functions 69.21% 272 / 393
🔵 Branches 58.62% 826 / 1409
File CoverageNo changed files found.
Generated in workflow #1302 for commit fb7eb4b by the Vitest Coverage Report Action

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Components API endpoint to fetch a bounded dependency tree (direct + transitive) from Neo4j, including cycle detection, truncation metadata, and optional system/scope filtering, backed by new repository/service plumbing and OpenAPI + type definitions.

Changes:

  • Added GET /api/components/{key}/dependencies API handler with query param validation (system, scope, maxDepth, limit) and OpenAPI docs.
  • Added Neo4j recursive DEPENDS_ON query and repository/service methods to build a dependency tree with depth + circular flags.
  • Added repository + API tests covering empty trees, transitive nesting, cycles, and system/scope filtering.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
types/api.d.ts Adds API types for dependency tree responses.
server/api/components/[key]/dependencies.get.ts New endpoint handler for dependency tree retrieval + validation.
server/services/component.service.ts Exposes dependency-tree method on the ComponentService.
server/repositories/component.repository.ts Executes recursive query and builds the in-memory tree structure.
server/database/queries/components/find-dependencies-recursive.cypher Recursive bounded Cypher query to collect dependency paths with optional system/scope filters.
server/openapi.ts Adds OpenAPI schemas for DependencyNode + DependencyTreeResponse.
public/openapi.json Generated OpenAPI output updated with the new schemas + path.
test/server/repositories/component.repository.spec.ts Integration-style tests for repository tree generation behavior.
test/server/api/component-dependencies.spec.ts Unit tests for the new API handler behavior and validation.

Comment thread server/repositories/component.repository.ts Outdated
Comment thread server/repositories/component.repository.ts Outdated
localgod and others added 2 commits June 3, 2026 15:39
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@localgod localgod merged commit 75d37bc into main Jun 3, 2026
1 check passed
@localgod localgod deleted the feature/component-dependency-tree-api branch June 3, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add transitive dependencies API endpoint

2 participants