Skip to content

Add regression test for registration-order MaxDepth context failure - #4675

Merged
jbogard merged 1 commit into
mainfrom
test/registration-order-maxdepth-context
Oct 29, 2026
Merged

jbogard merged 1 commit into
mainfrom
test/registration-order-maxdepth-context

Conversation

@jbogard

@jbogard jbogard commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Closes #4657

#4657 is already fixed on main by #4651, which hasn't been released yet. This PR adds the issue's repro as a regression test. I confirmed it fails on the commit just before #4651 with the reported Context.Items are only available... exception, and passes on main in both registration orders.

How this differs from #4651's test

That test forces the runtime path with MapAtRuntime() and needs two separate Map calls. This one uses neither:

  • Cycle detection turns the collection members into runtime calls on its own.
  • Within a single Map<EpicModel> call, WorkItemModel.Stories compiles the shared List<StoryEntity> → List<StoryModel> plan. That plan carries the MaxDepth 64 check from WorkItemEntity -> WorkItemModel.
  • EpicModel.Stories then reuses that plan under the caller's default context and throws.
  • Registering InitiativeEntity -> InitiativeModel first is what makes the Epic members runtime calls, so the test covers both orders.

🤖 Generated with Claude Code

…4657)

Reproduces #4657, already fixed by #4651. Unlike that fix's test, this
needs no MapAtRuntime and a single Map call: cycle detection turns the
collection members into runtime calls, WorkItemModel.Stories compiles the
shared List<StoryEntity> -> List<StoryModel> plan with WorkItem's MaxDepth
check, and EpicModel.Stories then reuses it under the default context.
Registering InitiativeEntity -> InitiativeModel first is what makes the
Epic members runtime calls, so the test covers both registration orders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 29, 2026 13:46
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T13:47:40.395449Z d5ada95 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues were identified in the regression coverage for recursive collection mapping across both registration orders.

No open issues 🎉

What changed in this PR

Adds regression coverage for #4657, protecting the fix from #4651 against registration-order-dependent failures when mapping recursive collections.

Changes:

  • Reproduces the recursive graph using a single Map<EpicModel> call without explicit MapAtRuntime() configuration.
  • Tests both Initiative-first and Epic-first registration orders.
  • Verifies collection counts and preservation of the WorkItem back-reference.
File Description
src/​UnitTests/​Bug/​RegistrationOrderMaxDepthContext.cs Adds the recursive graph fixture and regression tests for both registration orders.

Review effort: Balanced

@jbogard
jbogard merged commit df65f2e into main Oct 29, 2026
7 checks passed
@jbogard
jbogard deleted the test/registration-order-maxdepth-context branch October 29, 2026 20:03
This was referenced Nov 5, 2026
FreeAndNil added a commit to komsa/AutoMapper that referenced this pull request Nov 16, 2026
…uckyPennySoftware#4657) (LuckyPennySoftware#4675)

Reproduces LuckyPennySoftware#4657, already fixed by LuckyPennySoftware#4651. Unlike that fix's test, this
needs no MapAtRuntime and a single Map call: cycle detection turns the
collection members into runtime calls, WorkItemModel.Stories compiles the
shared List<StoryEntity> -> List<StoryModel> plan with WorkItem's MaxDepth
check, and EpicModel.Stories then reuses it under the default context.
Registering InitiativeEntity -> InitiativeModel first is what makes the
Epic members runtime calls, so the test covers both registration orders.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit df65f2e)
This was referenced Nov 16, 2026
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.

Registration order causes ResolutionContext.OverTypeDepth to access Context.Items in AutoMapper 16.2.0

2 participants