Skip to content

test(thumbreq): build the harness pool without a worker - #268

Merged
thisisgm merged 1 commit into
thisisgm:mainfrom
mrphonk:fix/thumbreq-symlink-test-race
Oct 13, 2026
Merged

thisisgm merged 1 commit into
thisisgm:mainfrom
mrphonk:fix/thumbreq-symlink-test-race

Conversation

@mrphonk

@mrphonk mrphonk commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

backend::thumbreq::tests::a_symlink_row_keys_the_cache_on_its_target_mtime fails intermittently with one job queued (left 0, right 1). The test reads its job back through pool.cancel_all(), but the harness built a real one-worker Pool, and that worker sometimes popped the job first. It failed 2 of 5 runs here.

The harness now uses Pool::idle(), a test-only constructor for a queue no worker drains, so what a test queued is exactly what it reads back. No test in thumbreq.rs needs a worker. They all check the request policy. Since the queue is now exact, the other tests assert it too: the four that queue nothing require an empty queue, and the two that queue a row require exactly one job for photo.jpg. TestPool::new in thumbs.rs builds on Pool::idle() instead of a third copy of the queue constructor. Production code is unchanged.

src/backend/thumbs.rs was already over the hard cap, so its recorded ceiling moves from 460 to 466, and thumbreq.rs drops from 418 to 417, with the note in AGENTS.md "File budget".

Validation: the test passed 50 of 50 runs after the change. cargo test --locked passed (1583 passed, 0 failed), and tools/flea-clippy and tools/flea-file-budget both pass. As a mutation check, queueing the wrong path in queue_row makes the two strengthened tests fail; before this change they passed. The headless battery (tests/run-all.sh) was not run for this PR, since the change touches only Rust test code.

Summary by CodeRabbit

  • Tests
    • Updated thumbnail request tests to verify that cache hits and cache-only misses do not queue work, while ordinary cache misses queue the requested thumbnail. These changes improve coverage of thumbnail request behavior; they do not change user-facing functionality.

a_symlink_row_keys_the_cache_on_its_target_mtime read its job back
through cancel_all, but the harness pool's one worker could pop it
first, which failed 2 of 5 runs. With Pool::idle the queue is exact,
so every test in the file now asserts what reached it.
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dbe84701-b533-4f51-b5b4-485b59889b4c
📥 Commits

Reviewing files that changed from the base of the PR and between abb536e and 1d98dea.

📒 Files selected for processing (4)
  • AGENTS.md
  • src/backend/thumbreq.rs
  • src/backend/thumbs.rs
  • tools/flea-file-budget

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The test pool now supports an idle, worker-free setup. Thumbnail request tests use it to inspect queued jobs, checking that cache hits and selected misses queue no jobs and that ordinary misses queue the expected file path.

Changes

Thumbnail request test harness

Layer / File(s) Summary
Create and share an idle test pool
src/backend/thumbs.rs, tools/flea-file-budget
Pool::idle creates a pool with an empty queue and no worker. TestPool::new uses the helper and shares its queue with the test worker. The recorded line ceiling for thumbs.rs increases from 460 to 466.
Use the idle pool to verify thumbnail jobs
src/backend/thumbreq.rs, AGENTS.md
The thumbnail request test harness uses the idle pool instead of configuring a worker-backed pool. Tests inspect cancel_all() results to check for no jobs in cache-only and selected symlink cases, and to check the expected path for ordinary misses. AGENTS.md records the harness change.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: thisisgm

Merge Risk: ⚪ Minimal · up to 1d98d

The reported queue-inspection race is not present in this change; it appears mergeable subject to normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 64.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 2 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: the thumbreq test harness now builds its pool without a worker.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 64.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 2 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@thisisgm
thisisgm merged commit 137b438 into thisisgm:main Oct 13, 2026
1 check passed
@thisisgm

Copy link
Copy Markdown
Owner

the thumbnail stall is not fixed in 0.3.10; this PR changes only the thumbnail test harness (137b438, v0.3.10), so this stays open. Thanks @mrphonk! https://github.com/thisisgm/flea/releases/tag/v0.3.10

@thisisgm

Copy link
Copy Markdown
Owner

Busy thumbnail workers could lose visible requests; the separate production fix at cd27b96ab3 retries them in v0.3.11, following your test-harness fix already merged in v0.3.10. Thanks @mrphonk! Release.

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