Skip to content

Don't truncate URLs in formatted output - #273

Merged
jeremy merged 3 commits into
mainfrom
styled-truncation
Mar 11, 2026
Merged

jeremy merged 3 commits into
mainfrom
styled-truncation

Conversation

@jeremy

@jeremy jeremy commented Mar 11, 2026 •

Copy link
Copy Markdown
Member

Summary

  • formatCell truncates any string over 40 runes, which destroys URL fields like todolists_url and app_todolists_url — a truncated URL can't be clicked, copied, or navigated
  • Add isURL() helper to skip truncation for http:// and https:// prefixes
  • Affects all four render paths (styled/markdown × object/table) since they all funnel through formatCell

Test plan

  • Unit tests: long URL preserved, non-URL still truncated, short URL passthrough, http scheme
  • Regression tests: styled and markdown renderers preserve full URLs in both object and table views
  • bin/ci green

Summary by cubic

Skip truncation of http(s) URLs in formatted output so links stay usable across styled and markdown, for both object and table views.

  • Bug Fixes
    • Update formatCell to skip truncation for http:///https:// and reject values with spaces via isURL() to avoid false positives.
    • Applies to all render paths that funnel through formatCell.
    • Add tests: long URL preserved, non-URL truncated, short URL passthrough, whitespace-in-URL rejected, and styled/markdown object/table regressions.

Written for commit 8d3d5f8. Summary will update on new commits.

jeremy added 2 commits March 11, 2026 14:55
formatCell truncates strings longer than 40 runes, which destroys
URLs in output fields like todolists_url and app_todolists_url.
Add an isURL helper that recognizes http(s):// prefixes and bypass
truncation for those values.
Cover formatCell unit cases (long URL preserved, non-URL still
truncated, short URL passthrough, http scheme) and regression tests
for all four render paths: styled/markdown × object/table.
@jeremy
jeremy requested a review from a team as a code owner March 11, 2026 21:55
Copilot AI review requested due to automatic review settings March 11, 2026 21:55
@github-actions github-actions Bot added tests Tests (unit and e2e) output Output formatting and presentation bug Something isn't working labels Mar 11, 2026

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

Copy link
Copy Markdown
Contributor

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the output rendering pipeline to preserve full HTTP(S) URLs in formatted output, preventing URL fields from becoming unusable due to truncation in formatCell.

Changes:

  • Skip the existing 40-rune truncation behavior for strings that look like HTTP(S) URLs.
  • Add isURL() helper used by formatCell to detect URL strings.
  • Add unit/regression tests ensuring URLs are preserved across styled/markdown and object/table render paths.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
internal/output/render.go Updates formatCell truncation logic and adds isURL() helper.
internal/output/output_test.go Adds coverage for URL preservation in formatCell and end-to-end render outputs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/output/render.go Resolved
Comment thread internal/output/render.go Resolved
After newline collapsing, a string like "https://example.com\n(extra)"
becomes "https://example.com (extra)" — not a real URL. Reject strings
containing spaces so they still get truncated.
@jeremy
jeremy merged commit 89eeda6 into main Mar 11, 2026
26 checks passed
@jeremy
jeremy deleted the styled-truncation branch March 11, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working 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