Skip to content

Document generated struct evolution policy#244

Merged
iainmcgin merged 3 commits into
anthropics:mainfrom
Yong-yuan-X:fix/generated-struct-evolution-policy
Jun 27, 2026
Merged

Document generated struct evolution policy#244
iainmcgin merged 3 commits into
anthropics:mainfrom
Yong-yuan-X:fix/generated-struct-evolution-policy

Conversation

@Yong-yuan-X

Copy link
Copy Markdown
Contributor

Summary

Refs #202.

  • Add a generated struct evolution policy note to owned message, eager view, and lazy view struct docs.
  • Document that generated structs may gain fields and that exhaustive struct literals/destructuring are not covered by buffa's semver guarantees.
  • Keep this scoped to the Option 2 direction from the issue discussion: documentation only, no #[non_exhaustive] and no new builder API.
  • Regenerate checked-in buffa-types and buffa-descriptor outputs so the new rustdoc note appears in committed generated code.

Testing

  • cargo fmt --all --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo check --workspace --all-features
  • cargo test -p buffa-codegen comments
  • cargo test --workspace -- --skip timestamp_ext::tests::systemtime_roundtrip_post_epoch
  • Additional no_std / 32-bit / MSRV / miri checks run locally

Notes

  • cargo test --workspace has one Windows-only SystemTime precision failure locally; the workspace test pass succeeds when that single test is skipped.
  • Docker is not available in this local environment, so conformance was not run locally.

@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@Yong-yuan-X

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Jun 26, 2026
Per maintainer review on anthropics#244: the policy is a library-level contract, so
it belongs on the runtime trait docs (alongside the existing serialization
model / thread safety / manual-impl sections) rather than repeated on
every generated struct. The per-struct note also became the rustdoc
summary line for any proto message without a leading comment, which
polluted module indexes and search.

- Add a '# Struct evolution policy' section to the buffa::Message trait
  doc, with the full text including an explicit blessing of
  Foo { x, ..Default::default() } and the deliberate-not-non_exhaustive
  rationale.
- Add one-line cross-references from MessageView and LazyMessageView.
- Revert the per-struct codegen note and the checked-in regen.
- Keep the docs/guide.md bullet (now linking to the trait section).
- Merge origin/main for the changie infra and add a Changed fragment.

Refs anthropics#202.
@iainmcgin

Copy link
Copy Markdown
Collaborator

[claude code] Thanks for the PR — this is exactly the Option-2 direction from #202 and the guide bullet is spot on.

After reviewing, we decided the policy reads better as a library-level statement than as text repeated on every generated struct, so I've pushed a maintainer commit that reshapes the change:

  • Moved the full policy text to a new # Struct evolution policy section on the buffa::Message trait doc, with one-line cross-references from MessageView and LazyMessageView. The trait docs are where buffa already documents library-level contracts about generated structs (serialization model, thread safety, manual-impl discouragement), so this keeps the policy alongside them.
  • Reverted the per-struct codegen note. The main reason: for any proto message without a leading comment, the note became the type's rustdoc summary line, so module indexes and search results showed identical boilerplate for every doc-less type.
  • Kept your docs/guide.md bullet, tweaked to explicitly bless Foo { x, ..Default::default() } struct-update syntax and to link to the trait section.
  • Merged origin/main (the base predated the changie adoption in changelog: adopt changie fragment files to end CHANGELOG merge conflicts #230) and added a .changes/unreleased/ fragment.

Verified locally: task lint, cargo test -p buffa, cargo doc -p buffa with -D rustdoc::broken_intra_doc_links, and the #struct-evolution-policy HTML anchor.

If we later want point-of-use discoverability on individual structs, a one-line per-struct intra-doc link to this trait section is the natural follow-up — but that can wait for actual usage feedback, same as the Option-3 builders.

@iainmcgin iainmcgin enabled auto-merge June 27, 2026 00:25
@iainmcgin iainmcgin added this pull request to the merge queue Jun 27, 2026
Merged via the queue into anthropics:main with commit 8f5b067 Jun 27, 2026
9 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants