Skip to content

fix: tolerate expert_op4grid_recommender's typed-pipeline return shape#183

Merged
marota merged 1 commit into
ainetus:mainfrom
marota:claude/expert-op4grid-refactor-bqy6jm
Jul 3, 2026
Merged

fix: tolerate expert_op4grid_recommender's typed-pipeline return shape#183
marota merged 1 commit into
ainetus:mainfrom
marota:claude/expert-op4grid-refactor-bqy6jm

Conversation

@marota

@marota marota commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

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

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>
@marota marota merged commit 8854c1b into ainetus:main Jul 3, 2026
11 checks passed
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