Skip to content

fix(tui): restore column width auto-sizing after requested model fields#597

Merged
wesm merged 7 commits intomainfrom
fix/tui-column-widths
Mar 30, 2026
Merged

fix(tui): restore column width auto-sizing after requested model fields#597
wesm merged 7 commits intomainfrom
fix/tui-column-widths

Conversation

@wesm
Copy link
Copy Markdown
Collaborator

@wesm wesm commented Mar 30, 2026

Summary

  • Fix three bugs introduced in d2d671f that broke TUI queue column auto-sizing for users with existing column config: missing header text in allHeaders, excessive minimum widths (15/18 instead of 9/12), and no migration backfill for new default-hidden columns
  • Add versioned column config migration (ColumnConfigVersion) so the backfill runs exactly once and does not re-hide columns a user later unhides
  • Stamp ColumnConfigVersion in saveColumnOptions so user-saved preferences from unversioned configs are not re-migrated on next startup
  • Add column metadata smoke tests (TestColumnMetadataComplete, TestAllColumnsVisibleHeadersPresent, TestQueueRenderWithStaleHiddenConfig) that catch this class of bug when new columns are added

🤖 Generated with Claude Code

wesm and others added 4 commits March 30, 2026 08:38
d2d671f introduced colRequestedModel and colRequestedProvider with
three bugs that broke auto-sizing for existing users:

1. allHeaders array omitted header text for the new columns (indices
   12-13 defaulted to ""), so they rendered with no header
2. Minimum widths (15, 18) were larger than the header text (9, 12),
   stealing extra space from flex columns even when content was empty
3. migrateColumnConfig did not backfill new default-hidden columns into
   existing hidden_columns configs, so users with saved column prefs
   saw two empty columns consuming 33+ chars of table width

Fix by adding the missing headers, correcting minimums to match header
widths, and backfilling default-hidden columns during config migration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add three invariant tests that catch the class of bug introduced in
d2d671f where new columns were added to the enum but metadata
structures were not fully updated:

- TestColumnMetadataComplete: every toggleable column must have entries
  in columnNames and columnConfigNames
- TestAllColumnsVisibleHeadersPresent: renders with all columns visible
  and verifies each header appears (catches missing allHeaders entries)
- TestQueueRenderWithStaleHiddenConfig: simulates a pre-upgrade config
  and verifies migration backfills new default-hidden columns so flex
  columns retain usable widths

All three tests were verified to fail against the pre-fix code and
pass after the fix.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Address review findings from #11439 and #11445:

- Add ColumnConfigVersion to Config so the backfill migration runs
  exactly once. A user who later unhides columns won't get them
  re-hidden on next startup (version >= 1 skips the migration).
- Iterate toggleableColumns (a slice) instead of defaultHiddenColumns
  (a map) for deterministic append order.
- Remove the else-if branch that bumped version for configs without
  explicit hidden_columns — those use parseHiddenColumns(nil) defaults
  and need no migration.
- Add TestQueueRenderPostMigrationUserChoice to verify post-migration
  configs are not re-migrated.
- Add "version 1 config not re-migrated" case to TestMigrateColumnConfig.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
saveColumnOptions now writes ColumnConfigVersion = 1 alongside the
user's column preferences. Without this, a user starting from a
version-0 config (sentinel or nil hidden_columns) could save custom
column choices, but the next startup would treat the saved config as
stale and backfill default-hidden columns — undoing the user's choice.

Add TestSaveColumnOptionStampsVersion to verify the save-then-reload
cycle preserves preferences.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@roborev-ci
Copy link
Copy Markdown

roborev-ci bot commented Mar 30, 2026

roborev: Combined Review (6dc03a0)

Verdict: Changes look mostly sound, but there is one medium-severity regression risk in the config migration.

Medium

  • cmd/roborev/tui/render_queue.go:782
    The new v1 migration unconditionally backfills all default-hidden columns into any pre-versioned hidden_columns list. For users who upgraded earlier, explicitly made requested_model or requested_provider visible, and saved before ColumnConfigVersion existed, the first startup after this change will hide those columns again. That overwrites an explicit user preference instead of preserving it.
    Suggested fix: Only backfill when there is a reliable signal that the config is actually stale, or avoid mutating existing non-sentinel hidden_columns lists and only stamp the version. Add an upgrade-path test covering a pre-v1 config where those columns were intentionally visible.

Synthesized from 3 reviews (agents: codex, gemini | types: default, security)

- TestSaveColumnOptionsWritesVersion: exercises the real
  saveColumnOptions → LoadGlobal/SaveGlobal path via ROBOREV_DATA_DIR,
  verifying ColumnConfigVersion = 1 is persisted and survives reload
- TestMigratePreV1ConfigWithVisibleNewColumns: documents that the v1
  migration backfills default-hidden columns for unversioned configs,
  and verifies the version stamp prevents re-migration on second run

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@roborev-ci
Copy link
Copy Markdown

roborev-ci bot commented Mar 30, 2026

roborev: Combined Review (6a1e52c)

Verdict: Changes are mostly sound, but there is one medium-severity migration bug to address before merge.

Medium

  • Hidden-column migration overwrites existing user preferences
    Location: cmd/roborev/tui/render_queue.go#L786
    The v1 migration is intended to backfill defaults for the newly added requested_model / requested_provider columns, but it currently re-adds every entry from defaultHiddenColumns, including session_id. That can silently override a valid pre-v1 user setting such as hidden_columns = ["branch"] where session_id had been intentionally made visible.
    Recommended fix: Limit the one-time backfill to the newly introduced columns, or otherwise scope the migration so existing visibility choices for older columns are preserved.

Synthesized from 3 reviews (agents: codex, gemini | types: default, security)

The backfill loop was iterating all defaultHiddenColumns, which
includes session_id — a column that existed before d2d671f. A user
with hidden_columns = ["branch"] may have intentionally shown
session_id; the migration should not override that choice.

Scope the backfill to only colRequestedModel and colRequestedProvider
(the columns actually introduced in d2d671f). Add a test case
verifying session_id visibility is preserved during migration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@roborev-ci
Copy link
Copy Markdown

roborev-ci bot commented Mar 30, 2026

roborev: Combined Review (535820a)

Verdict: No medium, high, or critical findings.

Two review agents found the change clean, and there are no medium-or-higher issues to report.

One review (gemini) failed to return output, so this verdict is based on the completed codex default and security reviews.


Synthesized from 3 reviews (agents: codex, gemini | types: default, security)

Assert the reloaded HiddenColumns value matches the user's selection,
not just the version stamp.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@wesm wesm merged commit 269b7e2 into main Mar 30, 2026
7 of 8 checks passed
@wesm wesm deleted the fix/tui-column-widths branch March 30, 2026 18:43
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.

2 participants