fix: fall back to summary when title is empty in formatCell#380
Conversation
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
There was a problem hiding this comment.
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[]any→map[string]anyrendering to usename → title → summary → id, with empty-string guards. - Add test coverage for
summaryfallback 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.
There was a problem hiding this comment.
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.
Problem
basecamp reports schedule --mdshows blank names for every schedule entry: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 emitssummarybut nottitlefor schedule entries. The SDK deserialises the missing field to Go's zero value"".The generic
formatCellrenderer, when displaying an array of maps (asschedule_entriesis rendered inside theUpcomingScheduleResponseobject), walksname → title → idto find a display label. Sincetitleis present but empty, the type assertion succeeds withok=true, an empty string is appended for each entry, and the join produces, , , , ....Note:
Schedule::Entry#titlein bc3 delegates directly tosummary, so the two fields are semantically identical —summaryis just what the calendar API path exposes.Fix
Add
summaryas a fallback betweentitleandidin themap[string]anyarm offormatCell. Also add empty-string guards onnameandtitleso 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
summaryas its display name benefits automatically.Testing
Extended
TestFormatCellWithMapArraywith three new cases:title,summarywins)titlestill beatssummarynamedoes not shadow a validtitlebin/cipasses.Summary by cubic
Fixes blank schedule entry names in
basecamp reports schedule --md.formatCellnow falls back tosummarywhentitleis empty and skips emptyname/titlevalues.summaryfallback betweentitleandidinformatCell, and ignore emptyname/title.Written for commit b78b5d1. Summary will update on new commits.