Skip to content

feat(cfg): setup config.proto code generation and privacy scrubber - #4958

Open
PranjalC100 wants to merge 4 commits into
masterfrom
feat-telemetry-schema-gen
Open

feat(cfg): setup config.proto code generation and privacy scrubber#4958
PranjalC100 wants to merge 4 commits into
masterfrom
feat-telemetry-schema-gen

Conversation

@PranjalC100

@PranjalC100 PranjalC100 commented Jul 28, 2026

Copy link
Copy Markdown
Member

Description

This pull request establishes the foundational schema infrastructure by automatically generating the cfg/config.proto definition directly from cfg/params.yaml, which acts as the single source of truth for the telemetry payload.

Key Features:

  • Automated Protobuf Generation: Uses a new proto3 template config_proto.tpl and a compilation loop in tools/config-gen/main.go to auto-generate the schema with sequential field tags.
  • Tag Registry & Schema Evolution: Enforces strict backward compatibility. The generator parses the existing config.proto file to extract and re-use previously assigned field tags, and automatically calculates maxTag + 1 to assign to any entirely new configuration parameters.
  • Integrated Privacy Scrubber: To prevent logging PII, parser.go maps high-risk text types (string, resolvedPath, []string) into safe boolean indicators (e.g., is_app_name_set).

File changes:

  • cfg/config.proto: The auto-generated Protobuf definition file derived from the configuration source.
  • tools/config-gen/main.go: Refactored the generator output loop to support .proto file compilation.
  • tools/config-gen/parser.go: Implements the populateProtoMetadata mapping and the privacy scrubbing logic for high-risk types.
  • tools/config-gen/type_template_data_gen.go: Parses the existing config.proto to build a tag registry, exposing proto metadata and dynamically assigning stable backward-compatible field tags into the templates.
  • tools/config-gen/templates/config_proto.tpl: A new text/template directive to format the output into proto3 syntax.

Testing details

Manually verified the generated sequential tags and privacy nomenclatures. Added exhaustive unit tests in parser_test.go and type_template_data_gen_test.go to validate both the privacy logic and the backward-compatible tag assignment.

Backward Compatibility

Enforced by design. Older flag definitions (even deprecated ones) retain their explicit tags to prevent tag collisions and schema breaks in legacy GCSFuse versions.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces automated generation of a Protocol Buffers configuration schema (config.proto) by updating the configuration generator tool (tools/config-gen). It maps configuration parameters to proto types, assigns sequential tags, and generates the proto file using a new template. Feedback on this PR suggests using the leaf segment of the configuration path instead of the full flag name to prevent redundant field names in nested proto messages (e.g., FileCacheConfig.file_cache_max_size_mb). Additionally, it is recommended to use filepath.Join instead of path.Join in the generator tool to ensure cross-platform compatibility.

Comment thread tools/config-gen/parser.go
Comment thread tools/config-gen/main.go
@PranjalC100
PranjalC100 force-pushed the feat-telemetry-schema-gen branch from 4b89270 to 61c7a48 Compare July 28, 2026 20:21
@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.80%. Comparing base (ab36809) to head (99a923c).

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #4958       +/-   ##
===========================================
+ Coverage        0   83.80%   +83.80%     
===========================================
  Files           0      173      +173     
  Lines           0    21334    +21334     
===========================================
+ Hits            0    17879    +17879     
- Misses          0     2775     +2775     
- Partials        0      680      +680     
Flag Coverage Δ
unittests 83.80% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@PranjalC100
PranjalC100 force-pushed the feat-telemetry-schema-gen branch 7 times, most recently from 0b7b051 to 1755c75 Compare July 29, 2026 09:42
@PranjalC100
PranjalC100 marked this pull request as ready for review July 29, 2026 09:44
@PranjalC100
PranjalC100 requested review from a team and meet2mky as code owners July 29, 2026 09:44
@github-actions github-actions Bot added the remind-reviewers Auto remind reviewers in attention set for review post 24hrs of inactivity on PR. label Jul 29, 2026
Comment thread cfg/config.proto Outdated
@github-actions

Copy link
Copy Markdown

Hi @kislaykishore, @meet2mky, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

3 similar comments
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Hi @kislaykishore, @meet2mky, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Hi @kislaykishore, @meet2mky, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Hi @kislaykishore, @meet2mky, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

@PranjalC100 PranjalC100 added execute-integration-tests Run only integration tests execute-integration-tests-on-zb To run E2E tests on zonal bucket. labels Aug 5, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

Hi @kislaykishore, @meet2mky, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

Comment thread cfg/config.proto Outdated
Comment thread tools/config-gen/type_template_data_gen_test.go
Comment thread tools/config-gen/templates/config_proto.tpl Outdated
This commit establishes the foundational schema infrastructure by introducing automated Protobuf schema generation and a privacy scrubber for high-risk text fields.

File-by-file changes:
- cfg/config.proto: The generated Protobuf definition file derived from params.yaml, establishing the single source of truth for the telemetry payload.
- tools/config-gen/main.go: Refactored the generator output loop to support compiling .proto files.
- tools/config-gen/parser.go: Added populateProtoMetadata mapping logic to convert native Go types into Protobuf equivalents. Also introduced the implicit privacy scrubber that automatically transforms string/path fields into safe is_XYZ_set boolean flags.
- tools/config-gen/type_template_data_gen.go: Extended the fieldInfo structures to expose the proto metadata to templates and dynamically inject sequential Protobuf field tags.
- tools/config-gen/templates/config_proto.tpl: Added the text/template directive to correctly format the output into proto3 syntax.
- tools/config-gen/parser_test.go: Added TestPopulateProtoMetadataExhaustive to exhaustively verify that every config type is successfully mapped to its Protobuf type and privacy conditions are met.
@PranjalC100
PranjalC100 force-pushed the feat-telemetry-schema-gen branch from 1755c75 to f474beb Compare August 7, 2026 09:55
@PranjalC100
PranjalC100 force-pushed the feat-telemetry-schema-gen branch from f474beb to 9d01089 Compare August 7, 2026 10:01
@github-actions

Copy link
Copy Markdown

Hi @meet2mky, @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

4 similar comments
@github-actions

Copy link
Copy Markdown

Hi @meet2mky, @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

@github-actions

Copy link
Copy Markdown

Hi @meet2mky, @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

@github-actions

Copy link
Copy Markdown

Hi @meet2mky, @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

@github-actions

Copy link
Copy Markdown

Hi @meet2mky, @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

Comment on lines +89 to +90
if param.FlagName == "app-name" {
continue

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not hardcode it. It's okay to send an extra param to keep the code and analysis less complex.

Comment thread cfg/config.proto
option go_package = "github.com/googlecloudplatform/gcsfuse/v3/cfg/pb";


message CloudProfilerConfig {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tag numbers require old params.yaml to be present and cannot be generated from scratch later on. This makes the design brittle. I'd rather we hardcode the tag numbers in the params.

@github-actions

Copy link
Copy Markdown

Hi @meet2mky, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

execute-integration-tests Run only integration tests execute-integration-tests-on-zb To run E2E tests on zonal bucket. remind-reviewers Auto remind reviewers in attention set for review post 24hrs of inactivity on PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants