fix: tolerate expert_op4grid_recommender's typed-pipeline return shape#183
Merged
Merged
Conversation
The upstream expert_op4grid_recommender typed-pipeline refactor (R1, 0.2.7) replaced run_analysis_step1's (res_step1, context) 2-tuple with a single AnalysisContext (proceed) or AnalysisResult (no-overload short-circuit). AnalysisMixin.run_analysis_step1 now normalises both shapes via _normalize_step1_outcome, so the backend keeps working against both the legacy and the refactored recommender releases (same version-tolerance pattern as _upstream_step1_supports_prebuilt_obs). The new AnalysisContext / AnalysisResult dataclasses expose a dict-compatible view, so every context[...] / result.get(...) access in the service layer is unchanged. Verified against the real refactored recommender: this fixes the two tests that drive the live step1 (test_step1_detects_single_overload, test_step2_returns_prioritized_action_set) with zero regressions across the backend suite. Also: annotate _normalize_step1_outcome's return type (backend code-quality ratchet: 61 -> 60), and add expert_backend/tests/test_step1_outcome_normalization.py covering the tuple / isinstance / structural-fallback paths and the service-level short-circuit-vs-proceed decision (real-dataclass cases skip under the mock layer). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LGzwaP2SnQCbLKo4ZNuwSg Signed-off-by: Antoine Marot <amarot91@gmail.com>
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.
The upstream expert_op4grid_recommender typed-pipeline refactor (R1, 0.2.7) replaced run_analysis_step1's (res_step1, context) 2-tuple with a single AnalysisContext (proceed) or AnalysisResult (no-overload short-circuit).
AnalysisMixin.run_analysis_step1 now normalises both shapes via _normalize_step1_outcome, so the backend keeps working against both the legacy and the refactored recommender releases (same version-tolerance pattern as _upstream_step1_supports_prebuilt_obs). The new AnalysisContext / AnalysisResult dataclasses expose a dict-compatible view, so every context[...] / result.get(...) access in the service layer is unchanged.
Verified against the real refactored recommender: this fixes the two tests that drive the live step1 (test_step1_detects_single_overload, test_step2_returns_prioritized_action_set) with zero regressions across the backend suite.
Also: annotate _normalize_step1_outcome's return type (backend code-quality ratchet: 61 -> 60), and add
expert_backend/tests/test_step1_outcome_normalization.py covering the tuple / isinstance / structural-fallback paths and the service-level short-circuit-vs-proceed decision (real-dataclass cases skip under the mock layer).
Claude-Session: https://claude.ai/code/session_01LGzwaP2SnQCbLKo4ZNuwSg