fix(cli): allocate table columns by water-fill (3.2.5)#54
Merged
Conversation
When a Markdown table had one very wide column (e.g. `Description`, `Remediation`) next to several narrow ones (`CWE`, `Severity`), the old allocator distributed the terminal budget proportionally to each column's natural width. The narrow columns therefore received more space than they could ever use, while the wide column had to wrap across many rows. As the terminal was resized, columns alternated between "just wide enough" and "wrapping heavily" in a pattern that felt like the fix kept toggling on and off. Replace that pass with classic water-filling: sort columns by natural width ascending and, for each in turn, give it the smaller of its natural width and a fair share of the remaining budget. Narrow columns settle early with exactly what they need; all leftover budget rolls over to the wide columns. Result: `CWE` gets 7 cols, `Severity` gets 8, and `Description` absorbs everything else, no matter how the terminal is resized. Added two tests: - `water_fill_narrow_columns_do_not_hoard` — regression for the exact SEC-doc table layout the user reported. - `water_fill_tight_budget_does_not_overflow` — ensures the total content width never exceeds the budget even when the sum of naturals does, and no column is inflated past its natural. Bump CLI to 3.2.5. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
montfort
added a commit
that referenced
this pull request
May 7, 2026
…#112) Documents the follow-ups backlog convention contributed by the Sentinel adopter via issue #111. Empirically validated in StrangeDaysTech/sentinel CHARTER-12 (47 AILOGs across CHARTER-08 → CHARTER-11). Adopters reaching ~20+ AILOGs benefit from a central registry + per-AILOG drift detection script + agent integration block. This release is docs only — no CLI changes, no schema changes, no audit flow changes. Cristalization as a `devtrail followups` subcommand is deferred until a second adopter validates the pattern. Adds: - dist/.devtrail/00-governance/FOLLOW-UPS-BACKLOG-PATTERN.md (EN, ES, zh-CN) documenting the registry shape, 5 buckets, per-entry schema, drift detection (3 modes), agent integration, adoption walkthrough, reference implementation (Sentinel CHARTER-12 PRs #53/#54), and v0 open questions. - "Patterns" sections in AGENT-RULES.md and QUICK-REFERENCE.md (3 langs) pointing to the new document. Bumps: - dist/dist-manifest.yml to 4.10.0. - Footer versions and adopter doc references from v4.9.0 to v4.10.0 (skill version markers preserved as historical "since" annotations). Closes the upstream side of issue #111 (option A: docs-only adoption). Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Table column allocation in
devtrail exploreis now water-fill instead of proportional.The bug
With a table like the one from the SEC document shared in #52/#53 (columns
Vuln ID,CWE,Severity,Description,Affected Component,Remediation,Status), the old allocator gave each column a slice of the terminal budget proportional to its natural width. Narrow columns likeCWE(natural 7) therefore received more columns than they could ever use, whileDescription/Remediationhad to wrap. As the terminal was resized, the layout alternated between "just wide enough" and "wrapping heavily" in a way users described as the fix turning on and off.The fix
Classic water-filling: sort columns by natural width ascending and, for each one, give it the smaller of its natural width and a fair share of the remaining budget. Narrow columns settle early with exactly what they need; leftover rolls over to the wide columns.
Deterministic result for the SEC example (budget 120):
Vuln ID=8,CWE=7,Severity=8,Description=84. No matter how you resize, narrow columns never hoard space.Test plan
cargo test— 78 library tests passing (76 from 3.2.4 + 2 new).water_fill_narrow_columns_do_not_hoardregression test asserts narrow columns get exactly their natural width and the wide column absorbs the leftover.water_fill_tight_budget_does_not_overflowtest asserts the total never exceeds the budget and no column is inflated past its natural.cargo clippy --all-features— no new warnings.cargo build --release→devtrail aboutreportscli-3.2.5.🤖 Generated with Claude Code