Skip to content

Improve date display and HTML stripping in generic renderer#277

Merged
jeremy merged 2 commits intomainfrom
fix/output-display-polish
Mar 12, 2026
Merged

Improve date display and HTML stripping in generic renderer#277
jeremy merged 2 commits intomainfrom
fix/output-display-polish

Conversation

@jeremy
Copy link
Copy Markdown
Member

@jeremy jeremy commented Mar 12, 2026

Summary

  • Format dates in generic table cells as human-readable text instead of raw ISO8601 timestamps
  • Skip updated_at in generic table views — misleading because it changes on subscriber edits, not content changes
  • Strip HTML in formatCell to prevent raw tags from appearing in generic table output

These 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

Test plan

  • New unit tests for styled/markdown table date formatting
  • New unit test for selectColumns width measurement with formatted dates
  • New unit test for updated_at omission in generic tables
  • New unit tests for HTML stripping in formatCell
  • New unit test for formatTableCell delegation
  • bin/ci passes
  • Manual: basecamp show <url> — dates human-readable, HTML stripped
  • Manual: basecamp recordings list messages --in <project> — no updated_at column, dates readable

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
@jeremy jeremy requested a review from a team as a code owner March 12, 2026 00:48
Copilot AI review requested due to automatic review settings March 12, 2026 00:48
@github-actions github-actions bot added tests Tests (unit and e2e) output Output formatting and presentation enhancement New feature or request labels Mar 12, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_at from generic table column detection.
  • Route generic table cell formatting through a new formatTableCell path to apply date formatting consistently (including for column width calculation).
  • Strip/convert HTML in formatCell to 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.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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.
@jeremy jeremy merged commit 023c439 into main Mar 12, 2026
26 checks passed
@jeremy jeremy deleted the fix/output-display-polish branch March 12, 2026 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request output Output formatting and presentation tests Tests (unit and e2e)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants