Skip to content

fix: accept structured annotations in responses output#136

Merged
SantiagoDePolonia merged 1 commit intomainfrom
gom-86-structured-annotations
Mar 12, 2026
Merged

fix: accept structured annotations in responses output#136
SantiagoDePolonia merged 1 commit intomainfrom
gom-86-structured-annotations

Conversation

@SantiagoDePolonia
Copy link
Copy Markdown
Contributor

@SantiagoDePolonia SantiagoDePolonia commented Mar 12, 2026

Summary by CodeRabbit

  • New Features

    • Extended annotation support to accept structured JSON payloads, enabling richer annotation data beyond simple text strings.
  • Tests

    • Added test coverage for structured annotations handling and serialization round-trip validation.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 84e01cca-a637-4ffb-904a-70ed22d94f71

📥 Commits

Reviewing files that changed from the base of the PR and between 4899d25 and af89bff.

📒 Files selected for processing (5)
  • internal/core/responses.go
  • internal/core/responses_json_test.go
  • internal/providers/openai/openai_test.go
  • internal/providers/responses_adapter.go
  • internal/providers/responses_output_state.go

📝 Walkthrough

Walkthrough

The pull request modifies the annotation structure across the codebase to support arbitrary JSON payloads instead of plain strings. The Annotations field type changes from []string to []json.RawMessage in core data structures, adapters, and output formatters. New tests validate JSON unmarshalling and structured annotation handling.

Changes

Cohort / File(s) Summary
Core Data Structure
internal/core/responses.go
Updated ResponsesContentItem.Annotations field type from []string to []json.RawMessage to support arbitrary JSON annotation payloads, with added explanatory comment.
Test Coverage
internal/core/responses_json_test.go, internal/providers/openai/openai_test.go
Added tests validating structured annotation JSON unmarshalling, round-trip serialization, and annotation type assertions.
Provider Implementation
internal/providers/responses_adapter.go, internal/providers/responses_output_state.go
Updated all annotation field initialization and assignments from []string to []json.RawMessage across response building paths and output state generation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Hops of joy! The annotations dance,
No longer strings in rigid stance—
Raw JSON messages now take flight,
Structured data, gleaming bright! ✨
Tests confirm the path is true.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: accept structured annotations in responses output' accurately describes the main change—broadening the Annotations field type from []string to []json.RawMessage to support structured annotation payloads.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch gom-86-structured-annotations
📝 Coding Plan for PR comments
  • Generate coding plan

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@SantiagoDePolonia SantiagoDePolonia merged commit 9aa359c into main Mar 12, 2026
13 checks passed
@SantiagoDePolonia SantiagoDePolonia deleted the gom-86-structured-annotations branch March 22, 2026 14:26
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.

1 participant