Skip to content

Fix campfire messages --limit being ignored#367

Merged
jeremy merged 1 commit intomainfrom
fix-campfire-messages-limit
Mar 24, 2026
Merged

Fix campfire messages --limit being ignored#367
jeremy merged 1 commit intomainfrom
fix-campfire-messages-limit

Conversation

@jeremy
Copy link
Copy Markdown
Member

@jeremy jeremy commented Mar 24, 2026

Summary

  • Pass --limit to the SDK via CampfireLineListOptions instead of nil, so pagination actually collects the requested number of messages
  • Remove the broken client-side trim that was both redundant (SDK handles truncation) and slicing the wrong end (returned oldest messages instead of newest)

Fixes #335. Also addresses the root cause of #284 (stale/old messages returned).

Test plan

  • TestChatMessagesLimit — mock returns 5 lines, --limit 3 asserts 3 in output
  • Manual: basecamp campfire messages --limit 50 --in <project> returns 50 messages (not 15)

Summary by cubic

Fixes the campfire messages --limit flag being ignored and validates the flag. Returns the newest N messages with correct pagination and early stop.

Written for commit 47ae290. Summary will update on new commits.

Copilot AI review requested due to automatic review settings March 24, 2026 18:15
@github-actions github-actions bot added commands CLI command implementations tests Tests (unit and e2e) bug Something isn't working labels Mar 24, 2026
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: 48f4a5630e

ℹ️ 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

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 campfire/chat messages --limit being ignored by ensuring the CLI forwards the requested limit into the Basecamp SDK’s campfire line listing call, rather than fetching a default-sized page and trimming client-side afterward (which also previously selected the wrong end of the slice).

Changes:

  • Forward --limit to the SDK via CampfireLineListOptions{Limit: ...} when listing campfire lines.
  • Remove the incorrect client-side post-fetch trimming logic.
  • Add a regression test intended to validate --limit behavior for chat messages.

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.

Reviewed changes

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

File Description
internal/commands/chat.go Passes --limit into ListLines and removes client-side slicing so the SDK controls pagination/truncation.
internal/commands/chat_test.go Adds a new test + mock transport for validating chat messages --limit.

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

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

@jeremy jeremy force-pushed the fix-campfire-messages-limit branch from 48f4a56 to d044b01 Compare March 24, 2026 18:26
Copilot AI review requested due to automatic review settings March 24, 2026 18:30
@jeremy jeremy force-pushed the fix-campfire-messages-limit branch from d044b01 to b6fd750 Compare March 24, 2026 18:30
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 3 comments.


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

@jeremy jeremy force-pushed the fix-campfire-messages-limit branch from b6fd750 to 6ed6dd3 Compare March 24, 2026 19:02
Copilot AI review requested due to automatic review settings March 24, 2026 19:06
@jeremy jeremy force-pushed the fix-campfire-messages-limit branch from 6ed6dd3 to 6e48099 Compare March 24, 2026 19:06
@github-actions github-actions bot added the breaking Breaking change label Mar 24, 2026
@github-actions
Copy link
Copy Markdown

⚠️ Potential breaking changes detected:

  • Behavior of the --limit flag has changed: previously, when the --limit flag was used, the CLI would retrieve messages and filter for the last N messages locally. Now, the Limit parameter is instead passed directly to the SDK/API to retrieve the first N messages (newest-first). This change could break scripts relying on the old behavior.
  • Error handling was added for the --limit flag: if a negative value is provided, an error message is returned ('--limit must be a positive number'), and the CLI exits with a usage error. Previously, negative values were ignored. This could change exit codes for invalid input scenarios.

Review carefully before merging. Consider a major version bump.

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 2 comments.


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

Pass the user's --limit value to the SDK via CampfireLineListOptions
instead of nil, so the SDK paginates to collect the requested number
of messages. Remove the broken client-side trim that was both redundant
and slicing the wrong end (oldest instead of newest).

Fixes #335
@jeremy jeremy force-pushed the fix-campfire-messages-limit branch from 6e48099 to 47ae290 Compare March 24, 2026 19:13
@github-actions github-actions bot removed the breaking Breaking change label Mar 24, 2026
@jeremy jeremy merged commit fe45ce5 into main Mar 24, 2026
26 checks passed
@jeremy jeremy deleted the fix-campfire-messages-limit branch March 24, 2026 19:17
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 tests Tests (unit and e2e)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

campfire messages --limit is silently capped at 15 — pagination not followed

2 participants