Skip to content

Conversation

@joshlf
Copy link
Member

@joshlf joshlf commented Feb 8, 2026

Invoke charon using --message-format=json. Intercept all tool output
and render our own unified terminal UI.

TODO: Review this PR in depth.


This PR is on branch hermes.

Latest Update: v19 — Compare vs v18

📚 Full Patch History

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

Version v18 v17 v16 v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v19 v18 v17 v16 v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v18 v17 v16 v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v17 v16 v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v16 v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v13 v12 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/Gd1a7f9c4436f266d37e83ebc2310f5a99a73d24d && git checkout -b pr-Gd1a7f9c4436f266d37e83ebc2310f5a99a73d24d FETCH_HEAD

Checkout

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

Cherry Pick

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

Pull

git pull origin refs/heads/Gd1a7f9c4436f266d37e83ebc2310f5a99a73d24d

Stacked PRs enabled by GHerrit.

@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 significantly refines how compiler diagnostics are presented to the user within the hermes tool. By introducing a dedicated diagnostic mapping system, it translates internal build paths into meaningful user-facing paths, making error messages much clearer and easier to act upon. The changes also streamline the processing of diagnostic output from the charon driver, ensuring that all relevant information, including help messages and code spans, is correctly rendered. This enhancement is backed by extensive new integration tests to guarantee reliability across diverse error conditions.

Highlights

  • Enhanced Diagnostic Path Mapping: Implemented robust shadow-to-user path mapping for compiler errors, ensuring diagnostic messages display paths relative to the user's original project structure rather than temporary build directories.
  • JSON Diagnostic Processing: The charon driver now explicitly requests JSON-formatted diagnostic messages from Cargo and processes them using a new DiagnosticMapper to render user-friendly output with miette.
  • Improved Integration Testing: Added a comprehensive suite of new integration tests to cover various diagnostic scenarios, including interleaved output, missing source files, external dependencies, macro expansions, and multibyte character offsets. The test runner now supports mocking charon's JSON output for deterministic testing.
  • Refined Error Handling: Modified the charon execution to pipe stdout, allowing for real-time processing of diagnostic messages and bailing out if any error-level diagnostics are detected, providing more precise failure signals.

🧠 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
    • Added DiagnosticLevel import from cargo_metadata.
    • Modified run_charon to pipe stdout and spawn charon as a child process.
    • Added --message-format=json argument to cargo command for JSON output.
    • Implemented logic to read charon's stdout, parse JSON messages, and use DiagnosticMapper to render diagnostics.
    • Introduced output_error flag to track error-level diagnostics and updated error handling.
  • tools/hermes/src/diagnostics.rs
    • Added new file diagnostics.rs.
    • Defined DiagnosticMapper struct for mapping shadow paths to user paths and caching source content.
    • Implemented map_path to convert shadow paths to user paths.
    • Implemented get_source to read and cache source file content.
    • Implemented render_miette to process cargo_metadata::diagnostic::Diagnostic messages, map file paths, and render them using miette.
    • Defined MappedError struct implementing miette::Diagnostic for custom error rendering.
  • tools/hermes/src/main.rs
    • Added mod diagnostics; to include the new diagnostics module.
  • tools/hermes/tests/fixtures/env_interleaved_stdout/expected_status.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/env_interleaved_stdout/expected_stderr.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/env_interleaved_stdout/hermes.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/env_interleaved_stdout/mock_charon_output.json
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/env_interleaved_stdout/source/Cargo.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/env_interleaved_stdout/source/src/lib.rs
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/fs_missing_source/expected_status.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/fs_missing_source/expected_stderr.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/fs_missing_source/hermes.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/fs_missing_source/mock_charon_output.json
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/fs_missing_source/source/Cargo.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/fs_missing_source/source/src/lib.rs
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/hermes_multiple_targets/args.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/hermes_multiple_targets/expected_artifacts.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/hermes_multiple_targets/hermes.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/hermes_multiple_targets/source/Cargo.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/hermes_multiple_targets/source/src/bin/my_bin.rs
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/hermes_multiple_targets/source/src/lib.rs
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/hermes_shim_syntax_error/expected_status.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/hermes_shim_syntax_error/expected_stderr.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/hermes_shim_syntax_error/hermes.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/hermes_shim_syntax_error/mock_charon_output.json
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/hermes_shim_syntax_error/source/Cargo.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/hermes_shim_syntax_error/source/src/lib.rs
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/json_code_suggestions/expected_status.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/json_code_suggestions/expected_stderr.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/json_code_suggestions/hermes.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/json_code_suggestions/mock_charon_output.json
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/json_code_suggestions/source/Cargo.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/json_code_suggestions/source/src/lib.rs
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/json_linker_error/expected_status.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/json_linker_error/expected_stderr.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/json_linker_error/hermes.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/json_linker_error/mock_charon_output.json
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/json_linker_error/source/Cargo.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/json_linker_error/source/src/lib.rs
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/json_nested_children/expected_status.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/json_nested_children/expected_stderr.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/json_nested_children/hermes.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/json_nested_children/mock_charon_output.json
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/json_nested_children/source/Cargo.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/json_nested_children/source/src/lib.rs
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/map_external_dep/expected_status.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/map_external_dep/expected_stderr.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/map_external_dep/hermes.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/map_external_dep/mock_charon_output.json
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/map_external_dep/source/Cargo.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/map_external_dep/source/src/lib.rs
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/map_rewritten_file/expected_status.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/map_rewritten_file/expected_stderr.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/map_rewritten_file/hermes.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/map_rewritten_file/mock_charon_output.json
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/map_rewritten_file/source/Cargo.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/map_rewritten_file/source/src/lib.rs
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/map_std_library/expected_status.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/map_std_library/expected_stderr.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/map_std_library/hermes.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/map_std_library/mock_charon_output.json
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/map_std_library/source/Cargo.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/map_std_library/source/src/lib.rs
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/map_symlinked_file/expected_status.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/map_symlinked_file/expected_stderr.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/map_symlinked_file/hermes.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/map_symlinked_file/mock_charon_output.json
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/map_symlinked_file/source/Cargo.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/map_symlinked_file/source/src/lib.rs
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/map_symlinked_file/source/src/untransformed.rs
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/span_empty_unsafe_block/expected_status.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/span_empty_unsafe_block/expected_stderr.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/span_empty_unsafe_block/hermes.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/span_empty_unsafe_block/mock_charon_output.json
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/span_empty_unsafe_block/source/Cargo.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/span_empty_unsafe_block/source/src/lib.rs
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/span_empty_unsafe_block/source/src/untransformed.rs
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/span_macro_expansion/expected_status.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/span_macro_expansion/expected_stderr.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/span_macro_expansion/hermes.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/span_macro_expansion/mock_charon_output.json
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/span_macro_expansion/source/Cargo.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/span_macro_expansion/source/src/lib.rs
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/span_macro_expansion/source/src/untransformed.rs
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/span_multibyte_offsets/expected_status.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/span_multibyte_offsets/expected_stderr.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/span_multibyte_offsets/hermes.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/span_multibyte_offsets/mock_charon_output.json
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/span_multibyte_offsets/source/Cargo.toml
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/span_multibyte_offsets/source/src/lib.rs
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/span_multibyte_offsets/source/src/untransformed.rs
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/unsafe_redaction/expected/src/lib.rs
    • Minor whitespace change (newline at end of file).
  • tools/hermes/tests/fixtures/unsafe_redaction/expected_status.txt
    • Added new test fixture file.
  • tools/hermes/tests/fixtures/unsafe_redaction/expected_stderr.txt
    • Added new test fixture file.
  • tools/hermes/tests/integration.rs
    • Modified the charon shim script to support mocking charon's JSON output via HERMES_MOCK_CHARON_JSON.
    • Added logic to run_integration_test to detect and process mock_charon_output.json files, replacing placeholders like [PROJECT_ROOT] and [SHADOW_ROOT].
    • Updated stderr comparison logic to replace absolute sandbox paths with [PROJECT_ROOT] for deterministic test assertions.
