Skip to content

test(scripts): cover .github helper scripts - #2531

Merged
Borda merged 8 commits into
developfrom
test/github-scripts-coverage
Sep 3, 2026
Merged

Borda merged 8 commits into
developfrom
test/github-scripts-coverage

Conversation

@Borda

@Borda Borda commented Sep 2, 2026

Copy link
Copy Markdown
Member

The standalone scripts under .github/scripts run inside other workflows and inside pre-commit, so a regression in one of them surfaces as a confusing failure somewhere else. Give them direct coverage.

  • Add tests for star phrase rounding at every milestone boundary, both prose replacement forms, the mkdocs value rewrite and a near-miss key, doctest fence violation counting and message format, markdown link rewriting for relative, absolute, and non-markdown inputs, and the wheel manifest guard
  • Add a workflow running those tests plus the doctests embedded in the scripts, triggered on pushes and pull requests touching either directory
  • Add the two missing docstrings in augment_links.py

Tests live under tests/ so they inherit the repository's existing ruff and mypy overrides; a conftest puts the scripts directory on sys.path, since they are entry points rather than an installed package.

The standalone scripts under .github/scripts run inside other workflows and inside pre-commit, so a regression in one of them surfaces as a confusing failure somewhere else. Give them direct coverage.

- Add tests for star phrase rounding at every milestone boundary, both prose replacement forms, the mkdocs value rewrite and a near-miss key, doctest fence violation counting and message format, markdown link rewriting for relative, absolute, and non-markdown inputs, and the wheel manifest guard
- Add a workflow running those tests plus the doctests embedded in the scripts, triggered on pushes and pull requests touching either directory
- Add the two missing docstrings in augment_links.py

Tests live under tests/ so they inherit the repository's existing ruff and mypy overrides; a conftest puts the scripts directory on sys.path, since they are entry points rather than an installed package.

---
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>

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.

🟡 Changes recommended

Test collection currently fails because the referenced update_docs_stats module is absent.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds direct coverage for standalone .github helper scripts and a dedicated CI workflow.

Changes:

  • Adds unit tests for documentation, link, doctest, and wheel helpers.
  • Adds targeted script CI and doctest execution.
  • Documents two augment_links.py functions.
File summaries
File Description
tests/github_scripts/test_update_docs_stats.py Tests documentation statistics rewriting.
tests/github_scripts/test_ci_helpers.py Tests remaining script helpers.
tests/github_scripts/conftest.py Exposes scripts for test imports.
tests/github_scripts/__init__.py Defines the test package.
.github/workflows/ci-scripts.yml Runs script tests and doctests.
.github/scripts/augment_links.py Adds missing docstrings.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 4
  • Review effort level: Balanced

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

Comment thread tests/github_scripts/test_update_docs_stats.py Outdated
Comment thread .github/workflows/ci-scripts.yml Outdated
Comment thread tests/github_scripts/test_ci_helpers.py Outdated
Comment thread tests/github_scripts/test_ci_helpers.py
Changes:
- Remove the stale test that imported a nonexistent docs-stats helper.
- Strengthen script-helper assertions with a controlled repository root and a checked-in manifest happy path.
- Align the CI-scripts workflow with main/develop pushes and frozen development dependency synchronization.

Impact:
- CI script tests now exercise the actual maintained scripts and reject incorrect link resolution.
- The workflow tests relevant push branches with reproducible dependency resolution.

Verification:
- Ruff lint and format checks passed for the changed script tests and helper.
- Focused pytest/doctest suite passed: 11 tests.
- Workflow YAML parsed and git diff --check passed.

Residual limits:
- Fresh GitHub Actions CI and independent read-only review evidence require external follow-up.

---
Co-authored-by: Codex <codex@openai.com>
@codecov

codecov Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88%. Comparing base (2664387) to head (9879f55).

Additional details and impacted files
@@           Coverage Diff           @@
##           develop   #2531   +/-   ##
=======================================
  Coverage       88%     88%           
=======================================
  Files           85      85           
  Lines        12163   12163           
=======================================
  Hits         10694   10694           
  Misses        1469    1469           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Borda and others added 6 commits September 3, 2026 11:17
- Rename `seed_targets` -> `_seed_targets` to clarify it's an internal test utility.
- Update all references to use the new name.
Changes:
- Add a dedicated GitHub Actions workflow that installs the required dependency groups and runs every test in `.github/_tests`.

Impact:
- Repository workflow and documentation configuration regressions now receive a focused CI check on pushes and pull requests.

Verification:
- `uv run pytest .github/_tests -q` (21 passed).
- `uv run pre-commit run --files .github/workflows/ci-github-tests.yml .github/_tests/test_update_docs_stats.py` (passed).

Residual limits:
- GitHub-hosted runner execution is deferred until Actions runs the workflow.

---

Co-authored-by: Codex <codex@openai.com>
Changes:
- Move standalone `.github/scripts` tests into `.github/_tests` and merge their shared import setup.
- Update CI script-test discovery to use the consolidated directory.

Impact:
- Script tests now live with the other GitHub configuration tests while preserving script doctest coverage.

Verification:
- `PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .venv/bin/python -m pytest .github/_tests .github/scripts --doctest-modules -q` (32 passed).
- Focused pre-commit, Ruff, and mypy hooks passed.

Residual limits:
- The GitHub-hosted `uv run` wrapper remains deferred to CI because local uv could not initialize.

---

Co-authored-by: Codex <codex@openai.com>
Changes:
- Call the manifest validator directly in its success-path test.
- Install the docs dependency group before collecting consolidated GitHub tests.

Impact:
- Full mypy accepts the relocated test and CI can import Mike-based documentation tests.

Verification:
- `pre-commit run mypy --all-files` (passed).
- `PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .venv/bin/python -m pytest .github/_tests .github/scripts --doctest-modules -q` (32 passed).

Residual limits:
- GitHub-hosted runner execution remains deferred to CI.

---

Co-authored-by: Codex <codex@openai.com>
Changes:
- Run GitHub configuration tests and standalone script doctests in one workflow.
- Delete the duplicate CI scripts workflow.

Impact:
- Each GitHub test and doctest runs once per workflow invocation.

Verification:
- `pre-commit run mypy --all-files` (passed).
- `PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .venv/bin/python -m pytest .github/_tests .github/scripts --doctest-modules -q` (32 passed).

Residual limits:
- GitHub-hosted runner execution remains deferred to CI.

---

Co-authored-by: Codex <codex@openai.com>
@Borda
Borda merged commit 6cc5dba into develop Sep 3, 2026
39 checks passed
@Borda
Borda deleted the test/github-scripts-coverage branch September 3, 2026 09:17
@Borda Borda added the enhancement New feature or request label Sep 3, 2026
Borda added a commit that referenced this pull request Sep 3, 2026
* test(scripts): cover .github helper scripts
* test(ci): harden script verification
* test(tests): prefix internal helper and update references
* ci(ci): run GitHub configuration tests
* test(ci): consolidate GitHub script tests
* fix(ci): install docs for consolidated tests
* ci(ci): consolidate GitHub test workflows

---------

Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: Codex <codex@openai.com>
Borda added a commit that referenced this pull request Sep 4, 2026
* test(scripts): cover .github helper scripts
* test(ci): harden script verification
* test(tests): prefix internal helper and update references
* ci(ci): run GitHub configuration tests
* test(ci): consolidate GitHub script tests
* fix(ci): install docs for consolidated tests
* ci(ci): consolidate GitHub test workflows

---------

Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: Codex <codex@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants