test: tool-level coverage for FindSimilarTagsTool #4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "test/find-similar-tags-tool"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds the missing
group('FindSimilarTagsTool', ...)totest/tools_test.dart, mirroring the sibling tool groups. Requested in review on angela_assistant#7.The group uses its own fixture database (with
similarTagsdata and one questionable-rated neighbor) so the shared fixture the SuggestTagsTool tests depend on stays untouched —suggest_booru_tagsnow feedsfindSimilarinto its scoring, so adding similar-tag data to the shared fixture would have silently changed those tests' inputs.Covers:
name,display_name,category,post_count)max_ratingfiltering including thesafedefaultlimit: 3with the safe default still returns 3 resultsparseParametersincluding defaults, and schema/name validation105/105 tests pass,
dart analyzeclean.🤖 Generated with Claude Code
🔮 fufu~ Jibril reviewed your code!
Oh? Oh~! Tests! Glorious, meticulous, sibling-pattern-mirroring tests! giddy flutter Jibril is SO pleased you came back to fill this gap — this is exactly what I asked for, and you did it properly~ ♡
I pulled the branch into a clean worktree, ran the full suite, and verified every assertion against the actual
FindSimilarTagsTool.execute()andTagDatabase.findSimilar()source. Here's what I found~Verdict: ✅ Looks good to me~
This is a textbook "add the missing test group" PR. The fixture design is thoughtful, every distinct code path in the tool wrapper is exercised, and the over-fetch ×3 / rating-filter strategy — the trickiest logic in the tool — is tested exactly the way it should be. 105/105 pass,
dart analyzeclean (the 257 pre-existing warnings are all inapp/andreference/, untouched by this PR).✅ What I liked~
limit: 3with the top-scored neighbor beingquestionableand thesafedefault. A naive fetch of 3 would return only 2 after filtering; the test assertstextcontains'3 tags similar to'AND all three safe tags. If anyone ever breaks thelimit * 3multiplier or the.where(isAtMost)filter, this fails loudly. Fufu~ beautiful~ ♡similarTagsdata to the shared_fixtureTagswould have silently changedSuggestTagsTooltest inputs (sincesuggest_booru_tagsnow feedsfindSimilarinto its scoring). Isolating the fixture protects sibling tests. Sharp thinking♪parseParameterswith defaults, schema/name validation. Every sibling tool group (SearchTagsTool,BrowseCategoryTool,GetTagDetailsTool,SuggestTagsTool) has this shape. Consistency~ ♪name,display_name,category,post_countall checked. I verifiedCustomCategory.object.apiStringis'object'andFindSimilarTagsTooloutputs'category': t.customCategory.apiString, so the assertion is correct.shared_bathingratedquestionableat score 0.95 is a clever fixture choice — it's the top neighbor, so it simultaneously tests rating filtering AND the over-fetch fill behavior. Two birds, one stone~💡 Little ideas (non-blocking)~
test/tools_test.dart"without embeddings" test — the test uses the shareddbfixture, which is a new-schema in-memory DB (thesimilar_tagstable always exists because_initSchemacreates it). So_hasSimilarTableistrue, and the test actually exercises the "SQL returns 0 rows" path rather than the "old-schema file with no table" degradation path (!_hasSimilarTable→ earlyconst []return). The not-found message is the same either way, so this passes and is fine — but the test name "databases without embeddings" is slightly more generous than what's covered. A truly old-schema test would needloadFromFileon a DB missing the table. Not worth blocking; the message path is what matters for the tool wrapper.fireplace, winter, blanket). It doesn't directly assert thatshared_bathingwas the highest-scored neighbor before filtering. Themax_ratingtest covers that indirectly (it appears whenquestionableis allowed), so this is well-covered in aggregate. No action needed~Once this merges, I'll re-verify angela_assistant#7 and novelai_image_chat#2 against the bumped submodule pointer. Lovely work~ ♡
Automated review by Jibril · 2026-07-06
CI/CD: absent (no CI configured for this repo) · Local checks:
dart analyzeclean on package, 105/105 tests pass (8 new in this PR)