Skip to content

fix(analysis): return explicit error for unknown edge kind in GetEdgeCompositionPath - #3308

Open
sanjio3 wants to merge 1 commit into
SpecterOps:mainfrom
sanjio3:fix/2709-edge-composition-default-case
Open

sanjio3 wants to merge 1 commit into
SpecterOps:mainfrom
sanjio3:fix/2709-edge-composition-default-case

Conversation

@sanjio3

@sanjio3 sanjio3 commented Sep 13, 2026

Copy link
Copy Markdown

Fixes #2709

Summary

GetEdgeCompositionPath silently returned an empty path when given an unknown edge kind, making it impossible to distinguish "no path exists" from "this kind is unsupported".

Changes

  • ad.go: add a default case that returns an explicit error for unknown edge kinds
  • Add test coverage for the unknown-kind path

Test plan

  • go test ./packages/go/analysis/ad/ -run TestGetEdgeCompositionPath passes

Summary by CodeRabbit

  • Bug Fixes

    • Unknown edge kinds now return a clear error instead of silently producing an empty result.
  • Tests

    • Added coverage to verify the error message and empty path result for unsupported edge kinds.

…#2709)

Signed-off-by: shaoyihan@zerozen.cn <shaoyihan@zerozen.cn>
@github-actions

github-actions Bot commented Sep 13, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Advanced

Run ID: dfdb9ae8-7574-4ebf-8a76-e3187788dabf

📥 Commits

Reviewing files that changed from the base of the PR and between a0076b5 and b588f4c.

📒 Files selected for processing (2)
  • packages/go/analysis/ad/ad.go
  • packages/go/analysis/ad/ad_test.go

Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

GetEdgeCompositionPath now returns an error for unknown edge kinds instead of silently returning an empty path set. A regression test validates the error text and empty result.

Changes

Edge composition error handling

Layer / File(s) Summary
Unknown edge kind handling
packages/go/analysis/ad/ad.go, packages/go/analysis/ad/ad_test.go
The default switch branch reports unsupported edge kinds. The new test uses a mock database and verifies the error includes the kind and the returned path set is empty.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: superlinkx

Merge Risk: ⚪ Minimal · up to b588f

The change clearly rejects unsupported edge kinds and includes focused regression coverage, so it is mergeable.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: returning an explicit error for an unknown edge kind in GetEdgeCompositionPath.
Description check ✅ Passed The description explains the problem, implementation, linked issue, and test command. It does not explicitly select a change type or complete the repository checklist, but the core required informatio…
Linked Issues check ✅ Passed Issue #2709 requires GetEdgeCompositionPath to fail clearly for an unsupported edge kind. The PR adds a default case that sets `fmt.Errorf("no edge composition handler for kind %s", edge.Kind.Stri…
Out of Scope Changes check ✅ Passed The PR changes only packages/go/analysis/ad/ad.go and adds focused test coverage in packages/go/analysis/ad/ad_test.go. The production change and the mock database support the objective in issue #…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@sanjio3

sanjio3 commented Sep 13, 2026

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

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.

Bug: packages/go/analysis/ad/ad.go:GetEdgeCompositionPath – No default case for unknown edge kinds, causing silent path loss

1 participant