Repository navigation
Conversation
There was a problem hiding this comment.
🟢 Approved
No active review issues are reported for the Ping and Campfire attachment changes.
No open issues 🎉
What changed in this PR
Adds support for listing and downloading files posted in Pings and Campfires through the existing attachment commands, alongside rich-text attachments.
Changes:
- Reads the attachment array on chat upload lines, using each file’s download URL.
- Updates command help to describe Ping and Campfire support.
- Adds download regression tests for both URL forms and verifies that text-line metadata is excluded.
[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or rungh pr ready --undo.
Click "Ready for review" or rungh pr readyto reengage.
| File | Description |
|---|---|
| internal/commands/attachments.go | Shares attachment extraction between list and download; updates help. |
| internal/commands/attachments_test.go | Tests Ping and Campfire downloads and text-line exclusion. |
| internal/commands/attachments_lines.go | Converts chat upload files into the existing attachment representation. |
Review effort: Balanced (adaptive)
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Reply to a comment to ask cubic a question or push back. It learns from your replies.
View guided diff | Turn on auto-fix | Re-trigger cubic
An agent sent a screenshot in a Ping can now save it, and pass it on by attaching it to a card. The attachments commands read the files a chat upload line lists beside its content.
7c07768 to
89607ee
Compare
robzolkos
left a comment
There was a problem hiding this comment.
The approach is right. In bc3, app/views/api/chats/lines/_upload.json.jbuilder is the only chat line view that outputs attachments, so reading that array only for Chat::Lines::Upload matches the API exactly. Security looks fine too: the SDK sends the authenticated hop to the configured API host whatever host download_url names, and filenames are reduced to their base name and checked against the output directory. A few changes before this merges:
1. Reuse the SDK's type instead of lineFile. lineFile duplicates basecamp.CampfireLineAttachment. The item is decoded with UseNumber, so it re-marshals with an integer byte_size and unmarshals straight into the SDK struct (Filesize via strconv.FormatInt). Most of attachments_lines.go goes away.
2. The test fixture's byte_size is a string; the API sends an integer. The fixture has "byte_size": "9", but bc3 emits json.byte_size attachment.byte_size, an integer, as do the SDK's own fixtures. Please use 9. The json.Number field exists only to accept a shape the API never sends.
3. The unmarshal error is discarded, which can silently drop files. One malformed entry stops decoding partway through the array: the entries after it are lost and a zero-value entry is appended. For example, [ok, {"byte_size": ""}, ok] comes back as [ok, <empty>]. That's unlikely with the real API, but a file the person asked for shouldn't vanish without an error. Return the error, or decode each element separately and skip only the bad one.
4. Nit: attachments_test.go has no blank line before func TestAttachmentsDownloadSavesPingLineFiles.
5. Agents still can't find out how to download these files. The card's goal is an agent passing on a screenshot or recording someone posted in chat. Today basecamp chat output shows 📎 screenshot.png for an upload line, but nothing points to basecamp attachments download <line>. The skill's guidance in skills/basecamp/SKILL.md ("When a result reports content or description attachments, download and inspect them") doesn't cover these files either, since they're in neither field. Suggest:
- a breadcrumb on upload lines in the chat line output that points to
basecamp attachments download <line>, and - widening that skill line to cover files posted in Ping and Campfire lines (the skill drift check will hold the command reference to the real command).
Written by @thehalebot
What
attachments listandattachments downloadnow return the files posted in a Ping or a Campfire. A chat upload line (Chat::Lines::Upload) lists its files in anattachmentsarray beside its content, each with adownload_url, and the commands read that array as well as the<bc-attachment>tags in rich text. A Ping line URL (/circles/<ping>@<line>) and a Campfire line URL (/buckets/<p>/chats/<c>@<line>) both work.Why
The CLI couldn't download a file someone posted in a Ping or a Campfire. An agent sent a screenshot or a screen recording in chat therefore couldn't pass it on, for example by attaching it to a bug card. With CLI 0.27.0,
attachments downloadon such a line said "No downloadable attachments found", although the line lists the file with its download URL.Card: https://app.basecamp.com/2914079/buckets/48521764/card_tables/cards/10563076254
Testing
TestAttachmentsDownloadSavesPingLineFilesfails onmainwith the card's error and passes here.TestAttachmentsDownloadSavesCampfireLineFilesdoes the same.attachmentsarray is read, so a text line that carries one gains no attachments.TestAttachmentsListLeavesOutTextLineMetadatacovers this.bin/cipasses