Skip to content

test: raise backend coverage to 88.5%, floor 87 - #677

Merged
fclairamb merged 27 commits into
mainfrom
chore/coverage-90
Oct 25, 2026
Merged

fclairamb merged 27 commits into
mainfrom
chore/coverage-90

Conversation

@fclairamb

Copy link
Copy Markdown
Owner

Raises backend test coverage (spec 2026-10-23-03-coverage-90). Moved here from #672, where it did not belong.

What changed

  • About 30 new *_cover_test.go files: pkg/cli, auth (passkey, OAuth), discord, slack, mcp, jobtypes, models, checkerdef, cmd/devloop, db contract (update_every_field).
  • testsupport/errmap.go and testsupport/fault.go (SweepFresh) to drive error paths.
  • Coverage floor 87 (CI, scripts/coverage.sh, codecov.yml). Local measure: 88.5%, CI reads about 1 point lower.
  • Wiki: wiki/testing/test-layers.md, wiki/testing/coverage.md.
  • Fix: slack/events.go built its Handler without cfg, so link_shared panicked on a nil config (TestLinkSharedUnfurlsOwnLinks).

Open

The spec asked for 90%. It stopped at 88.5% after 3 attempts. The spec is still in specs/todos/ until that is decided.

🤖 Generated with Claude Code

fclairamb and others added 24 commits October 25, 2026 16:50
…bove

Ratchet COVERAGE_MIN and codecov targets from 84 to 85 (local full-layer
measurement about 87%, CI reads about 1 point lower).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…kinds and CLI results

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…bove

Measured full-layer coverage is 87.5%; the floor is ratcheted from 85 to 87
(ci.yml x2, scripts/coverage.sh x2, codecov.yml x2). 90% is not reachable
without mocking live-network or Docker code (RDP/VNC, passkey, SAML, email
sender, Slack/Discord socket modes, cmd mains). The remaining gap is a long
tail of small error branches (auth, pkg/cli, jobtypes, checks, db/postgres).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… and plugin-finger startup

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ed no longer panics

DispatchEvent built its Handler without cfg, and handleLinkShared reads
cfg.BaseURLHost(), so every link_shared delivery (the bot requests
links:read) dereferenced a nil config. Also covers member_joined_channel
auto-configuration, Socket Mode event kinds, users.lookupByEmail and the
incident auto-publish job.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A misspelled or missing column fails the UPDATE even when no row matches,
so each Update* method is called once with every value field set and once
with every set-to-NULL switch taken.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…uery failing

Adds testsupport.SweepFresh, the FaultHook sweep for operations that skip
themselves once their data exists, so each replay gets a fresh database.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
isExcludedDir checks every path component and "tmp" is excluded, so
t.TempDir() under Linux's /tmp made addWatches skip the whole root and
the debounce loop drop every event. macOS temp dirs live under
/var/folders, which is why the tests passed locally.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@codecov

codecov Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.30769% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.70%. Comparing base (37966e2) to head (5e1d1be).

Files with missing lines Patch % Lines
...erver/internal/db/dbcontract/update_every_field.go 89.39% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #677      +/-   ##
==========================================
+ Coverage   88.16%   89.70%   +1.53%     
==========================================
  Files        1289     1291       +2     
  Lines      131553   131644      +91     
==========================================
+ Hits       115982   118088    +2106     
+ Misses      15562    13547    -2015     
  Partials        9        9              
Files with missing lines Coverage Δ
server/internal/db/dbcontract/contract.go 100.00% <100.00%> (ø)
server/internal/integrations/slack/events.go 88.37% <100.00%> (+16.49%) ⬆️
server/internal/testsupport/errmap.go 100.00% <100.00%> (ø)
server/internal/testsupport/fault.go 100.00% <100.00%> (ø)
...erver/internal/db/dbcontract/update_every_field.go 89.39% <89.39%> (ø)

... and 182 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fclairamb
fclairamb merged commit e53c2b5 into main Oct 25, 2026
33 checks passed
@fclairamb
fclairamb deleted the chore/coverage-90 branch October 25, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant