Skip to content
This repository was archived by the owner on Oct 23, 2026. It is now read-only.

feat(init): add bounded stateless file reads - #1437

Merged
betegon merged 3 commits into
mainfrom
feat/init-read-files-v2
Aug 18, 2026
Merged

betegon merged 3 commits into
mainfrom
feat/init-read-files-v2

Conversation

@betegon

@betegon betegon commented Aug 18, 2026 •

Copy link
Copy Markdown
Member

Summary

This is the CLI half of bounded, stateless read-files support for sentry init.

  • add an opt-in V2 response with one structured content/error result per requested path
  • accept startLine, maxLines, and maxBytes in the request, but return no cursor, file version, or continuation state
  • return complete lines only; callers can issue another independent range read or use grep when they need different evidence
  • cap all returned content across the request at 40 KB and bound deep line lookup at 4 MiB
  • read from an open descriptor with containment, regular-file, identity, stability, UTF-8, binary, symlink-target, and sensitive-path checks
  • preserve the existing V1 response shape for older API deployments

Compatibility

The protocol is negotiated per request. An older API never asks for V2, so this CLI keeps returning the V1 shape. A newer API accepts V1 from older CLI releases and treats ambiguous truncation conservatively.

Companion API PR: https://github.com/getsentry/cli-init-api/pull/234

Test plan

  • pnpm --filter sentry typecheck
  • focused filesystem suite: 17 tests
  • focused Biome check for the three changed files
  • pnpm test:unit: changed tests pass; the full run retains two unrelated completion-simulation failures from the local shell environment
  • git diff --check

@vercel

vercel Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cli Ready Ready Preview Aug 18, 2026 1:52pm

Request Review

@betegon betegon changed the title feat(init): read files by byte range feat(init): add bounded stateless file reads Aug 18, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 480863a. Configure here.

@betegon
betegon merged commit 10fe565 into main Aug 18, 2026
32 checks passed
@betegon
betegon deleted the feat/init-read-files-v2 branch August 18, 2026 14:32

This branch was successfully deployed

1 active deployment
Preview — 77306f24 Deployed Aug 18, 2026 by vercel[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant