Skip to content

Mapping Services Lazy-Loading Integration #118

Closed
0 of 1 issue completed
Closed

Description

@JeremyCaney

The mapping services (both forward and reverse) fan out as concurrent tasks assuming loads complete synchronously, which was true before lazy loading, but is now false—so awaits expose concurrency races, nondeterministic ordering, and cases where checks silently force full eager loads, which defeats the point of the lazy-loading entirely.

Steps

  • Fix where lazy loading is being silently negated (e.g., eager evaluation of getters, un-awaited fills of extended attributes)
  • Concurrency safety (e.g., locking resolution of association, infinite-loop detection, guarding modification of shared lists)
  • Deterministic collection ordering (replacing completion-order with source-order)
  • ReverseTopicMappingService:
    • Fix a data-integrity bug where clearing relationships doesn't purge deferred entries, so deletions get silently resurrected
    • Sequentializing its fan-out to avoid concurrent writes to the same collections on the target Topic

Activity

  1. added this to the OnTopic 6.0.0 milestone on Jul 25, 2026
  2. self-assigned this
    on Jul 25, 2026
  3. added
    Type: BugBehavior that is inconsistent with documented or expected behavior.
    Area: RepositoriesRelates to the `ITopicRepository` interface or one of its implementations.
    on Jul 25, 2026
  4. added theissue type on Jul 25, 2026
  5. changed the issue type fromtoon Jul 25, 2026
  6. added 2 commits that reference this issue on Aug 5, 2026
  7. added
    Status 5: CompleteTask is considered complete, and ready for deployment.
    and removed on Aug 9, 2026
  8. JeremyCaney commented on Aug 9, 2026

    @JeremyCaney
    MemberAuthor

    Merged with 3acee3b:

    • Fix where lazy loading is being silently negated (e.g., eager evaluation of getters, un-awaited fills of extended attributes)
      • Use lazy-loading in GetSourceCollectionAsync() (7777ed1) with unit tests to confirm load order (6e064a1)
      • Ensure EnsureLoaded() is awaited (d4b4020)
      • EnsureLoaded() for AsAttributeDictionary() (03ed27c) with unit tests (51d0f4e, faf3639)
      • Ensure metadata lookup items are loaded on mapping (b88d436)
      • Defer GetContentTypeDescriptors() to first use, instead of eagerly loading the entire Root:Configuration tree in the constructor (4857676)
      • Ensure target topic is fully loaded in ReverseTopicMappingService.MapAsync(), so unchanged extended attributes aren't marked dirty (f0c65ea) with unit tests (59a8b85, f235508)
    • Concurrency safety (e.g., locking resolution of association, infinite-loop detection, guarding modification of shared lists)
      • Introduced MapPath class to detect circular vs. sibling references (b42673a) wired into the MapAsync() chain (61b1487), with unit tests (a64b1f8, dbb4798, dc88d41, 4a67bab)
      • Added "completion semantics" to mapped cache entries (7a5bd2c) with unit tests (28f0b07):
        • TryGetValue(…, includeInitializing) (5a6b8a9)
        • Complete() in Register() (ee9a9a5)
        • Fault() in MapAsync() (b197889)
        • resolveCachedEntry() (1334a2b)
      • Made AddMissingAssociations() concurrent (0f51264), applied to caller (a971aeb), with unit tests (bc73f87)
      • Lock creation of new view model collections (86c6f7e) and adding view models to the collections (9dfc24c)
      • Added unit tests (678bf64, 6d59060, 3a50d6b), including test aparatus:
        • RendezvousTopicLazyLoader (f6a85a2)
        • StaggeredTopicLazyLoader (3359853)
        • CreateGatedMappingService() helper (91d0a21)
      • Added fault-injection support (a101412) to model concurrency in tests (73e2f3a)
    • Deterministic collection ordering (replacing completion-order with source-order)
      • Rely on WhenAll() over WhenAny() to honor sibling source order (c5f191b) with unit tests (1a631ab)
      • Prefer direct WhenAll(IEnumerable) (487ecf2)
    • ReverseTopicMappingService:
      • Fix a data-integrity bug where clearing relationships doesn't purge deferred entries, so deletions get silently resurrected
      • Sequentializing its fan-out to avoid concurrent writes to the same collections on the target Topic
        • Serialize PopulateTargetCollectionAsync() (c6e644d) with unit tests (23f4adf), using new test doubles:
          • StaggeredStubTopicRepository (277edab)
          • NestedReferenceAttributeTopicBindingModel (909121d)
    • Prevent duplicate mapping of properties on repeated [Include] calls (a preexisting bug) (f287c1d) with unit tests (ec102ab, 49a6048)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Area: RepositoriesRelates to the `ITopicRepository` interface or one of its implementations.Priority: 1Severity 2: MajorStatus 5: CompleteTask is considered complete, and ready for deployment.Type: BugBehavior that is inconsistent with documented or expected behavior.Type: ImprovementImproves the functionality or interface of an existing feature.

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions