Repository navigation
Description
Raised by CodeRabbit against #1255 after that pull request merged. The sibling finding, C# test-project name detection, is fixed separately. This half is filed rather than fixed because settling it needs a check this host cannot perform.
The defect
.github/workflows/validate-task.yml gates its four Python steps on:
hashFiles('pyproject.toml') != '' && hashFiles('tests/**') != ''hashFiles('tests/**') matches any file under tests/, including a tests/README.md that sits beside no Python at all. All four Python steps then activate and pytest runs against a directory it collects nothing from.
Why it matters now rather than before
#1255 made spec/audit.py require a .py file under a test directory, pinned by its selftest case python, a test directory holding no Python. The workflow was not changed to match. So the two now disagree about the same repository: the audit reports no Python tests and drops the coverage claim, while the validator runs the Python leg and collects nothing. Before #1255 both were wrong in the same direction, which is less confusing than one of each.
Why this is not a one-line fix
The obvious change is hashFiles('tests/**/*.py'). It cannot be verified from a Linux checkout, and the repository's own model of the guard disagrees with the likely real behavior:
scripts/tests/test_release_guards.py'shash_files()expands**to.*and*to[^/]*, sotests/**/*.pybecomestests/.*/[^/]*\.py, which requires a second path segment and therefore does not matchtests/test_a.py. Applying the change makes two existing guard cases fail.- GitHub's
hashFilesuses@actions/glob, where globstar conventionally matches zero or more segments, sotests/**/*.pywould matchtests/test_a.py.
If the second is right, the repository's test model is wrong and should be corrected alongside the guard. If the first is right, the guard needs a different spelling. Nothing on a developer host settles which, and guessing would either ship a guard that silently stops matching every Python repository, or a test that pins the wrong semantics.
What settling it needs
- Determine empirically what
hashFilesdoes withtests/**/*.pyagainst a root-leveltests/test_a.py, on GitHub rather than by reasoning. A scratch workflow on a branch answers it in one run. - Fix the guard to require a Python file, in whatever spelling that answer supports. A disjunction such as
(hashFiles('tests/*.py') != '' || hashFiles('tests/**/*.py') != '')is unambiguous under both readings if the direct form turns out not to be. - Correct
hash_files()inscripts/tests/test_release_guards.pyif its globstar handling is shown wrong, since every other guard assertion rests on it. - Add the
tests/README.md-only regression case to the guard trees, which is written and was reverted out of the fix for the C# half.
Note that the audit and the validator will still differ in scope by design after this: spec/audit.py discovers test modules anywhere in the tree, while the validator's guard is root-tests/ only, which WORKFLOW.md D1.6 states deliberately. This issue is only about the empty-directory case.
Activity
Read a C# Test Project Name Two Ways, Not One (#1262)
Promote Develop to Main: Settle Section 5 and the CRLF Chain (#1263)