This is an automated email from the ASF dual-hosted git repository.
tbonelee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zeppelin.git
The following commit(s) were added to refs/heads/master by this push:
new 1dc3d4f0d6 [ZEPPELIN-6663] Mark CompletionItem.meta optional to match
completion payloads
1dc3d4f0d6 is described below
commit 1dc3d4f0d63aa10e2da61e24cfca33c9ab09bb6b
Author: JangAyeon <[email protected]>
AuthorDate: Fri Oct 2 23:48:28 2026 +0900
[ZEPPELIN-6663] Mark CompletionItem.meta optional to match completion
payloads
### What is this PR for?
`CompletionItem.meta` is declared as required in the SDK, but real
completion payloads from the Spark and Flink interpreters omit the `meta` key.
This PR makes only `meta` optional, keeps `name` and `value` required, and adds
a compile-time regression fixture that runs as part of the existing SDK
contract typecheck (`typecheck:sdk-contracts`).
Part of ZEPPELIN-6627.
**Why `meta` is absent on the wire**
- The following interpreters construct `new InterpreterCompletion(name,
value, null)`:
- `SparkScala212Interpreter.scala:117`
- `SparkScala213Interpreter.scala:142`
- `FlinkScala212Interpreter.scala:39`
- `NotebookServer.java:142-146` builds Gson without `serializeNulls()`, so
null fields are dropped.
- `serializeMessage()` uses that Gson (`NotebookServer.java:633-635`). The
completion reply is sent through it at `NotebookServer.java:1372-1374`, so
these payloads contain no `meta` key at all (not `meta: null`).
- The Jupyter path supplies an empty string
(`JupyterKernelInterpreter.java:367`), so this PR does not claim every payload
omits `meta`. It only makes the shared type accept the proven Spark/Flink shape.
**Why `name` and `value` stay required**
- All current production construction sites supply both fields.
- The New UI reads `name` without a fallback
(`completion.service.ts:82-83`).
### What type of PR is it?
Improvement
### Todos
* [x] Make `CompletionItem.meta` optional (`meta?: string`)
* [x] Add `projects/zeppelin-sdk/type-tests/completion-item-meta.ts`
* [x] Include `type-tests/**/*.ts` in
`projects/zeppelin-sdk/tsconfig.spec.json`
### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-6663
### How should this be tested?
```bash
cd zeppelin-web-angular
npm run typecheck:sdk-contracts
npm run build-project:sdk
npm run check:websocket-contract
```
- The fixture assigns a literal with `name` and `value` but no `meta` to
`CompletionItem` without a type assertion.
- `<at>ts-expect-error` cases reject literals missing `name` or `value`, so
neither field can become optional by accident.
- The issue suggests a new `tsconfig.type-tests.json` and a new script.
Instead, this PR adds `type-tests/**/*.ts` to the existing
`projects/zeppelin-sdk/tsconfig.spec.json`.
- The existing `typecheck:sdk-contracts` script already type-checks that
config.
- `zeppelin-web-angular/pom.xml` already runs `npm run
typecheck:sdk-contracts` in the Maven `test` phase (`npm typecheck sdk
contracts` execution).
- So the regression runs in the existing Maven/frontend build path
without changing `package.json`, and without running the same typecheck twice
through `build-project:sdk`.
- `check:websocket-contract` does not inspect field optionality. It is only
a guard against unrelated operation-map regressions.
### Screenshots (if appropriate)
N/A
### Questions:
* Does the license files need to update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No
Closes #5519 from JangAyeon/ZEPPELIN-6663.
Signed-off-by: ChanHo Lee <[email protected]>
---
.../src/interfaces/message-paragraph.interface.ts | 2 +-
.../projects/zeppelin-sdk/tsconfig.spec.json | 2 +-
.../type-tests/completion-item-meta.ts | 24 ++++++++++++++++++++++
3 files changed, 26 insertions(+), 2 deletions(-)
diff --git
a/zeppelin-web-angular/projects/zeppelin-sdk/src/interfaces/message-paragraph.interface.ts
b/zeppelin-web-angular/projects/zeppelin-sdk/src/interfaces/message-paragraph.interface.ts
index dab0a65333..0906e19687 100644
---
a/zeppelin-web-angular/projects/zeppelin-sdk/src/interfaces/message-paragraph.interface.ts
+++
b/zeppelin-web-angular/projects/zeppelin-sdk/src/interfaces/message-paragraph.interface.ts
@@ -277,7 +277,7 @@ export interface Completion {
}
export interface CompletionItem {
- meta: string;
+ meta?: string;
value: string;
name: string;
}
diff --git a/zeppelin-web-angular/projects/zeppelin-sdk/tsconfig.spec.json
b/zeppelin-web-angular/projects/zeppelin-sdk/tsconfig.spec.json
index 436d2bfdf2..3011c5aeac 100644
--- a/zeppelin-web-angular/projects/zeppelin-sdk/tsconfig.spec.json
+++ b/zeppelin-web-angular/projects/zeppelin-sdk/tsconfig.spec.json
@@ -4,5 +4,5 @@
"noEmit": true,
"types": ["node"]
},
- "include": ["src/**/*.spec.ts"]
+ "include": ["src/**/*.spec.ts", "type-tests/**/*.ts"]
}
diff --git
a/zeppelin-web-angular/projects/zeppelin-sdk/type-tests/completion-item-meta.ts
b/zeppelin-web-angular/projects/zeppelin-sdk/type-tests/completion-item-meta.ts
new file mode 100644
index 0000000000..d61cce076e
--- /dev/null
+++
b/zeppelin-web-angular/projects/zeppelin-sdk/type-tests/completion-item-meta.ts
@@ -0,0 +1,24 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { CompletionItem } from '../src/interfaces/message-paragraph.interface';
+
+// Spark and Flink interpreters build InterpreterCompletion(name, value,
null), and
+// NotebookServer's Gson omits null fields, so their completion payloads have
no `meta` key.
+export const sparkFlinkCompletion: CompletionItem = { name: 'println', value:
'println' };
+
+// `name` and `value` are always supplied by production construction sites and
must stay required.
+// @ts-expect-error `name` is required
+export const missingName: CompletionItem = { value: 'println' };
+
+// @ts-expect-error `value` is required
+export const missingValue: CompletionItem = { name: 'println' };