Skip to content

ci: add feature audit checks#1193

Merged
alandtse merged 8 commits into
community-shaders:devfrom
alandtse:feature_audit
Jun 25, 2025
Merged

ci: add feature audit checks#1193
alandtse merged 8 commits into
community-shaders:devfrom
alandtse:feature_audit

Conversation

@alandtse
Copy link
Copy Markdown
Collaborator

@alandtse alandtse commented Jun 24, 2025

Conducts feature audit checking including missing ini file warnings (warnings are optional for now).

Summary by CodeRabbit

  • New Features

    • Automated feature version auditing now runs on pull requests and releases, providing detailed markdown reports on feature changes, version updates, and metadata completeness.
    • Pull requests receive automatic comments summarizing audit findings for improved review visibility.
  • Chores

    • Release notes generation enhanced to incorporate feature audit reports, offering clearer insights into feature updates and metadata status.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 24, 2025

Caution

Review failed

The pull request is closed.

"""

Walkthrough

This update introduces a feature version audit system integrated into the GitHub Actions workflow. It adds three new jobs for auditing feature versions on releases and pull requests, generating markdown reports, and posting results as PR comments. A new Python script implements the audit logic, and the release process is updated to include audit results in release notes.

Changes

File(s) Change Summary
.github/workflows/build.yaml Adds feature-audit, feature-audit-pr, and feature-audit-pr-comment jobs; modifies release job to depend on feature-audit and incorporate audit reports into release notes.
tools/feature_version_audit.py New script implementing feature metadata extraction, version comparison, commit analysis, and markdown report generation for feature version auditing.

Sequence Diagram(s)

sequenceDiagram
    participant GitHub Actions
    participant feature_version_audit.py
    participant Artifact Store
    participant PR/Release

    GitHub Actions->>feature_version_audit.py: Run audit script (on release or PR)
    feature_version_audit.py->>Artifact Store: Upload markdown report
    GitHub Actions->>PR/Release: (On PR) Post comment with audit report
    GitHub Actions->>PR/Release: (On release) Append audit report to release notes
Loading

Possibly related PRs

  • ci: add feature audit checks #1193: Introduces the same feature version audit tooling and GitHub Actions jobs, directly related by implementing the audit script and workflow integration.

Poem

In the warren of features, a rabbit did hop,
Auditing versions, it just couldn't stop.
With scripts and with notes,
It checks all the quotes—
Now release notes are topped with a markdown crop!
🐇✨
"""


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6574238 and 5ebb3f9.

