refactor(cli): render database history through the shared status table renderer - #1206
Draft
aparajon wants to merge 1 commit into
Draft
refactor(cli): render database history through the shared status table renderer#1206aparajon wants to merge 1 commit into
aparajon wants to merge 1 commit into
Conversation
…e renderer Generalize statusColumn and its helpers over the row type so any CLI table can define columns against its own row struct, add writeStatusTable as the single header+rows renderer, and replace WriteDatabaseHistory's hand-rolled column layout with history-specific statusColumn definitions. History output is byte-identical, pinned by an exact-bytes test; the status list's colored state cell now ends its color escape before the column separator, which renders identically. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the CLI table rendering in templates to reuse a single shared “status table” renderer across multiple outputs, starting with the database history view, while preserving the existing user-facing formatting (including ANSI coloring behavior).
Changes:
- Generalizes
statusColumnand related helpers over an arbitrary row type and introduceswriteStatusTableto own the shared header/row rendering loop (including correct ANSI reset behavior around separators). - Refactors
WriteStatusListandWriteDatabaseHistoryto render viawriteStatusTable, replacing bespoke printing/width tracking in history output. - Adds exact-bytes tests for the database history table output (including unknown-state and missing-timestamp cases) plus an empty-history test.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/cmd/internal/templates/progress.go | Introduces generic status-table primitives (statusColumn[T], writeStatusTable) and refactors status list + database history rendering to use them. |
| pkg/cmd/internal/templates/progress_states_test.go | Adds exact-bytes tests pinning database history table output and the empty-history message. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Follow-up to #1062 (review finding 6, deferred there): reuse the status list's column renderer for other CLI tables, starting with the database history table.
statusColumnand its helpers (retainPopulatedStatusColumns,statusColumnValue, width sizing) are now generic over the row type, and a newwriteStatusTableowns the shared header+rows loop, taking a row-state accessor so colored columns work for any row type.WriteDatabaseHistorydefines its columns viadatabaseHistoryColumns()and renders throughwriteStatusTable, replacing its hand-rolledfmt.Printflayout and manual width tracking.🤖 Generated with Claude Code