Skip to content

Spec-driven change from a Jira issue - #18

Closed
dev-agentic-platform[bot] wants to merge 5 commits into
masterfrom
agent/65607f8b-4231-4104-9f4b-89915e15c816/implement
Closed

dev-agentic-platform[bot] wants to merge 5 commits into
masterfrom
agent/65607f8b-4231-4104-9f4b-89915e15c816/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-4: Add Bordeaux Wine as a new maturing product

Summary

This adds Bordeaux Wine as a product that gains quality as it ages. It is matched by its exact name, Bordeaux Wine, and follows the same rule as Aged Brie.

  • Quality rises by 1 per day while sell-in is not expired.
  • Quality rises by 2 per day once the new sell-in is below 0.
  • Quality is capped at 50, using the existing Quality.Increase() limit.
  • Sell-in goes down by 1 per day.

All changes are in the new ProposedCode service. src/Core/OriginalCode is not touched.

I haven't built the project or run any tests. Neither have the engineers, because they had no build tool. Run the checks below before merging.

Requirements met

  • FR-001: ItemKind.FromName maps the exact name Bordeaux Wine to the new ItemKind.BordeauxWine.
  • FR-002, FR-003: MatureBordeauxWine adds 1 quality, and adds 1 more when the new sell-in is expired.
  • FR-004, FR-005: The existing Quality.Increase() enforces the 0–50 limits. I didn't open that type, so this is assumed from the Aged Brie rule that this code copies.
  • FR-006: Sell-in moves forward with SellIn.NextDay().
  • FR-007: Bordeaux Wine no longer falls through to the Standard rule.
  • FR-008: Only new switch arms were added, so other products take the same paths as before.
  • FR-009: The rules live in ItemMaturingPolicy, which is used by ItemMaturationService.
  • FR-010: OriginalCode/UpdateQualityService.cs has no change and no Bordeaux handling. I found no "Bordeaux" text under src/Core/OriginalCode.
  • FR-011: Tests cover the sell-by boundary (0 → -1) and the quality limits of 0 and 50. Details are below.

What changed

Source

  • src/Core/ProposedCode/Domain/ItemKind.cs
    • Adds public sealed record BordeauxWine : ItemKind;.
    • Adds the arm "Bordeaux Wine" => new BordeauxWine() before the default in FromName.
    • The match is exact and case-sensitive, with no aliases. bordeaux wine, BordeauxWine and Bordeaux Wine resolve to Standard. Aliases are out of scope.
  • src/Core/ProposedCode/Domain/ItemMaturingPolicy.cs
    • Adds the arm ItemKind.BordeauxWine => this.MatureBordeauxWine(state) in Mature.
    • Adds a private MatureBordeauxWine(ItemState) that mirrors MatureAgedBrie.

Tests

I left the existing test cases unchanged. The three files were rewritten in full, so check the diff for stray changes at the end of each file.

  • tests/Core.Tests/ProposedCode/Domain/ItemKindTests.cs
    • Adds Bordeaux Wine → ItemKind.BordeauxWine to FromName_MapsNamesToExpectedKinds.
    • Adds the theory FromName_WhenBordeauxWineNameIsNotExact_ResolvesToStandard, which covers three near-miss names.
  • tests/Core.Tests/ProposedCode/Domain/ItemMaturingPolicyTests.cs
    • Adds Mature_WhenKindIsBordeauxWine_FollowsExpectedRules with 11 rows, placed after the Aged Brie test.
    • The rows cover:
      • normal days (sell-in 10 and 1);
      • the boundary (sell-in 0) and expired items (-5);
      • the cap at 50 (50 and 49, with sell-in 10, 0 and -1);
      • quality 0, which gives +1 within the period and +2 after it.
  • tests/Core.Tests/ProposedCode/ItemMaturationServiceTests.cs
    • Adds three end-to-end rows through the service: ("Bordeaux Wine",20,10,21,9), ("Bordeaux Wine",20,0,22,-1) and ("Bordeaux Wine",50,0,50,-1).

How to check

  1. Run dotnet build. The test project won't compile without ItemKind.BordeauxWine and the policy arm, which are in this change.
  2. Run dotnet test. The new Bordeaux Wine tests and all the existing ones should pass (SC-004, SC-006).
  3. Run git diff --stat -- src/Core/OriginalCode. It should print nothing (SC-005).
  4. Skim the diff of the three test files for unintended whitespace or end-of-file changes.

Out of scope

  • Changing OriginalCode/UpdateQualityService.cs.
  • Adding Cellar-Aged Mead (KAN-1) or any other product.
  • Recognising name variants or aliases of Bordeaux Wine.
  • Changing the rules of existing products or the 0–50 quality limits.

The Jira issue has no written acceptance criteria. The requirements above come from the run's spec.md.

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