Skip to content

refactor(util): move the remaining Actions output onto the helper (#2047) - #2079

Merged
JarryShaw merged 1 commit into
mainfrom
refactor/2047-actions-helper-5
Oct 23, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
refactor/2047-actions-helper-5

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

What is the purpose of your pull request?

  • ci — changes to CI configuration files and scripts

Description of your pull request and other information

The last batch for #2047. discussion_report, project_status, python_versions, superseded and verdict_covers_checkout now write their Actions output through util/_actions.py. Their output is byte-identical except where a value used to be printed unescaped:

  • verdict_covers_checkout: bot-commit paths and author emails were raw. On main, a path containing \n::error::… printed an annotation of its own; it is escaped now.
  • python_versions: the --file path in the error prefix is now escaped.
  • project_status: the repo in the search query is now escaped, though a valid repo name has no %.

Workflow changes needed for the import:

  • Sparse checkouts: util/_actions.py is added in deploy-pages.yml, experimental.yml, python-compatibility.yml and unit-tests.yml.
  • project-status.yml (pull_request_target): it already downloads its script through the API at ${SCRIPT_REF}. It now fetches project_status.py and _actions.py in a loop at the same ref, still with no checkout and no expression inside run:.
  • create-release.yml, Read the released Python versions: it also copies the released commit's util/_actions.py, but only when that commit has the file.

Tests:

  • Each script's whole stdout, $GITHUB_OUTPUT and summary are pinned. The byte pins pass on main's scripts too, apart from the escaping changes above.
  • The wiring tests run the real Project Status step and the release reader, both with and without _actions.py in the released commit.
  • Planted divergences were caught, including ModuleNotFoundError: No module named '_actions' when the fetch or copy is dropped.
  • Rebased onto 61bb4ba66: the SCRIPTS tuple is the union and the patch-id is unchanged. The readers pass, and the full project leg ran 2051 tests with 0 failures.

Overlap: #2076 also changes superseded.py (stopped=true), so whichever merges second needs a rebase.

)

- util/discussion_report.py, project_status.py, python_versions.py,
  superseded.py, verdict_covers_checkout.py: annotations, step outputs and
  summary lines go through util/_actions.py; the scripts' own escape()s and
  write_github_output's delimiter code go. Output is unchanged byte for byte,
  except that values the scripts interpolated unescaped are now escaped:
  --file in python_versions, --repo in project_status, VERDICT_SHA, --head and
  bot-commit paths in verdict_covers_checkout.
- Workflows: the sparse checkouts in deploy-pages, experimental (both),
  python-compatibility and unit-tests list util/_actions.py; Project Status
  fetches it beside project_status.py at the same ref; Create Release copies
  the released commit's helper beside its python_versions.py where it has one.
- Tests pin each script's whole stdout, $GITHUB_OUTPUT and summary (they pass
  on main bar the escaping changes), run the Project Status step and the
  released reader with the helper, and hold every sparse checkout of a helper
  script to listing it; test_actions_helper_2047 lists the five scripts.
- docs: workflows.rst and deploy-pages.yml say what is checked out.

tests/project leg under run_unittest_leg.py: 2051 tests OK (71 skipped).
@JarryShaw JarryShaw added ci Pull requests that change CI or workflow configuration (ci: subject prefix) refactor Restructuring for its own sake — neither a fix nor a new capability (refactor: prefix) review: running A cross-review is in flight against the current head - no verdict yet labels Oct 23, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

GOOD TO GO at e38801fa2 (Sonnet cross-review).

project-status.yml

  • SCRIPT_REF is ${{ github.sha }} in env:. Under pull_request_target that is the base tip, never the PR head.
  • The fetch loop names two fixed literals at the same ref and path.
  • No ${{ }} sits inside run:, and there is no checkout or uses:. So nothing from the PR can shadow import _actions: $RUNNER_TEMP holds only the two fetched files.

create-release.yml: the step gains exactly the five lines that copy _actions.py when the released commit has it. Older releases still run unchanged.

Every invocation site: the reviewer checked every job that runs one of the five scripts. Each one has _actions.py available, by full checkout, by its sparse list, or already.

