Skip to content

Conversation

@normanrz
Copy link
Member

@normanrz normanrz commented Jan 2, 2026

Description:

  • Adds chunk_shape to View.content_is_equal and fixes the corresponding issues

Todos:

Make sure to delete unnecessary points or to check all before merging:

  • Updated Changelog
  • Added / Updated Tests

@gemini-code-assist
Copy link

Summary of Changes

Hello @normanrz, 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 refines the content_is_equal method within the View class by introducing a chunk_shape parameter, enabling more precise data comparison. It also streamlines the handling of the read_only flag across various methods, ensuring that data views are consistently treated as read-only during comparison operations, thereby enhancing robustness and clarity in data integrity checks.

Highlights

  • Enhanced content_is_equal Method: The View.content_is_equal method now accepts a chunk_shape parameter, allowing for more granular control over how data chunks are compared for equality. Additionally, it ensures that comparisons are always performed on read-only views to prevent unintended side effects.
  • Refactored read_only Parameter Handling: The read_only parameter in the chunk method and related internal calls has been refactored. It now defaults to the View instance's own read_only status, improving consistency and reducing the need to explicitly pass read_only=True in several places.
  • Updated Test Coverage: A test case for content_is_equal in test_dataset.py has been updated to reflect the new chunk_shape parameter, ensuring the new functionality is correctly tested.

🧠 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.

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

@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 primarily fixes a bug in View.content_is_equal where the chunk_shape parameter was not correctly propagated, and enhances the method's robustness by performing comparisons on read-only views. Additionally, it refactors the View.chunk method to have a more intuitive default behavior for the read_only flag, improving code consistency. The changes are well-implemented and improve the codebase. I've included one suggestion to further enhance robustness in for_zipped_chunks by ensuring chunk shapes are always validated.

@normanrz normanrz self-assigned this Jan 2, 2026
@normanrz normanrz requested a review from fm3 January 2, 2026 13:57
source_chunk_shape = Vec3Int(source_chunk_shape)
target_chunk_shape = Vec3Int(target_chunk_shape)
self._check_chunk_shape(source_chunk_shape, read_only=True)
self._check_chunk_shape(source_chunk_shape, read_only=self.read_only)
Copy link
Member Author

@normanrz normanrz Jan 2, 2026

Choose a reason for hiding this comment

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

Source chunks were always read-only previously. Not sure, that was necessary. I changed all usages of for_zipped_chunks to use explicit read_only source views.

@github-actions
Copy link

github-actions bot commented Jan 2, 2026

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
10175 8573 84% 80% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
webknossos/webknossos/dataset/layer/layer.py 86% 🟢
webknossos/webknossos/dataset/layer/view/mag_view.py 90% 🟢
webknossos/webknossos/dataset/layer/view/view.py 89% 🟢
webknossos/webknossos/utils.py 78% 🟢
TOTAL 86% 🟢

updated for commit: 18beb9a by action🐍

Copy link
Member

@fm3 fm3 left a comment

Choose a reason for hiding this comment

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

LGTM

@normanrz normanrz merged commit 91eb7f2 into master Jan 5, 2026
23 checks passed
@normanrz normanrz deleted the fix-content-equal branch January 5, 2026 10:10
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.

3 participants