Skip to main content
Welcome. This site supports keyboard navigation and screen readers. Press ? at any time for keyboard shortcuts. Press [ to focus the sidebar, ] to focus the content. High-contrast themes are available via the toolbar.
serard@dev00:~/cv

Composition -- One Class, Twenty-Two DSLs, Three Tiers

Twenty-one parts described twenty-two DSLs in isolation. This part shows what happens when they all land on one class.


The Complete Declaration

// ==================================================================
// OrderServiceV3Ops.cs -- Complete Operational Specification
// 22 DSLs, ~200 attributes, one source of truth
// ==================================================================

// ---- 1. Deployment (Part 5) ----
[DeploymentOrchestrator("order-platform",
    Apps = new[] { "order-api", "order-worker", "order-scheduler" },
    DependsOn = new[] { "postgres-15", "redis-7", "rabbitmq-3" })]

[DeploymentApp("order-api",
    Image = "order-api",
    Port = 8080,
    Replicas = 3,
    ReadinessPath = "/health/ready",
    LivenessPath = "/health/live")]

[DeploymentApp("order-worker",
    Image = "order-worker",
    Replicas = 2)]

[CanaryStrategy(
    InitialWeight = 5,
    StepWeight = 15,
    StepInterval = "5m",
    ErrorRateThreshold = 1.0,
    LatencyP99Threshold = "500ms")]

// ---- 2. Migration (Part 6) ----
[SchemaMigration("047_add_order_metadata",
    Up = "ALTER TABLE orders ADD COLUMN metadata jsonb;",
    Down = "ALTER TABLE orders DROP COLUMN metadata;",
    Timeout = "30s")]

[DataMigration("backfill_order_metadata",
    DependsOn = "047_add_order_metadata",
    BatchSize = 1000,
    EstimatedRows = 5_000_000)]

// ---- 3. Observability (Part 7) ----
[HealthCheck("database",
    Type = HealthCheckType.Dependency,
    Interval = "10s",
    Timeout = "3s",
    FailureThreshold = 3)]

[HealthCheck("redis-cache",
    Type = HealthCheckType.Dependency,
    Interval = "10s",
    Timeout = "2s")]

[HealthCheck("rabbitmq",
    Type = HealthCheckType.Dependency,
    Interval = "15s",
    Timeout = "5s")]

[MetricDefinition("order_created_total",
    Type = MetricType.Counter,
    Description = "Total orders created",
    Labels = new[] { "payment_method", "region" })]

[MetricDefinition("order_processing_duration_seconds",
    Type = MetricType.Histogram,
    Description = "Order processing time",
    Buckets = new[] { 0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0 })]

[AlertRule("order-error-rate",
    Query = "rate(http_requests_total{service='order-api',status=~'5..'}[5m]) > 0.02",
    Severity = AlertSeverity.Critical,
    For = "2m")]

[AlertRule("order-latency-p99",
    Query = "histogram_quantile(0.99, rate(order_processing_duration_seconds_bucket[5m])) > 2.0",
    Severity = AlertSeverity.Warning,
    For = "5m")]

[Dashboard("order-service",
    Panels = new[]
    {
        "order_created_total:rate:1m",
        "order_processing_duration_seconds:p50,p95,p99",
        "http_requests_total:rate:status",
        "health_check_status:all"
    })]

// ---- 4. Configuration + Resilience (Part 8) ----
[EnvironmentTransform("ConnectionStrings:Default",
    Dev = "Host=localhost;Database=orders_dev",
    Staging = "Host=db-staging;Database=orders",
    Production = "Host={{vault:db-prod-host}};Database=orders")]

[SecretReference("PaymentGateway:ApiKey",
    Provider = SecretProvider.Vault,
    Path = "secret/payment/api-key",
    RotationSchedule = "90d")]

[SecretReference("Database:Password",
    Provider = SecretProvider.Vault,
    Path = "secret/db/password",
    RotationSchedule = "30d")]

[CircuitBreaker("payment-gateway",
    FailureThreshold = 5,
    SamplingDuration = "30s",
    BreakDuration = "60s",
    SuccessThresholdWhenHalfOpen = 3)]

[RetryPolicy("payment-gateway",
    MaxRetries = 3,
    InitialDelay = "200ms",
    MaxDelay = "5s",
    BackoffType = BackoffType.ExponentialWithJitter)]

[RollbackPlan("order-api-rollback",
    Strategy = RollbackStrategy.BlueGreen,
    AutoRollbackOnErrorRate = 5.0,
    ManualApprovalThreshold = 2.0,
    HealthCheckTimeout = "60s")]

// ---- 5. Performance (Part 9) ----
[ServiceLevelIndicator("order-api",
    Metric = "http_request_duration_seconds",
    Type = SliType.Latency)]

[ServiceLevelObjective("order-api-latency",
    SliRef = "order-api",
    Target = 99.5,
    Window = "30d",
    Threshold = "500ms")]

[PerformanceBudget("/api/v3/orders", "POST",
    P50 = "100ms", P95 = "300ms", P99 = "500ms")]

[PerformanceBudget("/api/v3/orders/{id}", "GET",
    P50 = "20ms", P95 = "50ms", P99 = "100ms")]

[CachePolicy("order-read",
    Strategy = CacheStrategy.ReadThrough,
    Ttl = "5m",
    MaxSize = "100MB",
    EvictionPolicy = EvictionPolicy.Lfu)]

// ---- 6. Load Testing (Part 10) ----
[LoadProfile("baseline",
    Tier = Tier.InProcess,
    VirtualUsers = 10,
    Duration = "2m",
    RampUp = "30s")]

[LoadProfile("staging-load",
    Tier = Tier.Container,
    VirtualUsers = 500,
    Duration = "15m",
    RampUp = "3m",
    TargetRps = 1000)]

[LoadProfile("production-capacity",
    Tier = Tier.Cloud,
    VirtualUsers = 5000,
    Duration = "30m",
    RampUp = "5m",
    TargetRps = 10000,
    Regions = new[] { "us-east-1", "eu-west-1" })]

// ---- 7. Chaos (Part 11) ----
[ChaosExperiment("payment-timeout",
    Tier = Tier.InProcess,
    FaultKind = FaultKind.Timeout,
    TargetService = "payment-gateway",
    Duration = "30s",
    Hypothesis = "Circuit breaker trips within 10s, orders return 503 with retry-after")]

[ChaosExperiment("database-latency",
    Tier = Tier.Container,
    FaultKind = FaultKind.Latency,
    TargetService = "postgres",
    Duration = "2m",
    InjectedLatency = "2000ms",
    Hypothesis = "Read queries fall back to cache, write queries queue in RabbitMQ")]

[ChaosExperiment("az-failover",
    Tier = Tier.Cloud,
    FaultKind = FaultKind.ProcessKill,
    TargetService = "order-api",
    Duration = "10m",
    BlastRadius = "us-east-1a",
    Hypothesis = "Traffic redistributes to us-east-1b within 30s, no user-facing errors")]

// ---- 8. Security (Part 12) ----
[RbacRule("order:read",
    Roles = new[] { "customer", "support", "admin" })]

[RbacRule("order:write",
    Roles = new[] { "customer", "admin" })]

[RbacRule("order:refund",
    Roles = new[] { "support", "admin" },
    RequiresMfa = true)]

[AuditPolicy(
    AuditEvents = new[] { "order:create", "order:cancel", "order:refund" },
    RetentionDays = 365,
    ImmutableLog = true)]

[SecretRotation("PaymentGateway:ApiKey",
    Schedule = "90d",
    RotationStrategy = RotationStrategy.DualKey,
    AlertBeforeExpiry = "14d")]

[VulnerabilityScan(
    Schedule = "daily",
    SeverityThreshold = VulnSeverity.High,
    FailBuildOnThreshold = true)]

// ---- 9. Testing (Part 13) ----
[TestStrategy("order-service",
    Categories = new[]
    {
        "unit:80%",
        "integration:60%",
        "load:baseline,staging-load",
        "chaos:payment-timeout,database-latency",
        "security:owasp-top-10"
    })]

// ---- 10. Quality (Part 14) ----
[ComplexityThreshold(
    MaxCyclomaticComplexity = 15,
    MaxCognitiveComplexity = 20,
    MaxMethodLines = 50)]

[CoverageTarget(
    LineCoverage = 80,
    BranchCoverage = 70,
    MutationScore = 60)]

// ---- 11. Infrastructure (Part 15) ----
[ContainerSpec("order-api",
    CpuRequest = "250m", CpuLimit = "1000m",
    MemoryRequest = "256Mi", MemoryLimit = "1Gi",
    ReadOnlyRootFilesystem = true)]

[StorageSpec("order-data",
    Type = StorageType.PersistentVolume,
    Size = "100Gi",
    StorageClass = "gp3",
    BackupSchedule = "0 2 * * *")]

[CertSpec("order-api-tls",
    Issuer = "letsencrypt-prod",
    DnsNames = new[] { "orders.api.example.com", "orders.internal.example.com" },
    RenewBefore = "30d")]

[DnsRecord("orders.api.example.com",
    Type = DnsRecordType.CNAME,
    Target = "ingress.example.com",
    Ttl = 300)]

// ---- 12. Networking (Part 16) ----
[IngressRule("orders.api.example.com", "/api/v3/orders",
    backendService: "order-api", backendPort: 8080,
    TlsTermination = TlsTermination.Edge,
    RateLimitRps = 1000)]

[MtlsPolicy(MtlsMode.Strict,
    Mesh = ServiceMesh.Istio)]

[FirewallRule("allow-internal",
    AllowCidrs = new[] { "10.0.0.0/8" },
    Ports = new[] { 8080 },
    Direction = "Inbound")]

[FirewallRule("deny-database-public",
    DenyCidrs = new[] { "0.0.0.0/0" },
    Ports = new[] { 5432 },
    Direction = "Inbound",
    Priority = 1)]

[NetworkPolicy("order-api-network",
    PodSelector = new[] { "app=order-api" },
    AllowFrom = new[] { "namespace:ingress-nginx" },
    AllowTo = new[] { "pod:app=postgres", "pod:app=redis", "pod:app=rabbitmq" },
    DenyAll = true)]

// ---- 13. Data Governance (Part 17) ----
[BackupPolicy("order-database",
    Schedule = "0 */6 * * *",
    RetentionDays = 90,
    CrossRegionReplication = true)]

[RetentionPolicy("orders",
    RetentionPeriod = "7y",
    ArchiveAfter = "1y",
    DeleteAfter = "7y")]

[GdprDataMap("orders",
    PersonalDataFields = new[] { "customer_name", "email",
        "shipping_address", "phone" },
    LegalBasis = LegalBasis.ContractPerformance,
    DataSubjectType = "customer",
    DeletionStrategy = DeletionStrategy.Anonymize)]

[DisasterRecovery(
    Rpo = "1h",
    Rto = "4h",
    Strategy = DrStrategy.ActivePassive,
    FailoverRegion = "eu-west-1")]

// ---- 14. Compliance (Part 18) ----
[ComplianceFramework(Framework.SOC2,
    Controls = new[] { "CC6.1", "CC6.2", "CC6.3", "CC7.1", "CC7.2" },
    AuditFrequency = "annual",
    EvidenceRetention = "5y")]

// ---- 15. Supply Chain (Part 19) ----
[DependencyAudit(
    Schedule = "weekly",
    AllowedLicenses = new[] { "MIT", "Apache-2.0", "BSD-2-Clause",
                               "BSD-3-Clause" },
    ProhibitedLicenses = new[] { "GPL-3.0", "AGPL-3.0" },
    MaxAgeDays = 365)]

[SbomGeneration(
    Format = SbomFormat.CycloneDX,
    IncludeTransitive = true,
    SignOutput = true)]

[LicensePolicy(
    RequireApproval = true,
    ApprovalFile = "licenses/approved.json",
    FailOnUnknown = true)]

// ---- 16. Cost (Part 20) ----
[ResourceBudget("order-platform",
    MonthlyCpuHours = 2160,
    MonthlyMemoryGbHours = 4320,
    MonthlyStorageGb = 500,
    MonthlyBudgetUsd = 3500,
    AlertAtPercent = 80)]

[RightSizing(
    AnalysisWindow = "14d",
    CpuUtilizationTarget = 65,
    MemoryUtilizationTarget = 70,
    Schedule = "weekly")]

// ---- 17. Capacity (Part 20) ----
[AutoscaleRule("order-api",
    MinReplicas = 3,
    MaxReplicas = 20,
    CpuThreshold = 70,
    MemoryThreshold = 80,
    ScaleUpCooldown = "60s",
    ScaleDownCooldown = "300s",
    CustomMetric = "http_requests_per_second",
    CustomMetricThreshold = 500)]

[ThrottlePolicy("order-api",
    RequestsPerSecond = 1000,
    BurstSize = 1500,
    ThrottleResponse = 429,
    PerClient = true,
    ClientIdentifier = ClientIdentifier.ApiKey)]

// ---- 18. Incident (Part 21) ----
[OnCallRotation("order-backend",
    new[] { "alice@co.com", "bob@co.com", "carol@co.com", "david@co.com" },
    RotationPeriod = "7d",
    EscalationTimeout = "10m")]

[EscalationPolicy("order-critical",
    new[] { "oncall", "team-lead", "eng-manager" },
    TimeoutPerTierMinutes = new[] { 10, 20, 45 })]

[IncidentSeverity(SeverityLevel.P1,
    "Complete order processing outage",
    ResponseTime = "5m",
    NotifyChannels = new[] { "pagerduty", "slack:#p1-incidents", "phone:eng-manager" },
    RequiresIncidentCommander = true,
    RequiresStatusPageUpdate = true)]

[StatusPage("order-system",
    new[] { "Order API", "Order Processing", "Payment Integration" },
    Provider = StatusPageProvider.Statuspage,
    AutoUpdateFromHealthChecks = true)]

[PostMortemTemplate(
    new[] { "Summary", "Impact", "Timeline", "Root Cause",
            "Action Items", "Lessons Learned" },
    DueWithin = "3bd",
    RequiresActionItems = true)]

// ---- 19. ApiContract (Part 22) ----
[ApiVersionPolicy("3", "2",
    DeprecationNotice = "API v2 deprecated. Migrate by 2026-09-01.",
    SunsetDate = "2026-09-01")]

[BreakingChangeGuard("schemas/order-api-v3-baseline.json",
    ProhibitedChanges = new[]
    {
        SchemaChange.RemoveField,
        SchemaChange.RenameField,
        SchemaChange.ChangeFieldType,
        SchemaChange.RemoveEndpoint
    })]

[ConsumerContract("mobile-ios", "contracts/mobile-ios-v3.pact.json")]
[ConsumerContract("mobile-android", "contracts/mobile-android-v3.pact.json")]

// ---- 20. EnvironmentParity (Part 22) ----
[ParityRule("schema-parity",
    new[] { "dev", "staging", "production" },
    Dimension = ParityDimension.Schema)]

[FeatureFlag("new-checkout-flow",
    typeof(NewCheckoutFeature),
    EnabledEnvironments = new[] { "dev", "staging" },
    SunsetDate = "2026-07-01")]

[FeatureFlag("order-batch-processing",
    typeof(BatchProcessingFeature),
    RolloutPercentage = 10,
    SunsetDate = "2026-09-01")]

// ---- 21. Lifecycle (Part 22) ----
[SunsetSchedule("OrderController.V1",
    deprecationDate: "2025-06-01",
    sunsetDate: "2026-06-01",
    Replacement = "OrderController.V2",
    MigrationGuide = "docs/migration-v1-to-v2.md")]

[SupportWindow("v2", "2027-06-01", Level = SupportLevel.Active)]
[SupportWindow("v3", "2028-06-01", Level = SupportLevel.Active)]

[TechDebtItem("Upgrade Newtonsoft.Json 9.0.1 -> 13.x",
    EstimatedEffort = "2d",
    Deadline = "2026-05-01",
    Priority = TechDebtPriority.Critical,
    Category = TechDebtCategory.SecurityVulnerability)]

[TechDebtItem("Replace raw SQL in OrderRepository",
    EstimatedEffort = "1w",
    Priority = TechDebtPriority.Medium,
    Category = TechDebtCategory.CodeQuality)]

public partial class OrderServiceV3Ops { }

That is approximately 200 attributes on one class. Every operational concern for the order service -- from deployment strategy to post-mortem template -- declared in one file, compiled by one compiler, validated by one set of analyzers.


InProcess Tier (~15 .g.cs files)

These files are emitted by the source generator and compiled into the application binary. They require zero external infrastructure -- no Docker, no Kubernetes, no cloud provider.

# File Source DSL Purpose
1 HealthChecks.g.cs Observability IHealthCheck implementations for database, Redis, RabbitMQ
2 MetricDefinitions.g.cs Observability Prometheus metric registrations with labels and buckets
3 CircuitBreakerDecorator.g.cs Resilience DI decorator wrapping IPaymentGateway with Polly circuit breaker
4 RetryPolicyDecorator.g.cs Resilience DI decorator wrapping IPaymentGateway with retry + jitter
5 CacheDecorator.g.cs Performance DI decorator wrapping IOrderRepository.GetById with read-through cache
6 ChaosDecorator.g.cs Chaos DI decorator injecting timeouts into IPaymentGateway (test builds only)
7 RbacPolicies.g.cs Security Authorization policy registrations for order:read, order:write, order:refund
8 AuditLogger.g.cs Security Audit event logging for create, cancel, refund operations
9 FeatureFlags.g.cs EnvironmentParity Strongly-typed flag accessors with sunset dates
10 DeprecationMiddleware.g.cs ApiContract Response headers for deprecated API versions
11 ThrottleMiddleware.g.cs Capacity Rate limiting middleware (1000 rps, per-client, API key)
12 SunsetObsolete.g.cs Lifecycle [Obsolete] attributes on sunset components
13 DependencyRegistration.g.cs All Single AddOrderServiceV3Ops() extension method wiring everything
14 PactVerifier.g.cs ApiContract Consumer contract verification tests
15 LoadTestBaseline.g.cs LoadTesting InProcess load test configuration for baseline profile

The developer runs dotnet build, and every decorator, policy, health check, metric, and middleware is generated and registered. The AddOrderServiceV3Ops() method is the single entry point:

// Auto-generated: DependencyRegistration.g.cs
public static class OrderServiceV3OpsRegistration
{
    public static IServiceCollection AddOrderServiceV3Ops(
        this IServiceCollection services)
    {
        // Observability
        services.AddHealthChecks()
            .AddCheck<DatabaseHealthCheck>("database")
            .AddCheck<RedisCacheHealthCheck>("redis-cache")
            .AddCheck<RabbitmqHealthCheck>("rabbitmq");

        // Resilience (decorators chain: retry -> circuit breaker -> actual)
        services.AddSingleton<IPaymentGateway>(sp =>
            new RetryPolicyDecorator(
                new CircuitBreakerDecorator(
                    sp.GetRequiredService<PaymentGateway>())));

        // Performance
        services.Decorate<IOrderRepository, CacheDecorator>();

        // Security
        services.AddAuthorization(options =>
        {
            options.AddPolicy("order:read", p => p.RequireRole("customer", "support", "admin"));
            options.AddPolicy("order:write", p => p.RequireRole("customer", "admin"));
            options.AddPolicy("order:refund", p => p.RequireRole("support", "admin").RequireMfa());
        });

        // Capacity
        services.AddRateLimiting(options =>
        {
            options.AddPolicy("order-api", new PerClientRateLimitPolicy(1000, 1500));
        });

        return services;
    }
}

Aggregate three-tier fan-out

22 sub-DSLs project into ~10 InProcess C# files, ~20 Container-tier files, and ~25 Cloud-tier files. The diagram below summarizes the fan-out by tier; the per-tier tables that follow enumerate every emitted file with its source DSL.

Diagram
The aggregate fan-out: about 200 attributes on a single class project into ten InProcess C# files, twenty container-tier YAML and JSON files, and twenty-five cloud-tier manifests, CRDs and Terraform resources.

Container Tier (~20 YAML/JSON files)

These files are emitted to the ops/container/ directory. They configure Docker Compose, Prometheus, Grafana, k6, Toxiproxy, OPA Conftest, Trivy, and the Linux-level hardening profiles for local and CI environments.

# File Source DSL Purpose
1 docker-compose.ops.yaml Deployment Service definitions, dependencies, health checks
2 docker-compose.override.dev.yaml EnvironmentParity Stub services for development
3 prometheus.yaml Observability Scrape configs, alert rules
4 grafana-dashboard.json Observability Pre-built dashboard with all panels
5 alertmanager.yaml Observability + Incident Alert routing to notification channels
6 k6-staging-load.js LoadTesting 500 VU, 15 min, 1000 rps load test script
7 toxiproxy-config.json Chaos Database latency injection (2000ms)
8 migration-runner.yaml Migration Init container running schema + data migrations
9 wiremock-mappings.json EnvironmentParity Payment gateway stub responses
10 network-policies.yaml Networking Docker Compose network isolation
11 .env.staging.g Configuration Non-secret env values from [ConfigTransform]
12 docker-compose.config.yaml Configuration Vault-secret mounts + env-file binding
13 conftest-policies/soc2.rego Compliance Local OPA rules from [ComplianceControl]
14 trivy-compliance.yaml Compliance Per-framework Trivy scan profile
15 docker-compose.canary.yaml Resilience Traefik weighted routing canary
16 prometheus-canary-rules.yaml Resilience Local SLI rules mirroring AnalysisTemplate
17 docker-compose.scale.yaml Capacity Replicas + resource limits/reservations
18 docker-compose.security.yaml Security Hardening overlay (cap_drop, read_only, no-new-privileges)
19 seccomp-profile.json Security Syscall allow-list per [SecurityPolicy]
20 apparmor-profile Security AppArmor profile mounted by the overlay

Cloud Tier (~25 files)

These files target Kubernetes, Terraform, and cloud-native tools. They are generated to ops/cloud/ and applied by the deployment pipeline.

# File Source DSL Purpose
1 terraform/main.tf Infrastructure Container specs, storage, DNS, certs
2 terraform/variables.tf Infrastructure + Cost Resource definitions with budget constraints
3 k8s/deployment.yaml Deployment Kubernetes Deployment with resource limits, probes
4 k8s/hpa.yaml Capacity HorizontalPodAutoscaler (3-20 replicas, CPU/custom metric)
5 k8s/network-policy.yaml Networking Kubernetes NetworkPolicy (deny-all + allow-list)
6 k8s/ingress.yaml Networking Ingress with TLS, rate limiting
7 k8s/peerauthentication.yaml Networking Istio mTLS strict mode
8 k8s/cert-manager.yaml Infrastructure Certificate with auto-renewal
9 litmus/payment-timeout.yaml Chaos LitmusChaos experiment CRD
10 litmus/az-failover.yaml Chaos AZ failure injection experiment
11 k6/production-capacity.js LoadTesting 5000 VU, multi-region, 10000 rps
12 monitoring/prometheus-rules.yaml Observability Helm-wrapped alert rules
13 monitoring/grafana-configmap.yaml Observability Dashboard as ConfigMap
14 pagerduty-config.json Incident Escalation policy, on-call schedule
15 statuspage-components.json Incident Status page component definitions
16 k8s/configmap.yaml Configuration Non-secret env values from [ConfigTransform]
17 k8s/external-secret.yaml Configuration Key Vault refs from [Secret]
18 gatekeeper/constraint-template.yaml Compliance OPA template from [ComplianceControl]
19 gatekeeper/constraint.yaml Compliance Residency constraint from [DataResidency]
20 monitoring/servicemonitor.yaml Observability Prometheus Operator scrape target (CRD)
21 monitoring/prometheusrule.yaml Observability Prometheus Operator alert rules (CRD)
22 k8s/analysistemplate.yaml Resilience Argo AnalysisTemplate for canary metrics
23 k8s/vpa.yaml Capacity VerticalPodAutoscaler (CRD)
24 k8s/keda-scaledobject.yaml Capacity KEDA ScaledObject (CRD)
25 k8s/serviceaccount.yaml + k8s/role.yaml + k8s/rolebinding.yaml Security RBAC trio per [SecurityPolicy]

The Cross-DSL Analyzer Report

The analyzers do not run in isolation. Every attribute is validated against every other attribute on the same class. This is the cross-DSL validation report:

