Skip to content

fix(hgraph): refactor label remap handling in SetImmutable#1607

Merged
inabao merged 1 commit into0.16from
cherry-pick-9f7dca1-fix
Feb 28, 2026
Merged

fix(hgraph): refactor label remap handling in SetImmutable#1607
inabao merged 1 commit into0.16from
cherry-pick-9f7dca1-fix

Conversation

@inabao
Copy link
Copy Markdown
Collaborator

@inabao inabao commented Feb 27, 2026

cp #1550 to 0.16
link #1555

Signed-off-by: baoyuan <129934985+misaka0714@users.noreply.github.com>
@inabao inabao self-assigned this Feb 27, 2026
@inabao inabao requested a review from wxyucs as a code owner February 27, 2026 03:24
@inabao inabao added kind/improvement Code improvements (variable/function renaming, refactoring, etc. ) version/0.16 labels Feb 27, 2026
@inabao inabao changed the title fix(hgraph): refactor label remap handling in SetImmutable (#1550) fix(hgraph): refactor label remap handling in SetImmutable Feb 27, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses an issue in the HGraph component where label remapping data was not correctly preserved or loaded under certain conditions, specifically when the graph was immutable or being deserialized. The changes ensure that the label_remap_ structure is consistently populated and retained, providing correct and stable behavior for label management within immutable graph instances.

Highlights

  • Label Remap Handling: The conditional check that prevented label_remap_ from being populated during deserialization if the graph was immutable has been removed. This ensures that label remapping data is always loaded.
  • Immutable State Behavior: The explicit clearing of label_table_->label_remap_ when SetImmutable() is called has been removed. This change ensures that label remapping data persists even after the graph transitions to an immutable state.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/algorithm/hgraph.cpp
    • Removed the if (not this->immutable_) condition around label_table_->label_remap_.emplace in deserialize_label_info, ensuring label remapping always occurs during deserialization.
    • Removed the code that cleared this->label_table_->label_remap_ in the SetImmutable method, allowing label remapping data to persist when the graph becomes immutable.
Activity
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the handling of label_remap_ in HGraph. The changes prevent label_remap_ from being cleared when an index is set to immutable, and the deserialization logic is updated to be consistent with this change. I have one suggestion regarding const-correctness to improve code clarity.

if (not this->immutable_) {
this->label_table_->label_remap_.emplace(key, value);
}
this->label_table_->label_remap_.emplace(key, value);
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.

medium

The function deserialize_label_info is marked as const, but this line modifies this->label_table_->label_remap_. This is misleading as the function has side effects on the object's logical state, which violates the principle of const-correctness. To improve clarity and maintainability, consider removing the const specifier from this function's declaration in hgraph.h and its definition.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@            Coverage Diff             @@
##             0.16    #1607      +/-   ##
==========================================
+ Coverage   92.21%   92.27%   +0.05%     
==========================================
  Files         295      295              
  Lines       15677    15681       +4     
==========================================
+ Hits        14457    14469      +12     
+ Misses       1220     1212       -8     
Flag Coverage Δ
cpp 92.27% <100.00%> (+0.05%) ⬆️

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

Components Coverage Δ
common 92.62% <ø> (ø)
datacell 92.26% <ø> (+0.37%) ⬆️
index 91.36% <71.42%> (-0.14%) ⬇️
simd 100.00% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 31735f3...0419d06. Read the comment docs.

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

Copy link
Copy Markdown
Collaborator

@wxyucs wxyucs left a comment

Choose a reason for hiding this comment

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

lgtm

@wxyucs wxyucs requested a review from LHT129 February 28, 2026 06:10
Copy link
Copy Markdown
Collaborator

@LHT129 LHT129 left a comment

Choose a reason for hiding this comment

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

LGTM

@inabao inabao merged commit c56de42 into 0.16 Feb 28, 2026
29 of 37 checks passed
@inabao inabao deleted the cherry-pick-9f7dca1-fix branch February 28, 2026 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/improvement Code improvements (variable/function renaming, refactoring, etc. ) size/XS version/0.16

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants