Skip to content

[hermes] Stop copying shadow crate; run in-place#3035

Open
joshlf wants to merge 1 commit intoG4otukodorqa35fh3ms527yqmldc7g7ftfrom
G5bgufougyvpozncgq4yokgx3sie6wfy7
Open

[hermes] Stop copying shadow crate; run in-place#3035
joshlf wants to merge 1 commit intoG4otukodorqa35fh3ms527yqmldc7g7ftfrom
G5bgufougyvpozncgq4yokgx3sie6wfy7

Conversation

@joshlf
Copy link
Member

@joshlf joshlf commented Feb 12, 2026


This PR is on branch hermes.

Latest Update: v12 — Compare vs v11

📚 Full Patch History

Links show the diff between the row version and the column version.

Version v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v8 v7 v6 v5 v4 v3 v2 v1 Base
v7 v6 v5 v4 v3 v2 v1 Base
v6 v5 v4 v3 v2 v1 Base
v5 v4 v3 v2 v1 Base
v4 v3 v2 v1 Base
v3 v2 v1 Base
v2 v1 Base
v1 Base
⬇️ Download this PR

Branch

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

Checkout

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

Cherry Pick

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

Pull

git pull origin refs/heads/G5bgufougyvpozncgq4yokgx3sie6wfy7

Stacked PRs enabled by GHerrit.

gherrit-pr-id: G5bgufougyvpozncgq4yokgx3sie6wfy7
@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 streamlines the Hermes analysis workflow by eliminating the intermediate 'shadow crate' step. Instead of copying project files to a temporary location for analysis, Hermes will now operate directly on the existing project structure. This change reduces file I/O, simplifies the internal architecture, and removes a layer of abstraction that is no longer necessary, leading to a more efficient and straightforward process.

Highlights

  • Shadow Crate Removal: The core mechanism of creating and managing a 'shadow crate' directory for analysis has been completely removed, simplifying the build process.
  • In-Place Analysis: Hermes now performs analysis directly on the original Cargo.toml manifests and source files within the workspace, rather than on copied shadow versions.
  • Code Simplification: Significant portions of code related to shadow crate creation, directory management, and symlinking have been deleted, reducing complexity.
  • Test Updates: Integration tests have been updated to reflect the removal of the shadow crate concept, including changes to mock output paths and removal of shadow directory assertions.

🧠 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/charon.rs
    • Updated cargo command to use the original manifest_path instead of the shadow_manifest_path.
    • Modified diagnostic mapping to use the workspace root directly for source file resolution.
  • tools/hermes/src/shadow.rs
    • Removed unused cargo_metadata::PackageName import.
    • Renamed shadow_manifest_path to manifest_path in the HermesArtifact struct.
    • Adjusted hashing logic to use the updated manifest_path.
    • Eliminated the build_shadow_crate function's logic for creating and managing the shadow root directory.
    • Removed the create_symlink_skeleton and platform-specific make_symlink functions.
  • tools/hermes/tests/integration.rs
    • Updated mock JSON output path handling to remove references to the shadow_root.
    • Removed assertions related to the expected shadow crate directory content.
    • Deleted the assert_directories_match utility function.
Activity
  • No human activity (comments, reviews, etc.) has been recorded on this pull request yet.
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.

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (G4otukodorqa35fh3ms527yqmldc7g7ft@565936b). Learn more about missing BASE report.

Additional details and impacted files
@@                         Coverage Diff                          @@
##             G4otukodorqa35fh3ms527yqmldc7g7ft    #3035   +/-   ##
====================================================================
  Coverage                                     ?   91.87%           
====================================================================
  Files                                        ?       20           
  Lines                                        ?     6057           
  Branches                                     ?        0           
====================================================================
  Hits                                         ?     5565           
  Misses                                       ?      492           
  Partials                                     ?        0           

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

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 effectively removes the concept of a shadow crate, simplifying the verification process by running charon directly on the source workspace. The changes are consistent and well-executed. I have a couple of suggestions to improve code clarity by renaming a function and a variable that are now misleading after this refactoring.

// inserted one for each package that has a root.
let shadow_manifest_path =
shadow_manifest_paths.get(&target.name.package_name).unwrap();
let manifest_path = find_package_root(&target.src_path).ok()?.join("Cargo.toml");
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Since this function no longer builds a shadow crate, its name build_shadow_crate has become misleading. For better clarity and maintainability, consider renaming it to something like find_hermes_artifacts. This would also require updating its documentation and any call sites.

// We still need the path for mapping `[SHADOW_ROOT]` correctly!
// But we construct it manually since it might not be created yet:
let abs_shadow_root = std::env::current_dir().unwrap().join(&shadow_root);
let abs_shadow_root = std::env::current_dir().unwrap().join(&sandbox_root);
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The variable abs_shadow_root is now misleading since shadow crates are no longer used. It actually holds the absolute path to the sandbox root. Renaming it to abs_sandbox_root would make the code easier to understand. You'll need to update its usage below as well.

Suggested change
let abs_shadow_root = std::env::current_dir().unwrap().join(&sandbox_root);
let abs_sandbox_root = std::env::current_dir().unwrap().join(&sandbox_root);

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