Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 20, 2026

Memento Pattern Source Generator - Code Quality Improvements βœ…

Summary of Latest Changes

Addressed 3 code quality issues from the latest review, improving correctness and robustness.

πŸ“ Changes Made

1. Removed Unused Import (Comment #2711024069)

  • Removed unused System.Collections.Immutable import from MementoGenerator.cs
  • Keeps dependencies minimal and clean

2. Fixed Global Namespace Handling (Comment #2711024075)

  • Previous behavior: Used "GlobalNamespace" string for types in global namespace
    • This would generate invalid code: namespace GlobalNamespace; creating a namespace instead of using global
  • New behavior: Uses string.Empty for global namespace types
    • Namespace declaration is conditionally emitted only when not empty
    • Types in global namespace now correctly have no namespace declaration

3. Fixed Single-Character Name Handling (Comment #2711024084)

  • Previous code: name.Substring(1) would throw ArgumentOutOfRangeException for single-character names
  • New code: Added length check || name.Length == 1 to early return
    • Single-character names now handled safely
    • Prevents potential runtime exception

βœ… Validation

  • All 13 Memento generator tests passing
  • Build succeeds across all target frameworks (net8.0, net9.0, net10.0)
  • No new warnings or errors
  • Addressed all 3 code quality issues

🎯 Impact

These changes improve:

  • Correctness: Proper handling of global namespace types
  • Robustness: Prevents exception with edge-case input
  • Code quality: Cleaner imports and better validation

Previous Changes Summary

Previously addressed:

  • 10 initial review comments: Namespace consistency, property detection, constructor matching, code quality
  • 3 follow-up comments: Removed unused imports, simplified demo undo/redo logic
Original prompt

This section details on the original issue you should resolve

<issue_title>Generator: Create Memento Pattern (supports class/struct/record + optional undo/redo caretaker)</issue_title>
<issue_description>## Summary

Add a source generator that produces a complete implementation of the Memento pattern for consumer types β€” including classes, structs, record classes, and record structs β€” focused on:

  • capturing an immutable snapshot (β€œmemento”)
  • restoring that snapshot
  • optionally generating a caretaker for undo/redo history
  • providing safe-by-default capture strategies for mutable members
  • staying deterministic, reflection-free, and consistent with PatternKit’s β€œpatterns without boilerplate” direction

Motivation / Problem

Memento implementations are repetitive and correctness-sensitive:

  • picking which members to include/exclude
  • avoiding aliasing (mutable references captured by reference)
  • immutability guarantees for snapshots
  • versioning when the originator evolves
  • undo/redo history stacks, capacity, redo invalidation
  • supporting immutable originators (records) without awkward mutation paths

This is ideal for source generation: emit correct, optimized code once, consistently.


Supported Originator Kinds (must-have)

The generator must support:

  1. class
  2. struct
  3. record class
  4. record struct

Each kind has different restore semantics:

Mutable originators (class/struct with settable members)

  • restore can be β€œin-place” (assign members back)

Immutable originators (records with init or positional parameters)

  • restore should support returning a new instance:

    • RestoreNew(...) or Apply(...)
  • optionally support with-expression restore when feasible:

    • if the generator can express a valid with { ... } for the included members

We should not force mutation on records that are designed to be immutable.


Proposed User Experience

Minimal: snapshot only

[Memento]
public partial record class EditorState(string Text, int Cursor);

Generated (shape):

public readonly partial struct EditorStateMemento
{
    public string Text { get; }
    public int Cursor { get; }

    public static EditorStateMemento Capture(in EditorState originator);

    // Immutable-friendly restore
    public EditorState RestoreNew();

    // Optional: only generated if the originator is mutable
    public void Restore(EditorState originator);
}

Snapshot + caretaker (undo/redo)

[Memento(GenerateCaretaker = true, Capacity = 256)]
public partial record class EditorState(string Text, int Cursor);

Generated:

public sealed partial class EditorStateHistory
{
    public int Count { get; }
    public bool CanUndo { get; }
    public bool CanRedo { get; }

    public EditorState Current { get; }

    public EditorStateHistory(EditorState initial);

    public void Capture(EditorState state);
    public bool Undo();
    public bool Redo();

    public void Clear();
}

Notes

  • For immutable originators, caretaker stores states, not β€œa reference that gets mutated.”
  • For mutable originators, caretaker can store mementos and restore into the same instance (optional; see β€œCaretaker modes”).

Member Selection

Support both modes:

Include-all (default, configurable)

  • include all eligible public instance fields/properties with getters
  • exclude explicitly ignored members

Include-explicit

  • include only [MementoInclude]

Attributes:

  • [Memento]
  • [MementoIgnore]
  • [MementoInclude]

Capture Strategies for Mutable References (footgun prevention)

Default strategy should be explicit and safe:

  • value types copied
  • string treated as safe immutable
  • reference types default to ByReference with a warning unless configured otherwise

Per-member strategy attribute:

[MementoStrategy(Clone)]
public List<Item> Items { get; init; } = new();

Strategies:

  • ByReference
  • Clone (requires a known mechanism)
  • DeepCopy (only when generator can safely emit it)
  • Serialize (opt-in, future)
  • Custom (partial hook)

Restore Semantics (by originator type)

For class / struct (mutable)

Generate both:

  • void Restore(TOriginator originator) (in-place)
  • TOriginator RestoreNew() (convenience)

For record class / record struct

Generate:

  • TOriginator RestoreNew() (always)
  • optional Apply(TOriginator originator) only if the record has writable members (rare / discouraged)

Additionally:

  • if feasible, prefer with-expression:

    • originator with { Prop = value, ... }
  • otherwise, use the best available constructor/positional parameters:

    • either primary constructor args or a synthesized factory based on accessible constructors

The generator must emit diagnostics if it cannot safely construct a new record instance.


Caretaker Generation (Undo/Redo)

Caretaker should be optional and support dete...


✨ Let Copilot coding agent set things up for you β€” coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits January 20, 2026 06:15
- Created MementoAttribute with configuration options
- Implemented MementoGenerator for class/struct/record class/record struct
- Generated immutable memento structs with Capture and RestoreNew methods
- Generated optional caretaker classes for undo/redo history
- Added diagnostic support (PKMEM001-PKMEM006)
- All 13 generator tests passing

Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
- Created EditorStateDemo showing text editor with undo/redo
- Created GameStateDemo showing game state save/load
- Added comprehensive README with usage examples
- Moved MementoAttribute to Abstractions project for accessibility
- Fixed generator to skip computed/read-only properties
- All 13 generator tests passing

Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
- Added null checks for FirstOrDefault in test assertions
- Fixed potential NullReferenceException in generated source access
- All 13 Memento tests passing

Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
Copilot AI changed the title [WIP] Add source generator for Memento pattern implementation Add Memento pattern source generator for classes, structs, and records Jan 20, 2026
Copilot AI requested a review from JerrettDavis January 20, 2026 06:29
@JerrettDavis JerrettDavis removed their assignment Jan 21, 2026
@JerrettDavis JerrettDavis marked this pull request as ready for review January 21, 2026 02:44
@github-actions
Copy link
Contributor

github-actions bot commented Jan 21, 2026

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

βœ… No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@github-actions
Copy link
Contributor

github-actions bot commented Jan 21, 2026

Test Results

123 tests   123 βœ…β€ƒβ€ƒ19s ⏱️
  1 suites    0 πŸ’€
  1 files      0 ❌

Results for commit 8641aca.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 21, 2026

πŸ” PR Validation Results

Version: ``

βœ… Validation Steps

  • Build solution
  • Run tests
  • Build documentation
  • Dry-run NuGet packaging

πŸ“Š Artifacts

Dry-run artifacts have been uploaded and will be available for 7 days.


This comment was automatically generated by the PR validation workflow.

@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

❌ Patch coverage is 64.70588% with 210 lines in your changes missing coverage. Please review.
βœ… Project coverage is 89.77%. Comparing base (c3ee85e) to head (8641aca).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...rnKit.Examples/Generators/Memento/GameStateDemo.cs 5.35% 106 Missing ⚠️
...Kit.Examples/Generators/Memento/EditorStateDemo.cs 11.23% 79 Missing ⚠️
src/PatternKit.Generators/MementoGenerator.cs 95.59% 17 Missing ⚠️
...ernKit.Generators.Abstractions/MementoAttribute.cs 0.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #88      +/-   ##
==========================================
+ Coverage   86.81%   89.77%   +2.95%     
==========================================
  Files         139      143       +4     
  Lines       11295    11890     +595     
  Branches     1548     1615      +67     
==========================================
+ Hits         9806    10674     +868     
- Misses       1101     1216     +115     
+ Partials      388        0     -388     
Flag Coverage Ξ”
unittests 89.77% <64.70%> (+2.95%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a comprehensive source generator for the Memento pattern, enabling compile-time generation of immutable snapshot structures and optional undo/redo caretakers for classes, structs, record classes, and record structs.

Changes:

  • Adds MementoGenerator with support for four type kinds (class, struct, record class, record struct) with customizable member selection, capture strategies, and six diagnostic codes (PKMEM001-006)
  • Generates immutable memento structs with versioning, Capture methods, and RestoreNew/Restore methods based on type mutability
  • Generates optional caretaker classes with configurable capacity, FIFO eviction, duplicate suppression, and standard undo/redo semantics
  • Provides EditorStateDemo and GameStateDemo showcasing text editor and game state scenarios with generated mementos

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/PatternKit.Generators/MementoGenerator.cs Core source generator implementing memento struct and caretaker generation with member analysis and restore logic
src/PatternKit.Generators.Abstractions/MementoAttribute.cs Attribute definitions for [Memento], [MementoIgnore], [MementoInclude], and [MementoStrategy] with enums for inclusion mode and capture strategies
src/PatternKit.Generators/AnalyzerReleases.Unshipped.md Adds six diagnostic IDs (PKMEM001-006) for memento-specific errors and warnings
test/PatternKit.Generators.Tests/MementoGeneratorTests.cs Comprehensive test suite covering basic generation, caretaker, member selection, diagnostics, and capacity handling
src/PatternKit.Examples/Generators/Memento/README.md Detailed documentation with usage examples, configuration options, diagnostics reference, and best practices
src/PatternKit.Examples/Generators/Memento/EditorStateDemo.cs Text editor demonstration using record class with undo/redo functionality
src/PatternKit.Examples/Generators/Memento/GameStateDemo.cs Game state demonstration using mutable class with save/load and checkpoint functionality

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JerrettDavis
Copy link
Owner

@copilot apply changes based on the comments in this thread

- Fixed namespace mismatch in demo files (MementoDemo -> Memento)
- Updated GameStateDemo to use generated memento methods instead of manual copying
- Improved computed property detection to exclude init-only properties on non-record types
- Enhanced positional constructor detection with parameter name and type matching
- Added verification for settable members in RestoreNew for non-record types
- Refactored foreach loops to use explicit .Where() filtering
- Updated test assertions to use regex for flexible matching

All 13 Memento generator tests passing.

Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.


πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JerrettDavis
Copy link
Owner

@copilot apply changes based on the comments in this thread

Ignore the note about the gitversion bump. That was required, but we can make a comment about it. Fix the others.

- Removed unused PatternKit.Creational.Builder import from MementoGeneratorTests
- Simplified GameStateDemo undo/redo methods to avoid inefficient intermediate memento
- Now directly copies state from history instead of creating unnecessary memento instance

All 13 Memento generator tests passing.

Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.


πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JerrettDavis
Copy link
Owner

@copilot apply changes based on the comments in this thread

- Removed unused System.Collections.Immutable import
- Fixed global namespace handling to use empty string instead of "GlobalNamespace"
- Added length check in ToCamelCase to prevent exception with single-char names
- Conditionally emit namespace declaration only when not in global namespace

All 13 Memento generator tests passing.

Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.


πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Contributor

Code Coverage

Summary
  Generated on: 01/21/2026 - 05:47:41
  Coverage date: 01/21/2026 - 05:47:05 - 01/21/2026 - 05:47:36
  Parser: MultiReport (9x Cobertura)
  Assemblies: 4
  Classes: 338
  Files: 209
  Line coverage: 80.7%
  Covered lines: 10779
  Uncovered lines: 2566
  Coverable lines: 13345
  Total lines: 35358
  Branch coverage: 70.9% (3258 of 4591)
  Covered branches: 3258
  Total branches: 4591
  Method coverage: 78.2% (2231 of 2852)
  Full method coverage: 72.7% (2076 of 2852)
  Covered methods: 2231
  Fully covered methods: 2076
  Total methods: 2852

PatternKit.Core                                                                                                   96.8%
  PatternKit.Behavioral.Chain.ActionChain<T>                                                                       100%
  PatternKit.Behavioral.Chain.AsyncActionChain<T>                                                                  100%
  PatternKit.Behavioral.Chain.AsyncResultChain<T1, T2>                                                            97.7%
  PatternKit.Behavioral.Chain.ResultChain<T1, T2>                                                                  100%
  PatternKit.Behavioral.Command.Command<T>                                                                         100%
  PatternKit.Behavioral.Interpreter.ActionInterpreter                                                              100%
  PatternKit.Behavioral.Interpreter.ActionInterpreter<T>                                                          96.9%
  PatternKit.Behavioral.Interpreter.ActionInterpreterBuilder<T>                                                    100%
  PatternKit.Behavioral.Interpreter.AsyncActionInterpreter                                                         100%
  PatternKit.Behavioral.Interpreter.AsyncActionInterpreter<T>                                                      100%
  PatternKit.Behavioral.Interpreter.AsyncActionInterpreterBuilder<T>                                               100%
  PatternKit.Behavioral.Interpreter.AsyncInterpreter                                                               100%
  PatternKit.Behavioral.Interpreter.AsyncInterpreter<T1, T2>                                                      96.8%
  PatternKit.Behavioral.Interpreter.AsyncInterpreterBuilder<T1, T2>                                                100%
  PatternKit.Behavioral.Interpreter.Builder<T1, T2>                                                                 96%
  PatternKit.Behavioral.Interpreter.ExpressionExtensions                                                           100%
  PatternKit.Behavioral.Interpreter.Interpreter                                                                    100%
  PatternKit.Behavioral.Interpreter.Interpreter<T1, T2>                                                           96.6%
  PatternKit.Behavioral.Interpreter.NonTerminalExpression                                                          100%
  PatternKit.Behavioral.Interpreter.TerminalExpression                                                             100%
  PatternKit.Behavioral.Iterator.AsyncFlow<T>                                                                      100%
  PatternKit.Behavioral.Iterator.AsyncFlowExtensions                                                               100%
  PatternKit.Behavioral.Iterator.AsyncReplayBuffer<T>                                                             93.6%
  PatternKit.Behavioral.Iterator.Flow<T>                                                                          94.4%
  PatternKit.Behavioral.Iterator.FlowExtensions                                                                    100%
  PatternKit.Behavioral.Iterator.ReplayableSequence<T>                                                            98.2%
  PatternKit.Behavioral.Iterator.ReplayableSequenceExtensions                                                      100%
  PatternKit.Behavioral.Iterator.SharedAsyncFlow<T>                                                                100%
  PatternKit.Behavioral.Iterator.SharedFlow<T>                                                                     100%
  PatternKit.Behavioral.Iterator.WindowSequence                                                                    100%
  PatternKit.Behavioral.Mediator.Mediator                                                                         91.9%
  PatternKit.Behavioral.Mediator.MediatorHelpers                                                                   100%
  PatternKit.Behavioral.Mediator.TaskExtensions                                                                    100%
  PatternKit.Behavioral.Memento.Memento<T>                                                                         100%
  PatternKit.Behavioral.Observer.AsyncObserver<T>                                                                 98.7%
  PatternKit.Behavioral.Observer.Observer<T>                                                                      98.2%
  PatternKit.Behavioral.State.AsyncStateMachine<T1, T2>                                                             95%
  PatternKit.Behavioral.State.StateMachine<T1, T2>                                                                  99%
  PatternKit.Behavioral.Strategy.ActionStrategy<T>                                                                  97%
  PatternKit.Behavioral.Strategy.AsyncActionStrategy<T>                                                            100%
  PatternKit.Behavioral.Strategy.AsyncStrategy<T1, T2>                                                             100%
  PatternKit.Behavioral.Strategy.Strategy<T1, T2>                                                                  100%
  PatternKit.Behavioral.Strategy.TryStrategy<T1, T2>                                                              95.8%
  PatternKit.Behavioral.Template.ActionTemplate<T>                                                                 100%
  PatternKit.Behavioral.Template.AsyncActionTemplate<T>                                                            100%
  PatternKit.Behavioral.Template.AsyncTemplate<T1, T2>                                                            97.1%
  PatternKit.Behavioral.Template.AsyncTemplateMethod<T1, T2>                                                       100%
  PatternKit.Behavioral.Template.Template<T1, T2>                                                                  100%
  PatternKit.Behavioral.Template.TemplateMethod<T1, T2>                                                            100%
  PatternKit.Behavioral.TypeDispatcher.ActionTypeDispatcher<T>                                                    91.4%
  PatternKit.Behavioral.TypeDispatcher.AsyncActionTypeDispatcher<T>                                               94.5%
  PatternKit.Behavioral.TypeDispatcher.AsyncTypeDispatcher<T1, T2>                                                94.4%
  PatternKit.Behavioral.TypeDispatcher.TypeDispatcher<T1, T2>                                                      100%
  PatternKit.Behavioral.Visitor.ActionVisitor<T>                                                                  85.7%
  PatternKit.Behavioral.Visitor.ActionVisitorBase<T>                                                               100%
  PatternKit.Behavioral.Visitor.AsyncActionVisitor<T>                                                             94.5%
  PatternKit.Behavioral.Visitor.AsyncFluentActionVisitor<T>                                                        100%
  PatternKit.Behavioral.Visitor.AsyncFluentVisitor<T1, T2>                                                         100%
  PatternKit.Behavioral.Visitor.AsyncVisitor<T1, T2>                                                              86.1%
  PatternKit.Behavioral.Visitor.FluentActionVisitor<T>                                                             100%
  PatternKit.Behavioral.Visitor.FluentVisitor<T1, T2>                                                              100%
  PatternKit.Behavioral.Visitor.Visitor<T1, T2>                                                                   91.1%
  PatternKit.Behavioral.Visitor.VisitorBase<T1, T2>                                                                100%
  PatternKit.Common.Option<T>                                                                                      100%
  PatternKit.Common.Throw                                                                                          100%
  PatternKit.Common.TryHandlerExtensions                                                                           100%
  PatternKit.Creational.AbstractFactory.AbstractFactory<T>                                                        91.6%
  PatternKit.Creational.Builder.BranchBuilder<T1, T2>                                                              100%
  PatternKit.Creational.Builder.BuilderExtensions                                                                  100%
  PatternKit.Creational.Builder.ChainBuilder<T>                                                                    100%
  PatternKit.Creational.Builder.Composer<T1, T2>                                                                   100%
  PatternKit.Creational.Builder.MutableBuilder<T>                                                                  100%
  PatternKit.Creational.Factory.Factory<T1, T2>                                                                   92.3%
  PatternKit.Creational.Factory.Factory<T1, T2, T3>                                                               92.3%
  PatternKit.Creational.Prototype.Prototype<T>                                                                     100%
  PatternKit.Creational.Prototype.Prototype<T1, T2>                                                                 90%
  PatternKit.Creational.Singleton.Singleton<T>                                                                     100%
  PatternKit.Structural.Adapter.Adapter<T1, T2>                                                                    100%
  PatternKit.Structural.Adapter.AsyncAdapter<T1, T2>                                                               100%
  PatternKit.Structural.Bridge.ActionBridge<T1, T2>                                                               90.9%
  PatternKit.Structural.Bridge.AsyncActionBridge<T1, T2>                                                          96.5%
  PatternKit.Structural.Bridge.AsyncBridge<T1, T2, T3>                                                            90.6%
  PatternKit.Structural.Bridge.Bridge<T1, T2, T3>                                                                  100%
  PatternKit.Structural.Composite.ActionComposite<T>                                                               100%
  PatternKit.Structural.Composite.AsyncActionComposite<T>                                                          100%
  PatternKit.Structural.Composite.AsyncComposite<T1, T2>                                                          97.8%
  PatternKit.Structural.Composite.Composite<T1, T2>                                                               97.3%
  PatternKit.Structural.Decorator.ActionDecorator<T>                                                               100%
  PatternKit.Structural.Decorator.AsyncActionDecorator<T>                                                          100%
  PatternKit.Structural.Decorator.AsyncDecorator<T1, T2>                                                            98%
  PatternKit.Structural.Decorator.Decorator<T1, T2>                                                               97.6%
  PatternKit.Structural.Facade.Facade<T1, T2>                                                                     88.8%
  PatternKit.Structural.Facade.TypedFacade<T>                                                                     79.4%
  PatternKit.Structural.Facade.TypedFacadeDispatchProxy<T>                                                        81.8%
  PatternKit.Structural.Facade.TypedFacadeProxyFactory<T>                                                          100%
  PatternKit.Structural.Flyweight.Flyweight<T1, T2>                                                               97.9%
  PatternKit.Structural.Proxy.ActionProxy<T>                                                                       100%
  PatternKit.Structural.Proxy.AsyncActionProxy<T>                                                                  100%
  PatternKit.Structural.Proxy.AsyncProxy<T1, T2>                                                                  98.6%
  PatternKit.Structural.Proxy.Proxy<T1, T2>                                                                       98.8%

PatternKit.Examples                                                                                               66.3%
  PatternKit.Examples.AbstractFactoryDemo.AbstractFactoryDemo                                                     98.2%
  PatternKit.Examples.ApiGateway.Demo                                                                             97.9%
  PatternKit.Examples.ApiGateway.MiniRouter                                                                       96.6%
  PatternKit.Examples.ApiGateway.Request                                                                            75%
  PatternKit.Examples.ApiGateway.Response                                                                          100%
  PatternKit.Examples.ApiGateway.Responses                                                                         100%
  PatternKit.Examples.AsyncStateDemo.ConnectionStateDemo                                                          93.5%
  PatternKit.Examples.BridgeDemo.BridgeDemo                                                                       96.7%
  PatternKit.Examples.Chain.AuthLoggingDemo                                                                       95.2%
  PatternKit.Examples.Chain.CardProcessors                                                                         100%
  PatternKit.Examples.Chain.CardTenderStrategy                                                                    77.7%
  PatternKit.Examples.Chain.CashTenderStrategy                                                                     100%
  PatternKit.Examples.Chain.ChainStage                                                                             100%
  PatternKit.Examples.Chain.CharityRoundUpRule                                                                      50%
  PatternKit.Examples.Chain.ConfigDriven.Bundle1OffEach                                                           14.2%
  PatternKit.Examples.Chain.ConfigDriven.CardTender                                                               72.2%
  PatternKit.Examples.Chain.ConfigDriven.Cash2Pct                                                                 16.6%
  PatternKit.Examples.Chain.ConfigDriven.CashTender                                                               90.9%
  PatternKit.Examples.Chain.ConfigDriven.CharityRoundUp                                                            100%
  PatternKit.Examples.Chain.ConfigDriven.ConfigDrivenPipelineBuilderExtensions                                    94.2%
  PatternKit.Examples.Chain.ConfigDriven.ConfigDrivenPipelineDemo                                                  100%
  PatternKit.Examples.Chain.ConfigDriven.Loyalty5Pct                                                                20%
  PatternKit.Examples.Chain.ConfigDriven.NickelCashOnly                                                           77.7%
  PatternKit.Examples.Chain.ConfigDriven.PipelineOptions                                                           100%
  PatternKit.Examples.Chain.Customer                                                                               100%
  PatternKit.Examples.Chain.DeviceBus                                                                              100%
  PatternKit.Examples.Chain.GenericProcessor                                                                       100%
  PatternKit.Examples.Chain.HttpRequest                                                                            100%
  PatternKit.Examples.Chain.IRoundingRule                                                                          100%
  PatternKit.Examples.Chain.LineItem                                                                               100%
  PatternKit.Examples.Chain.MediatedTransactionPipelineDemo                                                        100%
  PatternKit.Examples.Chain.NickelCashOnlyRule                                                                     100%
  PatternKit.Examples.Chain.NoopCharityTracker                                                                     100%
  PatternKit.Examples.Chain.RoundingPipeline                                                                       100%
  PatternKit.Examples.Chain.Tender                                                                                 100%
  PatternKit.Examples.Chain.TenderRouterFactory                                                                   91.3%
  PatternKit.Examples.Chain.TransactionContext                                                                     100%
  PatternKit.Examples.Chain.TransactionPipeline                                                                    100%
  PatternKit.Examples.Chain.TransactionPipelineBuilder                                                            92.3%
  PatternKit.Examples.Chain.TxResult                                                                               100%
  PatternKit.Examples.CompositeDemo.CompositeDemo                                                                  100%
  PatternKit.Examples.EnterpriseDemo.EnterpriseOrderDemo                                                          97.1%
  PatternKit.Examples.FacadeDemo.FacadeDemo                                                                        100%
  PatternKit.Examples.FlyweightDemo.FlyweightDemo                                                                 96.9%
  PatternKit.Examples.Generators.Builders.CorporateApplicationBuilderDemo.BackgroundJobsModule                     100%
  PatternKit.Examples.Generators.Builders.CorporateApplicationBuilderDemo.CorporateApp                             100%
  PatternKit.Examples.Generators.Builders.CorporateApplicationBuilderDemo.CorporateApplication                    21.4%
  PatternKit.Examples.Generators.Builders.CorporateApplicationBuilderDemo.CorporateApplicationBuilder             52.6%
  PatternKit.Examples.Generators.Builders.CorporateApplicationBuilderDemo.CorporateApplicationBuilderExtensions   94.7%
  PatternKit.Examples.Generators.Builders.CorporateApplicationBuilderDemo.CorporateApplicationDemo                27.2%
  PatternKit.Examples.Generators.Builders.CorporateApplicationBuilderDemo.CorporateAppState                        100%
  PatternKit.Examples.Generators.Builders.CorporateApplicationBuilderDemo.InMemoryJobScheduler                     100%
  PatternKit.Examples.Generators.Builders.CorporateApplicationBuilderDemo.MessagingModule                          100%
  PatternKit.Examples.Generators.Builders.CorporateApplicationBuilderDemo.NotificationOptions                        0%
  PatternKit.Examples.Generators.Builders.CorporateApplicationBuilderDemo.ObservabilityModule                      100%
  PatternKit.Examples.Generators.Builders.CorporateApplicationBuilderDemo.QueueNotificationPublisher               100%
  PatternKit.Examples.Generators.Builders.CorporateApplicationBuilderDemo.SecretsProvider                          100%
  PatternKit.Examples.Generators.Factories.ApplicationOrchestrator                                                   0%
  PatternKit.Examples.Generators.Factories.BackgroundWorker                                                        100%
  PatternKit.Examples.Generators.Factories.ConsoleMetricsSink                                                      100%
  PatternKit.Examples.Generators.Factories.MemoryCacheProvider                                                     100%
  PatternKit.Examples.Generators.Factories.OrchestratorStepFactory                                                13.4%
  PatternKit.Examples.Generators.Factories.SeedDataStep                                                            100%
  PatternKit.Examples.Generators.Factories.ServiceModuleBootstrap                                                  100%
  PatternKit.Examples.Generators.Factories.ServiceModules                                                           44%
  PatternKit.Examples.Generators.Factories.StartWorkersStep                                                        100%
  PatternKit.Examples.Generators.Factories.WarmCacheStep                                                           100%
  PatternKit.Examples.Generators.Memento.EditorStateDemo                                                             0%
  PatternKit.Examples.Generators.Memento.EditorStateHistory                                                          0%
  PatternKit.Examples.Generators.Memento.EditorStateMemento                                                          0%
  PatternKit.Examples.Generators.Memento.GameStateDemo                                                               0%
  PatternKit.Examples.Generators.Memento.GameStateHistory                                                            0%
  PatternKit.Examples.Generators.Memento.GameStateMemento                                                            0%
  PatternKit.Examples.Generators.Strategies.IntParser                                                               60%
  PatternKit.Examples.Generators.Strategies.OrderRouter                                                           95.2%
  PatternKit.Examples.Generators.Strategies.ScoreLabeler                                                           100%
  PatternKit.Examples.Generators.Visitors.Document                                                                   0%
  PatternKit.Examples.Generators.Visitors.DocumentActionVisitorBuilder                                               0%
  PatternKit.Examples.Generators.Visitors.DocumentAsyncActionVisitorBuilder                                          0%
  PatternKit.Examples.Generators.Visitors.DocumentAsyncVisitorBuilder<T>                                             0%
  PatternKit.Examples.Generators.Visitors.DocumentProcessingDemo                                                     0%
  PatternKit.Examples.Generators.Visitors.DocumentVisitorBuilder<T>                                                  0%
  PatternKit.Examples.Generators.Visitors.MarkdownDocument                                                           0%
  PatternKit.Examples.Generators.Visitors.PdfDocument                                                                0%
  PatternKit.Examples.Generators.Visitors.SpreadsheetDocument                                                        0%
  PatternKit.Examples.Generators.Visitors.WordDocument                                                               0%
  PatternKit.Examples.InterpreterDemo.InterpreterDemo                                                             93.1%
  PatternKit.Examples.IteratorDemo.IteratorDemo                                                                   98.8%
  PatternKit.Examples.MediatorDemo.AppMediator                                                                     100%
  PatternKit.Examples.MediatorDemo.AuditLogHandler                                                                 100%
  PatternKit.Examples.MediatorDemo.BoxHelper                                                                        25%
  PatternKit.Examples.MediatorDemo.CountUpCmd                                                                      100%
  PatternKit.Examples.MediatorDemo.CountUpHandler                                                                  100%
  PatternKit.Examples.MediatorDemo.EchoCmd                                                                         100%
  PatternKit.Examples.MediatorDemo.EchoHandler                                                                     100%
  PatternKit.Examples.MediatorDemo.LoggingBehavior<T1, T2>                                                         100%
  PatternKit.Examples.MediatorDemo.MediatorAssemblyScanner                                                         100%
  PatternKit.Examples.MediatorDemo.MediatorDemoSink                                                                100%
  PatternKit.Examples.MediatorDemo.MediatorRegistry                                                                100%
  PatternKit.Examples.MediatorDemo.PingCmd                                                                         100%
  PatternKit.Examples.MediatorDemo.PingHandler                                                                     100%
  PatternKit.Examples.MediatorDemo.ServiceCollectionExtensions                                                    83.3%
  PatternKit.Examples.MediatorDemo.SumCmd                                                                          100%
  PatternKit.Examples.MediatorDemo.SumCmdBehavior                                                                  100%
  PatternKit.Examples.MediatorDemo.SumHandler                                                                      100%
  PatternKit.Examples.MediatorDemo.UserCreated                                                                     100%
  PatternKit.Examples.MediatorDemo.WelcomeEmailHandler                                                             100%
  PatternKit.Examples.MementoDemo.MementoDemo                                                                     83.5%
  PatternKit.Examples.Messaging.CreateUser                                                                           0%
  PatternKit.Examples.Messaging.DispatcherUsageExamples                                                              0%
  PatternKit.Examples.Messaging.EmailSent                                                                            0%
  PatternKit.Examples.Messaging.OrderPlaced                                                                          0%
  PatternKit.Examples.Messaging.PagedItem                                                                            0%
  PatternKit.Examples.Messaging.PagedRequest                                                                         0%
  PatternKit.Examples.Messaging.SearchQuery                                                                          0%
  PatternKit.Examples.Messaging.SearchResult                                                                         0%
  PatternKit.Examples.Messaging.SendEmail                                                                            0%
  PatternKit.Examples.Messaging.SourceGenerated.ComprehensiveMediatorDemo                                            0%
  PatternKit.Examples.Messaging.SourceGenerated.CreateCustomerCommand                                                0%
  PatternKit.Examples.Messaging.SourceGenerated.CreateCustomerHandler                                                0%
  PatternKit.Examples.Messaging.SourceGenerated.Customer                                                             0%
  PatternKit.Examples.Messaging.SourceGenerated.CustomerCreatedEvent                                                 0%
  PatternKit.Examples.Messaging.SourceGenerated.GetCustomerHandler                                                   0%
  PatternKit.Examples.Messaging.SourceGenerated.GetCustomerQuery                                                     0%
  PatternKit.Examples.Messaging.SourceGenerated.GetOrdersByCustomerHandler                                           0%
  PatternKit.Examples.Messaging.SourceGenerated.GetOrdersByCustomerQuery                                             0%
  PatternKit.Examples.Messaging.SourceGenerated.InMemoryCustomerRepository                                           0%
  PatternKit.Examples.Messaging.SourceGenerated.InMemoryLogger                                                       0%
  PatternKit.Examples.Messaging.SourceGenerated.InMemoryOrderRepository                                              0%
  PatternKit.Examples.Messaging.SourceGenerated.InMemoryProductRepository                                            0%
  PatternKit.Examples.Messaging.SourceGenerated.LoggingBehavior<T1, T2>                                              0%
  PatternKit.Examples.Messaging.SourceGenerated.MediatorServiceCollectionExtensions                                  0%
  PatternKit.Examples.Messaging.SourceGenerated.NotifyInventoryHandler                                               0%
  PatternKit.Examples.Messaging.SourceGenerated.Order                                                                0%
  PatternKit.Examples.Messaging.SourceGenerated.OrderItem                                                            0%
  PatternKit.Examples.Messaging.SourceGenerated.OrderPlacedEvent                                                     0%
  PatternKit.Examples.Messaging.SourceGenerated.PaymentProcessedEvent                                                0%
  PatternKit.Examples.Messaging.SourceGenerated.PerformanceBehavior<T1, T2>                                          0%
  PatternKit.Examples.Messaging.SourceGenerated.PlaceOrderCommand                                                    0%
  PatternKit.Examples.Messaging.SourceGenerated.PlaceOrderHandler                                                    0%
  PatternKit.Examples.Messaging.SourceGenerated.ProcessPaymentCommand                                                0%
  PatternKit.Examples.Messaging.SourceGenerated.ProcessPaymentHandler                                                0%
  PatternKit.Examples.Messaging.SourceGenerated.ProductionDispatcher                                                 0%
  PatternKit.Examples.Messaging.SourceGenerated.ProductSearchResult                                                  0%
  PatternKit.Examples.Messaging.SourceGenerated.RecordPaymentAuditHandler                                            0%
  PatternKit.Examples.Messaging.SourceGenerated.SearchProductsHandler                                                0%
  PatternKit.Examples.Messaging.SourceGenerated.SearchProductsQuery                                                  0%
  PatternKit.Examples.Messaging.SourceGenerated.SendOrderConfirmationHandler                                         0%
  PatternKit.Examples.Messaging.SourceGenerated.SendWelcomeEmailHandler                                              0%
  PatternKit.Examples.Messaging.SourceGenerated.TransactionBehavior<T1, T2>                                          0%
  PatternKit.Examples.Messaging.SourceGenerated.UpdateCustomerStatsHandler                                           0%
  PatternKit.Examples.Messaging.SourceGenerated.ValidationBehavior<T1, T2>                                           0%
  PatternKit.Examples.Messaging.UserCreated                                                                          0%
  PatternKit.Examples.Messaging.UserRegistered                                                                       0%
  PatternKit.Examples.ObserverDemo.EventHub<T>                                                                     100%
  PatternKit.Examples.ObserverDemo.LineItem                                                                        100%
  PatternKit.Examples.ObserverDemo.ObservableList<T>                                                                47%
  PatternKit.Examples.ObserverDemo.ObservableVar<T>                                                                100%
  PatternKit.Examples.ObserverDemo.ProfileViewModel                                                                100%
  PatternKit.Examples.ObserverDemo.PropertyChangedHub                                                              100%
  PatternKit.Examples.ObserverDemo.ReactiveTransaction                                                            95.4%
  PatternKit.Examples.ObserverDemo.UserEvent                                                                       100%
  PatternKit.Examples.PatternShowcase.PatternShowcase                                                             91.2%
  PatternKit.Examples.PointOfSale.CustomerInfo                                                                     100%
  PatternKit.Examples.PointOfSale.Demo                                                                            99.6%
  PatternKit.Examples.PointOfSale.OrderLineItem                                                                    100%
  PatternKit.Examples.PointOfSale.PaymentProcessorDemo                                                            95.7%
  PatternKit.Examples.PointOfSale.PaymentReceipt                                                                   100%
  PatternKit.Examples.PointOfSale.PromotionConfig                                                                  100%
  PatternKit.Examples.PointOfSale.PurchaseOrder                                                                    100%
  PatternKit.Examples.PointOfSale.ReceiptLineItem                                                                  100%
  PatternKit.Examples.PointOfSale.StoreLocation                                                                    100%
  PatternKit.Examples.Pricing.ApiPricingSource                                                                     100%
  PatternKit.Examples.Pricing.CharityRoundUpRule                                                                   100%
  PatternKit.Examples.Pricing.Coupon                                                                               100%
  PatternKit.Examples.Pricing.DbPricingSource                                                                      100%
  PatternKit.Examples.Pricing.DefaultSourceRouting                                                                83.3%
  PatternKit.Examples.Pricing.FilePricingSource                                                                    100%
  PatternKit.Examples.Pricing.LineItem                                                                             100%
  PatternKit.Examples.Pricing.Location                                                                             100%
  PatternKit.Examples.Pricing.LoyaltyMembership                                                                    100%
  PatternKit.Examples.Pricing.NickelCashOnlyRule                                                                   100%
  PatternKit.Examples.Pricing.PercentLoyaltyRule                                                                   100%
  PatternKit.Examples.Pricing.PricingContext                                                                       100%
  PatternKit.Examples.Pricing.PricingDemo                                                                         56.7%
  PatternKit.Examples.Pricing.PricingPipeline                                                                      100%
  PatternKit.Examples.Pricing.PricingPipelineBuilder                                                               100%
  PatternKit.Examples.Pricing.PricingResult                                                                        100%
  PatternKit.Examples.Pricing.RegionCategoryTaxPolicy                                                              100%
  PatternKit.Examples.Pricing.Sku                                                                                 85.7%
  PatternKit.Examples.Pricing.SourceRouter                                                                        92.3%
  PatternKit.Examples.PrototypeDemo.PrototypeDemo                                                                  100%
  PatternKit.Examples.ProxyDemo.ProxyDemo                                                                         94.5%
  PatternKit.Examples.Singleton.DeviceRegistry                                                                     100%
  PatternKit.Examples.Singleton.PosAppState                                                                        100%
  PatternKit.Examples.Singleton.PosAppStateDemo                                                                    100%
  PatternKit.Examples.Singleton.PricingCache                                                                       100%
  PatternKit.Examples.Singleton.StoreConfig                                                                        100%
  PatternKit.Examples.StateDemo.OrderStateDemo                                                                     100%
  PatternKit.Examples.Strategies.Coercion.Coercer<T>                                                              83.3%
  PatternKit.Examples.Strategies.Coercion.CoercerExtensions                                                        100%
  PatternKit.Examples.Strategies.Composed.ChannelPolicy                                                            100%
  PatternKit.Examples.Strategies.Composed.ChannelPolicyFactory                                                     100%
  PatternKit.Examples.Strategies.Composed.ComposedStrategies                                                      94.2%
  PatternKit.Examples.Strategies.Composed.SendContext                                                              100%
  PatternKit.Examples.Strategies.Composed.SendResult                                                               100%
  PatternKit.Examples.TemplateDemo.AsyncDataPipeline                                                               100%
  PatternKit.Examples.TemplateDemo.DataProcessor                                                                   100%
  PatternKit.Examples.TemplateDemo.TemplateAsyncFluentDemo                                                         100%
  PatternKit.Examples.TemplateDemo.TemplateFluentDemo                                                               90%
  PatternKit.Examples.TemplateDemo.TemplateMethodDemo                                                              100%
  PatternKit.Examples.VisitorDemo.Card                                                                             100%
  PatternKit.Examples.VisitorDemo.Cash                                                                             100%
  PatternKit.Examples.VisitorDemo.CountersHandler                                                                  100%
  PatternKit.Examples.VisitorDemo.Demo                                                                             100%
  PatternKit.Examples.VisitorDemo.GiftCard                                                                         100%
  PatternKit.Examples.VisitorDemo.ReceiptRendering                                                                 100%
  PatternKit.Examples.VisitorDemo.Routing                                                                          100%
  PatternKit.Examples.VisitorDemo.StoreCredit                                                                      100%
  PatternKit.Examples.VisitorDemo.Tender                                                                           100%
  PatternKit.Examples.VisitorDemo.Unknown                                                                          100%

PatternKit.Generators                                                                                             93.3%
  PatternKit.Generators.Builders.BuilderGenerator                                                                 96.3%
  PatternKit.Generators.Factories.FactoriesGenerator                                                              86.6%
  PatternKit.Generators.MementoGenerator                                                                          94.8%
  PatternKit.Generators.Messaging.DispatcherGenerator                                                             96.2%
  PatternKit.Generators.StrategyGenerator                                                                         93.9%
  PatternKit.Generators.VisitorGenerator                                                                          99.3%

PatternKit.Generators.Abstractions                                                                                67.9%
  PatternKit.Generators.Builders.BuilderRequiredAttribute                                                          100%
  PatternKit.Generators.Builders.GenerateBuilderAttribute                                                          100%
  PatternKit.Generators.Factories.FactoryCaseAttribute                                                             100%
  PatternKit.Generators.Factories.FactoryClassAttribute                                                            100%
  PatternKit.Generators.Factories.FactoryClassKeyAttribute                                                         100%
  PatternKit.Generators.Factories.FactoryMethodAttribute                                                           100%
  PatternKit.Generators.GenerateStrategyAttribute                                                                  100%
  PatternKit.Generators.MementoAttribute                                                                             0%
  PatternKit.Generators.MementoStrategyAttribute                                                                     0%
  PatternKit.Generators.Messaging.GenerateDispatcherAttribute                                                        0%
  PatternKit.Generators.Visitors.GenerateVisitorAttribute                                                            0%

@JerrettDavis JerrettDavis merged commit dae4428 into main Jan 21, 2026
16 of 17 checks passed
@JerrettDavis JerrettDavis deleted the copilot/add-memento-pattern-generator branch January 21, 2026 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generator: Create Memento Pattern (supports class/struct/record + optional undo/redo caretaker)

2 participants