Skip to content

Planned, built and reviewed change - #17

Closed
dev-agentic-platform[bot] wants to merge 4 commits into
masterfrom
agent/53e602dc-916b-4f1d-862b-060a7542f17b/implement
Closed

dev-agentic-platform[bot] wants to merge 4 commits into
masterfrom
agent/53e602dc-916b-4f1d-862b-060a7542f17b/implement

Conversation

@dev-agentic-platform

Copy link
Copy Markdown

Agents planned, built and reviewed this change; the run was approved at a gate before this pull request was opened. Review it as you would any change: agents can be wrong.

Summary

This adds a new product, Vintage Wine (alias Wine), that matures with age. The business rule is my choice, since the request left it open:

  • While the item is in date, its Quality goes up by 1 per day.
  • Once the SellIn date has passed, it loses 2 Quality per day instead.

Quality is clamped by the existing Quality type (0 to 50). Nothing in Quality.cs, SellIn.cs, IMaturingPolicy.cs or OriginalCode was touched.

Not verified: the engineers could not run dotnet build or dotnet test. I read the changed files and they match the reports. Nobody has confirmed that the build is warning-free or that the tests pass. Run both from the repo root before merging.

Changes per file

src/Core/ProposedCode/Domain/ItemKind.cs

  • Adds public sealed record VintageWine : ItemKind;.
  • FromName now maps "Vintage Wine" and "Wine" to new VintageWine(). Without this the item would fall through to Standard.

src/Core/ProposedCode/Domain/ItemMaturingPolicy.cs

  • Adds the case ItemKind.VintageWine => this.MatureVintageWine(state) to the Mature switch.
  • Adds MatureVintageWine. It computes newSellIn = state.SellIn.NextDay() first, then:
    • if newSellIn.IsExpired, quality is Decrease(2);
    • otherwise quality is Increase().
  • Expiry is decided on the new SellIn, as in the other policies. The day SellIn goes from 0 to -1 already costs 2 Quality.
  • Unlike the Aged Brie and Conjured methods, this one applies a single increase or decrease. It does not apply a normal step and then an extra one.

README.md

  • Adds a short intro sentence and a bullet after the "Conjured" section describing the Vintage Wine rule and its alias.

tests/Core.Tests/ProposedCode/Domain/ItemKindTests.cs

  • Adds "Vintage Wine" and "Wine" rows, both expecting ItemKind.VintageWine, to FromName_MapsNamesToExpectedKinds.

tests/Core.Tests/ProposedCode/Domain/ItemMaturingPolicyTests.cs

  • Adds the theory Mature_WhenKindIsVintageWine_FollowsExpectedRules with ten (quality, sellIn, expectedQuality, expectedSellIn) rows:
    • normal gain: (10,5,11,4), (10,1,11,0);
    • the expiry boundary: (10,0,8,-1);
    • already expired: (10,-1,8,-2);
    • floor at 0: (0,0,0,-1), (1,0,0,-1);
    • cap at 50: (50,5,50,4), (49,5,50,4);
    • expired from the cap: (50,0,48,-1);
    • gain from zero: (0,5,1,4).
  • The (10,-1,8,-2) row passes a negative sellIn. SellIn accepts any int, so this is valid.

tests/Core.Tests/ProposedCode/ItemMaturationServiceTests.cs

  • Adds four rows to Mature_UsesExpectedRulesForResolvedItemKinds. They run both names through name resolution and maturing, in date and just expired:
    • ("Vintage Wine",10,5,11,4) and ("Wine",10,5,11,4);
    • ("Vintage Wine",10,0,8,-1) and ("Wine",10,0,8,-1).

How to check

  1. From the repo root, run dotnet build. It should finish with no errors or warnings.
  2. Run dotnet test. All existing tests and the new Vintage Wine rows should pass.
  3. Optionally, run a Vintage Wine item through the service by hand:
    • ("Vintage Wine", quality 10, sellIn 5) should become quality 11, sellIn 4.
    • ("Wine", quality 10, sellIn 0) should become quality 8, sellIn -1.

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