Round #863
11 May 2026, 09:50· csharp· Meta-Llama-3.3-70B-Instruct· r15-firing-v3
- Complexity
- band 0
- ZP / UO / OBS
- 2 / 5 / 0
- Journey weight
- 444
- Lightshift ΔL
- +0.00
Prompt
Use Microsoft.FeatureManagement feature flags to gate a new checkout flow. Show the IFeatureManager check at the controller level and the flag definition in configuration.
Zero-point index (what the engine surfaced)
ZPI-ZPI-0020 | 2026-05-11T09:50:13Z
Use Microsoft.FeatureManagement feature flags to gate a new checkout flow. Show the IFeatureManager check at the controller level and the flag definition in configuration.
ZERO POINT — 2 entries (structural invariants)
● hsl(352.89, 100%, 15%) IFeatureManager [contract]
● hsl(221.72, 100%, 15%) IFeatureFilter [contract]
UNOBSERVED — 5 entries (implied truths)
○ hsl(27.69, 100%, 50%) async [feature]
○ hsl(9.23, 100%, 50%) interface [feature]
○ hsl(77.54, 100%, 42%) Routing middleware [function]
○ hsl(83.08, 100%, 42%) ILogger of T injection [function]
○ hsl(31.38, 100%, 42%) Scoped registration [function]
OBSERVED — 0 entries (explicit in request)
COMPLEXITY │ 7 entries │ spread: 74° │ band: LOW
Baseline response (no ZPI)
**Feature Flag Configuration and Implementation**
To gate a new checkout flow using Microsoft.FeatureManagement feature flags, you'll need to define the flag in your application's configuration and then use the `IFeatureManager` interface to check the flag's status in your controller.
### Configuration
In your `appsettings.json` file, add the following configuration to define the feature flag:
```json
{
"FeatureManagement": {
"NewCheckoutFlow": true
}
}
```
Alternatively, you can also define the feature flag in the Azure App Configuration service or other configuration providers.
### Controller Implementation
In your controller, inject the `IFeatureManager` interface and use it to check the status of the `NewCheckoutFlow` feature flag:
```csharp
using Microsoft.AspNetCore.Mvc;
using Microsoft.FeatureManagement;
[ApiController]
[Route("api/[controller]")]
public class CheckoutController : ControllerBase
{
private readonly IFeatureManager _featureManager;
public CheckoutController(IFeatureManager featureManager)
{
_featureManager = featureManager;
}
[HttpPost]
public async Task<IActionResult> Checkout()
{
if (await _featureManager.IsEnabledAsync("NewCheckoutFlow"))
{
// New checkout flow is enabled, use the new implementation
return await NewCheckoutFlow();
}
else
{
// New checkout flow is disabled, use the old implementation
return await OldCheckoutFlow();
}
}
private async Task<IActionResult> NewCheckoutFlow()
{
// Implement the new checkout flow logic here
return Ok("New checkout flow completed successfully");
}
private async Task<IActionResult> OldCheckoutFlow()
{
// Implement the old checkout flow logic here
return Ok("Old checkout flow completed successfully");
}
}
```
In this example, the `CheckoutController` checks the status of the `NewCheckoutFlow` feature flag using the `IFeatureManager` interface. If the flag is enabled, it uses the new checkout flow implementation; otherwise, it falls back to the old implementation.
### Startup Configuration
Make sure to add the Microsoft.FeatureManagement package to your project and configure it in the `Startup.cs` file:
```csharp
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.FeatureManagement;
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
services.AddFeatureManagement();
services.AddControllers();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
```
With this configuration and implementation, you can easily toggle the `NewCheckoutFlow` feature flag in your application's configuration to switch between the new and old checkout flow implementations.
Enhanced response (with ZPI)
To gate a new checkout flow using Microsoft.FeatureManagement feature flags, you can use the `IFeatureManager` interface to check the status of the feature flag at the controller level.
First, install the `Microsoft.FeatureManagement` NuGet package in your project. Then, define the feature flag in the `appsettings.json` file:
```json
{
"FeatureManagement": {
"NewCheckoutFlow": true
}
}
```
Next, inject the `IFeatureManager` interface into your controller and use it to check the status of the feature flag:
```csharp
using Microsoft.AspNetCore.Mvc;
using Microsoft.FeatureManagement;
[ApiController]
[Route("api/[controller]")]
public class CheckoutController : ControllerBase
{
private readonly IFeatureManager _featureManager;
public CheckoutController(IFeatureManager featureManager)
{
_featureManager = featureManager;
}
[HttpPost]
public async Task<IActionResult> Checkout()
{
if (await _featureManager.IsEnabledAsync("NewCheckoutFlow"))
{
// New checkout flow is enabled, use it
return Ok("New checkout flow");
}
else
{
// New checkout flow is disabled, use the old flow
return Ok("Old checkout flow");
}
}
}
```
In the `Startup.cs` file, add the `Microsoft.FeatureManagement` services to the DI container and configure the feature flags:
```csharp
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.FeatureManagement;
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
services.AddFeatureManagement();
services.AddControllers();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
```
This implementation uses the `IFeatureManager` interface to check the status of the `NewCheckoutFlow` feature flag at the controller level. If the feature flag is enabled, the new checkout flow is used; otherwise, the old flow is used. The feature flag is defined in the `appsettings.json` file and can be easily toggled on or off without requiring code changes.
This example requires more text to fully explain the implementation and provide a complete code example.
Grader chain
Each grader reads the same baseline + enhanced pair and casts an independent verdict. Disagreement is the framework's own signal — not noise to be averaged away.
V1samba/Meta-Llama-3.3-70B-Instruct
BetterV4qwen2.5-coder-3b-instruct
BetterV5openrouter/qwen/qwen3-235b-a22b-2507
SameV7qwen2.5-coder-7b-instruct
SameV8openai/gpt-4.1
SameV9anthropic/claude-opus-4-7
WorseV12openai/gpt-4o
SameComments
Our grader said what it said. What do you say? Comment as a guest below.
No comments yet. Be the first to say what you make of this round.