Repository navigation
Conversation
Convert local paths to forward slashes with filepath.ToSlash in user-facing messages (diagnostic locations, YAML/JSON load errors, variable overrides file errors, glob errors, duplicate library names, sync root errors, git root errors, filer errors) and in diff.py output. Remove acceptance Repls that normalized backslashes and are no longer needed. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
|
Cases left out of this PR (risky or not CLI output):
I removed Repls from a few cloud-only tests based on reading the code: cmd/fs/cp/file-to-nonexistent-dir, bundle/generate/genie_space, integration_whl/serverless, integration_whl/serverless_dynamic_version. PR CI can't check these on Windows. |
|
Commit: Regression test reportSelected 20 changed tests (limit=20, 2 not selected) 36 tests: regression=0 unreleased=0 coverage=36 failing=0
|
✅ Integration test reportCommit: 342aff2
Top 3 slowest tests (at least 2 minutes):
|
…og golden The removed backslash Repl was also rewriting escaped \n and \" in notebook JSON into /n and /". Co-authored-by: Isaac <no-reply@databricks.com>
Sankalp-Mittal
left a comment
There was a problem hiding this comment.
🤖 AI review from review-factory: 2 independent reviewer models (Claude Fable 5.2, Claude Opus 5.5) with cross-verification. Only findings that reviewers agreed on are posted.
Wraps local paths in error text with filepath.ToSlash and drops backslash Repls. Confirmed: filer errors also rewrite remote paths; three tests skip Windows selection.
Findings: 2 minor, 1 nit.
acceptance/bundle/validate/yaml_anchors/test.tomlminor: Three tests that lost an inherited Repl are not selected as changed on Windows
The description says the Windows cell runs the changed tests. That does not hold for three tests whose backslash Repl came from a deleted parent test.toml:
bundle/validate/targets/scalar_rewrite_diagnosticbundle/validate/yaml_anchors/invalid_merge_sequence_memberbundle/validate/yaml_duplicate_keys/shadowed_invalid_subtree
The changed-test selector maps a changed file to a test only when one of the file's ancestor directories contains a script. The three parent directories do not, so their deleted test.toml files select nothing. The Windows PR cell runs a hash-selected subset plus the changed tests, so these three run there only by chance.
From reading the code they should pass: their messages come from bundle/config/root.go:126,132 and diag.Location.String(), both converted in this PR. That is not confirmed by a Windows run. Please run these three on Windows once, or confirm they were in this commit's subset, before merging.
Evidence: acceptance/internal/selection/selection.go:347-360 (testDirForFile returns "" unless an ancestor is a known test dir) and :567-570 (such files are skipped). acceptance/bundle/validate/{targets,yaml_anchors,yaml_duplicate_keys}/ contain only subdirectories, no script. The bot report in _review_factory/discussion.md says "Selected 20 changed tests (limit=20, 2 not selected)", i.e. 22, which is exactly the number of touched directories that do contain a script; the three tests above are not among them. acceptance/subset_test.go:14-17,35-39,81-96 describes the Windows/macOS PR subset. Affected goldens: acceptance/bundle/validate/targets/scalar_rewrite_diagnostic/output.txt:3, acceptance/bundle/validate/yaml_anchors/invalid_merge_sequence_member/output.txt:3, acceptance/bundle/validate/yaml_duplicate_keys/shadowed_invalid_subtree/output.txt:3 (all print [TEST_TMP_DIR]/databricks.yml).
Agreed by 2 reviewer model(s).
bundle/config/mutator/translate_paths.go:246nit: Three messages in the same file still convert to backslashes
This PR switches the path %s is not contained in sync root path message (line 158) to forward slashes with filepath.ToSlash. Three neighbouring user-facing errors in the same file still call filepath.FromSlash(localFullPath), so they print backslashes on Windows:
- line 246:
unable to determine if %s is not a notebook: %w - line 264:
%s is not a directory - line 283:
unable to determine if %s is a directory: %w
localFullPath is already in slash form at that point (lines 162-163 normalize localPath with ToSlash before it is passed to the translate functions, e.g. translateNotebookPath at line 169), so dropping the FromSlash call is enough. This doesn't match the PR's goal of the same output on every OS. It is fine to leave for a follow-up if the PR is meant to cover only messages with acceptance coverage today; in that case consider adding these three to the list of cases left out on purpose.
Evidence: no acceptance golden contains these three messages (grep -rn "is not a directory\|unable to determine if" acceptance --include=output.txt returns nothing).
Agreed by 2 reviewer model(s).
|
|
||
| func (err fileAlreadyExistsError) Error() string { | ||
| return "file already exists: " + err.path | ||
| return "file already exists: " + filepath.ToSlash(err.path) |
There was a problem hiding this comment.
minor: ToSlash in filer Error() also rewrites remote paths on Windows
Error() of the seven filer error types now runs filepath.ToSlash on err.path. These types are shared with the DBFS, Files API and workspace filers, whose paths are POSIX strings built with path.Join; there a \ is an ordinary character, not a separator.
On Windows, a remote path that contains a backslash is now printed with / instead, so the message names a different path from the one sent to the API. Example: a Windows user types databricks fs ls dbfs:\Volumes\main and the API reports the path as missing. The error used to read no such directory: /\Volumes\main, which showed the mistake. It now reads no such directory: //Volumes/main, which looks like a valid path that does not exist.
Only local paths need converting. Apply filepath.ToSlash where libs/filer/local_client.go builds these errors and leave the Error() methods as they were.
Evidence: libs/filer/errors.go:15,34,45,59,73,88,119 wrap err.path unconditionally. Remote construction sites pass POSIX paths, e.g. libs/filer/dbfs_client.go:244 (absPath, err := w.root.Join(name)) and :259 (noSuchDirectoryError{absPath}), with Join implemented as path.Join(p.rootPath, name) at libs/filer/workspace_root_path.go:26. cmd/fs/helpers.go:38-49 passes everything after dbfs: to the remote filer unchanged. Local construction sites are only in libs/filer/local_client.go:61,63,90,96,121,128,143,149,172.
Agreed by 2 reviewer model(s).
Changes
Wrap local paths with
filepath.ToSlashin user-facing messages: diagnostic locations (diag.Location.String, which covers YAML/JSON load errors), config load/rewrite errors, variable-overrides file errors, artifact glob errors, duplicate library names, the bundle-root glob check, the sync-root check, the git repository-root check and filer errors.acceptance/bin/diff.pynow prints POSIX paths too.Remove the backslash
Replsfrom acceptance tests that no longer need them. Some were already stale (docker host, apps/init, genie_space generate, integration_whl/serverless*, overrides_file_complex_path, nil_artifacts, wrong-url).Why
This is a follow-up to #4528. Output is the same on every OS, so tests don't need per-test separator fixups.
Tests
Linux outputs are unchanged. The Windows cell runs the changed tests. Cases left out on purpose are listed in a comment below.
This pull request and its description were written by Isaac.