📒 Files selected for processing (1)
  • tools/feature_version_audit.py (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@alandtse alandtse marked this pull request as ready for review June 25, 2025 00:40
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Nitpick comments (5)
tools/feature_version_audit.py (3)

323-323: Rename unused loop variable

The loop control variable status is not used within the loop body.

-        for status, f in changes:
+        for _, f in changes:

514-514: Rename unused loop variable

The loop control variable fname is not used within the loop body.

-    for fname, info in feature_actions.items():
+    for _, info in feature_actions.items():

568-570: Remove unused global declarations

These global declarations are unnecessary since the variables are only read, not modified.

 def main():
-    global RELEASE_TAG, FEATURES_DIR, SHADER_TYPES
     parser = argparse.ArgumentParser(description="Feature version audit for Skyrim Community Shaders.")
.github/workflows/build.yaml (2)

615-627: Add GITHUB_TOKEN environment variable for gh CLI

While the gh CLI typically uses the default token, it's better to be explicit.

             - name: Generate combined release notes
               id: combined_notes
               shell: bash
+              env:
+                GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
               run: |
                   # Generate GitHub release notes
                   gh release view ${{ github.ref_name }} --json body -q .body > auto-release-notes.md || echo '' > auto-release-notes.md

517-591: Consider error handling strategy for production

The audit jobs currently have continue-on-error: true which is appropriate for testing but should be reconsidered before merging to production. Failed audits might indicate important issues that shouldn't be silently ignored.

For production readiness, consider:

  1. Remove continue-on-error once the feature is stable
  2. Add notifications or create issues when audits fail
  3. Make the audit results required status checks for PRs
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a5c9eb1 and abcda70.

📒 Files selected for processing (2)
  • .github/workflows/build.yaml (2 hunks)
  • tools/feature_version_audit.py (1 hunks)
🧰 Additional context used
🪛 Ruff (0.11.9)
tools/feature_version_audit.py

323-323: Loop control variable status not used within loop body

Rename unused status to _status

(B007)


374-374: Function definition does not bind loop variable is_attention

(B023)


429-429: Function definition does not bind loop variable fa

(B023)


450-450: Function definition does not bind loop variable missing

(B023)


477-477: Function definition does not bind loop variable missing

(B023)


514-514: Loop control variable fname not used within loop body

Rename unused fname to _fname

(B007)


655-657: Use a single if statement instead of nested if statements

(SIM102)

🪛 Flake8 (7.2.0)
tools/feature_version_audit.py

[error] 47-47: expected 2 blank lines, found 1

(E302)


[error] 51-51: expected 2 blank lines, found 1

(E302)


[error] 54-54: expected 2 blank lines, found 1

(E302)


[error] 61-61: expected 2 blank lines, found 1

(E302)


[error] 73-73: expected 2 blank lines, found 1

(E302)


[error] 84-84: expected 2 blank lines, found 1

(E302)


[error] 101-101: expected 2 blank lines, found 1

(E302)


[error] 111-111: expected 2 blank lines, found 1

(E302)


[error] 126-126: expected 2 blank lines, found 1

(E302)


[error] 136-136: expected 2 blank lines, found 1

(E302)


[error] 178-178: expected 2 blank lines, found 1

(E302)


[error] 214-214: expected 2 blank lines, found 1

(E302)


[error] 223-223: expected 1 blank line before a nested definition, found 0

(E306)


[error] 230-230: expected 2 blank lines, found 1

(E302)


[error] 245-245: expected 2 blank lines, found 1

(E302)


[error] 256-256: expected 2 blank lines, found 1

(E302)


[error] 270-270: expected 2 blank lines, found 1

(E302)


[error] 298-298: expected 1 blank line before a nested definition, found 0

(E306)


[error] 373-373: expected 1 blank line before a nested definition, found 0

(E306)


[error] 394-394: expected 2 blank lines, found 1

(E302)


[error] 403-403: expected 2 blank lines, found 1

(E302)


[error] 409-409: missing whitespace after ','

(E231)


[error] 409-409: missing whitespace after ','

(E231)


[error] 409-409: missing whitespace after ','

(E231)


[error] 410-410: missing whitespace after ','

(E231)


[error] 410-410: missing whitespace after ','

(E231)


[error] 410-410: missing whitespace after ','

(E231)


[error] 414-414: expected 2 blank lines, found 1

(E302)


[error] 423-423: expected 2 blank lines, found 1

(E302)


[error] 433-433: expected 2 blank lines, found 1

(E302)


[error] 449-449: expected 1 blank line before a nested definition, found 0

(E306)


[error] 458-458: expected 2 blank lines, found 1

(E302)


[error] 476-476: expected 1 blank line before a nested definition, found 0

(E306)


[error] 486-486: expected 2 blank lines, found 1

(E302)


[error] 512-512: expected 2 blank lines, found 1

(E302)


[error] 529-529: expected 2 blank lines, found 1

(E302)


[error] 568-568: expected 2 blank lines, found 1

(E302)


[error] 569-569: global RELEASE_TAG is unused: name is never assigned in scope

(F824)


[error] 569-569: global FEATURES_DIR is unused: name is never assigned in scope

(F824)


[error] 569-569: global SHADER_TYPES is unused: name is never assigned in scope

(F824)


[error] 611-611: expected 1 blank line before a nested definition, found 0

(E306)


[error] 669-669: expected 2 blank lines after class or function definition, found 1

(E305)

🪛 Pylint (3.3.7)
tools/feature_version_audit.py

[refactor] 178-178: Too many local variables (16/15)

(R0914)


[refactor] 263-268: Unnecessary "elif" after "return", remove the leading "el" from "elif"

(R1705)


[refactor] 270-270: Too many local variables (44/15)

(R0914)


[refactor] 365-365: Too many boolean expressions in if statement (6/5)

(R0916)


[refactor] 270-270: Too many branches (26/12)

(R0912)


[refactor] 270-270: Too many statements (92/50)

(R0915)


[refactor] 433-433: Too many local variables (17/15)

(R0914)


[refactor] 486-486: Too many local variables (16/15)

(R0914)


[refactor] 529-529: Too many arguments (11/5)

(R0913)


[refactor] 529-529: Too many positional arguments (11/5)

(R0917)


[refactor] 529-529: Too many local variables (19/15)

(R0914)


[refactor] 568-568: Too many local variables (25/15)

(R0914)


[refactor] 568-568: Too many branches (20/12)

(R0912)


[refactor] 568-568: Too many statements (65/50)

(R0915)

Comment thread tools/feature_version_audit.py
Comment thread tools/feature_version_audit.py
Comment thread tools/feature_version_audit.py
Comment thread tools/feature_version_audit.py
Comment thread tools/feature_version_audit.py
Comment thread .github/workflows/build.yaml
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (4)
tools/feature_version_audit.py (4)

373-374: Fix function closure bug that captures loop variable

The bold function captures the loop variable is_attention, which will always have the value from the last iteration when the function is called later.

-        def bold(val):
-            return f"**{val}**" if is_attention and val != '' and val != '-' else val
+        def bold(val, is_attention=is_attention):
+            return f"**{val}**" if is_attention and val != '' and val != '-' else val

428-430: Fix function closure bug in format_feature_table

The bold function captures the loop variable fa, causing all calls to use the last iteration's value.

-        def bold(val, is_attention=fa['is_attention']):
-            return f"**{val}**" if is_attention and val != '' and val != '-' else val
-        lines.append(f"| {bold(fa['name'])} | {bold(fa['prior_ver_str'])} | {bold(fa['proposed_ver_str'])} | {bold(str(fa['needs_bump']))} | {bold(fa['change_types'])} | {bold(fa['note'])} | {fa['commit_link']} |")
+        is_attention = fa['is_attention']
+        def bold(val):
+            return f"**{val}**" if is_attention and val != '' and val != '-' else val
+        lines.append(f"| {bold(fa['name'])} | {bold(fa['prior_ver_str'])} | {bold(fa['proposed_ver_str'])} | {bold(str(fa['needs_bump']))} | {bold(fa['change_types'])} | {bold(fa['note'])} | {fa['commit_link']} |")

449-455: Fix function closure bug in format_new_features_table

The boldmeta function captures the loop variable missing, which can cause incorrect formatting.

-            def boldmeta(val, missing=missing):
-                return f"**{val}**" if missing and val != '' and val != '-' else val
+            def boldmeta(val, is_missing):
+                return f"**{val}**" if is_missing and val != '' and val != '-' else val
             nexus_link = f"[Nexus]({meta['mod_link']})" if meta and meta['mod_link'] else ("**Missing metadata**" if not meta else "")
             author = get_commit_author(commit) if commit else None
             author_str = f" ({author})" if author else ""
             commit_link = f"[link](https://github.com/doodlum/skyrim-community-shaders/commit/{commit}){author_str}" if commit else ""
-            lines.append(f"| {boldmeta(name)} | {boldmeta(ver)} | {nexus_link} | {commit_link} |")
+            lines.append(f"| {boldmeta(name, missing)} | {boldmeta(ver, missing)} | {nexus_link} | {commit_link} |")

476-481: Fix function closure bug in format_metadata_summary

The boldmeta function captures the loop variable missing.

-        def boldmeta(val, missing=missing):
-            return f"**{val}**" if missing else val
+        def boldmeta(val, is_missing):
+            return f"**{val}**" if is_missing else val
         link = f"[Nexus]({info['mod_link']})" if info['mod_link'] else ""
         desc = info['description'][:80] + ("..." if len(info['description']) > 80 else "")
         keys = ", ".join(info['key_features'][:3]) + (", ..." if len(info['key_features']) > 3 else "") if info['key_features'] else ""
-        lines.append(f"| {boldmeta(info['name'])} | {info['is_core']} | {link} | {desc} | {keys} |")
+        lines.append(f"| {boldmeta(info['name'], missing)} | {info['is_core']} | {link} | {desc} | {keys} |")
🧹 Nitpick comments (4)
tools/feature_version_audit.py (4)

323-323: Rename unused loop variable

The loop variable status is not used within the loop body.

-        for status, f in changes:
+        for _status, f in changes:

514-514: Rename unused loop variable

The loop variable fname is not used within the loop body.

-    for fname, info in feature_actions.items():
+    for _fname, info in feature_actions.items():

654-656: Simplify nested if statements

These nested if statements can be combined into a single condition.

-        if args.output or args.ci or args.fail_on_actionable:
-            # Only print actionable items if not in audit/report mode (i.e., no --output)
-            if not args.output:
+        if (args.output or args.ci or args.fail_on_actionable) and not args.output:
+            # Only print actionable items if not in audit/report mode (i.e., no --output)

265-268: Remove unnecessary elif after return

Since the function returns in the if block, the elif can be changed to if for cleaner code.

     if has_feat:
         return (major, minor + 1, 0)
-    elif has_fix:
+    if has_fix:
         return (major, minor, patch + 1)
-    else:
-        return prior_version
+    return prior_version
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between abcda70 and 6574238.

📒 Files selected for processing (2)
  • .github/workflows/build.yaml (2 hunks)
  • tools/feature_version_audit.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/build.yaml
🧰 Additional context used
🪛 Ruff (0.11.9)
tools/feature_version_audit.py

323-323: Loop control variable status not used within loop body

Rename unused status to _status

(B007)


374-374: Function definition does not bind loop variable is_attention

(B023)


514-514: Loop control variable fname not used within loop body

Rename unused fname to _fname

(B007)


654-656: Use a single if statement instead of nested if statements

(SIM102)

🪛 Flake8 (7.2.0)
tools/feature_version_audit.py

[error] 47-47: expected 2 blank lines, found 1

(E302)


[error] 51-51: expected 2 blank lines, found 1

(E302)


[error] 54-54: expected 2 blank lines, found 1

(E302)


[error] 61-61: expected 2 blank lines, found 1

(E302)


[error] 73-73: expected 2 blank lines, found 1

(E302)


[error] 84-84: expected 2 blank lines, found 1

(E302)


[error] 101-101: expected 2 blank lines, found 1

(E302)


[error] 111-111: expected 2 blank lines, found 1

(E302)


[error] 126-126: expected 2 blank lines, found 1

(E302)


[error] 136-136: expected 2 blank lines, found 1

(E302)


[error] 178-178: expected 2 blank lines, found 1

(E302)


[error] 214-214: expected 2 blank lines, found 1

(E302)


[error] 223-223: expected 1 blank line before a nested definition, found 0

(E306)


[error] 230-230: expected 2 blank lines, found 1

(E302)


[error] 245-245: expected 2 blank lines, found 1

(E302)


[error] 256-256: expected 2 blank lines, found 1

(E302)


[error] 270-270: expected 2 blank lines, found 1

(E302)


[error] 298-298: expected 1 blank line before a nested definition, found 0

(E306)


[error] 373-373: expected 1 blank line before a nested definition, found 0

(E306)


[error] 394-394: expected 2 blank lines, found 1

(E302)


[error] 403-403: expected 2 blank lines, found 1

(E302)


[error] 409-409: missing whitespace after ','

(E231)


[error] 409-409: missing whitespace after ','

(E231)


[error] 409-409: missing whitespace after ','

(E231)


[error] 410-410: missing whitespace after ','

(E231)


[error] 410-410: missing whitespace after ','

(E231)


[error] 410-410: missing whitespace after ','

(E231)


[error] 414-414: expected 2 blank lines, found 1

(E302)


[error] 423-423: expected 2 blank lines, found 1

(E302)


[error] 433-433: expected 2 blank lines, found 1

(E302)


[error] 449-449: expected 1 blank line before a nested definition, found 0

(E306)


[error] 458-458: expected 2 blank lines, found 1

(E302)


[error] 476-476: expected 1 blank line before a nested definition, found 0

(E306)


[error] 486-486: expected 2 blank lines, found 1

(E302)


[error] 512-512: expected 2 blank lines, found 1

(E302)


[error] 529-529: expected 2 blank lines, found 1

(E302)


[error] 568-568: expected 2 blank lines, found 1

(E302)


[error] 569-569: global RELEASE_TAG is unused: name is never assigned in scope

(F824)


[error] 569-569: global FEATURES_DIR is unused: name is never assigned in scope

(F824)


[error] 569-569: global SHADER_TYPES is unused: name is never assigned in scope

(F824)


[error] 610-610: expected 1 blank line before a nested definition, found 0

(E306)


[error] 668-668: expected 2 blank lines after class or function definition, found 1

(E305)

🪛 Pylint (3.3.7)
tools/feature_version_audit.py

[refactor] 178-178: Too many local variables (16/15)

(R0914)


[refactor] 263-268: Unnecessary "elif" after "return", remove the leading "el" from "elif"

(R1705)


[refactor] 270-270: Too many local variables (44/15)

(R0914)


[refactor] 365-365: Too many boolean expressions in if statement (6/5)

(R0916)


[refactor] 270-270: Too many branches (26/12)

(R0912)


[refactor] 270-270: Too many statements (92/50)

(R0915)


[refactor] 433-433: Too many local variables (17/15)

(R0914)


[refactor] 486-486: Too many local variables (16/15)

(R0914)


[refactor] 529-529: Too many arguments (11/5)

(R0913)


[refactor] 529-529: Too many positional arguments (11/5)

(R0917)


[refactor] 529-529: Too many local variables (19/15)

(R0914)


[refactor] 568-568: Too many local variables (24/15)

(R0914)


[refactor] 568-568: Too many branches (20/12)

(R0912)


[refactor] 568-568: Too many statements (64/50)

(R0915)

return output

def main():
global RELEASE_TAG, FEATURES_DIR, SHADER_TYPES
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Remove unnecessary global declarations

These global declarations are not needed since the variables are never reassigned within the function scope.

 def main():
-    global RELEASE_TAG, FEATURES_DIR, SHADER_TYPES
     parser = argparse.ArgumentParser(description="Feature version audit for Skyrim Community Shaders.")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
global RELEASE_TAG, FEATURES_DIR, SHADER_TYPES
def main():
parser = argparse.ArgumentParser(description="Feature version audit for Skyrim Community Shaders.")
# ...
🧰 Tools
🪛 Flake8 (7.2.0)

[error] 569-569: global RELEASE_TAG is unused: name is never assigned in scope

(F824)


[error] 569-569: global FEATURES_DIR is unused: name is never assigned in scope

(F824)


[error] 569-569: global SHADER_TYPES is unused: name is never assigned in scope

(F824)

🤖 Prompt for AI Agents
In tools/feature_version_audit.py at line 569, remove the global declaration for
RELEASE_TAG, FEATURES_DIR, and SHADER_TYPES because these variables are not
reassigned within the function and do not require global scope declaration.

@alandtse alandtse merged commit 93a318d into community-shaders:dev Jun 25, 2025
3 checks passed
alandtse added a commit to alandtse/open-shaders that referenced this pull request Jul 20, 2025
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