Compare commits

...

12 Commits

Author SHA1 Message Date
James Wampler
6c815a6688 Add feature-usage tracking and dashboard charts
Instruments FeatureEvaluationService with System.Diagnostics.Metrics (Counter + IMeterFactory). Accumulates per-feature/day evaluation counts in-process, flushed every 30s to a new FeatureUsageDaily Postgres table via PostgreSQL ON CONFLICT upsert. Caches dashboard query results for 180s in IMemoryCache. New GET /api/v1/environments/{id}/usage endpoint returns top-10 features last day and 14-day per-day breakdown. Admin dashboard shows two ApexCharts bar charts: top features and evaluations by day with per-flag hover tooltip.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 12:45:56 -07:00
James Wampler
b59b56575f Fix identity trait add and persistence bugs
Remove Key from UpsertTraitRequest body (comes from URL route). Emit 'updated' event from IdentityDetail on trait mutations and sync parent. Reload segment data on tab activation and dialog open.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 12:45:45 -07:00
James Wampler
cbf1aba219 Fix v-btn-toggle overlap in dialogs; add segment override icon to features grid
Replace v-btn-toggle with manual button pairs in RuleGroupEditor and
FeatureValueEditor — VSlideGroup (used internally) measures zero width
inside teleported dialogs, causing buttons to overlap and show scroll arrows.

Add donut chart icon next to feature names in the features grid when segment
overrides exist; clicking opens FeatureDetail directly on the Segments tab.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-17 10:25:50 -07:00
James Wampler
d555e3b2d2 Wrap long method signatures and remove unused using to comply with 220-char line limit
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 11:31:03 -07:00
James Wampler
c0a1f4d194 Persist and restore selected project and environment across page reloads
- Add refreshOrganization/refreshProject/refreshEnvironment to context store — update value and localStorage without clearing child selections
- OrgSelector: use refreshOrganization when same org is already stored, preventing the chain that was clearing project and environment
- ProjectSelector: watch org ID (not object ref) so refresh doesn't retrigger; add autoSelectProject to restore stored project or auto-select single project
- EnvironmentTabBar: watch project ID; skip env-clear on initial mount; add autoSelectEnvironment to restore stored env or fall back to first
- Fix test fixtures missing isPrimary field; update EnvironmentTabBar tests to match v-select implementation; add tests for restore behavior

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 11:26:19 -07:00
James Wampler
0531e1943f Add primary organization flag with auto-selection on dashboard
Adds IsPrimary to OrganizationUser (per-user flag, one primary per user).
First org created is automatically set as primary. Selecting a different
org via the UI calls PUT /organisations/{id}/primary to persist the choice
server-side. Dashboard auto-selects: localStorage org (refreshed) →
primary org → single org when no explicit selection exists.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-11 10:00:09 -07:00
James Wampler
671c041764 Fix register form layout and validation shift
Fix first/last name field overlap by using no-gutters row with
responsive padding. Override global hideDetails:'auto' Vuetify default
with :hide-details="false" so the details area is always rendered,
preventing 22px layout shift when validation messages appear.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 22:14:31 -07:00
James Wampler
e51e28d411 Add admin Vite app to Aspire AppHost
Registers the Vue admin as an Aspire resource via AddViteApp, wired to
the API so Aspire injects service discovery env vars that the existing
Vite proxy config already reads.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 21:46:52 -07:00
James Wampler
e3b8cd9067 Fix build errors and enable TreatWarningsAsErrors across all projects
Remove duplicate source files from old ApiKeys/, Authentication/, and
Authorization/ folders that were already migrated to Common/Security/.
Update test namespace usings to match. Pin EFC Relational 10.0.5 to
resolve MSB3277 version conflict with Npgsql's transitive dependency.
Add LangVersion and TreatWarningsAsErrors to AppHost and ServiceDefaults.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 13:19:59 -07:00
James Wampler
570ab363c2 WIP 2026-06-10 13:06:55 -07:00
James Wampler
4621e8380b Add MicCheck.Api.Tests.Integration project
NUnit integration tests that target a running API by URL and seed/clean
data directly in Postgres. Settings (BaseUrl, DbConnectionString) come
from .runsettings or environment variables so tests can be pointed at
any environment. HTTP requests live in HttpFiles/*.http; assertion
failures include a fresh DB snapshot of the relevant rows. First test
covers the flag-enabled path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-03 19:12:47 -07:00
James Wampler
d3b36956e4 New project file, added Aspire, moved security 2026-06-03 18:44:48 -07:00
982 changed files with 24002 additions and 38016 deletions

0
.editorconfig Normal file → Executable file
View File

0
.gitignore vendored Normal file → Executable file
View File

0
.vscode/settings.json vendored Normal file → Executable file
View File

7
CLAUDE.md Normal file → Executable file
View File

@@ -24,10 +24,17 @@ MicCheck: open source. asp.net, c#, typescript, VueJS. Manages feature flags, pr
# Coding # Coding
- Descriptive names for all classes/methods. No generic names: Provider, Manager, Helper - Descriptive names for all classes/methods. No generic names: Provider, Manager, Helper
- Match formatting/style from `.editorconfig` - Match formatting/style from `.editorconfig`
- Wrap lines at 220 characters, leave single line if fewer
- Place interfaces that are implemented by a single class at the bottom of the class file. An interface with multiple implementations of an interface should be in a seperate file.
- Do not use tuples for return types. Prefer records or classes for multiple values
- Do not use `sealed` on classes-
- Use `record` for data objects, `class` for objects with behavior. Avoid mutable state where possible.
## Testing ## Testing
- BDD-style unit tests, end-to-end as possible, no external resources (DB, filesystem). e.g. `WhenAUserDoesSomething_ThenAThingAppears` - BDD-style unit tests, end-to-end as possible, no external resources (DB, filesystem). e.g. `WhenAUserDoesSomething_ThenAThingAppears`
- Mock external deps with Moq - Mock external deps with Moq
- New features need unit tests covering as much logic as possible
- Any modified file: evaluate for missing test coverage-
- No "Mock" in mocked object names - No "Mock" in mocked object names
- No Arrange/Act/Assert comments - No Arrange/Act/Assert comments

0
CLAUDE.original.md Normal file → Executable file
View File

19082
MicCheck.slnx Normal file → Executable file

File diff suppressed because it is too large Load Diff

0
docker-compose.yml Normal file → Executable file
View File

0
docs/admin/00-New-Website-output.md Normal file → Executable file
View File

0
docs/admin/00-New-Website.md Normal file → Executable file
View File

0
docs/admin/01-admin-site_plan.md Normal file → Executable file
View File

0
docs/api/00 - new-aspnet-project.md Normal file → Executable file
View File

0
docs/api/00-output.md Normal file → Executable file
View File

0
docs/api/01_project_setup.md Normal file → Executable file
View File

0
docs/api/01_project_setup_output.md Normal file → Executable file
View File

0
docs/api/02_core_domain_models.md Normal file → Executable file
View File

0
docs/api/02_core_domain_models_output.md Normal file → Executable file
View File

0
docs/api/03_database_and_repositories.md Normal file → Executable file
View File

0
docs/api/03_database_and_repositories_output.md Normal file → Executable file
View File

0
docs/api/04_authentication_and_authorization.md Normal file → Executable file
View File

0
docs/api/04_authentication_and_authorization_output.md Normal file → Executable file
View File

0
docs/api/05_flags_api.md Normal file → Executable file
View File

0
docs/api/05_flags_api_output.md Normal file → Executable file
View File

0
docs/api/06_admin_api.md Normal file → Executable file
View File

0
docs/api/06_admin_api_output.md Normal file → Executable file
View File

0
docs/api/07_audit_and_webhooks.md Normal file → Executable file
View File

0
docs/api/07_audit_and_webhooks_output.md Normal file → Executable file
View File

0
docs/api/08_testing_strategy.md Normal file → Executable file
View File

0
dotnet-install.sh vendored Normal file → Executable file
View File

0
dotnet-tools.json Normal file → Executable file
View File

0
readme.md Normal file → Executable file
View File

14
src/MicCheck.AppHost/AppHost.cs Executable file
View File

@@ -0,0 +1,14 @@
var builder = DistributedApplication.CreateBuilder(args);
var postgres = builder.AddPostgres("postgres").WithDataVolume("miccheck-pgdata").WithPgAdmin();
var miccheckDb = postgres.AddDatabase("miccheck");
var api = builder.AddProject<Projects.MicCheck_Api>("api").WithReference(miccheckDb).WaitFor(miccheckDb);
builder.AddViteApp("admin", "../admin", "serve")
.WithReference(api)
.WaitFor(api)
.WithExternalHttpEndpoints();
builder.Build().Run();

View File

@@ -0,0 +1,23 @@
<Project Sdk="Aspire.AppHost.Sdk/13.4.0">
<ItemGroup>
<ProjectReference Include="..\api\MicCheck.Api\MicCheck.Api.csproj" />
<ProjectReference Include="..\admin\Admin.esproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Aspire.Hosting.JavaScript" Version="13.4.2" />
<PackageReference Include="Aspire.Hosting.PostgreSQL" Version="13.4.0" />
</ItemGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<UserSecretsId>d10a4485-2ac0-4ba7-bda5-8eb63e417567</UserSecretsId>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,29 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:17244;http://localhost:15050",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21229",
"ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22051"
}
},
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:15050",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19033",
"ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20209"
}
}
}
}

View File

@@ -0,0 +1,16 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"Dashboard": {
"Frontend": {
"AuthMode": "Unsecured"
},
"Otlp": {
"AuthMode": "Unsecured"
}
}
}

View File

@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"Aspire.Hosting.Dcp": "Warning"
}
}
}

View File

@@ -0,0 +1,5 @@
{
"appHost": {
"path": "MicCheck.AppHost.csproj"
}
}

View File

@@ -0,0 +1,127 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.ServiceDiscovery;
using OpenTelemetry;
using OpenTelemetry.Metrics;
using OpenTelemetry.Trace;
namespace Microsoft.Extensions.Hosting;
// Adds common Aspire services: service discovery, resilience, health checks, and OpenTelemetry.
// This project should be referenced by each service project in your solution.
// To learn more about using this project, see https://aka.ms/aspire/service-defaults
public static class Extensions
{
private const string HealthEndpointPath = "/health";
private const string AlivenessEndpointPath = "/alive";
public static TBuilder AddServiceDefaults<TBuilder>(this TBuilder builder) where TBuilder : IHostApplicationBuilder
{
builder.ConfigureOpenTelemetry();
builder.AddDefaultHealthChecks();
builder.Services.AddServiceDiscovery();
builder.Services.ConfigureHttpClientDefaults(http =>
{
// Turn on resilience by default
http.AddStandardResilienceHandler();
// Turn on service discovery by default
http.AddServiceDiscovery();
});
// Uncomment the following to restrict the allowed schemes for service discovery.
// builder.Services.Configure<ServiceDiscoveryOptions>(options =>
// {
// options.AllowedSchemes = ["https"];
// });
return builder;
}
public static TBuilder ConfigureOpenTelemetry<TBuilder>(this TBuilder builder) where TBuilder : IHostApplicationBuilder
{
builder.Logging.AddOpenTelemetry(logging =>
{
logging.IncludeFormattedMessage = true;
logging.IncludeScopes = true;
});
builder.Services.AddOpenTelemetry()
.WithMetrics(metrics =>
{
metrics.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddRuntimeInstrumentation();
})
.WithTracing(tracing =>
{
tracing.AddSource(builder.Environment.ApplicationName)
.AddAspNetCoreInstrumentation(tracing =>
// Exclude health check requests from tracing
tracing.Filter = context =>
!context.Request.Path.StartsWithSegments(HealthEndpointPath)
&& !context.Request.Path.StartsWithSegments(AlivenessEndpointPath)
)
// Uncomment the following line to enable gRPC instrumentation (requires the OpenTelemetry.Instrumentation.GrpcNetClient package)
//.AddGrpcClientInstrumentation()
.AddHttpClientInstrumentation();
});
builder.AddOpenTelemetryExporters();
return builder;
}
private static TBuilder AddOpenTelemetryExporters<TBuilder>(this TBuilder builder) where TBuilder : IHostApplicationBuilder
{
var useOtlpExporter = !string.IsNullOrWhiteSpace(builder.Configuration["OTEL_EXPORTER_OTLP_ENDPOINT"]);
if (useOtlpExporter)
{
builder.Services.AddOpenTelemetry().UseOtlpExporter();
}
// Uncomment the following lines to enable the Azure Monitor exporter (requires the Azure.Monitor.OpenTelemetry.AspNetCore package)
//if (!string.IsNullOrEmpty(builder.Configuration["APPLICATIONINSIGHTS_CONNECTION_STRING"]))
//{
// builder.Services.AddOpenTelemetry()
// .UseAzureMonitor();
//}
return builder;
}
public static TBuilder AddDefaultHealthChecks<TBuilder>(this TBuilder builder) where TBuilder : IHostApplicationBuilder
{
builder.Services.AddHealthChecks()
// Add a default liveness check to ensure app is responsive
.AddCheck("self", () => HealthCheckResult.Healthy(), ["live"]);
return builder;
}
public static WebApplication MapDefaultEndpoints(this WebApplication app)
{
// Adding health checks endpoints to applications in non-development environments has security implications.
// See https://aka.ms/aspire/healthchecks for details before enabling these endpoints in non-development environments.
if (app.Environment.IsDevelopment())
{
// All health checks must pass for app to be considered ready to accept traffic after starting
app.MapHealthChecks(HealthEndpointPath);
// Only health checks tagged with the "live" tag must pass for app to be considered alive
app.MapHealthChecks(AlivenessEndpointPath, new HealthCheckOptions
{
Predicate = r => r.Tags.Contains("live")
});
}
return app;
}
}

View File

@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<IsAspireSharedProject>true</IsAspireSharedProject>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="10.6.0" />
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" Version="10.6.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.15.3" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.15.3" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.15.2" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.15.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.15.1" />
</ItemGroup>
</Project>

0
src/admin/.dockerignore Normal file → Executable file
View File

11
src/admin/Admin.esproj Executable file
View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.VisualStudio.JavaScript.Sdk/1.0.2752196">
<PropertyGroup>
<StartupCommand>npm run serve</StartupCommand>
<JavaScriptTestRoot>.\</JavaScriptTestRoot>
<JavaScriptTestFramework>Jest</JavaScriptTestFramework>
<!-- Allows the build (or compile) script located on package.json to run on Build -->
<ShouldRunBuildScript>false</ShouldRunBuildScript>
<!-- Folder where production build objects will be placed -->
<BuildOutputFolder>$(MSBuildProjectDirectory)\dist</BuildOutputFolder>
</PropertyGroup>
</Project>

0
src/admin/Dockerfile Normal file → Executable file
View File

0
src/admin/babel.config.js Normal file → Executable file
View File

0
src/admin/index.html Normal file → Executable file
View File

0
src/admin/jest.config.js Normal file → Executable file
View File

0
src/admin/nginx.conf Normal file → Executable file
View File

4408
src/admin/package-lock.json generated Normal file → Executable file

File diff suppressed because it is too large Load Diff

3
src/admin/package.json Normal file → Executable file
View File

@@ -14,10 +14,12 @@
"@iconify-json/ri": "^1.2.0", "@iconify-json/ri": "^1.2.0",
"@iconify/vue": "^4.1.0", "@iconify/vue": "^4.1.0",
"@vueuse/core": "^11.0.0", "@vueuse/core": "^11.0.0",
"apexcharts": "^5.15.0",
"axios": "^1.15.0", "axios": "^1.15.0",
"pinia": "^3.0.4", "pinia": "^3.0.4",
"vue": "^3.4.0", "vue": "^3.4.0",
"vue-router": "^4.3.0", "vue-router": "^4.3.0",
"vue3-apexcharts": "^1.11.1",
"vue3-perfect-scrollbar": "^2.0.0", "vue3-perfect-scrollbar": "^2.0.0",
"vuetify": "^3.7.5" "vuetify": "^3.7.5"
}, },
@@ -31,6 +33,7 @@
"@vue/test-utils": "^2.4.6", "@vue/test-utils": "^2.4.6",
"@vue/vue3-jest": "^29.2.6", "@vue/vue3-jest": "^29.2.6",
"babel-jest": "^29.7.0", "babel-jest": "^29.7.0",
"eslint": "^10.4.1",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0", "jest-environment-jsdom": "^29.7.0",
"sass": "^1.77.2", "sass": "^1.77.2",

0
src/admin/src/@core/components/MoreBtn.vue Normal file → Executable file
View File

0
src/admin/src/@core/components/ThemeSwitcher.vue Normal file → Executable file
View File

View File

View File

View File

0
src/admin/src/@core/scss/base/_components.scss Normal file → Executable file
View File

0
src/admin/src/@core/scss/base/_dark.scss Normal file → Executable file
View File

View File

0
src/admin/src/@core/scss/base/_default-layout.scss Normal file → Executable file
View File

0
src/admin/src/@core/scss/base/_index.scss Normal file → Executable file
View File

0
src/admin/src/@core/scss/base/_layouts.scss Normal file → Executable file
View File

0
src/admin/src/@core/scss/base/_misc.scss Normal file → Executable file
View File

0
src/admin/src/@core/scss/base/_mixins.scss Normal file → Executable file
View File

0
src/admin/src/@core/scss/base/_utilities.scss Normal file → Executable file
View File

0
src/admin/src/@core/scss/base/_utils.scss Normal file → Executable file
View File

0
src/admin/src/@core/scss/base/_variables.scss Normal file → Executable file
View File

0
src/admin/src/@core/scss/base/_vertical-nav.scss Normal file → Executable file
View File

View File

0
src/admin/src/@core/scss/base/libs/vuetify/_index.scss Normal file → Executable file
View File

View File

View File

View File

0
src/admin/src/@core/scss/base/placeholders/_index.scss Normal file → Executable file
View File

0
src/admin/src/@core/scss/base/placeholders/_misc.scss Normal file → Executable file
View File

0
src/admin/src/@core/scss/base/placeholders/_nav.scss Normal file → Executable file
View File

View File

View File

0
src/admin/src/@core/scss/template/_mixins.scss Normal file → Executable file
View File

0
src/admin/src/@core/scss/template/_utilities.scss Normal file → Executable file
View File

0
src/admin/src/@core/scss/template/_utils.scss Normal file → Executable file
View File

0
src/admin/src/@core/scss/template/_variables.scss Normal file → Executable file
View File

0
src/admin/src/@core/scss/template/_vertical-nav.scss Normal file → Executable file
View File

0
src/admin/src/@core/scss/template/index.scss Normal file → Executable file
View File

0
src/admin/src/@core/scss/template/libs/apex-chart.scss Normal file → Executable file
View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

Some files were not shown because too many files have changed in this diff Show More