Skip to content

Fix schedule update silently dropping --attach without --description#364

Merged
jeremy merged 1 commit intomainfrom
fix-schedule-update-attach-drop
Mar 24, 2026
Merged

Fix schedule update silently dropping --attach without --description#364
jeremy merged 1 commit intomainfrom
fix-schedule-update-attach-drop

Conversation

@jeremy
Copy link
Copy Markdown
Member

@jeremy jeremy commented Mar 24, 2026

Summary

  • basecamp schedule update <id> --summary "New" --attach foo.pdf silently dropped the attachment because the attach-only fallback was gated on !hasChanges — any other flag (summary, starts-at, etc.) set hasChanges = true first, skipping the fallback
  • Changes guard from !hasChanges to description == "" so attachments are processed whenever no description text is provided, regardless of other flags
  • The cards update command handles this correctly (attach block is outside the content guard); this aligns schedule with that pattern

Test plan

  • make test — all pass
  • make lint — clean
  • Manual: basecamp schedule update <id> --summary "test" --attach <file> should upload the attachment

Summary by cubic

Fixes basecamp schedule update dropping --attach when used with other flags like --summary and no description. Attachments now process whenever the description is empty, matching cards update.

  • Bug Fixes
    • Changed guard from !hasChanges to description == "" for attachment handling.
    • Honors --attach alongside flags like --summary and --starts-at when no description text is passed.

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

Copilot AI review requested due to automatic review settings March 24, 2026 16:41
@github-actions github-actions bot added commands CLI command implementations bug Something isn't working labels Mar 24, 2026
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

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 --attach is provided without --description. Since this file already has schedule update request-body tests, please add a test that runs schedule update with --summary + --attach and asserts the outgoing update body includes a non-empty description containing 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.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

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.

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.

@jeremy jeremy force-pushed the fix-schedule-update-attach-drop branch from 959025a to 0a53a04 Compare March 24, 2026 17:02
@jeremy jeremy enabled auto-merge (squash) March 24, 2026 19:06
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.
Copilot AI review requested due to automatic review settings March 24, 2026 19:18
@jeremy jeremy force-pushed the fix-schedule-update-attach-drop branch from 0a53a04 to 8a9343a Compare March 24, 2026 19:18
@jeremy jeremy merged commit 58247f0 into main Mar 24, 2026
30 checks passed
@jeremy jeremy deleted the fix-schedule-update-attach-drop branch March 24, 2026 19:21
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 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.

Comment on lines +680 to 682
// Handle attachments when no description text provided
if description == "" && len(attachFiles) > 0 {
refs, attachErr := uploadAttachments(cmd, app, attachFiles)
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
jeremy added a commit that referenced this pull request Mar 25, 2026
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)
jeremy added a commit that referenced this pull request Mar 25, 2026
jeremy added a commit that referenced this pull request Mar 25, 2026
jeremy added a commit that referenced this pull request Mar 25, 2026
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.
jeremy added a commit that referenced this pull request Mar 25, 2026
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.
jeremy added a commit that referenced this pull request Mar 25, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working commands CLI command implementations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants