Skip to content

Conversation

@Essoz
Copy link
Collaborator

@Essoz Essoz commented Jul 17, 2025

Starting a dummy PR so we can track whether formatting & other checks pass.

@Essoz Essoz requested a review from Copilot July 17, 2025 06:08
@Essoz Essoz added the enhancement New feature or request label Jul 17, 2025
Copy link

Copilot AI left a 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?
Copy link

Copilot AI Jul 17, 2025

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.

Suggested change
# 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.

Copilot uses AI. Check for mistakes.
Comment on lines 254 to 274
# 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
Copy link

Copilot AI Jul 17, 2025

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.

Suggested change
# 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 uses AI. Check for mistakes.
@Essoz Essoz merged commit 3d05bef into main Jul 22, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants