#249 Circular reference / reference handling - #307
Merged
Conversation
Introduce MappaReferenceManager, MappaException, and MappaSettings for ReferenceReusing, MaxRuntimeDepth, and MaxCompileTimeDepth. Expose a private ReferenceManager on MappaContext and cover it with unit and UnsafeAccessor tests. Bump to 10.2.0-alpha.50. Co-authored-by: Cursor <cursoragent@cursor.com>
Introduce warnings for missing MappaContext on root and nested maps, plus errors for MaxCompileTimeDepth overflow and compile-time mapping cycles. Resources and factory helpers are wired; call sites remain for later steps. Co-authored-by: Cursor <cursoragent@cursor.com>
…nfig. Expose ReferenceReusing, MaxRuntimeDepth, and MaxCompileTimeDepth on user settings with negative depth treated as Undefined. Read the matching mappa.* editorconfig keys and assert fully unset depth defaults. Co-authored-by: Cursor <cursoragent@cursor.com>
Track CurrentDepth on the root algorithm context and wrap both GetStrategy entry points so nested strategy discovery stops with MP00076 when the effective compile-time depth limit is exceeded. Co-authored-by: Cursor <cursoragent@cursor.com>
Track in-flight target/source type pairs on the root algorithm context and stop strategy discovery with MP00077 when the same pair re-enters before the outer call completes. Co-authored-by: Cursor <cursoragent@cursor.com>
Add reference-manager accessor scaffolding, root MaxDepth initialization, and nested IncreaseDepth using wraps for reference-type maps. Also avoid MP00077 false positives on intentional GetStrategy re-entry (nullable unwrap and polymorphism MapSourceType). Co-authored-by: Cursor <cursoragent@cursor.com>
Wrap root and nested reference-type maps with TryGetReference/AddReferencePair, register pairs early after construction for cycles, and warn with MP00074 when reference handling is requested without MappaContext. Co-authored-by: Cursor <cursoragent@cursor.com>
Warn with MP00075 when an invoked map method lacks MappaContext while reference handling is requested, reject IQueryable projections that enable reference handling, and share IsReferenceHandlingRequested/Active helpers. Co-authored-by: Cursor <cursoragent@cursor.com>
Cover MP00074–MP00076 and projection rejection with full syntax walks, and require generated-code validation after diagnostic assertions in the workflow rule. Co-authored-by: Cursor <cursoragent@cursor.com>
Cover method/class/editorconfig precedence for ReferenceReusing, MaxRuntimeDepth, and MaxCompileTimeDepth, including negative depth inherit and global-options parse fallbacks. Co-authored-by: Cursor <cursoragent@cursor.com>
Cover default and boundary limits, disabled depth, sibling restore, settings sources, and collection/tuple/nullable nesting with full syntax walks. Co-authored-by: Cursor <cursoragent@cursor.com>
Cover mutual nesting cycles, explicit map-method breakouts, sibling and distinct-pair false positives, and ReferenceReusing still reporting compile-time cycles. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Wrap nullable reference map-method strategies in NullableStrategy so null cycle edges short-circuit before nested Map calls. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Add unit and integration tests for ReferenceHandlingCodeGenerator, MappaReferenceManager, MappaBuilderContext, TypeMapIdentifierWithMapMethodAlgorithm early returns, ProjectionCapabilityAnalyzer, and ProjectionMapMethodEligibilityValidator. Co-authored-by: Cursor <cursoragent@cursor.com>
Publish the post-generator package bump, add ReferenceReusing/MaxRuntimeDepth samples with tests and AOT runners, and require a post-generator-tests coverage checkpoint in the development workflow. Co-authored-by: Cursor <cursoragent@cursor.com>
Compare AutoMapper, Mapperly, Mapster, and Mappa on closed cycles and shared-reference DAGs. Leave the SVG chart subset unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
Add enum/reference series with capped time-percentage axis, proportional overflow stubs, rounded break waves, inside-bar labels, and exclude string/enum from memory charts. Co-authored-by: Cursor <cursoragent@cursor.com>
Add unlabeled minor Y-axis guides on percentage charts and use comma thousands separators for values of 1000 or more. Co-authored-by: Cursor <cursoragent@cursor.com>
…gnostics. Update tutorial, attributes, algorithm, features, error codes, and READMEs for ReferenceReusing, MaxRuntimeDepth, MaxCompileTimeDepth, and MP00074-MP00077. Co-authored-by: Cursor <cursoragent@cursor.com>
…rage gate. Add unit tests for empty inner-code depth wraps, additional container wrappers, and mixed type eligibility so overall and Generator branch coverage meet the issue baseline. Co-authored-by: Cursor <cursoragent@cursor.com>
9 tasks
9 tasks
Code coverageCompared against the latest published coverage history from the code coverage gist.
No coverage metric dropped by more than 1 percentage point(s) versus baseline. BenchmarksAutoMapper is the BenchmarkDotNet ratio baseline. Absolute values are mean time in nanoseconds and allocated bytes. Ratio columns are competitor / Mappa as a percentage (n/a when either side is missing or Mappa is zero).
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ReferenceReusing,MaxRuntimeDepth, andMaxCompileTimeDepth(short, negative = Undefined), withMappaReferenceManageronMappaContext.MappaContextis present, warns otherwise (MP00074/MP00075), enforces compile-time depth (MP00076) and type-pair cycle detection (MP00077), and rejects reference handling onIQueryableprojections.Test plan
.\Scripts\RunTestsAndReportCoverage.ps1— 2844 tests passed; coverage ≥ baseline (line 98.3%, branch 90.4%, method 100%; Generator branch 90.3%)ReferenceReusingCycleMapper/MaxRuntimeDepthMapperwithMappaContextReferenceReusingstill fails with MP00057Closes #249