Fix: the flag message run gets wrong, and five contracts documented wrong - #64
Merged
Conversation
โฆrong The last five findings from the nine-language translation dogfood. Each was re-verified independently, and the question asked of every one was code or documentation. All five confirmed; four are documentation. rank4 run bounds clean_output and raw_output into different windows DOCS rank6 --grep help names a match surface it does not have DOCS rank7 the unknown-flag message misdiagnoses a space-separated value CODE rank9 omitted_bytes reconciles only on ASCII DOCS rank10 --max-output does not bound screen DOCS The one code change: `run --timeout 5 -- echo hi` said "Unknown option: --timeout ... put the command first or use a separator", which is wrong three ways โ it calls a flag rune owns Unknown, asserts a position error when the flag was already before the separator, and its remedy hands --timeout to the child instead of applying a timeout. It now names the real problem. The known-flag set derives from FLAG_PATTERNS, because a hand-maintained list is exactly what let --context ship accepted-and-ignored. I predicted rank4 would need code and was wrong. The per-field budget is a stated contract in four places โ the flag says "BYTES each" โ and a caller sizing a context window wants both fields under the cap. What was missing is any statement of the consequence: a pty turns \n into \r\n and raw keeps its escapes, so the same budget lands at different points and clean_output is not strip_ansi(raw_output). At --max-output=200 on a 5,200-byte fixture, metadata said 5000 and raw's own marker said 5070; with colour, a whole line of the child's output was in one field and absent from the other. Not fixed, each because the fix measured worse than the limitation: deriving clean from bounded raw cuts readable payload by the ANSI fraction on every colour-emitting child; grepping the screen loses scrollback, which is why --grep exists (39 of 200 lines were on screen); making omitted_bytes reconcile means discarding a split character's fragment, contradicting the scrub invariant; and rendering only the bounded bytes paints a discarded frame plus rune's own elision marker into the child's screen, losing 9 of 10 answers. Controls: the inline-value branch removed fails 3 of 4 tests. The drift guard fired unplanned on the first run โ the work order said to derive the set from FLAG_PATTERNS.keys plus --separate-streams, and that flag is boolean, so "give the value inline" is nonsense for it and the parser consumes it before this path anyway. The set is the value-taking flags only, and a test now pins that a boolean flag still works. 573 examples, 0 failures. specsync 31/31 files, 7115/7115 LOC. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018rf59AtQmJcodUJ6vXDZNY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The last five findings from the nine-language translation dogfood, each re-verified independently before anything was touched.
The question asked of every one was code or documentation, and that distinction is the whole point of the PR. A sibling finding earlier this week claimed
--settle-mswas broken because it is inert under--wait-for-regex; the code was right, a comment recorded why, and "fixing" it would have reintroduced a measured bug.All five confirmed. Four are documentation.
runboundsclean_outputandraw_outputinto different windows--grephelp names a match surface it does not haveomitted_bytesreconciles only on ASCII--max-outputdoes not boundscreenThe one code change
rune run --timeout 5 -- echo hianswered:Wrong three ways at once: it calls a flag rune owns "Unknown", it asserts a position error when the flag was already before the separator, and following its remedy literally hands
--timeoutto the child instead of applying a timeout. Two agents lost tool calls to it; one nearly filed it as a broken flag.Now:
The known-flag set is derived from
FLAG_PATTERNSrather than hand-written โ a hand-maintained list is exactly what let--contextship accepted-and-ignored.I predicted rank4 would need code, and was wrong
The per-field budget is a stated contract in four places โ the flag itself says "BYTES each" โ and a caller sizing a context window wants both fields under the cap. What was missing is any statement of the consequence: a pty turns
\ninto\r\nandraw_outputkeeps its escapes, so the same budget lands at different points in the child's output.Measured at
--max-output=200on a 5,200-byte ASCII fixture: metadata reportsomitted_bytes: 5000,raw_output's own marker says5070, and the head boundaries differ. With colour, a whole line of the child's output was present in one field and absent from the other, from one invocation.So
clean_outputis notstrip_ansi(raw_output)under this flag. That is now stated in the help, the spec, and three guides โdocs/pty_architecture.mdasserted the identity unconditionally.Deliberately not fixed
Each of these was measured, and the fix came out worse than the limitation:
clean_outputfrom the bounded raw (whatsession readdoes) would cut readable payload by the ANSI fraction on every colour-emitting child, against the flag's stated purpose.--grepexists. Measured: 39 of 200 lines were on screen.truncatedfor callers who changed nothing.Both limitations are recorded in
ROADMAP.mdso they are tracked rather than buried in help text.Test Plan
docs-checkgreenspecsync checkโ 31/31 files, 7115/7115 LOC (100%)--timeout 5โ new message;--tiemout=5โ old message unchanged;--timeout=5โ still applies;-- echo hi --timeout 5โ still passes throughOne control fired unplanned, and it was right. The work order said to derive the known-flag set from
FLAG_PATTERNS.keysplus--separate-streams. The drift guard rejected that on its first run:--separate-streamsis boolean, so "give the value inline" is nonsense advice for it, and the parser consumes it before this path anyway. The set is the value-taking flags only, and a test now pins that a boolean flag still works normally.๐ค Generated with Claude Code
https://claude.ai/code/session_018rf59AtQmJcodUJ6vXDZNY