Skip to content

Add direct coverage for serialization helpers and tree boundaries#32

Merged
achamayou merged 8 commits into
mainfrom
copilot/add-test-coverage-helpers
Jun 5, 2026
Merged

Add direct coverage for serialization helpers and tree boundaries#32
achamayou merged 8 commits into
mainfrom
copilot/add-test-coverage-helpers

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 19, 2026

  • Inspect CI workflow runs and collect compiler error logs
  • Reproduce the compiler error locally
  • Apply minimal code fix for the reported compiler issue
  • Run targeted tests/build to verify the fix
  • Run final validation (code review + CodeQL) and report back

Copilot AI and others added 6 commits May 19, 2026 19:09
Agent-Logs-Url: https://github.com/microsoft/merklecpp/sessions/cd6a239e-ca77-480e-b515-6c171a869977

Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/merklecpp/sessions/cd6a239e-ca77-480e-b515-6c171a869977

Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/merklecpp/sessions/cd6a239e-ca77-480e-b515-6c171a869977

Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/merklecpp/sessions/cd6a239e-ca77-480e-b515-6c171a869977

Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/merklecpp/sessions/cd6a239e-ca77-480e-b515-6c171a869977

Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
Copilot AI requested a review from achamayou May 19, 2026 19:19
@achamayou achamayou marked this pull request as ready for review May 19, 2026 19:46
Copilot AI review requested due to automatic review settings May 19, 2026 19:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 adds a dedicated “coverage” test binary to exercise low-level serialization helpers and boundary behaviors, while tightening PathT equality semantics and centralizing validation for partial tree serialization ranges.

Changes:

  • Add test/coverage.cpp to directly cover serialization helpers, PathT metadata/deserialization/equality, partial-serialization boundary cases, and TreeT move/self-assignment.
  • Update PathT equality to include leaf/max-index metadata and make operator!= const.
  • Centralize partial range validation for TreeT::serialise(from,to) and TreeT::serialised_size(from,to), including explicit empty-tree rejection.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
test/coverage.cpp New targeted coverage test executable covering helper functions and boundary/error paths.
test/CMakeLists.txt Registers the new coverage test target with the existing test harness.
merklecpp.h Refines PathT equality/inequality semantics and factors partial-range validation into a shared helper.

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

@achamayou
Copy link
Copy Markdown
Member

@copilot look at the compiler errors and fix them

Copilot AI and others added 2 commits May 20, 2026 07:30
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 20, 2026

@copilot look at the compiler errors and fix them

Fixed. I investigated the CI logs, resolved the compiler/clippy-style errors in test/coverage.cpp, and fixed the crash by hardening TreeT move/copy assignment ownership handling. The fix is in commit 3f1edbb (plus earlier prep in 05797c0), and local + CI-like validation now pass.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@achamayou achamayou merged commit 104a9de into main Jun 5, 2026
12 checks passed
Comment thread test/coverage.cpp
}
catch (const std::exception& ex)
{
std::cout << "Error: " << ex.what() << '\n';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think it's better to flush with std::endl to make sure we do not lose anything?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think we lose anything, the flushing may be a bit delayed, that's all. But this should arguably go to stderr, which is line buffered anyway.

Comment thread merklecpp.h
const bool from_out_of_range = from < min_index() || max_index() < from;
const bool to_out_of_range = to < min_index() || max_index() < to;
const bool reversed_range = from > to;
if (empty() || from_out_of_range || to_out_of_range || reversed_range)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nit. 3 comparisons are enough

min() <= from && from <= to && to <= max()

Comment thread merklecpp.h
delete (n);
}
uninserted_leaf_nodes.clear();
insertion_stack.clear();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Just curious why .clear() and only then = move()?

Copy link
Copy Markdown

@maxtropets maxtropets Jun 5, 2026

Choose a reason for hiding this comment

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

Also this's a dup of what we do in move ctor, so could've been made a single function, as in "clear()"

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.

5 participants