-
Notifications
You must be signed in to change notification settings - Fork 0
Implement persistent and scoped environment variable management #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- Added `EnvPersistent` class for managing persistent environment variables across different levels (process, user, system) with platform-specific implementations for Windows and Unix-like systems. - Introduced `EnvScoped` class for temporary environment variable management, ensuring original values are restored upon destruction. - Developed utility functions in `EnvUtils` for expanding environment variables, comparing and merging environment variable sets. - Implemented system information retrieval in `EnvSystem`, including home directory, temporary directory, configuration directory, data directory, system name, architecture, current user, and hostname. - Created a basic Python script for testing and a build script for optimized test components. - Added a command interface test to validate command execution, availability, and history management.
for more information, see https://pre-commit.ci
…ctor addition refactor(fnmatch): Simplify regex match call by removing unnecessary string conversion
- Implemented tests for the Thread class covering basic functionality, exception handling, stop token signaling, and thread management methods. - Added tests for parallel_for_each_optimized to validate its behavior with various data types, concurrency scenarios, and edge cases. - Included tests for OptimizedTask, CacheAligned, SpinLock, RWSpinLock, and SPSCQueue to ensure thread safety and performance. - Ensured coverage for both normal and exceptional cases, including empty ranges and single-element scenarios. - Verified correct handling of exceptions in tasks and the behavior of synchronization primitives under concurrent access.
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors and modernizes the atom::async library by streamlining implementations, integrating spdlog for diagnostics, and leveraging C++20 features for concurrency.
- Added comprehensive logging and error handling in ThreadSafeQueue, ThreadPool, MessageBus, and other utilities.
- Overhauled
PackagedTaskto use an intrusive lock-free continuation list and improved future handling. - Refactored Debounce/Throttle for jthread-based scheduling, replaced raw thread creation in limiter with parallel algorithms, and consolidated LockFactory creation.
Reviewed Changes
Copilot reviewed 55 out of 1007 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| atom/async/queue.hpp | Simplified lock implementations, switched to atomic flags, cleaned padding |
| atom/async/pool.hpp | Introduced global/local task queues, extensive spdlog logging |
| atom/async/parallel.hpp | Switched to jthread+latch patterns for parallel algorithms |
| atom/async/packaged_task.hpp | Replaced EnhancedPackagedTask with PackagedTask using lock-free continuations |
| atom/async/message_queue.hpp | Swapped remove_if/erase with std::erase_if, added logging |
| atom/async/message_bus.hpp | Cleaned includes, enhanced publish logic, detailed logging |
| atom/async/lodash.hpp | Reimplemented Debounce/Throttle with jthread timers |
| atom/async/lock.hpp and lock.cpp | Consolidated LockFactory via template helper, cleaned includes |
| atom/async/limiter.cpp | Replaced per-waiter pthread creation with parallel unsequenced for_each |
Comments suppressed due to low confidence (4)
atom/async/queue.hpp:620
- The
groupBymethod has its implementation entirely commented out and unconditionally returns an empty vector, disabling its intended functionality. Either restore a correct grouping implementation or remove the stub to avoid confusion and broken behavior.
return {};
atom/async/lodash.hpp:96
- The expression
timer_thread_.request_stop()returns void and cannot be evaluated in a boolean context. You should calltimer_thread_.request_stop();on its own, then checkjoinable()to decide whether to start a new thread.
scheduled_time_ =
atom/async/lodash.hpp:508
- Similar to the debounce logic,
trailing_thread_.request_stop()returns void and must not be used in a boolean expression. Separate the call torequest_stop()from theifcondition and rely onjoinable()or a flag to determine thread creation.
if (trailing_) {
atom/async/message_bus.hpp:1314
- [nitpick] The commented-out
#include <deque>is dead code. Removing unused include directives improves readability and reduces confusion about dependencies.
mutex_; // For subscribers_, messageHistory_, namespaces_, nextToken_
| @@ -1369,56 +1623,85 @@ class ThreadPool { | |||
| workers_.size() > options_.initialThreadCount) { | |||
| // If idle time exceeds threshold and current thread | |||
| // count exceeds initial count | |||
| spdlog::info( | |||
| "Worker {} idle timeout, considering termination.", | |||
| id); | |||
Copilot
AI
Jul 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Emitting a debug log on every task retrieval in a hot path can seriously degrade throughput under load. Consider guarding this with a verbosity check or rate-limiting logs to avoid performance penalties.
- Implemented tests for database connection, query execution, and data manipulation. - Added tests for parameterized queries, data retrieval, and error handling. - Included tests for transactions, validation, and pagination of results. - Verified behavior for edge cases such as non-existent tables and invalid queries. - Ensured proper cleanup of test database files after each test run.
for more information, see https://pre-commit.ci
- Replaced all loguru logging statements with spdlog equivalents in async.cpp and utils.cpp. - Enhanced log messages for clarity and detail, ensuring they accurately describe events and errors. - Initialized spdlog file logger in utils.cpp for consistent logging output. - Removed unnecessary comments and improved code organization for better readability and maintainability.
- Implemented comprehensive tests for UdpSocketHub, covering start/stop cycles, port validation, message handling, and error scenarios. - Added tests for circular_buffer and chunked_deque, including constructors, push/pop operations, access methods, and move semantics. - Utilized Google Test and Google Mock for structured testing and verification of expected behaviors.
- Implemented tests for async socket hub, including connection management, message sending/receiving, and group management. - Added tests for async TCP client, covering connection states, data transfer, and error handling. - Created tests for async UDP client, focusing on sending/receiving data, multicast, and error scenarios. - Introduced SSL tests for both TCP and UDP clients to ensure secure connections. - Utilized mock servers to simulate network behavior for thorough testing.
for more information, see https://pre-commit.ci
|
- Modified search module files (cache.hpp, lru.hpp, mysql.cpp/hpp, search.cpp/hpp, sqlite.hpp, ttl.hpp) - Added new test files and improvements across multiple modules - Enhanced ASIO, Beast, and other components with new features
for more information, see https://pre-commit.ci
- Updated include paths for platform-specific headers in os.cpp and os.hpp to use a unified "platform" directory structure. - Modified battery_formatter.hpp to include the common battery header from the correct path. - Refactored CPU cache formatting logic in cpu_formatter.cpp to use updated cache size variable names. - Renamed LocaleFormatter to LocaleInfoFormatter and updated method signatures for consistency in locale_formatter.cpp and locale_formatter.hpp. - Adjusted memory_formatter.cpp to reflect changes in memory slot variable names. - Enhanced printer.hpp to import BatteryInfo type from the battery submodule. - Updated base_report.cpp to use the new battery information retrieval method. - Added platform-specific source files in CMakeLists.txt for serial, virtual, wifi, and wm modules. - Improved include paths in various source files to maintain consistency across platform-specific implementations. - Refactored cron_manager.cpp to enhance job management logic, including better handling of job execution and failure scenarios. - Updated Env class methods to return boolean results based on operation success. - Simplified build.py to streamline CMake build type configuration.
- Updated tests in memory and search modules to utilize shared_ptr instead of unique_ptr for object management. - Changed method names in tests to follow a consistent naming convention (e.g., asyncGet to async_get). - Improved test assertions for clarity and consistency. - Modified object pool tests to accommodate changes in object creation and management. - Enhanced boolean search tests to utilize the new enhanced search method. - Updated various tests to ensure compatibility with recent changes in the underlying codebase.
…ules - algorithm: enhance Boyer-Moore logging and matching behavior; add XTEA/XXTEA span APIs; fix DFT/IDFT async recursion; simplify good-suffix shift; capture values in annealing schedule and add iteration logs; add fnmatch template instantiations - matrix: add complex type trait and unify complex handling - sha1: inline bytesToHex implementation in header - snowflake: add copyable StatisticsSnapshot - memory: stabilize memory_pool (disable prefetch/timing, lock-free path fixes), fix object pool deleter lifecycle, prevent ring deadlocks and add atomic index updates - search: extend ResourceCache API (expiry checks, async load, file IO, camelCase aliases, deferred cleanup), unify expiration semantics; extend LRU cache API (templated TTL, batch put, pop LRU, aliases) - TTL cache: rename CacheConfig to TTLCacheConfig; add stats copy/assign; expose force_cleanup; adjust config APIs - type: Args operator[] throws on missing key; CountingHashTable adds global mutex and safer concurrency; cstream adds empty checks; qvariant improves cross-type copy ctor; clipboard removes redundant constexpr - utils: UUID adds C++17 byte-array ctor; error_stack replaces ranges contains - build/tests: enable testing in roots; update test CMake to register with CTest and link gmock; adjust tests to new APIs, flakiness, and timings; exclude problematic tests temporarily BREAKING CHANGE: TTL cache config renamed to TTLCacheConfig and related method signatures updated
for more information, see https://pre-commit.ci
- Introduced `reorganize_tests.py` to analyze and restructure test directories for C++ and Python modules. - Implemented functionality to create missing directories, organize orphaned files, and generate test templates. - Added `test_system_status.py` to display the status of the testing and coverage system, including dependencies and directory structure. - Created `unified_coverage.py` for generating unified coverage reports for both C++ and Python, including HTML and JSON outputs. - Updated `README.md` in the tests directory to document the test structure and running procedures. - Added CMakeLists.txt files for error and log modules to facilitate test execution.
for more information, see https://pre-commit.ci
…nd detailed usage instructions
for more information, see https://pre-commit.ci
- Introduced `CrossPlatformSupport.cmake` for enhanced platform detection and configuration. - Implemented `install.py` for cross-platform dependency installation and build optimization. - Created CMakeLists for various test modules to integrate GoogleTest framework. - Developed `run_all_tests.sh` script for building and executing all test modules with error handling. - Added platform-specific library detection and configuration in CMake. - Enhanced logging and user feedback in installation and test scripts.
for more information, see https://pre-commit.ci
- Implemented extensive unit tests for AdvancedExecutor functionality, covering command execution, cancellation, environment variable handling, and resource management. - Added tests for Cron components including CronCache, CronMonitor, and CronSecurity, focusing on caching operations, event logging, permission checking, and security audits. - Included integration tests to validate interactions between Cron components, ensuring proper job execution and security violation handling.
for more information, see https://pre-commit.ci




This pull request introduces significant enhancements to the build system of the Atom project, including updates to CI/CD workflows, build configuration options, and documentation. The most important changes focus on improving build automation, expanding platform and feature support, and refining developer-facing tools and presets.
CI/CD Workflow Enhancements:
.github/workflows/build.yml: Added a comprehensive GitHub Actions workflow supporting matrix builds across Linux, macOS, and Windows platforms, Python package builds, documentation generation, and release deployment. Includes caching, system dependency setup, and artifact management.Build System Improvements:
CMakeLists.txt: Changed the default value ofATOM_BUILD_TESTStoON, ensuring tests are built by default.CMakePresets.json: Introduced new hidden configuration presets (e.g.,_features-config,_optimization-config,_sanitizer-config) and public build presets (e.g.,debug-full,release-optimized,python-dev,minimal) to streamline build customization and optimize performance. EnabledCMAKE_COLOR_DIAGNOSTICSfor better output readability. [1] [2] [3] [4]Documentation Updates:
BUILD_SYSTEM.md: Added detailed documentation for the enhanced build system, including quick start guides, supported build systems, advanced features, and troubleshooting tips. This document serves as a comprehensive guide for developers.Python Support:
.python-version: Updated to include Python 3.12, ensuring compatibility with the latest Python version.These changes collectively improve the Atom project's build system, making it more robust, developer-friendly, and suitable for diverse development scenarios.- Added
EnvPersistentclass for managing persistent environment variables across different levels (process, user, system) with platform-specific implementations for Windows and Unix-like systems.EnvScopedclass for temporary environment variable management, ensuring original values are restored upon destruction.EnvUtilsfor expanding environment variables, comparing and merging environment variable sets.EnvSystem, including home directory, temporary directory, configuration directory, data directory, system name, architecture, current user, and hostname.