Skip to content

fix(cli): allocate table columns by water-fill (3.2.5)#54

Merged
montfort merged 1 commit intomainfrom
chore/bump-cli-3.2.5
Apr 24, 2026
Merged

fix(cli): allocate table columns by water-fill (3.2.5)#54
montfort merged 1 commit intomainfrom
chore/bump-cli-3.2.5

Conversation

@montfort
Copy link
Copy Markdown
Contributor

Summary

Table column allocation in devtrail explore is 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 like CWE (natural 7) therefore received more columns than they could ever use, while Description / Remediation had 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).
  • New water_fill_narrow_columns_do_not_hoard regression test asserts narrow columns get exactly their natural width and the wide column absorbs the leftover.
  • New water_fill_tight_budget_does_not_overflow test asserts the total never exceeds the budget and no column is inflated past its natural.
  • cargo clippy --all-features — no new warnings.
  • cargo build --releasedevtrail about reports cli-3.2.5.
  • Manual: open the SEC doc at various terminal widths and confirm no more "toggling" behavior.

🤖 Generated with Claude Code

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 montfort merged commit 6d2d3e6 into main Apr 24, 2026
1 check passed
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>
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.

1 participant