Skip to content

Document the exported message.Message.String and message.Message.Usage accessors - #719

Open
PratikDhanave wants to merge 2 commits into
microsoft:mainfrom
PratikDhanaveFork:document-message-string-usage-accessors
Open

Document the exported message.Message.String and message.Message.Usage accessors#719
PratikDhanave wants to merge 2 commits into
microsoft:mainfrom
PratikDhanaveFork:document-message-string-usage-accessors

Conversation

@PratikDhanave

Copy link
Copy Markdown
Contributor

What

Add godoc comments to the exported Message.String and Message.Usage accessors in message/message.go, which were the only undocumented exported methods on Message (their neighbors NewText and Clone are already documented).

Why

Message.String implements fmt.Stringer, and Message.Usage exposes aggregated token usage — both are part of the public surface that shows up in go doc and IDE hovers. Leaving them blank makes the type read as partially documented. Both simply delegate to the already-documented Contents.Text and Contents.Usage helpers, so the comments state that delegation explicitly.

This mirrors the .NET / Python SDKs, where the equivalent message text (ChatMessage.Text / .text) and usage accessors are documented API members; adding the comments keeps the Go port aligned with that cross-SDK expectation.

Tests

Docs-only change. Verified with go build ./..., go vet ./message/..., and go test ./message/... (all green), and confirmed the new comments render via go doc ./message Message.String and go doc ./message Message.Usage.

@PratikDhanave
PratikDhanave requested a review from a team as a code owner July 24, 2026 03:17
Copilot AI review requested due to automatic review settings July 24, 2026 03:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds GoDoc comments for the remaining exported Message accessors so the message package’s public API surface is fully documented in go doc/IDE hovers.

Changes:

  • Documented (*Message).String() as the fmt.Stringer implementation (delegating to Contents.Text).
  • Documented (*Message).Usage() as the aggregated usage accessor (delegating to Contents.Usage).

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

Comment thread message/message.go
Comment on lines +64 to +65
// String implements fmt.Stringer, returning the concatenated text of all
// TextContent in the message (delegating to Contents.Text).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch — fixed in 732e4b7: rather than weaken the new String() doc, I corrected the stale Contents.Text godoc, which claimed "first text content" while the implementation actually concatenates all TextContent. Both public docs now consistently describe the concatenation semantics.

@github-actions

This comment has been minimized.

@github-actions github-actions Bot added the parity-approved Go API consistency review found no parity issues label Jul 24, 2026
@github-actions

This comment has been minimized.

Add godoc to the exported String and Usage methods, matching their
documented neighbors NewText and Clone. String satisfies fmt.Stringer;
both delegate to the already-documented Contents.Text and Contents.Usage
helpers, so the comments make the Message-level API self-describing in
go doc.
@PratikDhanave
PratikDhanave force-pushed the document-message-string-usage-accessors branch from 732e4b7 to 6a0274b Compare July 24, 2026 09:31
@github-actions

Copy link
Copy Markdown
Contributor

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

Generated by Go API Consistency Review Agent · 15.3 AIC · ⌖ 3.85 AIC · ⊞ 5.9K ·

@gdams
gdams added this pull request to the merge queue Jul 29, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Jul 29, 2026
@gdams
gdams enabled auto-merge July 29, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parity-approved Go API consistency review found no parity issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants