Round #845

11 May 2026, 09:45· csharp· Meta-Llama-3.3-70B-Instruct· r15-firing-v3
Complexity
band 0
ZP / UO / OBS
1 / 5 / 3
Journey weight
538
Lightshift ΔL
+0.00

Prompt

Create an ApiController class with a single GET ActionResult that returns a product or NotFound when no product matches the route id.

Zero-point index (what the engine surfaced)

ZPI-ZPI-0002 | 2026-05-11T09:45:18Z Create an ApiController class with a single GET ActionResult that returns a product or NotFound when no product matches the route id. ZERO POINT — 1 entries (structural invariants) ● hsl(113.08, 100%, 21%) ControllerBase [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 — 3 entries (explicit in request) ◉ hsl(7.18, 100%, 50%) class [feature] ◉ hsl(37.95, 100%, 15%) when [feature] ◉ hsl(98.46, 100%, 50%) with [feature] COMPLEXITY │ 9 entries │ spread: 91° │ band: LOW

Baseline response (no ZPI)

```csharp using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; namespace ProductApi.Controllers { [ApiController] [Route("api/[controller]")] public class ProductsController : ControllerBase { private readonly List<Product> products = new List<Product> { new Product { Id = 1, Name = "Product 1" }, new Product { Id = 2, Name = "Product 2" }, new Product { Id = 3, Name = "Product 3" }, }; [HttpGet("{id}")] public ActionResult<Product> GetProduct(int id) { var product = products.Find(p => p.Id == id); if (product == null) { return NotFound(); } return product; } } public class Product { public int Id { get; set; } public string Name { get; set; } } } ``` In this code: - We define a `ProductsController` class that inherits from `ControllerBase`. - The `[ApiController]` attribute enables API-specific features, such as automatic model validation. - The `[Route("api/[controller]")]` attribute specifies the base route for the controller. - We define a `GetProduct` action method that handles HTTP GET requests. - The `{id}` in the route template is a route parameter that is passed to the `GetProduct` method. - Inside the `GetProduct` method, we find the product with the matching `id` in the `products` list. - If no product is found, we return a `NotFound` result. - If a product is found, we return the product as the result. You can test this API by sending a GET request to `https://localhost:5001/api/Products/1`, replacing `https://localhost:5001` with your actual API URL. If the product with `id` 1 exists, you should receive the product details in the response. If not, you should receive a 404 Not Found response.

Enhanced response (with ZPI)

```csharp using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using System; namespace ProductApi.Controllers { [ApiController] [Route("api/[controller]")] public class ProductsController : ControllerBase { private readonly ILogger<ProductsController> _logger; private readonly IProductService _productService; public ProductsController(ILogger<ProductsController> logger, IProductService productService) { _logger = logger; _productService = productService; } [HttpGet("{id}")] public ActionResult<Product> GetProduct(int id) { try { var product = _productService.GetProduct(id); if (product == null) { return NotFound(); } return product; } catch (Exception ex) { _logger.LogError(ex, "Error getting product"); return StatusCode(500, "Internal Server Error"); } } } public interface IProductService { Product GetProduct(int id); } public class ProductService : IProductService { private readonly List<Product> _products = new List<Product> { new Product { Id = 1, Name = "Product 1" }, new Product { Id = 2, Name = "Product 2" }, }; public Product GetProduct(int id) { return _products.FirstOrDefault(p => p.Id == id); } } public class Product { public int Id { get; set; } public string Name { get; set; } } } ``` In the Startup.cs file, add the following code to register the services: ```csharp public void ConfigureServices(IServiceCollection services) { services.AddScoped<IProductService, ProductService>(); services.AddControllers(); } public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); } ``` This implementation uses the ControllerBase class and ILogger injection to create an ApiController with a single GET ActionResult. The ProductService class is registered as a scoped service and used to retrieve products. If no product matches the route id, a NotFound result is returned. If an error occurs, a 500 Internal Server Error is returned.

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
Better
V4qwen2.5-coder-3b-instruct
Better
V5openrouter/qwen/qwen3-235b-a22b-2507
Better
V7qwen2.5-coder-7b-instruct
Better
V8openai/gpt-4.1
Better
V9anthropic/claude-opus-4-7
Better
V12openai/gpt-4o
Better

Comments

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.

← back to all rounds