Compare commits

..

14 Commits

Author SHA1 Message Date
miccheck-ci
5959c1b2e3 chore: refresh coverage badge [skip ci] 2026-07-05 22:02:27 +00:00
James Wampler
4ad3285afa Add unit tests for Audit (59% to 100%) and Webhooks (62% to 91%) namespaces
All checks were successful
CI / build-and-push (push) Successful in 41s
CI / deploy-qa (push) Has been skipped
CI / smoke-qa (push) Has been skipped
Covers AuditLogQueryService filtering/paging/actor-name join,
AuditLogResponse mapping, AuditLogsController, AuditService.LogAsync
and actor-claim resolution, WebhookResponse/WebhookDeliveryLogResponse
mapping, CreateWebhookRequestValidator, WebhookQueue, and additional
WebhookDispatcher branch coverage (scope routing, disabled webhooks,
delivery exceptions).

Excludes WebhookBackgroundService and WebhookRetryBackgroundService
from coverage: both resolve a DI-scoped concrete MicCheckDbContext via
IServiceScopeFactory, which requires a live DI container/DB per
CLAUDE.md's no-InMemory/WebApplicationFactory rule. Their query and
dispatch logic is covered by WebhookRetryTests/WebhookDispatcherTests.
2026-07-05 15:00:02 -07:00
James Wampler
837c51d366 Add unit tests for Environments namespace (0% to 99.5% coverage)
Covers EnvironmentService (CRUD, clone, list, find-by-key), the
EnvironmentsController orchestration layer (webhooks, audit logs,
identities/traits, feature states, feature segments, identity
segments), EnvironmentDocumentService/Controller, response mappers,
and request validators.
2026-07-05 14:53:32 -07:00
James Wampler
4f04d805ac Reformat and tweaking claude.md 2026-07-05 14:37:59 -07:00
James Wampler
7b33bca6a9 Add unit tests for MicCheck.Api.Organizations and MicCheck.Api.Projects
Both namespaces had only entity tests. Adds service, controller, and
validator coverage: OrganizationService/OrganizationsController
(members, invites, invite links, webhooks) and
ProjectService/ProjectsController (CRUD, user permissions).

OrganizationService.SetPrimaryAsync is marked [ExcludeFromCodeCoverage]:
it uses EF Core's ExecuteUpdateAsync, which needs a real relational
query provider our Mock<DbSet<T>> LINQ-to-Objects harness can't
execute (and CLAUDE.md disallows EF InMemory as a substitute). Its
early-return branch is still covered.

Raises Organizations from 3.5% to 98.8% and Projects from 19.6% to
99.3%.
2026-07-05 14:36:24 -07:00
James Wampler
d6594521f8 Add unit tests for MicCheck.Api.Identities
Covers AdminIdentityService (list/create/find/upsert-trait/delete-trait/
delete/feature-state get-set-delete, all previously 0%), the
AdminIdentityResponse mapping, TraitInput's JSON/plain-type branch
logic, and IdentitiesController.GetByIdentifier.

Raises the namespace from 31% to 97.5%.
2026-07-05 14:20:31 -07:00
James Wampler
6ed173ff7c Exclude Data namespace from dotnet code coverage
DbContext/EF configuration classes are infra plumbing with no
business logic to unit test; counting them against the coverage
target only dilutes the signal, same rationale as Migrations.
2026-07-05 13:26:15 -07:00
James Wampler
678f605197 Add unit tests for MicCheck.Api.Features
Covers validators, response mapping, TagService/TagsController,
FeaturesController (CRUD + tag assignment), FeatureSegmentService,
FeatureStateService (incl. webhook dispatch), and
FeatureUsageController. Fills gaps in FeatureService
(FindByIdAsync, not-found exceptions).

FeatureUsageFlushBackgroundService is marked [ExcludeFromCodeCoverage]:
timer-driven, issues raw SQL through a DI-scoped concrete DbContext,
can't be exercised cleanly without a live DB (CLAUDE.md disallows
WebApplicationFactory/InMemory).

Raises the namespace from 44% to 97%.
2026-07-05 13:26:11 -07:00
James Wampler
117fc3bde7 Add unit tests for MicCheck.Api.Common, exclude untestable endpoint glue
ApiKeyService had zero coverage despite real logic (key generation,
hashing, org-scoped revoke). Also filled branch gaps in AuthService
(logout with unknown token) and the auth handlers (empty header
values).

ApiKeyEndpoints/AuthEndpoints are marked [ExcludeFromCodeCoverage]:
they're minimal-API route registration that needs a live HTTP
pipeline to exercise, which CLAUDE.md disallows (no
WebApplicationFactory/InMemory). Their branch logic is already
covered via the underlying service unit tests.

Raises the namespace from 66% to 91%. Remaining gap is plain
positional records with no logic (LoginRequest, PagedResult, etc.) -
left untested per CLAUDE.md's guidance against coverage-only tests.
2026-07-05 13:17:48 -07:00
James Wampler
1f09f0a3d2 Compress CLAUDE.md into caveman-speak to cut context tokens
Original kept as CLAUDE.original.md for human reference.
2026-07-05 13:11:39 -07:00
James Wampler
0595ff5642 Add unit tests for MicCheck.Api.Segments
Covers CreateSegmentRequestValidator, response mapping (incl. nested
rules), SegmentsController, and gaps in SegmentService/SegmentEvaluator
(FindByIdAsync, not-found paths, nested rules, modulo/percentage edge
cases), raising the namespace from 66% to 98% coverage.
2026-07-05 13:11:35 -07:00
James Wampler
7fc021500c Add unit tests for MicCheck.Api.Users
Covers UserService (profile update, email conflict, password change)
and UsersController (auth/validation/not-found/conflict branches),
raising the namespace from 3% coverage.
2026-07-05 13:11:29 -07:00
James Wampler
3888168571 Exclude Migrations namespace from dotnet code coverage
EF migrations are generated scaffolding with no meaningful logic to
test; counting them against the coverage target only dilutes the
signal.
2026-07-05 13:11:25 -07:00
James Wampler
fe22ba01b7 Add coverage reporting/badges and split CI between Gitea and GitHub
All checks were successful
CI / build-and-push (push) Successful in 38s
CI / deploy-qa (push) Has been skipped
CI / smoke-qa (push) Has been skipped
Merge dotnet+jest coverage via reportgenerator, publish a self-hosted
coverage badge and build-status badges on the readme. Gitea remains the
full pipeline (build/test/docker push/deploy-qa/smoke); GitHub only
builds and tests since it has no registry secrets or qa runner.
2026-07-05 10:12:12 -07:00

View File

@@ -123,7 +123,7 @@
<text x="53" y="15" fill="#010101" fill-opacity=".3">Coverage</text>
<text x="53" y="14" fill="#fff">Coverage</text>
<text class="" x="132.5" y="15" fill="#010101" fill-opacity=".3">29.8%</text><text class="" x="132.5" y="14">29.8%</text>
<text class="" x="132.5" y="15" fill="#010101" fill-opacity=".3">69.2%</text><text class="" x="132.5" y="14">69.2%</text>

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB