Skip to content

refactor: [PRODUCT-465] use logs2 instead of logs REST endpoint#166

Merged
sigmachirality merged 4 commits into
mainfrom
dt/switch-to-vm2
Jul 15, 2025
Merged

refactor: [PRODUCT-465] use logs2 instead of logs REST endpoint#166
sigmachirality merged 4 commits into
mainfrom
dt/switch-to-vm2

Conversation

@sigmachirality
Copy link
Copy Markdown
Member

Reimplement vm logs using v0/logs2 instead of v0/logs.

@semanticdiff-com
Copy link
Copy Markdown

semanticdiff-com Bot commented Jul 15, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  src/lib/vm.ts  27% smaller

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR refactors the VM logs functionality to use a new /v0/vms/logs2 endpoint, representing a significant improvement in robustness and type safety. The changes include:

  • Migration from timestamp-based to sequence-number-based log following
  • Implementation of proper UTF-8 decoding with incomplete line handling
  • Integration with strongly-typed API responses using generated types
  • Required instance ID parameter for better UX
  • RFC3339 timestamp validation

This change aligns with modern TypeScript practices by leveraging generated types from schema.ts, which provides better compile-time checking and API contract adherence. The new chunk processing logic with TextDecoder is particularly noteworthy as it properly handles UTF-8 encoded binary data and incomplete log lines across chunks, fixing potential character encoding issues that could exist in the previous implementation.

Confidence score: 4/5

  1. This PR is safe to merge with proper testing of log retrieval scenarios
  2. High score due to improved type safety, better error handling, and proper text encoding, but held back one point due to the complexity of log processing logic that could benefit from additional test coverage
  3. Files needing attention:
    • src/lib/vm.ts: Focus on testing the new chunk processing logic and sequence-number-based following mechanism

1 file reviewed, 2 comments
Edit PR Review Bot Settings | Greptile

Comment thread src/lib/vm.ts Outdated
Comment thread src/lib/vm.ts Outdated
sigmachirality and others added 3 commits July 14, 2025 18:58
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@sigmachirality sigmachirality self-assigned this Jul 15, 2025
@sigmachirality sigmachirality merged commit 816a20f into main Jul 15, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant