Skip to content

fix: fall back to summary when title is empty in formatCell#380

Merged
jeremy merged 1 commit intomainfrom
fix/formatcell-summary-fallback
Mar 25, 2026
Merged

fix: fall back to summary when title is empty in formatCell#380
jeremy merged 1 commit intomainfrom
fix/formatcell-summary-fallback

Conversation

@robzolkos
Copy link
Copy Markdown
Collaborator

@robzolkos robzolkos commented Mar 25, 2026

Problem

basecamp reports schedule --md shows blank names for every schedule entry:

## 82 upcoming items (43 entries, 31 recurring, 8 assignables)

- **Schedule Entries:** , , , , , , , ...

Ref: https://3.basecamp.com/2914079/buckets/46292715/card_tables/cards/9717714333

Root cause

The bc3 reports/upcoming API uses the calendar partial (schedules/calendar/_entry.json.jbuilder) which emits summary but not title for schedule entries. The SDK deserialises the missing field to Go's zero value "".

The generic formatCell renderer, when displaying an array of maps (as schedule_entries is rendered inside the UpcomingScheduleResponse object), walks name → title → id to find a display label. Since title is present but empty, the type assertion succeeds with ok=true, an empty string is appended for each entry, and the join produces , , , , ....

Note: Schedule::Entry#title in bc3 delegates directly to summary, so the two fields are semantically identical — summary is just what the calendar API path exposes.

Fix

Add summary as a fallback between title and id in the map[string]any arm of formatCell. Also add empty-string guards on name and title so an empty field can't silently win over a non-empty one lower in the chain.

This is a generic renderer fix — any future resource that uses summary as its display name benefits automatically.

Testing

Extended TestFormatCellWithMapArray with three new cases:

  • Schedule-entry shape (empty title, summary wins)
  • Non-empty title still beats summary
  • Empty name does not shadow a valid title

bin/ci passes.


Summary by cubic

Fixes blank schedule entry names in basecamp reports schedule --md. formatCell now falls back to summary when title is empty and skips empty name/title values.

  • Bug Fixes
    • Added summary fallback between title and id in formatCell, and ignore empty name/title.
    • Expanded tests to cover schedule entries and label precedence.

Written for commit b78b5d1. Summary will update on new commits.

The reports/upcoming API uses the calendar partial
(schedules/calendar/_entry.json.jbuilder) which emits summary but
not title for schedule entries. The SDK deserializes the missing
field to an empty string, so formatCell's existing name → title → id
chain was appending "" for each entry and joining them into
", , , , ..." in --md and styled output.

Add summary as a fallback between title and id, and add empty-string
guards on the name and title checks so an empty field doesn't
silently win over a non-empty one lower in the chain.

Schedule::Entry#title delegates to summary in bc3, so the two fields
carry identical data when both are present; summary is the canonical
field in the calendar API response.

Fixes: reports schedule --md showing blank entry names
Copilot AI review requested due to automatic review settings March 25, 2026 16:47
@github-actions github-actions bot added tests Tests (unit and e2e) output Output formatting and presentation bug Something isn't working labels Mar 25, 2026
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

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

Fixes blank labels when rendering schedule entries in basecamp reports schedule --md by improving the generic formatCell map-array label selection to ignore empty name/title and fall back to summary before id.

Changes:

  • Update formatCell’s []anymap[string]any rendering to use name → title → summary → id, with empty-string guards.
  • Add test coverage for summary fallback and empty-string guard behavior in map arrays.

Reviewed changes

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

File Description
internal/output/render.go Adjusts map-array label selection in formatCell to prevent empty title from producing blank rendered items and adds summary fallback.
internal/output/output_test.go Extends TestFormatCellWithMapArray with cases covering summary fallback and empty-string guard behavior.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.


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

Comment thread internal/output/render.go
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

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


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

@jeremy jeremy merged commit ddf5edf into main Mar 25, 2026
35 checks passed
@jeremy jeremy deleted the fix/formatcell-summary-fallback branch March 25, 2026 18:05
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.

3 participants