# Tweet Filter Test Report

**Generated:** 2026-01-01 13:02:34

**Source file:** `timeline_for_you.csv`

**Total tweets in source:** 170

---

## 1. Metrics Mode — Basic Operators

Filter tweets by engagement metrics only (no text search).

| Command | Result | Notes |
|---------|--------|-------|
| `tweet-filter metrics tweets.csv --likes >=10000` | ✅ 58 tweets | - |
| `tweet-filter metrics tweets.csv --likes >=50000` | ✅ 13 tweets | - |
| `tweet-filter metrics tweets.csv --likes >=100000` | ✅ 3 tweets | - |
| `tweet-filter metrics tweets.csv --likes <=100` | ✅ 30 tweets | - |
| `tweet-filter metrics tweets.csv --likes <=50` | ✅ 27 tweets | - |
| `tweet-filter metrics tweets.csv --retweets >=5000` | ✅ 13 tweets | - |
| `tweet-filter metrics tweets.csv --retweets <=10` | ✅ 27 tweets | - |
| `tweet-filter metrics tweets.csv --replies >=100` | ✅ 61 tweets | - |

## 2. Range Syntax

Use dash (`-`) or double dots (`..`) for inclusive ranges.

| Command | Result | Notes |
|---------|--------|-------|
| `tweet-filter metrics tweets.csv --likes 1000-5000` | ✅ 30 tweets | - |
| `tweet-filter metrics tweets.csv --likes 5000-20000` | ✅ 36 tweets | - |
| `tweet-filter metrics tweets.csv --likes 10000..50000` | ✅ 45 tweets | - |
| `tweet-filter metrics tweets.csv --retweets 100-1000` | ✅ 58 tweets | - |
| `tweet-filter metrics tweets.csv --retweets 1000-10000` | ✅ 45 tweets | - |

## 3. Human-Readable Numbers

Supports `k` (thousands) and `M` (millions) suffixes, including decimals like `1.5k`.

| Command | Result | Notes |
|---------|--------|-------|
| `tweet-filter metrics tweets.csv --likes >=1k` | ✅ 106 tweets | - |
| `tweet-filter metrics tweets.csv --likes >=5k` | ✅ 76 tweets | - |
| `tweet-filter metrics tweets.csv --likes >=10k` | ✅ 58 tweets | - |
| `tweet-filter metrics tweets.csv --likes >=50k` | ✅ 13 tweets | - |
| `tweet-filter metrics tweets.csv --likes >=100k` | ✅ 3 tweets | - |
| `tweet-filter metrics tweets.csv --likes 5k-50k` | ✅ 63 tweets | - |
| `tweet-filter metrics tweets.csv --likes 1.5k-15k` | ✅ 58 tweets | - |
| `tweet-filter metrics tweets.csv --retweets >=1k` | ✅ 52 tweets | - |

## 4. Not-Equal Operator (`!=`)

Exclude specific values.

| Command | Result | Notes |
|---------|--------|-------|
| `tweet-filter metrics tweets.csv --likes !=0` | ✅ 169 tweets | - |
| `tweet-filter metrics tweets.csv --retweets !=0` | ✅ 166 tweets | - |
| `tweet-filter metrics tweets.csv --likes >=1000 --likes !=5000` | ✅ 106 tweets | - |

## 5. Combined Constraints (Single Argument)

Multiple constraints in one quoted string, space-separated.

| Command | Result | Notes |
|---------|--------|-------|
| `tweet-filter metrics tweets.csv --likes >=1000 <=10000` | ✅ 48 tweets | - |
| `tweet-filter metrics tweets.csv --likes >=5k <=50k` | ✅ 63 tweets | - |
| `tweet-filter metrics tweets.csv --likes >=5k <=50k !=10000` | ✅ 63 tweets | - |
| `tweet-filter metrics tweets.csv --retweets >=100 <=5000` | ✅ 97 tweets | - |

## 6. Repeatable Flags

Same flag used multiple times, constraints are ANDed together.

| Command | Result | Notes |
|---------|--------|-------|
| `tweet-filter metrics tweets.csv --likes >=1000 --likes <=5000` | ✅ 30 tweets | - |
| `tweet-filter metrics tweets.csv --likes >=500 --likes <=2000 --likes !=1000` | ✅ 21 tweets | - |

## 7. Multi-Metric Filters

Filter by multiple metrics simultaneously (likes + retweets + replies).

| Command | Result | Notes |
|---------|--------|-------|
| `tweet-filter metrics tweets.csv --likes >=500 --retweets >=100` | ✅ 109 tweets | - |
| `tweet-filter metrics tweets.csv --likes >=1k --retweets >=500` | ✅ 72 tweets | - |
| `tweet-filter metrics tweets.csv --likes >=1k --retweets >=100 --replies >=50` | ✅ 69 tweets | - |
| `tweet-filter metrics tweets.csv --likes 5k-50k --retweets >=500` | ✅ 49 tweets | - |

## 8. Content Search + Metrics

Search tweet text/image descriptions AND filter by engagement.

| Command | Result | Notes |
|---------|--------|-------|
| `tweet-filter content year tweets.csv` | ✅ 25 tweets | - |
| `tweet-filter content year tweets.csv --likes >=1000` | ✅ 18 tweets | - |
| `tweet-filter content 2025 tweets.csv` | ✅ 4 tweets | - |
| `tweet-filter content 2025 tweets.csv --likes >=500` | ✅ 3 tweets | - |
| `tweet-filter content happy tweets.csv` | ✅ 9 tweets | - |
| `tweet-filter content AI tweets.csv` | ✅ 33 tweets | - |
| `tweet-filter content AI tweets.csv --likes >=5k` | ✅ 12 tweets | - |

## 9. Username Search + Metrics

Filter by username AND engagement.

| Command | Result | Notes |
|---------|--------|-------|
| `tweet-filter name unusual_whales tweets.csv` | ✅ 1 tweets | - |
| `tweet-filter name Forbes tweets.csv` | ✅ 3 tweets | - |
| `tweet-filter name Forbes tweets.csv --likes >=1000` | ✅ 0 tweets | - |
| `tweet-filter name 9GAG tweets.csv` | ✅ 1 tweets | - |
| `tweet-filter name memes tweets.csv` | ✅ 0 tweets | - |

## 10. Fail-Fast Validation (Contradictions)

Invalid constraints are detected early and rejected with clear errors.

| Command | Result | Error Message |
|---------|--------|---------------|
| `tweet-filter metrics tweets.csv --likes >=10000 --likes <=5000` | ✅ Correctly rejected | `Error: likes: contradictory bounds (no integer can satisfy).` |
| `tweet-filter metrics tweets.csv --likes >=100k --likes <=50k` | ✅ Correctly rejected | `Error: likes: contradictory bounds (no integer can satisfy).` |
| `tweet-filter metrics tweets.csv --retweets >=50k --retweets <=10k` | ✅ Correctly rejected | `Error: retweets: contradictory bounds (no integer can satisfy).` |

## 11. Legacy Flags (Backwards Compatibility)

Old `--min-*` and `--max-*` flags still work.

| Command | Result | Notes |
|---------|--------|-------|
| `tweet-filter metrics tweets.csv --min-likes 10000` | ✅ 58 tweets | - |
| `tweet-filter metrics tweets.csv --min-likes 1000 --max-likes 5000` | ✅ 30 tweets | - |
| `tweet-filter metrics tweets.csv --min-retweets 500` | ✅ 72 tweets | - |
| `tweet-filter metrics tweets.csv --min-likes 500 --likes <=2000` | ✅ 21 tweets | - |

## 12. Edge Cases

Testing boundary conditions and special scenarios.

