Improve date display and HTML stripping in generic renderer#277
Conversation
The schema-driven presenter (used by commands with WithEntity) already
handles date formatting and HTML-to-markdown conversion. This commit
hardens the generic renderer fallback path used by `basecamp show`,
recordings, and entity types without presenter schemas.
Three changes:
1. Format dates in generic table cells via formatTableCell, a shared
formatter used by both table renderers and selectColumns width
measurement. Dates now display as human-readable text ("Jan 15, 2024"
or "2 hours ago") instead of raw ISO8601 timestamps.
2. Skip updated_at in generic table views by adding it to skipColumns.
All presenter schemas already use only created_at; updated_at is
misleading in list views because it changes on subscriber edits,
not content changes. Detail/object views are unaffected.
3. Strip HTML in formatCell for strings detected as HTML via
richtext.IsHTML, converting to markdown before whitespace collapse
and truncation. Prevents raw HTML tags from appearing in generic
table cells.
Refs:
- https://3.basecamp.com/2914079/buckets/46292715/card_tables/cards/9664776147
- https://3.basecamp.com/2914079/buckets/46292715/card_tables/cards/9661365021
There was a problem hiding this comment.
Pull request overview
This PR hardens the generic (schema-less) output renderer by improving how table cells are formatted, particularly for date fields and HTML content, to make fallback table output more readable and less misleading.
Changes:
- Omit
updated_atfrom generic table column detection. - Route generic table cell formatting through a new
formatTableCellpath to apply date formatting consistently (including for column width calculation). - Strip/convert HTML in
formatCellto avoid raw tags appearing in generic table output, and add unit tests for the new behaviors.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| internal/output/render.go | Skips updated_at in generic tables; uses formatTableCell in styled/markdown tables and in width measurement; adds HTML-to-Markdown conversion in formatCell. |
| internal/output/output_test.go | Adds unit tests covering generic table date formatting, column width measurement, updated_at omission, HTML stripping, and formatTableCell delegation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 514277e304
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Switch from RFC3339 timestamps to date-only strings ("2024-01-15")
in date formatting tests. This guarantees the absolute-date branch
is exercised regardless of when the tests run, since RFC3339 timestamps
within 7 days of time.Now() would produce relative output instead.
Summary
updated_atin generic table views — misleading because it changes on subscriber edits, not content changesformatCellto prevent raw tags from appearing in generic table outputThese changes harden the generic renderer fallback path (used by
basecamp show, recordings, and entity types without presenter schemas). The schema-driven path already handles all of this correctly.Message sort order (card 9661155449) is blocked on API/SDK support for sort params and is not included here.
Basecamp cards
updated_atTest plan
selectColumnswidth measurement with formatted datesupdated_atomission in generic tablesformatCellformatTableCelldelegationbin/cipassesbasecamp show <url>— dates human-readable, HTML strippedbasecamp recordings list messages --in <project>— noupdated_atcolumn, dates readable