Skip to content

fix(ci): parse clang-tidy analyzer warning suffix - #2499

Open
ankitbuilds99 wants to merge 7 commits into
DeusData:mainfrom
ankitbuilds99:fix/lint-mem-gate-warning-suffix
Open

ankitbuilds99 wants to merge 7 commits into
DeusData:mainfrom
ankitbuilds99:fix/lint-mem-gate-warning-suffix

Conversation

@ankitbuilds99

@ankitbuilds99 ankitbuilds99 commented Oct 3, 2026 •

Copy link
Copy Markdown

Summary

Refs #2442 (the clang-tidy diagnostic parsing part).

When WarningsAsErrors: '*' is enabled, clang-tidy renders analyzer diagnostics as:

[clang-analyzer-core.NullDereference,-warnings-as-errors]

The lint memory gate only accepted [check], so it silently discarded these findings and could report a clean gate. This change accepts the optional suffix while preserving the existing whitelist key (clang-analyzer-core.NullDereference).

Validation

  • tests/test_lint_mem_gate.sh
  • python3 -m py_compile scripts/lint-mem-gate.py
  • git diff --check

The regression test proves that a suffixed analyzer finding matches its normal whitelist entry and is counted as an argued finding.

Written with the assistance of an AI coding agent; the commit is DCO-signed by the submitting account.

Signed-off-by: Your GitHub Username <your_email@example.com>
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown

Thanks for opening this — it has been seen, and it is queued.

This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence.

Current review status: working through a backlog. 0.9.1-rc.1 is out, so the release freeze that held reviews is over — but it left a large queue of open pull requests behind it, and we are reading through them oldest-first. The background is in discussion #1144.

What that means for this PR, concretely:

  • It will not be closed for inactivity. No stale bot touches pull requests here.
  • It may still sit a while before a human reads it. That is on us, not on you.
  • Older PRs are read first, so a recent one is not being skipped — it is behind a queue.

Things that will genuinely speed it up whenever review does happen:

  • Keep it rebased on main — the tree is moving quickly right now, and a conflicting branch cannot be reviewed as the diff you intended.
  • Get CI green, or say which failures you believe are pre-existing.
  • Keep the change to one claim. Bundled features and refactors get split before they get merged, which costs you a round trip.
  • Every commit needs a sign-off (git commit -s) — CI enforces DCO.

If this fixes a bug, a reproduction we can run is worth more than a description of the symptom.

Thanks for contributing, and sorry in advance for the wait.

@ankitbuilds99

Copy link
Copy Markdown
Author

@DeusData — this PR fixes the lint memory gate dropping clang-tidy analyzer findings with the ,-warnings-as-errors suffix. All required checks are green, and the regression test passes. Please review and merge when convenient. Thank you!

@DeusData DeusData added bug Something isn't working github_actions Pull requests that update GitHub Actions code labels Oct 19, 2026
@DeusData

Copy link
Copy Markdown
Owner

Thanks for the focused clang-tidy suffix handling and the follow-up. I have read the regression description; this remains pending review. Since the description identifies only the diagnostic-parsing part of #2442, please use Refs rather than Closes if other work in that issue is still outstanding.

@DeusData

Copy link
Copy Markdown
Owner

Thank you for the diagnostic-suffix fix. This still needs our review; please retain a non-closing issue reference if the other parts of #2442 remain outstanding. Sorry for the delay—I’ll follow up soon.

scripts/test.sh lists every shell contract test explicitly and does
not glob tests/, so tests/test_lint_mem_gate.sh never ran on any leg.
Register it as Step 0e4, next to the other gate contract (Step 0e3),
in the same two-line shape as its neighbours. Step 0 runs in every
default scripts/test.sh leg (macOS, Linux, Windows) and in the PR
contracts-only job. The wiring, Windows included, is a maintainer
decision (R1).

Make the test portable to the Windows leg. There python3 is a native
MSYS2 build: MSYS converts path arguments for it, but never the
diagnostic text on stdin, so the absolute fixture path inside the
finding does not resolve there, and a C:/ path would not parse (the
file field of FINDING_RE ends at the first colon). The gate now runs
from inside the fixture directory, in a subshell, with relative paths.
CRLF from a native python3 is stripped from the --hash output, the
whitelist is written once the hash is known (no placeholder rewrite),
the gate exit status is asserted, and every failed assertion is
reported together with the gate output.

Refs DeusData#2442

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
The test only covered a whitelisted finding. The defect in DeusData#2442 is
the other direction: on main clang-tidy reported findings that carry
the ,-warnings-as-errors suffix, the old FINDING_RE matched none of
them, and the gate reported clean. Pin that direction too: a second
fixture function with no whitelist entry, a suffixed finding inside
it, and the gate must exit 1 and report the finding under its plain
check name ([clang-analyzer-core.NullDereference], the whitelist key
form) as an entry missing for unlisted().

With the suffix group of FINDING_RE reverted, this case exits 0 with
"memory gate clean" and the test fails, naming all three assertions.
A parser that accepts the line but keeps the suffix inside the check
name fails it as well. The negative assertion is a maintainer
decision (R1).

Refs DeusData#2442

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Brings the branch up to date with main (a5b248f). No conflicts.
scripts/test.sh keeps Step 0e4 next to Step 0e3; the gate script and
its test are unchanged by main.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
@DeusData

DeusData commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Thank you very much, @ankitbuilds99, for tracking this down and for the clear write-up. You found the exact reason the memory-analyzer gate could report clean while clang-tidy was reporting real findings: with WarningsAsErrors enabled, the check name arrives as [clang-analyzer-...,-warnings-as-errors], and the old pattern matched none of those lines. Keeping the whitelist key unchanged was exactly the right call, and your regression test was the right starting point.

Maintainer edits were enabled (thank you for that), so we pushed three small commits on top of your branch to let this land now:

  1. 91070cb test(lint-mem): run the warning-suffix gate test on every leg - scripts/test.sh lists every shell contract test explicitly and does not glob tests/, so the new test was not running anywhere yet. It is now Step 0e4, next to the other gate contract, so it runs on the macOS, Linux and Windows legs and in the contracts-only PR job. To make it pass on Windows, the test now runs the gate from inside its fixture directory with relative paths. On Windows CI python3 is a native MSYS2 build: MSYS converts path arguments for it, but not the diagnostic text on stdin, so the absolute fixture path inside the finding could not be opened there (we reproduced "source file not found" on a Windows machine). The test also strips CRLF from the --hash output, asserts the gate exit status, and prints the gate output for any failed assertion.
  2. 24871ee test(lint-mem): an unwhitelisted suffixed finding must fail the gate - this adds the other direction of the bug: a suffixed finding with no whitelist entry must fail the gate (exit 1) and be reported under its plain check name. With the old pattern that case exits 0 with "memory gate clean", which is exactly what lint-mem gate can't fail: CI analyses no file, and the gate drops every analyzer finding #2442 describes, so the test now goes red if the parser fix is ever reverted.
  3. 020671b merges current main into the branch (no conflicts).

We also changed "Closes #2442" to "Refs #2442" in the description, because the rest of #2442 (the CI lane itself and triaging the findings it will surface) is a separate maintainer change.

If you push to this branch again, please pull first so these commits are not lost. Thanks again for a precise, well-argued fix!

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
@DeusData

DeusData commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Thanks for your patience, @ankitbuilds99: CI went green, but another change (#2198) also edited scripts/test.sh on main in the meantime, so we merged current main into your branch once more (714a0cf, a plain signed-off merge commit, no conflicts; your change and our commits are unchanged) to let CI cover the exact tree that will merge. It merges as soon as this run is green. Please pull before pushing again.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working github_actions Pull requests that update GitHub Actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants