viettranx
|
f2c43c3849
|
test(facebook,store/pg): wave B coverage push
Phase 03 - facebook 23.1% -> 81.9% (+58.8%, target ≥60%)
graph_api_test.go: NewGraphClient, VerifyToken, SubscribeApp, GetPost,
GetComment, GetCommentThread, ReplyToComment, SendMessage, SendTypingOn,
doRequest retry/backoff matrix (5xx retry, 401 non-retry, 429+Retry-After,
context cancel during backoff, transport error + retry), 551/subcode 24h
window non-retry, logRateLimit parse branches.
handlers_test.go: New required-field validation (4 branches), Factory
valid+malformed, WebhookHandler single-shot route, handleAPIError health
state mapping, handleCommentEvent (feature gate, edit/remove drop, page
routing, self-reply skip, dedup, enriched content path), handleMessagingEvent
(feature gate, page routing, self skip, receipt drop, text+postback dispatch,
dedup), Send Messenger+comment paths + missing-metadata error, sendFirstInbox
one-shot dedup, runDedupCleaner stale eviction, Stop closes deps, webhookRouter
register/unregister/route-once/ServeHTTP-no-instances, PostFetcher (defaults,
empty-id, cache hit/miss/expired, error propagation, GetCommentThread
empty+delegate).
Minimal refactor: converted package-level graphAPIBase const to var so tests
can point at httptest server. KISS, zero runtime behavior change.
Phase 04 - store/pg 1.3% -> 3.5% (+2.2%, unit-test-only)
scan_rows_test.go: pure-logic transformation tests for agentShareRow,
userInstanceRow, documentInfoRow, documentDetailRow, chunkInfoRow,
scoredChunkRow, episodicSummaryRow, episodicScoredRow, sessionListRow,
sessionPagedRow, sessionRichRow, entityRow, entityTemporalRow, relationRow,
relationExportRow, traversalRow, dedupCandidateRow, mcpAccessRequestRow,
cronRunLogRow, skillInfoRow+skillInfoRowWithFrontmatter, customSkillExportRow,
parseDepsColumn, parseFrontmatterAuthor, marshalFrontmatter, buildSkillInfo,
mergeEpisodicScores, hybridMerge.
pure_logic_test.go: matchWildcard pattern matching, evalPermRows priority
resolution (individual deny > individual allow > group deny > group allow),
contactResolveCache get/set/expired/negative cache.
Finding: 30% target not reachable with unit tests alone. Store/pg is
fundamentally DB-bound (~6000 LOC of SQL code vs ~200 LOC pure logic).
Reaching 30% requires running integration tests with TEST_DATABASE_URL and
-coverpkg=./internal/store/pg/ — which the current CI ratchet does NOT
do. Confirmed: integration tests yield 32% coverage on store/pg, but that
requires a wired-up test database in CI. Deferred as infrastructure change
outside Phase 04 scope.
Ratchet bumps (scripts/coverage_thresholds.json):
- internal/channels/facebook: 23.08 -> 81.80
- internal/store/pg: 1.28 -> 3.45
Race clean, dual build (default + -tags sqliteonly) clean.
|
2026-04-11 21:47:22 +07:00 |
|