Skip to content

Clean up executorch type checking setup (#21719) - #21793

Open
maggiemoss wants to merge 1 commit into
pytorch:mainfrom
maggiemoss:export-D115454520
Open

Clean up executorch type checking setup (#21719)#21793
maggiemoss wants to merge 1 commit into
pytorch:mainfrom
maggiemoss:export-D115454520

Conversation

@maggiemoss

@maggiemoss maggiemoss commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary:
Removing the typing = True from these buck files to clear the way for a more stable, easy to configure type checking set up

Reviewed By: shobhitmehro

Differential Revision: D115454520

Summary:

`fbcode/executorch/PACKAGE` carried a `python.set_pyrefly(False)` opt-out. Remove
it so executorch inherits `python.set_pyrefly(True)` from the fbcode root.

Removing the opt-out on its own would have flipped 43 targets from classic Pyre
onto Pyrefly and surfaced real type errors (nullability on `mem_id` /
`mem_offset` in `test_memory_passes.py`, `tuple[SourcePartition, ...]` vs
`list[GraphModule]` in `quantizer.py`, a missing `PassResult` return, and
others). Every one of those targets is in open-source code.

executorch syncs to the open-source `pytorch/executorch` repo, which is why the
root already sets `python.set_typing(False)` — suppressions added here leak into
OSS and break OSS CI on checker upgrades. That policy was being undercut by 43
target-level `typing = True` attributes outside the internal `fb/` subtrees, and
those overrides were the *only* thing pulling OSS files into type checking. So
rather than write Pyrefly suppressions into OSS-synced files, drop the overrides
and let the package-level `set_typing(False)` stand.

Internal `fb/` code is untouched: the 66 typed targets under
`examples/models/fb/` were already on Pyrefly via `examples/models/fb/PACKAGE`
and stay type-checked, now by inheritance from the fbcode root.

Note for reviewers: `backends/cadence` loses the Pyre coverage it had. That is
the intended trade — it is OSS-synced, and its errors cannot be suppressed
in-tree without leaking into the public repo — but it is a coverage reduction
that should be an explicit owner decision, not an auto-accept.

The `typing_stubs` target in `backends/cadence/aot/BUCK` and its dep references
are left intact.

Reviewed By: shobhitmehro

Differential Revision: D115454520
@maggiemoss
maggiemoss requested a review from SS-JIA as a code owner August 12, 2026 22:41
Copilot AI lite review requested due to automatic review settings August 12, 2026 22:41
@pytorch-bot

pytorch-bot Bot commented Aug 12, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21793

Note: Links to docs will display an error until the docs builds have been completed.

❌ 2 New Failures

As of commit a19e087 with merge base 3b5bf0f (image):

NEW FAILURES - The following jobs have failed:

  • Cadence Build & Test / hifi-build / hifi4 (gh)
    ##[error]Refusing to check out fork pull request code from a 'pull_request_target' workflow. This workflow runs with the base repository's GITHUB_TOKEN, secrets, default-branch cache scope, and runner access. Fetching and executing a fork's code in that trusted context commonly leads to "pwn request" vulnerabilities. To opt in, review the risks at https://gh.io/securely-using-pull_request_target and set 'allow-unsafe-pr-checkout: true' on the actions/checkout step.
  • Cadence Build & Test / vision-build / vision (gh)
    ##[error]Refusing to check out fork pull request code from a 'pull_request_target' workflow. This workflow runs with the base repository's GITHUB_TOKEN, secrets, default-branch cache scope, and runner access. Fetching and executing a fork's code in that trusted context commonly leads to "pwn request" vulnerabilities. To opt in, review the risks at https://gh.io/securely-using-pull_request_target and set 'allow-unsafe-pr-checkout: true' on the actions/checkout step.

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 12, 2026
@meta-codesync

meta-codesync Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

@maggiemoss has exported this pull request. If you are a Meta employee, you can view the originating Diff in D115454520.

@maggiemoss maggiemoss changed the title Drop executorch opt-out, stop type-checking OSS code (#21719) Clean up executorch type checking setup (#21719) Aug 12, 2026
@maggiemoss

Copy link
Copy Markdown
Contributor Author

@pytorchbot label "release notes: none"

@pytorch-bot pytorch-bot Bot added the release notes: none Do not include this in the release notes label Aug 12, 2026
@maggiemoss
maggiemoss requested a review from oulgen August 12, 2026 22:43

Copilot AI 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.

Pull request overview

This PR updates ExecuTorch Buck/Starlark build targets to stop opting open-source-synced Python code into type checking by removing per-target typing = True overrides, so typing behavior can be controlled by package-/repo-level defaults.

Changes:

  • Removed typing = True from multiple fbcode_target(...) / runtime.python_library(...) definitions across Vulkan, Native, Test, and Cadence backend build targets.
  • Kept the Cadence typing_stubs target and dependency wiring intact while disabling type checking for the surrounding OSS-synced targets.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
backends/vulkan/patterns/BUCK Removes typing = True from Vulkan patterns python library target.
backends/vulkan/partitioner/BUCK Removes typing = True from Vulkan partitioner python library target.
backends/vulkan/_passes/targets.bzl Removes typing = True from Vulkan passes target definition.
backends/test/targets.bzl Removes typing = True from shared test builder python libraries.
backends/native/BUCK Removes typing = True from the Native backend python library target.
backends/cadence/utils/targets.bzl Removes typing = True from Cadence utility python library target.
backends/cadence/runtime/BUCK Removes typing = True from Cadence runtime python library target.
backends/cadence/aot/quantizer/passes/BUCK Removes typing = True from Cadence quantizer passes python library target.
backends/cadence/aot/quantizer/BUCK Removes typing = True from Cadence quantizer-related python library targets.
backends/cadence/aot/BUCK Removes typing = True from multiple Cadence AOT python library and python_unittest targets (including typing_stubs).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread backends/cadence/aot/BUCK
Comment on lines 126 to 130
fbcode_target(_kind = runtime.python_library,
name = "ref_implementations",
srcs = [
"ref_implementations.py",
],

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is intentional as typing = True is an outdated way to enable this.

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported release notes: none Do not include this in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants