Skip to content

Spec-driven change from a Jira issue - #21

Closed
dev-agentic-platform[bot] wants to merge 5 commits into
masterfrom
agent/63575a79-d1d6-4d8b-8a46-0993833b33cd/implement
Closed

dev-agentic-platform[bot] wants to merge 5 commits into
masterfrom
agent/63575a79-d1d6-4d8b-8a46-0993833b33cd/implement

Conversation

@dev-agentic-platform

Copy link
Copy Markdown

Agents specified, planned, built and reviewed this change from a Jira issue; the specification and the change were approved at gates before this pull request was opened. The specification, plan and tasks are under specs/. Review it as you would any change: agents can be wrong.

KAN-7: Add Mature Cheese, a new product with its own maturing rule

Summary

This adds a new product kind, Mature Cheese, with its own maturing rule. An item named "Mature Cheese" or "MatureCheese" is now recognised as that kind. Each day it gains Quality: +1 while SellIn is above 0, and +2 once SellIn is 0 or below. Quality is capped at 50, and SellIn drops by 1 a day. Other items keep their existing rules, and the item name is not changed.

Nothing has been built or tested. The engineers had no way to run dotnet restore, dotnet build or dotnet test. Please run these from the repo root before merging.

Requirements met

  • FR-001: ItemKind.MatureCheese is added next to the existing kinds.
  • FR-002: ItemKind.FromName maps "Mature Cheese" and "MatureCheese" to MatureCheese.
  • FR-003: ItemMaturingPolicy has a separate MatureMatureCheese rule. It gives +1 Quality per day, and +1 more once the new SellIn is below 0. Quality never decreases.
  • FR-004: SellIn goes down by 1 through SellIn.NextDay().
  • FR-005: The existing Quality.Increase() already clamps Quality to 0..50, so no extra cap was added. Mature Cheese is not treated like Sulfuras.
  • FR-006: The name is not touched. The service tests check this.
  • FR-007: The existing FromName arms, Mature arms and maturing methods are unchanged.

What changed

Production code

  • src/Core/ProposedCode/Domain/ItemKind.cs
    • Added public sealed record MatureCheese : ItemKind;.
    • Added the FromName arms "Mature Cheese" and "MatureCheese". They sit before the _ => new Standard() default, so these names no longer fall through to Standard.
  • src/Core/ProposedCode/Domain/ItemMaturingPolicy.cs
    • Added the Mature arm ItemKind.MatureCheese => this.MatureMatureCheese(state).
    • Added MatureMatureCheese. It raises Quality by 1, moves SellIn on by one day, and raises Quality once more if the new SellIn is expired (SellIn.IsExpired means below 0).
    • Its body matches MatureAgedBrie today. It is a separate method so the cheese rule can change without touching Aged Brie.

Tests

  • tests/Core.Tests/ProposedCode/Domain/ItemKindTests.cs
    • Added the "Mature Cheese" and "MatureCheese" rows to FromName_MapsNamesToExpectedKinds. Both expect ItemKind.MatureCheese.
  • tests/Core.Tests/ProposedCode/Domain/ItemMaturingPolicyTests.cs
    • Added the theory Mature_WhenKindIsMatureCheese_FollowsExpectedRules with nine rows. They cover SellIn above 0, SellIn of 1, 0 and below 0, and Quality of 0, 49 and 50.
    • Each row also asserts that SellIn equals sellIn - 1 and that Quality does not go down.
  • tests/Core.Tests/ProposedCode/ItemMaturationServiceTests.cs
    • Added both names to Mature_UsesExpectedRulesForResolvedItemKinds (Quality 10, SellIn 5 gives Quality 11, SellIn 4).
    • Added Mature_WhenItemIsMatureCheese_KeepsInputName, which checks the name is kept.
  • All existing rows and tests are unchanged.

How to check

  1. From the repo root, run dotnet restore, dotnet build and dotnet test.
  2. Confirm the new Mature Cheese tests pass.
  3. Confirm the existing tests for the other kinds pass without changes (SC-003).
  4. As a spot check (SC-001), Mature Cheese with Quality 10 and SellIn 5 should become Quality 11. A Standard item with the same values becomes Quality 9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant