Skip to content

PR triage's test-detection regex misses namespaced test attributes (#[tokio::test], etc.) #201

Description

@euxaristia

Summary

The triage workflow's needs-tests check (.github/workflows/pr-triage.yml:73-75) detects an inline test addition with:

/^\+.*#\[(test\]|cfg\(test\))/m

This only matches a literal #[test] or #[cfg(test) immediately after #[. It does not match namespaced test attributes like #[tokio::test] or #[async_std::test], since the characters between #[ and test]/test) don't fit either alternative.

Impact

Any PR whose only new tests are async (#[tokio::test], which this codebase already uses throughout, e.g. crates/gl/src/agent.rs) gets falsely labeled needs-tests and receives the "no tests changed" guidance comment, even when tests were in fact added in the same commit.

Reproduced against PR #198: it added two #[tokio::test]-only tests to crates/gl/src/doctor.rs in the same commit as the source change, and the triage bot still commented needs-tests.

Fix

Widen the regex to also match any attribute ending in ::test], covering namespaced test macros regardless of depth:

/^\+.*(#\[test\]|#\[cfg\(test\)|::test\])/m

Verified against representative patches (including PR #198's actual diff) — the new regex correctly detects #[test], #[cfg(test)], #[tokio::test], and #[async_std::test], while still correctly rejecting a non-test Rust change.

I have a fix ready and will open a PR referencing this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    crate:glgl — the contributor CLIkind:ciCI, release, or packaging pipelinesev:lowCosmetic, cleanup, or nice-to-have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions