Skip to content

tests/grep-q-pipes: fail when a scan pathspec matches nothing - #597

Merged
derekross merged 1 commit into
derekross:mainfrom
only21mil:build/grep-q-pipes-pathspec-check
Nov 10, 2026
Merged

derekross merged 1 commit into
derekross:mainfrom
only21mil:build/grep-q-pipes-pathspec-check

Conversation

@only21mil

Copy link
Copy Markdown
Contributor

What and why

On #587 the maintainer found that the scan's pathspec 'packages/*/test' matched no file (a git pathspec with a wildcard has to match the whole path), so from #575 until a81fcf3 tests/grep-q-pipes read none of the package tests and still printed ok. a81fcf3 fixed the pathspec; this makes a wrong one fail loudly (review lesson L-419: a check must be able to fail).

Before the scan, each scan pathspec (tests, 'packages/*/test/*', bin, tools, rootfs) must add at least one script that sets pipefail, with the scan's exclusions applied, and tools/lib, whose files are sourced by pipefail scripts, must hold a file. An empty one fails with its name. The pathspecs and exclusions are one list each, shared by the check and the scan.

Failing first:

# main's test with 'packages/*/test' put back: passes quietly
ok - no pipe into grep -q in 92 pipefail scripts
# this branch with 'packages/*/test' put back
not ok - the pathspec 'packages/*/test' matches a pipefail script
# this branch as committed
ok - no pipe into grep -q in 165 pipefail scripts

testz, bim and rootf in place of tests, bin and rootfs each fail with their name too, and so does a tools/lib removed from a temporary index.

Other git pathspec users in tests/: none that can go empty unnoticed. tests/owl/lint/new-warnings passes a literal path to git archive, which errors on no match; tests/repo-publish only fakes git ls-files.

Device and build

  • Phone: none: test-only
  • Kernel release (uname -r): n/a
  • Packages changed, with versions: none

Checks (no phone needed)

  • tools/pr-check origin/main passes
  • tests/all passes (500 ok, 0 not ok)
  • tests/packages: no package touched
  • Each changed package has its version bumped, and the new version is in the commit subject (no package changed)
  • Commits have area prefixes and bodies that say why; any AI help is a Co-Authored-By: or Assisted-by: trailer, never a Signed-off-by:

On the phone

  • I ran this on my own phone, booted into this build: not applicable, test-only
  • Runbook steps passed (plan, step, result): n/a
  • What I did not test: nothing on a phone; nothing that runs on one changes
  • Nothing in this change writes outside slot B and userdata, weakens the storage guard, or reads registers from userspace (AGENTS.md §1)
tools/phone-smoke report

Not applicable: test-only (CONTRIBUTING.md §6.5).

Generated with Claude Opus 5.5 in T3 Code Nightly

The scan's pathspec 'packages/*/test' matched no file: a git pathspec
with a wildcard has to match the whole path. So from derekross#575 until a81fcf3
the test read none of the package tests and still printed ok, and a
pipe into grep -q appended to a package test passed (found on derekross#587).

Check each scan pathspec before the scan: tests, 'packages/*/test/*',
bin, tools and rootfs must each add a script that sets pipefail, with
the scan's exclusions applied (so 'tests' can't pass on this file
alone), and tools/lib, whose files are sourced by pipefail scripts,
must hold a file. An empty one fails with its name. The
exclusions now live in one list that the check and the scan share.

With 'packages/*/test' put back the test fails with
  not ok - the pathspec 'packages/*/test' matches a pipefail script
and so does each other pathspec misspelled in turn; with main's
pathspecs it passes on 165 scripts. Main's test with the old pathspec
passed on 92.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derekross

Copy link
Copy Markdown
Owner

Thank you, this closes the hole properly. A lint that reads nothing and prints ok is the worst kind, and now a wrong pathspec fails with its name. I ran it here: the committed test passes on 165 scripts (166 merged onto today's main, the same set main's test scans), 'packages/*/test' put back fails as you show, a misspelled tests and rootfs each fail with their name, and a | grep -q appended to a package test is caught. Sharing one list between the check and the scan also means they can't drift apart. Merging.

@derekross
derekross merged commit 4e7bca4 into derekross:main Nov 10, 2026
2 checks passed
robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
…oss#597)

A scan pathspec that matched no file made the lint read nothing and print ok. Each pathspec now fails by name when it matches nothing. It scans the same scripts as before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants