Skip to content

Spec-driven change from a Jira issue - #20

Closed
dev-agentic-platform[bot] wants to merge 9 commits into
masterfrom
agent/d2e8fd92-e5ff-4d3a-8021-766b67ee6ec7/implement
Closed

dev-agentic-platform[bot] wants to merge 9 commits into
masterfrom
agent/d2e8fd92-e5ff-4d3a-8021-766b67ee6ec7/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-5: Add Cellar-Aged Mead as a maturing product

Summary

This adds "Cellar-Aged Mead" as its own item kind in the ProposedCode maturation path.

  • Quality rises by 1 per daily update while sell-in is above 0, and by 2 once sell-in is 0 or lower.
  • Quality never exceeds 50.
  • Sell-in falls by 1 every day.
  • The product is recognised by its exact name, "Cellar-Aged Mead". The match is case-sensitive, so "cellar-aged mead", "Cellar-Aged Mead Reserve" and "Cellar-Aged Mead " (trailing space) are treated as normal items.
  • The rules for normal items, Aged Brie, Backstage passes, Conjured and Sulfuras are untouched.

Not built or run. No one could run dotnet build or dotnet test while writing this, and the tests were written on separate branches. Run the full suite before merging.

Requirements met

The FR numbers are from the run's spec.

Requirement Where
FR-001: recognised by explicit name, no substring match ItemKind.FromName
FR-002: +1 while sell-in is above 0 MatureCellarAgedMead
FR-003, FR-006: +2 once sell-in is 0 or lower, and no loss when expired MatureCellarAgedMead
FR-004: cap at 50 Quality clamps to 0–50, which Increase() uses; I read this in Quality.cs
FR-005: sell-in −1 every day SellIn.NextDay()
FR-007: existing rules preserved Other arms unchanged; regression tests added
FR-008: independent processing Mixed-inventory test
FR-009: deterministic, cumulative updates Repeat-update and determinism tests
FR-010: minimum quality 0, initial quality 0–50 Quality clamp; tests start at 0 and 48

The spec marks FR-010 as needing clarification: whether the legacy OriginalCode/UpdateQualityService must also handle the mead. This change does not touch the legacy path or Item.cs, so the mead is only handled by ItemMaturationService. Confirm that is what you want.

What changed

Source

  • src/Core/ProposedCode/Domain/ItemKind.cs
    • Adds CellarAgedMead as a sealed record.
    • FromName gets the exact arm "Cellar-Aged Mead" => new CellarAgedMead() before the Standard default.
  • src/Core/ProposedCode/Domain/ItemMaturingPolicy.cs
    • Mature gets the arm ItemKind.CellarAgedMead => this.MatureCellarAgedMead(state).
    • MatureCellarAgedMead follows the MatureAgedBrie pattern: quality +1, sell-in −1, and +1 more if the new sell-in is expired. That gives +2 from sell-in 0 and below.
    • Existing arms are unchanged.
  • README.md: a new "Cellar-Aged Mead" subsection at the end of the Kata Description. It covers the +1/+2 rule, the 50 cap and exact-name recognition.

Tests

  • tests/Core.Tests/ProposedCode/Domain/ItemKindTests.cs
    • The name-to-kind theory gets a row mapping "Cellar-Aged Mead" to CellarAgedMead.
    • A new theory checks that "Cellar-Aged", "Mead", "Cellar-Aged Mead Reserve", "cellar-aged mead" and "Cellar-Aged Mead " all resolve to Standard.
  • tests/Core.Tests/ProposedCode/Domain/ItemMaturingPolicyTests.cs
    • A 13-row rules theory covers sell-in 5, 1, 0, −1 and −5, and quality 0, 48, 49 and 50.
    • Starting at quality 20 and sell-in 2, three days give quality 24 and sell-in −1.
    • Starting from quality 0 and from 48, 30 days end at quality 50 and sell-in −30.
    • Two runs from the same state give the same result.
    • A 200-day run from quality 0 keeps quality within 0–50 on every day.
    • A negative sell-in (−1, −5, −100) never lowers quality.
  • tests/Core.Tests/ProposedCode/ItemMaturationServiceTests.cs
    • Two mead rows are added to the existing resolved-kinds theory (20/5 → 21/4 and 20/0 → 22/−1).
    • A mixed-inventory test uses five mead items plus Standard, Aged Brie, Backstage, Conjured and Sulfuras. Each result must equal the item matured alone, and the input items must not be mutated.
    • A regression theory pins known outputs for the five existing kinds.
    • A name-variant test checks that "Cellar-Aged Mead Reserve" is treated as Standard.

How to check

  1. Run dotnet build and dotnet test from the repository root.
  2. Check the mead scenarios from the issue:
    • AC-01: 20/5 → 21/4
    • AC-02: 20/0 → 22/−1
    • AC-03: 20/1 → 21/0
    • AC-04: 49/5 → 50
    • AC-05: 50/0 → 50/−1
    • AC-06: 30/−5 → 32/−6
  3. Check that the existing ItemMaturingPolicyTests, ItemMaturationServiceTests, QualityTests and SellInTests pass with no edits to their old expected values (AC-07).

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