Skip to content

feat(tickets)!: remove the deprecated top-level totalMessageCount - #302

Merged
SyniRon merged 1 commit into
developfrom
agent/remove-total-message-count
Nov 3, 2026
Merged

SyniRon merged 1 commit into
developfrom
agent/remove-total-message-count

Conversation

@SyniRon

@SyniRon SyniRon commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

Closes #301

Summary

The ticket detail response carried a second message count next to ticket.totalMessageCount. The spec deprecated it with "Removal target: v2.3.0". It goes, and so does the COUNT query that only fed it.

 GetTicketResponse
   ticket
     totalMessageCount        # replyCount + 1, unchanged
   firstMessages
-  totalMessageCount          # COUNT of visible message rows

 writeTicketResponse
-  msgs, total = GetTicketFirstMessages(...)   # COUNT query + page query
+  msgs = GetTicketFirstMessages(...)          # page query only

The two counts disagreed whenever a thread had hidden messages. On fixture ticket 1, ticket.totalMessageCount is 3 and the top-level value was 2, because one reply is a hidden internal note. A caller that needs the visible-only number now counts the messages from GET /api/v1/tickets/{ticketId}/messages.

Evidence

  • Before: develop against the seeded harness database:
    $ curl .../api/v1/tickets/1 | jq '{keys: keys, ticketTotal: .ticket.totalMessageCount, topTotal: .totalMessageCount}'
    {"keys":["firstMessages","ticket","totalMessageCount"],"ticketTotal":3,"topTotal":2}
    $ curl .../api/v1/tickets/ref/AA-0001 | jq ...
    {"keys":["firstMessages","ticket","totalMessageCount"],"ticketTotal":3,"topTotal":2}
    
    After: this branch against the same database:
    $ curl .../api/v1/tickets/1 | jq ...
    {"keys":["firstMessages","ticket"],"ticketTotal":3,"topTotal":null}
    $ curl .../api/v1/tickets/ref/AA-0001 | jq ...
    {"keys":["firstMessages","ticket"],"ticketTotal":3,"topTotal":null}
    
  • Only the get_by_id_happy and get_by_ref_happy goldens change, and each just loses the top-level field.
  • go vet ./..., go test ./... without the harness, go test -v ./testdb ./datastores with the MariaDB harness (0 skips), and go test -race ./... with the harness all pass.

Merge Danger

Door: two-way

Releases are a manual step, so merging changes nothing in production. A revert brings the field and its query back.

Blast Radius: tickets clients

This breaks the wire shape and belongs in the same 4.0.0 release as #296. The tickets MCP is the only client, and it never reads the top-level field.

Reviewed with sol-loop: 1 round with gpt-6.1-sol. Sol verdict: approved

Created with Claude Opus 5.5 in T3 Code, reviewed by gpt-6.1-sol.

Note

🤖 Opus 5.5 responding on behalf of SyniRon

The ticket detail response carried a second message count, deprecated
since v2.3.0 in favor of ticket.totalMessageCount. It cost a COUNT query
per request and disagreed with ticket.totalMessageCount on threads with
hidden messages. GetTicketFirstMessages now returns only the messages.

BREAKING CHANGE: GetTicketResponse drops the top-level totalMessageCount.

Closes #301
@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 8 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 16c78a83-ee25-4f88-9607-3b7cae5f666f
Commits

Reviewing files that changed from the base of the PR and between 2c6394a and 68f0b2a.

Files selected for processing: 13
  • contract/battery.go
  • contract/fake_datastore_test.go
  • contract/goldens/tickets/get_by_id_happy.golden.json
  • contract/goldens/tickets/get_by_ref_happy.golden.json
  • datastores/datastore.go
  • datastores/tickets.go
  • datastores/tickets_harness_test.go
  • openapi/openapi.yaml
  • rest/fake_tickets_test.go
  • rest/rest_test.go
  • rest/tickets.go
  • rest/tickets_test.go
  • types/tickets.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@SyniRon
SyniRon merged commit 50eb9f8 into develop Nov 3, 2026
5 checks passed
@SyniRon
SyniRon deleted the agent/remove-total-message-count branch November 3, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tickets: remove the deprecated top-level totalMessageCount

1 participant