Skip to content

Add comment-hygiene violations as a comment on the pull request - #1076

Open
jasonleenaylor wants to merge 4 commits into
mainfrom
feature/comment-hygiene-pr-comment
Open

Add comment-hygiene violations as a comment on the pull request#1076
jasonleenaylor wants to merge 4 commits into
mainfrom
feature/comment-hygiene-pr-comment

Conversation

@jasonleenaylor

@jasonleenaylor jasonleenaylor commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Quick Summary

Comment-hygiene violations now appear in the pull request conversation, not only as
inline annotations on Files changed and in the Actions log. Follow-up to #1061.

The advisory comment as posted on a pull request

A probe commit produced this comment, then was reverted.

  • New CommentHygiene.yml scans the lines a pull request adds and posts one sticky
    comment, updated in place on each push and replaced with a clean note once the
    violations are fixed. It cannot fail a check.
  • comment-hygiene.ps1 gains -ReportPath, writing the scan result as JSON;
    Build-CommentHygieneComment.ps1 renders that into the comment body.
  • The scan no longer auto-runs in CI. build.ps1 and test.ps1 invoke it only for
    -CommentHygiene, making CommentHygiene.yml the only place that scans and
    annotates. That retires FW_COMMENT_HYGIENE_REPORTED and its GITHUB_ENV write, and
    moves the fetch-depth: 0 requirement to the job that diffs. Push builds, including
    the installer workflows, no longer scan.
  • comment-hygiene.ps1 falls back to origin/main when origin/HEAD is unset. git rev-parse wrote to stderr, which Windows PowerShell 5.1 turns into a terminating
    error under ErrorActionPreference Stop, making the documented fallback unreachable.
  • powershell-compat.ps1 walks Build/Agent instead of naming six files.
  • Wording says "check" rather than "gate", and the agent requirement lives in
    AGENTS.md rather than repeated in help text that does not enforce it.

CI-ready checklist

  • Commit messages follow .github/commit-guidelines.md (subject <= 72 chars, no trailing punctuation; if body present, blank line then <= 80-char lines).
  • No whitespace warnings locally.
  • Builds/tests pass locally (or I've run the CI-style build via build.ps1/test.ps1 or MSBuild).
  • If this is core-developer AI-assisted work, I followed Docs/workflows/ai-pr-workflow.md and ran pr-preflight or the equivalent branch-readiness review before requesting review.
  • For any Src/** folders touched, corresponding AGENTS.md files are updated or explicitly confirmed still accurate. No Src/** changes.

Notes for reviewers

A separate workflow, rather than steps in the build job, so the comment lands in about a
minute and still arrives when the build fails or is cancelled. Report comment hygiene
took 53s.

The comment body is passed to the sticky action as a file path, following
Build-RenderArtifactComment.ps1, so there is no GITHUB_ENV delimiter to collide with
(cf. #1073).

Verified on this pull request: Flex CI green on the shallow checkout with both Codecov
uploads passing, and the new smoke test passing under PowerShell 7 and Windows
PowerShell 5.1.


This change is Reviewable

A new CommentHygiene.yml job scans the lines a pull request adds and posts
one sticky comment listing them, updated in place on each push and replaced
with a clean note once they are fixed. Nothing in it can fail a check.
comment-hygiene.ps1 gains -ReportPath to write the scan result as JSON, and
Build-CommentHygieneComment.ps1 renders that into the comment body.

- CI.yml presets FW_COMMENT_HYGIENE_REPORTED so the new workflow is the only
  place that annotates, which moves the fetch-depth: 0 requirement out of the
  build job, and runs the composer smoke test under both engines.
- comment-hygiene.ps1 falls back to origin/main when origin/HEAD is unset:
  git rev-parse wrote to stderr, which 5.1 turns into a terminating error, so
  the documented fallback was unreachable.
- Wording says check rather than gate, and the agent requirement lives in
  AGENTS.md alone rather than repeated in help text that does not enforce it.
- powershell-compat.ps1 walks Build/Agent instead of naming six files, so a
  new script is covered when it lands.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown

NUnit Tests

    1 files      1 suites   11m 7s ⏱️
5 778 tests 5 697 ✅ 81 💤 0 ❌
5 787 runs  5 706 ✅ 81 💤 0 ❌

Results for commit 3abeba9.

♻️ This comment has been updated with latest results.

@codecov-commenter

codecov-commenter commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 38.07%. Comparing base (d84b2b4) to head (3abeba9).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##           main    #1076       +/-   ##
=========================================
+ Coverage      0   38.07%   +38.07%     
=========================================
  Files         0     1499     +1499     
  Lines         0   350154   +350154     
  Branches      0    40241    +40241     
=========================================
+ Hits          0   133315   +133315     
- Misses        0   187559   +187559     
- Partials      0    29280    +29280     

see 1499 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Four deliberate violations in one throwaway script, so the advisory comment
on this pull request has something to show. Reverted once the comment has
been reviewed.

The subject is kept short on purpose: gitlint caps a title at 72 characters,
and the revert of this commit inherits it inside Revert "...".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown

Comment hygiene (advisory)

No comment-style violations in the lines this branch adds since origin/main.

This reverts commit 67bd09a.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@jasonleenaylor
jasonleenaylor marked this pull request as ready for review August 18, 2026 15:58
@jasonleenaylor
jasonleenaylor enabled auto-merge (squash) August 18, 2026 15:59
@jasonleenaylor jasonleenaylor changed the title Post advisory comment-hygiene violations to the pull request Add comment-hygiene violations as a comment on the pull request Aug 18, 2026
comment-hygiene.ps1 no longer auto-runs from build.ps1 and test.ps1 in CI, so
CommentHygiene.yml is the only thing that scans and annotates. With nothing
running the scan twice, FW_COMMENT_HYGIENE_REPORTED and its GITHUB_ENV write
go with it.

build.ps1 and test.ps1 invoke the scan only for -CommentHygiene, and the
installer workflows stop scanning on push.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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