Activity
  • A new diagnostics module has been introduced to handle the complex task of mapping paths in compiler error messages.
  • The charon driver's execution flow has been refactored to capture and interpret JSON diagnostic output from Cargo.
  • Numerous new integration tests have been added, demonstrating a thorough approach to validating the new diagnostic mapping and rendering capabilities.
  • The integration test harness itself has been enhanced to allow for mocking external tool output, improving test reliability and isolation.
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

The pull request introduces a robust mechanism for mapping compiler diagnostics from the shadow build directory back to the user's source directory, which is a significant improvement for usability. The implementation uses miette for high-quality error reporting and handles path mapping and source caching effectively. I've noted a small redundancy in the diagnostic rendering logic that can be simplified.

@codecov-commenter
Copy link

codecov-commenter commented Feb 8, 2026

Codecov Report

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

Additional details and impacted files
@@                            Coverage Diff                             @@
##           G3db3762006cf6333a7112b668f747072f8bb477b    #3019   +/-   ##
==========================================================================
  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.

@joshlf joshlf force-pushed the Gd1a7f9c4436f266d37e83ebc2310f5a99a73d24d branch 2 times, most recently from d0afaee to 0062c3c Compare February 8, 2026 19:17
@joshlf joshlf force-pushed the G3db3762006cf6333a7112b668f747072f8bb477b branch from e17001b to bd320db Compare February 10, 2026 00:50
@joshlf joshlf force-pushed the Gd1a7f9c4436f266d37e83ebc2310f5a99a73d24d branch from 0062c3c to 6b62149 Compare February 10, 2026 00:50
@joshlf joshlf force-pushed the Gd1a7f9c4436f266d37e83ebc2310f5a99a73d24d branch 2 times, most recently from 8771c47 to d46c4e1 Compare February 10, 2026 23:18
@joshlf joshlf force-pushed the G3db3762006cf6333a7112b668f747072f8bb477b branch from bd320db to 76a916e Compare February 10, 2026 23:18
@joshlf joshlf force-pushed the Gd1a7f9c4436f266d37e83ebc2310f5a99a73d24d branch from d46c4e1 to 4a6fb49 Compare February 10, 2026 23:23
@joshlf joshlf changed the title diagnostics: finalize robust shadow-to-user path mapping for compiler errors [hermes] Take responsibility for all terminal UI Feb 10, 2026
@joshlf joshlf force-pushed the Gd1a7f9c4436f266d37e83ebc2310f5a99a73d24d branch from 4a6fb49 to c0f128f Compare February 11, 2026 18:52
Invoke `charon` using `--message-format=json`. Intercept all tool output
and render our own unified terminal UI.

TODO: Review this PR in depth.

gherrit-pr-id: Gd1a7f9c4436f266d37e83ebc2310f5a99a73d24d
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