Skip to content

Spec-driven change from a Jira issue - #28

Closed
dev-agentic-platform[bot] wants to merge 7 commits into
masterfrom
agent/0fab53aa-65b6-4877-a240-0e54c77ab655/implement
Closed

dev-agentic-platform[bot] wants to merge 7 commits into
masterfrom
agent/0fab53aa-65b6-4877-a240-0e54c77ab655/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-8: Add Mature Cheese to the proposed Gilded Rose code

Summary

This adds a new product, Mature Cheese, to the proposed code in src/Core/ProposedCode. Its quality goes up as it ages: +1 per update while sellIn is above 0, and +2 once sellIn is 0 or below. The rule uses sellIn as it was before the day's decrement. Quality is always held in 0–50, and sellIn drops by 1 on each update.

Only the exact, case-sensitive name Mature Cheese gets the new rule. Any other name, such as mature cheese, Mature Cheese Deluxe or MatureCheese, follows the standard-item rule as before. The existing rules for Aged Brie, Backstage passes, Sulfuras, Conjured and standard items are unchanged. Nothing under src/Core/OriginalCode was edited.

I have not built or run anything. The engineers had file tools only, and so did I. The tests have never been compiled or run, so please check the points under "How to check".

Requirements met

  • FR-001, FR-009: ItemKind.FromName maps the exact name Mature Cheese to the new MatureCheese kind. Other names fall through to the existing arms or to Standard.
  • FR-002, FR-003, FR-004, FR-005: MatureCheese in ItemMaturingPolicy chooses the +1 or +2 increase from SellIn.Value before it calls NextDay().
  • FR-006, FR-007, FR-008: Quality clamps to 0–50 in its constructor, and Increase goes through it. A Mature Cheese item at quality 50 stays at 50, and invalid legacy quality (such as -5 or 60) ends up inside 0–50.
  • FR-010: The existing kind arms and methods are untouched. Tests check a mixed inventory.
  • FR-011, FR-012: Only Mature changes values. Tests check that the input Item is unchanged and that repeated runs give the same result.
  • FR-013: The change is limited to src/Core/ProposedCode and tests/.
  • FR-014: The rule sits in its own method, and tests cover the acceptance criteria, edge cases, consecutive updates, multiple items, a mixed inventory and similar names.

What changed

Source

  • src/Core/ProposedCode/Domain/ItemKind.cs
    • Added public sealed record MatureCheese : ItemKind;.
    • Added the arm "Mature Cheese" => new MatureCheese() to FromName, just before the Standard default.
  • src/Core/ProposedCode/Domain/ItemMaturingPolicy.cs
    • Added ItemKind.MatureCheese => this.MatureCheese(state) to the Mature switch.
    • Added the private method MatureCheese(ItemState). It picks +1 if SellIn.Value > 0 and +2 otherwise, applies Quality.Increase, then moves SellIn on one day.
    • The other kind methods are unchanged.

Tests

  • tests/Core.Tests/ProposedCode/Domain/ItemKindTests.cs
    • Added four rows to the FromName_MapsNamesToExpectedKinds theory.
    • Mature Cheese maps to MatureCheese. mature cheese, Mature Cheese Deluxe and MatureCheese map to Standard.
  • tests/Core.Tests/ProposedCode/Domain/ItemMaturingPolicyTests.cs
    • Added a 12-row theory, Mature_WhenKindIsMatureCheese_FollowsExpectedRules. It covers quality 0, 1, 49 and 50 and sellIn above, at and below 0.
    • Added a consecutive-updates test. Starting at quality 10 and sellIn 1, three updates give quality 11, 13, 15 and sellIn 0, -1, -2.
    • Added a determinism test, which compares values from two runs.
  • tests/Core.Tests/ProposedCode/ItemMaturationServiceTests.cs
    • Added a NewItem helper.

    • Added a theory with all 8 acceptance rows for Mature Cheese.

    • Added invalid-data tests with quality -5 and 60. A 60-day loop from six start states, including negative sellIn, keeps quality in 0–50 and drops sellIn by 1 each day.

    • Added a similar-names test, where all three names give quality 9 and sellIn 4 from quality 10 and sellIn 5.

    • Added a mixed-inventory test with expected values:

      Product Quality sellIn
      Mature Cheese 11 4
      Aged Brie 11 1
      Backstage passes 22 9
      Sulfuras 80 0
      Conjured Mana Cake 8 4
      Standard item 9 4

      Each non-cheese item must also match a separate service call on the same input.

    • Added a test with six cheeses run for 8 days, each checked every day against an independent calculation.

    • Added no-mutation tests. Mature leaves the input Item unchanged and returns a new instance, and creating or reading a Mature Cheese item changes nothing.

    • The existing tests are unchanged.

How to check

  1. Run dotnet restore && dotnet build --no-restore && dotnet test --no-build. The new tests reference ItemKind.MatureCheese, so they only compile with the source change in place. All new and existing tests should pass.
  2. Run git diff --stat against the base branch. It should list only the two source files above and the three test files. Nothing under src/Core/OriginalCode should appear (FR-013).
  3. Read the existing tests (Aged Brie, Backstage, Sulfuras, Conjured, standard). They should pass unchanged.

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