[architect] refactor: single source of truth for scripts/render_pr_body.py and scripts/render_gate_section.py - #431
Open
kubestellar-hive[bot] wants to merge 1 commit into
Conversation
…der_gate_section scripts/render_pr_body.py and scripts/render_gate_section.py were byte-identical duplicates of the modules the render-pr-body and render-gate-section composite actions execute via $GITHUB_ACTION_PATH. They were the only duplicated blobs in the repository. Because tests/conftest.py puts scripts/ first on sys.path, the whole pytest suite exercised the scripts/ copies, leaving the two files that actually run in CI at 0% coverage, and nothing detected drift between the pairs. Make the scripts/ paths genuine thin re-export wrappers around the composite-action implementation, matching the intent already recorded in the conftest comment and the *_wrapper module names in tests/test_script_entrypoints.py. Add tests/test_render_single_source.py to fail if the duplication is reintroduced. No workflow, action.yml, or rendering behaviour changes. Refs #430 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: kubestellar-hive[bot] <kubestellar-hive[bot]@users.noreply.github.com>
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor
Cluster claimed:
scripts/render_pr_body.py,scripts/render_gate_section.py,tests/conftest.py(sys.path comment only), newtests/test_render_single_source.py.Not touched: any
.github/workflows/*.yml, anyaction.yml, anydocs/file, anybootc-build/file, and the implementation bodies in.github/actions/render-pr-body/and.github/actions/render-gate-section/(unchanged, byte for byte).The problem
scripts/render_pr_body.pyandscripts/render_gate_section.pywere byte-identical duplicates of the modules therender-pr-body/render-gate-sectioncomposite actions execute via$GITHUB_ACTION_PATH. They were the only duplicated blobs in the whole repository:tests/conftest.pyputsscripts/first onsys.path, so the entire pytest suite exercised thescripts/copies — while the copies that actually run in CI (reusable-promote-squash.yml:288,reusable-release-gate.yml:379) had 0% coverage, and nothing in the repo detected drift between the pairs.Coverage on
main(eb4c546), using the exactunit-tests.ymlinvocation:The change
Make the two
scripts/paths genuine thin re-export wrappers that load the composite-action implementation withimportliband re-export its namespace. This matches the intent already written into the codebase —tests/conftest.pycalls them "the shipped wrapper files", andtests/test_script_entrypoints.pyalready loads them under the module namesrender_pr_body_wrapper/render_gate_section_wrapper.Both entry points keep working unchanged: import (
import render_pr_body),importlib.util.spec_from_file_location,runpy.run_path(run_name="__main__"), and directpython3 scripts/render_pr_body.pyexecution.Adds
tests/test_render_single_source.py, which asserts the imported callables have__code__.co_filenamepointing into.github/actions/…and that thescripts/files are wrappers rather than restatements — so the duplication cannot be reintroduced silently.Verification
Same
unit-tests.ymlpytest invocation, after the change:scripts/render_pr_body.pyand.github/actions/render-pr-body/render_pr_body.pyproduce byte-identical output for the same CLI arguments (verified by diff).Refs #430
Filed by architect agent (ACMM L5 — hold-gated mode). Hold-gated: human review required.
— hive: agent=architect backend=copilot model=claude-opus-5