Skip to content

chore: Add prek to testing workflows and frontend files - #607

Merged
tykeal merged 28 commits into
FutureTense:mainfrom
firstof9:chore/add-pre-commit-checks
May 14, 2026
Merged

tykeal merged 28 commits into
FutureTense:mainfrom
firstof9:chore/add-pre-commit-checks

Conversation

@firstof9

@firstof9 firstof9 commented May 12, 2026 •

Copy link
Copy Markdown
Collaborator

Overview

This PR focuses on stabilizing the keymaster integration by addressing critical race conditions during teardown, modernizing the CI/CD pipeline, and resolving long-standing test coverage gaps in both the backend (Python) and frontend (TypeScript) codebases.

Changes

🛠️ Backend Stabilization & Cleanup

  • Coordinator Reliability: Fixed a race condition in coordinator.py where rapid integration reloads could trigger multiple overlapping deletion attempts. Implemented a pending_delete state guard and ensured async_shutdown properly cancels all active refresh timers.
  • Persistent Storage Hardening: Updated TimerStore in autolock/store.py to defensively handle naive datetime strings by explicitly interpreting them as UTC, ensuring consistency with the rest of the integration.
  • Coverage Completion: Added targeted unit tests to achieve 100% coverage for all recently added logic in coordinator.py and store.py.

🎨 Lovelace Strategy (Frontend) Improvements

  • Refined Logic: Refactored the dashboard strategy logic into testable modules and resolved various TypeScript type inconsistencies.
  • Unit Testing Suite: Implemented a comprehensive Vitest-based testing suite for the frontend.
    • Added coverage for section-strategy.ts (error handling and initialization states).
    • Added coverage for slugify.ts (edge cases and special characters).
  • Linting & Quality: Resolved all ESLint no-explicit-any errors and standardized type casting across the strategy components.

🚀 CI/CD & Environment

  • Python Baseline: Transitioned testing and configuration from Python 3.13 to 3.14 to align with current Home Assistant development standards.
  • Pre-commit Integration: Added and fully configured a pre-commit pipeline including:
    • ruff (linting and formatting)
    • mypy (static type checking)
    • codespell (spelling)
    • actionlint (GitHub Actions validation)
    • eslint & tsc (TypeScript validation)

Testing Status

  • All backend unit tests passing (pytest)
  • Frontend unit tests implemented (vitest)
  • Pre-commit hooks verified and passing
  • Critical path coverage at 100% for stabilization patches

@github-actions github-actions Bot added the chore Code chores (dependency updates, etc) label May 12, 2026
@firstof9
firstof9 requested a review from tykeal May 12, 2026 23:32
@firstof9
firstof9 marked this pull request as draft May 12, 2026 23:34

@tykeal tykeal left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've got more comprehensive workflows and pre-commit config with Rental Control if you want me to try and port them in...

Comment thread .github/workflows/pytest.yaml Resolved
Comment thread .github/workflows/pytest.yaml Resolved
Comment thread .github/workflows/pytest.yaml Resolved
Comment thread .github/workflows/vitest.yaml Resolved
Comment thread .prek.yaml Resolved
@firstof9 firstof9 changed the title chore: Add pre-commit to testing workflows and frontend files chore: Add prek to testing workflows and frontend files May 13, 2026
firstof9 added 8 commits May 12, 2026 17:57
- Fix mypy issues in coordinator and tests
- Fix markdown linting in PROVIDERS.md
- Apply ruff formatting to test_base.py
- Add yarn install to prek CI jobs for tsc resolution
- Pin all GitHub actions to SHAs
- Corrected HACS and Hassfest action SHAs
- Fixed invalid ignoreDeprecations value in tsconfig.json
- Update moduleResolution to 'bundler' to resolve vite/vitest types
- Cast mock config to any in view-strategy.test.ts
@codecov-commenter

codecov-commenter commented May 13, 2026 •

Copy link
Copy Markdown

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

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@2d54f4c). Learn more about missing BASE report.
⚠️ Report is 65 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #607   +/-   ##
=======================================
  Coverage        ?   87.44%           
=======================================
  Files           ?       39           
  Lines           ?     3814           
  Branches        ?       30           
=======================================
  Hits            ?     3335           
  Misses          ?      479           
  Partials        ?        0           
Flag Coverage Δ
python 87.14% <100.00%> (?)
typescript 100.00% <100.00%> (?)

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

@firstof9
firstof9 requested a review from tykeal May 13, 2026 14:09
@firstof9
firstof9 marked this pull request as ready for review May 13, 2026 14:09
@firstof9

Copy link
Copy Markdown
Collaborator Author

I think all the holes are plugged now.

@firstof9
firstof9 requested a review from raman325 May 13, 2026 17:21
@tykeal
tykeal merged commit baaaba8 into FutureTense:main May 14, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Code chores (dependency updates, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants