Skip to content

refactor: the pod failure analysis checks each container in two flat steps - #460

Merged
HardMax71 merged 1 commit into
mainfrom
max/analyze-failure-complexity
Oct 23, 2026
Merged

HardMax71 merged 1 commit into
mainfrom
max/analyze-failure-complexity

Conversation

@HardMax71

@HardMax71 HardMax71 commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

The last SonarCloud issue from #459 that wasn't a false positive: PodEventMapper._analyze_failure scores a cognitive complexity of 22 against the allowed 15 (issue). #459 replaced its two getattr calls but didn't flatten it.

Changes

The waiting reasons become a module constant instead of a dict built for each container, and each container's state is read once, so the checks sit one level deep. Messages and error types stay the same, including both default messages.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/CD or tooling changes

Test Plan

  • Backend unit tests pass (cd backend && uv run pytest tests/unit)
  • Frontend unit tests pass (cd frontend && npm run test)
  • Backend E2E tests pass (docker compose exec -T backend sh -c 'uv sync --group test --no-dev --frozen --no-install-project --no-build && pytest tests/e2e')
  • Frontend E2E tests pass (cd frontend && npm run test:e2e)
  • API spec and client regenerated if routes or schemas changed (uv run python -m scripts.export_openapi in backend/, then npm run generate:api in frontend/), never edited by hand
  • Manual testing performed

Validation: complexipy measures 13 (it measured 18 before), ruff and strict mypy pass, and the 44 pod monitor unit tests pass, test_analyze_failure_variants included.

Checklist

  • My code follows the project's style guidelines
  • I have run pre-commit run --all-files and all checks pass
  • I have added tests that prove my fix/feature works
  • I have updated documentation if needed
  • My changes don't introduce new warnings

Summary by cubic

Refactors pod failure analysis so its cognitive complexity drops from 22 to 13, under SonarCloud's limit of 15. The waiting-reason mapping is now a module constant instead of a dict built per container, and each container's state is read once so the checks sit one level deep. Behavior, messages, and error types are unchanged; all 44 pod monitor unit tests pass.

Written for commit d05ede2. Summary will update on new commits.

View guided diff Turn on auto-fix

…steps

The last SonarCloud complexity finding (22 against the allowed 15). The waiting reasons become a module constant instead of a dict built per container, and a container's state is read once; complexipy measures 13. Behavior and messages are unchanged; the 44 pod monitor unit tests pass.
@HardMax71
HardMax71 enabled auto-merge (squash) October 23, 2026 20:13
@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 28689345-7241-47bc-bfa3-2f6674d9bba0
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the area: execution Queue, scheduler, k8s worker, pod monitor, result processor, executor pods, runtimes label Oct 23, 2026
@sonarqubecloud

Copy link
Copy Markdown

@codecov-commenter

codecov-commenter commented Oct 23, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
backend/app/services/pod_monitor/event_mapper.py 85.71% 2 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Flag Coverage Δ
backend-e2e 82.08% <7.14%> (+0.04%) ⬆️
backend-unit 77.82% <85.71%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
backend/app/services/pod_monitor/event_mapper.py 91.07% <85.71%> (-0.08%) ⬇️
Components Coverage Δ
Backend 94.73% <85.71%> (-0.01%) ⬇️
Frontend 92.25% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@HardMax71
HardMax71 merged commit 384f503 into main Oct 23, 2026
23 checks passed
@HardMax71
HardMax71 deleted the max/analyze-failure-complexity branch October 23, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: execution Queue, scheduler, k8s worker, pod monitor, result processor, executor pods, runtimes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants