Repository navigation
Break analyzer explanation prose into readable paragraphs - #708
Merged
Merged
Conversation
…graphs prompt_bloat, subagent_rightsizing and model_downgrade rendered their estimate_basis and hint text as single unbroken paragraphs of 40-60 word sentences. Split into short sentences grouped into blank-line separated paragraphs, and dropped the em dashes per the project copy rule. No number, claim or hedge changed. Co-Authored-By: Claude <[email protected]>
The A1/A2/A3 estimate_basis strings and the silent-invalidator checklist were semicolon run-ons of 30+ words. Re-sentenced, em dash removed. The lowercase-fragment convention these fields use when rendered inline is preserved. No number, exclusion rule or hedge changed. Co-Authored-By: Claude <[email protected]>
Ten strings in stream_usage (data-quality note, remediation one-liners, the derivation branches, hint and both estimate_basis blocks) and two capture hints in plan_reuse were compound run-ons. Re-sentenced, four em dashes removed. Singular/plural f-string grammar re-checked. No claim changed. Co-Authored-By: Claude <[email protected]>
PAST_OVERSPEND_BASIS was a ~200-word single run-on sentence. Split into five short paragraphs, em dashes removed. The RELEARN_RESEND_BOUNDARY concatenation stays contiguous and the 'must never be added together' substring is preserved verbatim. No number, field name or claim changed. Co-Authored-By: Claude <[email protected]>
…nt prose Six strings across the three analyzers (hints, honesty caveats, estimate basis and the batch friction note) were compound run-ons. Split at existing clause boundaries, em dashes removed, each file's own lowercase-fragment or Title-case convention preserved. No claim changed. Co-Authored-By: Claude <[email protected]>
…nsize_agents prose context_resend's estimate_basis was the worst case in the product: a single ~7000 char paragraph. It now reads as nine short paragraphs, one per claim (token definition, USD claim, offloadable share, right-sizing, TOKENS claim, the drop-from-both rule, the relearn boundary). Nine other strings in that file plus the shared resend/relearn boundary constant and three more analyzers got the same treatment. Em dashes removed throughout. No number, exclusion rule or hedge changed. Co-Authored-By: Claude <[email protected]>
These fields are thousands of characters and were interpolated raw into divs with no width cap and no paragraph structure. proseParagraphs() splits on blank lines and collapses incidental single newlines, so the breaks the analyzers now emit actually render, and source-line wrapping inside triple-quoted strings does not. Applied at the nine raw-dump call sites. No truncation or collapsing added. Co-Authored-By: Claude <[email protected]>
…usals Twenty-four strings, the densest being the cache_read_ratio simplification note (one ~90-word run-on, now six sentences). Also covers the MCP-remove apply-refusal reasons, which the apply card renders as its fallback explanation. Em dashes removed from returned strings only; docstrings and comments untouched. No number or claim changed. Co-Authored-By: Claude <[email protected]>
Twelve constants including _ROUTE_NOTE, the four-routes and relocation wall of text. Where a sentence split would have broken an asserted lowercase phrase, the join stays a semicolon rather than forcing the split. No number, field name or claim changed. Co-Authored-By: Claude <[email protected]>
The analyzer prose rewrite broke eight assertions that matched whole lowercase sentences. Each is repaired to guard what it was defending: threshold notes key on the count and the imported threshold constant, the negative offloadability disclosure matches case-insensitively, and the caveat render check applies _flat() to both sides so paragraph breaks do not defeat it. No test deleted or weakened. Co-Authored-By: Claude <[email protected]>
The prose rewrite introduced blank-line paragraph breaks, but the CLI's hand-written f-string prefix only indented the first line, so every later paragraph rendered flush at column 0, detached from its '!' marker. _render_prose uses a rich Table.grid so the marker prints once and all continuation lines align under the text, matching the Padding precedent already used by the scoreboard note. Byte-identical output for single-paragraph prose. Per-site escape behaviour is preserved as-is rather than normalised, to keep this an indentation change only. Co-Authored-By: Claude <[email protected]>
The boundary constant gained a trailing period in the rewrite while context_resend still appended its own, rendering 'resend's to claim..' on the analyzer page. Drop it from the constant, which is the contract both consumers were written against, and add the sentence break relearn's parenthesised splice was missing. Co-Authored-By: Claude <[email protected]>
Contributor
|
| Filename | Overview |
|---|---|
| tokenjam/cli/cmd_optimize.py | Adds a shared Rich grid renderer and migrates analyzer prose call sites while preserving each site's prior escaping choice. |
| tokenjam/ui/index.html | Adds blank-line-aware paragraph rendering at Optimize prose sites and caps explanatory copy at 78ch. |
| tokenjam/core/optimize/analyzers/context_resend.py | Reorganizes the longest resend explanations into paragraphs without changing the stated accounting boundaries. |
| tokenjam/core/optimize/analyzers/summarize.py | Breaks extensive summarize methodology and caveat text into shorter sentences and paragraphs while retaining its qualifications. |
| tokenjam/core/optimize/analyzers/relearn.py | Restructures past-overspend basis prose and preserves the shared resend/relearn accounting boundary. |
| tests/unit/test_optimize_resend_render.py | Normalizes multiline rendered prose and checks threshold details rather than relying on obsolete sentence wording. |
| tests/unit/test_past_overspend.py | Updates source-level UI assertions to require paragraph-aware rendering for coverage and basis prose. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Analyzer prose fields] --> B[Optimize report]
B --> C[CLI _render_prose]
B --> D[Dashboard proseParagraphs]
C --> E[Indented Rich output]
D --> F[Paragraph elements capped at 78ch]
Reviews (1): Last reviewed commit: "copy: fix punctuation at the shared rese..." | Re-trigger Greptile
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.
Analyzer explanation prose rendered as a wall of text on every Optimize page. The worst case,
RESEND_ESTIMATE_BASIS, was ~7000 characters in a single unbroken paragraph built from 40-60 word sentences, interpolated raw into a div with no width cap and no paragraph structure.What changed
Prose (17 analyzers). Every user-facing
estimate_basis,caveat,hint,notesandcoverage_noterewritten into sentences of roughly 22 words or fewer, grouped into blank-line separated paragraphs. Em dashes removed throughout, per the project copy rule.Every number, percentage, field name, backticked identifier and file path is preserved exactly, and every hedge and caveat is preserved as written. Sentences were only ever split, never merged, so no two claims collapsed into one. Docstrings, comments, model prompts and copyable code snippets were left alone.
Dashboard. A
proseParagraphs()helper splits on blank lines and collapses incidental single newlines, so the paragraph breaks render as real<p>elements while source-line wrapping inside triple-quoted Python strings does not. Applied at the nine raw-dump call sites. Prose classes capped at78ch, matching the74chprecedent already used by.sz-note. Nothing was truncated, clamped or hidden behind a toggle.CLI. The new paragraph breaks exposed an existing gap: prose was printed via a hand-written f-string prefix (
console.print(f" [yellow]![/yellow] ...")) that indents only the first line, so every paragraph after a blank line rendered flush at column 0, detached from its marker._render_proseuses arichTable.gridso the marker prints once and all continuation lines hang under the text. Output is byte-identical for single-paragraph prose. Per-site escaping behaviour is deliberately preserved rather than normalised, to keep this an indentation change only.Tests. Eight assertions pinned whole lowercase sentences that were rewritten. Each was repaired to defend what it was actually guarding rather than deleted: threshold notes now key on the count and the imported threshold constant, the negative offloadability disclosure matches case-insensitively, and the caveat render check applies the same
_flat()normalisation to both sides so paragraph breaks cannot defeat it. No test was deleted or weakened.Verification
Rendered the real dashboard from this branch against real transcript data in an isolated HOME and screenshotted the result, rather than inferring from the diff. That caught two defects the source review missed, both fixed here: a
resend's to claim..double period where the shared boundary constant gained a trailing period while its consumer still appended one, and a missing sentence break at the parenthesised splice of the same constant.CLI output was captured as real terminal bytes for multi-paragraph, single-paragraph and bracket/backtick cases.
1715 tests pass after merging latest
main.Note
One meaning change was introduced and caught during the work: a stray "only" added to a summarize claim, which failed
test_basis_refuses_to_present_compression_as_the_only_routeand was reverted. That test earned its keep.