Compare commits

..

13 Commits

Author SHA1 Message Date
James Wampler
9e8e81ba83 Add unit tests for Audit (59% to 100%) and Webhooks (62% to 91%) namespaces
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:04:03 -07:00
James Wampler
68d426253d 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 15:04:03 -07:00
James Wampler
5b3050a222 Reformat and tweaking claude.md 2026-07-05 15:04:03 -07:00
James Wampler
51539d24d8 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 15:04:03 -07:00
James Wampler
67d7de0362 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 15:04:03 -07:00
James Wampler
7d4ab7991c 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 15:04:03 -07:00
James Wampler
145e1f1be9 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 15:04:03 -07:00
James Wampler
611557ce81 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 15:04:03 -07:00
James Wampler
b59c81f3b2 Compress CLAUDE.md into caveman-speak to cut context tokens
Original kept as CLAUDE.original.md for human reference.
2026-07-05 15:04:03 -07:00
James Wampler
b8ce405068 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 15:04:03 -07:00
James Wampler
2759314f63 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 15:04:03 -07:00
James Wampler
06e5359674 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 15:04:03 -07:00
James Wampler
cae55e5737 Add coverage reporting/badges and split CI between Gitea and GitHub (#5)
All checks were successful
CI / build-and-push (push) Successful in 46s
CI / deploy-qa (push) Successful in 13s
CI / smoke-qa (push) Successful in 35s
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.

Reviewed-on: #5
2026-07-05 10:14:30 -07:00

View File

@@ -123,7 +123,7 @@
<text x="53" y="15" fill="#010101" fill-opacity=".3">Coverage</text> <text x="53" y="15" fill="#010101" fill-opacity=".3">Coverage</text>
<text x="53" y="14" fill="#fff">Coverage</text> <text x="53" y="14" fill="#fff">Coverage</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> <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>

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB