Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/23888
Note: Links to docs will display an error until the docs builds have been completed. ⏳ No Failures, 14 PendingAs of commit a8942db with merge base 11ce711 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
609ca3a to
7edb8d7
Compare
|
hi @rascani and @digantdesai we hope something like this could catch some buck2 stuff on github when merged :) |
|
New job runned |
|
@claude review this PR |
|
Claude finished @rascani's task in 3m 42s —— View job The PR is functional, but one bug in Detailed reviewPR Review: #23888SummaryThe PR runs each Vela parser case in its own process under Buck2, moves that C++ test into its own Code Quality
Infrastructure
RecommendationNeeds Discussion The early |
68b1d1a to
494b81a
Compare
|
Addressed the Claude's review report! |
|
|
||
| def visit(statements: list[ast.stmt], env: dict[str, object]) -> None: | ||
| for node in statements: | ||
| if isinstance(node, ast.FunctionDef) and node.name == "define_arm_tests": |
There was a problem hiding this comment.
Could we count registrations only when define_arm_tests is actually invoked? Traversing the function definition unconditionally lets the suite disappear without this check noticing.
There was a problem hiding this comment.
Fixed in aa6b089. Registrations now count only when the declaration visitor actually invokes define_arm_tests. Added regression tests for removed and inactive calls, uncalled wrappers, aliases and called wrappers.
|
|
||
| def visit(statements: list[ast.stmt], local_env: dict[str, object]) -> None: | ||
| for node in statements: | ||
| if ( |
There was a problem hiding this comment.
This visitor silently ignores augmented assignments such as srcs += ["new_helper.py"], retaining the old source list. Could we evaluate these mutations or mark the affected value unsupported so the checker reports that it cannot validate the declaration?
There was a problem hiding this comment.
Fixed in aa6b089. The visitor now evaluates supported += mutations to source and dependency lists. Unsupported mutations invalidate the affected value and report the original expression instead of retaining a stale list. Added regression coverage for both paths.
| package[: len(package) - node.level + 1] | ||
| + ([module] if module else []) | ||
| ) | ||
| if not module.startswith("executorch."): |
There was a problem hiding this comment.
Could this guard also accept module == "executorch"? Currently, from executorch import exir returns before resolving the imported alias, so a missing dependency passes unnoticed. The equivalent import executorch.exir correctly reports the missing dependency. Allowing the root package through should let the existing child-module resolution handle this case.
There was a problem hiding this comment.
Fixed in aa6b089. The guard now accepts module == "executorch" and uses the existing child-module resolution. Added regression tests confirming that from executorch import exir reports the same missing dependency as import executorch.exir, including coverage for aliases and multiple imports.
Count Arm test registrations only when the declaration visitor actually invokes define_arm_tests. Keep the package, source file and original helper name so aliases and called wrappers work while unused, inactive or unsupported calls cannot keep a removed test suite falsely registered. Evaluate supported augmented assignments to source and dependency lists. Invalidate unsupported mutations and report the original expression instead of retaining stale declaration values. Resolve imports from the executorch root package through the same child-module dependency checks as dotted imports. Add regression coverage for all three new review comments on GitHub PR pytorch#23888. The 64 checker tests and 12 entrypoint integration tests pass. The local entrypoint reports zero new errors or warnings against the parent patch. Removing the real Arm test macro call in a temporary snapshot reports 154 newly unregistered tests. UFMT, Flake8 and diff whitespace checks pass. Authored with assistance from OpenAI Codex. Signed-off-by: Usamah Zaheer <usamah.zaheer@arm.com> Change-Id: I6944d6481c6231754269716e4db1e3d7dcf22272
The public Buck2 suite omits Arm test coverage, so it can stay green when isolated Vela tests fail or Arm Python imports lack Buck declarations. Run the existing Vela parser suite and each discovered case in a fresh process. Retain runtime initialization in the test fixture before every case. Enable a plain test main only on the OSS isolation target so global initialization cannot mask missing fixture setup, while preserving internal and CMake test entrypoints. Move the C++ test into a standalone Buck package to avoid the internal Python test helper. Preserve the existing internal target label for individual-case selection, declare the platform dependency and update CMake's source path. Cover all ten Vela tests on upstream/main, including the malformed block and I/O payload cases. Add test-arm-backend-buck-declarations beside the other Arm GitHub jobs. Run it through test_arm_backend.sh test_buck_declarations so developers and CI share a command requiring only Git and Python. Compare against the PR merge base, previous push revision or local HEAD^, with BASE_REVISION available for changes spanning several commits. Keep the declaration check independent of Arm tool setup and the all suite. Check Arm Python test-library dependencies and test registration using supported local Buck declarations and their transitive dependencies. Discover every BUCK/TARGETS package beneath the Arm test tree so standalone nested libraries and removal of their source ownership are checked too. Collect errors after lazy dependency and provider discovery to report their actual build or helper file and unsupported construct. Preserve existing findings as a baseline. Fail on confirmed missing dependencies, unregistered Arm tests and unsupported Arm declarations. Report unsupported declarations outside Arm and dependency gaps that cannot be proven because of them as warnings. Include severity in the baseline identity so a warning becoming an error still fails. Document maintenance by Arm backend contributors and the limited static model. Evaluate Boolean expressions lazily, follow helpers only in active internal branches and reject parameterized or recursive helpers that cannot be validated. Present numbered findings with severity, files, targets and wrapped details. This check supplements Meta's internal packaged Python tests. Validation: 53 checker tests and 12 shell entrypoint integration tests pass, covering late diagnostics, warning policy, severity escalation, baseline selection, setup isolation and failure propagation. The local entrypoint reports zero new errors or warnings against upstream/main. UFMT, Flake8, ClangFormat and git diff --check pass. Focused public C++ compile/link checks cover both main configurations and all ten Vela cases together and separately. Meta's internal build and a complete Buck2 build have not been run for this amendment. Authored with assistance from OpenAI Codex. Signed-off-by: Usamah Zaheer <usamah.zaheer@arm.com> Change-Id: I2cdf857306becd0a1eeb844763b4a96a88d33502
Count Arm test registrations only when the declaration visitor actually invokes define_arm_tests. Keep the package, source file and original helper name so aliases and called wrappers work while unused, inactive or unsupported calls cannot keep a removed test suite falsely registered. Evaluate supported augmented assignments to source and dependency lists. Invalidate unsupported mutations and report the original expression instead of retaining stale declaration values. Resolve imports from the executorch root package through the same child-module dependency checks as dotted imports. Add regression coverage for all three new review comments on GitHub PR pytorch#23888. The 64 checker tests and 12 entrypoint integration tests pass. The local entrypoint reports zero new errors or warnings against the parent patch. Regression tests cover removed and inactive registration calls, augmented assignments and imports from the root package. UFMT, Flake8 and diff whitespace checks pass. Authored with assistance from OpenAI Codex. Signed-off-by: Usamah Zaheer <usamah.zaheer@arm.com> Change-Id: I6944d6481c6231754269716e4db1e3d7dcf22272
e82cda3 to
aa6b089
Compare
|
@claude review |
|
Claude finished @rascani's task in 6m 15s —— View job The three fixes from rascani's review look correct, but before this becomes a required check, maintainers need to agree on its policy of failing every new unregistered Arm test, and the checker still misses two kinds of declaration change. Detailed reviewPR Review: #23888SummaryThe PR adds a GitHub job and a
Infrastructure
Code Quality
RecommendationNeeds Discussion Maintainers should agree on the unregistered-test policy before this becomes a required check on every PR. The two coverage gaps (pytest deps and edits in an |
The declaration checker skipped per-test Python dependencies and could retain stale source or dependency lists inside conditions it could not evaluate. Evaluate the known test_files loop, check each Python test target's imports, and invalidate assignments behind unsupported conditions. Include normalized unsupported expressions and conditional bodies in baseline identities so a changed declaration cannot hide behind an existing finding. Warn for new unregistered tests while failing when a previously registered surviving test loses registration. Inspect tracked working-tree files, including staged additions and unstaged edits, and ignore untracked scratch files. Document the coverage and registration policy. Build the Vela test binary once and run every case in a fresh process, collecting all failures before exiting. Start the declaration workflow with a shallow checkout and deepen only as needed. Check shallow boundaries before accepting a merge base so a short merge-parent path cannot hide a newer common ancestor. Explain why changes outside Arm also run this check. Validation: all 106 checker, entrypoint and runner tests pass on the Gerrit parent. The real entrypoint reports zero new errors or warnings and 312 unchanged findings. Pinned UFMT and Flake8, shell syntax, workflow parsing and git diff --check pass. Actual Buck2 execution and Meta internal builds were not run for this change. Authored with assistance from OpenAI Codex. Signed-off-by: Usamah Zaheer <usamah.zaheer@arm.com> Change-Id: I50fd4590b90141e56489e428a977fbe9cbc70b25
| for is_oss in (False, True): | ||
| env = {"__is_oss__": is_oss} | ||
| visit(tree.body, env) | ||
| registrations.update(SCOPE + "/" + p for p in env.get("test_files", [])) |
There was a problem hiding this comment.
Could registration be based on the Python test rules actually emitted? test_files is still treated as registration even when nothing consumes it. Removing the for test_file in test_files loop from the current Arm declarations drops parsed Python test targets from 183 to 1, but compare() returns zero new findings. Since the visitor now evaluates this loop, we should use its emitted rules to detect removal of surviving tests, while preserving the OSS-only registration policy.
There was a problem hiding this comment.
now uses Python test rules actually emitted in internal or OSS mode. Removing the generation loop now reports lost registrations, also added regression coverage for unused lists, removed test emission and OSS-only registrations
| else: | ||
| called.add(name) | ||
| else: | ||
| self.parse_rule(call, local_env, package, filename) |
There was a problem hiding this comment.
The += path is handled now, but calls such as srcs.append("new_helper.py") and srcs.extend([...]) reach parse_rule() and are silently ignored, leaving the old list in the environment. A newly added helper with a missing Buck dependency then produces no finding. Could we either evaluate mutations of tracked declaration lists or invalidate the affected value and report the unsupported expression?
There was a problem hiding this comment.
Supported append() and extend() calls now update the modelled lists and their aliases. Unsupported mutations invalidate affected bindings and retain the original expression, and also added tests too
| except Unsupported: | ||
| local_env.pop(node.targets[0].id, None) |
There was a problem hiding this comment.
Could we preserve the unsupported assignment's original expression instead of only removing the name from local_env? For deps = select({...}) followed by a rule using deps=deps, the diagnostic becomes just deps: deps. I reproduced removing the required //executorch/exir:umbrella dependency inside that select() and getting zero new findings, because the baseline identity stays unchanged. The same edit fails when the select() is inline. Keeping the normalized right-hand expression in the error identity would close that gap.
There was a problem hiding this comment.
unsupported assignments now retain their normalized original RHS through variables and aliases. Changes inside select() therefore produce a new finding even when the rule uses deps=deps, also added regression coverage for aliases, unknown conditions and nested mutations
Register Arm Python tests from emitted test rules in either runtime mode, rather than from a test_files list that may never be consumed. Remove the duplicate list-based registration parser. Keep dependency checks on internal rules, preserve OSS-only registrations, warn about newly unregistered tests and fail when surviving tests lose existing registration. Evaluate supported list append and extend calls, preserving alias semantics. Retain the normalized original expression for unsupported assignments and mutations through aliases, nested calls and unknown conditions. Respect known conditional and Boolean short-circuiting when locating mutations so inactive branches do not produce false errors. Unused opaque values remain quiet until a declaration consumes them. Address the three November 16 review comments on GitHub PR pytorch#23888. All 127 tests pass, including 102 checker, 17 entrypoint and 8 runner tests. Removing the actual Arm test generation loop produces 168 fatal lost- registration findings; restoring it produces none. The local entrypoint reports zero new errors or warnings and 312 unchanged findings. Pinned UFMT, Flake8 and whitespace checks pass. Meta internal builds were not run. Authored with assistance from OpenAI Codex. Signed-off-by: Usamah Zaheer <usamah.zaheer@arm.com> Change-Id: Ie37c1bd95eef4779b40fdb5442cbc48e181f7323
Merge current upstream main into the existing PR history. Resolve the moved Vela test conflict using the reviewed Gerrit resolution, retaining upstream payload lifetime tests and one runtime initialization fixture. Keep the OSS-only test main and all existing Buck declaration fixes. The resulting tree matches Gerrit stack tip 9619499f66a0b26028ad47f327709bcd46a495e5, which passed 127 regression tests, the declaration entrypoint, pinned lint checks, and focused Vela C++ checks in both public main configurations with persistent-region support disabled and enabled. Full Buck2 and Meta internal builds were not run. Authored with assistance from OpenAI Codex. Signed-off-by: Usamah Zaheer <usamah.zaheer@arm.com>
Summary
The public Buck2 suite can stay green when Vela tests depend on initialization by an earlier test or when Arm Python imports are missing Buck declarations. Run the Vela parser suite through the Buck2 job and run each discovered case in a fresh process. Initialize the runtime in the fixture and enable a plain test main only on the isolated OSS Buck target. Preserve the existing internal target label for individual-case selection and leave internal and CMake test entrypoints intact.
Add a separate GitHub job and a shared local
test_buck_declarationsentrypoint to catch newly introduced dependency and test-registration gaps. The checker follows supported in-repository declarations and transitive dependencies and reports declaration errors after lazy package loading, with their original file and unsupported construct. Confirmed missing dependencies, unregistered Arm tests, and unsupported Arm declarations fail; unsupported declarations outside Arm and dependency gaps that cannot be proven because of them produce warnings. Baseline comparison includes severity so warnings becoming errors still fail. The README documents this policy and maintenance by Arm backend contributors.This supplements Meta's internal packaged Python tests; it does not reproduce their environment. This change is independent of #22580.
Authored with assistance from OpenAI Codex.
Test plan
python3 -m unittest discover -s .ci/scripts/tests -p 'test_arm_buck*.py'— all 65 tests pass: 53 checker tests and 12 shell entrypoint tests.BASE_REVISION=2a84702c2ce453d095e784a9af9403bc87987dd4 bash backends/arm/test/test_arm_backend.sh test_buck_declarations— passes with zero new errors or warnings and 282 unchanged findings.git diff --checkpass for the edited code.These C++ checks use public sources and do not verify Meta's internal build. A complete Buck2 build was not rerun locally for this revision; the GitHub Buck2 job remains the full build check.
cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani