[midPoint-git] [Evolveum/midpoint] 24412c: Smart Integration: Add useAiService flag to contro...

Michal Zelenčík noreply at github.com
Fri Feb 6 07:56:42 CET 2026


  Branch: refs/heads/master
  Home:   https://github.com/Evolveum/midpoint
  Commit: 24412c022fe8f0e10ce109ba90b401163df2dfd0
      https://github.com/Evolveum/midpoint/commit/24412c022fe8f0e10ce109ba90b401163df2dfd0
  Author: Michal Zelencik <michal.zelencik at evolveum.com>
  Date:   2026-02-03 (Tue, 03 Feb 2026)

  Changed paths:
    M model/smart-api/src/main/java/com/evolveum/midpoint/smart/api/SmartIntegrationService.java
    M model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/MappingSuggestionOperationFactory.java
    M model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/MappingsSuggestionOperation.java
    M model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/SmartIntegrationServiceImpl.java
    M model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/activities/MappingsSuggestionRemoteServiceCallActivityRun.java
    M model/smart-impl/src/test/java/com/evolveum/midpoint/smart/impl/TestMappingsSuggestionOperation.java
    M model/smart-impl/src/test/java/com/evolveum/midpoint/smart/impl/TestSmartIntegrationServiceImpl.java
    M model/smart-impl/src/test/java/com/evolveum/midpoint/smart/impl/TestSystemMappingsSuggestion.java

  Log Message:
  -----------
  Smart Integration: Add useAiService flag to control LLM mapping suggestion calls

This commit introduces a new `useAiService` parameter to the mapping
suggestion workflow, allowing callers to control whether AI/LLM services
should be invoked when suggesting attribute mappings.

- Enable selective use of AI services for mapping suggestions
- When useAiService=false, the system skips LLM calls and generates
  asIs mappings based on quality assessment
- All existing callers updated to pass useAiService=true to maintain
  current behavior
- Simplified MappingsSuggestionOperation.init() signature by
  introducing TypeOperationContext parameter object
- Reduced parameter count from 11 to 6 for better maintainability
- Aligned with CorrelationSuggestionOperation pattern for consistency
- Updated all test cases to use new TypeOperationContext pattern

Signed-off-by: Michal Zelencik <michal.zelencik at evolveum.com>


  Commit: 73a8f98a4073942c6ead57ac9b7562ee805c87cf
      https://github.com/Evolveum/midpoint/commit/73a8f98a4073942c6ead57ac9b7562ee805c87cf
  Author: Michal Zelencik <michal.zelencik at evolveum.com>
  Date:   2026-02-04 (Wed, 04 Feb 2026)

  Changed paths:
    M model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/MappingSuggestionOperationFactory.java
    M model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/MappingsSuggestionOperation.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/AbstractHeuristicMapping.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/FirstWordHeuristic.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/HeuristicMapping.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/HeuristicMappingManager.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/HeuristicResult.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/LastWordHeuristic.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/RemoveWhitespaceHeuristic.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/StripDiacriticsHeuristic.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/ToLowerCaseHeuristic.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/ToUpperCaseHeuristic.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/TrimAndLowerCaseHeuristic.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/TrimHeuristic.java
    M model/smart-impl/src/test/java/com/evolveum/midpoint/smart/impl/TestMappingsSuggestionOperation.java
    M model/smart-impl/src/test/java/com/evolveum/midpoint/smart/impl/TestSystemMappingsSuggestion.java

  Log Message:
  -----------
  Smart Integration: Add heuristic-based mapping suggestions for attribute transformations

Implement a heuristic system that suggests mappings based on common
transformation patterns, serving as a fallback when AI is unavailable
or produces lower quality results.

Key changes:
- Add HeuristicMappingManager to coordinate heuristic evaluation
- Implement 8 common transformation heuristics (trim, case conversion,
  word extraction, whitespace removal, combinations)
- Integrate heuristics into MappingsSuggestionOperation with quality
  comparison logic
- Add comprehensive test coverage for heuristic selection and
  preference over AI when quality is better

The system evaluates sample data against each heuristic and selects
the one with perfect accuracy if available, providing reliable
suggestions even without AI connectivity.

Signed-off-by: Michal Zelencik <michal.zelencik at evolveum.com>


  Commit: 21c814b6b8c149332b9ee4e6f881a21c0b43688d
      https://github.com/Evolveum/midpoint/commit/21c814b6b8c149332b9ee4e6f881a21c0b43688d
  Author: Michal Zelencik <michal.zelencik at evolveum.com>
  Date:   2026-02-04 (Wed, 04 Feb 2026)

  Changed paths:
    M model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/MappingsSuggestionOperation.java

  Log Message:
  -----------
  Smart Integration: Refactor mapping evaluation logic into smaller methods

Extract complex mapping evaluation logic from monolithic method into
focused, single-responsibility methods:

- evaluateMappingStrategy(): orchestrates overall evaluation strategy
- findBestMappingExpression(): compares as-is, heuristic, and AI options
- evaluateAiMappingWithRetry(): handles AI mapping with retry logic
- validateQualityThreshold(): validates quality against threshold

Introduce MappingEvaluationResult record to encapsulate evaluation
results (expression, quality, provenance).

Simplify provenance marking logic using ternary operator instead of
if-else blocks.

Signed-off-by: Michal Zelencik <michal.zelencik at evolveum.com>


  Commit: 18ba4dae515c34a1746dbd2c2824303f95aba3c5
      https://github.com/Evolveum/midpoint/commit/18ba4dae515c34a1746dbd2c2824303f95aba3c5
  Author: Michal Zelencik <michal.zelencik at evolveum.com>
  Date:   2026-02-06 (Fri, 06 Feb 2026)

  Changed paths:
    M model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/MappingSuggestionOperationFactory.java
    M model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/MappingsSuggestionOperation.java
    M model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/ValuesPairSample.java
    R model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/AbstractHeuristicMapping.java
    M model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/FirstWordHeuristic.java
    R model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/HeuristicMapping.java
    R model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/HeuristicMappingManager.java
    M model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/HeuristicResult.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/HeuristicRule.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/HeuristicRuleMatcher.java
    M model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/LastWordHeuristic.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/MappingExpressionFactory.java
    M model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/RemoveWhitespaceHeuristic.java
    M model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/StripDiacriticsHeuristic.java
    M model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/ToLowerCaseHeuristic.java
    M model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/ToUpperCaseHeuristic.java
    M model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/TrimAndLowerCaseHeuristic.java
    M model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/TrimHeuristic.java
    M model/smart-impl/src/test/java/com/evolveum/midpoint/smart/impl/TestMappingsSuggestionOperation.java
    M model/smart-impl/src/test/java/com/evolveum/midpoint/smart/impl/TestSystemMappingsSuggestion.java

  Log Message:
  -----------
  Smart Integration: Refactor heuristic mappings to use composition over inheritance

Replace inheritance-based design with factory pattern to reduce coupling
and improve modularity in the heuristic mapping system.

- Replace AbstractHeuristicMapping inheritance with MappingExpressionFactory
  functional interface
- Rename HeuristicMapping → HeuristicRule (better semantic meaning)
- Rename HeuristicMappingManager → HeuristicRuleMatcher (clearer purpose)
- Update all 8 heuristic implementations to use factory pattern
- Optimize HeuristicRuleMatcher.findBestMatch() to create HeuristicResult
  only for the best match instead of all evaluated rules
- Update both inbound and outbound expression methods to accept factory
  parameter

Addresses review comments in AbstractHeuristicMapping.java,
HeuristicMapping.java, and HeuristicMappingManager.java.


  Commit: 48522001113cb0ce5eee24752dd14a6dc011754f
      https://github.com/Evolveum/midpoint/commit/48522001113cb0ce5eee24752dd14a6dc011754f
  Author: Michal Zelencik <michal.zelencik at evolveum.com>
  Date:   2026-02-06 (Fri, 06 Feb 2026)

  Changed paths:
    M model/smart-api/src/main/java/com/evolveum/midpoint/smart/api/SmartIntegrationService.java
    M model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/MappingSuggestionOperationFactory.java
    M model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/MappingsSuggestionOperation.java
    M model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/SmartIntegrationServiceImpl.java
    M model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/activities/MappingsSuggestionRemoteServiceCallActivityRun.java
    M model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/ValuesPairSample.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/FirstWordHeuristic.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/HeuristicResult.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/HeuristicRule.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/HeuristicRuleMatcher.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/LastWordHeuristic.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/MappingExpressionFactory.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/RemoveWhitespaceHeuristic.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/StripDiacriticsHeuristic.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/ToLowerCaseHeuristic.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/ToUpperCaseHeuristic.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/TrimAndLowerCaseHeuristic.java
    A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/mappings/heuristics/TrimHeuristic.java
    M model/smart-impl/src/test/java/com/evolveum/midpoint/smart/impl/TestMappingsSuggestionOperation.java
    M model/smart-impl/src/test/java/com/evolveum/midpoint/smart/impl/TestSmartIntegrationServiceImpl.java
    M model/smart-impl/src/test/java/com/evolveum/midpoint/smart/impl/TestSystemMappingsSuggestion.java

  Log Message:
  -----------
  Merge branch 'feature/heuristic-mappings'

# Conflicts:
#	model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/activities/MappingsSuggestionRemoteServiceCallActivityRun.java


Compare: https://github.com/Evolveum/midpoint/compare/98075f34903f...48522001113c

To unsubscribe from these emails, change your notification settings at https://github.com/Evolveum/midpoint/settings/notifications


More information about the midPoint-svn mailing list