Output: old and new give byte-identical output on every input tried, apart from the three listed escaping fixes. One more, not in the body: set_output now treats a bare \r as multi-line. No current output value contains one.

Unverified until a live run: that a failed gh api fetch aborts the Project Status step under bash -e.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: running A cross-review is in flight against the current head - no verdict yet labels Oct 23, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Oct 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Coverage: 91.54% (unit tier, Python 3.15, e38801fa2, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 2 95.16%
pcapkit/const 19599 880 2618 866 92.12%
pcapkit/corekit 2565 71 812 37 96.56%
pcapkit/dumpkit 282 3 102 3 98.44%
pcapkit/foundation 2930 23 1022 25 98.79%
pcapkit/interface 138 4 52 3 96.32%
pcapkit/protocols 17414 219 4574 185 98.14%
pcapkit/toolkit 869 36 298 10 95.20%
pcapkit/utilities 473 7 136 5 98.03%
pcapkit/vendor 4432 1988 1018 167 51.87%

Per-file detail: the coverage-html artifact of this run.

@JarryShaw

Copy link
Copy Markdown
Owner Author

Ready to merge at e38801fa2: the review is GOOD TO GO and CI is complete (56 passed, 0 failed). The ordering leg ran 2060 tests with 0 failures. The 3.8–3.10 KTLO legs show 0 failing tests, and the PR is based on current main (61bb4ba66).
#2079 overlaps #2080 in superseded.py and #2081 in the SCRIPTS tuple, so whichever merges after this will need a rebase, which I'll do.

@JarryShaw
JarryShaw merged commit 834ff89 into main Oct 23, 2026
65 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Oct 23, 2026
@JarryShaw
JarryShaw deleted the refactor/2047-actions-helper-5 branch October 23, 2026 13:45
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 23, 2026
JarryShaw added a commit that referenced this pull request Oct 23, 2026
#2073)

#2079's byte pin for the watch command was written before #2076 made a stop write stopped=true to $GITHUB_OUTPUT; together they left main red.
JarryShaw added a commit that referenced this pull request Oct 23, 2026
Step 2 of #1967, third batch for create-release.yml: three of
version_check's inline shell steps move into stdlib-only scripts, on the
python3 setup-python puts first on PATH, with each step's name, id and
env: unchanged; only the run: bodies differ. Get Version stays inline.

* util/release_tiers.py: "Read the released Python versions", with
  #2079's copy of the released commit's util/_actions.py, where it has one.
* util/release_published.py pypi|anaconda: "Check PyPI publish
  completeness" and "Check Anaconda publish completeness", which shared
  all but endpoint, expectation and count. Same curl, URLs and /tmp paths.
* workflows.rst lists both scripts.

tests/project/test_release_version_check_scripts_1967.py runs each former
shell, kept verbatim, and its script on the same cases against stand-in
python3, git, mktemp and curl, requiring the same status, output,
$GITHUB_OUTPUT, calls and scratch files; the tables reach every exit and
path of each shell, and planted divergences are caught. The tests that ran
or pinned the shell now run or read the scripts.
JarryShaw added a commit that referenced this pull request Oct 23, 2026
)

Step 2 of #1967, third batch for create-release.yml: three of
version_check's inline shell steps move into stdlib-only scripts, on the
python3 setup-python puts first on PATH, with each step's name, id and
env: unchanged; only the run: bodies differ. Get Version stays inline.

* util/release_tiers.py: "Read the released Python versions", with
  #2079's copy of the released commit's util/_actions.py, where it has one.
* util/release_published.py pypi|anaconda: "Check PyPI publish
  completeness" and "Check Anaconda publish completeness", which shared
  all but endpoint, expectation and count. Same curl, URLs and /tmp paths.
* workflows.rst lists both scripts.

tests/project/test_release_version_check_scripts_1967.py runs each former
shell, kept verbatim, and its script on the same cases against stand-in
python3, git, mktemp and curl, requiring the same status, output,
$GITHUB_OUTPUT, calls and scratch files; the tables reach every exit and
path of each shell, and planted divergences are caught. The tests that ran
or pinned the shell now run or read the scripts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Pull requests that change CI or workflow configuration (ci: subject prefix) refactor Restructuring for its own sake — neither a fix nor a new capability (refactor: prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant