Skip to content

Fix quadratic discriminator cleanup after #1379 - #1381

Merged
stevehu merged 1 commit into
masterfrom
fix/discriminator-cleanup-scaling
Nov 7, 2026
Merged

stevehu merged 1 commit into
masterfrom
fix/discriminator-cleanup-scaling

Conversation

@stevehu

@stevehu stevehu commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #1379; the corresponding 2.x correction follows #1380.

Large arrays of discriminated items make the cleanup introduced for #1378 quadratic: each oneOf/anyOf alternative copies and scans discriminator state accumulated for earlier items. Replace those snapshots with a scoped insertion journal, retaining existing and same-location state while discarding new descendant state on normal and exceptional exits.

The named discriminator map journals all insertion methods. Validation/walk dispatch and enablement stay in each validator; non-validating walks avoid cleanup, and disabled isolation uses a shared no-op scope. Expand coverage to OpenAPI 3.0/3.1, validating and non-validating walks, redefinitions, map mutators, nested failures, and nested arrays. The growth regression counts actual backing-map operations after validation; test instrumentation does not modify final fields.

Validation:

  • Full clean Maven suite passed, including all 20 Issue1378Test cases.
  • Staged diff whitespace checks passed.
  • A temporary full-map-scan mutation was rejected by the growth assertion on both branches: about 254x work for 16x input. The mutation was removed before the clean full-suite runs.
  • Remote CI has not yet been verified.

Command: mvn -q clean test.

@stevehu
stevehu merged commit 2c78688 into master Nov 7, 2026
4 checks passed
@stevehu
stevehu deleted the fix/discriminator-cleanup-scaling branch November 7, 2026 03:29
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