You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test: select every orphaned test module in CI and guard the selection - #4748
17 test modules were selected by no CI job: the 16 top-level tests/test_*.py modules from the issue, plus tests/acceptance/test_logging_acceptance.py. Failures in them went unnoticed. This PR moves them under tests/unit/<area>/, triages what they surface, and adds a guard so an unselected module cannot reappear.
test_gitlab_git_transport.py goes to tests/integration/ (component), not tests/unit/, because it spawns git (taxonomy tm006 rejects process-spawning unit modules). The hermetic integration run selects it.
Repo-root lookups move to Path(__file__).resolve().parents[3], and the obsolete sys.path inserts are dropped.
Triage (pytest -n 2 over all 17 modules on main 899d17b, then in place under tests/unit):
product: _same_document re-parses the on-disk text that write() already parsed; parsing the new serialization is legitimate
test narrowed to parses of the on-disk text (2 == 1), strict xfail citing #4742 (filed, 0.38.0; one owner agreed with PERF)
Codex adapter modules wrote .codex/config.toml into the repo cwd
test hygiene
autouse monkeypatch.chdir(tmp_path)
test_token_manager.py::test_empty_string_invalid
exact duplicate of tests/unit/core/test_token_manager_lifecycle.py::test_empty_string_is_invalid (AST body hash)
deleted
No other exact duplicates were found: every function was AST-hashed against tests/unit.
Guard:tests/unit/test_ci_test_selection_coverage.py reads the test roots that each workflow's pytest, scripts.ci_sharding and scripts.ci_selections lines name, plus scripts/ci_selections.SELECTIONS. It fails on any test module those roots do not cover. Out of scope are tests/integration, tests/lifecycle, tests/benchmarks and tests/perf, which have their own jobs. Two negative controls pin the detector, so a paths: filter or an echo does not count as a selection. Red check: a temporary tests/test_tmp_orphan.py makes it fail with test modules no CI job selects ...: ['tests/test_tmp_orphan.py'].
Bookkeeping:
The path-keyed quality baselines (assertion_quality_baseline.json, test_taxonomy_baseline.json, exact_test_duplicates.json) are re-keyed and kept sorted. The duplicates baseline drops 6 stale entries (--update-baseline); nothing grows.
CONFORMANCE.{json,md} is regenerated after a full pytest tests --collect-only; only req-lk-001's node id changes.
Human scope-approval comment: pending. The Q&L lead assigned the work (Epic #4565); a fresh scope approval has been requested through the regent.
Does this PR complete the issue, or what remains? It completes #4736: every test module under tests/ is selected, each failure is triaged, and the guard is in place. The product fix for the lockfile double parse is #4742, a separate PR that flips the xfail.
Type of change
Bug fix
New feature
Documentation
Maintenance / refactor
Testing
Tested locally
All existing tests pass
Added tests for new functionality (if applicable)
Validation evidence (local, host_guard, -n 2):
the 17 moved modules plus the guard: 668 passed, 2 skipped, 1 xfailed, 9 subtests passed
tests/quality/test_ci_topology.py: passed (in the 523 passed run before the baseline re-sort)
lint chain: ruff 0.15.12 check + format, pylint R0801 10.00/10, auth signals, complexity ratchet, taxonomy --changed, AQ ratchet, exact-duplicate ratchet: all clean
Changelog
One fragment per section, changelog.d/<pr>.<section>.md, holding
one line: user-visible effect first, 25 words or fewer, ending with (#PR); breaking changes only under upgrade notes; no Highlights; no
new lines under ## [Unreleased]. See changelog.d/README.md and .github/instructions/changelog.instructions.md.
…4736)
17 test modules (16 top-level tests/test_*.py plus tests/acceptance)
ran in no CI job. They move under tests/unit/<area>/; the git-spawning
GitLab transport module moves to tests/integration (component).
Triage of the failures this surfaces:
- three stale resolver tests now pin enforce_ref_pins/accept_ref_change
- a stale install-logging fixture gains apm.yml's required version
- two Codex adapter modules stop writing .codex/ into the repo cwd
- test_write_parses_legacy_lockfile_once now counts parses of the
on-disk text only; it is a strict xfail citing #4742
- one exact duplicate (test_empty_string_invalid) is removed
tests/unit/test_ci_test_selection_coverage.py fails when a test module
outside integration/lifecycle/benchmarks/perf is not named by any
workflow pytest, sharding or selection command.
Fixes#4736
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The coverage guard can miss orphaned test modules by crediting non-executing command text and unused selections, and by exempting paths outside the intended directories.
This PR addresses #4736 by moving orphaned tests into CI-selected directories and adding a guard against future selection gaps. It also fixes stale test expectations and tracks the known lockfile parsing issue separately in #4742.
Changes:
Relocates 17 test modules, adjusts repository-root lookups, and isolates Codex configuration writes.
Adds a workflow-selection coverage guard with negative controls.
Updates quality baselines, test references, and conformance metadata for the moved paths.
- the guard reads tokenized commands: a launcher (uv/python/pytest) must
run pytest, ci_sharding files or ci_selections as a module; echo
lines, --collect-only runs, --ignore values and comments select
nothing; a selection counts only where a workflow invokes it; the
own-job exclusions match directory boundaries
- test_git_config_global_uses_dev_null_on_unix fakes sys.platform, so on
a Windows host os.devnull stays 'nul': skip it there
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Active findings show false-positive CI coverage from ignored files and quoted shell text, an incorrect test classification, and a structured-reference test that can pass without exercising the intended dispatch.
This module reads workflow files and recursively inventories the filesystem, and its negative controls create files through tmp_path. It therefore crosses the component boundary defined in pyproject.toml:217-219, rather than the pure-logic/no-filesystem unit boundary. Mark the module as component so its behavioral classification matches the tests it contains.
Splitting before interpreting quotes makes echo 'status; pytest tests/test_tmp_orphan.py; done' credit the module even though the shell only prints text. Preserve quoting when identifying command boundaries, and add this quoted-separator case as a negative control.
Preserve per-command exclusions in module coverage
uv run pytest tests/extra --ignore tests/extra/test_orphan.py still credits the ignored module through the tests/extra root, allowing an orphan to pass the guard. Preserve exclusions per command when computing module coverage, and add a negative control with an ignored file inside the selected directory.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The coverage guard can credit modules that never execute due to quoted commands, comments, or marker filters, and the structured-reference test masks a class mismatch without exercising its intended branch.
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
full-integrationRun the full integration suite (ci-integration.yml) on this PR before merge
2 participants
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.
Description
17 test modules were selected by no CI job: the 16 top-level
tests/test_*.pymodules from the issue, plustests/acceptance/test_logging_acceptance.py. Failures in them went unnoticed. This PR moves them undertests/unit/<area>/, triages what they surface, and adds a guard so an unselected module cannot reappear.Moves (
git mv, history kept):models/:test_apm_package_models.pydeps/:test_apm_resolver.py,test_github_downloader*.py,test_lockfile.py,test_virtual_package_multi_install.pyadapters/: the three empty-string and Codex modulescore/:test_collision_integration.py,test_runnable_prompts.py,test_token_manager.pycompilation/:test_distributed_compilation.pyprimitives/:test_enhanced_discovery.pyruntime/:test_runtime_manager_token_precedence.pyinstall/:test_logging_acceptance.pytest_gitlab_git_transport.pygoes totests/integration/(component), nottests/unit/, because it spawns git (taxonomy tm006 rejects process-spawning unit modules). The hermetic integration run selects it.Path(__file__).resolve().parents[3], and the obsoletesys.pathinserts are dropped.Triage (
pytest -n 2over all 17 modules on main 899d17b, then in place undertests/unit):test_apm_resolver.pyx3,resolve_marketplace_pluginexpected callenforce_ref_pins/accept_ref_changeenforce_ref_pins=True, accept_ref_change=Falsetest_logging_acceptance.py::test_dry_run_shows_dry_run_labelapm.ymllacked the requiredversionversion: 1.0.0test_lockfile.py::test_write_parses_legacy_lockfile_once(assert 3 == 1)_same_documentre-parses the on-disk text thatwrite()already parsed; parsing the new serialization is legitimate2 == 1), strictxfailciting #4742 (filed, 0.38.0; one owner agreed with PERF).codex/config.tomlinto the repo cwdmonkeypatch.chdir(tmp_path)test_token_manager.py::test_empty_string_invalidtests/unit/core/test_token_manager_lifecycle.py::test_empty_string_is_invalid(AST body hash)No other exact duplicates were found: every function was AST-hashed against
tests/unit.Guard:
tests/unit/test_ci_test_selection_coverage.pyreads the test roots that each workflow's pytest,scripts.ci_shardingandscripts.ci_selectionslines name, plusscripts/ci_selections.SELECTIONS. It fails on any test module those roots do not cover. Out of scope aretests/integration,tests/lifecycle,tests/benchmarksandtests/perf, which have their own jobs. Two negative controls pin the detector, so apaths:filter or anechodoes not count as a selection. Red check: a temporarytests/test_tmp_orphan.pymakes it fail withtest modules no CI job selects ...: ['tests/test_tmp_orphan.py'].Bookkeeping:
assertion_quality_baseline.json,test_taxonomy_baseline.json,exact_test_duplicates.json) are re-keyed and kept sorted. The duplicates baseline drops 6 stale entries (--update-baseline); nothing grows.CONFORMANCE.{json,md}is regenerated after a fullpytest tests --collect-only; onlyreq-lk-001's node id changes.primitive-types.mddoc path is updated.Issue and approved scope
Issue: Fixes #4736
Human scope-approval comment: pending. The Q&L lead assigned the work (Epic #4565); a fresh scope approval has been requested through the regent.
Does this PR complete the issue, or what remains? It completes #4736: every test module under
tests/is selected, each failure is triaged, and the guard is in place. The product fix for the lockfile double parse is #4742, a separate PR that flips the xfail.Type of change
Testing
Validation evidence (local, host_guard,
-n 2):668 passed, 2 skipped, 1 xfailed, 9 subtests passedtests/quality/test_test_taxonomy.py tests/quality/test_quality_baselines.py:43 passedtests/quality/test_ci_topology.py: passed (in the523 passedrun before the baseline re-sort)--changed, AQ ratchet, exact-duplicate ratchet: all cleanChangelog
changelog.d/<pr>.<section>.md, holdingone line: user-visible effect first, 25 words or fewer, ending with
(#PR); breaking changes only under upgrade notes; no Highlights; nonew lines under
## [Unreleased]. Seechangelog.d/README.mdand.github/instructions/changelog.instructions.md.Spec conformance (OpenAPM v0.1)
docs/src/content/docs/specs/openapm-v0.1.mdupdated(new/changed
<a id="req-XXX"></a>anchor + prose + Appendix Crow).
docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.ymlupdated.
@pytest.mark.req("req-XXX")test undertests/spec_conformance/added or extended.CONFORMANCE.{md,json}regenerated viauv run --extra dev python -m tests.spec_conformance.gen_statementand committed (node-id move only).