Skip to content

feat(editions): support editions in plugin#1234

Merged
stephenh merged 8 commits into
stephenh:mainfrom
kellen-miller:editions-support-plugin
Dec 20, 2025
Merged

feat(editions): support editions in plugin#1234
stephenh merged 8 commits into
stephenh:mainfrom
kellen-miller:editions-support-plugin

Conversation

@kellen-miller

@kellen-miller kellen-miller commented Dec 19, 2025

Copy link
Copy Markdown
Contributor

Overview

Implements #1165

Enable edition-aware behavior in ts-proto and advertise edition support to protoc. Uses Edition enum from ts-proto-descriptors to derive proto3 syntax when syntax != proto2 and edition is 2023/2024.

Note

The package.json temporarily uses ts-proto-descriptors: "file:protos" for testing, will set it to the published 2.1.0 after the related protos PR is merged/released.

All the changes under protos/google/protobuf can be ignored, they are a part of the preliminary PR below. I just needed them here for testing.

Related PRs

@kellen-miller

kellen-miller commented Dec 19, 2025

Copy link
Copy Markdown
Contributor Author

I felt like this is kind of a misuse of the intent behind the isProto3Syntax flag, but I wanted to make as minimal edits as possible for the first pass. Could possibly have changed that field to something like isProto3Semantics to be more appropriate, but that would have involved modifying a lot more files and doesn't really solve the problem. This works as of now since edition syntax for 2023/2024 has not deviated from the proto3 syntax.

stephenh pushed a commit that referenced this pull request Dec 19, 2025
## Overview

Update descriptor/compiler protos to match protoc version v6.33.2 and
publish ts-proto-descriptors 2.1.0.

## Related PRs
- #1234
@stephenh

Copy link
Copy Markdown
Owner

Hello @kellen-miller ! Thank you for these PRs!

I just merged #1233 and then manually ran yarn npm publish for that ts-proto-descriptors project -- it changes so infrequently that I don't have auto-publishing setup yet.

Also because we update that so infrequently, it's kinda an adhoc/janky process, so I would not be surprised if things don't "just work". 😬

But would be really amazing if you could pull those into this PR and see if it does! 🤞 Let me know if you need another ts-proto-descriptors publish and thanks again for the PRs!

[WHY] align ts-proto behavior with protobuf editions

[WHAT] use Edition enum and supports-editions feature flag; add context test

[HOW] derive proto3 syntax from edition in FileDescriptorProto

[TEST] yarn test tests/context-test.ts

[RISK] temp file:protos dependency until descriptors are published

[RAG] ts-proto:protos/google/protobuf/descriptor.proto#filedescriptorproto, ts-proto:protos/google/protobuf/compiler/plugin.proto#feature-enum
@kellen-miller kellen-miller force-pushed the editions-support-plugin branch from 926d366 to 37adfae Compare December 19, 2025 17:16
@kellen-miller

Copy link
Copy Markdown
Contributor Author

sure thing let me sync and rebase

@kellen-miller

Copy link
Copy Markdown
Contributor Author

should be good for review now @stephenh!

@stephenh

Copy link
Copy Markdown
Owner

@kellen-miller ty! Looks like our CI check is failing just b/c of all the codegen churn caused by the protobuf bump -- can you run the codegen step locally and just push up all the changes?

[WHY] fix tsc checks after descriptor updates

[WHAT] add FileContext fields and enum visibility in tests

[HOW] use SymbolVisibility enum and edition defaults

[TEST] yarn tsc:check

[RISK] low; test-only changes

[RAG] ts-proto:protos/google/protobuf/descriptor.proto#filedescriptorproto
@kellen-miller

kellen-miller commented Dec 19, 2025

Copy link
Copy Markdown
Contributor Author

@stephenh Ran yarn build and yarn build:test and pushed the changes, looked like that fixed the diff output failures. Also fixed an issue that arose after that with the yarn tsc:check with this commit 17a7553

[WHY] satisfy prettier format check

[WHAT] reformat isProto3Edition boolean expression

[HOW] apply prettier to src/context.ts

[TEST] not run (format-only change)

[RISK] none

[RAG] ts-proto:src/context.ts#proto3-syntax
[WHY] descriptor updates add new fields to snapshots

[WHAT] refresh inline/meta-typings and options snapshots

[HOW] update jest snapshots using a temporary formatter shim

[TEST] yarn test integration/meta-typings/meta-typings-test.ts integration/options/options-test.ts

[RISK] low; snapshot-only changes

[RAG] ts-proto:protos/google/protobuf/descriptor.proto#filedescriptorproto
@kellen-miller

kellen-miller commented Dec 19, 2025

Copy link
Copy Markdown
Contributor Author

Seems like Jest’s inline snapshot updater calls Prettier v2 sync APIs (resolveConfig.sync / getFileInfo.sync). Prettier v3 removed those, so jest -u (and inline snapshot updates) break unless you provide a compatible Prettier. I had to use a temp local prettier v2 to update those files and get around jest -u not updating the snapshot. Snapshots updated in the this commit 9c93ed7

I've added a more permanent fix to pin the jest snapshotter to use prettier v2 in this commit ee5ba50 so it doesn't fail in the future. I can revert that change if you don't want to keep that in.

@stephenh

Copy link
Copy Markdown
Owner

Ah shoot, yeah sorry about that prettier snapshot thing -- pinning to v2 is a pretty great work around for me 😅 , ty!

This PR is really great; any others you'd like to submit are super welcome! I could use any/all help staying on top of the latest protobuf updates, as I'm personally not using them day-to-day atm, so can only help triage/land PRs from intrepid folks like yourself. :-)

@stephenh stephenh merged commit 19ce1e3 into stephenh:main Dec 20, 2025
6 checks passed
stephenh pushed a commit that referenced this pull request Dec 20, 2025
# [2.9.0](v2.8.3...v2.9.0) (2025-12-20)

### Features

* **editions:** support editions in plugin ([#1234](#1234)) ([19ce1e3](19ce1e3))
@stephenh

Copy link
Copy Markdown
Owner

🎉 This PR is included in version 2.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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