Skip to content

fix: 32-bit build, strict resolvers, Result.Files errors, Editions 2023 features, and stable protobuf - #1

Merged
ZergsLaw merged 5 commits into
mainfrom
fix/easyp-integration-readiness
Nov 22, 2026
Merged

ZergsLaw merged 5 commits into
mainfrom
fix/easyp-integration-readiness

Conversation

@ZergsLaw

Copy link
Copy Markdown
Contributor

Summary

Addresses five readiness issues for embedding easyprotoc as a Go library:

  1. 32-bit compatibility (lexer/lexer.go, .github/workflows/ci.yml):
    • Cast len(src) to uint64 before comparing against math.MaxUint32 so 32-bit targets (e.g., linux/arm7) compile cleanly.
    • Added GOOS=linux GOARCH=arm GOARM=7 go build ./... to the CI build step.
  2. Strict custom resolver isolation & error propagation (protoc/compile.go, protoc/resolver.go, internal/compiler/driver.go):
    • Disabled automatic DirResolver appending and os.Stat/os.ReadFile fallbacks whenever a custom Resolver is provided via WithResolver.
    • Introduced compiler.ErrFileNotFound / FileNotFoundError (aliased by protoc.ErrFileNotFound) so non-not-found resolver errors (such as context.Canceled, permission errors, or sandbox rejections) propagate intact through Compile and import traversal without being masked as File not found. or ErrCompilationFailed.
  3. Result.Files() error handling, option extension resolution, and deadlock fix (protoc/result.go, protoc/protoc_test.go):
    • Changed (*Result).Files() to return ([]protoreflect.FileDescriptor, error) instead of silently returning nil on proto.Unmarshal or protodesc.NewFiles failures.
    • When compiled files declare extensions, re-unmarshal wire bytes using a dynamicpb extension resolver so option extensions (including feature extensions like pb.cpp) are exposed as typed fields via protoreflect (zero overhead fast path when no extensions are present).
    • Fixed a latent mutex re-entry deadlock in CodeGeneratorRequest via descriptorSetLocked().
  4. Editions 2023 features.* and features.(ext).* (parser/parser.go, internal/options/features.go, internal/options/evaluator.go, internal/serialize/wire.go):
    • Added support for parenthesized extension segments after . in field option names and aggregate fields (e.g., [features.(pb.cpp).string_type = VIEW]).
    • Added evaluation and wire serialization for features across all 9 descriptor *Options types, with a built-in google.protobuf.FeatureSet schema fallback so edition files work even without importing google/protobuf/descriptor.proto.
    • Added EDITION_UNSTABLE and EDITION_MAX to resolveEdition in wire serialization.
    • Added comprehensive tests in protoc/integration_readiness_test.go.
  5. Stable google.golang.org/protobuf dependency (go.mod, bench/go.mod):
    • Replaced pre-release google.golang.org/protobuf v1.37.0-rc.1 with stable v1.36.12 in both the root and bench modules.

Verification

  • test -z "$(gofmt -l .)"
  • go vet ./... and (cd bench && go vet ./...)
  • golangci-lint run ./... and (cd bench && golangci-lint run --config ../.golangci.yml ./...) (0 issues)
  • GOOS=linux GOARCH=arm GOARM=7 go build ./... and go test -c across all packages
  • go test -race -count=1 ./...
  • bench/run.sh parity (wkt, compute, api-common, googleapis: all match protoc)

Cast len(src) to uint64 before comparing with math.MaxUint32 so the lexer
compiles on 32-bit targets (such as linux/arm7), and add a linux/arm7
cross-build check to CI.
…d errors

Do not append DirResolver or fall back to os.Stat/os.ReadFile when a custom
Resolver is configured via WithResolver. Propagate non-ErrFileNotFound
resolver errors (such as context cancellation or sandbox/I/O failures) out
of Compile and import traversal without swallowing them.
Change (*Result).Files to return ([]protoreflect.FileDescriptor, error)
instead of silently returning nil when proto.Unmarshal or protodesc.NewFiles
fails. When compiled files declare extensions, re-unmarshal wireBytes with a
dynamicpb extension resolver so option extensions are typed in protoreflect.
Also avoid re-locking r.mu inside CodeGeneratorRequest.
… extensions

Support parenthesized extension segments after '.' in field option and
aggregate field names (e.g. features.(pb.cpp).string_type), evaluate and
serialize FeatureSet options across all descriptor option targets with a
built-in FeatureSet schema fallback, handle EDITION_UNSTABLE/EDITION_MAX in
wire serialization, and add integration readiness tests.
Replace the pre-release google.golang.org/protobuf v1.37.0-rc.1 dependency
with stable v1.36.12 in the root module and bench module.
@ZergsLaw
ZergsLaw merged commit e58bd1c into main Nov 22, 2026
4 checks passed
@ZergsLaw
ZergsLaw deleted the fix/easyp-integration-readiness branch November 22, 2026 16:28
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