refactor(text): char_boundary_*/ellipsize helpers + pin critic transcript (R D) - #357
Merged
Conversation
… critic transcript [dirge-ep1f] Round D, scoped HONESTLY after a rigorous feasibility pass: most of the proposed text-helper merges are intentional per-consumer variation with load-bearing, thinly-tested formats — consolidating them would risk silently changing model/critic-facing output. So: #8 (boundary helpers, the one pure win): promote char_boundary_at_or_before/ after to crate::text; compression.rs drops its private copies, summarize.rs's head_tail_truncate replaces its two inline boundary loops. Zero output change, no marker/ratio touched. The 3 head/tail TRUNCATORS themselves are LEFT — different ratios + model-facing markers, intentionally per-consumer. #6 (byte-budget … cluster): text::ellipsize(s, max_bytes) absorbs skills::truncate + memory_store::truncate_for_error (display/error text, not model-facing). The other 6 ellipsis sites are LEFT — their char-unit / whitespace-collapse / marker variations are genuinely per-site. #7 (transcript builders): NOT consolidated — 3 different input types (SessionMessage/LoopMessage/serde_json::Value), 3 intentional formats, and a trait+style abstraction would add more complexity than it removes. PLUS the highest-value action the audit surfaced: a byte-EXACT pinning test for build_critic_transcript (load-bearing critic format, previously only .contains()-tested) so a future refactor can't silently shift its labels. + ellipsize/char_boundary unit tests. 2457 default / 2551 all-features pass.
yogthos
pushed a commit
that referenced
this pull request
Jun 2, 2026
allen-munsch
pushed a commit
to allen-munsch/dirge
that referenced
this pull request
Jun 3, 2026
… critic transcript [dirge-ep1f] (dirge-code#357) Round D, scoped HONESTLY after a rigorous feasibility pass: most of the proposed text-helper merges are intentional per-consumer variation with load-bearing, thinly-tested formats — consolidating them would risk silently changing model/critic-facing output. So: dirge-code#8 (boundary helpers, the one pure win): promote char_boundary_at_or_before/ after to crate::text; compression.rs drops its private copies, summarize.rs's head_tail_truncate replaces its two inline boundary loops. Zero output change, no marker/ratio touched. The 3 head/tail TRUNCATORS themselves are LEFT — different ratios + model-facing markers, intentionally per-consumer. dirge-code#6 (byte-budget … cluster): text::ellipsize(s, max_bytes) absorbs skills::truncate + memory_store::truncate_for_error (display/error text, not model-facing). The other 6 ellipsis sites are LEFT — their char-unit / whitespace-collapse / marker variations are genuinely per-site. dirge-code#7 (transcript builders): NOT consolidated — 3 different input types (SessionMessage/LoopMessage/serde_json::Value), 3 intentional formats, and a trait+style abstraction would add more complexity than it removes. PLUS the highest-value action the audit surfaced: a byte-EXACT pinning test for build_critic_transcript (load-bearing critic format, previously only .contains()-tested) so a future refactor can't silently shift its labels. + ellipsize/char_boundary unit tests. 2457 default / 2551 all-features pass. Co-authored-by: Yogthos <yogthos@gmail.com>
allen-munsch
pushed a commit
to allen-munsch/dirge
that referenced
this pull request
Jun 3, 2026
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.
Round D of the duplication consolidation (epic dirge-9l12, dirge-ep1f), scoped honestly after a rigorous feasibility pass. The headline finding: most of Round D's proposed merges are intentional per-consumer variation over load-bearing, thinly-tested formats — consolidating them would risk silently changing model/critic-facing output. So this PR does the genuinely-safe subset and declines the rest with reasoning.
Done (pure, zero-output-change)
char_boundary_at_or_before/aftertocrate::text;compression.rsdrops its private copies andsummarize.rs::head_tail_truncatereplaces its two inline boundary-walk loops. No marker/ratio/format touched.…cluster —text::ellipsize(s, max_bytes)absorbsskills::truncate+memory_store::truncate_for_error(display/error text, not model-facing).Declined (with evidence)
.contains()/zero test coverage....vs…vs…[N more]) are genuinely different.SessionMessage/LoopMessage/serde_json::Value), 3 intentional formats; a trait+style abstraction adds more complexity than it removes.Plus the highest-value action the audit surfaced
A byte-exact pinning test for
build_critic_transcript— the load-bearing critic format (which just had a stale-summary bug fixed) was only.contains()-tested. Now a refactor can't silently shift itsUSER:/ASSISTANT:labels or tool-call rendering. +ellipsize/char_boundaryunit tests.2457 default / 2551 all-features tests pass. This completes the consolidation epic.