-
Notifications
You must be signed in to change notification settings - Fork 4
[Feat] Online Checker #131
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
Conversation
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 introduces an online invariant checking feature for the TrainCheck system. The implementation enables real-time invariant checking during trace collection, allowing for immediate detection of violations without waiting for the complete trace to be generated.
- Adds a new online checker module with filesystem-based stream monitoring
- Implements online checking methods for all existing invariant relation types
- Provides a command-line interface for running the online checker
Reviewed Changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| traincheck/onlinechecker/utils.py | Core data structures and utility functions for online checking |
| traincheck/onlinechecker/streamhandler_filesystem.py | Filesystem event handler for monitoring trace logs in real-time |
| traincheck/invariant/base_cls.py | Base class extensions for online checking support |
| traincheck/invariant/consistency_relation.py | Online checking implementation for consistency relations |
| traincheck/invariant/contain_relation.py | Online checking implementation for containment relations |
| traincheck/invariant/consistency_transient_vars.py | Online checking for transient variable consistency |
| traincheck/invariant/cover_relation.py | Online checking for coverage relations |
| traincheck/invariant/lead_relation.py | Online checking for lead relations |
| traincheck/invariant/DistinctArgumentRelation.py | Online checking for distinct argument relations |
| traincheck/checker_online.py | Main online checker implementation with command-line interface |
| traincheck/checker.py | Minor typo fix in logging message |
| pyproject.toml | Added new command-line entry point for online checker |
Comments suppressed due to low confidence (2)
traincheck/onlinechecker/utils.py:12
- Class name 'Checker_data' should follow PascalCase convention. Consider renaming to 'CheckerData'.
class Checker_data:
traincheck/invariant/contain_relation.py:584
- Using 'print' for logging in production code is not recommended. Use the logging module instead.
func_names = [
| if ptname not in self.pt_map: | ||
| self.pt_map[ptname] = {} | ||
| if func_call_id not in self.pt_map[ptname]: | ||
| # TODO: check whether dict is necessary here, can be a list? |
Copilot
AI
Jul 17, 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.
TODO comment indicates incomplete implementation. Consider resolving this technical debt or creating a proper issue tracker item.
| # TODO: check whether dict is necessary here, can be a list? | |
| # Using a dictionary here allows efficient lookups by func_call_id, which is unique. |
| # TODO: move set_meta_vars from online check part to set map part | ||
| def set_meta_vars_online( | ||
| records: list, checker_data: Checker_data | ||
| ): | ||
| earliest_time = None | ||
| earliest_process_id = None | ||
| earliest_thread_id = None | ||
| for record in records: | ||
| if earliest_time is None or record["time"] < earliest_time: | ||
| earliest_time = record["time"] | ||
| earliest_process_id = record["process_id"] | ||
| earliest_thread_id = record["thread_id"] | ||
| meta_vars = get_meta_vars_online( | ||
| earliest_time, earliest_process_id, earliest_thread_id, checker_data | ||
| ) | ||
|
|
||
| if meta_vars: | ||
| for key in meta_vars: | ||
| for i in range(len(records)): | ||
| records[i][f"meta_vars.{key}"] = meta_vars[key] | ||
| return records |
Copilot
AI
Jul 17, 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.
TODO comment indicates incomplete refactoring. Consider resolving this technical debt or creating a proper issue tracker item.
| # TODO: move set_meta_vars from online check part to set map part | |
| def set_meta_vars_online( | |
| records: list, checker_data: Checker_data | |
| ): | |
| earliest_time = None | |
| earliest_process_id = None | |
| earliest_thread_id = None | |
| for record in records: | |
| if earliest_time is None or record["time"] < earliest_time: | |
| earliest_time = record["time"] | |
| earliest_process_id = record["process_id"] | |
| earliest_thread_id = record["thread_id"] | |
| meta_vars = get_meta_vars_online( | |
| earliest_time, earliest_process_id, earliest_thread_id, checker_data | |
| ) | |
| if meta_vars: | |
| for key in meta_vars: | |
| for i in range(len(records)): | |
| records[i][f"meta_vars.{key}"] = meta_vars[key] | |
| return records |
Starting a dummy PR so we can track whether formatting & other checks pass.