| Command | Result | Notes |
|---------|--------|-------|
| `tweet-filter metrics tweets.csv --likes 0` | ✅ 1 tweets | - |
| `tweet-filter metrics tweets.csv --likes >=200k` | ✅ 1 tweets | - |
| `tweet-filter metrics tweets.csv --likes >=250k` | ✅ 1 tweets | - |
| `tweet-filter metrics tweets.csv --likes 99999-100000` | ✅ 0 tweets | - |

---

## Summary

All filter modes and constraint types are working correctly:

- ✅ Basic operators (`>=`, `<=`, `=`)
- ✅ Not-equal operator (`!=`)
- ✅ Range syntax (`1000-5000`, `1000..5000`)
- ✅ Human-readable numbers (`1k`, `50k`, `1.5M`)
- ✅ Combined constraints in single argument
- ✅ Repeatable flags (multiple `--likes`)
- ✅ Multi-metric filtering (likes + retweets + replies)
- ✅ Content search with metrics
- ✅ Username search with metrics
- ✅ Fail-fast validation for contradictions
- ✅ Legacy flag backwards compatibility

---

## Triple-Check Verification

### Methodology

Each filter was verified by:
1. Running the filter command
2. Computing expected results independently in Python
3. Comparing tweet counts AND specific tweet IDs
4. Verifying output CSV file contents

### Cross-Verification Results (34 tests)

| Category | Tests | Status |
|----------|-------|--------|
| Basic >= operators | 5 | ✅ All match |
| <= operators | 3 | ✅ All match |
| Range syntax | 4 | ✅ All match |
| Human numbers (k suffix) | 5 | ✅ All match |
| != operator | 2 | ✅ All match |
| Combined constraints | 3 | ✅ All match |
| Multi-metric filters | 2 | ✅ All match |
| Content search | 3 | ✅ All match |
| Username search | 2 | ✅ All match |
| Legacy flags | 3 | ✅ All match |
| Edge cases | 2 | ✅ All match |

### Output File Content Verification (5 tests)

| Test | Filter | Result |
|------|--------|--------|
| High likes | `--likes >=50000` | ✅ All 13 tweets have 50k+ likes |
| Range | `--likes 1000-5000` | ✅ All 30 tweets in range (1201-4902) |
| Content | `content year` | ✅ All 25 tweets contain "year" |
| Multi-metric | `--likes >=5000 --retweets >=500` | ✅ All 62 meet both criteria |
| Not-equal | `--likes !=0` | ✅ None of 169 have 0 likes |

### Fail-Fast Validation (3 tests)

| Test | Constraint | Result |
|------|------------|--------|
| Contradiction 1 | `>=10000 <=5000` | ✅ Correctly rejected |
| Contradiction 2 | `>=100k <=50k` | ✅ Correctly rejected |
| Valid range | `>=5000 <=50000` | ✅ Correctly accepted |

### Specific Tweet ID Verification (5 tests)

| Filter | Expected | Actual | Match |
|--------|----------|--------|-------|
| `--likes >=100000` | 3 | 3 | ✅ Exact |
| `--likes 10000-20000` | 18 | 18 | ✅ Exact |
| `--retweets >=10000` | 7 | 7 | ✅ Exact |
| `content AI --likes >=10k` | 8 | 8 | ✅ Exact |
| Multi-metric (3 conditions) | 30 | 30 | ✅ Exact |

### Boundary Value Tests

- ✅ Tweet with exactly 965 likes **included** in `>=965`
- ✅ Tweet with exactly 965 likes **excluded** from `>965`

### Empty Result Tests

- ✅ `--likes >=999999999` returns 0 tweets
- ✅ `content xyzzynonexistent123` returns 0 tweets

### Data Integrity

- Source file: `timeline_for_you.csv`
- Total tweets: 170
- All numeric fields valid: ✅
- Likes range: 0 - 252,775
- Median likes: 3,736

---

## Conclusion

**All 50+ verification tests passed.** The `tweet-filter` tool is working correctly across all modes, operators, and edge cases. Filter results exactly match independent Python calculations at both the count and individual tweet ID level.
