Skip to content

[code-improvement] reusability: reuse shared SHA-256 helper - #153

Merged
Pedro Henrique Penna (ppenna) merged 1 commit into
devfrom
code-improvement/reuse-benchmark-sha256-0fdd76ccfbc205c4
Sep 21, 2026
Merged

Pedro Henrique Penna (ppenna) merged 1 commit into
devfrom
code-improvement/reuse-benchmark-sha256-0fdd76ccfbc205c4

Conversation

@ppenna

Copy link
Copy Markdown
Contributor

Scope

Category: reusability

Evidence and novelty

scripts/nvx_tools/benchmark.py contained a private chunked SHA-256 implementation identical to the established scripts/nvx_tools/common.py::sha256_file helper. Five benchmark provenance call sites already exercised the duplicate implementation, providing a proven second use for the shared helper.

Recent code-improvement pull requests and their reviews were inspected. The prior reusability change in #144 concerned versioned JSON parsing, and open issues and pull requests do not track this hash-helper reuse, so this is neither a duplicate nor a cosmetic variant of rejected work.

Change

  • Reuse common.sha256_file for benchmark artifact and helper provenance hashes.
  • Remove the redundant hashlib import and local _sha256_file implementation.

Changed files: scripts/nvx_tools/benchmark.py

Patch size: 21 total added-plus-deleted lines (7 additions, 14 deletions).

Validation

All applicable repository-defined checks passed:

  • python -m unittest scripts.test_nvx_tools.BenchmarkTests -v
  • python -m unittest scripts/test_performance.py scripts/test_nvx_tools.py scripts/test_microvm_tests.py scripts/test_development_release.py -v
  • python -m compileall -q scripts
  • python -m ruff check scripts
  • python -m pyright --pythonplatform Linux
  • python -m pyright --pythonplatform Windows
  • python -m ruff format --check scripts
  • python .github/skills/nvx-host-connect/scripts/test_hosts.py -v
  • python scripts/nvx.py --help
  • python scripts/nvx.py test-openvmm-unit --help
  • python scripts/nvx.py test-openvmm --help
  • python scripts/nvx.py test-microvm --help
  • python scripts/nvx.py benchmark --help
  • git diff --check

python scripts/nvx.py verify was not run because this workflow is prohibited from initializing or inspecting the private OpenVMM submodule.

No dependency, public API/CLI/ABI, gitlink, or OpenVMM change was made.

Generated by code-improvement · copilot · gpt56 · 86.3 AIC · ⌖ 30.5 AIC · ⊞ 15.9K ·

  • expires on Oct 5, 2026, 2:02 AM UTC

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 21, 2026 02:02

Copilot AI left a comment

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.

Copilot review overview

🟢 Approval recommended

The shared helper is behaviorally identical to the removed implementation, and all affected call sites were updated correctly.

Review effort: Balanced
Findings: None

What changed in this PR

Replaces benchmark-specific SHA-256 logic with the established shared helper without changing behavior.

Changes:

  • Imports common.sha256_file.
  • Removes the duplicate implementation and hashlib import.
  • Updates five provenance hash call sites.
File Description
scripts/​nvx_tools/​benchmark.py Reuses the shared SHA-256 helper for benchmark provenance.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@ppenna
Pedro Henrique Penna (ppenna) marked this pull request as ready for review September 21, 2026 02:41
@ppenna
Pedro Henrique Penna (ppenna) merged commit 509718e into dev Sep 21, 2026
40 checks passed
@ppenna
Pedro Henrique Penna (ppenna) deleted the code-improvement/reuse-benchmark-sha256-0fdd76ccfbc205c4 branch September 21, 2026 03:07
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