[ZEPPELIN-5989] Resolve a local notebook dir as a file path instead of parsing it as a URI #5518
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 353 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.351
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #5518"
general
weight: 0.35
jongyoul
What is this PR for?
VFSNotebookRepo.setNotebookDirectory()parses the notebook dir withnew URI()unless it is a Windows absolute path likeC:\.... A local path is not a URI and can contain characters that a URI does not allow:On Windows the default dir is built as
./+\+notebook, so the server fails to start withURISyntaxException: Illegal character in path at index 2: ./\notebook.On any OS, a dir with a space, like
/home/me/My Notebooks, fails the same way.The issue suggests joining the dir with
Paths.get, but on Windows that gives.\notebook, whichnew URI()rejects too.This PR:
Resolves a notebook dir without a scheme as a file path,
new File(getAbsoluteDir(path)).toURI(), and parses only a dir with a scheme as a URI. The branch that handled a URI without a scheme is removed, since that case no longer reaches it.Keeps
rootNotebookFolderas a decoded path for a local dir. It was the root's URI withfile:///replaced, so it kept%20for a space.list()strips it from note file names that are decoded since ZEPPELIN-6202, which would shift note paths by two characters per space, andGitNotebookRepoopens the repository atrootNotebookFolder/.git, which would be a different directory.list()now resolves the root by its URI instead of by this path. A dir with another scheme keeps its current value.For a local dir without such characters, both values are the same as before.
I could not run it on Windows. On other systems the same code path is reached with a space, and Commons VFS treats a backslash in the file URI as a separator. It would help if someone on Windows could start the server from this branch without a configuration file, which is how the issue reproduces it.
What type of PR is it?
Bug Fix
What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-5989
How should this be tested?
VFSNotebookRepoTest.testNotebookDirWithCharactersThatAUriDoesNotAllowuses a dir with a space and one with a backslash, saves and lists a note, and checks its path.GitNotebookRepoTest.notebookDirWithSpacechecks that.gitis created in the dir with a space and that a checkpoint is recorded.Without the first change both tests fail with the
URISyntaxExceptionabove; without the second the path and.gitchecks fail.Run locally:
VFSNotebookRepoTest(8),GitNotebookRepoTest(12),NotebookRepoSyncTest(10),NotebookServiceTest(13),NotebookServiceRaceConditionTest(1),NoteManagerMoveResaveRaceTest(1),NotebookTest(42).testSchedule,testScheduleDisabledWithNameandtestSchedulePoolUsagefail locally with and without this change: they wait five seconds for the cron run, and the interpreter process here takes about six seconds to sync its libraries and register.