Skip to content

fix: check error status of GraphInfo::Load() in BenchmarkFixture::SetUp and remove dead code - #940

Merged
SYaoJun merged 1 commit into
mainfrom
fix/benchmark-status-check
Jul 23, 2026
Merged

SYaoJun merged 1 commit into
mainfrom
fix/benchmark-status-check

Conversation

@SYaoJun

@SYaoJun SYaoJun commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Reason for this PR

To make the code more readable and robust.

What changes are included in this PR?

  1. check the return value for Load() function.
  2. delete unreachable and unused code in graph_reader.cc.

Are these changes tested?

Yes

Are there any user-facing changes?

No

Checklist

  • I have performed a self-review of my own code.
  • I have formatted my own code using make cpplint before submitting when changed files are in the cpp directory.
  • I have performed pre-commit run before commit the changed files.
  • I have added tests to prove my changes are effective.

@SYaoJun
SYaoJun requested a review from yangxk1 July 22, 2026 14:53
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.60%. Comparing base (76b95a3) to head (9ab081d).

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #940      +/-   ##
============================================
- Coverage     81.60%   81.60%   -0.01%     
  Complexity      615      615              
============================================
  Files            95       95              
  Lines         11144    11143       -1     
  Branches       1066     1066              
============================================
- Hits           9094     9093       -1     
  Misses         1810     1810              
  Partials        240      240              
Flag Coverage Δ
cpp 71.81% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

This PR improves C++ code robustness and readability by tightening error handling around GraphInfo::Load() in benchmarks and cleaning up dead/unreachable code and minor logic/comment issues in high-level reader components and filesystem utilities.

Changes:

  • Add explicit status checks for GraphInfo::Load() in BenchmarkFixture::SetUp() and fail fast on load errors.
  • Remove unused/unreachable code paths in high-level graph reader implementations.
  • Minor cleanups: stop iteration after printing the first 10 items in examples; clarify template instantiation comments in filesystem code.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
cpp/src/graphar/high-level/graph_reader.h Removes an unused local (labels) to avoid dead code.
cpp/src/graphar/high-level/graph_reader.cc Removes an unreachable return Status::OK(); after a switch that already returns.
cpp/src/graphar/filesystem.cc Updates misleading comments to correctly describe explicit template instantiations for IdType.
cpp/examples/high_level_reader_example.cc Uses break instead of continue to actually stop after printing 10 vertices/edges.
cpp/benchmarks/benchmark_util.h Checks GraphInfo::Load() status and throws with a clearer failure message on error.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 48 to +52
auto maybe_graph_info = GraphInfo::Load(path_);
if (!maybe_graph_info.status().ok()) {
throw std::runtime_error("Failed to load graph info from " + path_ +
": " + maybe_graph_info.status().message());
}
@SYaoJun
SYaoJun merged commit 1fa72ca into main Jul 23, 2026
9 checks passed
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.

4 participants