Skip to content

test(v3/icons): assert .ico is small, not an exact byte size - #5627

Merged
leaanthony merged 1 commit into
masterfrom
fix/icon-test-size-assertion
Jun 17, 2026
Merged

leaanthony merged 1 commit into
masterfrom
fix/icon-test-size-assertion

Conversation

@leaanthony

@leaanthony leaanthony commented Jun 17, 2026 •

Copy link
Copy Markdown
Member

TestGenerateIcon hard-asserted the generated .ico was exactly 571 bytes. After the default icons were updated in #5610, the single-16px .ico is 481 bytes, so the test has been failing on master (macOS + Windows Go Tests v3).

The exact byte count depends on the source image, so this replaces the exact-size assertions (two test cases) with a check that the file is small (<5000 bytes) and non-empty — the test's actual intent (a single 16px icon) — which won't re-break when icons change again.

Verified go test -run TestGenerateIcon ./internal/commands/ passes.

Summary by CodeRabbit

  • Tests
    • Updated icon-generation test validation to use flexible range-based assertions instead of strict byte-size checks, improving test robustness and accommodating expected variations in generated output.

TestGenerateIcon asserted the generated .ico was exactly 571 bytes. After the
default icons were updated (#5610), the single-16px .ico is 481 bytes, so the
test failed on master (macOS + Windows). The exact byte count depends on the
source image, so assert the file is small (<5000 bytes) and non-empty instead —
which is the test's actual intent and won't re-break on future icon changes.
Copilot AI review requested due to automatic review settings June 17, 2026 21:21
@coderabbitai

coderabbitai Bot commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c4753e18-d96d-4590-a3ea-6d98cb2fd800

📥 Commits

Reviewing files that changed from the base of the PR and between 502b9c1 and 8208ecf.

📒 Files selected for processing (1)
  • v3/internal/commands/icons_test.go

Walkthrough

Two test assertions in icons_test.go for single 16px .ico generation are changed from checking an exact byte count (571) to verifying the output is non-empty and does not exceed a maximum threshold (5000 bytes), with comments noting that size varies by source image.

Changes

Icon Test Assertion Relaxation

Layer / File(s) Summary
Range-based .ico size assertions
v3/internal/commands/icons_test.go
For both the sizes=16 and sizes=0,16 test cases, the exact 571-byte assertion is replaced with checks that the .ico output is non-empty and ≤ 5000 bytes, accompanied by explanatory comments about source-image variance.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Suggested labels

go, v3

Poem

A rabbit checked the icon size,
"571 bytes? That's not so wise!"
Now any small .ico will do,
As long as it's not empty — whew!
Range checks hop in, exact counts flee,
🐇 Flexibility sets the tests free!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description lacks required sections from the template. It is missing: Type of change checklist, How Has This Been Tested section with platform checkboxes, Test Configuration section, and completion of the Checklist. Add the missing sections from the PR template: select the type of change, describe testing performed with platform checkboxes, provide test configuration details, and complete the PR checklist items.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'test(v3/icons): assert .ico is small, not an exact byte size' directly and specifically describes the main change: replacing exact byte size assertions with range-based size checks.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/icon-test-size-assertion

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain modules listed in go.work or their selected dependencies"


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@leaanthony
leaanthony merged commit 98efc33 into master Jun 17, 2026
18 of 20 checks passed
@leaanthony
leaanthony deleted the fix/icon-test-size-assertion branch June 17, 2026 21:23

Copilot AI 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.

Pull request overview

This PR fixes a brittle v3 icon-generation test by removing hard-coded .ico byte-size assertions and replacing them with size-sanity checks that better match the test’s intent (a single 16px icon) and won’t break when the source icon artwork changes.

Changes:

  • Replaced exact .ico size assertions (571 bytes) with checks that the output is non-empty and “small” (≤ 5000 bytes) for sizes=16.
  • Applied the same “small & non-empty” validation to the "0,16" sizes case (ensuring 0 is ignored).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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