Skip to content

Frame and encode the dependency plan's output against stdout noise - #74

Open
morisil wants to merge 2 commits into
mainfrom
issue-60-plan-output-framing
Open

morisil wants to merge 2 commits into
mainfrom
issue-60-plan-output-framing

Conversation

@morisil

@morisil morisil commented Nov 11, 2026

Copy link
Copy Markdown
Member

Fixes #60

PLAN's result is no longer parsed from its standard output line by line, where stdout noise without a trailing newline (from a sitecustomize or .pth file) glued to the first entry and dropped it.

  • PLAN writes its entries framed the way the environment probe does: between begin/end marker lines, after a leading newline, flushing the Python streams first and writing the bytes directly to file descriptor 1 — so a replaced or None sys.stdout doesn't matter.
  • One Python snippet, FRAMED_WRITER, now writes the frame for both the probe and PLAN, and one Kotlin framedOutput reads it for both.
  • Each entry is written as the hex of its UTF-8 bytes, so no requirement content can break the format: a newline inside a URL (accepted by packaging) no longer splits into a bogus entry, and a requirement containing the end marker no longer cuts the plan short.
  • A missing or malformed frame fails with a clear PythonDependencyException naming the unexpected output, capped like the probe's (shared limitOutput).

Review

1 round — no blocking findings. The review's polish was applied before this PR: hex-encoded entries and the None-stream guard (both fixing pre-existing variants on main, hence fixed here instead of filed), the shared writer, the message cap, a less brittle failure test, KDoc.

Merge note

Independent of the open #70 (#25) and the coming #6 stack, but all of them change the PLAN script: whichever is merged later needs main merged in — expect conflicts at the first and last lines of PLAN (FRAMED_WRITER + """ and the write_framed(...) call), and in plan() parsing (#6 adds an installed entry kind).

🤖 Generated with Claude Code

https://claude.ai/code/session_01FJmHQ3jHRbVdpwUiNUkApG

morisil and others added 2 commits November 11, 2026 20:30
PLAN writes its lines between begin/end marker lines, after a leading
newline, flushing sys.stdout first and writing the bytes to the original
standard output, like the environment probe, so that output of a
sitecustomize module or a .pth file without a trailing newline no longer
glues to the first line of the plan and drops a requirement.
The frame parsing of the probe is extracted into framedOutput and reused;
a missing frame fails with a PythonDependencyException.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJmHQ3jHRbVdpwUiNUkApG
…probe (#60)

Each plan entry is written as the hex digits of its UTF-8 bytes, so a
requirement with a line break, e.g. within its URL, accepted by packaging,
or containing the end line of the plan, can no longer split or cut off
the plan. The framed writer is one Python snippet, FRAMED_WRITER, shared by
the probe and PLAN; it writes to file descriptor 1 directly, so that a
sys.stdout or sys.__stdout__ of None no longer crashes it. The output in
the message of a missing plan is limited, like the error of the probe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FJmHQ3jHRbVdpwUiNUkApG
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.

PLAN output parsed line by line breaks on stdout noise without a trailing newline

1 participant