Fix CI collection error and improve build hygiene#63
Fix CI collection error and improve build hygiene#63heidi-dang wants to merge 3 commits intomainfrom
Conversation
…ension is missing
- Use `pytest.importorskip("heidi_cpp")` in `tests/test_core_integration.py` to handle missing C++ extension.
- Update `.gitignore` to ignore C++ build artifacts (`build/`, `*.so`, etc.).
- Replace deprecated `datetime.utcnow()` with `datetime.now(timezone.utc)` in `heidi_engine/state_machine.py`.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Summary of ChangesHello @heidi-dang, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly improves the project's stability and maintainability. It eliminates a persistent CI failure on macOS by making test collection more robust to platform-specific dependencies. Additionally, it cleans up the repository by ignoring C++ build outputs and updates core code to use modern, timezone-aware datetime practices, resolving deprecation warnings and enhancing overall code quality. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request successfully addresses the CI collection failures on macOS by using pytest.importorskip for the C++ extension and improves build hygiene with updated .gitignore rules. The transition to datetime.now(timezone.utc) in state_machine.py is a positive step towards modernizing the codebase, although it introduces a minor inconsistency in timestamp formatting compared to other parts of the system and some redundant logic in state initialization.
heidi_engine/state_machine.py
Outdated
| "started_at": datetime.now(timezone.utc).isoformat(), | ||
| "updated_at": datetime.now(timezone.utc).isoformat(), |
There was a problem hiding this comment.
The switch to datetime.now(timezone.utc).isoformat() correctly avoids the deprecation of utcnow(), but it changes the string format by adding a timezone offset (e.g., +00:00). This creates an inconsistency with heidi_engine/telemetry.py, which still uses the offset-less utcnow() format, leading to mixed timestamp styles in state.json. Consider updating telemetry.py as well or using .replace(tzinfo=None) to maintain the existing format. Additionally, calling now() twice here is redundant, particularly as _persist() (called on line 169) will immediately overwrite updated_at with a new timestamp.
- Fix CI collection error by skipping `heidi_cpp` and `heidid` tests when components are missing. - Add `setpgid(0, 0)` in `subprocess.cpp` to correctly support `killpg` for timeouts. - Fix use-after-free risk in `Daemon` by using joinable thread and atomic flag. - Replace deprecated `datetime.utcnow()` with `datetime.now(timezone.utc)` codebase-wide. - Update `.gitignore` to include C++ build artifacts.
- Fix CI collection error by skipping `heidi_cpp` and `heidid` tests when components are missing. - Add `setpgid(0, 0)` in `subprocess.cpp` to correctly support `killpg` for timeouts. - Fix use-after-free risk in `Daemon` by using joinable thread and atomic flag. - Replace deprecated `datetime.utcnow()` with `datetime.now(timezone.utc)` and standardized on ISO8601 with `Z` suffix and millisecond precision. - Update `.gitignore` to include C++ build artifacts.
This PR fixes a recurring CI failure in GitHub Actions where the
macos-latestrunner fails with Exit Code 2 during test collection. The failure was caused by an unconditionalimport heidi_cppintests/test_core_integration.pywhile the C++ extension is only built on Linux.Changes:
tests/test_core_integration.pyto usepytest.importorskip("heidi_cpp"). This allows pytest to gracefully skip the module during collection if the extension is not found, matching the intended behavior on non-Linux platforms..gitignoreto include C++ build artifacts (build/,*.so,*.o, etc.) to prevent accidental commits and maintain repository cleanliness.heidi_engine/state_machine.pyto usedatetime.now(timezone.utc)instead of the deprecateddatetime.utcnow(), resolving several deprecation warnings observed during test execution.Verified locally by running
pytest -vboth with and without the C++ extension built.PR created automatically by Jules for task 5516841422681149426 started by @heidi-dang