Skip to content

Conversation

@AbdulRashidReshamwala
Copy link
Contributor

@AbdulRashidReshamwala AbdulRashidReshamwala commented Dec 3, 2025

…o files, and add a new HTTP request configuration file.

Description

Testing (ignore for documentation update)

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Checklist:

Additional Notes:


Note

Updates generated proto TS to protoc v4.23.4 and removes enum namespace wrappers via a new post-generation script, plus tsconfig includes JS files.

  • Proto generation:
    • Update protoc version comment to v4.23.4 in src/proto/api.ts and src/proto/tee-bundle.ts.
    • Remove enum namespace wrappers from generated files (src/proto/api.ts, src/proto/tee-bundle.ts).
  • Tooling/Scripts:
    • Add src/scripts/remove-namespaces.js to strip namespaces from generated .ts files.
    • Invoke the script from src/scripts/generate-proto.sh after protoc runs.
  • Config:
    • Update tsconfig.json to include src/**/*.js.

Written by Cursor Bugbot for commit bed4f98. This will update automatically on new commits. Configure here.

Summary by CodeRabbit

  • Chores
    • Reduced internal type declaration surface in generated protocol buffer outputs to simplify public typings without changing runtime behavior.
    • Added a post-generation script to automatically clean up redundant namespace wrappers after proto generation.
    • Updated build config formatting and included JS files in compilation input.

✏️ Tip: You can customize this high-level summary in your review settings.

…o files, and add a new HTTP request configuration file.
@coderabbitai
Copy link

coderabbitai bot commented Dec 3, 2025

Walkthrough

Adds an automated post-processing step to strip exported TypeScript namespace wrappers from generated protobuf files. Introduces a Node.js script to remove namespace blocks, invokes it from the proto generation shell script, and updates generated proto files and tsconfig formatting.

Changes

Cohort / File(s) Summary
Proto files updated
src/proto/api.ts, src/proto/tee-bundle.ts
Removed exported namespace blocks (TranscriptMessageSenderType, ServiceSignatureType, AttestorVersion, ErrorCode, ZKProofEngine in api.ts; BodyType in tee-bundle.ts). Top-level type aliases and runtime values remain.
Proto generation script
src/scripts/generate-proto.sh
Added execution of node src/scripts/remove-namespaces.js immediately after protoc to run namespace cleanup automatically.
Namespace removal tool
src/scripts/remove-namespaces.js
New ES module script that scans src/proto/*.ts, detects export namespace <Name> { ... } blocks via regex, removes them, and writes files back with console logging.
TypeScript config formatting
tsconfig.json
Reformatted lib and path mapping arrays and added src/**/*.js to include (formatting + added include entry).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Inspect the regex in src/scripts/remove-namespaces.js for correctness (nested namespaces, braces balancing, edge cases).
  • Verify ESM usage and __dirname derivation (import.meta.url) works in target environments.
  • Check file encoding/error handling on read/write and that the script preserves non-target code.
  • Confirm generate-proto.sh invocation order and exit codes propagate correctly.

Poem

🐰 I hopped through files with a tiny command,
Unwrapping namespaces with a careful hand.
Types stayed cozy, untouched and true,
A little script, a tidy view.
Freshly spruced code — a carrot for you! 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: protoc version upgrade, namespace removal from proto files, and is directly supported by the raw summary showing namespace deletions and protoc version updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch remove-namespaces

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/scripts/generate-proto.sh (1)

1-7: Consider hardening the generation script with set -euo pipefail

The new node src/scripts/remove-namespaces.js step is wired correctly after protoc. To make failures (missing node, script errors, etc.) more obvious and avoid partial generations, consider adding strict shell options at the top:

set -euo pipefail

This is optional but improves robustness of the proto generation pipeline.

src/scripts/remove-namespaces.js (1)

17-35: Namespace‑stripping regex is tightly coupled to current ts-proto output

The regex /export namespace \w+ \{[\s\S]*?\n\}/g works today because the generated export namespace <Enum> blocks only contain simple type aliases (no nested {}), but it will misbehave if future ts-proto versions ever emit functions or other nested blocks inside the namespace.

Not urgent, but for extra safety you could:

  • Restrict matching further (e.g., only namespaces immediately following a const Enum = { ... } pattern), or
  • Replace the regex with a small brace‑counting scanner that finds the correct closing } for each export namespace block.

Also, if you want to avoid any potential interaction with the regex lastIndex, you can replace the test(...) with a non‑stateful check such as const hasNamespace = content.match(namespaceRegex); if (hasNamespace) { ... }.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b372f22 and 4c8db29.

📒 Files selected for processing (4)
  • src/proto/api.ts (6 hunks)
  • src/proto/tee-bundle.ts (2 hunks)
  • src/scripts/generate-proto.sh (1 hunks)
  • src/scripts/remove-namespaces.js (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: Test
src/scripts/remove-namespaces.js

[error] ESLint parsing error: TSConfig does not include this file. Include the file in tsconfig.json or adjust ESLint parserOptions.project to cover this path. See: https://typescript-eslint.io/troubleshooting/typed-linting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file


[error] Process completed with exit code 1.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Cursor Bugbot
🔇 Additional comments (2)
src/proto/tee-bundle.ts (1)

4-4: BodyType namespace removal is compatible with existing usage

All references to BodyType.BODY_TYPE_* in the codebase are runtime value accesses (e.g., bundle.bodyType !== BodyType.BODY_TYPE_K_OUTPUT), not type-position references. The new const object with union type pattern is fully compatible with these uses. No type-level breaks detected.

src/proto/api.ts (1)

4-4: Enum namespace removals are safe—no breaking type-level references detected

The generated pattern of export const Enum = { ... } as const; export type Enum = typeof Enum[keyof typeof Enum]; correctly replaces the removed namespace blocks. All 75 enum member references across the codebase use runtime value access (e.g., ErrorCode.ERROR_INTERNAL, ZKProofEngine.ZK_ENGINE_GNARK) in conditional checks and assignments, not in type positions. The union type alias fully covers all type-level use cases. The PR introduces no breaking changes.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
tsconfig.json (1)

31-31: Reconsider including build scripts in the main TypeScript configuration.

Adding "src/**/*.js" to the include list means all JavaScript files under src/ are now subject to the project's type checking. Build/utility scripts (like the new src/scripts/remove-namespaces.js) typically should not be part of the main TypeScript project's include configuration, as they are executed separately and may not conform to the same strict settings.

Consider either:

  1. Excluding the scripts directory explicitly: "exclude": ["node_modules", "src/scripts"]
  2. Moving build scripts outside src/ to a dedicated scripts/ or build/ directory at the project root
  3. Using a separate tsconfig for build tooling if broader .js inclusion is needed

Are there legitimate application .js files in src/ that require inclusion in the TypeScript project, or is this addition primarily to include the namespace-removal build script?

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4c8db29 and bed4f98.

📒 Files selected for processing (2)
  • src/scripts/remove-namespaces.js (1 hunks)
  • tsconfig.json (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/scripts/remove-namespaces.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Cursor Bugbot
  • GitHub Check: test
🔇 Additional comments (1)
tsconfig.json (1)

3-8: Formatting changes are fine.

The reformatting of the "lib" array and "#src/*" path mapping from single-line to multi-line is purely stylistic with no functional impact.

Also applies to: 23-25

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