feat(allowlist): add Thrift and Cap'n Proto support - #960
Merged
Conversation
Contributor
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 3 selected item(s). |
chethanuk
force-pushed
the
wf/thrift-capnp-allowlist
branch
from
August 17, 2026 06:21
66d122a to
2b0c847
Compare
Contributor
Author
|
@lizhengfeng101 Please review and merge this. Future main updates might cause more conflicts. Thanks :) |
chethanuk
force-pushed
the
wf/thrift-capnp-allowlist
branch
from
August 17, 2026 07:35
2b0c847 to
b99c62c
Compare
wu21-web
approved these changes
Aug 17, 2026
chethanuk
force-pushed
the
wf/thrift-capnp-allowlist
branch
from
August 17, 2026 12:30
b99c62c to
4e57d59
Compare
kefu84510-cmd
approved these changes
Aug 17, 2026
chethanuk
force-pushed
the
wf/thrift-capnp-allowlist
branch
from
August 18, 2026 08:50
4e57d59 to
709246c
Compare
Contributor
Author
|
@lizhengfeng101 Please review and merge this. Future main updates might cause more conflicts. I resolved conflicts 3 times now... Thanks :) |
| "**/test/**/*.zig", | ||
| "**/*_test.zig" | ||
| "**/*_test.zig", | ||
| "**/gen-{cpp,cpp2,c_glib,cocoa,csharp,netstd,dart,erl,go,hs,hs2,java,js,nodejs,kotlin,lua,perl,php,py,py3,rb,rs,swift}/**/*.{c,cc,cpp,cs,dart,erl,go,h,hrl,hs,java,js,kt,lua,m,mm,php,pl,pm,py,pyi,rb,rs,swift,ts}", |
Collaborator
There was a problem hiding this comment.
@chethanuk I feel that the hit rate for this matching rule is quite low and it is prone to accidental deletion; could we remove it?
Suggested change
| "**/gen-{cpp,cpp2,c_glib,cocoa,csharp,netstd,dart,erl,go,hs,hs2,java,js,nodejs,kotlin,lua,perl,php,py,py3,rb,rs,swift}/**/*.{c,cc,cpp,cs,dart,erl,go,h,hrl,hs,java,js,kt,lua,m,mm,php,pl,pm,py,pyi,rb,rs,swift,ts}", |
Thrift IDL (.thrift) and Cap'n Proto schema (.capnp) files were dropped at the extension gate, so no rule could ever run on them. Both are IDLs whose main review risk is silent wire-compatibility breakage, which is exactly what protobuf.md already covers for .proto. Adds both extensions to the allowlist, registers thrift.md and capnp.md in path_rule_map, and excludes the compilers' generated output. The gen-* and kitex_gen excludes are scoped by extension rather than by directory because IsExcludedPath applies every pattern to every path with no language dispatch; a bare gen-*/** would drop unrelated files in other languages. Data only, no Go source changes.
chethanuk
force-pushed
the
wf/thrift-capnp-allowlist
branch
from
August 18, 2026 09:53
709246c to
7f6787d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
.thriftand.capnpfiles were never reviewed. Neither extension is insupported_file_types.json, soIsAllowedExtdrops them at the filter gate before any rule can run.This adds both to the allowlist and registers
**/*.thrift→thrift.mdand**/*.capnp→capnp.mdinpath_rule_map. Two docs rather than one shared IDL doc, because almost nothing carries over between them. Thrift breaks when arequiredfield is added to a live struct, when a retired field id is reused (there is noreservedkeyword to hold it open), and when a service method is renamed, since method names travel on the wire. Cap'n Proto breaks when an@Nordinal moves, when aUInt32is widened toUInt64(fixed-width slots, unlike a protobuf varint), and when a struct is renamed with no explicit@0x...id pinned, since the id is derived from the name. A merged doc would spend half its lines telling the model which half to ignore. Data only, no Go source changes.The generated-output excludes are scoped by extension (
**/gen-{cpp,cpp2,go,py,...}/**/*.{c,cc,go,py,...}, not a bare**/gen-*/**).IsExcludedPathapplies every pattern to every path with no language dispatch, so an unscoped directory glob would drop unrelated files in other languages that happen to sit under a colliding directory name. That is why the file already carries**/Tests/**/*.swiftand**/tests/**/*.nimrather than the directory alone. Three negative rows inTestIsExcludedPathfail if anyone broadens it later.Only the Cap'n Proto C++ header gets a pattern. The generator also emits
.capnp.c++, but.c++was never allowlisted, so those files are already gone by the timeIsExcludedPathruns.Limitation
.thriftand.capnpdiffs that used to be skipped are now reviewed. Anyone who does not want that opts out with user exclude globs, which are checked before the allowlist.Type of Change
How Has This Been Tested?
make testpasses locallyRows appended to the existing table tests:
TestIsAllowedExt—.thriftand.capnp, both cases.TestIsExcludedPath— thegen-*,kitex_genand Cap'n Proto output patterns, plus negatives (tools/gen-go/config.yaml,site/gen-js/index.html,kitex_gen/api/schema.json) that fail if the patterns lose their extension scope, andidl/service.thrift/schema/addressbook.capnpto pin that the schemas themselves stay in review.TestResolve_DefaultRules—.thriftand.capnppaths resolve by heading anchors unique to each doc.Checklist
go fmt,go vet)The rule table in
pages/src/content/docs/{en,ja,ru,zh}/review-rules.mdlists both new patterns.Related Issues
Part of #470.