Skip to content

Conversation

@simpx
Copy link
Owner

@simpx simpx commented Sep 5, 2025

Summary

  • speed up pmo log by reading from file end like tail
  • add -n/--lines option and optional -f/--follow flag
  • document new flags and update tests

Testing

  • uv run pytest tests/test_advanced.py tests/test_cli.py tests/test_config.py tests/test_extends.py
  • uv run pytest tests/test_logs.py tests/test_process_monitoring.py tests/test_util.py tests/test_service_management.py
  • uv run pytest tests/test_integration.py -vv -s

https://chatgpt.com/codex/tasks/task_e_68ba3fa485688329a13b2d52196645a7

@simpx simpx requested a review from Copilot September 5, 2025 01:59
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 enhances the log command functionality by adding tail-style log reading for improved performance and new command-line options for better user control.

  • Replaces the --no-follow flag with a more intuitive -f/--follow flag
  • Adds a -n/--lines option for specifying the number of log lines to display
  • Implements efficient tail-style log reading using binary file operations

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pmo/cli.py Updates argument parser to use -f/--follow and -n/--lines flags
pmo/logs.py Implements efficient binary file reading for tail functionality
tests/test_cli.py Updates test cases to use new follow parameter instead of no_follow
tests/test_integration.py Updates integration test to use new follow parameter
README.md Documents the new -f and -n flags for the logs command

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

read_size = min(block_size, pointer)
pointer -= read_size
file.seek(pointer)
buffer[:0] = file.read(read_size)
Copy link

Copilot AI Sep 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The slice assignment buffer[:0] = is not immediately clear. Consider using buffer = file.read(read_size) + buffer or adding a comment explaining that this prepends data to the buffer.

Suggested change
buffer[:0] = file.read(read_size)
buffer = file.read(read_size) + buffer # Prepend read data to buffer

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants