[aw] Replace 3 always-noop nightly-fix-finder categories - #11739
Conversation
Per issue #11506, three nightly-fix-finder scripts have only ever produced no-ops because their detectors are dominated by false positives: - 02-obsolete-api-usage (4 no-ops): only finds intentional [Obsolete] back-compat #pragma suppressions - 03-performance-antipatterns (3 no-ops): "string concat in loop" matches += event handler subscriptions and integer accumulators - 07-error-handling (3 no-ops): "swallowed exception" matches catches that already log, rethrow, FailFast, or RaisePendingException Replace them with three categories tied to explicit repo rules, where the detector signal is structurally cleaner and the fix is mechanical and low-risk (clears safety >= 6): - 02-null-forgiving-operator: postfix ! usages (foo!., foo![, foo!;, foo!,, foo!)). Repo rule: NEVER use ! in C# code. - 03-region-directives: #region / #endregion. Repo rule: Do NOT use #region or #endregion. Pure delete. - 07-asynctask-log-property: direct Log.Log* calls inside classes deriving from AsyncTask. Repo rule: Log is [Obsolete] on AsyncTask -- calling it from a background thread can hang VS. Swap to the thread-safe LogMessage / LogCodedError / LogCodedWarning / LogDebugMessage helpers. Updated workflow_dispatch dropdown and recompiled lock file. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the nightly “fix-finder” agentic workflow to reduce no-op runs by removing three historically unproductive scan categories and replacing them with three mechanically-fixable categories aligned to explicit repo rules (null-forgiving operator !, #region directives, and AsyncTask Log property misuse).
Changes:
- Removed the
02-obsolete-api-usage,03-performance-antipatterns, and07-error-handlingnightly scripts. - Added
02-null-forgiving-operator,03-region-directives, and07-asynctask-log-propertyscripts with embedded GUIDANCE + sampling output. - Updated the workflow
workflow_dispatchdropdown options and regenerated the compiled lock file.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/nightly-fix-finder/02-obsolete-api-usage.sh | Deleted obsolete-api scan category script. |
| .github/workflows/nightly-fix-finder/02-null-forgiving-operator.sh | New scan category for postfix null-forgiving operator usage. |
| .github/workflows/nightly-fix-finder/03-performance-antipatterns.sh | Deleted performance-antipattern scan category script. |
| .github/workflows/nightly-fix-finder/03-region-directives.sh | New scan category for #region / #endregion usage in src/. |
| .github/workflows/nightly-fix-finder/07-error-handling.sh | Deleted error-handling scan category script. |
| .github/workflows/nightly-fix-finder/07-asynctask-log-property.sh | New scan category for AsyncTask-derived tasks using Log.Log* directly. |
| .github/workflows/nightly-fix-finder.md | Updated workflow_dispatch script options to match new categories. |
| .github/workflows/nightly-fix-finder.lock.yml | Regenerated compiled workflow lock file reflecting updated options/hashes. |
- 02-null-forgiving-operator: drop the redundant `grep -vP '!='` post-filter.
The regex already excludes `!=` at the character level (the class after
`!` does not include `=`), so the line-level filter only created false
negatives when a line happened to also contain `!=` elsewhere. Document
this in the GUIDANCE.
- 07-asynctask-log-property: fix the contradictory `Log.LogErrorFromException`
replacement example. The previous suggestion `LogCodedError ("XAxxxx",
e.Message)` contradicted the rule below the table that error strings
must come from `Properties.Resources`. Replace all table cells with the
correct shape and explicitly call out that no inline English strings
are acceptable -- prefer `noop` if a new `XA####` resource entry is
needed.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/review |
|
✅ Android PR Reviewer completed successfully! |
There was a problem hiding this comment.
🤖 Code Review — ⚠️ One recommended fix + one suggestion (non-blocking)
Cleanly-scoped workflow change that retires three always-noop fix-finder detectors and replaces them with three higher-precision ones tied to explicit AGENTS.md rules. The .md dropdown, the regenerated .lock.yml, and the script filenames are all consistent — and I confirmed no references to the old category names remain anywhere in the tree.
Findings (both inline)
⚠️ 07-asynctask-log-property.sh:22— theLogErrorFromExceptionreplacement row points at a bare helper that isn't part ofAsyncTask's thread-safe API and would likely not compile.- 💡
07-asynctask-log-property.sh:45— the: AsyncTaskdetector only matches direct derivation, missing transitive subclasses (e.g.Aapt2Compile/Aapt2Link).
Verified / positive callouts
- Lock regeneration is correct and minimal: only
frontmatter_hash+ the three dropdown option lines changed;body_hashis correctly unchanged (the workflow body selects scripts dynamically viafind/$INPUT_SCRIPT, so no script names are hardcoded). 02null-forgiving regex is genuinely high-precision:[A-Za-z0-9_)\]]!(\.|\[|;|,|\))— a postfix!in those positions is syntactically always null-forgiving (prefix!is excluded by the leading char class, and!=is excluded because=isn't in the follow set). Residual false positives are only inside strings/comments, which the "What NOT to flag" section already calls out.07grep alternation is ordered safely: the trailing\bpreventsLogErrorfrom shadowingLogErrorFromException.| shuf | head -20 || echo "None found"matches the unchanged sibling scripts (00,04,08); I empirically confirmed it does not spuriously emit "None found" under the harness'sbash -o pipefailat normal scale (shuf's output fits the pipe buffer, so it exits 0).
CI
At review time the Azure DevOps dotnet-android builds (Linux/Mac/Windows) and the agent check are still in progress (not failing); license/cla passed. This is a workflow-script-only change, so product builds are unaffected — please confirm CI is green before merge.
Neither finding is merge-blocking, so submitting as a COMMENT review rather than requesting changes. Nice, well-documented cleanup. 👍
Generated by Android PR Reviewer for issue #11739 · 819.4 AIC · ⌖ 48.3 AIC · ⊞ 37.9K
Comment /review to run again
07-asynctask-log-property: - Fix the LogErrorFromException replacement cell. `LogErrorFromException` is NOT a thread-safe helper on AsyncTask -- it only exists on the `Log` (TaskLoggingHelper) property, so a bare `LogErrorFromException` call would not compile (CS0103). Verified every existing call site in src/ uses `Log.LogErrorFromException(...)`. Replace the bare-call suggestion with "fold the exception detail into the LogCodedError call, or `throw;` to propagate". - Document that the AsyncTask-derivation regex matches DIRECT derivation only. Subclasses that reach AsyncTask through an intermediate base (e.g. `Aapt2Compile : Aapt2 : AsyncTask`) will not appear in the enumerated list. That is acceptable for a one-fix-per-night sampler, but the agent must still verify transitive derivation when reading the candidate file. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Why
Issue #11506 tracks every no-op run from the nightly fix-finder. Three of its scripts have only produced no-ops since they were introduced, because their detectors are dominated by false positives that can never clear the confidence/safety gate:
02-obsolete-api-usage(4 no-ops) -- only finds intentional#pragma CS0618back-compat suppressions03-performance-antipatterns(3 no-ops) -- "string concat in loop" matches+=event-handler subscriptions and integer accumulators07-error-handling(3 no-ops) -- "swallowed exception" matches catches that already log, rethrow,FailFast, orRaisePendingExceptionKeeping them in rotation wastes ~30% of nightly runs.
Approach
Delete the three losing scripts and replace each with a category tied to an explicit rule in the repo's
AGENTS.md, where the detector signal is structurally cleaner and the fix is mechanical and low-risk (so it can clear safety >= 6):02-null-forgiving-operator-- postfix!usages (foo!.,foo![,foo!;,foo!,,foo!)). Repo rule: NEVER use!in C# code. Documents the standard refactor patterns (explicit null check + throw, extract-after-Assert, declare[SetUp]field as nullable).03-region-directives--#region/#endregionin shipped code. Repo rule: Do NOT use#region. Pure deletion fix; safety = 10.07-asynctask-log-property-- directLog.LogMessage/Log.LogError/ etc. calls inside classes deriving fromAsyncTask. Repo rule:Logis[Obsolete]onAsyncTaskbecause calling it from a background thread can hang Visual Studio. The fix is a mechanical swap to the thread-safeLogMessage/LogCodedError/LogCodedWarning/LogDebugMessagehelpers.The
workflow_dispatchdropdown innightly-fix-finder.mdis updated to match, and the lock file has been regenerated withgh aw compile.Verification
Ran each new script locally against
src/:02-null-forgiving-operatorreturns 20 real postfix-!hits acrossMono.AndroidandXamarin.Android.Build.Tasks03-region-directivesreturns 20 real#regionhits (top offender:AdbSyncClient.cswith 18 regions)07-asynctask-log-propertycorrectly enumerates 17AsyncTask-derived task files and surfaces realLog.Log*violations inMavenDownload.cs,LinkNativeRuntime.cs,GetMicrosoftNuGetPackagesMap.csEach script prints its
GUIDANCEheredoc first (what to look for, how to fix, what NOT to flag) so the agent has full context without re-reading the workflow.Checklist