Fix schedule update silently dropping --attach without --description#364
Fix schedule update silently dropping --attach without --description#364
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes basecamp schedule update so --attach is not silently ignored when the user updates other fields (e.g. --summary) without providing --description, aligning schedule’s behavior with the existing cards update pattern.
Changes:
- Adjust attachment-handling guard to key off
description == ""(instead of!hasChanges) so attachments are processed whenever no description text is provided. - Preserve the existing “embed attachments into rich text” flow, but ensure it triggers even when other update flags are present.
Comments suppressed due to low confidence (1)
internal/commands/schedule.go:686
- This change fixes a previously silent behavior regression, but there’s no unit test covering the specific case where other update flags are set (e.g.
--summary) while--attachis provided without--description. Since this file already has schedule update request-body tests, please add a test that runsschedule updatewith--summary+--attachand asserts the outgoing update body includes a non-emptydescriptioncontaining the embedded attachment HTML (and that the attachment upload endpoint is invoked).
// Handle attachments when no description text provided
if description == "" && len(attachFiles) > 0 {
refs, attachErr := uploadAttachments(cmd, app, attachFiles)
if attachErr != nil {
return attachErr
}
req.Description = richtext.EmbedAttachments("", refs)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 959025a45e
ℹ️ 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".
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="internal/commands/schedule.go">
<violation number="1" location="internal/commands/schedule.go:681">
P1: This condition now triggers the attachment fallback for any update that omits `--description` (including `--summary ... --attach ...`), and that path rebuilds `req.Description` from attachment markup only. That can overwrite existing schedule entry description text during metadata-only updates, so preserve existing description content when attaching without an explicit description update.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
959025a to
0a53a04
Compare
The attach-only fallback was gated on `!hasChanges`, so passing `--attach` alongside other flags like `--summary` would silently drop the attachment (summary sets hasChanges=true, skipping the fallback). Change the guard to `description == ""` so attachments are always processed when no description text is provided.
0a53a04 to
8a9343a
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Handle attachments when no description text provided | ||
| if description == "" && len(attachFiles) > 0 { | ||
| refs, attachErr := uploadAttachments(cmd, app, attachFiles) |
There was a problem hiding this comment.
This change fixes the runtime behavior, but there’s no regression test covering the previously-broken case (e.g., schedule update with --summary + --attach and no --description). Consider adding a unit test in schedule_test.go that exercises update with another field set plus --attach, and asserts the outgoing PUT body includes an embedded attachment in description (and that the attachment upload request was made).
Cherry-picked fixes from pending main PRs: - Fix --assignee filter ignored with --list (#369) - Fix chat post JSON output contract and upload error handling (#365) - Fix schedule update silently dropping --attach without --description (#364) - Fix blank-line-after-list suppressing paragraph break (#363) - Fix campfire messages --limit being ignored (#367)
…accounts (#373) * Bump basecamp-sdk to v0.7.1 Fixes Person.Id deserialization (normalizeJSON pre-unmarshal for notification responses) and Account.Logo type (string → AccountLogo object). Adapts two breaking changes: Cards().Move() and Todos().Reposition() now take optional params. Adds AVIF/HEIC to richtext MIME extension map for logo upload support. * Merge upstream fixes (#363, #364, #365, #367, #369) Also fixes: chat upload error now wraps converted SDK error instead of raw error; schedule update --attach without --description now fetches current description to append rather than replace. * Add gauges command for project progress tracking Subcommands: list (account-wide), needles/needle (project-scoped), create/update/delete, enable/disable. Create validates --position (0-100), --color, --notify (requires --subscriptions for custom mode). * Add assignments command for viewing my assignments Subcommands: list, completed, due (with scope filter). Shortcut pattern — bare invocation shows priorities + non-priorities. * Add notifications command, extend accounts, register all new commands Notifications: list (paginated with dynamic next-page breadcrumb) and read (resolves IDs to SGIDs from --page). Accounts: show, update, logo upload (5MB + image type validation) and remove. Registers all new commands in root.go, catalog, and test harness. * Update docs and surface for v0.7.1 commands API-COVERAGE.md: 42 sections, 155 endpoints, SDK v0.7.1. SKILL.md: gauges, assignments, notifications, accounts sections. .surface: 148 commands, 422 flags.
Summary
basecamp schedule update <id> --summary "New" --attach foo.pdfsilently dropped the attachment because the attach-only fallback was gated on!hasChanges— any other flag (summary, starts-at, etc.) sethasChanges = truefirst, skipping the fallback!hasChangestodescription == ""so attachments are processed whenever no description text is provided, regardless of other flagscards updatecommand handles this correctly (attach block is outside the content guard); this aligns schedule with that patternTest plan
make test— all passmake lint— cleanbasecamp schedule update <id> --summary "test" --attach <file>should upload the attachmentSummary by cubic
Fixes
basecamp schedule updatedropping--attachwhen used with other flags like--summaryand no description. Attachments now process whenever the description is empty, matchingcards update.!hasChangestodescription == ""for attachment handling.--attachalongside flags like--summaryand--starts-atwhen no description text is passed.Written for commit 8a9343a. Summary will update on new commits.