spark-test commented on code in PR #60449:
URL: https://github.com/apache/spark/pull/60449#discussion_r4571626155
##########
dev/sparktestsupport/modules.py:
##########
@@ -1938,6 +1935,24 @@ def __hash__(self):
shell_script_test_goals=[ShellScriptTestGoal("dev/test-dependencies.sh")],
)
+lint_js = Module(
+ name="lint-js",
+ dependencies=[],
+ source_file_regexes=[
Review Comment:
**Non-blocking (P2):** This list doesn't claim `dev/spark-test-image/lint/`,
and `/dev/spark-test-image/lint/` is still in the linter group of
`ignored_file_patterns`. That directory's Dockerfile builds the image the lint
job runs in, and it installs the `nodejs` and `npm` that `dev/lint-js` checks
for. So a PR that changes only the Dockerfile selects no module, and the JS
linter step prints "There are no modules to test, exiting without testing." and
passes. For example, a future dependency-list cleanup like SPARK-58388 could
drop `npm`, or a base-image change could leave a Node version that ESLint 7.32
or `npm ci` can't run on. Before this change, the step ran `./dev/lint-js` in
the rebuilt image and failed that PR. Now the breakage merges and first shows
up as a JS linter failure on later, unrelated PRs that select `lint-js` or
root. The directory changed in 25 commits over the past year, and `sparkr` and
`pyspark-base` already claim the image directories their jobs run in.
To fix it, remove `/dev/spark-test-image/lint/` from the ignore list and add
an `r"dev/spark-test-image/lint/"` pattern here. Both edits are needed, because
`determine_modules_for_files` drops ignored files before it matches modules. A
change confined to the image then selects only `lint-js`, so it runs ESLint and
selects nothing else.
**Verification:**
- **Regression:** A module-selection case shows that a change to the lint
image's Dockerfile selects the lint-js module. On the current head, the same
path selects no module.
- **Behavior:** A module-selection case shows that a change confined to the
lint image selects only lint-js and not the root module, so it runs ESLint
without starting any other module-gated CI job.
##########
dev/sparktestsupport/modules.py:
##########
@@ -144,9 +140,10 @@
"/conf/",
# Binder infra. CI does not test this.
"/binder/",
- # UI tests. These are typically triggered by the `precondition` job
- # regardless of modifications to these files.
- "/ui-test/",
+ # UI test harness files. UI tests are typically triggered by the
+ # `precondition` job regardless of modifications to these files. Files
under
+ # `ui-test/tests/` are not ignored because `lint-js` checks them.
+ "/ui-test/*",
Review Comment:
**Nit (P3):** With an anchored pattern, `PurePath.match` has to match the
whole path, so `/ui-test/*` ignores only direct children of `ui-test/`. But
`lint-js` claims only `ui-test/tests/.*\.js$`. Any other nested path now
matches neither an ignore entry nor a module, so it maps to root. That covers a
Jest snapshot in its default location
(`ui-test/tests/__snapshots__/utils.test.js.snap`), a fixture like
`ui-test/tests/fixture.json`, and a helper like `ui-test/helpers/setup.js`. On
the base branch these selected nothing. At head, a PR touching only one of them
makes `is-changed.py` report `true` for every module group. That starts the
build, PySpark, SparkR, TPC-DS, and docker-integration jobs for a file that
ESLint doesn't even lint. No such file is tracked yet, and the new tests check
only the two package files and one `.js` file under `ui-test/tests/`, so
nothing catches this.
One fix is to make the `lint-js` pattern `r"ui-test/"` instead of
`r"ui-test/tests/.*\.js$"`. Direct children stay ignored, because ignored files
are dropped before module matching. Every nested file then selects only
`lint-js`, which costs one ESLint run, something the base branch did on every
build anyway. The comment on this entry would then say that `lint-js` claims
the rest of `ui-test/`.
**Verification:**
- **Regression:** Module-selection cases show that a non-JS file nested
under ui-test/tests/, such as a Jest snapshot, and a file in another ui-test
subdirectory each select lint-js and not the root module. On the current head,
both select root.
- **Regression:** The existing module-selection cases still pass with the
new pattern: a `.js` test under ui-test/tests/ selects lint-js, and
ui-test/package.json and ui-test/package-lock.json select no module.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]