Skip to content

Spec-driven change from a Jira issue - #19

Closed
dev-agentic-platform[bot] wants to merge 3 commits into
masterfrom
agent/e9247cc6-b8b1-43d0-84a2-b5db35ecb083/implement
Closed

dev-agentic-platform[bot] wants to merge 3 commits into
masterfrom
agent/e9247cc6-b8b1-43d0-84a2-b5db35ecb083/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-1: Add the Vintage Wine maturing product

Summary

This adds a new maturing product, Vintage Wine, to the ProposedCode maturing flow. The Jira issue left the business rules to the team, so the spec sets them. Vintage Wine gains quality as its sell-by date nears and never loses quality, even after that date.

  • If SellIn is 11 or more at the start of the day, Quality goes up by 1.
  • If SellIn is 10 or less (including 0 and below), Quality goes up by 2.
  • SellIn drops by 1 each day, with no expiry penalty and no reset.
  • Quality is capped at 50. Quality.Increase clamps in its constructor, so Q49 with Increase(2) gives Q50.

The other kinds (Standard, Aged Brie, Backstage, Conjured, Sulfuras) are unchanged. The legacy OriginalCode is untouched.

Requirements met

  • FR-001: "Vintage Wine" and "Vintage" are recognised as a distinct kind.
  • FR-002: SellIn drops by 1 each day, including after the sell-by date.
  • FR-003: Quality goes up by 1 when SellIn is 11 or more.
  • FR-004: Quality goes up by 2 when SellIn is 10 or less, including 0 and below.
  • FR-005: Quality never decreases.
  • FR-006: Quality never exceeds 50.
  • FR-007: The existing kinds keep their rules. No existing arm was changed, but this has not been run (see below).
  • FR-008: The name is preserved.

What changed

  • src/Core/ProposedCode/Domain/ItemKind.cs
    • Adds public sealed record VintageWine : ItemKind;.
    • FromName maps "Vintage Wine" and "Vintage" to it, before the _ arm. Matching stays exact-name, as before.
  • src/Core/ProposedCode/Domain/ItemMaturingPolicy.cs
    • Adds the arm ItemKind.VintageWine => this.MatureVintageWine(state).
    • The new MatureVintageWine applies the rules above.
  • tests/Core.Tests/ProposedCode/Domain/ItemKindTests.cs
    • Adds rows for "Vintage Wine" and "Vintage", both expecting ItemKind.VintageWine.
  • tests/Core.Tests/ProposedCode/Domain/ItemMaturingPolicyTests.cs
    • Adds the theory Mature_WhenKindIsVintageWine_FollowsExpectedRules with nine rows.
    • The rows cover the boundaries at SellIn 11, 10 and 0, an expired item, and the cap at 50.
  • tests/Core.Tests/ProposedCode/ItemMaturationServiceTests.cs
    • Adds eight Vintage Wine rows to Mature_UsesExpectedRulesForResolvedItemKinds. The -5 row uses the short name "Vintage".
    • Adds the [Fact] Mature_WhenItemIsVintageWine_PreservesName.

The author rewrote each file in full, so a trailing newline may differ from the originals.

How to check

Not yet verified: nobody could run dotnet restore, dotnet build or dotnet test while preparing this change (task T006). The new tests, the unchanged tests for the existing kinds, and the Roslynator/Sonar warnings are all unchecked. Please confirm CI is green before merging.

  1. Run dotnet restore, dotnet build and dotnet test.

  2. Confirm that:

    • the new Vintage Wine tests pass (SC-001);
    • the existing Standard, Aged Brie, Backstage, Conjured and Sulfuras tests pass with their expectations unchanged (SC-002);
    • the build shows no new warnings (SC-003).
  3. Spot-check through ItemMaturationService for "Vintage Wine" at Quality 10 (SC-004):

    SellIn Result
    20 Q11, SellIn 19
    10 Q12, SellIn 9
    0 Q12, SellIn -1

    Also check that Quality 50 stays at 50.

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