============================================================
  Cross-DSL Validation Report: OrderServiceV3Ops
  22 DSLs | 197 attributes | 42 generated files
============================================================

DEPLOYMENT
  [PASS] DEP001: All DeploymentApp images have health check paths
  [PASS] DEP002: Dependencies (postgres, redis, rabbitmq) have
         corresponding HealthCheck attributes

MIGRATION
  [PASS] MIG001: DataMigration depends on existing SchemaMigration
  [PASS] MIG002: Schema migration has rollback (Down clause)

OBSERVABILITY
  [PASS] OBS001: Every DeploymentApp has at least one HealthCheck
  [PASS] OBS002: AlertRule references existing MetricDefinition
  [PASS] OBS003: Dashboard panels reference existing metrics

RESILIENCE
  [PASS] RES001: CircuitBreaker target "payment-gateway" has
         matching ChaosExperiment
  [PASS] RES002: RollbackPlan references existing DeploymentApp
  [PASS] RES003: RetryPolicy target matches CircuitBreaker target

PERFORMANCE
  [PASS] PRF001: SLO threshold (500ms) >= worst PerformanceBudget P99
  [PASS] PRF002: CachePolicy target has corresponding MetricDefinition

LOAD TESTING
  [PASS] LDT001: Load profiles cover all three tiers
  [PASS] LDT002: Cloud tier load profile has regions matching
         DeploymentApp regions

CHAOS
  [PASS] CHS001: Every CircuitBreaker has a ChaosExperiment
  [PASS] CHS002: Chaos experiments cover all three tiers
  [PASS] CHS003: Cloud chaos blast radius matches deployment regions

SECURITY
  [PASS] SEC001: RBAC rules cover all API endpoints
  [PASS] SEC002: Audit policy covers all write operations
  [PASS] SEC003: Secret references have rotation schedules
  [PASS] SEC004: Vulnerability scan threshold matches compliance framework

INFRASTRUCTURE
  [PASS] INF001: ContainerSpec matches autoscale limits
  [PASS] INF002: StorageSpec has backup schedule matching BackupPolicy
  [PASS] INF003: CertSpec DNS names match IngressRule hosts

NETWORKING
  [PASS] NET001: NetworkPolicy allows traffic between declared dependencies
  [PASS] NET002: Firewall denies database port from public CIDR
  [PASS] NET003: mTLS is strict (not permissive) in production

DATA GOVERNANCE
  [PASS] DGV001: BackupPolicy RPO consistent with DisasterRecovery RPO
  [PASS] DGV002: GDPR data map covers all PII fields in schema
  [PASS] DGV003: Retention policy compliant with compliance framework

COMPLIANCE
  [PASS] CMP001: SOC2 controls have matching security attributes
  [PASS] CMP002: Audit retention (365d) meets evidence retention (5y)
  [WARN] CMP003: Audit retention (365d) is less than evidence
         retention (5y). Consider increasing audit retention.

SUPPLY CHAIN
  [PASS] SUP001: SBOM includes transitive dependencies
  [PASS] SUP002: License policy has approval file
  [PASS] SUP003: Dependency audit schedule is weekly or more frequent

COST
  [PASS] CST001: ResourceBudget covers all ContainerSpec resources
  [PASS] CST002: Right-sizing analysis window >= 7 days

CAPACITY
  [PASS] CAP001: AutoscaleRule min replicas >= DeploymentApp replicas
  [PASS] CAP002: ThrottlePolicy rate matches IngressRule rate limit
  [PASS] CAP003: Max replicas * ContainerSpec CPU <= ResourceBudget CPU

INCIDENT
  [PASS] INC001: P1 severity has matching escalation policy
  [PASS] INC002: All DeploymentApps have OnCallRotation
  [PASS] INC003: P1 severity has response time target
  [PASS] INC004: Escalation tiers match timeout array length

API CONTRACT
  [PASS] API001: No endpoints removed without deprecation
  [PASS] API002: No breaking changes detected vs. baseline
  [PASS] API003: Consumer contracts have existing Pact files

ENVIRONMENT PARITY
  [PASS] ENV001: All config keys present in all environments
  [PASS] ENV002: Feature flags within sunset dates
  [PASS] ENV003: No stubs in production environment

LIFECYCLE
  [PASS] LFC001: No sunset components still actively referenced
  [WARN] LFC003: TechDebtItem "Upgrade Newtonsoft.Json" deadline
         2026-05-01 is 25 days away. Priority: Critical.
  [PASS] LFC004: Sunset with replacement has migration guide

============================================================
  RESULT: 46 PASS | 2 WARN | 0 ERROR
  Build: PASS
============================================================

Forty-six cross-DSL validations. Every reference checked: the chaos experiment targets the circuit breaker target, the autoscale max replicas times CPU limit stays within the cost budget, the backup RPO matches the disaster recovery RPO, the certificate DNS names match the ingress hosts. These are not unit tests that someone wrote. They are structural validations derived from the attributes themselves.


The dotnet ops report Output

A CLI command that reads the compiled attributes and produces a human-readable operational posture summary:

$ dotnet ops report OrderServiceV3Ops

╔══════════════════════════════════════════════════════════════╗
║  Operational Posture: OrderServiceV3Ops                      ║
╠══════════════════════════════════════════════════════════════╣
║                                                              ║
║  Deployment     3 apps, canary (5%→100%), blue-green rollback║
║  Migration      1 schema + 1 data migration, rollback ready  ║
║  Observability  3 health checks, 2 metrics, 2 alerts, 1 dash║
║  Resilience     Circuit breaker + retry on payment gateway   ║
║  Performance    SLO 99.5% latency <500ms, 2 endpoint budgets ║
║  Load Testing   3-tier: 10 VU / 500 VU / 5000 VU            ║
║  Chaos          3-tier: timeout / latency / AZ failover      ║
║  Security       3 RBAC rules, audit on writes, MFA on refund ║
║  Testing        Unit 80%, integration 60%, chaos, OWASP      ║
║  Quality        Cyclomatic <15, branch coverage 70%          ║
║  Infrastructure 1 container, 100Gi storage, TLS cert, DNS    ║
║  Networking     Ingress + mTLS strict + firewall + net policy║
║  Data Gov       6h backup, 7y retention, GDPR anonymize, DR  ║
║  Compliance     SOC2 (CC6.1-CC7.2), annual audit             ║
║  Supply Chain   Weekly audit, CycloneDX SBOM, license gate   ║
║  Cost           $3500/mo budget, 80% alert, weekly rightsizing║
║  Capacity       3-20 replicas, HPA on CPU+custom, 1000 rps   ║
║  Incident       4-person rotation, 3-tier escalation, P1 5m  ║
║  API Contract   v3 current, v2 sunset 2026-09-01, 2 Pact     ║
║  Env Parity     Schema parity enforced, 2 flags, 1 stub      ║
║  Lifecycle      V1 sunset 2026-06-01, 2 tech debt items      ║
║                                                              ║
║  Generated: 15 InProcess + 10 Container + 15 Cloud = 40 files║
║  Analyzers: 46 pass, 2 warn, 0 error                        ║
║                                                              ║
╚══════════════════════════════════════════════════════════════╝

One class. One screen. The complete operational posture of a production service. Every line is backed by compiled attributes. Every attribute is backed by generated artifacts. Every generated artifact is backed by cross-DSL validation.


What This Means

The OrderServiceV3Ops class is not a document. It is not a wiki page. It is not a spreadsheet. It is not a Confluence space with 47 pages that were last updated at different times by different people with different levels of accuracy.

It is a single file that the compiler understands.

When a new engineer joins the team, they do not read a wiki. They read the ops class. When they add an endpoint, the analyzers tell them what else needs to change: a performance budget, an RBAC rule, a consumer contract update. When they change the deployment topology, the analyzers validate that the networking policies, autoscale rules, and cost budgets are consistent.

The twenty-two DSLs are not twenty-two frameworks to learn. They are twenty-two sets of attributes with IntelliSense, documentation, and analyzer diagnostics. The composition is natural because C# classes naturally accumulate attributes. The validation is automatic because source generators naturally read all attributes on a class.

The next two parts show how these Ops DSLs integrate with the domain-side DSLs (Part 24) and how they compare to existing tools (Part 25). The final part (Part 26) draws the conclusion.

⬇ Download