Skip to content

[hermes] Disable unsafe redaction#3034

Open
joshlf wants to merge 1 commit intoGd1a7f9c4436f266d37e83ebc2310f5a99a73d24dfrom
G4otukodorqa35fh3ms527yqmldc7g7ft
Open

[hermes] Disable unsafe redaction#3034
joshlf wants to merge 1 commit intoGd1a7f9c4436f266d37e83ebc2310f5a99a73d24dfrom
G4otukodorqa35fh3ms527yqmldc7g7ft

Conversation

@joshlf
Copy link
Member

@joshlf joshlf commented Feb 12, 2026


This PR is on branch hermes.

⬇️ Download this PR

Branch

git fetch origin refs/heads/G4otukodorqa35fh3ms527yqmldc7g7ft && git checkout -b pr-G4otukodorqa35fh3ms527yqmldc7g7ft FETCH_HEAD

Checkout

git fetch origin refs/heads/G4otukodorqa35fh3ms527yqmldc7g7ft && git checkout FETCH_HEAD

Cherry Pick

git fetch origin refs/heads/G4otukodorqa35fh3ms527yqmldc7g7ft && git cherry-pick FETCH_HEAD

Pull

git pull origin refs/heads/G4otukodorqa35fh3ms527yqmldc7g7ft

Stacked PRs enabled by GHerrit.

gherrit-pr-id: G4otukodorqa35fh3ms527yqmldc7g7ft
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @joshlf, 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 disables the unsafe redaction feature within the hermes tool. Previously, hermes would modify unsafe Rust code by removing the unsafe keyword and blanking out function bodies when generating shadow crates. This change removes that transformation logic entirely, simplifying the code generation process and ensuring that unsafe constructs are preserved in the output. The transform module, which implemented this redaction, has been deleted, and all related calls and imports have been removed from the codebase.

Highlights

  • Removed transform module: The transform module, which was responsible for redacting unsafe keywords and function bodies, has been entirely removed from the codebase.
  • Disabled unsafe redaction logic: The shadow.rs file no longer imports or utilizes the redaction logic previously provided by the transform module, simplifying the code generation process.
  • Updated test fixtures: Test fixtures related to unsafe_redaction, weird_functions, and workspace_path_dep have been updated to reflect the absence of unsafe redaction, including reintroducing unsafe keywords in expected output and adjusting test status and stderr.

🧠 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
  • tools/hermes/src/main.rs
    • Removed the transform module declaration.
  • tools/hermes/src/shadow.rs
    • Removed the import for the transform module.
    • Removed the collection and application of edits for redaction.
  • tools/hermes/src/transform.rs
    • Deleted the entire file, which contained the append_edits and apply_edits functions.
  • tools/hermes/tests/fixtures/unsafe_redaction/expected/src/lib.rs
    • Restored the unsafe keyword and a simple body to the foo function.
  • tools/hermes/tests/fixtures/unsafe_redaction/expected_status.txt
    • Updated the expected test result from failure to success.
  • tools/hermes/tests/fixtures/unsafe_redaction/expected_stderr.txt
    • Cleared the expected standard error output.
  • tools/hermes/tests/fixtures/weird_functions/expected/src/lib.rs
    • Added the unsafe keyword and a default return value to async_foo, const_foo, and extern_foo functions.
  • tools/hermes/tests/fixtures/workspace_path_dep/expected/app/src/lib.rs
    • Added the unsafe keyword and an empty body to the main function.
Activity
  • No specific activity (comments, reviews, progress) was provided in the context for this pull request.
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
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 disables the unsafe redaction feature by removing the transform module and its associated logic. The changes are applied consistently across the codebase, including updates to test fixtures to reflect that unsafe code is no longer modified. The implementation is straightforward and appears correct, resulting in a simplification of the codebase. I have no further comments.

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.87%. Comparing base (e78478d) to head (565936b).

Additional details and impacted files
@@                            Coverage Diff                             @@
##           Gd1a7f9c4436f266d37e83ebc2310f5a99a73d24d    #3034   +/-   ##
==========================================================================
  Coverage                                      91.87%   91.87%           
==========================================================================
  Files                                             20       20           
  Lines                                           6057     6057           
==========================================================================
  Hits                                            5565     5565           
  Misses                                           492      492           

☔ View full report in Codecov by Sentry.
📢 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.

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.

2 participants