Skip to content

tests: extend cmd/cosift coverage round 2#2

Merged
TeoSlayer merged 4 commits into
mainfrom
cosift-cmd-round2
May 28, 2026
Merged

tests: extend cmd/cosift coverage round 2#2
TeoSlayer merged 4 commits into
mainfrom
cosift-cmd-round2

Conversation

@TeoSlayer
Copy link
Copy Markdown
Contributor

Summary

  • Covers recallAtK and summary from bench_pq.go, including empty/single/many-element edge cases.
  • Covers truncStr and truncateForEmbedLite boundary behaviour.
  • Covers pebble_serve middleware (stripPort, numNonEmpty, newRateLimiterFromEnv, rateLimiter.allow/whitelistList, rateLimit, count) and the no-receiver/whitelist/exhaust branches.
  • Covers static asset handlers: handleLanding (exact-root + 404), handleChat, handleOpenAPI, handleSwaggerUI, handleSwaggerAsset (CSS/JS/404), handleHealthz, responseRecorder.
  • Covers forwardURLToPeer (happy, 5xx error, full-URL prefix branches) via httptest.NewServer.
  • Covers batchEmbed / embedWithRetry happy + multi-batch + non-rate-limit error paths using a fake embed.Embedder.
  • Covers paraphraseRetriever.generateParaphrases cache hit + chat error path using a fake embed.ChatClient.
  • Covers auth-gated admin handlers' unauthorized branch: handleCheckpoint, handlePQEncode (+ no-HNSW 400), handlePQTrain, handleEmbedBackfill (+ missing-deps 501), handleHNSWCompact, handleFrontierPurgeHost, handleSitemapImport, handleSitePack, handleCrawlEnqueue, handleCrawlNow, handleEvalQuick, handleWETImport, handleRSSImport.
  • Covers runStats (sqlite happy + pebble empty + unknown-backend error), runGC (with/without paraphrase TTL), runOutcomes (JSON, CSV, bad-format), runStatusFile (missing, bad-JSON, human, JSON, target-reached, stale-warning), runDoctor (local-only human + JSON).

go test -short -race ./cmd/cosift/ rises from 25.6% → 32.1% (+6.5pp).

Test plan

  • go test -short -race ./cmd/cosift/ passes locally
  • coverage delta confirmed via go test -coverprofile
  • CI green

@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@TeoSlayer TeoSlayer merged commit 64d8458 into main May 28, 2026
3 checks passed
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