Skip to content

fix: Add UpdateService checksum tests, update Newtonsoft.Json refere… - #61

Merged
Sythsaz merged 4 commits into
mainfrom
ql-fix
Feb 9, 2026
Merged

fix: Add UpdateService checksum tests, update Newtonsoft.Json refere…#61
Sythsaz merged 4 commits into
mainfrom
ql-fix

Conversation

@Sythsaz

@Sythsaz Sythsaz commented Feb 9, 2026

Copy link
Copy Markdown
Owner

…nce to conditionally use NuGet, and disable CA1850 diagnostic.


name: Pull Request
about: Propose changes to the bot
title: "[TYPE] Short description of change"
labels: ""
assignees: ""

Description

Type of change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • 📚 Documentation (updates to documentation or comments)
  • 🔧 Refactor (code restructuring without changing external behavior)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected)

Compatibility Check

  • I have verified this code compiles with C# 7.3 constraints (no new(), no record, no using var, etc.)
  • I have respected the suppressions in .editorconfig

How Has This Been Tested?

  • Automated Tests: Ran _tests/TestRunner.cs
  • Manual Verification: Imported into Streamer.bot and ran !giveaway system test
  • Feature specific testing: [Describe]

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have updated the CHANGELOG.md (under Unreleased)
  • My changes generate no new warnings (except those suppressed by design)

Summary by Sourcery

Align tests and project configuration with the .NET Framework 4.8 / C# 7.3 environment and adjust update-related testing and configuration.

Enhancements:

  • Suppress incompatible or noisy IDE and analyzer diagnostics in the UpdateService test file to match the target framework constraints.

Build:

  • Adjust project and configuration files (e.g., editorconfig and csproj) to align analyzer and dependency behavior with the current build setup.

Tests:

  • Update UpdateService checksum tests to better cover cases with missing checksums and clean up formatting.

…nce to conditionally use NuGet, and disable CA1850 diagnostic.
@Sythsaz Sythsaz self-assigned this Feb 9, 2026
@Sythsaz Sythsaz added the bug Something isn't working label Feb 9, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@sourcery-ai

sourcery-ai Bot commented Feb 9, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds coverage for UpdateService.ValidateChecksum behavior, introduces analyzer suppressions needed for legacy C# 7.3/.NET Framework constraints, and updates project configuration (including Newtonsoft.Json and CA1850 handling) to align with the test and build environment.

File-Level Changes

Change Details Files
Add/update tests to validate UpdateService checksum behavior, particularly when checksum is null or empty.
  • Add/adjust TestValidateChecksum_NoChecksum to assert that null checksum values allow updates with a warning instead of failing.
  • Add/adjust TestValidateChecksum_NoChecksum to assert that empty checksum strings allow updates with a warning instead of failing.
  • Fix indentation and formatting within the checksum test for consistency.
_tests/UpdateServiceTests.cs
Suppress analyzers that are incompatible with the project’s C# 7.3 / .NET Framework 4.8 constraints in the checksum tests and configuration.
  • Add file‑level pragmas in the UpdateService tests to disable IDE and CA analyzers that suggest C# 8+ features or different patterns (e.g., IDE0130, IDE0071, IDE0056, IDE0054, IDE0074, CA1854).
  • Adjust .editorconfig to suppress CA1850 (Prefer static local functions / caching) or configure its severity to avoid noise in this codebase.
_tests/UpdateServiceTests.cs
.editorconfig
Update project configuration and package references to better align with the build environment and analyzer settings.
  • Modify StreamerBot.csproj to update the Newtonsoft.Json reference and/or conditionally use a NuGet reference depending on the target environment.
  • Possibly wire up or align analyzer rules (including CA1850) with the project’s target framework and compilation configuration.
StreamerBot.csproj

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@Sythsaz Sythsaz changed the title test: Add UpdateService checksum tests, update Newtonsoft.Json refere… fix: Add UpdateService checksum tests, update Newtonsoft.Json refere… Feb 9, 2026

@sourcery-ai sourcery-ai Bot left a comment

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.

Hey - I've found 1 issue, and left some high level feedback:

  • Consider narrowing the #pragma warning disable scope in UpdateServiceTests.cs (or moving some suppressions into .editorconfig) so that only the specific lines that need each suppression are affected, which will make it easier to spot genuinely new issues in this file.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider narrowing the `#pragma warning disable` scope in `UpdateServiceTests.cs` (or moving some suppressions into `.editorconfig`) so that only the specific lines that need each suppression are affected, which will make it easier to spot genuinely new issues in this file.

## Individual Comments

### Comment 1
<location> `_tests/UpdateServiceTests.cs:72-82` </location>
<code_context>

         private static Task TestValidateChecksum_NoChecksum()
         {
-             // Should return true (allow update with warning)
-             if (!UpdateService.ValidateChecksum("Content", null))
+            // Should return true (allow update with warning)
+            if (!UpdateService.ValidateChecksum("Content", null))
                 throw new Exception("TestValidateChecksum_NoChecksum failed: Null checksum should pass (warn only)");

-             if (!UpdateService.ValidateChecksum("Content", ""))
+            if (!UpdateService.ValidateChecksum("Content", ""))
                 throw new Exception("TestValidateChecksum_NoChecksum failed: Empty checksum should pass (warn only)");

-             return Task.CompletedTask;
+            return Task.CompletedTask;
         }
</code_context>

<issue_to_address>
**suggestion (testing):** Consider adding a test case for whitespace-only checksum values in `TestValidateChecksum_NoChecksum`

Since this test already covers null and empty strings, please also verify how `UpdateService.ValidateChecksum` behaves with whitespace-only values (e.g. " ", "\t", or " \t "). Either extend this test with such a case or add a dedicated test documenting the expected behavior for whitespace checksums, so the edge case remains well-defined over time.

```suggestion
        private static Task TestValidateChecksum_NoChecksum()
        {
            // Should return true (allow update with warning)
            if (!UpdateService.ValidateChecksum("Content", null))
                throw new Exception("TestValidateChecksum_NoChecksum failed: Null checksum should pass (warn only)");

            if (!UpdateService.ValidateChecksum("Content", ""))
                throw new Exception("TestValidateChecksum_NoChecksum failed: Empty checksum should pass (warn only)");

            // Whitespace-only checksums should behave the same as no checksum (warn only, but allow update)
            if (!UpdateService.ValidateChecksum("Content", " "))
                throw new Exception("TestValidateChecksum_NoChecksum failed: Single-space checksum should pass (warn only)");

            if (!UpdateService.ValidateChecksum("Content", "\t"))
                throw new Exception("TestValidateChecksum_NoChecksum failed: Tab checksum should pass (warn only)");

            if (!UpdateService.ValidateChecksum("Content", " \t "))
                throw new Exception("TestValidateChecksum_NoChecksum failed: Mixed whitespace checksum should pass (warn only)");

            return Task.CompletedTask;
        }
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread _tests/UpdateServiceTests.cs
…lidation, updated `StreamerBot.csproj` for conditional Newtonsoft.Json usage, and disabled CA1850 diagnostic.
…ation and update `ValidateChecksum` to use `IsNullOrWhiteSpace`.
GitHub's default CodeQL setup is now enabled, which conflicts with
the advanced workflow configuration. Removing the advanced workflow
file resolves the error:
"CodeQL analyses from advanced configurations cannot be processed
when the default setup is enabled"
@Sythsaz
Sythsaz merged commit 889c18c into main Feb 9, 2026
14 checks passed
@Sythsaz
Sythsaz deleted the ql-fix branch February 9, 2026 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant