anthropics / anthropics/skills

slack-gif-creator: validate_gif and is_slack_ready ignore file size limits, 7MB emoji marked “Slack Ready”

Open
#116 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
176k
Forks
20.8k
Avg merge
7h 21m
Merged PRs (30d)
5

Description

## Summary

When validating large GIFs, `validate_gif` and `is_slack_ready` currently only enforce dimension limits. Files >5MB are noted in the output, but this does not affect the final `passes` result, and is much above the Slack guidance of max 128kb.

I suggest either
- Pass with warning at >128kb
- Fail at >128kb

Happy to send a tiny PR if that's helpful!

---

## Reproduction
### Steps to reproduce
1. Create a 128x128 animated GIF with many frames so the file is several MB.
(in my case: 400 frames @ 50 fps, 128x128, size ~6.95 MB)
2. Run:
```python
from core.validators import validate_gif, is_slack_ready

passes, info = validate_gif("hello_shake_huge.gif", is_emoji=True, verbose=True)
print("passes:", passes)
print("slack_ready:", is_slack_ready("hello_shake_huge.gif", is_emoji=True))
```

### Observed

Console output (abridged):
```
Validating hello_shake_huge.gif:
Dimensions: 128x128 (optimal)
Size: 7120.4 KB (6.95 MB)
Frames: 400 @ 50.0 fps (8.0s)
Note: Large file size - consider fewer frames/colors
Validation Result: ✅ PASSES

...
Slack Ready: Yes - Ready to upload!
```

So validate_gif returns passes = True, and is_slack_ready also returns
True, even though the file is ~7MB.

### Expected
Either
- Warn at lower threshold
- Large files should fail validation

Suggestion: 128kb per Slack's docs.
*Note: Slack says 'If your image is too large, we’ll try to resize it for you.', but even a 1.3MB version I created failed to upload.*

---
## Diagnosis and recommendation
### Likely cause

Looking at core/validators.py:
- validate_gif calculates dim_pass from validate_dimensions.
- File size is checked only to print a “Note: Large file size…” message.
- The final passes value only uses the dimension result, not size.
- is_slack_ready simply wraps validate_gif and returns passes.

So file size never participates in the boolean success/fail, even when
is_emoji=True.

### Possible fix
1. Simpler: update the warnings
- Warn at >128kb with descriptive message, for example:
> Warning: File size >128kb Slack guideline - consider fewer frames/colors

2. Stricter: have validate_gif combine both dimension and size checks into passes.
- For example (pseudocode):
```
dim_pass, dim_info = validate_dimensions(width, height, is_emoji=is_emoji)
size_pass, size_info = check_slack_size(path, is_emoji=is_emoji)

passes = dim_pass and size_pass
info = {"dimensions": dim_info, "size": size_info}
```
and have is_slack_ready(path, is_emoji=True) return that combined passes.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.