[ZEPPELIN-6724] Add a convention for frontend type tests #5520
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 401 lines diff across 5 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.359
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #5520"
general
weight: 0.35
jongyoul
What is this PR for?
Type tests in the frontend currently come in two layouts: assertions inside an SDK spec (ZEPPELIN-6664) and a separate
type-tests/directory (ZEPPELIN-6663). This PR settles on the first and documents it inzeppelin-web-angular/AGENTS.md, so the next type test has one place to go.The convention
expectTypeOf,assertType,@ts-expect-error) go in ordinary.spec.tsfiles, beside the interface they pin.tscchecks the spec: today, the zeppelin-sdk and notebook-core specs. Lint now accepts a type-only test there and still rejects one elsewhere.assertType<T>(...). Prefer an exact matcher to@ts-expect-error, which any error on the next line satisfies.Why ordinary specs
tscchecks them. The two spec programs above already have atscpass in Maven (typecheck:sdk-contracts,typecheck:notebook-core), so a type test there needs no extra tsconfig, script or runner..test-d.tsfiles checked byvitest --typecheck. It reports failures per test, but it is still experimental and reports a file outside its tsconfig as passed (vitest#7988), so a type test could go unchecked without anyone noticing. Per-test output is not worth that risk or a second checker.Commits (each passes typecheck, lint and tests on its own)
1.
eslint.config.js: accept type assertions in the two typechecked spec programs.2. Move the
CompletionItemtype test intocompletion-item.spec.ts, using exact matchers instead of@ts-expect-error.3. Drop the now-empty
type-tests/include from the SDK spec tsconfig.4. List
typecheck:sdk-contractsin AGENTS.md. Maven already ran it.5. Document the convention.
6. Replace runtime
expects on typed literals in the SDK specs withassertType.tscalready checked those literals;assertTypekeeps that check, excess properties included, without a variable that needs a use.What type of PR is it?
Improvement
Todos
[x] Accept type-only tests in typechecked spec programs
[x] Move the
CompletionItemtype test into an SDK spec[x] Document the convention in
zeppelin-web-angular/AGENTS.mdWhat is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-6724
How should this be tested?
expectTypeOfundersrc/:vitest/expect-expectreports it. The same test underprojects/zeppelin-sdk/srcpasses.CompletionItem.nameoptional:typecheck:sdk-contractsreportscompletion-item.spec.ts.Screenshots (if appropriate)
N/A
Questions:
Does the license files need to update? No
Is there breaking changes for older versions? No
zeppelin-web-angular/AGENTS.mdis updated in this PR