Skip to content

fix(messages): allow Update to clear a message's category - #838

Merged
jeremy merged 5 commits into
mainfrom
fix/message-clear-category
Sep 2, 2026
Merged

fix(messages): allow Update to clear a message's category#838
jeremy merged 5 commits into
mainfrom
fix/message-clear-category

Conversation

@jeremy

@jeremy jeremy commented Sep 2, 2026

Copy link
Copy Markdown
Member

What

MessagesService.Update could set a message's category but never remove one. Since BC3 became presence-aware, an omitted category_id is left unchanged, and the generated *int64 category_id has no spelling that clears — leaving the TUI/CLI unable to un-categorize a message.

Change

Additive public API on UpdateMessageRequest:

  • CategoryID int64 stays the set path (0 = leave unchanged), preserving the integer set-wire type. Kept int64 rather than switching to *int64 — the pointer change would be a breaking change to an existing exported field, and the repo prefers the additive path here.
  • New ClearCategory bool carries the clear. It is a control flag (json:"-"), never marshaled directly.

Wire behavior (Update now hand-marshals its body):

Request Body
ClearCategory: true {"category_id":""}
CategoryID: 42 {"category_id":42}
neither set category_id omitted (category unchanged)
both set {"category_id":""}ClearCategory wins

The clear goes on the wire as category_id: ""never null. SPEC §18 forbids null-for-clear and 5/6 SDKs strip nulls structurally, so "" is the only clear all six SDKs express identically. bc3 blank-casts ""nil to clear (basecamp/bc3#12521, messages_controller.rb find_category).

This mirrors CardsService.UpdateVerbatim, which clears due_on the same way via a hand-marshaled map (SPEC §18 rule-1 carve-out). No conflict precedent exists in the generated surface (Cards uses a single pointer field), so the documented rule is ClearCategory wins.

No spec change — the encoding is expressed entirely at the wire, so spec/basecamp.smithy and generated code are untouched.

Tests

  • TestMessagesUpdateBodyBytes (wire_bodies_test.go) — byte-level pins for set / clear / leave-unaddressed / clear-wins / set-alongside-other-fields.
  • TestMessagesService_UpdateCategory (messages_test.go) — presence semantics: clear is present-and-empty (""), set is the integer, unaddressed omits the key, clear wins.

Checks

make check (Go: fmt/vet/lint/test) green. Targeted cross-SDK parity gates green: go-check-drift, go-check-wrapper-drift, go-check-optional-pointers, check-write-semantics-parity, check-fixture-coverage.

Refs card 10264999579.


Summary by cubic

Lets MessagesService.Update clear a message's category. Previously an omitted category_id was left unchanged and the generated *int64 field could not spell a clear, so the TUI/CLI had no way to un-categorize a message.

Wire semantics

  • UpdateMessageRequest gains ClearCategory; CategoryID still sets the category (0 = leave unchanged).
  • ClearCategory sends category_id as "" on the wire — never null — which BC3 blank-casts to nil to clear; the clear is Go-only since the shared contract still models category_id as an integer.
  • ClearCategory wins when both fields are set.
  • Update hand-marshals its body; SPEC §18 and AGENTS.md now list the category_id clear as a second instance of the hand-marshal carve-out alongside the date clears.

Written for commit 85c7e47. Summary will update on new commits.

Review in cubic

MessagesService.Update could set a category but never remove one: an
omitted category_id is left unchanged since BC3 became presence-aware,
and the generated *int64 category_id cannot spell the clear.

Add ClearCategory to UpdateMessageRequest (additive; CategoryID int64
stays the set path) and hand-marshal the update body so a clear reaches
the wire as category_id: "" — never null (SPEC §18), the one clear
encoding all six SDKs express identically. BC3 blank-casts "" to nil to
clear (basecamp/bc3#12521). This mirrors CardsService.UpdateVerbatim,
which clears due_on the same way. ClearCategory wins over CategoryID.
Copilot AI balanced review requested due to automatic review settings September 2, 2026 15:35
@github-actions github-actions Bot added the go label Sep 2, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-02T16:54:34.500550Z 85c7e47 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread go/pkg/basecamp/messages.go

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

Copy link
Copy Markdown

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: 74857ffd3d

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

Comment thread go/pkg/basecamp/messages.go
Comment thread go/pkg/basecamp/messages.go

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The canonical hand-marshaled-body inventories must document this new carve-out.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds Go support for explicitly clearing a message category while preserving existing update semantics.

Changes:

  • Adds the ClearCategory request control flag.
  • Sends category_id: "" when clearing.
  • Adds wire-level and service-level tests.

[!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.

File summaries
File Description
go/pkg/basecamp/messages.go Implements and documents category clearing.
go/pkg/basecamp/messages_test.go Tests category presence semantics.
go/pkg/basecamp/wire_bodies_test.go Pins exact serialized request bodies.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread go/pkg/basecamp/messages.go
@jeremy

jeremy commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

@codex review

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

SPEC.md §18 must document the newly introduced hand-marshaling carve-out.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread go/pkg/basecamp/helpers.go

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

Copy link
Copy Markdown

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: bc4abf9954

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

Comment thread go/pkg/basecamp/helpers.go Outdated
@jeremy

jeremy commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

@codex review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 1 file (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread SPEC.md

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

Copy link
Copy Markdown

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: 92d67575f1

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

Comment thread SPEC.md
@jeremy

jeremy commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 0c6921232e

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

@jeremy

jeremy commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

@codex review

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

Copy link
Copy Markdown

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: 0c6921232e

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

Comment thread go/pkg/basecamp/messages.go Outdated
@jeremy

jeremy commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 85c7e47774

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

@jeremy

jeremy commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

@codex review

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

Copy link
Copy Markdown

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: 85c7e47774

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

Comment thread go/pkg/basecamp/messages.go
@jeremy
jeremy merged commit 96fc4ea into main Sep 2, 2026
55 of 57 checks passed
@jeremy
jeremy deleted the fix/message-clear-category branch September 2, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants