Private
Public Access
Merge branch 'tier2/phase2_4_5_call_site_completion_20260621' into tier2/code_path_audit_20260607
This commit is contained in:
@@ -193,6 +193,36 @@ class LogRegistry:
|
||||
self.data[session_id]['whitelisted'] = whitelisted
|
||||
self.save_registry() # Save after update
|
||||
|
||||
def set_session_start_time(self, session_id: str, start_time: datetime | str) -> None:
|
||||
"""
|
||||
Updates the start_time of an existing session.
|
||||
|
||||
Used by tests and maintenance tools to backdate a session for pruning
|
||||
verification. Creates a new Session with the updated start_time while
|
||||
preserving all other fields (Session is frozen).
|
||||
|
||||
Args:
|
||||
session_id (str): Unique identifier for the session.
|
||||
start_time (datetime|str): The new start timestamp.
|
||||
[C: tests/test_logging_e2e.py:test_logging_e2e]
|
||||
"""
|
||||
if session_id not in self.data:
|
||||
print(f"Error: Session ID '{session_id}' not found for start_time update.")
|
||||
return
|
||||
if isinstance(start_time, datetime):
|
||||
start_time_str: str = start_time.isoformat()
|
||||
else:
|
||||
start_time_str = start_time
|
||||
existing = self.data[session_id]
|
||||
self.data[session_id] = Session(
|
||||
session_id=existing.session_id,
|
||||
path=existing.path,
|
||||
start_time=start_time_str,
|
||||
whitelisted=existing.whitelisted,
|
||||
metadata=existing.metadata,
|
||||
)
|
||||
self.save_registry()
|
||||
|
||||
def is_session_whitelisted(self, session_id: str) -> bool:
|
||||
"""
|
||||
Checks if a specific session is marked as whitelisted.
|
||||
|
||||
Reference in New Issue
Block a user