Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
chore: enable noUncheckedIndexedAccess (#35178)
Stephen Zhouabb84f1c3848
diff --git a/packages/migrate-no-unchecked-indexed-access/bin/migrate-no-unchecked-indexed-access.js b/packages/migrate-no-unchecked-indexed-access/bin/migrate-no-unchecked-indexed-access.jsnew file mode 100755index 00000000000..2f2b0d72a9b--- /dev/null+++ b/packages/migrate-no-unchecked-indexed-access/bin/migrate-no-unchecked-indexed-access.js@@ -0,0 +1,28 @@+#!/usr/bin/env node++import { spawnSync } from 'node:child_process'+import fs from 'node:fs'+import path from 'node:path'+import process from 'node:process'+import { fileURLToPath } from 'node:url'++const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')+const entryFile = path.join(packageRoot, 'dist', 'cli.mjs')++if (!fs.existsSync(entryFile))+ throw new Error(`Built CLI entry not found at ${entryFile}. Run "pnpm --filter migrate-no-unchecked-indexed-access build" first.`)++const result = spawnSync(+ process.execPath,+ [entryFile, ...process.argv.slice(2)],+ {+ cwd: process.cwd(),+ env: process.env,+ stdio: 'inherit',+ },+)++if (result.error)+ throw result.error++process.exit(result.status ?? 1)diff --git a/packages/migrate-no-unchecked-indexed-access/package.json b/packages/migrate-no-unchecked-indexed-access/package.jsonnew file mode 100644index 00000000000..781e88b0e8f--- /dev/null+++ b/packages/migrate-no-unchecked-indexed-access/package.json@@ -0,0 +1,20 @@+{+ "name": "migrate-no-unchecked-indexed-access",+ "private": true,+ "version": "0.0.0-private",+ "type": "module",+ "bin": {+ "migrate-no-unchecked-indexed-access": "./bin/migrate-no-unchecked-indexed-access.js"+ },+ "scripts": {+ "build": "vp pack"+ },+ "dependencies": {+ "typescript": "catalog:"+ },+ "devDependencies": {+ "@types/node": "catalog:",+ "vite": "catalog:",+ "vite-plus": "catalog:"+ }+}diff --git a/packages/migrate-no-unchecked-indexed-access/src/cli.ts b/packages/migrate-no-unchecked-indexed-access/src/cli.tsnew file mode 100644index 00000000000..fa525109050--- /dev/null+++ b/packages/migrate-no-unchecked-indexed-access/src/cli.ts@@ -0,0 +1,45 @@+import process from 'node:process'+import { runBatchMigrationCommand } from './no-unchecked-indexed-access/run'++function printUsage() {+ console.log(`Usage:+ migrate-no-unchecked-indexed-access [options]++Options:+ --project <path>+ --batch-size <number>+ --batch-iterations <number>+ --max-rounds <number>+ --verbose`)+}++async function flushStandardStreams() {+ await Promise.all([+ new Promise<void>(resolve => process.stdout.write('', () => resolve())),+ new Promise<void>(resolve => process.stderr.write('', () => resolve())),+ ])+}++async function main() {+ const argv = process.argv.slice(2)+ if (argv.includes('help') || argv.includes('--help') || argv.includes('-h')) {+ printUsage()+ return+ }++ await runBatchMigrationCommand(argv)+}++let exitCode = 0++try {+ await main()+ exitCode = process.exitCode ?? 0+}+catch (error) {+ console.error(error instanceof Error ? error.message : error)+ exitCode = 1+}++await flushStandardStreams()+process.exit(exitCode)diff --git a/packages/migrate-no-unchecked-indexed-access/src/no-unchecked-indexed-access/migrate.ts b/packages/migrate-no-unchecked-indexed-access/src/no-unchecked-indexed-access/migrate.tsnew file mode 100644index 00000000000..6b79e214bb4--- /dev/null+++ b/packages/migrate-no-unchecked-indexed-access/src/no-unchecked-indexed-access/migrate.ts@@ -0,0 +1,1835 @@+import fs from 'node:fs/promises'+import path from 'node:path'+import process from 'node:process'+import ts from 'typescript'++const SUPPORTED_EXTENSIONS = new Set(['.ts', '.tsx', '.mts', '.cts'])+export const SUPPORTED_DIAGNOSTIC_CODES = new Set([2322, 2339, 2345, 2488, 2532, 2538, 2604, 2722, 2769, 2786, 7006, 18047, 18048])+const DEFAULT_MAX_ITERATIONS = 10+const ACCESS_DIAGNOSTIC_CODES = new Set([2339, 2532, 18047, 18048])+const ASSIGNABILITY_DIAGNOSTIC_CODES = new Set([2322, 2345, 2769])+const parsedConfigCache = new Map<string, ts.ParsedCommandLine>()++type CliOptions = {+ files: string[]+ maxIterations: number+ project: string+ useFullProjectRoots?: boolean+ verbose: boolean+ write: boolean+}++type TextEdit = {+ end: number+ expectedText?: string+ replacement: string+ start: number+}++type EditTarget+ = { expression: ts.Expression, kind: 'expression', sourceFile: ts.SourceFile }+ | { end: number, kind: 'direct-edit', replacement: string, sourceFile: ts.SourceFile, start: number }+ | { kind: 'shorthand-property', property: ts.ShorthandPropertyAssignment, sourceFile: ts.SourceFile }++export function parseArgs(argv: string[]): CliOptions {+ const options: CliOptions = {+ files: [],+ maxIterations: DEFAULT_MAX_ITERATIONS,+ project: 'tsconfig.json',+ verbose: false,+ write: false,+ }++ for (let i = 0; i < argv.length; i += 1) {+ const arg = argv[i]+ if (!arg)+ continue++ if (arg === '--')+ continue++ if (arg === '--write') {+ options.write = true+ continue+ }++ if (arg === '--verbose') {+ options.verbose = true+ continue+ }++ if (arg === '--project') {+ const value = argv[i + 1]+ if (!value)+ throw new Error('Missing value for --project')++ options.project = value+ i += 1+ continue+ }++ if (arg === '--max-iterations') {+ const value = argv[i + 1]+ if (!value)+ throw new Error('Missing value for --max-iterations')++ const parsed = Number(value)+ if (!Number.isInteger(parsed) || parsed <= 0)+ throw new Error(`Invalid --max-iterations value: ${value}`)++ options.maxIterations = parsed+ i += 1+ continue+ }++ if (arg === '--files') {+ const value = argv[i + 1]+ if (!value)+ throw new Error('Missing value for --files')++ options.files.push(...splitFilesArgument(value))+ i += 1+ continue+ }++ if (arg.startsWith('--'))+ throw new Error(`Unknown option: ${arg}`)++ options.files.push(...splitFilesArgument(arg))+ }++ return options+}++function splitFilesArgument(value: string): string[] {+ return value+ .split(',')+ .map(item => item.trim())+ .filter(Boolean)+}++function parseTsConfig(projectPath: string): ts.ParsedCommandLine {+ const cached = parsedConfigCache.get(projectPath)+ if (cached)+ return cached++ const configFile = ts.readConfigFile(projectPath, ts.sys.readFile)+ if (configFile.error)+ throw new Error(formatDiagnostic(configFile.error))++ const configDirectory = path.dirname(projectPath)+ const parsedConfig = ts.parseJsonConfigFileContent(+ configFile.config,+ ts.sys,+ configDirectory,+ undefined,+ projectPath,+ )+ parsedConfigCache.set(projectPath, parsedConfig)+ return parsedConfig+}++function createMigrationProgram(+ rootNames: string[],+ parsedConfig: ts.ParsedCommandLine,+ fileTexts: Map<string, string>,+ oldProgram?: ts.Program,+): ts.Program {+ const compilerHost = ts.createCompilerHost(parsedConfig.options, true)+ const originalGetSourceFile = compilerHost.getSourceFile.bind(compilerHost)++ compilerHost.readFile = (fileName) => {+ return fileTexts.get(fileName) ?? ts.sys.readFile(fileName)+ }++ compilerHost.getSourceFile = (fileName, languageVersion, onError, shouldCreateNewSourceFile) => {+ const text = fileTexts.get(fileName)+ if (text !== undefined)+ return ts.createSourceFile(fileName, text, languageVersion, true)++ return originalGetSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile)+ }++ return ts.createProgram({+ oldProgram,+ host: compilerHost,+ options: parsedConfig.options,+ projectReferences: parsedConfig.projectReferences,+ rootNames,+ })+}++function isTargetFile(fileName: string): boolean {+ const extension = path.extname(fileName)+ if (!SUPPORTED_EXTENSIONS.has(extension))+ return false++ if (fileName.endsWith('.d.ts'))+ return false++ return !fileName.includes(`${path.sep}.next${path.sep}`)+}++function normalizeFileName(fileName: string): string {+ return path.resolve(fileName)+}++function isDeclarationSupportFile(fileName: string): boolean {+ return fileName.endsWith('.d.ts')+}++function isSetupSupportFile(fileName: string): boolean {+ const baseName = path.basename(fileName)+ return baseName === 'vitest.setup.ts'+ || baseName === 'vitest.setup.tsx'+ || baseName === 'jest.setup.ts'+ || baseName === 'jest.setup.tsx'+ || baseName === 'setupTests.ts'+ || baseName === 'setupTests.tsx'+ || baseName === 'test.setup.ts'+ || baseName === 'test.setup.tsx'+}++function getMigrationRootNames(+ parsedConfig: ts.ParsedCommandLine,+ targetFiles: string[],+): string[] {+ const rootNames = new Set(targetFiles)++ for (const fileName of parsedConfig.fileNames.map(normalizeFileName)) {+ if (isDeclarationSupportFile(fileName) || isSetupSupportFile(fileName))+ rootNames.add(fileName)+ }++ return Array.from(rootNames)+}++function createFileMatcher(filePatterns: string[]): (fileName: string) => boolean {+ if (filePatterns.length === 0)+ return () => true++ const patterns = filePatterns.map(pattern => ({+ absolute: normalizeFileName(pattern),+ raw: pattern.split(path.sep).join('/'),+ }))+ return (fileName: string) => {+ const normalized = normalizeFileName(fileName)+ const unixStyle = normalized.split(path.sep).join('/')+ return patterns.some(pattern => normalized === pattern.absolute || unixStyle.endsWith(pattern.raw))+ }+}++function formatDiagnostic(diagnostic: ts.Diagnostic): string {+ const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n')+ if (!diagnostic.file || diagnostic.start === undefined)+ return message++ const position = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start)+ return `${diagnostic.file.fileName}:${position.line + 1}:${position.character + 1} TS${diagnostic.code}: ${message}`+}++function ensureTrailingNonNullAssertion(expression: string): string {+ const trimmedExpression = expression.trimEnd()+ return trimmedExpression.endsWith('!')+ ? trimmedExpression+ : `${trimmedExpression}!`+}++function hasOptionalChainDescendant(node: ts.Node): boolean {+ let found = false++ const visit = (current: ts.Node) => {+ if (found)+ return++ if (ts.isOptionalChain(current)) {+ found = true+ return+ }++ current.forEachChild(visit)+ }++ visit(node)+ return found+}++function shouldPrintInlineNonNullAssertion(expression: ts.Expression): boolean {+ return ts.isOptionalChain(expression)+ || (ts.isParenthesizedExpression(expression) && hasOptionalChainDescendant(expression.expression))+}++function normalizeOptionalChainNonNullContinuations(text: string): string {+ const sourceFile = ts.createSourceFile('normalize.tsx', text, ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX)+ const edits: TextEdit[] = []++ const visit = (node: ts.Node) => {+ if (+ ts.isNonNullExpression(node)+ && ts.isParenthesizedExpression(node.expression)+ && hasOptionalChainDescendant(node.expression.expression)+ ) {+ edits.push({+ end: node.getEnd(),+ replacement: `${node.expression.expression.getText(sourceFile)}!`,+ start: node.getStart(sourceFile),+ })+ return+ }++ node.forEachChild(visit)+ }++ visit(sourceFile)++ if (edits.length === 0)+ return text++ return applyEdits(text, edits).text+}++function collapseRepeatedInlineComments(text: string): string {+ return text+ .split('\n')+ .map((line) => {+ const commentIndex = line.indexOf('//')+ if (commentIndex < 0)+ return line++ const prefix = line.slice(0, commentIndex).trimEnd()+ const comment = line.slice(commentIndex + 2).trim()+ const segments = comment+ .split(/\s+\/\/\s+/)+ .map(item => item.trim())+ .filter(Boolean)++ if (segments.length < 2)+ return line++ const lastSegment = segments[segments.length - 1]!+ const stableSegments = segments.slice(0, -1)+ const repeatedSameComment = stableSegments.length > 0+ && stableSegments.every(segment => segment === segments[0])+ && (lastSegment === segments[0] || segments[0]!.startsWith(lastSegment) || lastSegment.startsWith(segments[0]!))++ if (!repeatedSameComment)+ return line.replace(/!{2,}$/g, '!')++ const normalizedComment = segments[0]!.replace(/!{2,}$/g, '!')+ return prefix ? `${prefix} // ${normalizedComment}` : `// ${normalizedComment}`+ })+ .join('\n')+}++export function normalizeMalformedAssertions(text: string): string {+ const normalizedText = text+ .replace(/\n(\s*)! (\s*\/\/[^\n]*)\n/g, '! $2\n')+ .replace(/\.not!+(?=[.(])/g, '.not')+ .replace(/(\(|,\s*)([A-Za-z_$][\w$]*)\s*:\s*any\s*=>/g, '$1($2: any) =>')+ .replace(/([,{]\s*)([A-Z_$][\w$]*)!=\{/g, '$1$2={')+ .replace(/\b([A-Z_$][\w$]*)!!,/gi, '$1: $1!,')+ .replace(/\b([A-Z_$][\w$]*)!!:/gi, '$1:')+ .replace(/([,{]\s*)([A-Z_$][\w$]*)!:/gi, '$1$2:')+ .replace(/\b(const|let|var)\s+\{([^=\n]+)\}\s*=\s*([^\n;]+)/g, (fullMatch, keyword: string, bindings: string, expression: string) => {+ if (!bindings.includes('!'))+ return fullMatch++ const normalizedBindings = bindings.replace(/!([,\s}:])/g, '$1')+ return `${keyword} {${normalizedBindings}} = ${ensureTrailingNonNullAssertion(expression)}`+ })++ return collapseRepeatedInlineComments(normalizeOptionalChainNonNullContinuations(normalizedText))+}++function isExpressionTarget(target: EditTarget): target is Extract<EditTarget, { kind: 'expression' }> {+ return target.kind === 'expression'+}++function createExpressionTarget(expression: ts.Expression): EditTarget {+ return {+ expression,+ kind: 'expression',+ sourceFile: expression.getSourceFile(),+ }+}++function createShorthandPropertyTarget(property: ts.ShorthandPropertyAssignment): EditTarget {+ return {+ kind: 'shorthand-property',+ property,+ sourceFile: property.getSourceFile(),+ }+}++function createDirectEditTarget(+ sourceFile: ts.SourceFile,+ start: number,+ end: number,+ replacement: string,+): EditTarget {+ return {+ end,+ kind: 'direct-edit',+ replacement,+ sourceFile,+ start,+ }+}++function createIterableFallbackReplacement(+ expression: ts.Expression,+ sourceFile: ts.SourceFile,+): string {+ return `(${expression.getText(sourceFile)} ?? [])`+}++function createIterableFallbackTarget(expression: ts.Expression): EditTarget {+ return createDirectEditTarget(+ expression.getSourceFile(),+ expression.getStart(expression.getSourceFile()),+ expression.getEnd(),+ createIterableFallbackReplacement(expression, expression.getSourceFile()),+ )+}++function createArrayLiteralIterableFallbackTarget(+ arrayLiteral: ts.ArrayLiteralExpression,+ checker: ts.TypeChecker,+): EditTarget | undefined {+ const sourceFile = arrayLiteral.getSourceFile()+ const start = arrayLiteral.getStart(sourceFile)+ const end = arrayLiteral.getEnd()+ const originalText = sourceFile.text.slice(start, end)+ const edits: TextEdit[] = []++ for (const element of arrayLiteral.elements) {+ if (!ts.isSpreadElement(element))+ continue++ if (isAlreadyNonNull(element.expression))+ continue++ if (!typeIncludesUndefined(checker.getTypeAtLocation(element.expression)))+ continue++ edits.push({+ end: element.expression.getEnd() - start,+ replacement: createIterableFallbackReplacement(element.expression, sourceFile),+ start: element.expression.getStart(sourceFile) - start,+ })+ }++ if (edits.length === 0)+ return undefined++ return createDirectEditTarget(+ sourceFile,+ start,+ end,+ applyEdits(originalText, edits).text,+ )+}++function getTokenAtPosition(sourceFile: ts.SourceFile, position: number): ts.Node {+ let current: ts.Node = sourceFile++ while (true) {+ let next: ts.Node | undefined+ current.forEachChild((child) => {+ if (!next && position >= child.getFullStart() && position < child.getEnd())+ next = child+ })++ if (!next)+ return current++ current = next+ }+}++function findAncestor<NodeType extends ts.Node>(+ node: ts.Node | undefined,+ predicate: (candidate: ts.Node) => candidate is NodeType,+): NodeType | undefined {+ let current = node++ while (current) {+ if (predicate(current))+ return current++ current = current.parent+ }++ return undefined+}++function findTightestExpression(sourceFile: ts.SourceFile, start: number, end: number): ts.Expression | undefined {+ let node: ts.Node | undefined = getTokenAtPosition(sourceFile, start)++ while (node) {+ if (ts.isExpression(node)) {+ const nodeStart = node.getStart(sourceFile)+ const nodeEnd = node.getEnd()+ if (nodeStart <= start && end <= nodeEnd)+ return node+ }++ node = node.parent+ }++ return undefined+}++function isAssignmentOperator(token: ts.SyntaxKind): boolean {+ return token >= ts.SyntaxKind.FirstAssignment && token <= ts.SyntaxKind.LastAssignment+}++function typeIncludesUndefined(type: ts.Type): boolean {+ if ((type.flags & ts.TypeFlags.Undefined) !== 0)+ return true++ if (!type.isUnion())+ return false++ return type.types.some(typeIncludesUndefined)+}++function skipOuterExpressions(expression: ts.Expression): ts.Expression {+ let current = expression++ while (ts.isParenthesizedExpression(current) || ts.isNonNullExpression(current))+ current = current.expression++ return current+}++function isAlreadyNonNull(expression: ts.Expression): boolean {+ let current = expression++ while (ts.isParenthesizedExpression(current))+ current = current.expression++ return ts.isNonNullExpression(current)+}++function findAssignmentLikeCandidate(+ token: ts.Node,+ sourceFile: ts.SourceFile,+ start: number,+ end: number,+): ts.Expression | undefined {+ let current: ts.Node | undefined = token++ while (current) {+ if (ts.isVariableDeclaration(current) && current.initializer)+ return current.initializer++ if (ts.isPropertyDeclaration(current) && current.initializer)+ return current.initializer++ if (ts.isPropertyAssignment(current))+ return current.initializer++ if (ts.isShorthandPropertyAssignment(current))+ return current.name++ if (ts.isParameter(current) && current.initializer)+ return current.initializer++ if (ts.isReturnStatement(current) && current.expression)+ return current.expression++ if (ts.isBinaryExpression(current) && isAssignmentOperator(current.operatorToken.kind))+ return current.right++ if (ts.isJsxAttribute(current) && current.initializer && ts.isJsxExpression(current.initializer) && current.initializer.expression)+ return current.initializer.expression++ if (ts.isJsxSpreadAttribute(current))+ return current.expression++ current = current.parent+ }++ return findTightestExpression(sourceFile, start, end)+}++function findArgumentCandidate(+ token: ts.Node,+ sourceFile: ts.SourceFile,+ start: number,+ end: number,+): ts.Expression | undefined {+ let current: ts.Node | undefined = token++ while (current) {+ if ((ts.isCallExpression(current) || ts.isNewExpression(current)) && current.arguments) {+ const argument = current.arguments.find((item) => {+ const itemStart = item.getStart(sourceFile)+ const itemEnd = item.getEnd()+ return itemStart <= start && end <= itemEnd+ })+ if (argument)+ return argument+ }++ current = current.parent+ }++ return findTightestExpression(sourceFile, start, end)+}++function getExpressionFromJsxAttribute(attribute: ts.JsxAttribute): ts.Expression | undefined {+ return attribute.initializer && ts.isJsxExpression(attribute.initializer)+ ? attribute.initializer.expression+ : undefined+}++function findTargetFromExpression(+ expression: ts.Expression,+ checker: ts.TypeChecker,+): EditTarget | undefined {+ const referencedDeclarationTarget = findReferencedDeclarationInitializerTarget(expression, checker)+ if (referencedDeclarationTarget)+ return referencedDeclarationTarget++ const nestedTarget = findNestedContainerTarget(expression, checker)+ if (nestedTarget)+ return nestedTarget++ const innerExpression = skipOuterExpressions(expression)+ if (ts.isConditionalExpression(innerExpression)) {+ return findTargetFromExpression(innerExpression.whenTrue, checker)+ ?? findTargetFromExpression(innerExpression.whenFalse, checker)+ }++ if (+ ts.isBinaryExpression(innerExpression)+ && (+ innerExpression.operatorToken.kind === ts.SyntaxKind.BarBarToken+ || innerExpression.operatorToken.kind === ts.SyntaxKind.QuestionQuestionToken+ || innerExpression.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken+ )+ ) {+ return findTargetFromExpression(innerExpression.left, checker)+ ?? findTargetFromExpression(innerExpression.right, checker)+ }++ if (ts.isArrowFunction(innerExpression) || ts.isFunctionExpression(innerExpression)) {+ const functionTarget = findFunctionLikeReturnTarget(innerExpression, checker)+ if (functionTarget)+ return functionTarget+ }++ if (ts.isPropertyAccessExpression(innerExpression)) {+ const namedPropertyTarget = findNamedPropertyTarget(innerExpression.expression, innerExpression.name.text, checker)+ if (namedPropertyTarget)+ return namedPropertyTarget+ }++ if (ts.isCallExpression(innerExpression)) {+ const collectionCallbackTarget = findCollectionCallbackTarget(innerExpression, checker)+ if (collectionCallbackTarget)+ return collectionCallbackTarget++ const callbackArgumentTarget = findCallbackArgumentTarget(innerExpression, checker)+ if (callbackArgumentTarget)+ return callbackArgumentTarget++ const callExpressionTarget = findCallExpressionDeclarationTarget(innerExpression, checker)+ if (callExpressionTarget)+ return callExpressionTarget+ }++ if (!typeIncludesUndefined(checker.getTypeAtLocation(expression)))+ return undefined++ return createExpressionTarget(expression)+}++function findJsxSpreadAttributeTarget(+ token: ts.Node,+ checker: ts.TypeChecker,+): EditTarget | undefined {+ const spreadAttribute = findAncestor(token, ts.isJsxSpreadAttribute)+ if (spreadAttribute)+ return findTargetFromExpression(spreadAttribute.expression, checker)++ const openingLikeElement = findAncestor(token, node =>+ ts.isJsxOpeningElement(node) || ts.isJsxSelfClosingElement(node))++ if (!openingLikeElement)+ return undefined++ for (const attribute of openingLikeElement.attributes.properties) {+ if (!ts.isJsxSpreadAttribute(attribute))+ continue++ const target = findTargetFromExpression(attribute.expression, checker)+ if (target)+ return target+ }++ return undefined+}++function findShorthandPropertyTarget(+ token: ts.Node,+ checker: ts.TypeChecker,+): EditTarget | undefined {+ const property = findAncestor(token, ts.isShorthandPropertyAssignment)+ if (!property)+ return undefined++ return typeIncludesUndefined(checker.getTypeAtLocation(property.name))+ ? createShorthandPropertyTarget(property)+ : undefined+}++function findPropertyAssignmentInitializerTarget(+ token: ts.Node,+ start: number,+ checker: ts.TypeChecker,+): EditTarget | undefined {+ const propertyAssignment = findAncestor(token, ts.isPropertyAssignment)+ if (!propertyAssignment)+ return undefined++ const propertyNameStart = propertyAssignment.name.getStart()+ const propertyNameEnd = propertyAssignment.name.getEnd()+ if (start < propertyNameStart || start >= propertyNameEnd)+ return undefined++ const directTarget = findTargetFromExpression(propertyAssignment.initializer, checker)+ if (directTarget)+ return directTarget++ const nestedTarget = findNestedContainerTarget(propertyAssignment.initializer, checker)+ if (nestedTarget)+ return nestedTarget++ if (!typeIncludesUndefined(checker.getTypeAtLocation(propertyAssignment.initializer)))+ return undefined++ return createExpressionTarget(propertyAssignment.initializer)+}++function findPropertyAccessExpressionTarget(+ token: ts.Node,+ start: number,+): EditTarget | undefined {+ const propertyAccess = findAncestor(token, ts.isPropertyAccessExpression)+ if (!propertyAccess)+ return undefined++ if (start >= propertyAccess.name.getStart() && start < propertyAccess.name.getEnd())+ return createExpressionTarget(propertyAccess.expression)++ return undefined+}++function findUndefinedAccessTarget(+ token: ts.Node,+ checker: ts.TypeChecker,+): EditTarget | undefined {+ let current: ts.Node | undefined = token+ let bestTarget: EditTarget | undefined++ while (current) {+ if (ts.isPropertyAccessExpression(current)) {+ const expression = current.expression+ if (typeIncludesUndefined(checker.getTypeAtLocation(expression)) && !isAlreadyNonNull(expression))+ bestTarget = createExpressionTarget(expression)+ }++ if (ts.isElementAccessExpression(current)) {+ const expression = current.expression+ if (typeIncludesUndefined(checker.getTypeAtLocation(expression)) && !isAlreadyNonNull(expression))+ bestTarget = createExpressionTarget(expression)+ }++ current = current.parent+ }++ return bestTarget+}++function findElementAccessArgumentTarget(token: ts.Node): EditTarget | undefined {+ let current = token+ let matchingElementAccess: ts.ElementAccessExpression | undefined++ while (current) {+ if (ts.isElementAccessExpression(current) && current.argumentExpression)+ matchingElementAccess = current++ current = current.parent+ }++ if (!matchingElementAccess?.argumentExpression)+ return undefined++ return createExpressionTarget(matchingElementAccess.argumentExpression)+}++function findIterableTarget(+ sourceFile: ts.SourceFile,+ token: ts.Node,+ start: number,+ end: number,+ checker: ts.TypeChecker,+): EditTarget | undefined {+ const arrayLiteral = findAncestor(token, ts.isArrayLiteralExpression)+ if (arrayLiteral) {+ const arrayLiteralTarget = createArrayLiteralIterableFallbackTarget(arrayLiteral, checker)+ if (arrayLiteralTarget)+ return arrayLiteralTarget+ }++ const spreadElement = findAncestor(token, ts.isSpreadElement)+ if (spreadElement && !isAlreadyNonNull(spreadElement.expression))+ return createIterableFallbackTarget(spreadElement.expression)++ const variableDeclaration = findAncestor(token, ts.isVariableDeclaration)+ if (+ variableDeclaration?.initializer+ && typeIncludesUndefined(checker.getTypeAtLocation(variableDeclaration.initializer))+ && !isAlreadyNonNull(variableDeclaration.initializer)+ ) {+ return createExpressionTarget(variableDeclaration.initializer)+ }++ const binaryExpression = findAncestor(token, ts.isBinaryExpression)+ if (+ binaryExpression+ && isAssignmentOperator(binaryExpression.operatorToken.kind)+ && typeIncludesUndefined(checker.getTypeAtLocation(binaryExpression.right))+ && !isAlreadyNonNull(binaryExpression.right)+ ) {+ return createExpressionTarget(binaryExpression.right)+ }++ return undefined+}++function findImplicitAnyParameterTarget(token: ts.Node): EditTarget | undefined {+ const parameter = findAncestor(token, ts.isParameter)+ if (!parameter || parameter.type || !ts.isIdentifier(parameter.name))+ return undefined++ const sourceFile = parameter.getSourceFile()+ const replacement = ts.isArrowFunction(parameter.parent) && parameter.parent.parameters.length === 1+ ? `(${parameter.name.getText(sourceFile)}: any)`+ : `${parameter.name.getText(sourceFile)}: any`++ return createDirectEditTarget(+ sourceFile,+ parameter.getStart(sourceFile),+ parameter.getEnd(),+ replacement,+ )+}++function getArrayPatternElementTypeText(+ element: ts.ArrayBindingElement | ts.Expression,+ checker: ts.TypeChecker,+): string {+ if (ts.isOmittedExpression(element))+ return 'unknown'++ const targetNode = ts.isBindingElement(element)+ ? element.name+ : element++ const targetType = checker.getNonNullableType(checker.getTypeAtLocation(targetNode))+ const typeText = checker.typeToString(targetType)+ return typeText === 'never' ? 'unknown' : typeText+}++function createArrayDestructuringReplacement(+ sourceFile: ts.SourceFile,+ expression: ts.Expression,+ elements: readonly (ts.ArrayBindingElement | ts.Expression)[],+ checker: ts.TypeChecker,+ options?: {+ fallbackToEmptyArray?: boolean+ },+): string | undefined {+ if (elements.length === 0)+ return undefined++ const tupleTypes = elements.map(element => getArrayPatternElementTypeText(element, checker))+ const expressionText = options?.fallbackToEmptyArray+ ? `(${expression.getText(sourceFile)} ?? [])`+ : `(${expression.getText(sourceFile)})`+ return `${expressionText} as [${tupleTypes.join(', ')}]`+}++function findArrayDestructuringTarget(+ token: ts.Node,+ checker: ts.TypeChecker,+): EditTarget | undefined {+ const binaryExpression = findAncestor(token, ts.isBinaryExpression)+ if (binaryExpression && isAssignmentOperator(binaryExpression.operatorToken.kind) && ts.isArrayLiteralExpression(binaryExpression.left)) {+ const replacement = createArrayDestructuringReplacement(+ binaryExpression.getSourceFile(),+ binaryExpression.right,+ binaryExpression.left.elements,+ checker,+ {+ fallbackToEmptyArray: typeIncludesUndefined(checker.getTypeAtLocation(binaryExpression.right)),+ },+ )+ if (replacement) {+ return createDirectEditTarget(+ binaryExpression.getSourceFile(),+ binaryExpression.right.getStart(binaryExpression.getSourceFile()),+ binaryExpression.right.getEnd(),+ replacement,+ )+ }+ }++ const variableDeclaration = findAncestor(token, ts.isVariableDeclaration)+ if (variableDeclaration?.initializer && ts.isArrayBindingPattern(variableDeclaration.name)) {+ const replacement = createArrayDestructuringReplacement(+ variableDeclaration.getSourceFile(),+ variableDeclaration.initializer,+ variableDeclaration.name.elements,+ checker,+ {+ fallbackToEmptyArray: typeIncludesUndefined(checker.getTypeAtLocation(variableDeclaration.initializer)),+ },+ )+ if (replacement) {+ return createDirectEditTarget(+ variableDeclaration.getSourceFile(),+ variableDeclaration.initializer.getStart(variableDeclaration.getSourceFile()),+ variableDeclaration.initializer.getEnd(),+ replacement,+ )+ }+ }++ return undefined+}++function findVariableDeclarationInitializerTarget(+ sourceFile: ts.SourceFile,+ token: ts.Node,+ checker: ts.TypeChecker,+): EditTarget | undefined {+ const variableDeclaration = findAncestor(token, ts.isVariableDeclaration)+ if (!variableDeclaration?.initializer)+ return undefined++ const nestedTarget = findNestedContainerTarget(variableDeclaration.initializer, checker)+ if (nestedTarget)+ return nestedTarget++ if (!typeIncludesUndefined(checker.getTypeAtLocation(variableDeclaration.initializer)))+ return undefined++ return createExpressionTarget(variableDeclaration.initializer)+}++function getResolvedValueDeclaration(+ symbol: ts.Symbol | undefined,+ checker: ts.TypeChecker,+): ts.Declaration | undefined {+ if (!symbol)+ return undefined++ const resolvedSymbol = symbol.flags & ts.SymbolFlags.Alias+ ? checker.getAliasedSymbol(symbol)+ : symbol++ return resolvedSymbol.valueDeclaration ?? resolvedSymbol.declarations?.[0]+}++function getFunctionLikeDeclaration(+ declaration: ts.Declaration,+): ts.FunctionLikeDeclarationBase | undefined {+ if (+ ts.isFunctionDeclaration(declaration)+ || ts.isMethodDeclaration(declaration)+ || ts.isFunctionExpression(declaration)+ || ts.isArrowFunction(declaration)+ ) {+ return declaration+ }++ if (+ ts.isVariableDeclaration(declaration)+ && declaration.initializer+ && (ts.isArrowFunction(declaration.initializer) || ts.isFunctionExpression(declaration.initializer))+ ) {+ return declaration.initializer+ }++ return undefined+}++function getPropertyNameText(name: ts.PropertyName | ts.BindingName): string | undefined {+ if (ts.isIdentifier(name) || ts.isStringLiteral(name) || ts.isNumericLiteral(name))+ return name.text++ return undefined+}++function getCallExpressionPropertyAccess(callExpression: ts.CallExpression): ts.PropertyAccessExpression | undefined {+ const callee = skipOuterExpressions(callExpression.expression)+ return ts.isPropertyAccessExpression(callee) ? callee : undefined+}++function getFunctionExpressionArgument(callExpression: ts.CallExpression, index = 0): ts.ArrowFunction | ts.FunctionExpression | undefined {+ const callback = callExpression.arguments[index]+ return callback && (ts.isArrowFunction(callback) || ts.isFunctionExpression(callback))+ ? callback+ : undefined+}++function findTargetInFunctionBody(+ body: ts.ConciseBody,+ resolveExpression: (expression: ts.Expression) => EditTarget | undefined,+): EditTarget | undefined {+ if (ts.isBlock(body)) {+ for (const expression of findReturnStatementExpressions(body)) {+ const target = resolveExpression(expression)+ if (target)+ return target+ }++ return undefined+ }++ return resolveExpression(body)+}++function getParameterCollectionExpression(+ declaration: ts.ParameterDeclaration,+): ts.Expression | undefined {+ const functionLikeDeclaration = declaration.parent+ if (+ !(ts.isArrowFunction(functionLikeDeclaration) || ts.isFunctionExpression(functionLikeDeclaration))+ || !ts.isCallExpression(functionLikeDeclaration.parent)+ || functionLikeDeclaration.parent.arguments[0] !== functionLikeDeclaration+ ) {+ return undefined+ }++ const callee = getCallExpressionPropertyAccess(functionLikeDeclaration.parent)+ return callee?.expression+}++function findObjectLiteralNamedPropertyTarget(+ objectLiteral: ts.ObjectLiteralExpression,+ propertyName: string,+ checker: ts.TypeChecker,+): EditTarget | undefined {+ for (const property of objectLiteral.properties) {+ if (ts.isSpreadAssignment(property))+ continue++ if (ts.isShorthandPropertyAssignment(property) && property.name.text === propertyName)+ return createShorthandPropertyTarget(property)++ if (ts.isPropertyAssignment(property)) {+ const currentPropertyName = getPropertyNameText(property.name)+ if (currentPropertyName !== propertyName)+ continue++ return findTargetFromExpression(property.initializer, checker)+ ?? createExpressionTarget(property.initializer)+ }+ }++ return undefined+}++function findFunctionLikeNamedReturnTarget(+ declaration: ts.FunctionLikeDeclarationBase,+ propertyName: string,+ checker: ts.TypeChecker,+): EditTarget | undefined {+ if (!declaration.body)+ return undefined++ return findTargetInFunctionBody(+ declaration.body,+ expression => findNamedPropertyTarget(expression, propertyName, checker),+ )+}++function findCollectionPropertyTarget(+ expression: ts.Expression,+ propertyName: string,+ checker: ts.TypeChecker,+): EditTarget | undefined {+ const innerExpression = skipOuterExpressions(expression)++ if (ts.isIdentifier(innerExpression))+ return findNamedPropertyTarget(innerExpression, propertyName, checker)++ if (!ts.isCallExpression(innerExpression))+ return undefined++ const callee = getCallExpressionPropertyAccess(innerExpression)+ if (!callee)+ return undefined++ if (callee.name.text === 'map' || callee.name.text === 'flatMap') {+ const callback = getFunctionExpressionArgument(innerExpression)+ if (!callback)+ return undefined++ return findTargetInFunctionBody(+ callback.body,+ returnedExpression => findNamedPropertyTarget(returnedExpression, propertyName, checker),+ )+ }++ if (callee.name.text === 'filter')+ return findCollectionPropertyTarget(callee.expression, propertyName, checker)++ return undefined+}++function findNamedPropertyTarget(+ expression: ts.Expression,+ propertyName: string,+ checker: ts.TypeChecker,+): EditTarget | undefined {+ const innerExpression = skipOuterExpressions(expression)++ if (ts.isObjectLiteralExpression(innerExpression))+ return findObjectLiteralNamedPropertyTarget(innerExpression, propertyName, checker)++ if (ts.isIdentifier(innerExpression)) {+ const declaration = getResolvedValueDeclaration(checker.getSymbolAtLocation(innerExpression), checker)+ if (!declaration)+ return undefined++ if (ts.isParameter(declaration)) {+ const collectionExpression = getParameterCollectionExpression(declaration)+ if (collectionExpression)+ return findCollectionPropertyTarget(collectionExpression, propertyName, checker)+ }++ const functionLikeDeclaration = getFunctionLikeDeclaration(declaration)+ if (functionLikeDeclaration)+ return findFunctionLikeNamedReturnTarget(functionLikeDeclaration, propertyName, checker)++ if (ts.isVariableDeclaration(declaration) && declaration.initializer)+ return findNamedPropertyTarget(declaration.initializer, propertyName, checker)++ return undefined+ }++ if (ts.isCallExpression(innerExpression)) {+ const collectionPropertyTarget = findCollectionPropertyTarget(innerExpression, propertyName, checker)+ if (collectionPropertyTarget)+ return collectionPropertyTarget++ const declaration = getResolvedValueDeclaration(checker.getSymbolAtLocation(skipOuterExpressions(innerExpression.expression)), checker)+ if (!declaration)+ return undefined++ const functionLikeDeclaration = getFunctionLikeDeclaration(declaration)+ if (!functionLikeDeclaration)+ return undefined++ return findFunctionLikeNamedReturnTarget(functionLikeDeclaration, propertyName, checker)+ }++ return undefined+}++function findReturnStatementExpressions(node: ts.Node): ts.Expression[] {+ const expressions: ts.Expression[] = []++ const visit = (current: ts.Node) => {+ if (+ current !== node+ && (+ ts.isArrowFunction(current)+ || ts.isFunctionExpression(current)+ || ts.isFunctionDeclaration(current)+ || ts.isMethodDeclaration(current)+ )+ ) {+ return+ }++ if (ts.isReturnStatement(current) && current.expression)+ expressions.push(current.expression)++ current.forEachChild(visit)+ }++ visit(node)+ return expressions+}++function findFunctionLikeReturnTarget(+ declaration: ts.FunctionLikeDeclarationBase,+ checker: ts.TypeChecker,+): EditTarget | undefined {+ if (!declaration.body)+ return undefined++ return findTargetInFunctionBody(+ declaration.body,+ expression => findTargetFromExpression(expression, checker),+ )+}++function findCallExpressionDeclarationTarget(+ callExpression: ts.CallExpression,+ checker: ts.TypeChecker,+): EditTarget | undefined {+ const declaration = getResolvedValueDeclaration(checker.getSymbolAtLocation(skipOuterExpressions(callExpression.expression)), checker)+ if (!declaration)+ return undefined++ const functionLikeDeclaration = getFunctionLikeDeclaration(declaration)+ if (!functionLikeDeclaration)+ return undefined++ return findFunctionLikeReturnTarget(functionLikeDeclaration, checker)+}++function findCallbackArgumentTarget(+ callExpression: ts.CallExpression,+ checker: ts.TypeChecker,+): EditTarget | undefined {+ const callee = skipOuterExpressions(callExpression.expression)+ const calleeName = ts.isIdentifier(callee) ? callee.text : getCallExpressionPropertyAccess(callExpression)?.name.text++ if (calleeName !== 'useCallback' && calleeName !== 'useMemo')+ return undefined++ const callback = getFunctionExpressionArgument(callExpression)+ if (!callback)+ return undefined++ return findFunctionLikeReturnTarget(callback, checker)+}++function findReferencedDeclarationInitializerTarget(+ expression: ts.Expression,+ checker: ts.TypeChecker,+): EditTarget | undefined {+ const innerExpression = skipOuterExpressions(expression)+ if (!ts.isIdentifier(innerExpression))+ return undefined++ const declaration = getResolvedValueDeclaration(checker.getSymbolAtLocation(innerExpression), checker)+ if (!declaration)+ return undefined++ if (ts.isBindingElement(declaration)) {+ const propertyName = declaration.propertyName+ ? getPropertyNameText(declaration.propertyName)+ : getPropertyNameText(declaration.name)++ const variableDeclaration = declaration.parent.parent+ if (propertyName && ts.isVariableDeclaration(variableDeclaration) && variableDeclaration.initializer) {+ const namedPropertyTarget = findNamedPropertyTarget(variableDeclaration.initializer, propertyName, checker)+ if (namedPropertyTarget)+ return namedPropertyTarget+ }+ }++ if (ts.isParameter(declaration)) {+ const collectionExpression = getParameterCollectionExpression(declaration)+ if (collectionExpression) {+ const collectionTarget = findTargetFromExpression(collectionExpression, checker)+ if (collectionTarget)+ return collectionTarget+ }+ }++ const functionLikeDeclaration = getFunctionLikeDeclaration(declaration)+ if (functionLikeDeclaration) {+ const functionTarget = findFunctionLikeReturnTarget(functionLikeDeclaration, checker)+ if (functionTarget)+ return functionTarget+ }++ if (!ts.isVariableDeclaration(declaration) || !declaration.initializer)+ return undefined++ const collectionCallbackTarget = findCollectionCallbackTarget(declaration.initializer, checker)+ if (collectionCallbackTarget)+ return collectionCallbackTarget++ const initializerTarget = findTargetFromExpression(declaration.initializer, checker)+ if (initializerTarget)+ return initializerTarget++ const nestedTarget = findNestedContainerTarget(declaration.initializer, checker)+ if (nestedTarget)+ return nestedTarget++ if (!typeIncludesUndefined(checker.getTypeAtLocation(declaration.initializer)))+ return undefined++ return createExpressionTarget(declaration.initializer)+}++function findCollectionCallbackTarget(+ expression: ts.Expression,+ checker: ts.TypeChecker,+): EditTarget | undefined {+ const innerExpression = skipOuterExpressions(expression)+ if (!ts.isCallExpression(innerExpression))+ return undefined++ const callee = getCallExpressionPropertyAccess(innerExpression)+ if (!callee)+ return undefined++ if (callee.name.text !== 'map' && callee.name.text !== 'flatMap')+ return undefined++ const callback = getFunctionExpressionArgument(innerExpression)+ if (!callback)+ return undefined++ return findFunctionLikeReturnTarget(callback, checker)+}++function findJsxComponentDeclarationTarget(+ token: ts.Node,+ checker: ts.TypeChecker,+): EditTarget | undefined {+ const openingLikeElement = findAncestor(token, node =>+ ts.isJsxOpeningElement(node) || ts.isJsxSelfClosingElement(node))+ if (!openingLikeElement)+ return undefined++ const tagName = openingLikeElement.tagName+ if (!ts.isIdentifier(tagName))+ return undefined++ const symbol = checker.getSymbolAtLocation(tagName)+ const declaration = symbol?.valueDeclaration+ if (!declaration || !ts.isVariableDeclaration(declaration) || !declaration.initializer)+ return undefined++ if (!typeIncludesUndefined(checker.getTypeAtLocation(declaration.initializer)))+ return undefined++ return createExpressionTarget(declaration.initializer)+}++function findObjectLiteralPropertyTarget(+ objectLiteral: ts.ObjectLiteralExpression,+ checker: ts.TypeChecker,+): EditTarget | undefined {+ for (const property of objectLiteral.properties) {+ if (ts.isSpreadAssignment(property)) {+ const directTarget = findTargetFromExpression(property.expression, checker)+ if (directTarget)+ return directTarget++ if (typeIncludesUndefined(checker.getTypeAtLocation(property.expression)))+ return createExpressionTarget(property.expression)+ continue+ }++ if (ts.isShorthandPropertyAssignment(property)) {+ if (typeIncludesUndefined(checker.getTypeAtLocation(property.name)))+ return createShorthandPropertyTarget(property)+ continue+ }++ if (ts.isPropertyAssignment(property)) {+ const directTarget = findTargetFromExpression(property.initializer, checker)+ if (directTarget)+ return directTarget++ const nestedTarget = findNestedContainerTarget(property.initializer, checker)+ if (nestedTarget)+ return nestedTarget++ if (typeIncludesUndefined(checker.getTypeAtLocation(property.initializer)))+ return createExpressionTarget(property.initializer)+ }+ }++ return undefined+}++function findArrayLiteralElementTarget(+ arrayLiteral: ts.ArrayLiteralExpression,+ checker: ts.TypeChecker,+): EditTarget | undefined {+ const iterableFallbackTarget = createArrayLiteralIterableFallbackTarget(arrayLiteral, checker)+ if (iterableFallbackTarget)+ return iterableFallbackTarget++ for (const element of arrayLiteral.elements) {+ if (ts.isSpreadElement(element)) {+ const directTarget = findTargetFromExpression(element.expression, checker)+ if (directTarget)+ return directTarget++ if (typeIncludesUndefined(checker.getTypeAtLocation(element.expression)))+ return createExpressionTarget(element.expression)+ continue+ }++ const directTarget = findTargetFromExpression(element, checker)+ if (directTarget)+ return directTarget++ const nestedTarget = findNestedContainerTarget(element, checker)+ if (nestedTarget)+ return nestedTarget++ if (typeIncludesUndefined(checker.getTypeAtLocation(element)))+ return createExpressionTarget(element)+ }++ for (let index = arrayLiteral.elements.length - 1; index >= 0; index -= 1) {+ const element = arrayLiteral.elements[index]+ if (!element)+ continue++ if (ts.isSpreadElement(element))+ continue++ if (!isAlreadyNonNull(element))+ return createExpressionTarget(element)+ }++ return undefined+}++function findNestedContainerTarget(+ expression: ts.Expression,+ checker: ts.TypeChecker,+): EditTarget | undefined {+ const innerExpression = skipOuterExpressions(expression)+ if (ts.isObjectLiteralExpression(innerExpression))+ return findObjectLiteralPropertyTarget(innerExpression, checker)++ if (ts.isArrayLiteralExpression(innerExpression))+ return findArrayLiteralElementTarget(innerExpression, checker)++ return undefined+}++function findAccessDiagnosticTarget(+ sourceFile: ts.SourceFile,+ token: ts.Node,+ start: number,+ end: number,+ checker: ts.TypeChecker,+): EditTarget | undefined {+ const directExpression = findTightestExpression(sourceFile, start, end)+ if (directExpression) {+ if (typeIncludesUndefined(checker.getTypeAtLocation(directExpression)) && !isAlreadyNonNull(directExpression))+ return createExpressionTarget(directExpression)++ const referencedDeclarationTarget = findReferencedDeclarationInitializerTarget(directExpression, checker)+ if (referencedDeclarationTarget && isExpressionTarget(referencedDeclarationTarget) && !isAlreadyNonNull(referencedDeclarationTarget.expression))+ return referencedDeclarationTarget+ }++ const bindingPatternTarget = findVariableDeclarationInitializerTarget(sourceFile, token, checker)+ if (bindingPatternTarget && isExpressionTarget(bindingPatternTarget) && !isAlreadyNonNull(bindingPatternTarget.expression))+ return bindingPatternTarget++ const accessTarget = findUndefinedAccessTarget(token, checker)+ if (accessTarget && isExpressionTarget(accessTarget) && !isAlreadyNonNull(accessTarget.expression))+ return accessTarget++ const propertyAccessTarget = findPropertyAccessExpressionTarget(token, start)+ if (propertyAccessTarget && isExpressionTarget(propertyAccessTarget) && !isAlreadyNonNull(propertyAccessTarget.expression))+ return propertyAccessTarget++ return undefined+}++function findDiagnosticCandidate(+ sourceFile: ts.SourceFile,+ token: ts.Node,+ start: number,+ end: number,+ diagnosticCode: number,+ checker: ts.TypeChecker,+): ts.Expression | undefined {+ if (diagnosticCode === 2322) {+ const directExpression = findTightestExpression(sourceFile, start, end)+ if (directExpression && typeIncludesUndefined(checker.getTypeAtLocation(directExpression)))+ return directExpression++ return findAssignmentLikeCandidate(token, sourceFile, start, end)+ }++ if (diagnosticCode === 2345)+ return findArgumentCandidate(token, sourceFile, start, end)++ if (diagnosticCode === 2722) {+ const current = findTightestExpression(sourceFile, start, end)+ if (current && ts.isCallExpression(current))+ return current.expression++ return findTightestExpression(sourceFile, start, end)+ }++ return findTightestExpression(sourceFile, start, end)+}++function resolveEditTarget(+ sourceFile: ts.SourceFile,+ diagnostic: ts.DiagnosticWithLocation,+ checker: ts.TypeChecker,+): EditTarget | undefined {+ const start = diagnostic.start+ const end = diagnostic.start + diagnostic.length+ const token = getTokenAtPosition(sourceFile, start)++ const shorthandTarget = findShorthandPropertyTarget(token, checker)+ if (shorthandTarget)+ return shorthandTarget++ const propertyAssignmentTarget = findPropertyAssignmentInitializerTarget(token, start, checker)+ if (propertyAssignmentTarget)+ return propertyAssignmentTarget++ const jsxSpreadTarget = findJsxSpreadAttributeTarget(token, checker)+ if (jsxSpreadTarget && isExpressionTarget(jsxSpreadTarget) && !isAlreadyNonNull(jsxSpreadTarget.expression))+ return jsxSpreadTarget++ const jsxAttribute = findAncestor(token, ts.isJsxAttribute)+ const jsxExpression = jsxAttribute ? getExpressionFromJsxAttribute(jsxAttribute) : undefined++ if (+ ASSIGNABILITY_DIAGNOSTIC_CODES.has(diagnostic.code)+ && jsxExpression+ && typeIncludesUndefined(checker.getTypeAtLocation(jsxExpression))+ && !isAlreadyNonNull(jsxExpression)+ ) {+ return findTargetFromExpression(jsxExpression, checker)+ ?? createExpressionTarget(jsxExpression)+ }++ if (ACCESS_DIAGNOSTIC_CODES.has(diagnostic.code))+ return findAccessDiagnosticTarget(sourceFile, token, start, end, checker)++ if (diagnostic.code === 2322 || diagnostic.code === 2488) {+ const arrayDestructuringTarget = findArrayDestructuringTarget(token, checker)+ if (arrayDestructuringTarget)+ return arrayDestructuringTarget+ }++ if (diagnostic.code === 2538) {+ const elementAccessTarget = findElementAccessArgumentTarget(token)+ if (elementAccessTarget && isExpressionTarget(elementAccessTarget) && !isAlreadyNonNull(elementAccessTarget.expression))+ return elementAccessTarget+ }++ if (diagnostic.code === 7006)+ return findImplicitAnyParameterTarget(token)++ if (diagnostic.code === 2488) {+ const iterableTarget = findIterableTarget(sourceFile, token, start, end, checker)+ if (iterableTarget && (!isExpressionTarget(iterableTarget) || !isAlreadyNonNull(iterableTarget.expression)))+ return iterableTarget+ }++ if (diagnostic.code === 2604 || diagnostic.code === 2786) {+ const jsxComponentTarget = findJsxComponentDeclarationTarget(token, checker)+ if (jsxComponentTarget && isExpressionTarget(jsxComponentTarget) && !isAlreadyNonNull(jsxComponentTarget.expression))+ return jsxComponentTarget+ }++ const candidate = findDiagnosticCandidate(sourceFile, token, start, end, diagnostic.code, checker)++ if (!candidate) {+ return jsxExpression && !isAlreadyNonNull(jsxExpression)+ ? createExpressionTarget(jsxExpression)+ : undefined+ }++ if (ASSIGNABILITY_DIAGNOSTIC_CODES.has(diagnostic.code)) {+ if (+ diagnostic.code === 2345+ && typeIncludesUndefined(checker.getTypeAtLocation(candidate))+ && !isAlreadyNonNull(candidate)+ && (+ ts.isIdentifier(candidate)+ || ts.isElementAccessExpression(candidate)+ || ts.isPropertyAccessExpression(candidate)+ )+ ) {+ return createExpressionTarget(candidate)+ }++ const referencedDeclarationTarget = findReferencedDeclarationInitializerTarget(candidate, checker)+ if (referencedDeclarationTarget && isExpressionTarget(referencedDeclarationTarget) && !isAlreadyNonNull(referencedDeclarationTarget.expression))+ return referencedDeclarationTarget++ const collectionCallbackTarget = findCollectionCallbackTarget(candidate, checker)+ if (collectionCallbackTarget && isExpressionTarget(collectionCallbackTarget) && !isAlreadyNonNull(collectionCallbackTarget.expression))+ return collectionCallbackTarget+ }++ const targetFromCandidate = findTargetFromExpression(candidate, checker)+ if (targetFromCandidate && (!isExpressionTarget(targetFromCandidate) || !isAlreadyNonNull(targetFromCandidate.expression)))+ return targetFromCandidate++ if (ASSIGNABILITY_DIAGNOSTIC_CODES.has(diagnostic.code) && (ts.isArrowFunction(candidate) || ts.isFunctionExpression(candidate))) {+ const functionTarget = findFunctionLikeReturnTarget(candidate, checker)+ if (functionTarget && isExpressionTarget(functionTarget) && !isAlreadyNonNull(functionTarget.expression))+ return functionTarget+ }++ const nestedContainerTarget = findNestedContainerTarget(candidate, checker)+ if (nestedContainerTarget)+ return nestedContainerTarget++ if (isAlreadyNonNull(candidate))+ return undefined++ if (ASSIGNABILITY_DIAGNOSTIC_CODES.has(diagnostic.code) && ts.isObjectLiteralExpression(candidate)) {+ const objectLiteralTarget = findObjectLiteralPropertyTarget(candidate, checker)+ if (objectLiteralTarget)+ return objectLiteralTarget+ }++ if (diagnostic.code === 2322) {+ const declarationInitializerTarget = findVariableDeclarationInitializerTarget(sourceFile, token, checker)+ if (declarationInitializerTarget && isExpressionTarget(declarationInitializerTarget) && !isAlreadyNonNull(declarationInitializerTarget.expression))+ return declarationInitializerTarget+ }++ if (ASSIGNABILITY_DIAGNOSTIC_CODES.has(diagnostic.code) && !typeIncludesUndefined(checker.getTypeAtLocation(candidate)))+ return undefined++ return createExpressionTarget(candidate)+}++function createEditForTarget(+ target: EditTarget,+ printer: ts.Printer,+): TextEdit {+ const sourceFile = target.sourceFile++ if (target.kind === 'direct-edit') {+ return {+ end: target.end,+ expectedText: sourceFile.text.slice(target.start, target.end),+ replacement: target.replacement,+ start: target.start,+ }+ }++ if (target.kind === 'shorthand-property') {+ const name = target.property.name+ const nonNullName = printer.printNode(+ ts.EmitHint.Expression,+ ts.factory.createNonNullExpression(name),+ sourceFile,+ )+ return {+ end: target.property.getEnd(),+ expectedText: sourceFile.text.slice(target.property.getStart(sourceFile), target.property.getEnd()),+ replacement: `${name.getText(sourceFile)}: ${nonNullName}`,+ start: target.property.getStart(sourceFile),+ }+ }++ const replacement = shouldPrintInlineNonNullAssertion(target.expression)+ ? `${target.expression.getText(sourceFile)}!`+ : printer.printNode(+ ts.EmitHint.Expression,+ ts.factory.createNonNullExpression(target.expression),+ sourceFile,+ )++ return {+ end: target.expression.getEnd(),+ expectedText: sourceFile.text.slice(target.expression.getStart(sourceFile), target.expression.getEnd()),+ replacement,+ start: target.expression.getStart(sourceFile),+ }+}++function hasOverlap(existingEdits: TextEdit[], nextEdit: TextEdit): boolean {+ return existingEdits.some(edit => nextEdit.start < edit.end && edit.start < nextEdit.end)+}++function applyEdits(text: string, edits: TextEdit[]): { appliedEditCount: number, text: string } {+ let currentText = text+ let appliedEditCount = 0++ for (const edit of edits.sort((left, right) => right.start - left.start)) {+ if (edit.replacement.length > currentText.length * 4)+ continue++ try {+ currentText = `${currentText.slice(0, edit.start)}${edit.replacement}${currentText.slice(edit.end)}`+ appliedEditCount += 1+ }+ catch {+ continue+ }+ }++ return {+ appliedEditCount,+ text: currentText,+ }+}++function isValidEditRange(text: string, edit: TextEdit): boolean {+ return Number.isInteger(edit.start)+ && Number.isInteger(edit.end)+ && edit.start >= 0+ && edit.end >= edit.start+ && edit.end <= text.length+}++function filterApplicableEdits(text: string, edits: TextEdit[]): TextEdit[] {+ return edits.filter(edit => isValidEditRange(text, edit) && (!edit.expectedText || text.slice(edit.start, edit.end) === edit.expectedText))+}++export async function runMigration(options: CliOptions) {+ const projectPath = path.resolve(process.cwd(), options.project)+ const parsedConfig = parseTsConfig(projectPath)+ const matchesRequestedFile = createFileMatcher(options.files)+ const targetFiles = parsedConfig.fileNames+ .map(normalizeFileName)+ .filter(isTargetFile)+ .filter(matchesRequestedFile)++ if (targetFiles.length === 0) {+ console.error('No matching TypeScript source files found.')+ process.exitCode = 1+ return { converged: false, totalEdits: 0 }+ }++ const fileTexts = new Map<string, string>()+ const printer = ts.createPrinter()+ const migrationRootNames = options.useFullProjectRoots+ ? parsedConfig.fileNames.map(normalizeFileName)+ : getMigrationRootNames(parsedConfig, targetFiles)++ let totalEdits = 0+ let converged = false+ let previousProgram: ts.Program | undefined++ for (let iteration = 1; iteration <= options.maxIterations; iteration += 1) {+ const program = createMigrationProgram(migrationRootNames, parsedConfig, fileTexts, previousProgram)+ const checker = program.getTypeChecker()+ const editsByFile = new Map<string, TextEdit[]>()++ for (const fileName of targetFiles) {+ const sourceFile = program.getSourceFile(fileName)+ if (!sourceFile)+ continue++ const diagnostics = program+ .getSemanticDiagnostics(sourceFile)+ .filter((diagnostic): diagnostic is ts.DiagnosticWithLocation => {+ return diagnostic.file !== undefined+ && diagnostic.start !== undefined+ && diagnostic.length !== undefined+ && SUPPORTED_DIAGNOSTIC_CODES.has(diagnostic.code)+ })++ if (options.verbose && diagnostics.length > 0)+ console.log(`file ${path.relative(process.cwd(), fileName)}: ${diagnostics.length} supported diagnostic(s)`)++ for (const diagnostic of diagnostics) {+ const target = resolveEditTarget(sourceFile, diagnostic, checker)+ if (!target) {+ if (options.verbose)+ console.log(`unresolved ${formatDiagnostic(diagnostic)}`)+ continue+ }++ const editFileName = target.sourceFile.fileName+ const edit = createEditForTarget(target, printer)+ const existing = editsByFile.get(editFileName) ?? []+ if (hasOverlap(existing, edit))+ continue++ existing.push(edit)+ editsByFile.set(editFileName, existing)++ if (options.verbose) {+ const position = target.sourceFile.getLineAndCharacterOfPosition(edit.start)+ console.log(`iter ${iteration}: ${path.relative(process.cwd(), editFileName)}:${position.line + 1}:${position.character + 1} -> add !`)+ }+ }+ }++ if (editsByFile.size === 0) {+ console.log(`No more supported diagnostics after ${iteration - 1} iteration(s).`)+ converged = true+ break+ }++ let iterationEditCount = 0++ for (const [fileName, edits] of editsByFile) {+ const currentText = fileTexts.get(fileName) ?? await fs.readFile(fileName, 'utf8')+ const applicableEdits = filterApplicableEdits(currentText, edits)+ if (applicableEdits.length === 0)+ continue++ const { appliedEditCount, text: editedText } = applyEdits(currentText, applicableEdits)+ if (appliedEditCount === 0)+ continue++ const nextText = normalizeMalformedAssertions(editedText)+ if (nextText === currentText) {+ if (options.verbose) {+ const firstEdit = applicableEdits[0]+ console.log(`iter ${iteration}: no-op after normalization for ${path.relative(process.cwd(), fileName)}:${firstEdit?.start ?? 0} ${JSON.stringify(firstEdit ? currentText.slice(firstEdit.start, firstEdit.end) : '')} -> ${JSON.stringify(firstEdit?.replacement ?? '')}`)+ }+ continue+ }++ fileTexts.set(fileName, nextText)+ iterationEditCount += appliedEditCount+ }++ totalEdits += iterationEditCount+ console.log(`Iteration ${iteration}: ${iterationEditCount} edit(s) across ${editsByFile.size} file(s).`)+ previousProgram = program+ }++ if (totalEdits === 0) {+ console.log('No supported noUncheckedIndexedAccess-style diagnostics were migrated.')+ return { converged, totalEdits }+ }++ if (!options.write) {+ if (!converged)+ console.log(`Stopped after reaching --max-iterations=${options.maxIterations}.`)++ console.log(`Dry run complete. ${totalEdits} edit(s) are ready. Re-run with --write to apply them.`)+ return { converged, totalEdits }+ }++ const changedFiles = Array.from(fileTexts.entries())+ await Promise.all(changedFiles.map(async ([fileName, text]) => {+ await fs.writeFile(fileName, text)+ }))++ if (!converged)+ console.log(`Stopped after reaching --max-iterations=${options.maxIterations}.`)++ console.log(`Wrote ${totalEdits} edit(s) to ${changedFiles.length} file(s).`)+ return { converged, totalEdits }+}++export async function runMigrationCommand(argv: string[]) {+ await runMigration(parseArgs(argv))+}diff --git a/packages/migrate-no-unchecked-indexed-access/src/no-unchecked-indexed-access/normalize.ts b/packages/migrate-no-unchecked-indexed-access/src/no-unchecked-indexed-access/normalize.tsnew file mode 100644index 00000000000..d3b88736fcb--- /dev/null+++ b/packages/migrate-no-unchecked-indexed-access/src/no-unchecked-indexed-access/normalize.ts@@ -0,0 +1,51 @@+import fs from 'node:fs/promises'+import path from 'node:path'+import process from 'node:process'+import { normalizeMalformedAssertions } from './migrate'++const ROOT = process.cwd()+const EXTENSIONS = new Set(['.ts', '.tsx'])++async function collectFiles(directory: string): Promise<string[]> {+ const entries = await fs.readdir(directory, { withFileTypes: true })+ const files: string[] = []++ for (const entry of entries) {+ if (entry.name === 'node_modules' || entry.name === '.next')+ continue++ const absolutePath = path.join(directory, entry.name)+ if (entry.isDirectory()) {+ files.push(...await collectFiles(absolutePath))+ continue+ }++ if (!EXTENSIONS.has(path.extname(entry.name)))+ continue++ files.push(absolutePath)+ }++ return files+}++async function main() {+ const files = await collectFiles(ROOT)+ let changedFileCount = 0++ await Promise.all(files.map(async (fileName) => {+ const currentText = await fs.readFile(fileName, 'utf8')+ const nextText = normalizeMalformedAssertions(currentText)+ if (nextText === currentText)+ return++ await fs.writeFile(fileName, nextText)+ changedFileCount += 1+ }))++ console.log(`Normalized malformed assertion syntax in ${changedFileCount} file(s).`)+}++export async function runNormalizeCommand(_argv: string[]) {+ await main()+}diff --git a/packages/migrate-no-unchecked-indexed-access/src/no-unchecked-indexed-access/run.ts b/packages/migrate-no-unchecked-indexed-access/src/no-unchecked-indexed-access/run.tsnew file mode 100644index 00000000000..ad655e4f114--- /dev/null+++ b/packages/migrate-no-unchecked-indexed-access/src/no-unchecked-indexed-access/run.ts@@ -0,0 +1,325 @@+import { execFile } from 'node:child_process'+import { createHash } from 'node:crypto'+import fs from 'node:fs/promises'+import os from 'node:os'+import path from 'node:path'+import process from 'node:process'+import { promisify } from 'node:util'+import { runMigration, SUPPORTED_DIAGNOSTIC_CODES } from './migrate'++const execFileAsync = promisify(execFile)+const DIAGNOSTIC_PATTERN = /^(.+?\.(?:ts|tsx))\((\d+),(\d+)\): error TS(\d+): (.+)$/+const DEFAULT_BATCH_SIZE = 100+const DEFAULT_BATCH_ITERATIONS = 5+const DEFAULT_MAX_ROUNDS = 20+const TYPECHECK_CACHE_DIR = path.join(os.tmpdir(), 'migrate-no-unchecked-indexed-access')++type CliOptions = {+ batchIterations: number+ batchSize: number+ maxRounds: number+ project: string+ verbose: boolean+}++type DiagnosticEntry = {+ code: number+ fileName: string+ line: number+ message: string+}++function parseArgs(argv: string[]): CliOptions {+ const options: CliOptions = {+ batchIterations: DEFAULT_BATCH_ITERATIONS,+ batchSize: DEFAULT_BATCH_SIZE,+ maxRounds: DEFAULT_MAX_ROUNDS,+ project: 'tsconfig.json',+ verbose: false,+ }++ for (let i = 0; i < argv.length; i += 1) {+ const arg = argv[i]++ if (arg === '--')+ continue++ if (arg === '--verbose') {+ options.verbose = true+ continue+ }++ if (arg === '--project') {+ const value = argv[i + 1]+ if (!value)+ throw new Error('Missing value for --project')++ options.project = value+ i += 1+ continue+ }++ if (arg === '--batch-size') {+ const value = Number(argv[i + 1])+ if (!Number.isInteger(value) || value <= 0)+ throw new Error('Invalid value for --batch-size')++ options.batchSize = value+ i += 1+ continue+ }++ if (arg === '--batch-iterations') {+ const value = Number(argv[i + 1])+ if (!Number.isInteger(value) || value <= 0)+ throw new Error('Invalid value for --batch-iterations')++ options.batchIterations = value+ i += 1+ continue+ }++ if (arg === '--max-rounds') {+ const value = Number(argv[i + 1])+ if (!Number.isInteger(value) || value <= 0)+ throw new Error('Invalid value for --max-rounds')++ options.maxRounds = value+ i += 1+ continue+ }++ throw new Error(`Unknown option: ${arg}`)+ }++ return options+}++function getTypeCheckBuildInfoPath(projectPath: string): string {+ const hash = createHash('sha1')+ .update(projectPath)+ .digest('hex')+ .slice(0, 16)++ return path.join(TYPECHECK_CACHE_DIR, `${hash}.tsbuildinfo`)+}++async function runTypeCheck(+ project: string,+ options?: {+ incremental?: boolean+ },+): Promise<{ diagnostics: DiagnosticEntry[], exitCode: number, rawOutput: string }> {+ const projectPath = path.resolve(process.cwd(), project)+ const projectDirectory = path.dirname(projectPath)+ const buildInfoPath = getTypeCheckBuildInfoPath(projectPath)+ const incremental = options?.incremental ?? true++ await fs.mkdir(TYPECHECK_CACHE_DIR, { recursive: true })++ const tscArgs = ['exec', 'tsc', '--noEmit', '--pretty', 'false']+ if (incremental) {+ tscArgs.push('--incremental', '--tsBuildInfoFile', buildInfoPath)+ }+ else {+ tscArgs.push('--incremental', 'false')+ }+ tscArgs.push('--project', projectPath)++ try {+ const { stdout, stderr } = await execFileAsync('pnpm', tscArgs, {+ cwd: projectDirectory,+ env: {+ ...process.env,+ NODE_OPTIONS: process.env.NODE_OPTIONS ?? '--max-old-space-size=8192',+ },+ maxBuffer: 1024 * 1024 * 32,+ })++ const rawOutput = `${stdout}${stderr}`.trim()+ return {+ diagnostics: parseDiagnostics(rawOutput, projectDirectory),+ exitCode: 0,+ rawOutput,+ }+ }+ catch (error) {+ const exitCode = typeof error === 'object' && error && 'code' in error && typeof error.code === 'number'+ ? error.code+ : 1+ const stdout = typeof error === 'object' && error && 'stdout' in error && typeof error.stdout === 'string'+ ? error.stdout+ : ''+ const stderr = typeof error === 'object' && error && 'stderr' in error && typeof error.stderr === 'string'+ ? error.stderr+ : ''+ const rawOutput = `${stdout}${stderr}`.trim()++ return {+ diagnostics: parseDiagnostics(rawOutput, projectDirectory),+ exitCode,+ rawOutput,+ }+ }+}++function parseDiagnostics(rawOutput: string, projectDirectory: string): DiagnosticEntry[] {+ return rawOutput+ .split('\n')+ .map(line => line.trim())+ .flatMap((line) => {+ const match = line.match(DIAGNOSTIC_PATTERN)+ if (!match)+ return []++ return [{+ code: Number(match[4]),+ fileName: path.resolve(projectDirectory, match[1]!),+ line: Number(match[2]),+ message: match[5] ?? '',+ }]+ })+}++function summarizeCodes(diagnostics: DiagnosticEntry[]): string {+ const counts = new Map<number, number>()+ for (const diagnostic of diagnostics)+ counts.set(diagnostic.code, (counts.get(diagnostic.code) ?? 0) + 1)++ return Array.from(counts.entries())+ .sort((left, right) => right[1] - left[1])+ .slice(0, 8)+ .map(([code, count]) => `TS${code}:${count}`)+ .join(', ')+}++function chunk<T>(items: T[], size: number): T[][] {+ const batches: T[][] = []+ for (let i = 0; i < items.length; i += size)+ batches.push(items.slice(i, i + size))++ return batches+}++async function runBatchMigration(options: CliOptions) {+ for (let round = 1; round <= options.maxRounds; round += 1) {+ const { diagnostics, exitCode, rawOutput } = await runTypeCheck(options.project)+ if (exitCode === 0) {+ const finalCheck = await runTypeCheck(options.project, { incremental: false })+ if (finalCheck.exitCode !== 0) {+ const finalDiagnostics = finalCheck.diagnostics+ console.log(`Final cold type check found ${finalDiagnostics.length} diagnostic(s). ${summarizeCodes(finalDiagnostics)}`)++ if (options.verbose) {+ for (const diagnostic of finalDiagnostics.slice(0, 40))+ console.log(`${path.relative(process.cwd(), diagnostic.fileName)}:${diagnostic.line} TS${diagnostic.code} ${diagnostic.message}`)+ }++ const finalSupportedFiles = Array.from(new Set(+ finalDiagnostics+ .filter(diagnostic => SUPPORTED_DIAGNOSTIC_CODES.has(diagnostic.code))+ .map(diagnostic => diagnostic.fileName),+ ))++ if (finalSupportedFiles.length > 0) {+ console.log(` Final pass batch: ${finalSupportedFiles.length} file(s)`)+ let finalResult = await runMigration({+ files: finalSupportedFiles,+ maxIterations: options.batchIterations,+ project: options.project,+ verbose: options.verbose,+ write: true,+ })++ if (finalResult.totalEdits === 0) {+ console.log(' No edits produced; retrying final pass with full project roots.')+ finalResult = await runMigration({+ files: finalSupportedFiles,+ maxIterations: options.batchIterations,+ project: options.project,+ useFullProjectRoots: true,+ verbose: options.verbose,+ write: true,+ })+ }++ if (finalResult.totalEdits > 0)+ continue+ }++ if (finalCheck.rawOutput)+ process.stderr.write(`${finalCheck.rawOutput}\n`)+ process.exitCode = 1+ return+ }++ console.log(`Type check passed after ${round - 1} migration round(s).`)+ return+ }++ const supportedDiagnostics = diagnostics.filter(diagnostic => SUPPORTED_DIAGNOSTIC_CODES.has(diagnostic.code))+ const unsupportedDiagnostics = diagnostics.filter(diagnostic => !SUPPORTED_DIAGNOSTIC_CODES.has(diagnostic.code))+ const supportedFiles = Array.from(new Set(supportedDiagnostics.map(diagnostic => diagnostic.fileName)))++ console.log(`Round ${round}: ${diagnostics.length} diagnostic(s). ${summarizeCodes(diagnostics)}`)++ if (options.verbose) {+ for (const diagnostic of diagnostics.slice(0, 40))+ console.log(`${path.relative(process.cwd(), diagnostic.fileName)}:${diagnostic.line} TS${diagnostic.code} ${diagnostic.message}`)+ }++ if (supportedFiles.length === 0) {+ console.error('No supported diagnostics remain to migrate.')+ if (unsupportedDiagnostics.length > 0) {+ console.error('Remaining unsupported diagnostics:')+ for (const diagnostic of unsupportedDiagnostics.slice(0, 40))+ console.error(`${path.relative(process.cwd(), diagnostic.fileName)}:${diagnostic.line} TS${diagnostic.code} ${diagnostic.message}`)+ }+ if (rawOutput)+ process.stderr.write(`${rawOutput}\n`)+ process.exitCode = 1+ return+ }++ let roundEdits = 0+ const batches = chunk(supportedFiles, options.batchSize)++ for (const [index, batch] of batches.entries()) {+ console.log(` Batch ${index + 1}/${batches.length}: ${batch.length} file(s)`)+ let result = await runMigration({+ files: batch,+ maxIterations: options.batchIterations,+ project: options.project,+ verbose: options.verbose,+ write: true,+ })++ if (result.totalEdits === 0) {+ console.log(' No edits produced; retrying batch with full project roots.')+ result = await runMigration({+ files: batch,+ maxIterations: options.batchIterations,+ project: options.project,+ useFullProjectRoots: true,+ verbose: options.verbose,+ write: true,+ })+ }++ roundEdits += result.totalEdits+ }++ if (roundEdits === 0) {+ console.error('Migration script made no edits in this round; stopping to avoid an infinite loop.')+ process.exitCode = 1+ return+ }+ }++ console.error(`Reached --max-rounds=${options.maxRounds} before type check passed.`)+ process.exitCode = 1+}++export async function runBatchMigrationCommand(argv: string[]) {+ await runBatchMigration(parseArgs(argv))+}diff --git a/packages/migrate-no-unchecked-indexed-access/vite.config.ts b/packages/migrate-no-unchecked-indexed-access/vite.config.tsnew file mode 100644index 00000000000..ac4aed1a064--- /dev/null+++ b/packages/migrate-no-unchecked-indexed-access/vite.config.ts@@ -0,0 +1,17 @@+import { defineConfig } from 'vite-plus'++export default defineConfig({+ pack: {+ clean: true,+ deps: {+ neverBundle: ['typescript'],+ },+ entry: ['src/cli.ts'],+ format: ['esm'],+ outDir: 'dist',+ platform: 'node',+ sourcemap: true,+ target: 'node22',+ treeshake: true,+ },+})diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex d37f6b7977b..cdf5001e2d7 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -624,6 +624,22 @@ importers:specifier: 'catalog:'version: 0.1.2+ packages/migrate-no-unchecked-indexed-access:+ dependencies:+ typescript:+ specifier: 'catalog:'+ version: 6.0.2+ devDependencies:+ '@types/node':+ specifier: 'catalog:'+ version: 25.6.0+ vite:+ specifier: npm:@voidzero-dev/[email protected]+ version: '@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])'+ vite-plus:+ specifier: 'catalog:'+ version: 0.1.18(@types/[email protected])(@vitest/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])+sdks/nodejs-client:devDependencies:'@eslint/js':diff --git a/web/__tests__/datasets/dataset-settings-flow.test.tsx b/web/__tests__/datasets/dataset-settings-flow.test.tsxindex b4a5e783264..7c53401b158 100644--- a/web/__tests__/datasets/dataset-settings-flow.test.tsx+++ b/web/__tests__/datasets/dataset-settings-flow.test.tsx@@ -311,7 +311,7 @@ describe('Dataset Settings Flow - Cross-Module Configuration Cascade', () => {await result.current.handleSave()})- const savedBody = mockUpdateDatasetSetting.mock.calls[0][0].body as Record<string, unknown>+ const savedBody = mockUpdateDatasetSetting.mock.calls[0]![0].body as Record<string, unknown>expect(savedBody).not.toHaveProperty('partial_member_list')})})diff --git a/web/__tests__/datasets/document-management.test.tsx b/web/__tests__/datasets/document-management.test.tsxindex f9d80520ed1..96937332a3e 100644--- a/web/__tests__/datasets/document-management.test.tsx+++ b/web/__tests__/datasets/document-management.test.tsx@@ -109,7 +109,7 @@ describe('Document Management Flow', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.options.history).toBe('replace')expect(update.searchParams.get('keyword')).toBe('test')expect(update.searchParams.get('page')).toBe('2')@@ -123,7 +123,7 @@ describe('Document Management Flow', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.options.history).toBe('replace')expect(update.searchParams.toString()).toBe('')})diff --git a/web/__tests__/datasets/hit-testing-flow.test.tsx b/web/__tests__/datasets/hit-testing-flow.test.tsxindex 93d6f77d8f4..54f85c5200f 100644--- a/web/__tests__/datasets/hit-testing-flow.test.tsx+++ b/web/__tests__/datasets/hit-testing-flow.test.tsx@@ -282,7 +282,7 @@ describe('Hit Testing Flow', () => {const response = createHitTestingResponse(5)for (let i = 1; i < response.records.length; i++) {- expect(response.records[i - 1].score).toBeGreaterThanOrEqual(response.records[i].score)+ expect(response.records[i - 1]!.score).toBeGreaterThanOrEqual(response.records[i]!.score)}})@@ -290,8 +290,8 @@ describe('Hit Testing Flow', () => {const response = createHitTestingResponse(1)const record = response.records[0]- expect(record.segment.document.name).toBeTruthy()- expect(record.segment.document.data_source_type).toBeTruthy()+ expect(record!.segment.document.name).toBeTruthy()+ expect(record!.segment.document.data_source_type).toBeTruthy()})})diff --git a/web/__tests__/datasets/pipeline-datasource-flow.test.tsx b/web/__tests__/datasets/pipeline-datasource-flow.test.tsxindex dc140e85142..d005fda5581 100644--- a/web/__tests__/datasets/pipeline-datasource-flow.test.tsx+++ b/web/__tests__/datasets/pipeline-datasource-flow.test.tsx@@ -113,8 +113,8 @@ describe('Pipeline Data Source Store Composition - Cross-Slice Integration', ()store.getState().setLocalFileList(files)expect(store.getState().localFileList).toHaveLength(3)- expect(store.getState().localFileList[0].fileID).toBe('f1')- expect(store.getState().localFileList[2].fileID).toBe('f3')+ expect(store.getState().localFileList[0]!.fileID).toBe('f1')+ expect(store.getState().localFileList[2]!.fileID).toBe('f3')})it('should update preview ref when setting file list', () => {@@ -157,7 +157,7 @@ describe('Pipeline Data Source Store Composition - Cross-Slice Integration', ()store.getState().setOnlineDocuments(pages)expect(store.getState().onlineDocuments).toHaveLength(2)- expect(store.getState().onlineDocuments[0].page_id).toBe('page-1')+ expect(store.getState().onlineDocuments[0]!.page_id).toBe('page-1')})it('should update preview ref when setting online documents', () => {@@ -391,7 +391,7 @@ describe('Pipeline Data Source Store Composition - Cross-Slice Integration', ()store.getState().setLocalFileList(files)// Step 3: Select current file for preview- store.getState().setCurrentLocalFile(files[0].file)+ store.getState().setCurrentLocalFile(files[0]!.file)// Verify all state is consistentexpect(store.getState().currentCredentialId).toBe('upload-cred-1')diff --git a/web/__tests__/datasets/segment-crud.test.tsx b/web/__tests__/datasets/segment-crud.test.tsxindex 9190e173957..fe21dd50798 100644--- a/web/__tests__/datasets/segment-crud.test.tsx+++ b/web/__tests__/datasets/segment-crud.test.tsx@@ -289,7 +289,7 @@ describe('Segment CRUD Flow', () => {// Open detail modalact(() => {- modalResult.current.onClickCard(segments[0])+ modalResult.current.onClickCard(segments[0]!)})// All states should be independentdiff --git a/web/__tests__/document-detail-navigation-fix.test.tsx b/web/__tests__/document-detail-navigation-fix.test.tsxindex 5cb115830e0..c5641d2adfd 100644--- a/web/__tests__/document-detail-navigation-fix.test.tsx+++ b/web/__tests__/document-detail-navigation-fix.test.tsx@@ -146,7 +146,7 @@ describe('Document Detail Navigation Fix Verification', () => {fireEvent.click(screen.getByTestId('back-button-fixed'))// URLSearchParams will normalize the encoding, but preserve all parameters- const expectedCall = mockPush.mock.calls[0][0]+ const expectedCall = mockPush.mock.calls[0]![0]expect(expectedCall).toMatch(/^\/datasets\/dataset-123\/documents\?/)expect(expectedCall).toMatch(/page=1/)expect(expectedCall).toMatch(/limit=50/)@@ -257,7 +257,7 @@ describe('Document Detail Navigation Fix Verification', () => {// Should still attempt navigation (URLSearchParams will clean up the parameters)expect(mockPush).toHaveBeenCalled()- const navigationPath = mockPush.mock.calls[0][0]+ const navigationPath = mockPush.mock.calls[0]![0]expect(navigationPath).toMatch(/^\/datasets\/dataset-123\/documents/)console.log('✅ Malformed parameters handled gracefully:', navigationPath)diff --git a/web/__tests__/explore/explore-app-list-flow.test.tsx b/web/__tests__/explore/explore-app-list-flow.test.tsxindex 40f2156c066..e2c78310182 100644--- a/web/__tests__/explore/explore-app-list-flow.test.tsx+++ b/web/__tests__/explore/explore-app-list-flow.test.tsx@@ -175,16 +175,16 @@ describe('Explore App List Flow', () => {it('should display all apps when no category filter is applied', () => {renderAppList()- expect(screen.getByText('Writer Bot')).toBeInTheDocument()- expect(screen.getByText('Translator')).toBeInTheDocument()- expect(screen.getByText('Code Helper')).toBeInTheDocument()+ expect(screen.getByText('Writer Bot'))!.toBeInTheDocument()+ expect(screen.getByText('Translator'))!.toBeInTheDocument()+ expect(screen.getByText('Code Helper'))!.toBeInTheDocument()})it('should filter apps by selected category', () => {mockTabValue = 'Writing'renderAppList()- expect(screen.getByText('Writer Bot')).toBeInTheDocument()+ expect(screen.getByText('Writer Bot'))!.toBeInTheDocument()expect(screen.queryByText('Translator')).not.toBeInTheDocument()expect(screen.queryByText('Code Helper')).not.toBeInTheDocument()})@@ -196,7 +196,7 @@ describe('Explore App List Flow', () => {fireEvent.change(input, { target: { value: 'trans' } })await waitFor(() => {- expect(screen.getByText('Translator')).toBeInTheDocument()+ expect(screen.getByText('Translator'))!.toBeInTheDocument()expect(screen.queryByText('Writer Bot')).not.toBeInTheDocument()expect(screen.queryByText('Code Helper')).not.toBeInTheDocument()})@@ -218,7 +218,7 @@ describe('Explore App List Flow', () => {renderAppList(true, onSuccess)// Step 2: Click add to workspace button - opens create modal- fireEvent.click(screen.getAllByText('explore.appCard.addToWorkspace')[0])+ fireEvent.click(screen.getAllByText('explore.appCard.addToWorkspace')[0]!)// Step 3: Confirm creation in modalfireEvent.click(await screen.findByTestId('confirm-create'))@@ -232,7 +232,8 @@ describe('Explore App List Flow', () => {expect(mockHandleImportDSL).toHaveBeenCalledTimes(1)// Step 6: DSL confirm modal appears and user confirms- expect(await screen.findByTestId('dsl-confirm-modal')).toBeInTheDocument()+ // Step 6: DSL confirm modal appears and user confirms+ expect(await screen.findByTestId('dsl-confirm-modal'))!.toBeInTheDocument()fireEvent.click(screen.getByTestId('dsl-confirm'))// Step 7: Flow completes successfully@@ -250,7 +251,7 @@ describe('Explore App List Flow', () => {mockExploreData = undefinedconst { unmount } = render(appListElement())- expect(screen.getByRole('status')).toBeInTheDocument()+ expect(screen.getByRole('status'))!.toBeInTheDocument()// Step 2: Data loadsmockIsLoading = false@@ -262,7 +263,7 @@ describe('Explore App List Flow', () => {renderAppList()expect(screen.queryByRole('status')).not.toBeInTheDocument()- expect(screen.getByText('Alpha')).toBeInTheDocument()+ expect(screen.getByText('Alpha'))!.toBeInTheDocument()})})diff --git a/web/__tests__/goto-anything/slash-command-modes.test.tsx b/web/__tests__/goto-anything/slash-command-modes.test.tsxindex 38c965e3838..bcaddfb27b1 100644--- a/web/__tests__/goto-anything/slash-command-modes.test.tsx+++ b/web/__tests__/goto-anything/slash-command-modes.test.tsx@@ -108,8 +108,8 @@ describe('Slash Command Dual-Mode System', () => {const results = await handler?.search('', 'en')expect(results).toHaveLength(2)- expect(results?.[0].title).toBe('Light Theme')- expect(results?.[1].title).toBe('Dark Theme')+ expect(results?.[0]!.title).toBe('Light Theme')+ expect(results?.[1]!.title).toBe('Dark Theme')})it('should not have execute function for submenu mode', () => {diff --git a/web/__tests__/plugins/plugin-data-utilities.test.ts b/web/__tests__/plugins/plugin-data-utilities.test.tsindex 068b0e3238a..cfec48ca4d8 100644--- a/web/__tests__/plugins/plugin-data-utilities.test.ts+++ b/web/__tests__/plugins/plugin-data-utilities.test.ts@@ -145,15 +145,15 @@ describe('Plugin Data Utilities Integration', () => {validCategory: getValidCategoryKeys(p.category),}))- expect(results[0].validTags.length).toBeGreaterThan(0)- expect(results[0].validCategory).toBe('tool')+ expect(results[0]!.validTags.length).toBeGreaterThan(0)+ expect(results[0]!.validCategory).toBe('tool')- expect(results[1].validTags).toContain('image')- expect(results[1].validTags).toContain('design')- expect(results[1].validCategory).toBe('model')+ expect(results[1]!.validTags).toContain('image')+ expect(results[1]!.validTags).toContain('design')+ expect(results[1]!.validCategory).toBe('model')- expect(results[2].validTags).toHaveLength(0)- expect(results[2].validCategory).toBe('extension')+ expect(results[2]!.validTags).toHaveLength(0)+ expect(results[2]!.validCategory).toBe('extension')})})})diff --git a/web/__tests__/plugins/plugin-page-shell-flow.test.tsx b/web/__tests__/plugins/plugin-page-shell-flow.test.tsxindex 5895a20eef1..9202f647af5 100644--- a/web/__tests__/plugins/plugin-page-shell-flow.test.tsx+++ b/web/__tests__/plugins/plugin-page-shell-flow.test.tsx@@ -132,16 +132,16 @@ describe('Plugin Page Shell Flow', () => {it('switches from installed plugins to marketplace and syncs the active tab into the URL', async () => {const { onUrlUpdate } = renderPluginPage()- expect(screen.getByTestId('plugins-view')).toBeInTheDocument()+ expect(screen.getByTestId('plugins-view'))!.toBeInTheDocument()expect(screen.queryByTestId('marketplace-view')).not.toBeInTheDocument()fireEvent.click(screen.getByTestId('tab-item-discover'))await waitFor(() => {- expect(screen.getByTestId('marketplace-view')).toBeInTheDocument()+ expect(screen.getByTestId('marketplace-view'))!.toBeInTheDocument()})- const tabUpdate = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const tabUpdate = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(tabUpdate.searchParams.get('tab')).toBe('discover')})@@ -150,13 +150,13 @@ describe('Plugin Page Shell Flow', () => {await waitFor(() => {expect(mockFetchManifestFromMarketPlace).toHaveBeenCalledWith('langgenius%2Fplugin-demo')- expect(screen.getByTestId('install-from-marketplace-modal')).toBeInTheDocument()+ expect(screen.getByTestId('install-from-marketplace-modal'))!.toBeInTheDocument()})fireEvent.click(screen.getByRole('button', { name: 'close-install-modal' }))await waitFor(() => {- const clearUpdate = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const clearUpdate = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(clearUpdate.searchParams.has('package-ids')).toBe(false)})})diff --git a/web/__tests__/rag-pipeline/chunk-preview-formatting.test.ts b/web/__tests__/rag-pipeline/chunk-preview-formatting.test.tsindex c4cafbc1c5e..6c8dfb982f6 100644--- a/web/__tests__/rag-pipeline/chunk-preview-formatting.test.ts+++ b/web/__tests__/rag-pipeline/chunk-preview-formatting.test.ts@@ -38,9 +38,9 @@ describe('Chunk Preview Formatting', () => {expect(Array.isArray(result)).toBe(true)const chunks = result as Array<{ content: string, summary?: string }>expect(chunks).toHaveLength(2)- expect(chunks[0].content).toBe('Chunk 1 content')- expect(chunks[0].summary).toBe('Summary 1')- expect(chunks[1].content).toBe('Chunk 2 content')+ expect(chunks[0]!.content).toBe('Chunk 1 content')+ expect(chunks[0]!.summary).toBe('Summary 1')+ expect(chunks[1]!.content).toBe('Chunk 2 content')})it('should limit chunks to RAG_PIPELINE_PREVIEW_CHUNK_NUM', () => {@@ -84,9 +84,9 @@ describe('Chunk Preview Formatting', () => {expect(result.parent_mode).toBe('paragraph')expect(result.parent_child_chunks).toHaveLength(1)- expect(result.parent_child_chunks[0].parent_content).toBe('Parent paragraph')- expect(result.parent_child_chunks[0].parent_summary).toBe('Parent summary')- expect(result.parent_child_chunks[0].child_contents).toEqual(['Child 1', 'Child 2'])+ expect(result.parent_child_chunks[0]!.parent_content).toBe('Parent paragraph')+ expect(result.parent_child_chunks[0]!.parent_summary).toBe('Parent summary')+ expect(result.parent_child_chunks[0]!.child_contents).toEqual(['Child 1', 'Child 2'])})it('should limit parent chunks in paragraph mode', () => {@@ -129,8 +129,8 @@ describe('Chunk Preview Formatting', () => {}expect(result.parent_child_chunks).toHaveLength(1)- expect(result.parent_child_chunks[0].parent_content).toBe('Full document content')- expect(result.parent_child_chunks[0].parent_mode).toBe('full-doc')+ expect(result.parent_child_chunks[0]!.parent_content).toBe('Full document content')+ expect(result.parent_child_chunks[0]!.parent_mode).toBe('full-doc')})it('should limit child chunks in full-doc mode', () => {@@ -149,7 +149,7 @@ describe('Chunk Preview Formatting', () => {parent_child_chunks: Array<{ child_contents: string[] }>}- expect(result.parent_child_chunks[0].child_contents).toHaveLength(3) // Mocked limit+ expect(result.parent_child_chunks[0]!.child_contents).toHaveLength(3) // Mocked limit})})@@ -168,8 +168,8 @@ describe('Chunk Preview Formatting', () => {}expect(result.qa_chunks).toHaveLength(2)- expect(result.qa_chunks[0].question).toBe('What is AI?')- expect(result.qa_chunks[0].answer).toBe('Artificial Intelligence is...')+ expect(result.qa_chunks[0]!.question).toBe('What is AI?')+ expect(result.qa_chunks[0]!.answer).toBe('Artificial Intelligence is...')})it('should limit QA chunks', () => {diff --git a/web/__tests__/rag-pipeline/input-field-crud-flow.test.ts b/web/__tests__/rag-pipeline/input-field-crud-flow.test.tsindex 233c9a288a1..981107fe446 100644--- a/web/__tests__/rag-pipeline/input-field-crud-flow.test.ts+++ b/web/__tests__/rag-pipeline/input-field-crud-flow.test.ts@@ -268,11 +268,11 @@ describe('Input Field CRUD Flow', () => {const restoredFields = formDataList.map(fd => convertFormDataToINputField(fd))expect(restoredFields).toHaveLength(2)- expect(restoredFields[0].variable).toBe('name')- expect(restoredFields[0].default_value).toBe('Alice')- expect(restoredFields[1].variable).toBe('count')- expect(restoredFields[1].default_value).toBe('10')- expect(restoredFields[1].unit).toBe('items')+ expect(restoredFields[0]!.variable).toBe('name')+ expect(restoredFields[0]!.default_value).toBe('Alice')+ expect(restoredFields[1]!.variable).toBe('count')+ expect(restoredFields[1]!.default_value).toBe('10')+ expect(restoredFields[1]!.unit).toBe('items')})})})diff --git a/web/__tests__/rag-pipeline/test-run-flow.test.ts b/web/__tests__/rag-pipeline/test-run-flow.test.tsindex a2bf557acd0..4ed31a5713d 100644--- a/web/__tests__/rag-pipeline/test-run-flow.test.ts+++ b/web/__tests__/rag-pipeline/test-run-flow.test.ts@@ -139,8 +139,8 @@ describe('Test Run Flow Integration', () => {const { result } = renderHook(() => useTestRunSteps())expect(result.current.steps).toHaveLength(2)- expect(result.current.steps[0].value).toBe('dataSource')- expect(result.current.steps[1].value).toBe('documentProcessing')+ expect(result.current.steps[0]!.value).toBe('dataSource')+ expect(result.current.steps[1]!.value).toBe('documentProcessing')})})@@ -153,8 +153,8 @@ describe('Test Run Flow Integration', () => {// Should only include DataSource nodes, not KnowledgeBaseexpect(result.current).toHaveLength(2)- expect(result.current[0].value).toBe('ds-1')- expect(result.current[1].value).toBe('ds-2')+ expect(result.current[0]!.value).toBe('ds-1')+ expect(result.current[1]!.value).toBe('ds-2')})it('should include node data in options', async () => {@@ -163,8 +163,8 @@ describe('Test Run Flow Integration', () => {)const { result } = renderHook(() => useDatasourceOptions())- expect(result.current[0].label).toBe('Local Files')- expect(result.current[0].data.type).toBe(BlockEnum.DataSource)+ expect(result.current[0]!.label).toBe('Local Files')+ expect(result.current[0]!.data.type).toBe(BlockEnum.DataSource)})})diff --git a/web/__tests__/real-browser-flicker.test.tsx b/web/__tests__/real-browser-flicker.test.tsxindex 60f97d69388..7c3b45af190 100644--- a/web/__tests__/real-browser-flicker.test.tsx+++ b/web/__tests__/real-browser-flicker.test.tsx@@ -296,7 +296,7 @@ describe('Real Browser Environment Dark Mode Flicker Test', () => {// Wait for theme system to fully initializeawait waitFor(() => {- expect(screen.getByTestId('theme-indicator')).toHaveTextContent('Current Theme: dark')+ expect(screen.getByTestId('theme-indicator'))!.toHaveTextContent('Current Theme: dark')})const finalState = {@@ -319,10 +319,10 @@ describe('Real Browser Environment Dark Mode Flicker Test', () => {)await waitFor(() => {- expect(screen.getByTestId('theme-indicator')).toHaveTextContent('Current Theme: light')+ expect(screen.getByTestId('theme-indicator'))!.toHaveTextContent('Current Theme: light')})- expect(screen.getByTestId('visual-appearance')).toHaveTextContent('Appearance: light')+ expect(screen.getByTestId('visual-appearance'))!.toHaveTextContent('Appearance: light')})it('handles system theme with dark preference', async () => {@@ -335,10 +335,10 @@ describe('Real Browser Environment Dark Mode Flicker Test', () => {)await waitFor(() => {- expect(screen.getByTestId('theme-indicator')).toHaveTextContent('Current Theme: dark')+ expect(screen.getByTestId('theme-indicator'))!.toHaveTextContent('Current Theme: dark')})- expect(screen.getByTestId('visual-appearance')).toHaveTextContent('Appearance: dark')+ expect(screen.getByTestId('visual-appearance'))!.toHaveTextContent('Appearance: dark')})it('handles system theme with light preference', async () => {@@ -351,10 +351,10 @@ describe('Real Browser Environment Dark Mode Flicker Test', () => {)await waitFor(() => {- expect(screen.getByTestId('theme-indicator')).toHaveTextContent('Current Theme: light')+ expect(screen.getByTestId('theme-indicator'))!.toHaveTextContent('Current Theme: light')})- expect(screen.getByTestId('visual-appearance')).toHaveTextContent('Appearance: light')+ expect(screen.getByTestId('visual-appearance'))!.toHaveTextContent('Appearance: light')})it('handles no stored theme (defaults to system)', async () => {@@ -367,7 +367,7 @@ describe('Real Browser Environment Dark Mode Flicker Test', () => {)await waitFor(() => {- expect(screen.getByTestId('theme-indicator')).toHaveTextContent('Current Theme: light')+ expect(screen.getByTestId('theme-indicator'))!.toHaveTextContent('Current Theme: light')})})@@ -384,7 +384,7 @@ describe('Real Browser Environment Dark Mode Flicker Test', () => {)await waitFor(() => {- expect(screen.getByTestId('timing-status')).toHaveTextContent('Phase: CSR')+ expect(screen.getByTestId('timing-status'))!.toHaveTextContent('Phase: CSR')})// Analyze timing and style changes@@ -395,7 +395,7 @@ describe('Real Browser Environment Dark Mode Flicker Test', () => {// Check if there are style changes (this is visible flicker)const hasStyleChange = timingData.length > 1- && timingData[0].styles.backgroundColor !== timingData[timingData.length - 1].styles.backgroundColor+ && timingData[0]!.styles.backgroundColor !== timingData[timingData.length - 1]!.styles.backgroundColorif (hasStyleChange)console.log('⚠️ Style changes detected - this causes visible flicker')@@ -420,7 +420,7 @@ describe('Real Browser Environment Dark Mode Flicker Test', () => {)await waitFor(() => {- expect(screen.getByTestId('css-classes')).toHaveTextContent('bg-gray-900 text-white')+ expect(screen.getByTestId('css-classes'))!.toHaveTextContent('bg-gray-900 text-white')})console.log('\n=== CSS Class Change Detection ===')@@ -430,12 +430,12 @@ describe('Real Browser Environment Dark Mode Flicker Test', () => {// Check if CSS classes have changedconst hasCSSChange = cssStates.length > 1- && cssStates[0].className !== cssStates[cssStates.length - 1].className+ && cssStates[0]!.className !== cssStates[cssStates.length - 1]!.classNameif (hasCSSChange) {console.log('⚠️ CSS class changes detected - may cause style flicker')- console.log(`From: "${cssStates[0].className}"`)- console.log(`To: "${cssStates[cssStates.length - 1].className}"`)+ console.log(`From: "${cssStates[0]!.className}"`)+ console.log(`To: "${cssStates[cssStates.length - 1]!.className}"`)}expect(hasCSSChange).toBe(true) // We expect to see this change@@ -469,11 +469,12 @@ describe('Real Browser Environment Dark Mode Flicker Test', () => {// Should fallback gracefully without crashingawait waitFor(() => {- expect(screen.getByTestId('theme-indicator')).toBeInTheDocument()+ expect(screen.getByTestId('theme-indicator'))!.toBeInTheDocument()})// Should default to light theme when localStorage fails- expect(screen.getByTestId('visual-appearance')).toHaveTextContent('Appearance: light')+ // Should default to light theme when localStorage fails+ expect(screen.getByTestId('visual-appearance'))!.toHaveTextContent('Appearance: light')}finally {Reflect.deleteProperty(window, 'localStorage')@@ -490,12 +491,12 @@ describe('Real Browser Environment Dark Mode Flicker Test', () => {)await waitFor(() => {- expect(screen.getByTestId('theme-indicator')).toBeInTheDocument()+ expect(screen.getByTestId('theme-indicator'))!.toBeInTheDocument()})// Should handle invalid values gracefullyconst themeIndicator = screen.getByTestId('theme-indicator')- expect(themeIndicator).toBeInTheDocument()+ expect(themeIndicator)!.toBeInTheDocument()})})@@ -516,7 +517,7 @@ describe('Real Browser Environment Dark Mode Flicker Test', () => {)await waitFor(() => {- expect(screen.getByTestId('performance-test')).toHaveTextContent('Theme: dark')+ expect(screen.getByTestId('performance-test'))!.toHaveTextContent('Theme: dark')})// Analyze performance timelinediff --git a/web/__tests__/tools/provider-list-shell-flow.test.tsx b/web/__tests__/tools/provider-list-shell-flow.test.tsxindex 5b6ba8a64bf..d0d096f072e 100644--- a/web/__tests__/tools/provider-list-shell-flow.test.tsx+++ b/web/__tests__/tools/provider-list-shell-flow.test.tsx@@ -174,7 +174,7 @@ describe('Tool Provider List Shell Flow', () => {fireEvent.click(screen.getByTestId('tool-card-plugin-tool'))await waitFor(() => {- expect(screen.getByTestId('tool-plugin-detail-panel')).toBeInTheDocument()+ expect(screen.getByTestId('tool-plugin-detail-panel'))!.toBeInTheDocument()})fireEvent.click(screen.getByRole('button', { name: 'update-plugin-detail' }))@@ -196,10 +196,10 @@ describe('Tool Provider List Shell Flow', () => {fireEvent.click(screen.getByTestId('tab-item-workflow'))await waitFor(() => {- expect(screen.getByTestId('workflow-empty')).toBeInTheDocument()+ expect(screen.getByTestId('workflow-empty'))!.toBeInTheDocument()})- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.get('category')).toBe('workflow')})})diff --git a/web/__tests__/tools/tool-data-processing.test.ts b/web/__tests__/tools/tool-data-processing.test.tsindex 120461201f7..69be82447ac 100644--- a/web/__tests__/tools/tool-data-processing.test.ts+++ b/web/__tests__/tools/tool-data-processing.test.ts@@ -50,11 +50,11 @@ describe('Tool Data Processing Pipeline Integration', () => {const formSchemas = toolParametersToFormSchemas(rawParameters as unknown as Parameters<typeof toolParametersToFormSchemas>[0])expect(formSchemas).toHaveLength(2)- expect(formSchemas[0].variable).toBe('query')- expect(formSchemas[0].required).toBe(true)- expect(formSchemas[0].type).toBe('text-input')- expect(formSchemas[1].variable).toBe('limit')- expect(formSchemas[1].type).toBe('number-input')+ expect(formSchemas[0]!.variable).toBe('query')+ expect(formSchemas[0]!.required).toBe(true)+ expect(formSchemas[0]!.type).toBe('text-input')+ expect(formSchemas[1]!.variable).toBe('limit')+ expect(formSchemas[1]!.type).toBe('number-input')const withDefaults = addDefaultValue({}, formSchemas)expect(withDefaults.query).toBe('hello')@@ -83,9 +83,9 @@ describe('Tool Data Processing Pipeline Integration', () => {const credentialSchemas = toolCredentialToFormSchemas(rawCredentials as Parameters<typeof toolCredentialToFormSchemas>[0])expect(credentialSchemas).toHaveLength(1)- expect(credentialSchemas[0].variable).toBe('api_key')- expect(credentialSchemas[0].required).toBe(true)- expect(credentialSchemas[0].type).toBe('secret-input')+ expect(credentialSchemas[0]!.variable).toBe('api_key')+ expect(credentialSchemas[0]!.required).toBe(true)+ expect(credentialSchemas[0]!.type).toBe('secret-input')})it('processes trigger event parameters through the pipeline', () => {@@ -107,9 +107,9 @@ describe('Tool Data Processing Pipeline Integration', () => {const schemas = triggerEventParametersToFormSchemas(rawParams as unknown as Parameters<typeof triggerEventParametersToFormSchemas>[0])expect(schemas).toHaveLength(1)- expect(schemas[0].name).toBe('event_type')- expect(schemas[0].type).toBe('select')- expect(schemas[0].options).toHaveLength(2)+ expect(schemas[0]!.name).toBe('event_type')+ expect(schemas[0]!.type).toBe('select')+ expect(schemas[0]!.options).toHaveLength(2)})})@@ -189,16 +189,16 @@ describe('Tool Data Processing Pipeline Integration', () => {] as Parameters<typeof addFileInfos>[1]const sorted = sortAgentSorts(thoughts)- expect(sorted[0].id).toBe('t1')- expect(sorted[1].id).toBe('t2')- expect(sorted[2].id).toBe('t3')+ expect(sorted[0]!.id).toBe('t1')+ expect(sorted[1]!.id).toBe('t2')+ expect(sorted[2]!.id).toBe('t3')const enriched = addFileInfos(sorted, messageFiles)- expect(enriched[0].message_files).toBeUndefined()- expect(enriched[1].message_files).toHaveLength(1)- expect(enriched[1].message_files![0].id).toBe('f2')- expect(enriched[2].message_files).toHaveLength(1)- expect(enriched[2].message_files![0].id).toBe('f1')+ expect(enriched[0]!.message_files).toBeUndefined()+ expect(enriched[1]!.message_files).toHaveLength(1)+ expect(enriched[1]!.message_files![0]!.id).toBe('f2')+ expect(enriched[2]!.message_files).toHaveLength(1)+ expect(enriched[2]!.message_files![0]!.id).toBe('f1')})it('handles null inputs gracefully in the pipeline', () => {diff --git a/web/app/account/oauth/authorize/page.tsx b/web/app/account/oauth/authorize/page.tsxindex fe24afe7ff0..f370efcd3e4 100644--- a/web/app/account/oauth/authorize/page.tsx+++ b/web/app/account/oauth/authorize/page.tsx@@ -151,7 +151,7 @@ export default function OAuthAuthorize() {return (<div key={scope} className="flex items-center gap-2 body-sm-medium text-text-secondary">{Icon ? <Icon.icon className="h-4 w-4" /> : <RiAccountCircleLine className="h-4 w-4" />}- {Icon.label}+ {Icon!.label}</div>)})}diff --git a/web/app/components/app-sidebar/app-info/__tests__/index.spec.tsx b/web/app/components/app-sidebar/app-info/__tests__/index.spec.tsxindex fc0bb56f75a..2f0d748ae98 100644--- a/web/app/components/app-sidebar/app-info/__tests__/index.spec.tsx+++ b/web/app/components/app-sidebar/app-info/__tests__/index.spec.tsx@@ -89,7 +89,7 @@ describe('AppInfo', () => {it('should render trigger when not onlyShowDetail', () => {render(<AppInfo expand />)- expect(screen.getByTestId('trigger')).toBeInTheDocument()+ expect(screen.getByTestId('trigger'))!.toBeInTheDocument()})it('should not render trigger when onlyShowDetail is true', () => {@@ -99,11 +99,11 @@ describe('AppInfo', () => {it('should pass expand prop to trigger', () => {render(<AppInfo expand />)- expect(screen.getByTestId('trigger')).toHaveAttribute('data-expand', 'true')+ expect(screen.getByTestId('trigger'))!.toHaveAttribute('data-expand', 'true')const { unmount } = render(<AppInfo expand={false} />)const triggers = screen.getAllByTestId('trigger')- expect(triggers[triggers.length - 1]).toHaveAttribute('data-expand', 'false')+ expect(triggers[triggers.length - 1])!.toHaveAttribute('data-expand', 'false')unmount()})@@ -114,7 +114,7 @@ describe('AppInfo', () => {await user.click(screen.getByTestId('trigger'))expect(mockSetPanelOpen).toHaveBeenCalled()- const updater = mockSetPanelOpen.mock.calls[0][0] as (v: boolean) => boolean+ const updater = mockSetPanelOpen.mock.calls[0]![0] as (v: boolean) => booleanexpect(updater(false)).toBe(true)expect(updater(true)).toBe(false)})@@ -132,12 +132,12 @@ describe('AppInfo', () => {it('should show detail panel based on panelOpen when not onlyShowDetail', () => {mockUseAppInfoActions.panelOpen = truerender(<AppInfo expand />)- expect(screen.getByTestId('detail-panel')).toBeInTheDocument()+ expect(screen.getByTestId('detail-panel'))!.toBeInTheDocument()})it('should show detail panel based on openState when onlyShowDetail', () => {render(<AppInfo expand onlyShowDetail openState />)- expect(screen.getByTestId('detail-panel')).toBeInTheDocument()+ expect(screen.getByTestId('detail-panel'))!.toBeInTheDocument()})it('should hide detail panel when openState is false and onlyShowDetail', () => {diff --git a/web/app/components/app/annotation/__tests__/list.spec.tsx b/web/app/components/app/annotation/__tests__/list.spec.tsxindex aa47a5304b3..ad6a1e5e9c4 100644--- a/web/app/components/app/annotation/__tests__/list.spec.tsx+++ b/web/app/components/app/annotation/__tests__/list.spec.tsx@@ -64,7 +64,7 @@ describe('List', () => {)const checkboxes = getCheckboxes(container)- fireEvent.click(checkboxes[1])+ fireEvent.click(checkboxes[1]!)expect(onSelectedIdsChange).toHaveBeenCalledWith(['a'])rerender(@@ -79,10 +79,10 @@ describe('List', () => {/>,)const updatedCheckboxes = getCheckboxes(container)- fireEvent.click(updatedCheckboxes[1])+ fireEvent.click(updatedCheckboxes[1]!)expect(onSelectedIdsChange).toHaveBeenCalledWith([])- fireEvent.click(updatedCheckboxes[0])+ fireEvent.click(updatedCheckboxes[0]!)expect(onSelectedIdsChange).toHaveBeenCalledWith(['a', 'b'])})@@ -103,13 +103,13 @@ describe('List', () => {const row = screen.getByText(item.question).closest('tr') as HTMLTableRowElementconst actionButtons = within(row).getAllByRole('button')- fireEvent.click(actionButtons[1])+ fireEvent.click(actionButtons[1]!)- expect(await screen.findByText('appDebug.feature.annotation.removeConfirm')).toBeInTheDocument()+ expect(await screen.findByText('appDebug.feature.annotation.removeConfirm'))!.toBeInTheDocument()const confirmButton = await screen.findByRole('button', { name: 'common.operation.confirm' })fireEvent.click(confirmButton)expect(onRemove).toHaveBeenCalledWith(item.id)- expect(screen.getByText('appAnnotation.batchAction.selected')).toBeInTheDocument()+ expect(screen.getByText('appAnnotation.batchAction.selected'))!.toBeInTheDocument()})})diff --git a/web/app/components/app/annotation/batch-add-annotation-modal/__tests__/index.spec.tsx b/web/app/components/app/annotation/batch-add-annotation-modal/__tests__/index.spec.tsxindex 51047060459..3176b1addb9 100644--- a/web/app/components/app/annotation/batch-add-annotation-modal/__tests__/index.spec.tsx+++ b/web/app/components/app/annotation/batch-add-annotation-modal/__tests__/index.spec.tsx@@ -96,15 +96,15 @@ describe('BatchModal', () => {renderComponent()- expect(screen.getByTestId('annotation-full')).toBeInTheDocument()- expect(screen.getByRole('button', { name: 'appAnnotation.batchModal.run' })).toBeDisabled()+ expect(screen.getByTestId('annotation-full'))!.toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'appAnnotation.batchModal.run' }))!.toBeDisabled()})it('should reset uploader state when modal closes and allow manual cancellation', () => {const { rerender, props } = renderComponent()fireEvent.click(screen.getByTestId('mock-uploader'))- expect(screen.getByTestId('selected-file')).toHaveTextContent('batch.csv')+ expect(screen.getByTestId('selected-file'))!.toHaveTextContent('batch.csv')rerender(<BatchModal {...props} isShow={false} />)rerender(<BatchModal {...props} isShow />)@@ -137,7 +137,7 @@ describe('BatchModal', () => {expect(annotationBatchImportMock).toHaveBeenCalledTimes(1)})- const formData = annotationBatchImportMock.mock.calls[0][0].body as FormData+ const formData = annotationBatchImportMock.mock.calls[0]![0].body as FormDataexpect(formData.get('file')).toBe(lastUploadedFile)await waitFor(() => {diff --git a/web/app/components/app/annotation/edit-annotation-modal/__tests__/index.spec.tsx b/web/app/components/app/annotation/edit-annotation-modal/__tests__/index.spec.tsxindex 53a6f7356a1..4844017dde1 100644--- a/web/app/components/app/annotation/edit-annotation-modal/__tests__/index.spec.tsx+++ b/web/app/components/app/annotation/edit-annotation-modal/__tests__/index.spec.tsx@@ -75,7 +75,8 @@ describe('EditAnnotationModal', () => {render(<EditAnnotationModal {...props} />)// Assert - Check for modal title as it appears in the mock- expect(screen.getByText('appAnnotation.editModal.title')).toBeInTheDocument()+ // Assert - Check for modal title as it appears in the mock+ expect(screen.getByText('appAnnotation.editModal.title'))!.toBeInTheDocument()})it('should not render modal when isShow is false', () => {@@ -85,6 +86,37 @@ describe('EditAnnotationModal', () => {// Actrender(<EditAnnotationModal {...props} />)+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert// Assertexpect(screen.queryByText('appAnnotation.editModal.title')).not.toBeInTheDocument()})@@ -97,8 +129,9 @@ describe('EditAnnotationModal', () => {render(<EditAnnotationModal {...props} />)// Assert - Look for query and answer content- expect(screen.getByText('Test query')).toBeInTheDocument()- expect(screen.getByText('Test answer')).toBeInTheDocument()+ // Assert - Look for query and answer content+ expect(screen.getByText('Test query'))!.toBeInTheDocument()+ expect(screen.getByText('Test answer'))!.toBeInTheDocument()})})@@ -116,8 +149,9 @@ describe('EditAnnotationModal', () => {render(<EditAnnotationModal {...props} />)// Assert - Check content is displayed- expect(screen.getByText('Custom query content')).toBeInTheDocument()- expect(screen.getByText('Custom answer content')).toBeInTheDocument()+ // Assert - Check content is displayed+ expect(screen.getByText('Custom query content'))!.toBeInTheDocument()+ expect(screen.getByText('Custom answer content'))!.toBeInTheDocument()})it('should show remove option when annotationId is provided', () => {@@ -131,7 +165,8 @@ describe('EditAnnotationModal', () => {render(<EditAnnotationModal {...props} />)// Assert - Remove option should be present (using pattern)- expect(screen.getByText('appAnnotation.editModal.removeThisCache')).toBeInTheDocument()+ // Assert - Remove option should be present (using pattern)+ expect(screen.getByText('appAnnotation.editModal.removeThisCache'))!.toBeInTheDocument()})})@@ -160,7 +195,8 @@ describe('EditAnnotationModal', () => {render(<EditAnnotationModal {...props} />)// Assert- expect(screen.getByText('appAnnotation.editModal.removeThisCache')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('appAnnotation.editModal.removeThisCache'))!.toBeInTheDocument()})it('should save content when edited', async () => {@@ -183,7 +219,7 @@ describe('EditAnnotationModal', () => {// Find and click edit link for queryconst editLinks = screen.getAllByText(/common\.operation\.edit/i)- await user.click(editLinks[0])+ await user.click(editLinks[0]!)// Find textarea and enter new contentconst textarea = screen.getByRole('textbox')@@ -225,7 +261,7 @@ describe('EditAnnotationModal', () => {// Edit query contentconst editLinks = screen.getAllByText(/common\.operation\.edit/i)- await user.click(editLinks[0])+ await user.click(editLinks[0]!)const textarea = screen.getByRole('textbox')await user.clear(textarea)@@ -258,7 +294,7 @@ describe('EditAnnotationModal', () => {// Edit query contentconst editLinks = screen.getAllByText(/common\.operation\.edit/i)- await user.click(editLinks[0])+ await user.click(editLinks[0]!)const textarea = screen.getByRole('textbox')await user.clear(textarea)@@ -289,6 +325,37 @@ describe('EditAnnotationModal', () => {// Actrender(<EditAnnotationModal {...props} />)+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially+ // Assert - Confirm dialog should not be visible initially// Assert - Confirm dialog should not be visible initiallyexpect(screen.queryByText('appDebug.feature.annotation.removeConfirm')).not.toBeInTheDocument()})@@ -306,7 +373,8 @@ describe('EditAnnotationModal', () => {await user.click(screen.getByText('appAnnotation.editModal.removeThisCache'))// Assert - Confirmation dialog should appear- expect(screen.getByText('appDebug.feature.annotation.removeConfirm')).toBeInTheDocument()+ // Assert - Confirmation dialog should appear+ expect(screen.getByText('appDebug.feature.annotation.removeConfirm'))!.toBeInTheDocument()})it('should call onRemove when removal is confirmed', async () => {@@ -342,7 +410,7 @@ describe('EditAnnotationModal', () => {render(<EditAnnotationModal {...props} />)await user.click(screen.getByText('appAnnotation.editModal.removeThisCache'))- expect(screen.getByText('appDebug.feature.annotation.removeConfirm')).toBeInTheDocument()+ expect(screen.getByText('appDebug.feature.annotation.removeConfirm'))!.toBeInTheDocument()await user.click(screen.getByRole('button', { name: 'common.operation.cancel' }))@@ -366,7 +434,8 @@ describe('EditAnnotationModal', () => {render(<EditAnnotationModal {...props} />)// Assert- expect(screen.getByText('appAnnotation.editModal.title')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('appAnnotation.editModal.title'))!.toBeInTheDocument()})it('should handle very long content', () => {@@ -383,8 +452,9 @@ describe('EditAnnotationModal', () => {render(<EditAnnotationModal {...props} />)// Assert- expect(screen.getByText(longQuery)).toBeInTheDocument()- expect(screen.getByText(longAnswer)).toBeInTheDocument()+ // Assert+ expect(screen.getByText(longQuery))!.toBeInTheDocument()+ expect(screen.getByText(longAnswer))!.toBeInTheDocument()})it('should handle special characters in content', () => {@@ -401,8 +471,9 @@ describe('EditAnnotationModal', () => {render(<EditAnnotationModal {...props} />)// Assert- expect(screen.getByText(specialQuery)).toBeInTheDocument()- expect(screen.getByText(specialAnswer)).toBeInTheDocument()+ // Assert+ expect(screen.getByText(specialQuery))!.toBeInTheDocument()+ expect(screen.getByText(specialAnswer))!.toBeInTheDocument()})it('should handle onlyEditResponse prop', () => {@@ -440,7 +511,7 @@ describe('EditAnnotationModal', () => {// Find and click edit link for queryconst editLinks = screen.getAllByText(/common\.operation\.edit/i)- await user.click(editLinks[0])+ await user.click(editLinks[0]!)// Find textarea and enter new contentconst textarea = screen.getByRole('textbox')@@ -458,8 +529,9 @@ describe('EditAnnotationModal', () => {expect(mockOnAdded).not.toHaveBeenCalled()// Verify edit mode remains open (textarea should still be visible)- expect(screen.getByRole('textbox')).toBeInTheDocument()- expect(screen.getByRole('button', { name: 'common.operation.save' })).toBeInTheDocument()+ // Verify edit mode remains open (textarea should still be visible)+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'common.operation.save' }))!.toBeInTheDocument()})it('should show fallback error message when addAnnotation error has no message', async () => {@@ -477,7 +549,7 @@ describe('EditAnnotationModal', () => {render(<EditAnnotationModal {...props} />)const editLinks = screen.getAllByText(/common\.operation\.edit/i)- await user.click(editLinks[0])+ await user.click(editLinks[0]!)const textarea = screen.getByRole('textbox')await user.clear(textarea)@@ -493,8 +565,9 @@ describe('EditAnnotationModal', () => {expect(mockOnAdded).not.toHaveBeenCalled()// Verify edit mode remains open (textarea should still be visible)- expect(screen.getByRole('textbox')).toBeInTheDocument()- expect(screen.getByRole('button', { name: 'common.operation.save' })).toBeInTheDocument()+ // Verify edit mode remains open (textarea should still be visible)+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'common.operation.save' }))!.toBeInTheDocument()})it('should show error toast and skip callbacks when editAnnotation fails', async () => {@@ -516,7 +589,7 @@ describe('EditAnnotationModal', () => {// Edit query contentconst editLinks = screen.getAllByText(/common\.operation\.edit/i)- await user.click(editLinks[0])+ await user.click(editLinks[0]!)const textarea = screen.getByRole('textbox')await user.clear(textarea)@@ -532,8 +605,9 @@ describe('EditAnnotationModal', () => {expect(mockOnEdited).not.toHaveBeenCalled()// Verify edit mode remains open (textarea should still be visible)- expect(screen.getByRole('textbox')).toBeInTheDocument()- expect(screen.getByRole('button', { name: 'common.operation.save' })).toBeInTheDocument()+ // Verify edit mode remains open (textarea should still be visible)+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'common.operation.save' }))!.toBeInTheDocument()})it('should show fallback error message when editAnnotation error is not an Error instance', async () => {@@ -553,7 +627,7 @@ describe('EditAnnotationModal', () => {render(<EditAnnotationModal {...props} />)const editLinks = screen.getAllByText(/common\.operation\.edit/i)- await user.click(editLinks[0])+ await user.click(editLinks[0]!)const textarea = screen.getByRole('textbox')await user.clear(textarea)@@ -569,8 +643,9 @@ describe('EditAnnotationModal', () => {expect(mockOnEdited).not.toHaveBeenCalled()// Verify edit mode remains open (textarea should still be visible)- expect(screen.getByRole('textbox')).toBeInTheDocument()- expect(screen.getByRole('button', { name: 'common.operation.save' })).toBeInTheDocument()+ // Verify edit mode remains open (textarea should still be visible)+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'common.operation.save' }))!.toBeInTheDocument()})})@@ -589,7 +664,7 @@ describe('EditAnnotationModal', () => {// Assert - Check that the formatted time appears somewhere in the componentconst container = screen.getByRole('dialog')- expect(container).toHaveTextContent('2023-12-01 10:30:00')+ expect(container)!.toHaveTextContent('2023-12-01 10:30:00')})it('should not show createdAt when not provided', () => {@@ -619,7 +694,8 @@ describe('EditAnnotationModal', () => {render(<EditAnnotationModal {...props} />)// Assert - Should have remove functionality- expect(screen.getByText('appAnnotation.editModal.removeThisCache')).toBeInTheDocument()+ // Assert - Should have remove functionality+ expect(screen.getByText('appAnnotation.editModal.removeThisCache'))!.toBeInTheDocument()})})@@ -634,7 +710,7 @@ describe('EditAnnotationModal', () => {render(<EditAnnotationModal {...props} />)const editLinks = screen.getAllByText(/common\.operation\.edit/i)- await user.click(editLinks[0])+ await user.click(editLinks[0]!)const textarea = screen.getByRole('textbox')await user.clear(textarea)@@ -661,7 +737,8 @@ describe('EditAnnotationModal', () => {rerender(<EditAnnotationModal {...props} />)// Assert - Component should still be visible (no errors thrown)- expect(screen.getByText('appAnnotation.editModal.title')).toBeInTheDocument()+ // Assert - Component should still be visible (no errors thrown)+ expect(screen.getByText('appAnnotation.editModal.title'))!.toBeInTheDocument()})it('should re-render when props change', () => {@@ -674,7 +751,8 @@ describe('EditAnnotationModal', () => {rerender(<EditAnnotationModal {...newProps} />)// Assert - Should show new content- expect(screen.getByText('New query content')).toBeInTheDocument()+ // Assert - Should show new content+ expect(screen.getByText('New query content'))!.toBeInTheDocument()})})})diff --git a/web/app/components/app/annotation/header-opts/__tests__/index.spec.tsx b/web/app/components/app/annotation/header-opts/__tests__/index.spec.tsxindex a4e2d98917c..944a8563eb8 100644--- a/web/app/components/app/annotation/header-opts/__tests__/index.spec.tsx+++ b/web/app/components/app/annotation/header-opts/__tests__/index.spec.tsx@@ -172,7 +172,7 @@ type HeaderOptionsProps = ComponentProps<typeof HeaderOptions>const renderComponent = (props: Partial<HeaderOptionsProps> = {},- locale: Locale = LanguagesSupported[0],+ locale: Locale = LanguagesSupported[0]!,) => {;(useLocale as Mock).mockReturnValue(locale)@@ -279,8 +279,8 @@ describe('HeaderOptions', () => {const { csvButton, jsonButton } = await getExportButtons()- expect(csvButton).toBeDisabled()- expect(jsonButton).toBeDisabled()+ expect(csvButton)!.toBeDisabled()+ expect(jsonButton)!.toBeDisabled()expect(lastCSVDownloaderProps).toMatchObject({data: [['Question', 'Answer']],@@ -323,7 +323,7 @@ describe('HeaderOptions', () => {await openOperationsPopover(user)await clickOperationAction(user, 'appAnnotation.table.header.bulkImport')- expect(await screen.findByText('appAnnotation.batchModal.title')).toBeInTheDocument()+ expect(await screen.findByText('appAnnotation.batchModal.title'))!.toBeInTheDocument()await user.click(screen.getByRole('button', { name: 'appAnnotation.batchModal.cancel' }),)@@ -375,7 +375,7 @@ describe('HeaderOptions', () => {})const lines = blobContent.trim().split('\n')expect(lines).toHaveLength(1)- expect(JSON.parse(lines[0])).toEqual({+ expect(JSON.parse(lines[0]!)).toEqual({messages: [{ role: 'system', content: '' },{ role: 'user', content: 'Question 1' },diff --git a/web/app/components/app/annotation/view-annotation-modal/__tests__/index.spec.tsx b/web/app/components/app/annotation/view-annotation-modal/__tests__/index.spec.tsxindex d05fa27ccda..1b46443bd8a 100644--- a/web/app/components/app/annotation/view-annotation-modal/__tests__/index.spec.tsx+++ b/web/app/components/app/annotation/view-annotation-modal/__tests__/index.spec.tsx@@ -126,7 +126,8 @@ describe('ViewAnnotationModal', () => {fireEvent.click(screen.getByText('appAnnotation.viewModal.hitHistory'))// Assert- expect(await screen.findByText('appAnnotation.viewModal.noHitHistory')).toBeInTheDocument()+ // Assert+ expect(await screen.findByText('appAnnotation.viewModal.noHitHistory'))!.toBeInTheDocument()expect(mockFormatTime).toHaveBeenCalledWith(props.item.created_at, 'appLog.dateTimeFormat')})@@ -138,16 +139,16 @@ describe('ViewAnnotationModal', () => {fireEvent.click(await screen.findByText('appAnnotation.viewModal.hitHistory'))- expect(await screen.findByText('user input')).toBeInTheDocument()- expect(screen.getByText('15 appAnnotation.viewModal.hits')).toBeInTheDocument()- expect(mockFormatTime).toHaveBeenCalledWith(hits[0].created_at, 'appLog.dateTimeFormat')+ expect(await screen.findByText('user input'))!.toBeInTheDocument()+ expect(screen.getByText('15 appAnnotation.viewModal.hits'))!.toBeInTheDocument()+ expect(mockFormatTime).toHaveBeenCalledWith(hits[0]!.created_at, 'appLog.dateTimeFormat')})it('should confirm before removing the annotation and hide on success', async () => {const { props } = renderComponent()fireEvent.click(screen.getByText('appAnnotation.editModal.removeThisCache'))- expect(await screen.findByText('appDebug.feature.annotation.removeConfirm')).toBeInTheDocument()+ expect(await screen.findByText('appDebug.feature.annotation.removeConfirm'))!.toBeInTheDocument()const confirmButton = await screen.findByRole('button', { name: 'common.operation.confirm' })fireEvent.click(confirmButton)@@ -162,7 +163,7 @@ describe('ViewAnnotationModal', () => {renderComponent()fireEvent.click(screen.getByText('appAnnotation.editModal.removeThisCache'))- expect(await screen.findByText('appDebug.feature.annotation.removeConfirm')).toBeInTheDocument()+ expect(await screen.findByText('appDebug.feature.annotation.removeConfirm'))!.toBeInTheDocument()fireEvent.click(screen.getByRole('button', { name: 'common.operation.cancel' }))diff --git a/web/app/components/app/app-access-control/add-member-or-group-pop.tsx b/web/app/components/app/app-access-control/add-member-or-group-pop.tsxindex 125a4865a7e..8c8087cf17b 100644--- a/web/app/components/app/app-access-control/add-member-or-group-pop.tsx+++ b/web/app/components/app/app-access-control/add-member-or-group-pop.tsx@@ -36,7 +36,7 @@ export default function AddMemberOrGroupDialog() {let observer: IntersectionObserver | undefinedif (anchorRef.current) {observer = new IntersectionObserver((entries) => {- if (entries[0].isIntersecting && !isLoading && hasMore)+ if (entries[0]!.isIntersecting && !isLoading && hasMore)fetchNextPage()}, { rootMargin: '20px' })observer.observe(anchorRef.current)diff --git a/web/app/components/app/app-publisher/__tests__/index.spec.tsx b/web/app/components/app/app-publisher/__tests__/index.spec.tsxindex 1e29e44c824..bba2f53afcf 100644--- a/web/app/components/app/app-publisher/__tests__/index.spec.tsx+++ b/web/app/components/app/app-publisher/__tests__/index.spec.tsx@@ -207,7 +207,7 @@ describe('AppPublisher', () => {fireEvent.click(screen.getByText('common.publish'))- expect(screen.getByText('publisher-summary-publish')).toBeInTheDocument()+ expect(screen.getByText('publisher-summary-publish'))!.toBeInTheDocument()expect(mockOnToggle).toHaveBeenCalledWith(true)await waitFor(() => {@@ -248,7 +248,7 @@ describe('AppPublisher', () => {fireEvent.click(screen.getByText('common.publish'))fireEvent.click(screen.getByText('publisher-embed'))- expect(screen.getByTestId('embedded-modal')).toBeInTheDocument()+ expect(screen.getByTestId('embedded-modal'))!.toBeInTheDocument()})it('should close embedded and access control panels through child callbacks', async () => {@@ -265,7 +265,7 @@ describe('AppPublisher', () => {fireEvent.click(screen.getByText('common.publish'))fireEvent.click(screen.getByText('publisher-access-control'))- expect(screen.getByTestId('access-control')).toBeInTheDocument()+ expect(screen.getByTestId('access-control'))!.toBeInTheDocument()fireEvent.click(screen.getByText('close-access-control'))expect(screen.queryByTestId('access-control')).not.toBeInTheDocument()})@@ -280,7 +280,7 @@ describe('AppPublisher', () => {fireEvent.click(screen.getByText('common.publish'))fireEvent.click(screen.getByText('publisher-access-control'))- expect(screen.getByTestId('access-control')).toBeInTheDocument()+ expect(screen.getByTestId('access-control'))!.toBeInTheDocument()fireEvent.click(screen.getByText('confirm-access-control'))@@ -338,7 +338,7 @@ describe('AppPublisher', () => {/>,)- ahooksMocks.keyPressHandlers[0]({ preventDefault })+ ahooksMocks.keyPressHandlers[0]!({ preventDefault })await waitFor(() => {expect(preventDefault).toHaveBeenCalled()@@ -367,7 +367,7 @@ describe('AppPublisher', () => {/>,)- ahooksMocks.keyPressHandlers[0]({ preventDefault })+ ahooksMocks.keyPressHandlers[0]!({ preventDefault })await waitFor(() => {expect(preventDefault).toHaveBeenCalled()@@ -381,7 +381,7 @@ describe('AppPublisher', () => {await waitFor(() => {expect(onRestore).toHaveBeenCalledTimes(1)})- expect(screen.getByText('publisher-summary-publish')).toBeInTheDocument()+ expect(screen.getByText('publisher-summary-publish'))!.toBeInTheDocument()})it('should report missing explore installations', async () => {@@ -455,6 +455,6 @@ describe('AppPublisher', () => {await waitFor(() => {expect(mockFetchAppDetailDirect).not.toHaveBeenCalled()})- expect(screen.getByTestId('access-control')).toBeInTheDocument()+ expect(screen.getByTestId('access-control'))!.toBeInTheDocument()})})diff --git a/web/app/components/app/app-publisher/__tests__/version-info-modal.spec.tsx b/web/app/components/app/app-publisher/__tests__/version-info-modal.spec.tsxindex fa8b1c92fc9..ed86bb85717 100644--- a/web/app/components/app/app-publisher/__tests__/version-info-modal.spec.tsx+++ b/web/app/components/app/app-publisher/__tests__/version-info-modal.spec.tsx@@ -34,8 +34,8 @@ describe('VersionInfoModal', () => {/>,)- expect(screen.getByDisplayValue('Release 1')).toBeInTheDocument()- expect(screen.getByDisplayValue('Initial release')).toBeInTheDocument()+ expect(screen.getByDisplayValue('Release 1'))!.toBeInTheDocument()+ expect(screen.getByDisplayValue('Initial release'))!.toBeInTheDocument()})it('should reject overlong titles', () => {@@ -50,7 +50,7 @@ describe('VersionInfoModal', () => {)const [titleInput] = screen.getAllByRole('textbox')- fireEvent.change(titleInput, { target: { value: 'a'.repeat(16) } })+ fireEvent.change(titleInput!, { target: { value: 'a'.repeat(16) } })fireEvent.click(screen.getByRole('button', { name: 'common.publish' }))expect(toast.error).toHaveBeenCalledWith('versionHistory.editField.titleLengthLimit')@@ -75,8 +75,8 @@ describe('VersionInfoModal', () => {)const [titleInput, notesInput] = screen.getAllByRole('textbox')- fireEvent.change(titleInput, { target: { value: 'Release 2' } })- fireEvent.change(notesInput, { target: { value: 'Updated notes' } })+ fireEvent.change(titleInput!, { target: { value: 'Release 2' } })+ fireEvent.change(notesInput!, { target: { value: 'Updated notes' } })fireEvent.click(screen.getByRole('button', { name: 'common.publish' }))expect(handlePublish).toHaveBeenCalledWith({@@ -106,16 +106,16 @@ describe('VersionInfoModal', () => {const [titleInput, notesInput] = screen.getAllByRole('textbox')- fireEvent.change(titleInput, { target: { value: 'a'.repeat(16) } })+ fireEvent.change(titleInput!, { target: { value: 'a'.repeat(16) } })fireEvent.click(screen.getByRole('button', { name: 'common.publish' }))expect(toast.error).toHaveBeenCalledWith('versionHistory.editField.titleLengthLimit')- fireEvent.change(titleInput, { target: { value: 'Release 3' } })- fireEvent.change(notesInput, { target: { value: 'b'.repeat(101) } })+ fireEvent.change(titleInput!, { target: { value: 'Release 3' } })+ fireEvent.change(notesInput!, { target: { value: 'b'.repeat(101) } })fireEvent.click(screen.getByRole('button', { name: 'common.publish' }))expect(toast.error).toHaveBeenCalledWith('versionHistory.editField.releaseNotesLengthLimit')- fireEvent.change(notesInput, { target: { value: 'Stable release notes' } })+ fireEvent.change(notesInput!, { target: { value: 'Stable release notes' } })fireEvent.click(screen.getByRole('button', { name: 'common.publish' }))expect(handlePublish).toHaveBeenCalledWith({diff --git a/web/app/components/app/app-publisher/features-wrapper.tsx b/web/app/components/app/app-publisher/features-wrapper.tsxindex 47ce63645cc..7c39535701b 100644--- a/web/app/components/app/app-publisher/features-wrapper.tsx+++ b/web/app/components/app/app-publisher/features-wrapper.tsx@@ -62,7 +62,7 @@ const FeaturesWrappedAppPublisher = (props: Props) => {},enabled: !!(file_upload?.enabled || file_upload?.image?.enabled),allowed_file_types: file_upload?.allowed_file_types || [SupportUploadFileTypes.image],- allowed_file_extensions: file_upload?.allowed_file_extensions || FILE_EXTS[SupportUploadFileTypes.image].map(ext => `.${ext}`),+ allowed_file_extensions: file_upload?.allowed_file_extensions || FILE_EXTS[SupportUploadFileTypes.image]!.map(ext => `.${ext}`),allowed_file_upload_methods: file_upload?.allowed_file_upload_methods || file_upload?.image?.transfer_methods || ['local_file', 'remote_url'],number_limits: file_upload?.number_limits || file_upload?.image?.number_limits || 3,} as FileUploaddiff --git a/web/app/components/app/app-publisher/index.tsx b/web/app/components/app/app-publisher/index.tsxindex 67388602986..ce3698dbb7a 100644--- a/web/app/components/app/app-publisher/index.tsx+++ b/web/app/components/app/app-publisher/index.tsx@@ -197,7 +197,7 @@ const AppPublisher = ({throw new Error('App not found')const { installed_apps } = await fetchInstalledAppList(appDetail.id)if (installed_apps?.length > 0)- return `${basePath}/explore/installed/${installed_apps[0].id}`+ return `${basePath}/explore/installed/${installed_apps[0]!.id}`throw new Error('No app found in Explore')}, {onError: (err) => {diff --git a/web/app/components/app/configuration/__tests__/utils.spec.ts b/web/app/components/app/configuration/__tests__/utils.spec.tsindex 65a61921770..6db1c0c09c7 100644--- a/web/app/components/app/configuration/__tests__/utils.spec.ts+++ b/web/app/components/app/configuration/__tests__/utils.spec.ts@@ -60,8 +60,8 @@ describe('configuration utils', () => {{ id: 'tool-2', icon: '/console/icons/prefixed.svg' },] as never, '/console')- expect(result[0].icon).toBe('/console/icons/tool.svg')- expect(result[1].icon).toBe('/console/icons/prefixed.svg')+ expect(result[0]!.icon).toBe('/console/icons/tool.svg')+ expect(result[1]!.icon).toBe('/console/icons/prefixed.svg')})})diff --git a/web/app/components/app/configuration/config-prompt/__tests__/advanced-prompt-input.spec.tsx b/web/app/components/app/configuration/config-prompt/__tests__/advanced-prompt-input.spec.tsxindex 413721ee2e9..f7cfff94fb3 100644--- a/web/app/components/app/configuration/config-prompt/__tests__/advanced-prompt-input.spec.tsx+++ b/web/app/components/app/configuration/config-prompt/__tests__/advanced-prompt-input.spec.tsx@@ -208,7 +208,7 @@ describe('AdvancedPromptInput', () => {fireEvent.click(screen.getByText('open-advanced-tool-modal'))- const modalConfig = mockSetShowExternalDataToolModal.mock.calls[0][0]+ const modalConfig = mockSetShowExternalDataToolModal.mock.calls[0]![0]expect(modalConfig.onValidateBeforeSaveCallback({ variable: 'existing_var' })).toBe(false)expect(mockToastError).toHaveBeenCalledWith('varKeyError.keyAlreadyExists')diff --git a/web/app/components/app/configuration/config-prompt/__tests__/index.spec.tsx b/web/app/components/app/configuration/config-prompt/__tests__/index.spec.tsxindex d42eedf16b3..70283e02c9f 100644--- a/web/app/components/app/configuration/config-prompt/__tests__/index.spec.tsx+++ b/web/app/components/app/configuration/config-prompt/__tests__/index.spec.tsx@@ -144,8 +144,8 @@ describe('Prompt config component', () => {renderComponent({ onChange }, { isAdvancedMode: false })const simplePrompt = screen.getByTestId('simple-prompt-input')- expect(simplePrompt).toBeInTheDocument()- expect(simplePrompt).toHaveAttribute('data-mode', AppModeEnum.CHAT)+ expect(simplePrompt)!.toBeInTheDocument()+ expect(simplePrompt)!.toHaveAttribute('data-mode', AppModeEnum.CHAT)expect(mockSimplePromptInputProps?.promptTemplate).toBe('initial template')fireEvent.click(simplePrompt)expect(onChange).toHaveBeenCalledWith('mocked prompt', defaultPromptVariables)@@ -171,9 +171,9 @@ describe('Prompt config component', () => {const renderedMessages = screen.getAllByTestId('advanced-message-input')expect(renderedMessages).toHaveLength(2)- expect(renderedMessages[0]).toHaveAttribute('data-context-missing', 'true')- fireEvent.click(screen.getAllByText('hide-context')[0])- expect(screen.getAllByTestId('advanced-message-input')[0]).toHaveAttribute('data-context-missing', 'false')+ expect(renderedMessages[0])!.toHaveAttribute('data-context-missing', 'true')+ fireEvent.click(screen.getAllByText('hide-context')[0]!)+ expect(screen.getAllByTestId('advanced-message-input')[0])!.toHaveAttribute('data-context-missing', 'false')})// Chat message mutations@@ -193,7 +193,7 @@ describe('Prompt config component', () => {},)- fireEvent.click(screen.getAllByText('change')[0])+ fireEvent.click(screen.getAllByText('change')[0]!)expect(setCurrentAdvancedPrompt).toHaveBeenCalledWith([{ role: PromptRole.user, text: 'updated text' },@@ -219,7 +219,7 @@ describe('Prompt config component', () => {},)- fireEvent.click(screen.getAllByText('type')[1])+ fireEvent.click(screen.getAllByText('type')[1]!)expect(setCurrentAdvancedPrompt).toHaveBeenCalledWith([{ role: PromptRole.user, text: 'first' },@@ -244,7 +244,7 @@ describe('Prompt config component', () => {},)- fireEvent.click(screen.getAllByText('delete')[0])+ fireEvent.click(screen.getAllByText('delete')[0]!)expect(setCurrentAdvancedPrompt).toHaveBeenCalledWith([{ role: PromptRole.assistant, text: 'second' }])})diff --git a/web/app/components/app/configuration/config-prompt/__tests__/simple-prompt-input.spec.tsx b/web/app/components/app/configuration/config-prompt/__tests__/simple-prompt-input.spec.tsxindex a0bc0727603..0f8b9b032fb 100644--- a/web/app/components/app/configuration/config-prompt/__tests__/simple-prompt-input.spec.tsx+++ b/web/app/components/app/configuration/config-prompt/__tests__/simple-prompt-input.spec.tsx@@ -151,7 +151,7 @@ describe('SimplePromptInput', () => {fireEvent.click(screen.getByText('blur-prompt'))- expect(screen.getByText('autoAddVar')).toBeInTheDocument()+ expect(screen.getByText('autoAddVar'))!.toBeInTheDocument()fireEvent.click(screen.getByText('operation.add'))@@ -180,7 +180,7 @@ describe('SimplePromptInput', () => {fireEvent.click(screen.getByText('open-tool-modal'))expect(mockSetShowExternalDataToolModal).toHaveBeenCalledTimes(1)- const modalConfig = mockSetShowExternalDataToolModal.mock.calls[0][0]+ const modalConfig = mockSetShowExternalDataToolModal.mock.calls[0]![0]expect(modalConfig.onValidateBeforeSaveCallback({ variable: 'existing_var' })).toBe(false)expect(mockToastError).toHaveBeenCalledWith('varKeyError.keyAlreadyExists')@@ -267,10 +267,10 @@ describe('SimplePromptInput', () => {</ConfigContext.Provider>,)- expect(screen.getByText('datasets:Knowledge Base')).toBeInTheDocument()- expect(screen.getByText('variables:existing_var')).toBeInTheDocument()- expect(screen.getByText('external-tools:search_api')).toBeInTheDocument()- expect(screen.getByText('query-selectable:false')).toBeInTheDocument()+ expect(screen.getByText('datasets:Knowledge Base'))!.toBeInTheDocument()+ expect(screen.getByText('variables:existing_var'))!.toBeInTheDocument()+ expect(screen.getByText('external-tools:search_api'))!.toBeInTheDocument()+ expect(screen.getByText('query-selectable:false'))!.toBeInTheDocument()})it('should skip external tool variables and incomplete prompt variables when deciding whether to auto add', () => {@@ -312,7 +312,7 @@ describe('SimplePromptInput', () => {)fireEvent.click(screen.getByText('blur-prompt'))- expect(screen.getByText('autoAddVar')).toBeInTheDocument()+ expect(screen.getByText('autoAddVar'))!.toBeInTheDocument()fireEvent.click(screen.getByText('operation.cancel'))expect(mockOnChange).toHaveBeenCalledWith('Hello {{existing_var}}', [])diff --git a/web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx b/web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsxindex 2783f66c3f3..1de6e6ce0c4 100644--- a/web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx+++ b/web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx@@ -96,8 +96,8 @@ const AdvancedPromptInput: FC<Props> = ({},onValidateBeforeSaveCallback: (newExternalDataTool: ExternalDataTool) => {for (let i = 0; i < promptVariables.length; i++) {- if (promptVariables[i].key === newExternalDataTool.variable) {- toast.error(t('varKeyError.keyAlreadyExists', { ns: 'appDebug', key: promptVariables[i].key }))+ if (promptVariables[i]!.key === newExternalDataTool.variable) {+ toast.error(t('varKeyError.keyAlreadyExists', { ns: 'appDebug', key: promptVariables[i]!.key }))return false}}diff --git a/web/app/components/app/configuration/config-prompt/index.tsx b/web/app/components/app/configuration/config-prompt/index.tsxindex 3a36358d5ea..8a77d4bb58c 100644--- a/web/app/components/app/configuration/config-prompt/index.tsx+++ b/web/app/components/app/configuration/config-prompt/index.tsx@@ -53,7 +53,7 @@ const Prompt: FC<IPromptProps> = ({const handleMessageTypeChange = (index: number, role: PromptRole) => {const newPrompt = produce(currentAdvancedPrompt as PromptItem[], (draft) => {- draft[index].role = role+ draft[index]!.role = role})setCurrentAdvancedPrompt(newPrompt)}@@ -61,7 +61,7 @@ const Prompt: FC<IPromptProps> = ({const handleValueChange = (value: string, index?: number) => {if (modelModeType === ModelModeType.chat) {const newPrompt = produce(currentAdvancedPrompt as PromptItem[], (draft) => {- draft[index as number].text = value+ draft[index as number]!.text = value})setCurrentAdvancedPrompt(newPrompt, true)}diff --git a/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx b/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsxindex 0f6d2b94a67..6b5c3acccbc 100644--- a/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx+++ b/web/app/components/app/configuration/config-prompt/simple-prompt-input.tsx@@ -94,8 +94,8 @@ const Prompt: FC<ISimplePromptInput> = ({},onValidateBeforeSaveCallback: (newExternalDataTool: ExternalDataTool) => {for (let i = 0; i < promptVariables.length; i++) {- if (promptVariables[i].key === newExternalDataTool.variable) {- toast.error(t('varKeyError.keyAlreadyExists', { ns: 'appDebug', key: promptVariables[i].key }))+ if (promptVariables[i]!.key === newExternalDataTool.variable) {+ toast.error(t('varKeyError.keyAlreadyExists', { ns: 'appDebug', key: promptVariables[i]!.key }))return false}}diff --git a/web/app/components/app/configuration/config-var/__tests__/index.spec.tsx b/web/app/components/app/configuration/config-var/__tests__/index.spec.tsxindex fb190d844a7..4486489a206 100644--- a/web/app/components/app/configuration/config-var/__tests__/index.spec.tsx+++ b/web/app/components/app/configuration/config-var/__tests__/index.spec.tsx@@ -118,7 +118,7 @@ describe('ConfigVar', () => {it('should show empty state when no variables exist', () => {renderConfigVar({ promptVariables: [] })- expect(screen.getByText('appDebug.notSetVar')).toBeInTheDocument()+ expect(screen.getByText('appDebug.notSetVar'))!.toBeInTheDocument()})it('should render variable items and allow reordering via sortable list', () => {@@ -131,8 +131,8 @@ describe('ConfigVar', () => {onPromptVariablesChange,})- expect(screen.getByText('first')).toBeInTheDocument()- expect(screen.getByText('second')).toBeInTheDocument()+ expect(screen.getByText('first'))!.toBeInTheDocument()+ expect(screen.getByText('second'))!.toBeInTheDocument()act(() => {latestSortableProps?.setList([@@ -163,7 +163,7 @@ describe('ConfigVar', () => {fireEvent.click(await screen.findByText('appDebug.variableConfig.string'))expect(onPromptVariablesChange).toHaveBeenCalledTimes(1)- const [nextVariables] = onPromptVariablesChange.mock.calls[0]+ const [nextVariables] = (onPromptVariablesChange.mock.calls[0] ?? []) as [any]expect(nextVariables).toHaveLength(1)expect(nextVariables[0].type).toBe('string')})@@ -178,7 +178,7 @@ describe('ConfigVar', () => {expect(onPromptVariablesChange).toHaveBeenCalledTimes(1)expect(setShowExternalDataToolModal).toHaveBeenCalledTimes(1)- const modalState = setShowExternalDataToolModal.mock.calls[0][0]+ const modalState = setShowExternalDataToolModal.mock.calls[0]![0]expect(modalState.payload.type).toBe('api')act(() => {@@ -197,13 +197,13 @@ describe('ConfigVar', () => {fireEvent.click(screen.getByText('common.operation.add'))fireEvent.click(await screen.findByText('appDebug.variableConfig.apiBasedVar'))- const modalState = setShowExternalDataToolModal.mock.calls[0][0]+ const modalState = setShowExternalDataToolModal.mock.calls[0]![0]act(() => {modalState.onCancelCallback?.()})expect(onPromptVariablesChange).toHaveBeenCalledTimes(2)- const [addedVariables] = onPromptVariablesChange.mock.calls[0]+ const [addedVariables] = (onPromptVariablesChange.mock.calls[0] ?? []) as [any]expect(addedVariables).toHaveLength(2)expect(addedVariables[0]).toBe(existingVar)expect(addedVariables[1].type).toBe('api')@@ -235,7 +235,7 @@ describe('ConfigVar', () => {expect(itemContainer).not.toBeNull()const actionButtons = itemContainer!.querySelectorAll('div.h-6.w-6')expect(actionButtons).toHaveLength(2)- fireEvent.click(actionButtons[0])+ fireEvent.click(actionButtons[0]!)const editDialog = await screen.findByRole('dialog')const saveButton = within(editDialog).getByRole('button', { name: 'common.operation.save' })@@ -261,10 +261,10 @@ describe('ConfigVar', () => {expect(itemContainer).not.toBeNull()const actionButtons = itemContainer!.querySelectorAll('div.h-6.w-6')expect(actionButtons).toHaveLength(2)- fireEvent.click(actionButtons[0])+ fireEvent.click(actionButtons[0]!)const inputs = await screen.findAllByPlaceholderText('appDebug.variableConfig.inputPlaceholder')- fireEvent.change(inputs[0], { target: { value: 'second' } })+ fireEvent.change(inputs[0]!, { target: { value: 'second' } })fireEvent.click(screen.getByRole('button', { name: 'common.operation.save' }))@@ -287,10 +287,10 @@ describe('ConfigVar', () => {expect(itemContainer).not.toBeNull()const actionButtons = itemContainer!.querySelectorAll('div.h-6.w-6')expect(actionButtons).toHaveLength(2)- fireEvent.click(actionButtons[0])+ fireEvent.click(actionButtons[0]!)const inputs = await screen.findAllByPlaceholderText('appDebug.variableConfig.inputPlaceholder')- fireEvent.change(inputs[1], { target: { value: 'Second' } })+ fireEvent.change(inputs[1]!, { target: { value: 'Second' } })fireEvent.click(screen.getByRole('button', { name: 'common.operation.save' }))@@ -412,7 +412,7 @@ describe('ConfigVar', () => {expect(itemContainer).not.toBeNull()const actionButtons = itemContainer!.querySelectorAll('div.h-6.w-6')- fireEvent.click(actionButtons[0])+ fireEvent.click(actionButtons[0]!)const modalState = setShowExternalDataToolModal.mock.calls.at(-1)?.[0]@@ -461,7 +461,7 @@ describe('ConfigVar', () => {expect(itemContainer).not.toBeNull()const actionButtons = itemContainer!.querySelectorAll('div.h-6.w-6')- fireEvent.click(actionButtons[0])+ fireEvent.click(actionButtons[0]!)const modalState = setShowExternalDataToolModal.mock.calls.at(-1)?.[0]diff --git a/web/app/components/app/configuration/config-var/config-modal/__tests__/form-fields.spec.tsx b/web/app/components/app/configuration/config-var/config-modal/__tests__/form-fields.spec.tsxindex 101cbab8fb4..8cc8775bf56 100644--- a/web/app/components/app/configuration/config-var/config-modal/__tests__/form-fields.spec.tsx+++ b/web/app/components/app/configuration/config-var/config-modal/__tests__/form-fields.spec.tsx@@ -178,8 +178,8 @@ describe('ConfigModalFormFields', () => {render(<ConfigModalFormFields {...singleFileProps} />)fireEvent.click(screen.getByText('single-file-setting'))fireEvent.click(screen.getByText('upload-file'))- fireEvent.click(screen.getAllByText('unchecked')[0])- fireEvent.click(screen.getAllByText('unchecked')[1])+ fireEvent.click(screen.getAllByText('unchecked')[0]!)+ fireEvent.click(screen.getAllByText('unchecked')[1]!)expect(singleFileProps.onFilePayloadChange).toHaveBeenCalledWith({ number_limits: 1 })expect(singleFileProps.payloadChangeHandlers.default).toHaveBeenCalledWith(expect.objectContaining({@@ -198,7 +198,7 @@ describe('ConfigModalFormFields', () => {}render(<ConfigModalFormFields {...multiFileProps} />)fireEvent.click(screen.getByText('multi-file-setting'))- fireEvent.click(screen.getAllByText('upload-file')[1])+ fireEvent.click(screen.getAllByText('upload-file')[1]!)expect(multiFileProps.onFilePayloadChange).toHaveBeenCalledWith({ number_limits: 3 })expect(multiFileProps.payloadChangeHandlers.default).toHaveBeenCalledWith([expect.objectContaining({ fileId: 'file-1' }),diff --git a/web/app/components/app/configuration/config-var/config-modal/__tests__/index.spec.tsx b/web/app/components/app/configuration/config-var/config-modal/__tests__/index.spec.tsxindex 31256f0c08f..d15d6527c51 100644--- a/web/app/components/app/configuration/config-var/config-modal/__tests__/index.spec.tsx+++ b/web/app/components/app/configuration/config-var/config-modal/__tests__/index.spec.tsx@@ -44,9 +44,9 @@ describe('ConfigModal', () => {)const textboxes = screen.getAllByRole('textbox')- fireEvent.blur(textboxes[0], { target: { value: 'question' } })+ fireEvent.blur(textboxes[0]!, { target: { value: 'question' } })- expect(textboxes[1]).toHaveValue('question')+ expect(textboxes[1])!.toHaveValue('question')})it('should submit the edited payload when the form is valid', () => {diff --git a/web/app/components/app/configuration/config-var/config-string/__tests__/index.spec.tsx b/web/app/components/app/configuration/config-var/config-string/__tests__/index.spec.tsxindex 5fb2aaf732e..b83a27d670b 100644--- a/web/app/components/app/configuration/config-var/config-string/__tests__/index.spec.tsx+++ b/web/app/components/app/configuration/config-var/config-string/__tests__/index.spec.tsx@@ -27,15 +27,15 @@ describe('ConfigString', () => {const input = screen.getByRole('spinbutton')- expect(input).toHaveValue(3)- expect(input).toHaveAttribute('min', '1')- expect(input).toHaveAttribute('max', '8')+ expect(input)!.toHaveValue(3)+ expect(input)!.toHaveAttribute('min', '1')+ expect(input)!.toHaveAttribute('max', '8')})it('should render empty input when value is undefined', () => {const { onChange } = renderConfigString({ value: undefined })- expect(screen.getByRole('spinbutton')).toHaveValue(null)+ expect(screen.getByRole('spinbutton'))!.toHaveValue(null)expect(onChange).not.toHaveBeenCalled()})})@@ -116,7 +116,7 @@ describe('ConfigString', () => {fireEvent.change(screen.getByRole('spinbutton'), { target: { value: '' } })expect(onChange).toHaveBeenCalledTimes(1)- expect(onChange.mock.calls[0][0]).toBeNaN()+ expect(onChange.mock.calls[0]![0]).toBeNaN()})})})diff --git a/web/app/components/app/configuration/config-var/index.tsx b/web/app/components/app/configuration/config-var/index.tsxindex 951680c0357..aca28172493 100644--- a/web/app/components/app/configuration/config-var/index.tsx+++ b/web/app/components/app/configuration/config-var/index.tsx@@ -165,8 +165,8 @@ const ConfigVar: FC<IConfigVarProps> = ({ promptVariables, readonly, onPromptVar},onValidateBeforeSaveCallback: (newExternalDataTool: ExternalDataTool) => {for (let i = 0; i < promptVariables.length; i++) {- if (promptVariables[i].key === newExternalDataTool.variable && i !== index) {- toast.error(t('varKeyError.keyAlreadyExists', { ns: 'appDebug', key: promptVariables[i].key }))+ if (promptVariables[i]!.key === newExternalDataTool.variable && i !== index) {+ toast.error(t('varKeyError.keyAlreadyExists', { ns: 'appDebug', key: promptVariables[i]!.key }))return false}}@@ -220,7 +220,7 @@ const ConfigVar: FC<IConfigVarProps> = ({ promptVariables, readonly, onPromptVarconst handleRemoveVar = useCallback((index: number) => {const removeVar = promptVariables[index]- if (mode === AppModeEnum.COMPLETION && dataSets.length > 0 && removeVar.is_context_var) {+ if (mode === AppModeEnum.COMPLETION && dataSets.length > 0 && removeVar!.is_context_var) {showDeleteContextVarModal()setRemoveIndex(index)returndiff --git a/web/app/components/app/configuration/config-vision/__tests__/index.spec.tsx b/web/app/components/app/configuration/config-vision/__tests__/index.spec.tsxindex 6ff73ae008c..b46f561bdb1 100644--- a/web/app/components/app/configuration/config-vision/__tests__/index.spec.tsx+++ b/web/app/components/app/configuration/config-vision/__tests__/index.spec.tsx@@ -69,7 +69,7 @@ const setupFeatureStore = (fileOverrides: Partial<FileUpload> = {}) => {const getLatestFileConfig = () => {expect(setFeaturesMock).toHaveBeenCalled()- const latestFeatures = setFeaturesMock.mock.calls[setFeaturesMock.mock.calls.length - 1][0] as { file: FileUpload }+ const latestFeatures = setFeaturesMock.mock.calls[setFeaturesMock.mock.calls.length - 1]![0] as { file: FileUpload }return latestFeatures.file}@@ -98,8 +98,8 @@ describe('ConfigVision', () => {it('should show the toggle and parameter controls when visible', () => {render(<ConfigVision />)- expect(screen.getByText('appDebug.vision.name')).toBeInTheDocument()- expect(screen.getByRole('switch')).toHaveAttribute('aria-checked', 'false')+ expect(screen.getByText('appDebug.vision.name'))!.toBeInTheDocument()+ expect(screen.getByRole('switch'))!.toHaveAttribute('aria-checked', 'false')})it('should enable both image and video uploads when toggled on with video support', async () => {@@ -178,7 +178,7 @@ describe('ParamConfig', () => {await user.click(screen.getByRole('button', { name: 'appDebug.voice.settings' }))- expect(await screen.findByText('appDebug.vision.visionSettings.title')).toBeInTheDocument()+ expect(await screen.findByText('appDebug.vision.visionSettings.title'))!.toBeInTheDocument()})})diff --git a/web/app/components/app/configuration/config/assistant-type-picker/__tests__/index.spec.tsx b/web/app/components/app/configuration/config/assistant-type-picker/__tests__/index.spec.tsxindex 073ff5a639a..b32f14d089d 100644--- a/web/app/components/app/configuration/config/assistant-type-picker/__tests__/index.spec.tsx+++ b/web/app/components/app/configuration/config/assistant-type-picker/__tests__/index.spec.tsx@@ -46,7 +46,8 @@ describe('AssistantTypePicker', () => {renderComponent()// Assert- expect(screen.getByText(/chatAssistant.name/i)).toBeInTheDocument()+ // Assert+ expect(screen.getByText(/chatAssistant.name/i))!.toBeInTheDocument()})it('should render chat assistant by default when value is "chat"', () => {@@ -54,7 +55,8 @@ describe('AssistantTypePicker', () => {renderComponent({ value: 'chat' })// Assert- expect(screen.getByText(/chatAssistant.name/i)).toBeInTheDocument()+ // Assert+ expect(screen.getByText(/chatAssistant.name/i))!.toBeInTheDocument()})it('should render agent assistant when value is "agent"', () => {@@ -62,7 +64,8 @@ describe('AssistantTypePicker', () => {renderComponent({ value: 'agent' })// Assert- expect(screen.getByText(/agentAssistant.name/i)).toBeInTheDocument()+ // Assert+ expect(screen.getByText(/agentAssistant.name/i))!.toBeInTheDocument()})})@@ -73,7 +76,8 @@ describe('AssistantTypePicker', () => {renderComponent({ value: 'agent' })// Assert- expect(screen.getByText(/agentAssistant.name/i)).toBeInTheDocument()+ // Assert+ expect(screen.getByText(/agentAssistant.name/i))!.toBeInTheDocument()})it('should handle agentConfig prop', () => {@@ -91,7 +95,8 @@ describe('AssistantTypePicker', () => {}).not.toThrow()// Assert- expect(screen.getByText(/chatAssistant.name/i)).toBeInTheDocument()+ // Assert+ expect(screen.getByText(/chatAssistant.name/i))!.toBeInTheDocument()})it('should handle undefined agentConfig prop', () => {@@ -101,7 +106,8 @@ describe('AssistantTypePicker', () => {}).not.toThrow()// Assert- expect(screen.getByText(/chatAssistant.name/i)).toBeInTheDocument()+ // Assert+ expect(screen.getByText(/chatAssistant.name/i))!.toBeInTheDocument()})})@@ -137,7 +143,7 @@ describe('AssistantTypePicker', () => {// Wait for dropdown to open and find chat optionawait waitFor(() => {- expect(screen.getByText(/chatAssistant.description/i)).toBeInTheDocument()+ expect(screen.getByText(/chatAssistant.description/i))!.toBeInTheDocument()})// Find and click the chat option by its unique description@@ -160,7 +166,7 @@ describe('AssistantTypePicker', () => {// Wait for dropdown to open and click agent optionawait waitFor(() => {- expect(screen.getByText(/agentAssistant.description/i)).toBeInTheDocument()+ expect(screen.getByText(/agentAssistant.description/i))!.toBeInTheDocument()})const agentOption = getOptionByDescription(/agentAssistant.description/i)@@ -181,7 +187,7 @@ describe('AssistantTypePicker', () => {// Wait for dropdown and select chatawait waitFor(() => {- expect(screen.getByText(/chatAssistant.description/i)).toBeInTheDocument()+ expect(screen.getByText(/chatAssistant.description/i))!.toBeInTheDocument()})const chatOption = getOptionByDescription(/chatAssistant.description/i)@@ -209,11 +215,11 @@ describe('AssistantTypePicker', () => {})const agentOptions = screen.getAllByText(/agentAssistant.name/i)- await user.click(agentOptions[0])+ await user.click(agentOptions[0]!)// Assert - Dropdown should remain open (agent settings should be visible)await waitFor(() => {- expect(screen.getByText(/agent.setting.name/i)).toBeInTheDocument()+ expect(screen.getByText(/agent.setting.name/i))!.toBeInTheDocument()})})@@ -234,7 +240,7 @@ describe('AssistantTypePicker', () => {})const chatOptions = screen.getAllByText(/chatAssistant.name/i)- await user.click(chatOptions[1])+ await user.click(chatOptions[1]!)// Assertexpect(onChange).not.toHaveBeenCalled()@@ -255,7 +261,7 @@ describe('AssistantTypePicker', () => {// Wait for dropdown to openawait waitFor(() => {- expect(screen.getByText(/agentAssistant.description/i)).toBeInTheDocument()+ expect(screen.getByText(/agentAssistant.description/i))!.toBeInTheDocument()})// Act - Try to click an option@@ -292,7 +298,7 @@ describe('AssistantTypePicker', () => {// Assert - Agent settings option should be visibleawait waitFor(() => {- expect(screen.getByText(/agent.setting.name/i)).toBeInTheDocument()+ expect(screen.getByText(/agent.setting.name/i))!.toBeInTheDocument()})})})@@ -310,7 +316,7 @@ describe('AssistantTypePicker', () => {// Click agent settingsawait waitFor(() => {- expect(screen.getByText(/agent.setting.name/i)).toBeInTheDocument()+ expect(screen.getByText(/agent.setting.name/i))!.toBeInTheDocument()})const agentSettingsTrigger = screen.getByText(/agent.setting.name/i)@@ -318,7 +324,7 @@ describe('AssistantTypePicker', () => {// Assertawait waitFor(() => {- expect(screen.getByText(/common.operation.save/i)).toBeInTheDocument()+ expect(screen.getByText(/common.operation.save/i))!.toBeInTheDocument()})})@@ -333,9 +339,40 @@ describe('AssistantTypePicker', () => {// Wait for dropdown to openawait waitFor(() => {- expect(screen.getByText(/chatAssistant.description/i)).toBeInTheDocument()+ expect(screen.getByText(/chatAssistant.description/i))!.toBeInTheDocument()})+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')+ // Assert - Agent settings modal should not appear (value is 'chat')// Assert - Agent settings modal should not appear (value is 'chat')expect(screen.queryByText(/common.operation.save/i)).not.toBeInTheDocument()})@@ -351,7 +388,7 @@ describe('AssistantTypePicker', () => {await user.click(trigger)await waitFor(() => {- expect(screen.getByText(/agent.setting.name/i)).toBeInTheDocument()+ expect(screen.getByText(/agent.setting.name/i))!.toBeInTheDocument()})const agentSettingsTrigger = screen.getByText(/agent.setting.name/i)@@ -359,7 +396,7 @@ describe('AssistantTypePicker', () => {// Wait for modal and click saveawait waitFor(() => {- expect(screen.getByText(/common.operation.save/i)).toBeInTheDocument()+ expect(screen.getByText(/common.operation.save/i))!.toBeInTheDocument()})const saveButton = screen.getByText(/common.operation.save/i)@@ -379,14 +416,14 @@ describe('AssistantTypePicker', () => {await user.click(trigger)await waitFor(() => {- expect(screen.getByText(/agent.setting.name/i)).toBeInTheDocument()+ expect(screen.getByText(/agent.setting.name/i))!.toBeInTheDocument()})const agentSettingsTrigger = screen.getByText(/agent.setting.name/i)await user.click(agentSettingsTrigger)await waitFor(() => {- expect(screen.getByText(/appDebug.agent.setting.name/i)).toBeInTheDocument()+ expect(screen.getByText(/appDebug.agent.setting.name/i))!.toBeInTheDocument()})const saveButton = screen.getByText(/common.operation.save/i)@@ -409,14 +446,14 @@ describe('AssistantTypePicker', () => {await user.click(trigger)await waitFor(() => {- expect(screen.getByText(/agent.setting.name/i)).toBeInTheDocument()+ expect(screen.getByText(/agent.setting.name/i))!.toBeInTheDocument()})const agentSettingsTrigger = screen.getByText(/agent.setting.name/i)await user.click(agentSettingsTrigger)await waitFor(() => {- expect(screen.getByText(/common.operation.save/i)).toBeInTheDocument()+ expect(screen.getByText(/common.operation.save/i))!.toBeInTheDocument()})const cancelButton = screen.getByText(/common.operation.cancel/i)@@ -439,7 +476,7 @@ describe('AssistantTypePicker', () => {await user.click(trigger)await waitFor(() => {- expect(screen.getByText(/agent.setting.name/i)).toBeInTheDocument()+ expect(screen.getByText(/agent.setting.name/i))!.toBeInTheDocument()})const agentSettingsTrigger = screen.getByText(/agent.setting.name/i)@@ -447,7 +484,7 @@ describe('AssistantTypePicker', () => {// Assert - Modal should be open and dropdown should closeawait waitFor(() => {- expect(screen.getByText(/common.operation.save/i)).toBeInTheDocument()+ expect(screen.getByText(/common.operation.save/i))!.toBeInTheDocument()})// The dropdown should be closed (agent settings description should not be visible)@@ -472,7 +509,8 @@ describe('AssistantTypePicker', () => {await user.click(trigger)// Assert - Should not crash- expect(trigger).toBeInTheDocument()+ // Assert - Should not crash+ expect(trigger)!.toBeInTheDocument()})it('should handle multiple rapid selection changes', async () => {@@ -486,7 +524,7 @@ describe('AssistantTypePicker', () => {await user.click(trigger)await waitFor(() => {- expect(screen.getByText(/agentAssistant.description/i)).toBeInTheDocument()+ expect(screen.getByText(/agentAssistant.description/i))!.toBeInTheDocument()})// Click agent option - this stays open because value is 'agent'@@ -523,7 +561,8 @@ describe('AssistantTypePicker', () => {}).not.toThrow()// Assert- expect(screen.getByText(/chatAssistant.name/i)).toBeInTheDocument()+ // Assert+ expect(screen.getByText(/chatAssistant.name/i))!.toBeInTheDocument()})describe('should render with different prop combinations', () => {@@ -542,7 +581,7 @@ describe('AssistantTypePicker', () => {// Assertconst expectedText = combo.value === 'agent' ? 'agentAssistant.name' : 'chatAssistant.name'- expect(screen.getByText(new RegExp(expectedText, 'i'))).toBeInTheDocument()+ expect(screen.getByText(new RegExp(expectedText, 'i')))!.toBeInTheDocument()},)})@@ -561,15 +600,15 @@ describe('AssistantTypePicker', () => {// Assert - Both options should be visible and clickableawait waitFor(() => {- expect(screen.getByText(/chatAssistant.description/i)).toBeInTheDocument()- expect(screen.getByText(/agentAssistant.description/i)).toBeInTheDocument()+ expect(screen.getByText(/chatAssistant.description/i))!.toBeInTheDocument()+ expect(screen.getByText(/agentAssistant.description/i))!.toBeInTheDocument()})// Verify we can interact with option elements using helper functionconst chatOption = getOptionByDescription(/chatAssistant.description/i)const agentOption = getOptionByDescription(/agentAssistant.description/i)- expect(chatOption).toBeInTheDocument()- expect(agentOption).toBeInTheDocument()+ expect(chatOption)!.toBeInTheDocument()+ expect(agentOption)!.toBeInTheDocument()})})@@ -586,16 +625,16 @@ describe('AssistantTypePicker', () => {// Assert - Both options should be visible with radio componentsawait waitFor(() => {- expect(screen.getByText(/chatAssistant.description/i)).toBeInTheDocument()- expect(screen.getByText(/agentAssistant.description/i)).toBeInTheDocument()+ expect(screen.getByText(/chatAssistant.description/i))!.toBeInTheDocument()+ expect(screen.getByText(/agentAssistant.description/i))!.toBeInTheDocument()})// The SelectItem components render with different visual states// based on isChecked prop - we verify both options are renderedconst chatOption = getOptionByDescription(/chatAssistant.description/i)const agentOption = getOptionByDescription(/agentAssistant.description/i)- expect(chatOption).toBeInTheDocument()- expect(agentOption).toBeInTheDocument()+ expect(chatOption)!.toBeInTheDocument()+ expect(agentOption)!.toBeInTheDocument()})it('should render description text', async () => {@@ -609,8 +648,8 @@ describe('AssistantTypePicker', () => {// Assert - Descriptions should be visibleawait waitFor(() => {- expect(screen.getByText(/chatAssistant.description/i)).toBeInTheDocument()- expect(screen.getByText(/agentAssistant.description/i)).toBeInTheDocument()+ expect(screen.getByText(/chatAssistant.description/i))!.toBeInTheDocument()+ expect(screen.getByText(/agentAssistant.description/i))!.toBeInTheDocument()})})@@ -625,8 +664,8 @@ describe('AssistantTypePicker', () => {// Assert - Radio components should be present (both options visible)await waitFor(() => {- expect(screen.getByText(/chatAssistant.description/i)).toBeInTheDocument()- expect(screen.getByText(/agentAssistant.description/i)).toBeInTheDocument()+ expect(screen.getByText(/chatAssistant.description/i))!.toBeInTheDocument()+ expect(screen.getByText(/agentAssistant.description/i))!.toBeInTheDocument()})})})@@ -643,7 +682,7 @@ describe('AssistantTypePicker', () => {await user.click(trigger)await waitFor(() => {- expect(screen.getByText(/agent.setting.name/i)).toBeInTheDocument()+ expect(screen.getByText(/agent.setting.name/i))!.toBeInTheDocument()})const agentSettingsTrigger = screen.getByText(/agent.setting.name/i)@@ -651,9 +690,9 @@ describe('AssistantTypePicker', () => {// Assertawait waitFor(() => {- expect(screen.getByText(/common.operation.save/i)).toBeInTheDocument()+ expect(screen.getByText(/common.operation.save/i))!.toBeInTheDocument()})- expect(screen.getByText(/appDebug.agent.agentModeType.functionCall/i)).toBeInTheDocument()+ expect(screen.getByText(/appDebug.agent.agentModeType.functionCall/i))!.toBeInTheDocument()})it('should show built-in prompt when isFunctionCall is false', async () => {@@ -666,7 +705,7 @@ describe('AssistantTypePicker', () => {await user.click(trigger)await waitFor(() => {- expect(screen.getByText(/agent.setting.name/i)).toBeInTheDocument()+ expect(screen.getByText(/agent.setting.name/i))!.toBeInTheDocument()})const agentSettingsTrigger = screen.getByText(/agent.setting.name/i)@@ -674,9 +713,9 @@ describe('AssistantTypePicker', () => {// Assertawait waitFor(() => {- expect(screen.getByText(/common.operation.save/i)).toBeInTheDocument()+ expect(screen.getByText(/common.operation.save/i))!.toBeInTheDocument()})- expect(screen.getByText(/tools.builtInPromptTitle/i)).toBeInTheDocument()+ expect(screen.getByText(/tools.builtInPromptTitle/i))!.toBeInTheDocument()})it('should initialize max iteration from agentConfig payload', async () => {@@ -696,7 +735,7 @@ describe('AssistantTypePicker', () => {await user.click(trigger)await waitFor(() => {- expect(screen.getByText(/agent.setting.name/i)).toBeInTheDocument()+ expect(screen.getByText(/agent.setting.name/i))!.toBeInTheDocument()})const agentSettingsTrigger = screen.getByText(/agent.setting.name/i)@@ -705,7 +744,7 @@ describe('AssistantTypePicker', () => {// Assertawait screen.findByText(/common.operation.save/i)const maxIterationInput = await screen.findByRole('spinbutton')- expect(maxIterationInput).toHaveValue(10)+ expect(maxIterationInput)!.toHaveValue(10)})})@@ -721,7 +760,7 @@ describe('AssistantTypePicker', () => {await user.click(trigger)await waitFor(() => {- expect(screen.getByText(/chatAssistant.description/i)).toBeInTheDocument()+ expect(screen.getByText(/chatAssistant.description/i))!.toBeInTheDocument()})// Press Escape@@ -741,8 +780,9 @@ describe('AssistantTypePicker', () => {const trigger = screen.getByText(/chatAssistant.name/i)// Assert - Element should be focusable- expect(trigger).toBeInTheDocument()- expect(trigger.parentElement).toBeInTheDocument()+ // Assert - Element should be focusable+ expect(trigger)!.toBeInTheDocument()+ expect(trigger.parentElement)!.toBeInTheDocument()})it('should allow keyboard focus on dropdown options', async () => {@@ -755,7 +795,7 @@ describe('AssistantTypePicker', () => {await user.click(trigger)await waitFor(() => {- expect(screen.getByText(/chatAssistant.description/i)).toBeInTheDocument()+ expect(screen.getByText(/chatAssistant.description/i))!.toBeInTheDocument()})// Get options@@ -763,8 +803,9 @@ describe('AssistantTypePicker', () => {const agentOption = getOptionByDescription(/agentAssistant.description/i)// Assert - Options should be focusable- expect(chatOption).toBeInTheDocument()- expect(agentOption).toBeInTheDocument()+ // Assert - Options should be focusable+ expect(chatOption)!.toBeInTheDocument()+ expect(agentOption)!.toBeInTheDocument()// Verify options exist and can receive focus programmatically// Note: focus() doesn't always update document.activeElement in JSDOM@@ -787,11 +828,11 @@ describe('AssistantTypePicker', () => {// Assert - Agent settings button should be focusableawait waitFor(() => {- expect(screen.getByText(/agent.setting.name/i)).toBeInTheDocument()+ expect(screen.getByText(/agent.setting.name/i))!.toBeInTheDocument()})const agentSettings = screen.getByText(/agent.setting.name/i)- expect(agentSettings).toBeInTheDocument()+ expect(agentSettings)!.toBeInTheDocument()})})@@ -804,7 +845,7 @@ describe('AssistantTypePicker', () => {// Act - Check initial stateconst portalContainer = container.querySelector('[data-state]')- expect(portalContainer).toHaveAttribute('data-state', 'closed')+ expect(portalContainer)!.toHaveAttribute('data-state', 'closed')// Open dropdownconst trigger = screen.getByText(/chatAssistant.name/i)@@ -813,7 +854,7 @@ describe('AssistantTypePicker', () => {// Assert - State should change to openawait waitFor(() => {const openPortal = container.querySelector('[data-state="open"]')- expect(openPortal).toBeInTheDocument()+ expect(openPortal)!.toBeInTheDocument()})})@@ -823,11 +864,12 @@ describe('AssistantTypePicker', () => {// Assert - Portal should have data-state for accessibilityconst portalContainer = container.querySelector('[data-state]')- expect(portalContainer).toBeInTheDocument()- expect(portalContainer).toHaveAttribute('data-state')+ expect(portalContainer)!.toBeInTheDocument()+ expect(portalContainer)!.toHaveAttribute('data-state')// Should start in closed state- expect(portalContainer).toHaveAttribute('data-state', 'closed')+ // Should start in closed state+ expect(portalContainer)!.toHaveAttribute('data-state', 'closed')})it('should maintain accessible structure for screen readers', () => {@@ -835,7 +877,8 @@ describe('AssistantTypePicker', () => {renderComponent({ value: 'chat' })// Assert - Text content should be accessible- expect(screen.getByText(/chatAssistant.name/i)).toBeInTheDocument()+ // Assert - Text content should be accessible+ expect(screen.getByText(/chatAssistant.name/i))!.toBeInTheDocument()// Icons should have proper structureconst { container } = renderComponent()@@ -854,12 +897,13 @@ describe('AssistantTypePicker', () => {// Assert - All options should have descriptive textawait waitFor(() => {- expect(screen.getByText(/chatAssistant.description/i)).toBeInTheDocument()- expect(screen.getByText(/agentAssistant.description/i)).toBeInTheDocument()+ expect(screen.getByText(/chatAssistant.description/i))!.toBeInTheDocument()+ expect(screen.getByText(/agentAssistant.description/i))!.toBeInTheDocument()})// Title text should be visible- expect(screen.getByText(/assistantType.name/i)).toBeInTheDocument()+ // Title text should be visible+ expect(screen.getByText(/assistantType.name/i))!.toBeInTheDocument()})})})diff --git a/web/app/components/app/configuration/config/automatic/__tests__/result.spec.tsx b/web/app/components/app/configuration/config/automatic/__tests__/result.spec.tsxindex 7e9c26bd06b..30f41b7828d 100644--- a/web/app/components/app/configuration/config/automatic/__tests__/result.spec.tsx+++ b/web/app/components/app/configuration/config/automatic/__tests__/result.spec.tsx@@ -81,11 +81,11 @@ describe('Result', () => {/>,)- expect(screen.getByTestId('prompt-toast')).toHaveTextContent('optimization note')- expect(screen.getByTestId('prompt-res')).toHaveTextContent('generated output')+ expect(screen.getByTestId('prompt-toast'))!.toHaveTextContent('optimization note')+ expect(screen.getByTestId('prompt-res'))!.toHaveTextContent('generated output')fireEvent.click(screen.getByTestId('version-selector'))- fireEvent.click(screen.getAllByRole('button')[1])+ fireEvent.click(screen.getAllByRole('button')[1]!)fireEvent.click(screen.getByText('generate.apply'))expect(mockSetCurrentVersionIndex).toHaveBeenCalledWith(1)@@ -106,7 +106,7 @@ describe('Result', () => {/>,)- expect(screen.getByTestId('prompt-res-in-workflow')).toHaveTextContent('generated output')+ expect(screen.getByTestId('prompt-res-in-workflow'))!.toHaveTextContent('generated output')expect(mockPromptResInWorkflow).toHaveBeenCalledWith(expect.objectContaining({nodeId: 'node-1',value: 'generated output',@@ -121,6 +121,6 @@ describe('Result', () => {/>,)- expect(screen.getByTestId('code-editor')).toHaveTextContent('generated output')+ expect(screen.getByTestId('code-editor'))!.toHaveTextContent('generated output')})})diff --git a/web/app/components/app/configuration/dataset-config/__tests__/index.spec.tsx b/web/app/components/app/configuration/dataset-config/__tests__/index.spec.tsxindex 11562e8d9b1..25e38b48552 100644--- a/web/app/components/app/configuration/dataset-config/__tests__/index.spec.tsx+++ b/web/app/components/app/configuration/dataset-config/__tests__/index.spec.tsx@@ -61,7 +61,7 @@ vi.mock('es-toolkit/compat', () => ({return []// Start with first array and filter down- return validArrays[0].filter((item: any) => {+ return validArrays[0]!.filter((item: any) => {if (!item || !item.name)return false@@ -317,14 +317,14 @@ describe('DatasetConfig', () => {it('should render dataset configuration panel when component mounts', () => {renderDatasetConfig()- expect(screen.getByText('appDebug.feature.dataSet.title')).toBeInTheDocument()+ expect(screen.getByText('appDebug.feature.dataSet.title'))!.toBeInTheDocument()})it('should display empty state message when no datasets are configured', () => {renderDatasetConfig()- expect(screen.getByText(/no.*data/i)).toBeInTheDocument()- expect(screen.getByTestId('params-config')).toBeDisabled()+ expect(screen.getByText(/no.*data/i))!.toBeInTheDocument()+ expect(screen.getByTestId('params-config'))!.toBeDisabled()})it('should render dataset cards and enable parameters when datasets exist', () => {@@ -333,16 +333,16 @@ describe('DatasetConfig', () => {dataSets: [dataset],})- expect(screen.getByTestId(`card-item-${dataset.id}`)).toBeInTheDocument()- expect(screen.getByText(dataset.name)).toBeInTheDocument()+ expect(screen.getByTestId(`card-item-${dataset.id}`))!.toBeInTheDocument()+ expect(screen.getByText(dataset.name))!.toBeInTheDocument()expect(screen.getByTestId('params-config')).not.toBeDisabled()})it('should show configuration title and add dataset button in header', () => {renderDatasetConfig()- expect(screen.getByText('appDebug.feature.dataSet.title')).toBeInTheDocument()- expect(screen.getByText('common.operation.add')).toBeInTheDocument()+ expect(screen.getByText('appDebug.feature.dataSet.title'))!.toBeInTheDocument()+ expect(screen.getByText('common.operation.add'))!.toBeInTheDocument()})it('should hide parameters configuration when in agent mode', () => {@@ -436,7 +436,7 @@ describe('DatasetConfig', () => {dataSets: [dataset],})- expect(screen.getByTestId(`card-item-${dataset.id}`)).toBeInTheDocument()+ expect(screen.getByTestId(`card-item-${dataset.id}`))!.toBeInTheDocument()})})@@ -456,9 +456,10 @@ describe('DatasetConfig', () => {},})- expect(screen.getByTestId('context-var')).toBeInTheDocument()+ expect(screen.getByTestId('context-var'))!.toBeInTheDocument()// Should find the selected context variable in the options- expect(screen.getByText('Select context variable')).toBeInTheDocument()+ // Should find the selected context variable in the options+ expect(screen.getByText('Select context variable'))!.toBeInTheDocument()})it('should not show context variable selector in chat mode', () => {@@ -514,8 +515,8 @@ describe('DatasetConfig', () => {dataSets: [dataset],})- expect(screen.getByTestId('metadata-filter')).toBeInTheDocument()- expect(screen.getByTestId('metadata-list-count')).toHaveTextContent('2') // both 'category' and 'priority'+ expect(screen.getByTestId('metadata-filter'))!.toBeInTheDocument()+ expect(screen.getByTestId('metadata-list-count'))!.toHaveTextContent('2') // both 'category' and 'priority'})it('should handle metadata filter mode change', async () => {@@ -740,8 +741,8 @@ describe('DatasetConfig', () => {dataSets: [dataset],})- expect(screen.getByTestId('metadata-filter')).toBeInTheDocument()- expect(screen.getByTestId('metadata-list-count')).toHaveTextContent('0')+ expect(screen.getByTestId('metadata-filter'))!.toBeInTheDocument()+ expect(screen.getByTestId('metadata-list-count'))!.toHaveTextContent('0')})it('should handle empty doc_metadata array', () => {@@ -753,8 +754,8 @@ describe('DatasetConfig', () => {dataSets: [dataset],})- expect(screen.getByTestId('metadata-filter')).toBeInTheDocument()- expect(screen.getByTestId('metadata-list-count')).toHaveTextContent('0')+ expect(screen.getByTestId('metadata-filter'))!.toBeInTheDocument()+ expect(screen.getByTestId('metadata-list-count'))!.toHaveTextContent('0')})it('should handle missing userProfile', () => {@@ -769,7 +770,7 @@ describe('DatasetConfig', () => {dataSets: [dataset],})- expect(screen.getByTestId(`card-item-${dataset.id}`)).toBeInTheDocument()+ expect(screen.getByTestId(`card-item-${dataset.id}`))!.toBeInTheDocument()})it('should handle missing datasetConfigsRef gracefully', () => {@@ -816,10 +817,10 @@ describe('DatasetConfig', () => {dataSets: datasets,})- expect(screen.getByTestId('card-item-ds1')).toBeInTheDocument()- expect(screen.getByTestId('card-item-ds2')).toBeInTheDocument()- expect(screen.getByText('Dataset 1')).toBeInTheDocument()- expect(screen.getByText('Dataset 2')).toBeInTheDocument()+ expect(screen.getByTestId('card-item-ds1'))!.toBeInTheDocument()+ expect(screen.getByTestId('card-item-ds2'))!.toBeInTheDocument()+ expect(screen.getByText('Dataset 1'))!.toBeInTheDocument()+ expect(screen.getByText('Dataset 2'))!.toBeInTheDocument()})it('should integrate with params config component', () => {@@ -833,8 +834,8 @@ describe('DatasetConfig', () => {})const paramsConfig = screen.getByTestId('params-config')- expect(paramsConfig).toBeInTheDocument()- expect(paramsConfig).toHaveTextContent('Params (2)')+ expect(paramsConfig)!.toBeInTheDocument()+ expect(paramsConfig)!.toHaveTextContent('Params (2)')expect(paramsConfig).not.toBeDisabled()})@@ -860,9 +861,10 @@ describe('DatasetConfig', () => {})const metadataFilter = screen.getByTestId('metadata-filter')- expect(metadataFilter).toBeInTheDocument()+ expect(metadataFilter)!.toBeInTheDocument()+ // Should show intersection (only 'category')// Should show intersection (only 'category')- expect(screen.getByTestId('metadata-list-count')).toHaveTextContent('1')+ expect(screen.getByTestId('metadata-list-count'))!.toHaveTextContent('1')})})@@ -884,7 +886,7 @@ describe('DatasetConfig', () => {})const metadataFilter = screen.getByTestId('metadata-filter')- expect(metadataFilter).toBeInTheDocument()+ expect(metadataFilter)!.toBeInTheDocument()fireEvent.click(within(metadataFilter).getByText('Change Metadata Model'))@@ -915,7 +917,7 @@ describe('DatasetConfig', () => {})const metadataFilter = screen.getByTestId('metadata-filter')- expect(metadataFilter).toBeInTheDocument()+ expect(metadataFilter)!.toBeInTheDocument()fireEvent.click(within(metadataFilter).getByText('Change Metadata Params'))@@ -941,7 +943,8 @@ describe('DatasetConfig', () => {})// The editable property should be false when no permission- expect(screen.getByTestId(`card-item-${dataset.id}`)).toBeInTheDocument()+ // The editable property should be false when no permission+ expect(screen.getByTestId(`card-item-${dataset.id}`))!.toBeInTheDocument()})it('should show readonly state for non-editable datasets', () => {@@ -956,7 +959,7 @@ describe('DatasetConfig', () => {dataSets: [dataset],})- expect(screen.getByTestId(`card-item-${dataset.id}`)).toBeInTheDocument()+ expect(screen.getByTestId(`card-item-${dataset.id}`))!.toBeInTheDocument()})it('should allow editing when user has partial member permission', () => {@@ -972,7 +975,7 @@ describe('DatasetConfig', () => {dataSets: [dataset],})- expect(screen.getByTestId(`card-item-${dataset.id}`)).toBeInTheDocument()+ expect(screen.getByTestId(`card-item-${dataset.id}`))!.toBeInTheDocument()})})@@ -989,9 +992,10 @@ describe('DatasetConfig', () => {})// Verify order is maintained- expect(screen.getByText('Dataset 1')).toBeInTheDocument()- expect(screen.getByText('Dataset 2')).toBeInTheDocument()- expect(screen.getByText('Dataset 3')).toBeInTheDocument()+ // Verify order is maintained+ expect(screen.getByText('Dataset 1'))!.toBeInTheDocument()+ expect(screen.getByText('Dataset 2'))!.toBeInTheDocument()+ expect(screen.getByText('Dataset 3'))!.toBeInTheDocument()})it('should handle multiple dataset operations correctly', async () => {@@ -1007,7 +1011,7 @@ describe('DatasetConfig', () => {// Remove first datasetconst removeButton1 = screen.getAllByText('Remove')[0]- await user.click(removeButton1)+ await user.click(removeButton1!)expect(mockConfigContext.setDataSets).toHaveBeenCalledWith([datasets[1]])})@@ -1050,7 +1054,7 @@ describe('DatasetConfig', () => {dataSets: datasets,})- expect(screen.getByTestId('params-config')).toHaveTextContent('Params (2)')+ expect(screen.getByTestId('params-config'))!.toHaveTextContent('Params (2)')})it('should handle external knowledge base integration', () => {@@ -1068,8 +1072,8 @@ describe('DatasetConfig', () => {dataSets: [externalDataset],})- expect(screen.getByTestId(`card-item-${externalDataset.id}`)).toBeInTheDocument()- expect(screen.getByText(externalDataset.name)).toBeInTheDocument()+ expect(screen.getByTestId(`card-item-${externalDataset.id}`))!.toBeInTheDocument()+ expect(screen.getByText(externalDataset.name))!.toBeInTheDocument()})})@@ -1090,7 +1094,7 @@ describe('DatasetConfig', () => {dataSets: manyDatasets,})- expect(screen.getByTestId('params-config')).toHaveTextContent('Params (50)')+ expect(screen.getByTestId('params-config'))!.toHaveTextContent('Params (50)')})it('should handle metadata intersection calculation efficiently', () => {@@ -1118,7 +1122,8 @@ describe('DatasetConfig', () => {})// Should calculate intersection correctly- expect(screen.getByTestId('metadata-filter')).toBeInTheDocument()+ // Should calculate intersection correctly+ expect(screen.getByTestId('metadata-filter'))!.toBeInTheDocument()})})})diff --git a/web/app/components/app/configuration/dataset-config/card-item/__tests__/index.spec.tsx b/web/app/components/app/configuration/dataset-config/card-item/__tests__/index.spec.tsxindex 16a539bae32..1d14f7dbd25 100644--- a/web/app/components/app/configuration/dataset-config/card-item/__tests__/index.spec.tsx+++ b/web/app/components/app/configuration/dataset-config/card-item/__tests__/index.spec.tsx@@ -157,9 +157,9 @@ describe('dataset-config/card-item', () => {const card = screen.getByText(dataset.name).closest('.group') as HTMLElementconst actionButtons = within(card).getAllByRole('button', { hidden: true })- expect(screen.getByText(dataset.name)).toBeInTheDocument()- expect(screen.getByText('dataset.indexingTechnique.high_quality · dataset.indexingMethod.semantic_search')).toBeInTheDocument()- expect(screen.getByText('dataset.externalTag')).toBeInTheDocument()+ expect(screen.getByText(dataset.name))!.toBeInTheDocument()+ expect(screen.getByText('dataset.indexingTechnique.high_quality · dataset.indexingMethod.semantic_search'))!.toBeInTheDocument()+ expect(screen.getByText('dataset.externalTag'))!.toBeInTheDocument()expect(actionButtons).toHaveLength(2)})@@ -170,9 +170,9 @@ describe('dataset-config/card-item', () => {const card = screen.getByText(dataset.name).closest('.group') as HTMLElementconst [editButton] = within(card).getAllByRole('button', { hidden: true })- await user.click(editButton)+ await user.click(editButton!)- expect(await screen.findByText('Mock settings modal')).toBeInTheDocument()+ expect(await screen.findByText('Mock settings modal'))!.toBeInTheDocument()fireEvent.click(await screen.findByText('Save changes'))await waitFor(() => {@@ -213,8 +213,8 @@ describe('dataset-config/card-item', () => {const nameElement = screen.getByText(dataset.name)const iconElement = nameElement.parentElement?.firstElementChild as HTMLElement- expect(iconElement).toHaveStyle({ background: '#FFF4ED' })- expect(iconElement.querySelector('em-emoji')).toHaveAttribute('id', '📙')+ expect(iconElement)!.toHaveStyle({ background: '#FFF4ED' })+ expect(iconElement.querySelector('em-emoji'))!.toHaveAttribute('id', '📙')})it('should apply mask overlay on mobile when drawer is open', async () => {@@ -226,12 +226,12 @@ describe('dataset-config/card-item', () => {const card = screen.getByText(dataset.name).closest('.group') as HTMLElementconst [editButton] = within(card).getAllByRole('button', { hidden: true })- await user.click(editButton)- expect(screen.getByText('Mock settings modal')).toBeInTheDocument()+ await user.click(editButton!)+ expect(screen.getByText('Mock settings modal'))!.toBeInTheDocument()const overlay = [...document.querySelectorAll('[class]')].find(element => element.className.toString().includes('bg-black/30'))- expect(overlay).toBeInTheDocument()+ expect(overlay)!.toBeInTheDocument()})})diff --git a/web/app/components/app/configuration/dataset-config/context-var/__tests__/index.spec.tsx b/web/app/components/app/configuration/dataset-config/context-var/__tests__/index.spec.tsxindex 0d886fa9e5f..6726ba0583b 100644--- a/web/app/components/app/configuration/dataset-config/context-var/__tests__/index.spec.tsx+++ b/web/app/components/app/configuration/dataset-config/context-var/__tests__/index.spec.tsx@@ -87,7 +87,8 @@ describe('ContextVar', () => {render(<ContextVar {...props} />)// Assert- expect(screen.getByText('appDebug.feature.dataSet.queryVariable.title')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('appDebug.feature.dataSet.queryVariable.title'))!.toBeInTheDocument()})it('should show selected variable with proper formatting when value is provided', () => {@@ -98,9 +99,10 @@ describe('ContextVar', () => {render(<ContextVar {...props} />)// Assert- expect(screen.getByText('var1')).toBeInTheDocument()- expect(screen.getByText('{{')).toBeInTheDocument()- expect(screen.getByText('}}')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('var1'))!.toBeInTheDocument()+ expect(screen.getByText('{{'))!.toBeInTheDocument()+ expect(screen.getByText('}}'))!.toBeInTheDocument()})})@@ -114,7 +116,8 @@ describe('ContextVar', () => {render(<ContextVar {...props} />)// Assert - Should display the selected value- expect(screen.getByText('var2')).toBeInTheDocument()+ // Assert - Should display the selected value+ expect(screen.getByText('var2'))!.toBeInTheDocument()})it('should show placeholder text when no value is selected', () => {@@ -127,9 +130,40 @@ describe('ContextVar', () => {// Actrender(<ContextVar {...props} />)+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable+ // Assert - Should show placeholder instead of variable// Assert - Should show placeholder instead of variableexpect(screen.queryByText('var1')).not.toBeInTheDocument()- expect(screen.getByText('appDebug.feature.dataSet.queryVariable.choosePlaceholder')).toBeInTheDocument()+ expect(screen.getByText('appDebug.feature.dataSet.queryVariable.choosePlaceholder'))!.toBeInTheDocument()})it('should display custom tip message when notSelectedVarTip is provided', () => {@@ -144,7 +178,8 @@ describe('ContextVar', () => {render(<ContextVar {...props} />)// Assert- expect(screen.getByText('Select a variable')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('Select a variable'))!.toBeInTheDocument()})it('should apply custom className to VarPicker when provided', () => {@@ -158,7 +193,8 @@ describe('ContextVar', () => {const { container } = render(<ContextVar {...props} />)// Assert- expect(container.querySelector('.custom-class')).toBeInTheDocument()+ // Assert+ expect(container.querySelector('.custom-class'))!.toBeInTheDocument()})})@@ -176,13 +212,13 @@ describe('ContextVar', () => {const triggers = screen.getAllByTestId('portal-trigger')const varPickerTrigger = triggers[triggers.length - 1]- await user.click(varPickerTrigger)- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ await user.click(varPickerTrigger!)+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()// Select a different optionconst options = screen.getAllByText('var2')expect(options.length).toBeGreaterThan(0)- await user.click(options[0])+ await user.click(options[0]!)// Assertexpect(onChange).toHaveBeenCalledWith('var2')@@ -201,11 +237,11 @@ describe('ContextVar', () => {const varPickerTrigger = triggers[triggers.length - 1]// Open dropdown- await user.click(varPickerTrigger)- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ await user.click(varPickerTrigger!)+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()// Close dropdown- await user.click(varPickerTrigger)+ await user.click(varPickerTrigger!)expect(screen.queryByTestId('portal-content')).not.toBeInTheDocument()})})@@ -223,8 +259,9 @@ describe('ContextVar', () => {render(<ContextVar {...props} />)// Assert- expect(screen.getByText('appDebug.feature.dataSet.queryVariable.title')).toBeInTheDocument()- expect(screen.getByText('appDebug.feature.dataSet.queryVariable.choosePlaceholder')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('appDebug.feature.dataSet.queryVariable.title'))!.toBeInTheDocument()+ expect(screen.getByText('appDebug.feature.dataSet.queryVariable.choosePlaceholder'))!.toBeInTheDocument()expect(screen.queryByText('var1')).not.toBeInTheDocument()})@@ -240,8 +277,9 @@ describe('ContextVar', () => {render(<ContextVar {...props} />)// Assert- expect(screen.getByText('appDebug.feature.dataSet.queryVariable.title')).toBeInTheDocument()- expect(screen.getByText('appDebug.feature.dataSet.queryVariable.choosePlaceholder')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('appDebug.feature.dataSet.queryVariable.title'))!.toBeInTheDocument()+ expect(screen.getByText('appDebug.feature.dataSet.queryVariable.choosePlaceholder'))!.toBeInTheDocument()})it('should handle null value without crashing', () => {@@ -255,8 +293,9 @@ describe('ContextVar', () => {render(<ContextVar {...props} />)// Assert- expect(screen.getByText('appDebug.feature.dataSet.queryVariable.title')).toBeInTheDocument()- expect(screen.getByText('appDebug.feature.dataSet.queryVariable.choosePlaceholder')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('appDebug.feature.dataSet.queryVariable.title'))!.toBeInTheDocument()+ expect(screen.getByText('appDebug.feature.dataSet.queryVariable.choosePlaceholder'))!.toBeInTheDocument()})it('should handle options with different data types', () => {@@ -275,9 +314,10 @@ describe('ContextVar', () => {render(<ContextVar {...props} />)// Assert- expect(screen.getByText('strVar')).toBeInTheDocument()- expect(screen.getByText('{{')).toBeInTheDocument()- expect(screen.getByText('}}')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('strVar'))!.toBeInTheDocument()+ expect(screen.getByText('{{'))!.toBeInTheDocument()+ expect(screen.getByText('}}'))!.toBeInTheDocument()})it('should render variable names with special characters safely', () => {@@ -294,7 +334,8 @@ describe('ContextVar', () => {render(<ContextVar {...props} />)// Assert- expect(screen.getByText('specialVar')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('specialVar'))!.toBeInTheDocument()})})})diff --git a/web/app/components/app/configuration/dataset-config/context-var/__tests__/var-picker.spec.tsx b/web/app/components/app/configuration/dataset-config/context-var/__tests__/var-picker.spec.tsxindex 15052e9351f..1d81a310910 100644--- a/web/app/components/app/configuration/dataset-config/context-var/__tests__/var-picker.spec.tsx+++ b/web/app/components/app/configuration/dataset-config/context-var/__tests__/var-picker.spec.tsx@@ -88,8 +88,9 @@ describe('VarPicker', () => {render(<VarPicker {...props} />)// Assert- expect(screen.getByTestId('portal-trigger')).toBeInTheDocument()- expect(screen.getByText('var1')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('portal-trigger'))!.toBeInTheDocument()+ expect(screen.getByText('var1'))!.toBeInTheDocument()})it('should display selected variable with type icon when value is provided', () => {@@ -100,11 +101,13 @@ describe('VarPicker', () => {render(<VarPicker {...props} />)// Assert- expect(screen.getByText('var1')).toBeInTheDocument()- expect(screen.getByText('{{')).toBeInTheDocument()- expect(screen.getByText('}}')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('var1'))!.toBeInTheDocument()+ expect(screen.getByText('{{'))!.toBeInTheDocument()+ expect(screen.getByText('}}'))!.toBeInTheDocument()+ // IconTypeIcon should be rendered (check for svg icon)// IconTypeIcon should be rendered (check for svg icon)- expect(document.querySelector('svg')).toBeInTheDocument()+ expect(document.querySelector('svg'))!.toBeInTheDocument()})it('should show placeholder text when no value is selected', () => {@@ -117,9 +120,40 @@ describe('VarPicker', () => {// Actrender(<VarPicker {...props} />)+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert// Assertexpect(screen.queryByText('var1')).not.toBeInTheDocument()- expect(screen.getByText('appDebug.feature.dataSet.queryVariable.choosePlaceholder')).toBeInTheDocument()+ expect(screen.getByText('appDebug.feature.dataSet.queryVariable.choosePlaceholder'))!.toBeInTheDocument()})it('should display custom tip message when notSelectedVarTip is provided', () => {@@ -134,7 +168,8 @@ describe('VarPicker', () => {render(<VarPicker {...props} />)// Assert- expect(screen.getByText('Select a variable')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('Select a variable'))!.toBeInTheDocument()})it('should render dropdown indicator icon', () => {@@ -145,7 +180,8 @@ describe('VarPicker', () => {render(<VarPicker {...props} />)// Assert - Trigger should be present- expect(screen.getByTestId('portal-trigger')).toBeInTheDocument()+ // Assert - Trigger should be present+ expect(screen.getByTestId('portal-trigger'))!.toBeInTheDocument()})})@@ -162,7 +198,8 @@ describe('VarPicker', () => {const { container } = render(<VarPicker {...props} />)// Assert- expect(container.querySelector('.custom-class')).toBeInTheDocument()+ // Assert+ expect(container.querySelector('.custom-class'))!.toBeInTheDocument()})it('should apply custom triggerClassName to trigger button', () => {@@ -176,7 +213,8 @@ describe('VarPicker', () => {render(<VarPicker {...props} />)// Assert- expect(screen.getByTestId('portal-trigger')).toHaveClass('custom-trigger-class')+ // Assert+ expect(screen.getByTestId('portal-trigger'))!.toHaveClass('custom-trigger-class')})it('should display selected value with proper formatting', () => {@@ -193,9 +231,10 @@ describe('VarPicker', () => {render(<VarPicker {...props} />)// Assert- expect(screen.getByText('customVar')).toBeInTheDocument()- expect(screen.getByText('{{')).toBeInTheDocument()- expect(screen.getByText('}}')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('customVar'))!.toBeInTheDocument()+ expect(screen.getByText('{{'))!.toBeInTheDocument()+ expect(screen.getByText('}}'))!.toBeInTheDocument()})})@@ -212,7 +251,8 @@ describe('VarPicker', () => {await user.click(screen.getByTestId('portal-trigger'))// Assert- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()})it('should call onChange and close dropdown when selecting an option', async () => {@@ -226,12 +266,12 @@ describe('VarPicker', () => {// Open dropdownawait user.click(screen.getByTestId('portal-trigger'))- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()// Select a different optionconst options = screen.getAllByText('var2')expect(options.length).toBeGreaterThan(0)- await user.click(options[0])+ await user.click(options[0]!)// Assertexpect(onChange).toHaveBeenCalledWith('var2')@@ -250,7 +290,7 @@ describe('VarPicker', () => {// Open dropdownawait user.click(trigger)- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()// Close dropdownawait user.click(trigger)@@ -267,6 +307,37 @@ describe('VarPicker', () => {// Actrender(<VarPicker {...props} />)+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert// Assertexpect(screen.queryByTestId('portal-content')).not.toBeInTheDocument()})@@ -284,7 +355,7 @@ describe('VarPicker', () => {// Open dropdownawait user.click(trigger)- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()// Close dropdownawait user.click(trigger)@@ -305,7 +376,8 @@ describe('VarPicker', () => {await user.click(trigger)// Assert- expect(screen.getByText('var1')).toBeInTheDocument() // Original value still displayed+ // Assert+ expect(screen.getByText('var1'))!.toBeInTheDocument() // Original value still displayed})})@@ -322,8 +394,9 @@ describe('VarPicker', () => {render(<VarPicker {...props} />)// Assert- expect(screen.getByText('appDebug.feature.dataSet.queryVariable.choosePlaceholder')).toBeInTheDocument()- expect(screen.getByTestId('portal-trigger')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('appDebug.feature.dataSet.queryVariable.choosePlaceholder'))!.toBeInTheDocument()+ expect(screen.getByTestId('portal-trigger'))!.toBeInTheDocument()})it('should handle empty options array', () => {@@ -338,8 +411,9 @@ describe('VarPicker', () => {render(<VarPicker {...props} />)// Assert- expect(screen.getByTestId('portal-trigger')).toBeInTheDocument()- expect(screen.getByText('appDebug.feature.dataSet.queryVariable.choosePlaceholder')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('portal-trigger'))!.toBeInTheDocument()+ expect(screen.getByText('appDebug.feature.dataSet.queryVariable.choosePlaceholder'))!.toBeInTheDocument()})it('should handle null value without crashing', () => {@@ -353,7 +427,8 @@ describe('VarPicker', () => {render(<VarPicker {...props} />)// Assert- expect(screen.getByText('appDebug.feature.dataSet.queryVariable.choosePlaceholder')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('appDebug.feature.dataSet.queryVariable.choosePlaceholder'))!.toBeInTheDocument()})it('should handle variable names with special characters safely', () => {@@ -370,7 +445,8 @@ describe('VarPicker', () => {render(<VarPicker {...props} />)// Assert- expect(screen.getByText('specialVar')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('specialVar'))!.toBeInTheDocument()})it('should handle long variable names', () => {@@ -387,8 +463,9 @@ describe('VarPicker', () => {render(<VarPicker {...props} />)// Assert- expect(screen.getByText('longVar')).toBeInTheDocument()- expect(screen.getByTestId('portal-trigger')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('longVar'))!.toBeInTheDocument()+ expect(screen.getByTestId('portal-trigger'))!.toBeInTheDocument()})})})diff --git a/web/app/components/app/configuration/dataset-config/params-config/__tests__/config-content.spec.tsx b/web/app/components/app/configuration/dataset-config/params-config/__tests__/config-content.spec.tsxindex 6d734763ea9..a17b39e4b45 100644--- a/web/app/components/app/configuration/dataset-config/params-config/__tests__/config-content.spec.tsx+++ b/web/app/components/app/configuration/dataset-config/params-config/__tests__/config-content.spec.tsx@@ -203,7 +203,7 @@ describe('ConfigContent', () => {await waitFor(() => {expect(onChange).toHaveBeenCalled()})- const [nextConfigs] = onChange.mock.calls[0]+ const [nextConfigs] = (onChange.mock.calls[0] ?? []) as [any]expect(nextConfigs.retrieval_model).toBe(RETRIEVE_TYPE.multiWay)})})@@ -239,10 +239,11 @@ describe('ConfigContent', () => {)// Assert- expect(screen.getByText('dataset.weightedScore.title')).toBeInTheDocument()- expect(screen.getByText('common.modelProvider.rerankModel.key')).toBeInTheDocument()- expect(screen.getByText('dataset.weightedScore.semantic')).toBeInTheDocument()- expect(screen.getByText('dataset.weightedScore.keyword')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('dataset.weightedScore.title'))!.toBeInTheDocument()+ expect(screen.getByText('common.modelProvider.rerankModel.key'))!.toBeInTheDocument()+ expect(screen.getByText('dataset.weightedScore.semantic'))!.toBeInTheDocument()+ expect(screen.getByText('dataset.weightedScore.keyword'))!.toBeInTheDocument()})})diff --git a/web/app/components/app/configuration/dataset-config/params-config/__tests__/index.spec.tsx b/web/app/components/app/configuration/dataset-config/params-config/__tests__/index.spec.tsxindex d75f46b371c..a892de7feea 100644--- a/web/app/components/app/configuration/dataset-config/params-config/__tests__/index.spec.tsx+++ b/web/app/components/app/configuration/dataset-config/params-config/__tests__/index.spec.tsx@@ -164,7 +164,8 @@ describe('dataset-config/params-config', () => {renderParamsConfig({ disabled: true })// Assert- expect(screen.getByRole('button', { name: 'dataset.retrievalSettings' })).toBeDisabled()+ // Assert+ expect(screen.getByRole('button', { name: 'dataset.retrievalSettings' }))!.toBeDisabled()})})@@ -181,11 +182,11 @@ describe('dataset-config/params-config', () => {const dialogScope = within(dialog)const incrementButtons = dialogScope.getAllByRole('button', { name: /increment/i })- await user.click(incrementButtons[0])+ await user.click(incrementButtons[0]!)await waitFor(() => {const [topKInput] = dialogScope.getAllByRole('textbox')- expect(topKInput).toHaveValue('5')+ expect(topKInput)!.toHaveValue('5')})await user.click(dialogScope.getByRole('button', { name: 'common.operation.save' }))@@ -200,7 +201,8 @@ describe('dataset-config/params-config', () => {const [reopenedTopKInput] = reopenedScope.getAllByRole('textbox')// Assert- expect(reopenedTopKInput).toHaveValue('5')+ // Assert+ expect(reopenedTopKInput)!.toHaveValue('5')})it('should discard changes when cancel is clicked', async () => {@@ -214,11 +216,11 @@ describe('dataset-config/params-config', () => {const dialogScope = within(dialog)const incrementButtons = dialogScope.getAllByRole('button', { name: /increment/i })- await user.click(incrementButtons[0])+ await user.click(incrementButtons[0]!)await waitFor(() => {const [topKInput] = dialogScope.getAllByRole('textbox')- expect(topKInput).toHaveValue('5')+ expect(topKInput)!.toHaveValue('5')})const cancelButton = await dialogScope.findByRole('button', { name: 'common.operation.cancel' })@@ -234,7 +236,8 @@ describe('dataset-config/params-config', () => {const [reopenedTopKInput] = reopenedScope.getAllByRole('textbox')// Assert- expect(reopenedTopKInput).toHaveValue('4')+ // Assert+ expect(reopenedTopKInput)!.toHaveValue('4')})it('should prevent saving when rerank model is required but invalid', async () => {@@ -255,7 +258,7 @@ describe('dataset-config/params-config', () => {// Assertexpect(toastErrorSpy).toHaveBeenCalledWith('appDebug.datasetConfig.rerankModelRequired')- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})})})diff --git a/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx b/web/app/components/app/configuration/dataset-config/params-config/config-content.tsxindex f712d7017aa..bb260fb4997 100644--- a/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx+++ b/web/app/components/app/configuration/dataset-config/params-config/config-content.tsx@@ -121,10 +121,10 @@ const ConfigContent: FC<Props> = ({...datasetConfigs.weights!,vector_setting: {...datasetConfigs.weights!.vector_setting!,- vector_weight: value.value[0],+ vector_weight: value.value[0]!,},keyword_setting: {- keyword_weight: value.value[1],+ keyword_weight: value.value[1]!,},},}diff --git a/web/app/components/app/configuration/dataset-config/params-config/weighted-score.tsx b/web/app/components/app/configuration/dataset-config/params-config/weighted-score.tsxindex d4ce935a4df..c8f7bc49ec3 100644--- a/web/app/components/app/configuration/dataset-config/params-config/weighted-score.tsx+++ b/web/app/components/app/configuration/dataset-config/params-config/weighted-score.tsx@@ -54,10 +54,10 @@ const WeightedScore = ({<div className="mr-1 truncate uppercase" title={t('weightedScore.semantic', { ns: 'dataset' }) || ''}>{t('weightedScore.semantic', { ns: 'dataset' })}</div>- {formatNumber(value.value[0])}+ {formatNumber(value.value[0]!)}</div><div className="flex w-[90px] shrink-0 items-center justify-end text-util-colors-teal-teal-500 system-xs-semibold-uppercase">- {formatNumber(value.value[1])}+ {formatNumber(value.value[1]!)}<div className="ml-1 truncate uppercase" title={t('weightedScore.keyword', { ns: 'dataset' }) || ''}>{t('weightedScore.keyword', { ns: 'dataset' })}</div>diff --git a/web/app/components/app/configuration/dataset-config/settings-modal/__tests__/retrieval-section.spec.tsx b/web/app/components/app/configuration/dataset-config/settings-modal/__tests__/retrieval-section.spec.tsxindex e100ed94902..e4e3f5ab71c 100644--- a/web/app/components/app/configuration/dataset-config/settings-modal/__tests__/retrieval-section.spec.tsx+++ b/web/app/components/app/configuration/dataset-config/settings-modal/__tests__/retrieval-section.spec.tsx@@ -152,7 +152,8 @@ describe('RetrievalChangeTip', () => {await userEvent.click(screen.getByRole('button', { name: 'close-retrieval-change-tip' }))// Assert- expect(screen.getByText('Test message')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('Test message'))!.toBeInTheDocument()expect(onDismiss).toHaveBeenCalledTimes(1)})@@ -160,6 +161,37 @@ describe('RetrievalChangeTip', () => {// Arrange & Actrender(<RetrievalChangeTip {...defaultProps} visible={false} />)+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert// Assertexpect(screen.queryByText('Test message')).not.toBeInTheDocument()})@@ -213,12 +245,13 @@ describe('RetrievalSection', () => {/>,)const [topKIncrement] = screen.getAllByRole('button', { name: /increment/i })- await userEvent.click(topKIncrement)+ await userEvent.click(topKIncrement!)// Assert- expect(screen.getByText('External API')).toBeInTheDocument()- expect(screen.getByText('https://api.external.com')).toBeInTheDocument()- expect(screen.getByText('ext-id-999')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('External API'))!.toBeInTheDocument()+ expect(screen.getByText('https://api.external.com'))!.toBeInTheDocument()+ expect(screen.getByText('ext-id-999'))!.toBeInTheDocument()expect(handleExternalChange).toHaveBeenCalledWith(expect.objectContaining({ top_k: 4 }))})@@ -243,9 +276,10 @@ describe('RetrievalSection', () => {)// Assert- expect(screen.getByText('dataset.retrieval.semantic_search.title')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('dataset.retrieval.semantic_search.title'))!.toBeInTheDocument()const learnMoreLink = screen.getByRole('link', { name: 'datasetSettings.form.retrievalSetting.learnMore' })- expect(learnMoreLink).toHaveAttribute('href', 'https://docs.example/use-dify/knowledge/create-knowledge/setting-indexing-methods')+ expect(learnMoreLink)!.toHaveAttribute('href', 'https://docs.example/use-dify/knowledge/create-knowledge/setting-indexing-methods')expect(docLink).toHaveBeenCalledWith('/use-dify/knowledge/create-knowledge/setting-indexing-methods')})@@ -268,10 +302,11 @@ describe('RetrievalSection', () => {/>,)const [topKIncrement] = screen.getAllByRole('button', { name: /increment/i })- await userEvent.click(topKIncrement)+ await userEvent.click(topKIncrement!)// Assert- expect(screen.getByText('dataset.retrieval.keyword_search.title')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('dataset.retrieval.keyword_search.title'))!.toBeInTheDocument()expect(handleRetrievalChange).toHaveBeenCalledWith(expect.objectContaining({top_k: 3,}))diff --git a/web/app/components/app/configuration/debug/__tests__/index.spec.tsx b/web/app/components/app/configuration/debug/__tests__/index.spec.tsxindex 071307303b6..4a50ecc626e 100644--- a/web/app/components/app/configuration/debug/__tests__/index.spec.tsx+++ b/web/app/components/app/configuration/debug/__tests__/index.spec.tsx@@ -479,8 +479,8 @@ describe('Debug', () => {},})- expect(screen.getByText('appDebug.noModelProviderConfigured')).toBeInTheDocument()- expect(screen.getByText('appDebug.noModelProviderConfiguredTip')).toBeInTheDocument()+ expect(screen.getByText('appDebug.noModelProviderConfigured'))!.toBeInTheDocument()+ expect(screen.getByText('appDebug.noModelProviderConfiguredTip'))!.toBeInTheDocument()fireEvent.click(screen.getByRole('button', { name: 'appDebug.manageModels' }))expect(onSetting).toHaveBeenCalledTimes(1)@@ -500,8 +500,8 @@ describe('Debug', () => {},})- expect(screen.getByText('appDebug.noModelSelected')).toBeInTheDocument()- expect(screen.getByText('appDebug.noModelSelectedTip')).toBeInTheDocument()+ expect(screen.getByText('appDebug.noModelSelected'))!.toBeInTheDocument()+ expect(screen.getByText('appDebug.noModelSelectedTip'))!.toBeInTheDocument()expect(screen.queryByText('appDebug.noModelProviderConfigured')).not.toBeInTheDocument()})})@@ -510,9 +510,9 @@ describe('Debug', () => {it('should render single-model panel and refresh conversation', () => {renderDebug()- expect(screen.getByTestId('debug-with-single-model')).toBeInTheDocument()+ expect(screen.getByTestId('debug-with-single-model'))!.toBeInTheDocument()- fireEvent.click(screen.getAllByTestId('action-button')[0])+ fireEvent.click(screen.getAllByTestId('action-button')[0]!)expect(mockState.mockHandleRestart).toHaveBeenCalledTimes(1)})@@ -535,8 +535,8 @@ describe('Debug', () => {},})- expect(screen.getByTestId('chat-user-input')).toBeInTheDocument()- fireEvent.click(screen.getAllByTestId('action-button')[1])+ expect(screen.getByTestId('chat-user-input'))!.toBeInTheDocument()+ fireEvent.click(screen.getAllByTestId('action-button')[1]!)expect(screen.queryByTestId('chat-user-input')).not.toBeInTheDocument()})@@ -560,7 +560,7 @@ describe('Debug', () => {},})- expect(screen.getByTestId('formatting-changed')).toBeInTheDocument()+ expect(screen.getByTestId('formatting-changed'))!.toBeInTheDocument()fireEvent.click(screen.getByTestId('formatting-cancel'))expect(setFormattingChanged).toHaveBeenCalledWith(false)})@@ -623,8 +623,8 @@ describe('Debug', () => {},})- expect(screen.getByTestId('prompt-value-panel')).toBeInTheDocument()- expect(screen.getByText('appDebug.noResult')).toBeInTheDocument()+ expect(screen.getByTestId('prompt-value-panel'))!.toBeInTheDocument()+ expect(screen.getByText('appDebug.noResult'))!.toBeInTheDocument()})it('should notify when required input is missing', () => {@@ -696,7 +696,7 @@ describe('Debug', () => {})fireEvent.click(screen.getByTestId('panel-send'))- expect(screen.getByTestId('cannot-query-dataset')).toBeInTheDocument()+ expect(screen.getByTestId('cannot-query-dataset'))!.toBeInTheDocument()fireEvent.click(screen.getByTestId('cannot-query-confirm'))expect(screen.queryByTestId('cannot-query-dataset')).not.toBeInTheDocument()@@ -752,7 +752,7 @@ describe('Debug', () => {fireEvent.click(screen.getByTestId('panel-send'))await waitFor(() => expect(mockState.mockSendCompletionMessage).toHaveBeenCalledTimes(1))- const [, requestData] = mockState.mockSendCompletionMessage.mock.calls[0]+ const [, requestData] = (mockState.mockSendCompletionMessage.mock.calls[0] ?? []) as [unknown, any]expect(requestData).toMatchObject({inputs: { question: 'hello' },model_config: {@@ -763,9 +763,9 @@ describe('Debug', () => {dataset_query_variable: 'question',},})- expect(screen.getByTestId('text-generation')).toHaveTextContent('final answer')- expect(screen.getByTestId('text-generation')).toHaveAttribute('data-message-id', 'msg-1')- expect(screen.getByTestId('text-generation')).toHaveAttribute('data-tts', 'true')+ expect(screen.getByTestId('text-generation'))!.toHaveTextContent('final answer')+ expect(screen.getByTestId('text-generation'))!.toHaveAttribute('data-message-id', 'msg-1')+ expect(screen.getByTestId('text-generation'))!.toHaveAttribute('data-tts', 'true')})it('should notify when sending again while a response is in progress', async () => {@@ -830,7 +830,7 @@ describe('Debug', () => {fireEvent.click(screen.getByTestId('panel-send'))await waitFor(() => expect(mockState.mockSendCompletionMessage).toHaveBeenCalledTimes(1))- expect(screen.getByText('appDebug.noResult')).toBeInTheDocument()+ expect(screen.getByText('appDebug.noResult'))!.toBeInTheDocument()})it('should render prompt log modal in completion mode when store flag is enabled', () => {@@ -845,7 +845,7 @@ describe('Debug', () => {},})- expect(screen.getByTestId('prompt-log-modal')).toBeInTheDocument()+ expect(screen.getByTestId('prompt-log-modal'))!.toBeInTheDocument()})it('should close prompt log modal in completion mode', () => {@@ -904,7 +904,7 @@ describe('Debug', () => {},})- expect(screen.getByRole('button', { name: 'common.modelProvider.addModel(4/4)' })).toBeDisabled()+ expect(screen.getByRole('button', { name: 'common.modelProvider.addModel(4/4)' }))!.toBeDisabled()})it('should emit completion event in multiple-model completion mode', () => {@@ -945,7 +945,7 @@ describe('Debug', () => {},})- fireEvent.click(screen.getAllByTestId('action-button')[0])+ fireEvent.click(screen.getAllByTestId('action-button')[0]!)expect(mockState.mockEventEmitterEmit).toHaveBeenCalledWith({type: APP_CHAT_WITH_MULTIPLE_MODEL_RESTART,})@@ -1012,8 +1012,8 @@ describe('Debug', () => {},})- expect(screen.getByTestId('prompt-log-modal')).toBeInTheDocument()- expect(screen.getByTestId('agent-log-modal')).toBeInTheDocument()+ expect(screen.getByTestId('prompt-log-modal'))!.toBeInTheDocument()+ expect(screen.getByTestId('agent-log-modal'))!.toBeInTheDocument()})it('should close prompt and agent log modals in multiple-model mode', () => {diff --git a/web/app/components/app/configuration/debug/debug-with-multiple-model/__tests__/context-provider.spec.tsx b/web/app/components/app/configuration/debug/debug-with-multiple-model/__tests__/context-provider.spec.tsxindex 5608f4c5a2a..6ed016ecc75 100644--- a/web/app/components/app/configuration/debug/debug-with-multiple-model/__tests__/context-provider.spec.tsx+++ b/web/app/components/app/configuration/debug/debug-with-multiple-model/__tests__/context-provider.spec.tsx@@ -8,7 +8,7 @@ const ContextConsumer = () => {<div><div>{value.multipleModelConfigs.length}</div><button onClick={() => value.onMultipleModelConfigsChange(true, value.multipleModelConfigs)}>change-multiple</button>- <button onClick={() => value.onDebugWithMultipleModelChange(value.multipleModelConfigs[0])}>change-single</button>+ <button onClick={() => value.onDebugWithMultipleModelChange(value.multipleModelConfigs[0]!)}>change-single</button><div>{String(value.checkCanSend?.())}</div></div>)@@ -32,7 +32,7 @@ describe('DebugWithMultipleModelContextProvider', () => {</DebugWithMultipleModelContextProvider>,)- expect(screen.getByText('1')).toBeInTheDocument()- expect(screen.getByText('true')).toBeInTheDocument()+ expect(screen.getByText('1'))!.toBeInTheDocument()+ expect(screen.getByText('true'))!.toBeInTheDocument()})})diff --git a/web/app/components/app/configuration/debug/debug-with-multiple-model/__tests__/debug-item.spec.tsx b/web/app/components/app/configuration/debug/debug-with-multiple-model/__tests__/debug-item.spec.tsxindex 19c5fbf3fa4..747ea4efcb6 100644--- a/web/app/components/app/configuration/debug/debug-with-multiple-model/__tests__/debug-item.spec.tsx+++ b/web/app/components/app/configuration/debug/debug-with-multiple-model/__tests__/debug-item.spec.tsx@@ -141,8 +141,8 @@ describe('DebugItem', () => {it('should render with basic props', () => {renderComponent()- expect(screen.getByTestId('model-parameter-trigger')).toBeInTheDocument()- expect(screen.getByTestId('dropdown')).toBeInTheDocument()+ expect(screen.getByTestId('model-parameter-trigger'))!.toBeInTheDocument()+ expect(screen.getByTestId('dropdown'))!.toBeInTheDocument()})it('should display correct index number', () => {@@ -170,7 +170,7 @@ describe('DebugItem', () => {})const wrapper = container.firstChild as HTMLElement- expect(wrapper).toHaveClass('custom-class')+ expect(wrapper)!.toHaveClass('custom-class')expect(wrapper.style.backgroundColor).toBe('red')})@@ -193,7 +193,7 @@ describe('DebugItem', () => {renderComponent()- expect(screen.getByTestId('chat-item')).toBeInTheDocument()+ expect(screen.getByTestId('chat-item'))!.toBeInTheDocument()expect(screen.queryByTestId('text-generation-item')).not.toBeInTheDocument()})@@ -207,7 +207,7 @@ describe('DebugItem', () => {renderComponent()- expect(screen.getByTestId('chat-item')).toBeInTheDocument()+ expect(screen.getByTestId('chat-item'))!.toBeInTheDocument()})it('should not render ChatItem when model is not active', () => {@@ -261,7 +261,7 @@ describe('DebugItem', () => {renderComponent()- expect(screen.getByTestId('text-generation-item')).toBeInTheDocument()+ expect(screen.getByTestId('text-generation-item'))!.toBeInTheDocument()expect(screen.queryByTestId('chat-item')).not.toBeInTheDocument()})@@ -502,7 +502,7 @@ describe('DebugItem', () => {expect.arrayContaining([models[0],models[1],- expect.objectContaining({ model: models[1].model }),+ expect.objectContaining({ model: models[1]!.model }),models[2],]),)@@ -545,6 +545,37 @@ describe('DebugItem', () => {renderComponent()+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render+ // When provider/model doesn't match, ChatItem won't render// When provider/model doesn't match, ChatItem won't renderexpect(screen.queryByTestId('chat-item')).not.toBeInTheDocument()})diff --git a/web/app/components/app/configuration/debug/debug-with-multiple-model/__tests__/index.spec.tsx b/web/app/components/app/configuration/debug/debug-with-multiple-model/__tests__/index.spec.tsxindex f1ee03ebbc9..bd12ff2c142 100644--- a/web/app/components/app/configuration/debug/debug-with-multiple-model/__tests__/index.spec.tsx+++ b/web/app/components/app/configuration/debug/debug-with-multiple-model/__tests__/index.spec.tsx@@ -194,13 +194,13 @@ describe('DebugWithMultipleModel', () => {it('should handle empty multipleModelConfigs array', () => {renderComponent({ multipleModelConfigs: [] })expect(screen.queryByTestId('debug-item')).not.toBeInTheDocument()- expect(screen.getByTestId('chat-input-area')).toBeInTheDocument()+ expect(screen.getByTestId('chat-input-area'))!.toBeInTheDocument()})it('should handle model config with missing required fields', () => {const incompleteConfig = { id: 'incomplete' } as ModelAndParameterrenderComponent({ multipleModelConfigs: [incompleteConfig] })- expect(screen.getByTestId('debug-item')).toBeInTheDocument()+ expect(screen.getByTestId('debug-item'))!.toBeInTheDocument()})it('should handle more than 4 model configs', () => {@@ -257,7 +257,8 @@ describe('DebugWithMultipleModel', () => {renderComponent()// Should still render but handle gracefully- expect(screen.getByTestId('chat-input-area')).toBeInTheDocument()+ // Should still render but handle gracefully+ expect(screen.getByTestId('chat-input-area'))!.toBeInTheDocument()expect(capturedChatInputProps?.inputsForm).toHaveLength(3)})})@@ -287,7 +288,7 @@ describe('DebugWithMultipleModel', () => {rerender(<DebugWithMultipleModel {...props2} />)const items = screen.getAllByTestId('debug-item')- expect(items[0]).toHaveAttribute('data-model-id', 'model-2')+ expect(items[0])!.toHaveAttribute('data-model-id', 'model-2')})})@@ -296,14 +297,14 @@ describe('DebugWithMultipleModel', () => {renderComponent()const chatInput = screen.getByTestId('chat-input-area')- expect(chatInput).toBeInTheDocument()+ expect(chatInput)!.toBeInTheDocument()// Check for button accessibilityconst sendButton = screen.getByRole('button', { name: /send/i })- expect(sendButton).toBeInTheDocument()+ expect(sendButton)!.toBeInTheDocument()const featureButton = screen.getByRole('button', { name: /feature/i })- expect(featureButton).toBeInTheDocument()+ expect(featureButton)!.toBeInTheDocument()})it('should apply ARIA attributes correctly', () => {@@ -312,8 +313,8 @@ describe('DebugWithMultipleModel', () => {// Debug items should be identifiableconst debugItem = screen.getByTestId('debug-item')- expect(debugItem).toBeInTheDocument()- expect(debugItem).toHaveAttribute('data-model-id')+ expect(debugItem)!.toBeInTheDocument()+ expect(debugItem)!.toHaveAttribute('data-model-id')})})@@ -422,7 +423,8 @@ describe('DebugWithMultipleModel', () => {fireEvent.click(screen.getByRole('button', { name: /feature/i }))// Assert- expect(screen.getByTestId('chat-input-area')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('chat-input-area'))!.toBeInTheDocument()expect(capturedChatInputProps?.inputs).toEqual({ audience: 'engineers' })expect(capturedChatInputProps?.inputsForm).toEqual([expect.objectContaining({ label: 'City', variable: 'city', hide: false, required: true }),@@ -446,7 +448,8 @@ describe('DebugWithMultipleModel', () => {renderComponent()// Assert- expect(screen.getByTestId('chat-input-area')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('chat-input-area'))!.toBeInTheDocument()})it('should hide chat input when not in chat mode', () => {@@ -459,6 +462,37 @@ describe('DebugWithMultipleModel', () => {// ActrenderComponent({ multipleModelConfigs })+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert// Assertexpect(screen.queryByTestId('chat-input-area')).not.toBeInTheDocument()expect(screen.getAllByTestId('debug-item')).toHaveLength(1)@@ -538,7 +572,8 @@ describe('DebugWithMultipleModel', () => {expect(secondItems).toHaveLength(1)// Check that the element still renders the same content- expect(firstItems[0]).toHaveTextContent(secondItems[0].textContent || '')+ // Check that the element still renders the same content+ expect(firstItems[0])!.toHaveTextContent(secondItems[0]!.textContent || '')})it('should recalculate size and position when number of models changes', () => {@@ -557,8 +592,8 @@ describe('DebugWithMultipleModel', () => {)const twoItems = screen.getAllByTestId('debug-item')- expect(twoItems[0].style.width).toBe('calc(50% - 4px - 24px)')- expect(twoItems[1].style.width).toBe('calc(50% - 4px - 24px)')+ expect(twoItems[0]!.style.width).toBe('calc(50% - 4px - 24px)')+ expect(twoItems[1]!.style.width).toBe('calc(50% - 4px - 24px)')})})@@ -583,7 +618,7 @@ describe('DebugWithMultipleModel', () => {expect(element.style.height).toBe('')expect(element.style.transform).toBe(expectation.transform)- expectation.classes?.forEach(cls => expect(element).toHaveClass(cls))+ expectation.classes?.forEach(cls => expect(element)!.toHaveClass(cls))}it('should arrange items in two-column layout for two models', () => {@@ -596,13 +631,13 @@ describe('DebugWithMultipleModel', () => {// Assertexpect(items).toHaveLength(2)- expectItemLayout(items[0], {+ expectItemLayout(items[0]!, {width: 'calc(50% - 4px - 24px)',height: '100%',transform: 'translateX(0) translateY(0)',classes: ['mr-2'],})- expectItemLayout(items[1], {+ expectItemLayout(items[1]!, {width: 'calc(50% - 4px - 24px)',height: '100%',transform: 'translateX(calc(100% + 8px)) translateY(0)',@@ -620,19 +655,19 @@ describe('DebugWithMultipleModel', () => {// Assertexpect(items).toHaveLength(3)- expectItemLayout(items[0], {+ expectItemLayout(items[0]!, {width: 'calc(33.3% - 5.33px - 16px)',height: '100%',transform: 'translateX(0) translateY(0)',classes: ['mr-2'],})- expectItemLayout(items[1], {+ expectItemLayout(items[1]!, {width: 'calc(33.3% - 5.33px - 16px)',height: '100%',transform: 'translateX(calc(100% + 8px)) translateY(0)',classes: ['mr-2'],})- expectItemLayout(items[2], {+ expectItemLayout(items[2]!, {width: 'calc(33.3% - 5.33px - 16px)',height: '100%',transform: 'translateX(calc(200% + 16px)) translateY(0)',@@ -655,25 +690,25 @@ describe('DebugWithMultipleModel', () => {// Assertexpect(items).toHaveLength(4)- expectItemLayout(items[0], {+ expectItemLayout(items[0]!, {width: 'calc(50% - 4px - 24px)',height: 'calc(50% - 4px)',transform: 'translateX(0) translateY(0)',classes: ['mr-2', 'mb-2'],})- expectItemLayout(items[1], {+ expectItemLayout(items[1]!, {width: 'calc(50% - 4px - 24px)',height: 'calc(50% - 4px)',transform: 'translateX(calc(100% + 8px)) translateY(0)',classes: ['mb-2'],})- expectItemLayout(items[2], {+ expectItemLayout(items[2]!, {width: 'calc(50% - 4px - 24px)',height: 'calc(50% - 4px)',transform: 'translateX(0) translateY(calc(100% + 8px))',classes: ['mr-2'],})- expectItemLayout(items[3], {+ expectItemLayout(items[3]!, {width: 'calc(50% - 4px - 24px)',height: 'calc(50% - 4px)',transform: 'translateX(calc(100% + 8px)) translateY(calc(100% + 8px))',@@ -699,7 +734,7 @@ describe('DebugWithMultipleModel', () => {it('should set scroll area height for chat modes', () => {const { container } = renderComponent()const scrollArea = container.querySelector('.relative.mb-3.grow.overflow-auto.px-6') as HTMLElement- expect(scrollArea).toBeInTheDocument()+ expect(scrollArea)!.toBeInTheDocument()expect(scrollArea.style.height).toBe('calc(100% - 60px)')})diff --git a/web/app/components/app/configuration/debug/debug-with-multiple-model/model-parameter-trigger.tsx b/web/app/components/app/configuration/debug/debug-with-multiple-model/model-parameter-trigger.tsxindex 65e6067e1a8..a870538edc8 100644--- a/web/app/components/app/configuration/debug/debug-with-multiple-model/model-parameter-trigger.tsx+++ b/web/app/components/app/configuration/debug/debug-with-multiple-model/model-parameter-trigger.tsx@@ -40,7 +40,7 @@ const ModelParameterTrigger: FC<ModelParameterTriggerProps> = ({const handleSelectModel = ({ modelId, provider }: { modelId: string, provider: string }) => {const newModelConfigs = [...multipleModelConfigs]newModelConfigs[index] = {- ...newModelConfigs[index],+ ...newModelConfigs[index]!,model: modelId,provider,}@@ -49,7 +49,7 @@ const ModelParameterTrigger: FC<ModelParameterTriggerProps> = ({const handleParamsChange = (params: FormValue) => {const newModelConfigs = [...multipleModelConfigs]newModelConfigs[index] = {- ...newModelConfigs[index],+ ...newModelConfigs[index]!,parameters: params,}onMultipleModelConfigsChange(true, newModelConfigs)diff --git a/web/app/components/app/configuration/debug/debug-with-single-model/__tests__/index.spec.tsx b/web/app/components/app/configuration/debug/debug-with-single-model/__tests__/index.spec.tsxindex 0ab6e86c17b..634dd6217f3 100644--- a/web/app/components/app/configuration/debug/debug-with-single-model/__tests__/index.spec.tsx+++ b/web/app/components/app/configuration/debug/debug-with-single-model/__tests__/index.spec.tsx@@ -591,9 +591,10 @@ describe('DebugWithSingleModel', () => {render(<DebugWithSingleModel ref={ref as RefObject<DebugWithSingleModelRefType>} />)// Verify Chat component is rendered- expect(screen.getByTestId('chat-component')).toBeInTheDocument()- expect(screen.getByTestId('chat-input')).toBeInTheDocument()- expect(screen.getByTestId('send-button')).toBeInTheDocument()+ // Verify Chat component is rendered+ expect(screen.getByTestId('chat-component'))!.toBeInTheDocument()+ expect(screen.getByTestId('chat-input'))!.toBeInTheDocument()+ expect(screen.getByTestId('send-button'))!.toBeInTheDocument()})it('should render with custom checkCanSend prop', () => {@@ -601,7 +602,7 @@ describe('DebugWithSingleModel', () => {render(<DebugWithSingleModel ref={ref as RefObject<DebugWithSingleModelRefType>} checkCanSend={checkCanSend} />)- expect(screen.getByTestId('chat-component')).toBeInTheDocument()+ expect(screen.getByTestId('chat-component'))!.toBeInTheDocument()})})@@ -620,7 +621,7 @@ describe('DebugWithSingleModel', () => {expect(mockSsePost).toHaveBeenCalled()})- expect(mockSsePost.mock.calls[0][0]).toBe('apps/test-app-id/chat-messages')+ expect(mockSsePost.mock.calls[0]![0]).toBe('apps/test-app-id/chat-messages')})it('should prevent send when checkCanSend returns false', async () => {@@ -666,7 +667,7 @@ describe('DebugWithSingleModel', () => {expect(mockSsePost).toHaveBeenCalled()})- const body = mockSsePost.mock.calls[0][1].body+ const body = mockSsePost.mock.calls[0]![1].bodyexpect(body.model_config.opening_statement).toBe('Hello!')expect(body.model_config.suggested_questions).toEqual(['Q1'])})@@ -685,7 +686,7 @@ describe('DebugWithSingleModel', () => {expect(mockSsePost).toHaveBeenCalled()})- const body = mockSsePost.mock.calls[0][1].body+ const body = mockSsePost.mock.calls[0]![1].bodyexpect(body.model_config.opening_statement).toBe('')expect(body.model_config.suggested_questions).toEqual([])})@@ -717,7 +718,7 @@ describe('DebugWithSingleModel', () => {render(<DebugWithSingleModel ref={ref as RefObject<DebugWithSingleModelRefType>} />)- expect(screen.getByTestId('chat-component')).toBeInTheDocument()+ expect(screen.getByTestId('chat-component'))!.toBeInTheDocument()})it('should handle missing model in provider list', () => {@@ -735,7 +736,7 @@ describe('DebugWithSingleModel', () => {render(<DebugWithSingleModel ref={ref as RefObject<DebugWithSingleModelRefType>} />)- expect(screen.getByTestId('chat-component')).toBeInTheDocument()+ expect(screen.getByTestId('chat-component'))!.toBeInTheDocument()})})@@ -759,7 +760,8 @@ describe('DebugWithSingleModel', () => {render(<DebugWithSingleModel ref={ref as RefObject<DebugWithSingleModelRefType>} />)// Component should render successfully with filtered variables- expect(screen.getByTestId('chat-component')).toBeInTheDocument()+ // Component should render successfully with filtered variables+ expect(screen.getByTestId('chat-component'))!.toBeInTheDocument()})it('should handle empty prompt variables', () => {@@ -775,7 +777,7 @@ describe('DebugWithSingleModel', () => {render(<DebugWithSingleModel ref={ref as RefObject<DebugWithSingleModelRefType>} />)- expect(screen.getByTestId('chat-component')).toBeInTheDocument()+ expect(screen.getByTestId('chat-component'))!.toBeInTheDocument()})})@@ -784,7 +786,7 @@ describe('DebugWithSingleModel', () => {it('should map tool icons from collection list', () => {render(<DebugWithSingleModel ref={ref as RefObject<DebugWithSingleModelRefType>} />)- expect(screen.getByTestId('chat-component')).toBeInTheDocument()+ expect(screen.getByTestId('chat-component'))!.toBeInTheDocument()})it('should handle empty tools list', () => {@@ -802,7 +804,7 @@ describe('DebugWithSingleModel', () => {render(<DebugWithSingleModel ref={ref as RefObject<DebugWithSingleModelRefType>} />)- expect(screen.getByTestId('chat-component')).toBeInTheDocument()+ expect(screen.getByTestId('chat-component'))!.toBeInTheDocument()})it('should handle missing collection for tool', () => {@@ -829,7 +831,7 @@ describe('DebugWithSingleModel', () => {render(<DebugWithSingleModel ref={ref as RefObject<DebugWithSingleModelRefType>} />)- expect(screen.getByTestId('chat-component')).toBeInTheDocument()+ expect(screen.getByTestId('chat-component'))!.toBeInTheDocument()})})@@ -843,7 +845,7 @@ describe('DebugWithSingleModel', () => {render(<DebugWithSingleModel ref={ref as RefObject<DebugWithSingleModelRefType>} />)- expect(screen.getByTestId('chat-component')).toBeInTheDocument()+ expect(screen.getByTestId('chat-component'))!.toBeInTheDocument()})it('should handle missing user profile', () => {@@ -859,7 +861,7 @@ describe('DebugWithSingleModel', () => {render(<DebugWithSingleModel ref={ref as RefObject<DebugWithSingleModelRefType>} />)- expect(screen.getByTestId('chat-component')).toBeInTheDocument()+ expect(screen.getByTestId('chat-component'))!.toBeInTheDocument()})it('should handle null completion params', () => {@@ -870,7 +872,7 @@ describe('DebugWithSingleModel', () => {render(<DebugWithSingleModel ref={ref as RefObject<DebugWithSingleModelRefType>} />)- expect(screen.getByTestId('chat-component')).toBeInTheDocument()+ expect(screen.getByTestId('chat-component'))!.toBeInTheDocument()})})@@ -940,7 +942,7 @@ describe('DebugWithSingleModel', () => {expect(mockSsePost).toHaveBeenCalled()})- const body = mockSsePost.mock.calls[0][1].body+ const body = mockSsePost.mock.calls[0]![1].bodyexpect(body.files).toEqual([])})@@ -989,7 +991,7 @@ describe('DebugWithSingleModel', () => {expect(mockSsePost).toHaveBeenCalled()})- const body = mockSsePost.mock.calls[0][1].body+ const body = mockSsePost.mock.calls[0]![1].bodyexpect(body.files).toHaveLength(1)})})diff --git a/web/app/components/app/configuration/hooks/__tests__/use-configuration-utils.spec.ts b/web/app/components/app/configuration/hooks/__tests__/use-configuration-utils.spec.tsindex b5d00bd5738..c0353c233d7 100644--- a/web/app/components/app/configuration/hooks/__tests__/use-configuration-utils.spec.ts+++ b/web/app/components/app/configuration/hooks/__tests__/use-configuration-utils.spec.ts@@ -345,7 +345,7 @@ describe('useConfiguration utils', () => {},url: '/datasets',})- expect(state.collectionList[0].icon).toBe('/console/tool.svg')+ expect(state.collectionList[0]!.icon).toBe('/console/tool.svg')expect(state.promptMode).toBe('advanced')expect(state.nextDataSets).toEqual([{ id: 'dataset-1', name: 'Dataset One' }])expect(state.annotationConfig).toEqual(expect.objectContaining({diff --git a/web/app/components/app/configuration/tools/__tests__/external-data-tool-modal-utils.spec.ts b/web/app/components/app/configuration/tools/__tests__/external-data-tool-modal-utils.spec.tsindex 5d55c303c59..03f77671d9e 100644--- a/web/app/components/app/configuration/tools/__tests__/external-data-tool-modal-utils.spec.ts+++ b/web/app/components/app/configuration/tools/__tests__/external-data-tool-modal-utils.spec.ts@@ -42,7 +42,7 @@ describe('external-data-tool-modal-utils', () => {it('should build localized providers and default configs for code-based tools', () => {const providers = buildProviders({codeBasedExtensionList,- locale: LanguagesSupported[1],+ locale: LanguagesSupported[1]!,t,})diff --git a/web/app/components/app/configuration/tools/external-data-tool-modal-utils.ts b/web/app/components/app/configuration/tools/external-data-tool-modal-utils.tsindex 702ebdb5f47..0a9d0724e44 100644--- a/web/app/components/app/configuration/tools/external-data-tool-modal-utils.ts+++ b/web/app/components/app/configuration/tools/external-data-tool-modal-utils.ts@@ -114,8 +114,8 @@ export const getValidationError = ({if (!systemTypes.includes(localeData.type as typeof systemTypes[number]) && currentProvider?.form_schema) {for (let i = 0; i < currentProvider.form_schema.length; i++) {const form = currentProvider.form_schema[i]- if (!localeData.config?.[form.variable] && form.required) {- return t('errorMessage.valueOfVarRequired', { ns: 'appDebug', key: locale === LanguagesSupported[1] ? form.label['zh-Hans'] : form.label['en-US'] })+ if (!localeData.config?.[form!.variable] && form!.required) {+ return t('errorMessage.valueOfVarRequired', { ns: 'appDebug', key: locale === LanguagesSupported[1] ? form!.label['zh-Hans'] : form!.label['en-US'] })}}}diff --git a/web/app/components/app/configuration/utils.ts b/web/app/components/app/configuration/utils.tsindex 3f06c863a40..18bc144b5e1 100644--- a/web/app/components/app/configuration/utils.ts+++ b/web/app/components/app/configuration/utils.ts@@ -40,7 +40,7 @@ export const buildConfigurationFeaturesData = (},enabled: !!(modelConfig.file_upload?.enabled || modelConfig.file_upload?.image?.enabled),allowed_file_types: modelConfig.file_upload?.allowed_file_types || [],- allowed_file_extensions: modelConfig.file_upload?.allowed_file_extensions || [...FILE_EXTS[SupportUploadFileTypes.image], ...FILE_EXTS[SupportUploadFileTypes.video]].map(ext => `.${ext}`),+ allowed_file_extensions: modelConfig.file_upload?.allowed_file_extensions || [...(FILE_EXTS[SupportUploadFileTypes.image] ?? []), ...(FILE_EXTS[SupportUploadFileTypes.video] ?? [])].map(ext => `.${ext}`),allowed_file_upload_methods: modelConfig.file_upload?.allowed_file_upload_methods || modelConfig.file_upload?.image?.transfer_methods || ['local_file', 'remote_url'],number_limits: modelConfig.file_upload?.number_limits || modelConfig.file_upload?.image?.number_limits || 3,fileUploadConfig: fileUploadConfigResponse,diff --git a/web/app/components/app/create-app-dialog/__tests__/index.spec.tsx b/web/app/components/app/create-app-dialog/__tests__/index.spec.tsxindex 6fa30ded245..cc59ce7456c 100644--- a/web/app/components/app/create-app-dialog/__tests__/index.spec.tsx+++ b/web/app/components/app/create-app-dialog/__tests__/index.spec.tsx@@ -53,6 +53,37 @@ describe('CreateAppTemplateDialog', () => {it('should not render when show is false', () => {render(<CreateAppTemplateDialog {...defaultProps} />)+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false+ // FullScreenModal should not render any content when open is false// FullScreenModal should not render any content when open is falseexpect(screen.queryByRole('dialog')).not.toBeInTheDocument()})@@ -61,14 +92,15 @@ describe('CreateAppTemplateDialog', () => {render(<CreateAppTemplateDialog {...defaultProps} show={true} />)// FullScreenModal renders with role="dialog"- expect(screen.getByRole('dialog')).toBeInTheDocument()- expect(screen.getByTestId('app-list')).toBeInTheDocument()+ // FullScreenModal renders with role="dialog"+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()+ expect(screen.getByTestId('app-list'))!.toBeInTheDocument()})it('should render create from blank button when onCreateFromBlank is provided', () => {render(<CreateAppTemplateDialog {...defaultProps} show={true} />)- expect(screen.getByTestId('create-from-blank')).toBeInTheDocument()+ expect(screen.getByTestId('create-from-blank'))!.toBeInTheDocument()})it('should not render create from blank button when onCreateFromBlank is not provided', () => {@@ -87,7 +119,7 @@ describe('CreateAppTemplateDialog', () => {expect(screen.queryByRole('dialog')).not.toBeInTheDocument()rerender(<CreateAppTemplateDialog {...defaultProps} show={true} />)- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})it('should pass closable prop to FullScreenModal', () => {@@ -97,8 +129,8 @@ describe('CreateAppTemplateDialog', () => {// Verify that the modal has the proper dialog structureconst dialog = screen.getByRole('dialog')- expect(dialog).toBeInTheDocument()- expect(dialog).toHaveAttribute('aria-modal', 'true')+ expect(dialog)!.toBeInTheDocument()+ expect(dialog)!.toHaveAttribute('aria-modal', 'true')})})@@ -109,11 +141,12 @@ describe('CreateAppTemplateDialog', () => {// Test that the modal is renderedconst dialog = screen.getByRole('dialog')- expect(dialog).toBeInTheDocument()+ expect(dialog)!.toBeInTheDocument()// Test that AppList component renders (child component interactions)- expect(screen.getByTestId('app-list')).toBeInTheDocument()- expect(screen.getByTestId('app-list-success')).toBeInTheDocument()+ // Test that AppList component renders (child component interactions)+ expect(screen.getByTestId('app-list'))!.toBeInTheDocument()+ expect(screen.getByTestId('app-list-success'))!.toBeInTheDocument()})it('should call both onSuccess and onClose when app list success is triggered', () => {@@ -204,8 +237,8 @@ describe('CreateAppTemplateDialog', () => {// Verify that useKeyPress was called with a functionconst calls = mockUseKeyPress.mock.callsexpect(calls.length).toBeGreaterThan(0)- expect(calls[0][0]).toBe('esc')- expect(typeof calls[0][1]).toBe('function')+ expect(calls[0]![0]).toBe('esc')+ expect(typeof calls[0]![1]).toBe('function')})})@@ -243,7 +276,7 @@ describe('CreateAppTemplateDialog', () => {// Test show staterender(<CreateAppTemplateDialog {...defaultProps} show={true} />)- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()// Test hide staterender(<CreateAppTemplateDialog {...defaultProps} show={false} />)@@ -258,7 +291,7 @@ describe('CreateAppTemplateDialog', () => {render(<CreateAppTemplateDialog {...propsWithoutOnCreate} show={true} />)}).not.toThrow()- expect(screen.getByTestId('app-list')).toBeInTheDocument()+ expect(screen.getByTestId('app-list'))!.toBeInTheDocument()expect(screen.queryByTestId('create-from-blank')).not.toBeInTheDocument()})@@ -273,8 +306,8 @@ describe('CreateAppTemplateDialog', () => {render(<CreateAppTemplateDialog {...requiredProps} />)}).not.toThrow()- expect(screen.getByRole('dialog')).toBeInTheDocument()- expect(screen.getByTestId('app-list')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()+ expect(screen.getByTestId('app-list'))!.toBeInTheDocument()})})})diff --git a/web/app/components/app/create-app-dialog/app-list/__tests__/index.spec.tsx b/web/app/components/app/create-app-dialog/app-list/__tests__/index.spec.tsxindex a319bb58f73..34024da54c2 100644--- a/web/app/components/app/create-app-dialog/app-list/__tests__/index.spec.tsx+++ b/web/app/components/app/create-app-dialog/app-list/__tests__/index.spec.tsx@@ -183,15 +183,15 @@ describe('Apps', () => {render(<Apps />)expect(screen.getAllByTestId('app-card')).toHaveLength(6)- expect(screen.getByText('Alpha')).toBeInTheDocument()- expect(screen.getByText('Bravo')).toBeInTheDocument()+ expect(screen.getByText('Alpha'))!.toBeInTheDocument()+ expect(screen.getByText('Bravo'))!.toBeInTheDocument()})it('opens create modal when a template card is clicked', () => {render(<Apps />)- fireEvent.click(screen.getAllByTestId('app-card')[0])- expect(screen.getByTestId('create-from-template-modal')).toBeInTheDocument()+ fireEvent.click(screen.getAllByTestId('app-card')[0]!)+ expect(screen.getByTestId('create-from-template-modal'))!.toBeInTheDocument()})it('shows no template message when list is empty', () => {@@ -202,8 +202,8 @@ describe('Apps', () => {render(<Apps />)- expect(screen.getByText('app.newApp.noTemplateFound')).toBeInTheDocument()- expect(screen.getByText('app.newApp.noTemplateFoundTip')).toBeInTheDocument()+ expect(screen.getByText('app.newApp.noTemplateFound'))!.toBeInTheDocument()+ expect(screen.getByText('app.newApp.noTemplateFoundTip'))!.toBeInTheDocument()})it('filters templates by keyword and selected app type', async () => {@@ -214,7 +214,7 @@ describe('Apps', () => {})await waitFor(() => {- expect(screen.getByText('Bravo')).toBeInTheDocument()+ expect(screen.getByText('Bravo'))!.toBeInTheDocument()expect(screen.queryByText('Alpha')).not.toBeInTheDocument()})@@ -224,8 +224,8 @@ describe('Apps', () => {fireEvent.click(screen.getByTestId('type-selector-chat'))await waitFor(() => {- expect(screen.getByText('Alpha')).toBeInTheDocument()- expect(screen.getByText('Bravo')).toBeInTheDocument()+ expect(screen.getByText('Alpha'))!.toBeInTheDocument()+ expect(screen.getByText('Bravo'))!.toBeInTheDocument()expect(screen.queryByText('Charlie')).not.toBeInTheDocument()})})@@ -235,7 +235,7 @@ describe('Apps', () => {render(<Apps onSuccess={onSuccess} />)- fireEvent.click(screen.getAllByTestId('app-card')[0])+ fireEvent.click(screen.getAllByTestId('app-card')[0]!)fireEvent.click(screen.getByTestId('confirm-create'))await waitFor(() => {@@ -264,7 +264,7 @@ describe('Apps', () => {render(<Apps />)- fireEvent.click(screen.getAllByTestId('app-card')[0])+ fireEvent.click(screen.getAllByTestId('app-card')[0]!)fireEvent.click(screen.getByTestId('confirm-create'))await waitFor(() => {@@ -290,7 +290,7 @@ describe('Apps', () => {render(<Apps />)- expect(screen.getByRole('status')).toBeInTheDocument()+ expect(screen.getByRole('status'))!.toBeInTheDocument()})it('should handle an undefined template payload by falling back to the empty state', () => {@@ -301,7 +301,7 @@ describe('Apps', () => {render(<Apps />)- expect(screen.getByText('app.newApp.noTemplateFound')).toBeInTheDocument()+ expect(screen.getByText('app.newApp.noTemplateFound'))!.toBeInTheDocument()})it('should filter templates by category and the remaining app modes', async () => {@@ -309,8 +309,8 @@ describe('Apps', () => {fireEvent.click(screen.getByText('Cat C'))expect(screen.queryByText('Alpha')).not.toBeInTheDocument()- expect(screen.getByText('Echo')).toBeInTheDocument()- expect(screen.getByText('Foxtrot')).toBeInTheDocument()+ expect(screen.getByText('Echo'))!.toBeInTheDocument()+ expect(screen.getByText('Foxtrot'))!.toBeInTheDocument()fireEvent.click(screen.getByTestId('type-selector-advanced'))await waitFor(() => {@@ -322,13 +322,13 @@ describe('Apps', () => {fireEvent.click(screen.getByText('Cat C'))fireEvent.click(screen.getByTestId('type-selector-agent'))await waitFor(() => {- expect(screen.getByText('Echo')).toBeInTheDocument()+ expect(screen.getByText('Echo'))!.toBeInTheDocument()expect(screen.queryByText('Foxtrot')).not.toBeInTheDocument()})fireEvent.click(screen.getByTestId('type-selector-workflow'))await waitFor(() => {- expect(screen.getByText('Foxtrot')).toBeInTheDocument()+ expect(screen.getByText('Foxtrot'))!.toBeInTheDocument()expect(screen.queryByText('Echo')).not.toBeInTheDocument()})@@ -356,11 +356,11 @@ describe('Apps', () => {})await waitFor(() => {- expect(screen.getByText('Cat A')).toBeInTheDocument()+ expect(screen.getByText('Cat A'))!.toBeInTheDocument()})- fireEvent.click(screen.getAllByTestId('app-card')[0])- expect(screen.getByTestId('create-from-template-modal')).toBeInTheDocument()+ fireEvent.click(screen.getAllByTestId('app-card')[0]!)+ expect(screen.getByTestId('create-from-template-modal'))!.toBeInTheDocument()fireEvent.click(screen.getByTestId('hide-create-modal'))diff --git a/web/app/components/app/create-from-dsl-modal/__tests__/index.spec.tsx b/web/app/components/app/create-from-dsl-modal/__tests__/index.spec.tsxindex e106cc7eb3e..40c32b7dd63 100644--- a/web/app/components/app/create-from-dsl-modal/__tests__/index.spec.tsx+++ b/web/app/components/app/create-from-dsl-modal/__tests__/index.spec.tsx@@ -137,10 +137,10 @@ describe('CreateFromDSLModal', () => {/>,)- expect(screen.getByText('importFromDSL')).toBeInTheDocument()+ expect(screen.getByText('importFromDSL'))!.toBeInTheDocument()await waitFor(() => {- expect(screen.getByText('demo.yml')).toBeInTheDocument()+ expect(screen.getByText('demo.yml'))!.toBeInTheDocument()})})@@ -159,7 +159,7 @@ describe('CreateFromDSLModal', () => {await act(async () => {fireEvent.click(screen.getByText('importFromDSLUrl'))})- expect(screen.getByPlaceholderText('importFromDSLUrlPlaceholder')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('importFromDSLUrlPlaceholder'))!.toBeInTheDocument()const closeTrigger = screen.getByText('importFromDSL').parentElement?.querySelector('.cursor-pointer.items-center') as HTMLElementfireEvent.click(closeTrigger)@@ -222,7 +222,7 @@ describe('CreateFromDSLModal', () => {)await waitFor(() => {- expect(screen.getByText('demo.yml')).toBeInTheDocument()+ expect(screen.getByText('demo.yml'))!.toBeInTheDocument()})await act(async () => {@@ -245,7 +245,7 @@ describe('CreateFromDSLModal', () => {)await waitFor(() => {- expect(screen.getByText('demo.yml')).toBeInTheDocument()+ expect(screen.getByText('demo.yml'))!.toBeInTheDocument()})const removeButton = screen.getByText('demo.yml').closest('.group')?.querySelector('button') as HTMLButtonElement@@ -255,7 +255,7 @@ describe('CreateFromDSLModal', () => {await waitFor(() => {expect(screen.queryByText('demo.yml')).not.toBeInTheDocument()- expect(getCreateButton()).toBeDisabled()+ expect(getCreateButton())!.toBeDisabled()})ahooksMocks.handlers.findLast(item => Array.isArray(item.keys))?.handler()@@ -294,10 +294,10 @@ describe('CreateFromDSLModal', () => {vi.advanceTimersByTime(300)})- expect(screen.getAllByText('newApp.appCreateDSLErrorTitle')[0]).toBeInTheDocument()+ expect(screen.getAllByText('newApp.appCreateDSLErrorTitle')[0])!.toBeInTheDocument()await act(async () => {- fireEvent.click(screen.getAllByRole('button', { name: 'newApp.Confirm' })[0])+ fireEvent.click(screen.getAllByRole('button', { name: 'newApp.Confirm' })[0]!)})expect(mockImportDSLConfirm).toHaveBeenCalledWith({@@ -386,7 +386,7 @@ describe('CreateFromDSLModal', () => {/>,)- expect(screen.getByText('apps-full')).toBeInTheDocument()+ expect(screen.getByText('apps-full'))!.toBeInTheDocument()ahooksMocks.handlers.findLast(item => Array.isArray(item.keys))?.handler()expect(mockImportDSL).toHaveBeenCalledTimes(1)})@@ -461,12 +461,12 @@ describe('CreateFromDSLModal', () => {vi.advanceTimersByTime(300)})await act(async () => {- fireEvent.click(screen.getAllByRole('button', { name: 'newApp.Confirm' })[0])+ fireEvent.click(screen.getAllByRole('button', { name: 'newApp.Confirm' })[0]!)})expect(toastMocks.error).toHaveBeenCalledWith('newApp.appCreateFailed')await act(async () => {- fireEvent.click(screen.getAllByRole('button', { name: 'newApp.Confirm' })[0])+ fireEvent.click(screen.getAllByRole('button', { name: 'newApp.Confirm' })[0]!)})expect(toastMocks.error).toHaveBeenCalledTimes(2)})diff --git a/web/app/components/app/log/__tests__/filter.spec.tsx b/web/app/components/app/log/__tests__/filter.spec.tsxindex 4c377ecde7f..ec1a0183bef 100644--- a/web/app/components/app/log/__tests__/filter.spec.tsx+++ b/web/app/components/app/log/__tests__/filter.spec.tsx@@ -77,7 +77,7 @@ describe('Filter', () => {it('should render filter components', () => {render(<Filter {...defaultProps} />)- expect(screen.getByPlaceholderText('operation.search')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('operation.search'))!.toBeInTheDocument()})it('should return null when loading', () => {@@ -89,13 +89,13 @@ describe('Filter', () => {it('should render sort component in chat mode', () => {render(<Filter {...defaultProps} isChatMode />)- expect(screen.getByPlaceholderText('operation.search')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('operation.search'))!.toBeInTheDocument()})it('should not render sort component when not in chat mode', () => {render(<Filter {...defaultProps} isChatMode={false} />)- expect(screen.getByPlaceholderText('operation.search')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('operation.search'))!.toBeInTheDocument()})})@@ -105,23 +105,23 @@ describe('Filter', () => {})it('should have today period with value 0', () => {- expect(TIME_PERIOD_MAPPING['1'].value).toBe(0)- expect(TIME_PERIOD_MAPPING['1'].name).toBe('today')+ expect(TIME_PERIOD_MAPPING['1']!.value).toBe(0)+ expect(TIME_PERIOD_MAPPING['1']!.name).toBe('today')})it('should have last7days period with value 7', () => {- expect(TIME_PERIOD_MAPPING['2'].value).toBe(7)- expect(TIME_PERIOD_MAPPING['2'].name).toBe('last7days')+ expect(TIME_PERIOD_MAPPING['2']!.value).toBe(7)+ expect(TIME_PERIOD_MAPPING['2']!.name).toBe('last7days')})it('should have last4weeks period with value 28', () => {- expect(TIME_PERIOD_MAPPING['3'].value).toBe(28)- expect(TIME_PERIOD_MAPPING['3'].name).toBe('last4weeks')+ expect(TIME_PERIOD_MAPPING['3']!.value).toBe(28)+ expect(TIME_PERIOD_MAPPING['3']!.name).toBe('last4weeks')})it('should have allTime period with value -1', () => {- expect(TIME_PERIOD_MAPPING['9'].value).toBe(-1)- expect(TIME_PERIOD_MAPPING['9'].name).toBe('allTime')+ expect(TIME_PERIOD_MAPPING['9']!.value).toBe(-1)+ expect(TIME_PERIOD_MAPPING['9']!.name).toBe('allTime')})})@@ -158,25 +158,25 @@ describe('Filter', () => {it('should update and clear period, annotation, and sort filters', () => {render(<Filter {...defaultProps} isChatMode />)- fireEvent.click(screen.getAllByText('select-9')[0])+ fireEvent.click(screen.getAllByText('select-9')[0]!)expect(mockSetQueryParams).toHaveBeenCalledWith({...defaultQueryParams,period: '9',})- fireEvent.click(screen.getAllByText('clear-chip')[0])+ fireEvent.click(screen.getAllByText('clear-chip')[0]!)expect(mockSetQueryParams).toHaveBeenCalledWith({...defaultQueryParams,period: '9',})- fireEvent.click(screen.getAllByText('select-not_annotated')[0])+ fireEvent.click(screen.getAllByText('select-not_annotated')[0]!)expect(mockSetQueryParams).toHaveBeenCalledWith({...defaultQueryParams,annotation_status: 'not_annotated',})- fireEvent.click(screen.getAllByText('clear-chip')[1])+ fireEvent.click(screen.getAllByText('clear-chip')[1]!)expect(mockSetQueryParams).toHaveBeenCalledWith({...defaultQueryParams,annotation_status: 'all',@@ -200,7 +200,8 @@ describe('Filter', () => {render(<Filter {...propsWithPeriod} />)// Period '1' maps to 'today' in TIME_PERIOD_MAPPING- expect(screen.getByText('filter.period.today')).toBeInTheDocument()+ // Period '1' maps to 'today' in TIME_PERIOD_MAPPING+ expect(screen.getByText('filter.period.today'))!.toBeInTheDocument()})it('should display "last7days" when period is set to 2', () => {@@ -211,14 +212,15 @@ describe('Filter', () => {render(<Filter {...propsWithPeriod} />)- expect(screen.getByText('filter.period.last7days')).toBeInTheDocument()+ expect(screen.getByText('filter.period.last7days'))!.toBeInTheDocument()})it('should display "allTime" when period is set to 9', () => {render(<Filter {...defaultProps} />)// Default period is '9' which maps to 'allTime'- expect(screen.getByText('filter.period.allTime')).toBeInTheDocument()+ // Default period is '9' which maps to 'allTime'+ expect(screen.getByText('filter.period.allTime'))!.toBeInTheDocument()})it('should display annotated status with count when annotation_status is annotated', () => {@@ -230,7 +232,8 @@ describe('Filter', () => {render(<Filter {...propsWithAnnotation} />)// The mock returns count: 10, so the text should include the count- expect(screen.getByText('filter.annotation.annotated (10)')).toBeInTheDocument()+ // The mock returns count: 10, so the text should include the count+ expect(screen.getByText('filter.annotation.annotated (10)'))!.toBeInTheDocument()})it('should display not_annotated status when annotation_status is not_annotated', () => {@@ -241,14 +244,15 @@ describe('Filter', () => {render(<Filter {...propsWithNotAnnotated} />)- expect(screen.getByText('filter.annotation.not_annotated')).toBeInTheDocument()+ expect(screen.getByText('filter.annotation.not_annotated'))!.toBeInTheDocument()})it('should display all annotation status when annotation_status is all', () => {render(<Filter {...defaultProps} />)// Default annotation_status is 'all'- expect(screen.getByText('filter.annotation.all')).toBeInTheDocument()+ // Default annotation_status is 'all'+ expect(screen.getByText('filter.annotation.all'))!.toBeInTheDocument()})it('should return null when annotation count data is unavailable', () => {@@ -269,7 +273,7 @@ describe('Filter', () => {render(<Filter {...propsWithSort} />)- expect(screen.getByPlaceholderText('operation.search')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('operation.search'))!.toBeInTheDocument()})it('should handle descending sort order', () => {@@ -281,7 +285,7 @@ describe('Filter', () => {render(<Filter {...propsWithDescSort} />)- expect(screen.getByPlaceholderText('operation.search')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('operation.search'))!.toBeInTheDocument()})})})diff --git a/web/app/components/app/log/__tests__/list-utils.spec.ts b/web/app/components/app/log/__tests__/list-utils.spec.tsindex 245ff0567ee..deaaa015910 100644--- a/web/app/components/app/log/__tests__/list-utils.spec.ts+++ b/web/app/components/app/log/__tests__/list-utils.spec.ts@@ -150,12 +150,12 @@ describe('log list utils', () => {it('should update annotation state helpers', () => {const items = createChatItems()- expect(applyAnnotationEdited(items, 'updated question', 'updated answer', 1)[0].content).toBe('updated question')- expect(applyAnnotationAdded(items, 'annotation-1', 'Dify', 'question', 'answer', 1)[1].annotation).toEqual(expect.objectContaining({+ expect(applyAnnotationEdited(items, 'updated question', 'updated answer', 1)[0]!.content).toBe('updated question')+ expect(applyAnnotationAdded(items, 'annotation-1', 'Dify', 'question', 'answer', 1)[1]!.annotation).toEqual(expect.objectContaining({id: 'annotation-1',authorName: 'Dify',}))- expect(applyAnnotationRemoved(items, 1)[1].annotation).toBeUndefined()+ expect(applyAnnotationRemoved(items, 1)[1]!.annotation).toBeUndefined()})it('should derive urls, scroll thresholds, row values, and detail metadata', () => {diff --git a/web/app/components/app/log/index.tsx b/web/app/components/app/log/index.tsxindex c30cf6cf510..411ec8694dd 100644--- a/web/app/components/app/log/index.tsx+++ b/web/app/components/app/log/index.tsx@@ -78,7 +78,7 @@ const Logs: FC<ILogsProps> = ({ appDetail }) => {limit,...((debouncedQueryParams.period !== '9')? {- start: dayjs().subtract(TIME_PERIOD_MAPPING[debouncedQueryParams.period].value, 'day').startOf('day').format('YYYY-MM-DD HH:mm'),+ start: dayjs().subtract(TIME_PERIOD_MAPPING[debouncedQueryParams.period]!.value, 'day').startOf('day').format('YYYY-MM-DD HH:mm'),end: dayjs().endOf('day').format('YYYY-MM-DD HH:mm'),}: {}),diff --git a/web/app/components/app/overview/__tests__/app-chart-utils.spec.ts b/web/app/components/app/overview/__tests__/app-chart-utils.spec.tsindex a087df241a8..5064af5f36d 100644--- a/web/app/components/app/overview/__tests__/app-chart-utils.spec.ts+++ b/web/app/components/app/overview/__tests__/app-chart-utils.spec.ts@@ -97,7 +97,7 @@ describe('app-chart-utils', () => {expect(dataset.dimensions).toEqual(['date', 'count'])expect(dataset.source).toHaveLength(2)expect(yAxis.max).toBe(100)- expect(series[0].lineStyle.color).toBe('rgba(6, 148, 162, 1)')+ expect(series[0]!.lineStyle.color).toBe('rgba(6, 148, 162, 1)')})it('should build token-aware tooltip content and split-line intervals for cost charts', () => {@@ -112,11 +112,11 @@ describe('app-chart-utils', () => {})const xAxis = options.xAxis as Array<Record<string, any>>- const formatter = xAxis[0].axisLabel.formatter as (value: string) => string- const outerInterval = xAxis[0].splitLine.interval as (index: number) => boolean- const innerInterval = xAxis[1].splitLine.interval as (_index: number, value: string) => boolean+ const formatter = xAxis[0]!.axisLabel.formatter as (value: string) => string+ const outerInterval = xAxis[0]!.splitLine.interval as (index: number) => boolean+ const innerInterval = xAxis[1]!.splitLine.interval as (_index: number, value: string) => booleanconst series = options.series as Array<Record<string, any>>- const tooltipFormatter = series[0].tooltip.formatter as (params: { name: string, data: { total_cost: number, total_price: string } }) => string+ const tooltipFormatter = series[0]!.tooltip.formatter as (params: { name: string, data: { total_cost: number, total_price: string } }) => stringexpect(formatter('Jan 2, 2024')).toBe('Jan 2, 2024')expect(outerInterval(0)).toBe(true)diff --git a/web/app/components/app/overview/__tests__/app-chart.spec.tsx b/web/app/components/app/overview/__tests__/app-chart.spec.tsxindex ccd59a8f4ab..d6aa2414055 100644--- a/web/app/components/app/overview/__tests__/app-chart.spec.tsx+++ b/web/app/components/app/overview/__tests__/app-chart.spec.tsx@@ -58,10 +58,10 @@ describe('app-chart', () => {/>,)- expect(screen.getByText('Cost title')).toBeInTheDocument()- expect(screen.getByText('300')).toBeInTheDocument()- expect(screen.getByText(/\$3\.7500/)).toBeInTheDocument()- expect(screen.getByTestId('echarts')).toBeInTheDocument()+ expect(screen.getByText('Cost title'))!.toBeInTheDocument()+ expect(screen.getByText('300'))!.toBeInTheDocument()+ expect(screen.getByText(/\$3\.7500/))!.toBeInTheDocument()+ expect(screen.getByTestId('echarts'))!.toBeInTheDocument()})})@@ -85,10 +85,10 @@ describe('app-chart', () => {/>,)- expect(screen.getByText('analysis.totalMessages.title')).toBeInTheDocument()- expect(screen.getByTestId('echarts')).toBeInTheDocument()+ expect(screen.getByText('analysis.totalMessages.title'))!.toBeInTheDocument()+ expect(screen.getByTestId('echarts'))!.toBeInTheDocument()- const options = reactEChartsMock.mock.calls[0][0] as {+ const options = reactEChartsMock.mock.calls[0]![0] as {dataset: { source: Array<Record<string, unknown>> }yAxis: { max: number }}diff --git a/web/app/components/app/overview/embedded/__tests__/index.spec.tsx b/web/app/components/app/overview/embedded/__tests__/index.spec.tsxindex 9b8a2ad8c41..0a843c26fd4 100644--- a/web/app/components/app/overview/embedded/__tests__/index.spec.tsx+++ b/web/app/components/app/overview/embedded/__tests__/index.spec.tsx@@ -102,12 +102,12 @@ describe('Embedded', () => {const optionButtons = document.body.querySelectorAll('[class*="option"]')expect(optionButtons.length).toBeGreaterThanOrEqual(3)act(() => {- fireEvent.click(optionButtons[2])+ fireEvent.click(optionButtons[2]!)})const [chromeText] = screen.getAllByText('appOverview.overview.appInfo.embedded.chromePlugin')act(() => {- fireEvent.click(chromeText)+ fireEvent.click(chromeText!)})expect(mockWindowOpen).toHaveBeenCalledWith(diff --git a/web/app/components/app/overview/embedded/index.tsx b/web/app/components/app/overview/embedded/index.tsxindex 547d80f0feb..029566587e9 100644--- a/web/app/components/app/overview/embedded/index.tsx+++ b/web/app/components/app/overview/embedded/index.tsx@@ -105,7 +105,7 @@ const Embedded = ({ siteInfo, isShow, onClose, appBaseUrl, accessToken, classNamif (option === 'chromePlugin') {const splitUrl = OPTION_MAP[option].getContent(appBaseUrl, accessToken).split(': ')if (splitUrl.length > 1)- copy(splitUrl[1])+ copy(splitUrl[1]!)}else {copy(OPTION_MAP[option].getContent(appBaseUrl, accessToken, themeBuilder.theme?.primaryColor ?? '#1C64F2', isTestEnv))diff --git a/web/app/components/app/text-generate/saved-items/__tests__/index.spec.tsx b/web/app/components/app/text-generate/saved-items/__tests__/index.spec.tsxindex ddfea019516..3989817a719 100644--- a/web/app/components/app/text-generate/saved-items/__tests__/index.spec.tsx+++ b/web/app/components/app/text-generate/saved-items/__tests__/index.spec.tsx@@ -37,8 +37,8 @@ describe('SavedItems', () => {const { container } = render(<SavedItems {...baseProps} />)const markdownElement = container.querySelector('.markdown-body')- expect(markdownElement).toBeInTheDocument()- expect(screen.getByText('11 common.unit.char')).toBeInTheDocument()+ expect(markdownElement)!.toBeInTheDocument()+ expect(screen.getByText('11 common.unit.char'))!.toBeInTheDocument()const actionArea = container.querySelector('[class*="bg-components-actionbar-bg"]')const actionButtons = actionArea?.querySelectorAll('button') ?? []@@ -56,11 +56,11 @@ describe('SavedItems', () => {const copyButton = actionButtons[1]const deleteButton = actionButtons[2]- fireEvent.click(copyButton)+ fireEvent.click(copyButton!)expect(mockCopy).toHaveBeenCalledWith('hello world')expect(toastSuccessSpy).toHaveBeenCalledWith('common.actionMsg.copySuccessfully')- fireEvent.click(deleteButton)+ fireEvent.click(deleteButton!)expect(handleRemove).toHaveBeenCalledWith('1')})})diff --git a/web/app/components/app/type-selector/index.tsx b/web/app/components/app/type-selector/index.tsxindex 6b8f8985c21..873593a6005 100644--- a/web/app/components/app/type-selector/index.tsx+++ b/web/app/components/app/type-selector/index.tsx@@ -148,9 +148,9 @@ function AppTypeSelectTrigger({ values }: { readonly values: AppSelectorProps['v'flex h-8 flex-nowrap items-center justify-between gap-1',)}>- <AppTypeIcon type={values[0]} />+ <AppTypeIcon type={values[0]!} /><div className="line-clamp-1 flex flex-1 items-center text-center">- <AppTypeLabel type={values[0]} className="system-sm-medium text-components-menu-item-text" />+ <AppTypeLabel type={values[0]!} className="system-sm-medium text-components-menu-item-text" /></div></div>)diff --git a/web/app/components/app/workflow-log/__tests__/filter.spec.tsx b/web/app/components/app/workflow-log/__tests__/filter.spec.tsxindex d2555373541..237862fd71f 100644--- a/web/app/components/app/workflow-log/__tests__/filter.spec.tsx+++ b/web/app/components/app/workflow-log/__tests__/filter.spec.tsx@@ -56,8 +56,9 @@ describe('Filter', () => {)// Should render status chip, period chip, and search input- expect(screen.getByText('All')).toBeInTheDocument()- expect(screen.getByPlaceholderText('common.operation.search')).toBeInTheDocument()+ // Should render status chip, period chip, and search input+ expect(screen.getByText('All'))!.toBeInTheDocument()+ expect(screen.getByPlaceholderText('common.operation.search'))!.toBeInTheDocument()})it('should render all filter components', () => {@@ -69,11 +70,14 @@ describe('Filter', () => {)// Status chip- expect(screen.getByText('All')).toBeInTheDocument()+ // Status chip+ expect(screen.getByText('All'))!.toBeInTheDocument()+ // Period chip (shows translated key)// Period chip (shows translated key)- expect(screen.getByText('appLog.filter.period.last7days')).toBeInTheDocument()+ expect(screen.getByText('appLog.filter.period.last7days'))!.toBeInTheDocument()// Search input- expect(screen.getByPlaceholderText('common.operation.search')).toBeInTheDocument()+ // Search input+ expect(screen.getByPlaceholderText('common.operation.search'))!.toBeInTheDocument()})})@@ -90,7 +94,8 @@ describe('Filter', () => {)// Chip should show Success for succeeded status- expect(screen.getByText('Success')).toBeInTheDocument()+ // Chip should show Success for succeeded status+ expect(screen.getByText('Success'))!.toBeInTheDocument()})it('should open status dropdown when clicked', async () => {@@ -107,10 +112,10 @@ describe('Filter', () => {// Should show all status optionsawait waitFor(() => {- expect(screen.getByText('Success')).toBeInTheDocument()- expect(screen.getByText('Fail')).toBeInTheDocument()- expect(screen.getByText('Stop')).toBeInTheDocument()- expect(screen.getByText('Partial Success')).toBeInTheDocument()+ expect(screen.getByText('Success'))!.toBeInTheDocument()+ expect(screen.getByText('Fail'))!.toBeInTheDocument()+ expect(screen.getByText('Stop'))!.toBeInTheDocument()+ expect(screen.getByText('Partial Success'))!.toBeInTheDocument()})})@@ -167,7 +172,7 @@ describe('Filter', () => {// Find the clear icon (div with group/clear class) in the status chipconst clearIcon = container.querySelector('.group\\/clear')- expect(clearIcon).toBeInTheDocument()+ expect(clearIcon)!.toBeInTheDocument()await user.click(clearIcon!)expect(setQueryParams).toHaveBeenCalledWith({@@ -190,7 +195,7 @@ describe('Filter', () => {/>,)- expect(screen.getByText(expectedLabel)).toBeInTheDocument()+ expect(screen.getByText(expectedLabel))!.toBeInTheDocument()})})@@ -206,7 +211,7 @@ describe('Filter', () => {/>,)- expect(screen.getByText('appLog.filter.period.today')).toBeInTheDocument()+ expect(screen.getByText('appLog.filter.period.today'))!.toBeInTheDocument()})it('should open period dropdown when clicked', async () => {@@ -223,10 +228,10 @@ describe('Filter', () => {// Should show all period optionsawait waitFor(() => {- expect(screen.getByText('appLog.filter.period.today')).toBeInTheDocument()- expect(screen.getByText('appLog.filter.period.last4weeks')).toBeInTheDocument()- expect(screen.getByText('appLog.filter.period.last3months')).toBeInTheDocument()- expect(screen.getByText('appLog.filter.period.allTime')).toBeInTheDocument()+ expect(screen.getByText('appLog.filter.period.today'))!.toBeInTheDocument()+ expect(screen.getByText('appLog.filter.period.last4weeks'))!.toBeInTheDocument()+ expect(screen.getByText('appLog.filter.period.last3months'))!.toBeInTheDocument()+ expect(screen.getByText('appLog.filter.period.allTime'))!.toBeInTheDocument()})})@@ -287,7 +292,7 @@ describe('Filter', () => {/>,)- expect(screen.getByDisplayValue('test search')).toBeInTheDocument()+ expect(screen.getByDisplayValue('test search'))!.toBeInTheDocument()})it('should call setQueryParams when typing in search', async () => {@@ -337,7 +342,7 @@ describe('Filter', () => {// Find the clear icon div (has cursor-pointer class and contains RiCloseCircleFill)const clearIconDiv = inputWrapper?.querySelector('div.cursor-pointer')- expect(clearIconDiv).toBeInTheDocument()+ expect(clearIconDiv)!.toBeInTheDocument()await user.click(clearIconDiv!)expect(setQueryParams).toHaveBeenCalledWith({@@ -399,11 +404,11 @@ describe('Filter', () => {['9', 'allTime', -1],])('TIME_PERIOD_MAPPING[%s] should have name=%s and correct value', (key, name, expectedValue) => {const mapping = TIME_PERIOD_MAPPING[key]- expect(mapping.name).toBe(name)+ expect(mapping!.name).toBe(name)if (expectedValue >= 0)- expect(mapping.value).toBe(expectedValue)+ expect(mapping!.value).toBe(expectedValue)else- expect(mapping.value).toBe(-1)+ expect(mapping!.value).toBe(-1)})})@@ -420,7 +425,7 @@ describe('Filter', () => {)const input = screen.getByPlaceholderText('common.operation.search')- expect(input).toHaveValue('')+ expect(input)!.toHaveValue('')})it('should handle empty string keyword', () => {@@ -432,7 +437,7 @@ describe('Filter', () => {)const input = screen.getByPlaceholderText('common.operation.search')- expect(input).toHaveValue('')+ expect(input)!.toHaveValue('')})it('should preserve other query params when updating status', async () => {@@ -515,9 +520,9 @@ describe('Filter', () => {/>,)- expect(screen.getByText('Success')).toBeInTheDocument()- expect(screen.getByText('appLog.filter.period.today')).toBeInTheDocument()- expect(screen.getByDisplayValue('integration test')).toBeInTheDocument()+ expect(screen.getByText('Success'))!.toBeInTheDocument()+ expect(screen.getByText('appLog.filter.period.today'))!.toBeInTheDocument()+ expect(screen.getByDisplayValue('integration test'))!.toBeInTheDocument()})it('should have proper layout with flex and gap', () => {@@ -529,9 +534,9 @@ describe('Filter', () => {)const filterContainer = container.firstChild as HTMLElement- expect(filterContainer).toHaveClass('flex')- expect(filterContainer).toHaveClass('flex-row')- expect(filterContainer).toHaveClass('gap-2')+ expect(filterContainer)!.toHaveClass('flex')+ expect(filterContainer)!.toHaveClass('flex-row')+ expect(filterContainer)!.toHaveClass('gap-2')})})})diff --git a/web/app/components/app/workflow-log/__tests__/list.spec.tsx b/web/app/components/app/workflow-log/__tests__/list.spec.tsxindex 356aaa5a483..35e6369e676 100644--- a/web/app/components/app/workflow-log/__tests__/list.spec.tsx+++ b/web/app/components/app/workflow-log/__tests__/list.spec.tsx@@ -181,7 +181,7 @@ describe('WorkflowAppLogList', () => {<WorkflowAppLogList logs={undefined} appDetail={createMockApp()} onRefresh={defaultOnRefresh} />,)- expect(container.querySelector('.spin-animation')).toBeInTheDocument()+ expect(container.querySelector('.spin-animation'))!.toBeInTheDocument()})it('should render loading state when appDetail is undefined', () => {@@ -191,7 +191,7 @@ describe('WorkflowAppLogList', () => {<WorkflowAppLogList logs={logs} appDetail={undefined} onRefresh={defaultOnRefresh} />,)- expect(container.querySelector('.spin-animation')).toBeInTheDocument()+ expect(container.querySelector('.spin-animation'))!.toBeInTheDocument()})it('should render table when data is available', () => {@@ -201,7 +201,7 @@ describe('WorkflowAppLogList', () => {<WorkflowAppLogList logs={logs} appDetail={createMockApp()} onRefresh={defaultOnRefresh} />,)- expect(screen.getByRole('table')).toBeInTheDocument()+ expect(screen.getByRole('table'))!.toBeInTheDocument()})it('should render all table headers', () => {@@ -211,11 +211,11 @@ describe('WorkflowAppLogList', () => {<WorkflowAppLogList logs={logs} appDetail={createMockApp()} onRefresh={defaultOnRefresh} />,)- expect(screen.getByText('appLog.table.header.startTime')).toBeInTheDocument()- expect(screen.getByText('appLog.table.header.status')).toBeInTheDocument()- expect(screen.getByText('appLog.table.header.runtime')).toBeInTheDocument()- expect(screen.getByText('appLog.table.header.tokens')).toBeInTheDocument()- expect(screen.getByText('appLog.table.header.user')).toBeInTheDocument()+ expect(screen.getByText('appLog.table.header.startTime'))!.toBeInTheDocument()+ expect(screen.getByText('appLog.table.header.status'))!.toBeInTheDocument()+ expect(screen.getByText('appLog.table.header.runtime'))!.toBeInTheDocument()+ expect(screen.getByText('appLog.table.header.tokens'))!.toBeInTheDocument()+ expect(screen.getByText('appLog.table.header.user'))!.toBeInTheDocument()})it('should render trigger column for workflow apps', () => {@@ -226,7 +226,7 @@ describe('WorkflowAppLogList', () => {<WorkflowAppLogList logs={logs} appDetail={workflowApp} onRefresh={defaultOnRefresh} />,)- expect(screen.getByText('appLog.table.header.triggered_from')).toBeInTheDocument()+ expect(screen.getByText('appLog.table.header.triggered_from'))!.toBeInTheDocument()})it('should not render trigger column for non-workflow apps', () => {@@ -256,7 +256,7 @@ describe('WorkflowAppLogList', () => {<WorkflowAppLogList logs={logs} appDetail={createMockApp()} onRefresh={defaultOnRefresh} />,)- expect(screen.getByText('Success')).toBeInTheDocument()+ expect(screen.getByText('Success'))!.toBeInTheDocument()})it('should render failure status correctly', () => {@@ -270,7 +270,7 @@ describe('WorkflowAppLogList', () => {<WorkflowAppLogList logs={logs} appDetail={createMockApp()} onRefresh={defaultOnRefresh} />,)- expect(screen.getByText('Failure')).toBeInTheDocument()+ expect(screen.getByText('Failure'))!.toBeInTheDocument()})it('should render stopped status correctly', () => {@@ -284,7 +284,7 @@ describe('WorkflowAppLogList', () => {<WorkflowAppLogList logs={logs} appDetail={createMockApp()} onRefresh={defaultOnRefresh} />,)- expect(screen.getByText('Stop')).toBeInTheDocument()+ expect(screen.getByText('Stop'))!.toBeInTheDocument()})it('should render running status correctly', () => {@@ -298,7 +298,7 @@ describe('WorkflowAppLogList', () => {<WorkflowAppLogList logs={logs} appDetail={createMockApp()} onRefresh={defaultOnRefresh} />,)- expect(screen.getByText('Running')).toBeInTheDocument()+ expect(screen.getByText('Running'))!.toBeInTheDocument()})it('should render partial-succeeded status correctly', () => {@@ -312,7 +312,7 @@ describe('WorkflowAppLogList', () => {<WorkflowAppLogList logs={logs} appDetail={createMockApp()} onRefresh={defaultOnRefresh} />,)- expect(screen.getByText('Partial Success')).toBeInTheDocument()+ expect(screen.getByText('Partial Success'))!.toBeInTheDocument()})})@@ -332,7 +332,7 @@ describe('WorkflowAppLogList', () => {<WorkflowAppLogList logs={logs} appDetail={createMockApp()} onRefresh={defaultOnRefresh} />,)- expect(screen.getByText('John Doe')).toBeInTheDocument()+ expect(screen.getByText('John Doe'))!.toBeInTheDocument()})it('should display end user session id when created by end user', () => {@@ -347,7 +347,7 @@ describe('WorkflowAppLogList', () => {<WorkflowAppLogList logs={logs} appDetail={createMockApp()} onRefresh={defaultOnRefresh} />,)- expect(screen.getByText('session-abc-123')).toBeInTheDocument()+ expect(screen.getByText('session-abc-123'))!.toBeInTheDocument()})it('should display N/A when no user info', () => {@@ -362,7 +362,7 @@ describe('WorkflowAppLogList', () => {<WorkflowAppLogList logs={logs} appDetail={createMockApp()} onRefresh={defaultOnRefresh} />,)- expect(screen.getByText('N/A')).toBeInTheDocument()+ expect(screen.getByText('N/A'))!.toBeInTheDocument()})})@@ -405,7 +405,7 @@ describe('WorkflowAppLogList', () => {// Arrow should rotate (indicated by class change)// The sort icon should have rotate-180 class for ascendingconst sortIcon = startTimeHeader.closest('div')?.querySelector('svg')- expect(sortIcon).toBeInTheDocument()+ expect(sortIcon)!.toBeInTheDocument()})it('should render sort arrow icon', () => {@@ -417,7 +417,7 @@ describe('WorkflowAppLogList', () => {// Check for ArrowDownIcon presenceconst sortArrow = container.querySelector('svg.ml-0\\.5')- expect(sortArrow).toBeInTheDocument()+ expect(sortArrow)!.toBeInTheDocument()})})@@ -440,11 +440,11 @@ describe('WorkflowAppLogList', () => {)const dataRows = screen.getAllByRole('row')- await user.click(dataRows[1]) // Click first data row+ await user.click(dataRows[1]!) // Click first data rowconst dialog = await screen.findByRole('dialog')- expect(dialog).toBeInTheDocument()- expect(screen.getByText('appLog.runDetail.workflowTitle')).toBeInTheDocument()+ expect(dialog)!.toBeInTheDocument()+ expect(screen.getByText('appLog.runDetail.workflowTitle'))!.toBeInTheDocument()})it('should close drawer and call onRefresh when closing', async () => {@@ -459,7 +459,7 @@ describe('WorkflowAppLogList', () => {// Open drawerconst dataRows = screen.getAllByRole('row')- await user.click(dataRows[1])+ await user.click(dataRows[1]!)await screen.findByRole('dialog')// Close drawer using Escape key@@ -482,14 +482,46 @@ describe('WorkflowAppLogList', () => {const dataRows = screen.getAllByRole('row')const dataRow = dataRows[1]+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight+ // Before click - no highlight// Before click - no highlightexpect(dataRow).not.toHaveClass('bg-background-default-hover')// After click - has highlight (via currentLog state)- await user.click(dataRow)+ await user.click(dataRow!)// The row should have the selected class- expect(dataRow).toHaveClass('bg-background-default-hover')+ // The row should have the selected class+ expect(dataRow)!.toHaveClass('bg-background-default-hover')})})@@ -515,7 +547,7 @@ describe('WorkflowAppLogList', () => {// Open drawerconst dataRows = screen.getAllByRole('row')- await user.click(dataRows[1])+ await user.click(dataRows[1]!)await screen.findByRole('dialog')// Replay button should be present for app-run triggers@@ -543,12 +575,12 @@ describe('WorkflowAppLogList', () => {// Open drawerconst dataRows = screen.getAllByRole('row')- await user.click(dataRows[1])+ await user.click(dataRows[1]!)await screen.findByRole('dialog')// Replay button should be present for debugging triggersconst replayButton = screen.getByRole('button', { name: 'appLog.runDetail.testWithParams' })- expect(replayButton).toBeInTheDocument()+ expect(replayButton)!.toBeInTheDocument()})it('should not show replay for webhook triggers', async () => {@@ -569,9 +601,40 @@ describe('WorkflowAppLogList', () => {// Open drawerconst dataRows = screen.getAllByRole('row')- await user.click(dataRows[1])+ await user.click(dataRows[1]!)await screen.findByRole('dialog')+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers+ // Replay button should not be present for webhook triggers// Replay button should not be present for webhook triggersexpect(screen.queryByRole('button', { name: 'appLog.runDetail.testWithParams' })).not.toBeInTheDocument()})@@ -594,7 +657,7 @@ describe('WorkflowAppLogList', () => {// Unread indicator is a small blue dotconst unreadDot = container.querySelector('.bg-util-colors-blue-blue-500')- expect(unreadDot).toBeInTheDocument()+ expect(unreadDot)!.toBeInTheDocument()})it('should not show unread indicator for read logs', () => {@@ -629,7 +692,7 @@ describe('WorkflowAppLogList', () => {<WorkflowAppLogList logs={logs} appDetail={createMockApp()} onRefresh={defaultOnRefresh} />,)- expect(screen.getByText('1.235s')).toBeInTheDocument()+ expect(screen.getByText('1.235s'))!.toBeInTheDocument()})it('should display 0 elapsed time with special styling', () => {@@ -644,8 +707,8 @@ describe('WorkflowAppLogList', () => {)const zeroTime = screen.getByText('0.000s')- expect(zeroTime).toBeInTheDocument()- expect(zeroTime).toHaveClass('text-text-quaternary')+ expect(zeroTime)!.toBeInTheDocument()+ expect(zeroTime)!.toHaveClass('text-text-quaternary')})})@@ -664,7 +727,7 @@ describe('WorkflowAppLogList', () => {<WorkflowAppLogList logs={logs} appDetail={createMockApp()} onRefresh={defaultOnRefresh} />,)- expect(screen.getByText('12345')).toBeInTheDocument()+ expect(screen.getByText('12345'))!.toBeInTheDocument()})})@@ -680,7 +743,7 @@ describe('WorkflowAppLogList', () => {)const table = screen.getByRole('table')- expect(table).toBeInTheDocument()+ expect(table)!.toBeInTheDocument()// Should only have header rowconst rows = screen.getAllByRole('row')@@ -721,8 +784,8 @@ describe('WorkflowAppLogList', () => {<WorkflowAppLogList logs={logs} appDetail={createMockApp()} onRefresh={defaultOnRefresh} />,)- expect(screen.getByText('0.000s')).toBeInTheDocument()- expect(screen.getByText('0')).toBeInTheDocument()+ expect(screen.getByText('0.000s'))!.toBeInTheDocument()+ expect(screen.getByText('0'))!.toBeInTheDocument()})it('should handle null workflow_run.triggered_from for non-workflow apps', () => {@@ -739,6 +802,37 @@ describe('WorkflowAppLogList', () => {<WorkflowAppLogList logs={logs} appDetail={chatApp} onRefresh={defaultOnRefresh} />,)+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column+ // Should render without trigger column// Should render without trigger columnexpect(screen.queryByText('appLog.table.header.triggered_from')).not.toBeInTheDocument()})diff --git a/web/app/components/app/workflow-log/index.tsx b/web/app/components/app/workflow-log/index.tsxindex 79ae2ed83cd..242fd7d093d 100644--- a/web/app/components/app/workflow-log/index.tsx+++ b/web/app/components/app/workflow-log/index.tsx@@ -47,7 +47,7 @@ const Logs: FC<ILogsProps> = ({ appDetail }) => {...(debouncedQueryParams.keyword ? { keyword: debouncedQueryParams.keyword } : {}),...((debouncedQueryParams.period !== '9')? {- created_at__after: dayjs().subtract(TIME_PERIOD_MAPPING[debouncedQueryParams.period].value, 'day').startOf('day').tz(timezone).format('YYYY-MM-DDTHH:mm:ssZ'),+ created_at__after: dayjs().subtract(TIME_PERIOD_MAPPING[debouncedQueryParams.period]!.value, 'day').startOf('day').tz(timezone).format('YYYY-MM-DDTHH:mm:ssZ'),created_at__before: dayjs().endOf('day').tz(timezone).format('YYYY-MM-DDTHH:mm:ssZ'),}: {}),diff --git a/web/app/components/apps/__tests__/list.spec.tsx b/web/app/components/apps/__tests__/list.spec.tsxindex 9b826489861..eddcb31d604 100644--- a/web/app/components/apps/__tests__/list.spec.tsx+++ b/web/app/components/apps/__tests__/list.spec.tsx@@ -222,55 +222,55 @@ describe('List', () => {describe('Rendering', () => {it('should render without crashing', () => {renderList()- expect(screen.getByText('app.types.all')).toBeInTheDocument()+ expect(screen.getByText('app.types.all'))!.toBeInTheDocument()})it('should render tab slider with all app types', () => {renderList()- expect(screen.getByText('app.types.all')).toBeInTheDocument()- expect(screen.getByText('app.types.workflow')).toBeInTheDocument()- expect(screen.getByText('app.types.advanced')).toBeInTheDocument()- expect(screen.getByText('app.types.chatbot')).toBeInTheDocument()- expect(screen.getByText('app.types.agent')).toBeInTheDocument()- expect(screen.getByText('app.types.completion')).toBeInTheDocument()+ expect(screen.getByText('app.types.all'))!.toBeInTheDocument()+ expect(screen.getByText('app.types.workflow'))!.toBeInTheDocument()+ expect(screen.getByText('app.types.advanced'))!.toBeInTheDocument()+ expect(screen.getByText('app.types.chatbot'))!.toBeInTheDocument()+ expect(screen.getByText('app.types.agent'))!.toBeInTheDocument()+ expect(screen.getByText('app.types.completion'))!.toBeInTheDocument()})it('should render search input', () => {renderList()- expect(screen.getByRole('textbox')).toBeInTheDocument()+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})it('should render tag filter', () => {renderList()- expect(screen.getByText('common.tag.placeholder')).toBeInTheDocument()+ expect(screen.getByText('common.tag.placeholder'))!.toBeInTheDocument()})it('should render created by me checkbox', () => {renderList()- expect(screen.getByText('app.showMyCreatedAppsOnly')).toBeInTheDocument()+ expect(screen.getByText('app.showMyCreatedAppsOnly'))!.toBeInTheDocument()})it('should render app cards when apps exist', () => {renderList()- expect(screen.getByTestId('app-card-app-1')).toBeInTheDocument()- expect(screen.getByTestId('app-card-app-2')).toBeInTheDocument()+ expect(screen.getByTestId('app-card-app-1'))!.toBeInTheDocument()+ expect(screen.getByTestId('app-card-app-2'))!.toBeInTheDocument()})it('should render new app card for editors', () => {renderList()- expect(screen.getByTestId('new-app-card')).toBeInTheDocument()+ expect(screen.getByTestId('new-app-card'))!.toBeInTheDocument()})it('should render footer when branding is disabled', () => {renderList()- expect(screen.getByTestId('footer')).toBeInTheDocument()+ expect(screen.getByTestId('footer'))!.toBeInTheDocument()})it('should render drop DSL hint for editors', () => {renderList()- expect(screen.getByText('app.newApp.dropDSLToCreateApp')).toBeInTheDocument()+ expect(screen.getByText('app.newApp.dropDSLToCreateApp'))!.toBeInTheDocument()})})@@ -281,7 +281,7 @@ describe('List', () => {fireEvent.click(screen.getByText('app.types.workflow'))await vi.waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const lastCall = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const lastCall = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(lastCall.searchParams.get('category')).toBe(AppModeEnum.WORKFLOW)})@@ -291,7 +291,7 @@ describe('List', () => {fireEvent.click(screen.getByText('app.types.all'))await vi.waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const lastCall = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const lastCall = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]// nuqs removes the default value ('all') from URL paramsexpect(lastCall.searchParams.has('category')).toBe(false)})@@ -300,7 +300,7 @@ describe('List', () => {describe('Search Functionality', () => {it('should render search input field', () => {renderList()- expect(screen.getByRole('textbox')).toBeInTheDocument()+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})it('should handle search input change', () => {@@ -318,7 +318,7 @@ describe('List', () => {renderList()const clearButton = document.querySelector('.group')- expect(clearButton).toBeInTheDocument()+ expect(clearButton)!.toBeInTheDocument()if (clearButton)fireEvent.click(clearButton)@@ -329,14 +329,14 @@ describe('List', () => {describe('Tag Filter', () => {it('should render tag filter component', () => {renderList()- expect(screen.getByText('common.tag.placeholder')).toBeInTheDocument()+ expect(screen.getByText('common.tag.placeholder'))!.toBeInTheDocument()})})describe('Created By Me Filter', () => {it('should render checkbox with correct label', () => {renderList()- expect(screen.getByText('app.showMyCreatedAppsOnly')).toBeInTheDocument()+ expect(screen.getByText('app.showMyCreatedAppsOnly'))!.toBeInTheDocument()})it('should handle checkbox change', () => {@@ -391,39 +391,39 @@ describe('List', () => {describe('Edge Cases', () => {it('should handle multiple renders without issues', () => {const { unmount } = renderWithNuqs(<List />)- expect(screen.getByText('app.types.all')).toBeInTheDocument()+ expect(screen.getByText('app.types.all'))!.toBeInTheDocument()unmount()renderList()- expect(screen.getByText('app.types.all')).toBeInTheDocument()+ expect(screen.getByText('app.types.all'))!.toBeInTheDocument()})it('should render app cards correctly', () => {renderList()- expect(screen.getByText('Test App 1')).toBeInTheDocument()- expect(screen.getByText('Test App 2')).toBeInTheDocument()+ expect(screen.getByText('Test App 1'))!.toBeInTheDocument()+ expect(screen.getByText('Test App 2'))!.toBeInTheDocument()})it('should render with all filter options visible', () => {renderList()- expect(screen.getByRole('textbox')).toBeInTheDocument()- expect(screen.getByText('common.tag.placeholder')).toBeInTheDocument()- expect(screen.getByText('app.showMyCreatedAppsOnly')).toBeInTheDocument()+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()+ expect(screen.getByText('common.tag.placeholder'))!.toBeInTheDocument()+ expect(screen.getByText('app.showMyCreatedAppsOnly'))!.toBeInTheDocument()})})describe('Dragging State', () => {it('should show drop hint when DSL feature is enabled for editors', () => {renderList()- expect(screen.getByText('app.newApp.dropDSLToCreateApp')).toBeInTheDocument()+ expect(screen.getByText('app.newApp.dropDSLToCreateApp'))!.toBeInTheDocument()})it('should render dragging state overlay when dragging', () => {mockDragging = trueconst { container } = renderList()- expect(container).toBeInTheDocument()+ expect(container)!.toBeInTheDocument()})})@@ -431,12 +431,12 @@ describe('List', () => {it('should render all app type tabs', () => {renderList()- expect(screen.getByText('app.types.all')).toBeInTheDocument()- expect(screen.getByText('app.types.workflow')).toBeInTheDocument()- expect(screen.getByText('app.types.advanced')).toBeInTheDocument()- expect(screen.getByText('app.types.chatbot')).toBeInTheDocument()- expect(screen.getByText('app.types.agent')).toBeInTheDocument()- expect(screen.getByText('app.types.completion')).toBeInTheDocument()+ expect(screen.getByText('app.types.all'))!.toBeInTheDocument()+ expect(screen.getByText('app.types.workflow'))!.toBeInTheDocument()+ expect(screen.getByText('app.types.advanced'))!.toBeInTheDocument()+ expect(screen.getByText('app.types.chatbot'))!.toBeInTheDocument()+ expect(screen.getByText('app.types.agent'))!.toBeInTheDocument()+ expect(screen.getByText('app.types.completion'))!.toBeInTheDocument()})it('should update URL for each app type tab click', async () => {@@ -454,7 +454,7 @@ describe('List', () => {onUrlUpdate.mockClear()fireEvent.click(screen.getByText(text))await vi.waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const lastCall = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const lastCall = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(lastCall.searchParams.get('category')).toBe(mode)}})@@ -464,22 +464,22 @@ describe('List', () => {it('should display all app cards from data', () => {renderList()- expect(screen.getByTestId('app-card-app-1')).toBeInTheDocument()- expect(screen.getByTestId('app-card-app-2')).toBeInTheDocument()+ expect(screen.getByTestId('app-card-app-1'))!.toBeInTheDocument()+ expect(screen.getByTestId('app-card-app-2'))!.toBeInTheDocument()})it('should display app names correctly', () => {renderList()- expect(screen.getByText('Test App 1')).toBeInTheDocument()- expect(screen.getByText('Test App 2')).toBeInTheDocument()+ expect(screen.getByText('Test App 1'))!.toBeInTheDocument()+ expect(screen.getByText('Test App 2'))!.toBeInTheDocument()})})describe('Footer Visibility', () => {it('should render footer when branding is disabled', () => {renderList()- expect(screen.getByTestId('footer')).toBeInTheDocument()+ expect(screen.getByTestId('footer'))!.toBeInTheDocument()})})@@ -493,7 +493,7 @@ describe('List', () => {mockOnDSLFileDropped(mockFile)})- expect(screen.getByTestId('create-dsl-modal')).toBeInTheDocument()+ expect(screen.getByTestId('create-dsl-modal'))!.toBeInTheDocument()})it('should close DSL modal when onClose is called', () => {@@ -505,7 +505,7 @@ describe('List', () => {mockOnDSLFileDropped(mockFile)})- expect(screen.getByTestId('create-dsl-modal')).toBeInTheDocument()+ expect(screen.getByTestId('create-dsl-modal'))!.toBeInTheDocument()fireEvent.click(screen.getByTestId('close-dsl-modal'))@@ -521,7 +521,7 @@ describe('List', () => {mockOnDSLFileDropped(mockFile)})- expect(screen.getByTestId('create-dsl-modal')).toBeInTheDocument()+ expect(screen.getByTestId('create-dsl-modal'))!.toBeInTheDocument()fireEvent.click(screen.getByTestId('success-dsl-modal'))@@ -585,7 +585,7 @@ describe('List', () => {it('should handle error state in useEffect', () => {mockServiceState.error = new Error('Test error')const { container } = renderList()- expect(container).toBeInTheDocument()+ expect(container)!.toBeInTheDocument()})})})diff --git a/web/app/components/apps/app-card.tsx b/web/app/components/apps/app-card.tsxindex ba85ce51788..6d76d632f75 100644--- a/web/app/components/apps/app-card.tsx+++ b/web/app/components/apps/app-card.tsx@@ -115,7 +115,7 @@ const AppCardOperationsMenu: React.FC<AppCardOperationsMenuProps> = ({await openAsyncWindow(async () => {const { installed_apps } = await fetchInstalledAppList(app.id)if (installed_apps?.length > 0)- return `${basePath}/explore/installed/${installed_apps[0].id}`+ return `${basePath}/explore/installed/${installed_apps[0]!.id}`throw new Error('No app found in Explore')}, {onError: (err) => {diff --git a/web/app/components/apps/hooks/__tests__/use-apps-query-state.spec.tsx b/web/app/components/apps/hooks/__tests__/use-apps-query-state.spec.tsxindex 8e8e5821a84..4b0c63f580a 100644--- a/web/app/components/apps/hooks/__tests__/use-apps-query-state.spec.tsx+++ b/web/app/components/apps/hooks/__tests__/use-apps-query-state.spec.tsx@@ -114,7 +114,7 @@ describe('useAppsQueryState', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.get('keywords')).toBe('search')expect(update.options.history).toBe('push')})@@ -127,7 +127,7 @@ describe('useAppsQueryState', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.get('tagIDs')).toBe('tag1;tag2')})@@ -139,7 +139,7 @@ describe('useAppsQueryState', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.get('isCreatedByMe')).toBe('true')})@@ -151,7 +151,7 @@ describe('useAppsQueryState', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.has('keywords')).toBe(false)})@@ -163,7 +163,7 @@ describe('useAppsQueryState', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.has('tagIDs')).toBe(false)})@@ -175,7 +175,7 @@ describe('useAppsQueryState', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.has('isCreatedByMe')).toBe(false)})})diff --git a/web/app/components/apps/hooks/use-dsl-drag-drop.ts b/web/app/components/apps/hooks/use-dsl-drag-drop.tsindex 77d89b87da9..3e795018b0a 100644--- a/web/app/components/apps/hooks/use-dsl-drag-drop.ts+++ b/web/app/components/apps/hooks/use-dsl-drag-drop.ts@@ -41,8 +41,8 @@ export const useDSLDragDrop = ({ onDSLFileDropped, containerRef, enabled = truereturnconst file = files[0]- if (file.name.toLowerCase().endsWith('.yaml') || file.name.toLowerCase().endsWith('.yml'))- onDSLFileDropped(file)+ if (file!.name.toLowerCase().endsWith('.yaml') || file!.name.toLowerCase().endsWith('.yml'))+ onDSLFileDropped(file!)}useEffect(() => {diff --git a/web/app/components/apps/list.tsx b/web/app/components/apps/list.tsxindex a898e682f5e..3b30a839d48 100644--- a/web/app/components/apps/list.tsx+++ b/web/app/components/apps/list.tsx@@ -151,7 +151,7 @@ const List: FC<Props> = ({const dynamicMargin = Math.max(100, Math.min(containerHeight * 0.2, 200)) // Clamps to 100-200px range, using 20% of container height as the base valueobserver = new IntersectionObserver((entries) => {- if (entries[0].isIntersecting && !isLoading && !isFetchingNextPage && !error && hasMore)+ if (entries[0]!.isIntersecting && !isLoading && !isFetchingNextPage && !error && hasMore)fetchNextPage()}, {root: containerRef.current,diff --git a/web/app/components/base/amplitude/__tests__/utils.spec.ts b/web/app/components/base/amplitude/__tests__/utils.spec.tsindex f1ff5db1e35..87ac9159d06 100644--- a/web/app/components/base/amplitude/__tests__/utils.spec.ts+++ b/web/app/components/base/amplitude/__tests__/utils.spec.ts@@ -85,7 +85,7 @@ describe('amplitude utils', () => {setUserProperties(properties)expect(mockIdentify).toHaveBeenCalledTimes(1)- const identifyArg = mockIdentify.mock.calls[0][0] as InstanceType<typeof MockIdentify>+ const identifyArg = mockIdentify.mock.calls[0]![0] as InstanceType<typeof MockIdentify>expect(identifyArg).toBeInstanceOf(MockIdentify)expect(identifyArg.setCalls).toEqual([['role', 'owner'],diff --git a/web/app/components/base/app-icon-picker/__tests__/index.spec.tsx b/web/app/components/base/app-icon-picker/__tests__/index.spec.tsxindex 83345120475..07dd809f414 100644--- a/web/app/components/base/app-icon-picker/__tests__/index.spec.tsx+++ b/web/app/components/base/app-icon-picker/__tests__/index.spec.tsx@@ -156,10 +156,10 @@ describe('AppIconPicker', () => {it('should render emoji and image tabs when upload is enabled', async () => {renderPicker()- expect(await screen.findByText(/emoji/i)).toBeInTheDocument()- expect(screen.getByText(/image/i)).toBeInTheDocument()- expect(screen.getByText(/cancel/i)).toBeInTheDocument()- expect(screen.getByText(/ok/i)).toBeInTheDocument()+ expect(await screen.findByText(/emoji/i))!.toBeInTheDocument()+ expect(screen.getByText(/image/i))!.toBeInTheDocument()+ expect(screen.getByText(/cancel/i))!.toBeInTheDocument()+ expect(screen.getByText(/ok/i))!.toBeInTheDocument()})it('should hide the image tab when upload is disabled', () => {@@ -167,7 +167,7 @@ describe('AppIconPicker', () => {renderPicker()expect(screen.queryByText(/image/i)).not.toBeInTheDocument()- expect(screen.getByPlaceholderText(/search/i)).toBeInTheDocument()+ expect(screen.getByPlaceholderText(/search/i))!.toBeInTheDocument()})})@@ -184,10 +184,10 @@ describe('AppIconPicker', () => {renderPicker()await userEvent.click(screen.getByText(/image/i))- expect(screen.getByText(/drop.*here/i)).toBeInTheDocument()+ expect(screen.getByText(/drop.*here/i))!.toBeInTheDocument()await userEvent.click(screen.getByText(/emoji/i))- expect(screen.getByPlaceholderText(/search/i)).toBeInTheDocument()+ expect(screen.getByPlaceholderText(/search/i))!.toBeInTheDocument()})it('should call onSelect with emoji data after emoji selection', async () => {@@ -251,7 +251,7 @@ describe('AppIconPicker', () => {fireEvent.change(input, { target: { files: [new File(['png'], 'avatar.png', { type: 'image/png' })] } })await waitFor(() => {- expect(screen.getByTestId('mock-cropper')).toBeInTheDocument()+ expect(screen.getByTestId('mock-cropper'))!.toBeInTheDocument()})await userEvent.click(screen.getByTestId('trigger-crop'))@@ -261,7 +261,7 @@ describe('AppIconPicker', () => {expect(mocks.handleLocalFileUpload).toHaveBeenCalledTimes(1)})- const uploadedFile = mocks.handleLocalFileUpload.mock.calls[0][0]+ const uploadedFile = mocks.handleLocalFileUpload.mock.calls[0]![0]expect(uploadedFile).toBeInstanceOf(File)expect(uploadedFile.name).toBe('avatar.png')expect(uploadedFile.type).toBe('image/png')@@ -291,7 +291,7 @@ describe('AppIconPicker', () => {await waitFor(() => {expect(screen.queryByTestId('mock-cropper')).not.toBeInTheDocument()const preview = screen.queryByTestId('animated-image')- expect(preview).toBeInTheDocument()+ expect(preview)!.toBeInTheDocument()expect(preview?.getAttribute('src')).toContain('blob:mock-url')})diff --git a/web/app/components/base/audio-btn/__tests__/audio.player.manager.spec.ts b/web/app/components/base/audio-btn/__tests__/audio.player.manager.spec.tsindex c613aa2c116..4a98524ed2d 100644--- a/web/app/components/base/audio-btn/__tests__/audio.player.manager.spec.ts+++ b/web/app/components/base/audio-btn/__tests__/audio.player.manager.spec.ts@@ -90,8 +90,8 @@ describe('AudioPlayerManager', () => {expect(mockAudioPlayerConstructor).toHaveBeenCalledTimes(1)expect(first).toBe(second)- expect(mockState.instances[0].setCallback).toHaveBeenCalledTimes(1)- expect(mockState.instances[0].setCallback).toHaveBeenCalledWith(secondCallback)+ expect(mockState.instances[0]!.setCallback).toHaveBeenCalledTimes(1)+ expect(mockState.instances[0]!.setCallback).toHaveBeenCalledWith(secondCallback)})it('should cleanup existing player and create a new one when msg id changes', () => {@@ -102,9 +102,9 @@ describe('AudioPlayerManager', () => {const next = manager.getAudioPlayer('/apps/1/text-to-audio', false, 'msg-2', 'world', 'en-US', callback)- expect(previous.pauseAudio).toHaveBeenCalledTimes(1)- expect(previous.cacheBuffers).toEqual([])- expect(previous.sourceBuffer?.abort).toHaveBeenCalledTimes(1)+ expect(previous!.pauseAudio).toHaveBeenCalledTimes(1)+ expect(previous!.cacheBuffers).toEqual([])+ expect(previous!.sourceBuffer?.abort).toHaveBeenCalledTimes(1)expect(mockAudioPlayerConstructor).toHaveBeenCalledTimes(2)expect(next).toBe(mockState.instances[1])})@@ -114,7 +114,7 @@ describe('AudioPlayerManager', () => {const callback = vi.fn()manager.getAudioPlayer('/text-to-audio', false, 'msg-1', 'hello', 'en-US', callback)const previous = mockState.instances[0]- previous.pauseAudio.mockImplementation(() => {+ previous!.pauseAudio.mockImplementation(() => {throw new Error('cleanup failure')})@@ -122,7 +122,7 @@ describe('AudioPlayerManager', () => {manager.getAudioPlayer('/apps/1/text-to-audio', false, 'msg-2', 'world', 'en-US', callback)}).not.toThrow()- expect(previous.pauseAudio).toHaveBeenCalledTimes(1)+ expect(previous!.pauseAudio).toHaveBeenCalledTimes(1)expect(mockAudioPlayerConstructor).toHaveBeenCalledTimes(2)})})@@ -135,8 +135,8 @@ describe('AudioPlayerManager', () => {manager.resetMsgId('msg-updated')- expect(mockState.instances[0].resetMsgId).toHaveBeenCalledTimes(1)- expect(mockState.instances[0].resetMsgId).toHaveBeenCalledWith('msg-updated')+ expect(mockState.instances[0]!.resetMsgId).toHaveBeenCalledTimes(1)+ expect(mockState.instances[0]!.resetMsgId).toHaveBeenCalledWith('msg-updated')})it('should not throw when resetting message id without an audio player', () => {diff --git a/web/app/components/base/audio-btn/__tests__/audio.spec.ts b/web/app/components/base/audio-btn/__tests__/audio.spec.tsindex 4399cb40fd0..16f880719dd 100644--- a/web/app/components/base/audio-btn/__tests__/audio.spec.ts+++ b/web/app/components/base/audio-btn/__tests__/audio.spec.ts@@ -241,10 +241,10 @@ describe('AudioPlayer', () => {expect(player.mediaSource).toBe(mediaSource as unknown as MediaSource)expect(globalThis.URL.createObjectURL).toHaveBeenCalledTimes(1)- expect(audio.src).toBe('blob:mock-url')- expect(audio.autoplay).toBe(true)- expect(audioContext.createMediaElementSource).toHaveBeenCalledWith(audio)- expect(audioContext.connect).toHaveBeenCalledTimes(1)+ expect(audio!.src).toBe('blob:mock-url')+ expect(audio!.autoplay).toBe(true)+ expect(audioContext!.createMediaElementSource).toHaveBeenCalledWith(audio)+ expect(audioContext!.connect).toHaveBeenCalledTimes(1)})it('should notify unsupported browser when no MediaSource implementation exists', () => {@@ -254,7 +254,7 @@ describe('AudioPlayer', () => {const audio = testState.audios[0]expect(player.mediaSource).toBeNull()- expect(audio.src).toBe('')+ expect(audio!.src).toBe('')expect(mockToastNotify).toHaveBeenCalledTimes(1)expect(mockToastNotify).toHaveBeenCalledWith(expect.objectContaining({@@ -271,8 +271,8 @@ describe('AudioPlayer', () => {const audio = testState.audios[0]expect(player.mediaSource).not.toBeNull()- expect(audio.disableRemotePlayback).toBe(true)- expect(audio.controls).toBe(true)+ expect(audio!.disableRemotePlayback).toBe(true)+ expect(audio!.controls).toBe(true)})})@@ -282,14 +282,14 @@ describe('AudioPlayer', () => {const player = new AudioPlayer('/text-to-audio', true, 'msg-1', 'hello', 'en-US', callback)const audio = testState.audios[0]- audio.emit('play')- audio.emit('ended')- audio.emit('error')- audio.emit('paused')- audio.emit('loaded')- audio.emit('timeupdate')- audio.emit('loadeddate')- audio.emit('canplay')+ audio!.emit('play')+ audio!.emit('ended')+ audio!.emit('error')+ audio!.emit('paused')+ audio!.emit('loaded')+ audio!.emit('timeupdate')+ audio!.emit('loadeddate')+ audio!.emit('canplay')expect(player.callback).toBe(callback)expect(callback).toHaveBeenCalledWith('play')@@ -306,11 +306,11 @@ describe('AudioPlayer', () => {const player = new AudioPlayer('/text-to-audio', true, 'msg-1', 'hello', 'en-US', vi.fn())const mediaSource = testState.mediaSources[0]- mediaSource.emit('sourceopen')- mediaSource.emit('sourceopen')+ mediaSource!.emit('sourceopen')+ mediaSource!.emit('sourceopen')- expect(mediaSource.addSourceBuffer).toHaveBeenCalledTimes(1)- expect(player.sourceBuffer).toBe(mediaSource.sourceBuffer)+ expect(mediaSource!.addSourceBuffer).toHaveBeenCalledTimes(1)+ expect(player.sourceBuffer).toBe(mediaSource!.sourceBuffer)})})@@ -366,12 +366,12 @@ describe('AudioPlayer', () => {const audioContext = testState.audioContexts[0]player.isLoadData = true- audioContext.state = 'suspended'+ audioContext!.state = 'suspended'player.playAudio()await Promise.resolve()- expect(audioContext.resume).toHaveBeenCalledTimes(1)- expect(audio.play).toHaveBeenCalledTimes(1)+ expect(audioContext!.resume).toHaveBeenCalledTimes(1)+ expect(audio!.play).toHaveBeenCalledTimes(1)expect(callback).toHaveBeenCalledWith('play')})@@ -382,11 +382,11 @@ describe('AudioPlayer', () => {const audioContext = testState.audioContexts[0]player.isLoadData = true- audioContext.state = 'running'- audio.ended = true+ audioContext!.state = 'running'+ audio!.ended = trueplayer.playAudio()- expect(audio.play).toHaveBeenCalledTimes(1)+ expect(audio!.play).toHaveBeenCalledTimes(1)expect(callback).toHaveBeenCalledWith('play')})@@ -397,11 +397,11 @@ describe('AudioPlayer', () => {const audioContext = testState.audioContexts[0]player.isLoadData = true- audioContext.state = 'running'- audio.ended = false+ audioContext!.state = 'running'+ audio!.ended = falseplayer.playAudio()- expect(audio.play).not.toHaveBeenCalled()+ expect(audio!.play).not.toHaveBeenCalled()expect(callback).toHaveBeenCalledWith('play')})@@ -427,8 +427,8 @@ describe('AudioPlayer', () => {player.pauseAudio()expect(callback).toHaveBeenCalledWith('paused')- expect(audio.pause).toHaveBeenCalledTimes(1)- expect(audioContext.suspend).toHaveBeenCalledTimes(1)+ expect(audio!.pause).toHaveBeenCalledTimes(1)+ expect(audioContext!.suspend).toHaveBeenCalledTimes(1)})})@@ -453,7 +453,7 @@ describe('AudioPlayer', () => {expect(player.isLoadData).toBe(false)expect(player.cacheBuffers).toHaveLength(0)- expect(mediaSource.endOfStream).toHaveBeenCalledTimes(1)+ expect(mediaSource!.endOfStream).toHaveBeenCalledTimes(1)expect(callback).not.toHaveBeenCalledWith('play')}finally {@@ -469,19 +469,19 @@ describe('AudioPlayer', () => {const mediaSource = testState.mediaSources[0]const audioBase64 = Buffer.from('hello').toString('base64')- mediaSource.emit('sourceopen')- audio.paused = true+ mediaSource!.emit('sourceopen')+ audio!.paused = trueawait player.playAudioWithAudio(audioBase64, true)await Promise.resolve()expect(player.isLoadData).toBe(true)expect(player.cacheBuffers).toHaveLength(0)- expect(mediaSource.sourceBuffer.appendBuffer).toHaveBeenCalledTimes(1)- const appendedAudioData = mediaSource.sourceBuffer.appendBuffer.mock.calls[0][0]+ expect(mediaSource!.sourceBuffer.appendBuffer).toHaveBeenCalledTimes(1)+ const appendedAudioData = mediaSource!.sourceBuffer.appendBuffer.mock.calls[0]![0]expect(appendedAudioData).toBeInstanceOf(ArrayBuffer)expect(appendedAudioData.byteLength).toBeGreaterThan(0)- expect(audioContext.resume).toHaveBeenCalledTimes(1)- expect(audio.play).toHaveBeenCalledTimes(1)+ expect(audioContext!.resume).toHaveBeenCalledTimes(1)+ expect(audio!.play).toHaveBeenCalledTimes(1)expect(callback).toHaveBeenCalledWith('play')})@@ -494,8 +494,8 @@ describe('AudioPlayer', () => {await player.playAudioWithAudio(Buffer.from('hello').toString('base64'), false)expect(player.isLoadData).toBe(false)- expect(audioContext.resume).not.toHaveBeenCalled()- expect(audio.play).not.toHaveBeenCalled()+ expect(audioContext!.resume).not.toHaveBeenCalled()+ expect(audio!.play).not.toHaveBeenCalled()expect(callback).not.toHaveBeenCalledWith('play')})@@ -504,11 +504,11 @@ describe('AudioPlayer', () => {const player = new AudioPlayer('/text-to-audio', true, 'msg-1', 'hello', 'en-US', callback)const audio = testState.audios[0]- audio.paused = false- audio.ended = true+ audio!.paused = false+ audio!.ended = trueawait player.playAudioWithAudio(Buffer.from('hello').toString('base64'), true)- expect(audio.play).toHaveBeenCalledTimes(1)+ expect(audio!.play).toHaveBeenCalledTimes(1)expect(callback).toHaveBeenCalledWith('play')})@@ -517,12 +517,12 @@ describe('AudioPlayer', () => {const player = new AudioPlayer('/text-to-audio', true, 'msg-1', 'hello', 'en-US', callback)const audio = testState.audios[0]- audio.paused = false- audio.ended = false- audio.played = {}+ audio!.paused = false+ audio!.ended = false+ audio!.played = {}await player.playAudioWithAudio(Buffer.from('hello').toString('base64'), true)- expect(audio.play).not.toHaveBeenCalled()+ expect(audio!.play).not.toHaveBeenCalled()expect(callback).not.toHaveBeenCalledWith('play')})@@ -531,12 +531,12 @@ describe('AudioPlayer', () => {const player = new AudioPlayer('/text-to-audio', true, 'msg-1', 'hello', 'en-US', callback)const audio = testState.audios[0]- audio.paused = false- audio.ended = false- audio.played = null+ audio!.paused = false+ audio!.ended = false+ audio!.played = nullawait player.playAudioWithAudio(Buffer.from('hello').toString('base64'), true)- expect(audio.play).toHaveBeenCalledTimes(1)+ expect(audio!.play).toHaveBeenCalledTimes(1)expect(callback).toHaveBeenCalledWith('play')})})@@ -567,8 +567,8 @@ describe('AudioPlayer', () => {it('should queue incoming buffer when source buffer is updating', () => {const player = new AudioPlayer('/text-to-audio', true, 'msg-1', 'hello', 'en-US', null)const mediaSource = testState.mediaSources[0]- mediaSource.emit('sourceopen')- mediaSource.sourceBuffer.updating = true+ mediaSource!.emit('sourceopen')+ mediaSource!.sourceBuffer.updating = true; (player as unknown as { receiveAudioData: (data: Uint8Array) => void }).receiveAudioData(new Uint8Array([1, 2, 3]))@@ -578,16 +578,16 @@ describe('AudioPlayer', () => {it('should append previously queued buffer before new one when source buffer is idle', () => {const player = new AudioPlayer('/text-to-audio', true, 'msg-1', 'hello', 'en-US', null)const mediaSource = testState.mediaSources[0]- mediaSource.emit('sourceopen')+ mediaSource!.emit('sourceopen')const existingBuffer = new ArrayBuffer(2)player.cacheBuffers = [existingBuffer]- mediaSource.sourceBuffer.updating = false+ mediaSource!.sourceBuffer.updating = false; (player as unknown as { receiveAudioData: (data: Uint8Array) => void }).receiveAudioData(new Uint8Array([9]))- expect(mediaSource.sourceBuffer.appendBuffer).toHaveBeenCalledTimes(1)- expect(mediaSource.sourceBuffer.appendBuffer).toHaveBeenCalledWith(existingBuffer)+ expect(mediaSource!.sourceBuffer.appendBuffer).toHaveBeenCalledTimes(1)+ expect(mediaSource!.sourceBuffer.appendBuffer).toHaveBeenCalledWith(existingBuffer)expect(player.cacheBuffers.length).toBe(1)})@@ -595,15 +595,15 @@ describe('AudioPlayer', () => {vi.useFakeTimers()const player = new AudioPlayer('/text-to-audio', true, 'msg-1', 'hello', 'en-US', null)const mediaSource = testState.mediaSources[0]- mediaSource.emit('sourceopen')- mediaSource.sourceBuffer.updating = false+ mediaSource!.emit('sourceopen')+ mediaSource!.sourceBuffer.updating = falseplayer.cacheBuffers = [new ArrayBuffer(3)]; (player as unknown as { finishStream: () => void }).finishStream()vi.advanceTimersByTime(50)- expect(mediaSource.sourceBuffer.appendBuffer).toHaveBeenCalledTimes(1)- expect(mediaSource.endOfStream).toHaveBeenCalledTimes(1)+ expect(mediaSource!.sourceBuffer.appendBuffer).toHaveBeenCalledTimes(1)+ expect(mediaSource!.endOfStream).toHaveBeenCalledTimes(1)vi.useRealTimers()})})diff --git a/web/app/components/base/audio-btn/__tests__/index.spec.tsx b/web/app/components/base/audio-btn/__tests__/index.spec.tsxindex 8f6c26d12b7..0fb81e9ab67 100644--- a/web/app/components/base/audio-btn/__tests__/index.spec.tsx+++ b/web/app/components/base/audio-btn/__tests__/index.spec.tsx@@ -32,7 +32,7 @@ describe('AudioBtn', () => {const hoverAndCheckTooltip = async (expectedText: string) => {await userEvent.hover(getButton())- expect(await screen.findByText(expectedText)).toBeInTheDocument()+ expect(await screen.findByText(expectedText))!.toBeInTheDocument()}const getLatestAudioCallback = () => {@@ -64,7 +64,7 @@ describe('AudioBtn', () => {it('should render button with play tooltip by default', async () => {render(<AudioBtn value="hello" />)- expect(getButton()).toBeInTheDocument()+ expect(getButton())!.toBeInTheDocument()expect(getButton()).not.toBeDisabled()await hoverAndCheckTooltip('play')})@@ -73,7 +73,7 @@ describe('AudioBtn', () => {const { container } = render(<AudioBtn value="hello" className="custom-wrapper" />)const wrapper = container.firstElementChild- expect(wrapper).toHaveClass('custom-wrapper')+ expect(wrapper)!.toHaveClass('custom-wrapper')})})@@ -87,8 +87,8 @@ describe('AudioBtn', () => {await waitFor(() => expect(mockGetAudioPlayer).toHaveBeenCalled())const call = mockGetAudioPlayer.mock.calls[0]- expect(call[0]).toBe('/text-to-audio')- expect(call[1]).toBe(true)+ expect(call![0]).toBe('/text-to-audio')+ expect(call![1]).toBe(true)})it('should call app endpoint when appId exists', async () => {@@ -100,8 +100,8 @@ describe('AudioBtn', () => {await waitFor(() => expect(mockGetAudioPlayer).toHaveBeenCalled())const call = mockGetAudioPlayer.mock.calls[0]- expect(call[0]).toBe('/apps/123/text-to-audio')- expect(call[1]).toBe(false)+ expect(call![0]).toBe('/apps/123/text-to-audio')+ expect(call![1]).toBe(false)})it('should call installed app endpoint for explore installed routes', async () => {@@ -113,8 +113,8 @@ describe('AudioBtn', () => {await waitFor(() => expect(mockGetAudioPlayer).toHaveBeenCalled())const call = mockGetAudioPlayer.mock.calls[0]- expect(call[0]).toBe('/installed-apps/456/text-to-audio')- expect(call[1]).toBe(false)+ expect(call![0]).toBe('/installed-apps/456/text-to-audio')+ expect(call![1]).toBe(false)})})@@ -126,9 +126,9 @@ describe('AudioBtn', () => {await waitFor(() => {expect(mockPlayAudio).toHaveBeenCalledTimes(1)- expect(getButton()).toBeDisabled()+ expect(getButton())!.toBeDisabled()})- expect(screen.getByRole('status')).toBeInTheDocument()+ expect(screen.getByRole('status'))!.toBeInTheDocument()await hoverAndCheckTooltip('loading')})@@ -159,7 +159,7 @@ describe('AudioBtn', () => {})await hoverAndCheckTooltip('loading')- expect(getButton()).toBeDisabled()+ expect(getButton())!.toBeDisabled()})it.each(['ended', 'paused', 'error'])('should return to play tooltip when %s event is received', async (event) => {@@ -183,9 +183,9 @@ describe('AudioBtn', () => {await waitFor(() => expect(mockGetAudioPlayer).toHaveBeenCalled())const call = mockGetAudioPlayer.mock.calls[0]- expect(call[2]).toBe('msg-1')- expect(call[3]).toBe('hello')- expect(call[4]).toBe('en-US')+ expect(call![2]).toBe('msg-1')+ expect(call![3]).toBe('hello')+ expect(call![4]).toBe('en-US')})it('should keep empty route when neither token nor appId is present', async () => {@@ -194,9 +194,9 @@ describe('AudioBtn', () => {await waitFor(() => expect(mockGetAudioPlayer).toHaveBeenCalled())const call = mockGetAudioPlayer.mock.calls[0]- expect(call[0]).toBe('')- expect(call[1]).toBe(false)- expect(call[3]).toBeUndefined()+ expect(call![0]).toBe('')+ expect(call![1]).toBe(false)+ expect(call![3]).toBeUndefined()})})})diff --git a/web/app/components/base/audio-gallery/AudioPlayer.tsx b/web/app/components/base/audio-gallery/AudioPlayer.tsxindex 9174b13356b..c3b2056698d 100644--- a/web/app/components/base/audio-gallery/AudioPlayer.tsx+++ b/web/app/components/base/audio-gallery/AudioPlayer.tsx@@ -95,7 +95,7 @@ const AudioPlayer: React.FC<AudioPlayerProps> = ({ src, srcs }) => {for (let i = 0; i < samples; i++) {let sum = 0for (let j = 0; j < blockSize; j++)- sum += Math.abs(channelData[i * blockSize + j])+ sum += Math.abs(channelData[i * blockSize + j]!)// Apply nonlinear scaling to enhance small amplitudeswaveformData.push((sum / blockSize) * 5)}@@ -145,7 +145,7 @@ const AudioPlayer: React.FC<AudioPlayerProps> = ({ src, srcs }) => {e.preventDefault()const getClientX = (event: React.MouseEvent | React.TouchEvent): number => {if ('touches' in event)- return event.touches[0].clientX+ return event.touches[0]!.clientXreturn event.clientX}const updateProgress = (clientX: number) => {diff --git a/web/app/components/base/audio-gallery/__tests__/AudioPlayer.spec.tsx b/web/app/components/base/audio-gallery/__tests__/AudioPlayer.spec.tsxindex a86188f635b..fc5578d5a46 100644--- a/web/app/components/base/audio-gallery/__tests__/AudioPlayer.spec.tsx+++ b/web/app/components/base/audio-gallery/__tests__/AudioPlayer.spec.tsx@@ -47,7 +47,7 @@ async function advanceWaveformTimer() {type ReactEventHandler = ((...args: any[]) => void) | undefinedfunction getReactProps<T extends Element>(el: T): Record<string, ReactEventHandler> {const key = Object.keys(el).find(k => k.startsWith('__reactProps$'))- return key ? (el as unknown as Record<string, Record<string, ReactEventHandler>>)[key] : {}+ return key ? (el as unknown as Record<string, Record<string, ReactEventHandler>>)[key]! : {}}// ─── Setup / teardown ─────────────────────────────────────────────────────────@@ -77,8 +77,8 @@ describe('AudioPlayer — rendering', () => {it('should render the play button and audio element when given a src', () => {render(<AudioPlayer src="https://example.com/a.mp3" />)- expect(screen.getByTestId('play-pause-btn')).toBeInTheDocument()- expect(document.querySelector('audio')).toBeInTheDocument()+ expect(screen.getByTestId('play-pause-btn'))!.toBeInTheDocument()+ expect(document.querySelector('audio'))!.toBeInTheDocument()expect(document.querySelector('audio')?.getAttribute('src')).toBe('https://example.com/a.mp3')})@@ -93,7 +93,7 @@ describe('AudioPlayer — rendering', () => {it('should render without crashing when no props are supplied', () => {render(<AudioPlayer />)- expect(screen.getByTestId('play-pause-btn')).toBeInTheDocument()+ expect(screen.getByTestId('play-pause-btn'))!.toBeInTheDocument()})})@@ -129,14 +129,14 @@ describe('AudioPlayer — play/pause', () => {render(<AudioPlayer src="https://example.com/a.mp3" />)const btn = screen.getByTestId('play-pause-btn')- expect(btn.querySelector('.i-ri-play-large-fill')).toBeInTheDocument()+ expect(btn.querySelector('.i-ri-play-large-fill'))!.toBeInTheDocument()expect(btn.querySelector('.i-ri-pause-circle-fill')).not.toBeInTheDocument()await act(async () => {fireEvent.click(btn)})- expect(btn.querySelector('.i-ri-pause-circle-fill')).toBeInTheDocument()+ expect(btn.querySelector('.i-ri-pause-circle-fill'))!.toBeInTheDocument()expect(btn.querySelector('.i-ri-play-large-fill')).not.toBeInTheDocument()})@@ -147,14 +147,14 @@ describe('AudioPlayer — play/pause', () => {await act(async () => {fireEvent.click(btn)})- expect(btn.querySelector('.i-ri-pause-circle-fill')).toBeInTheDocument()+ expect(btn.querySelector('.i-ri-pause-circle-fill'))!.toBeInTheDocument()const audio = document.querySelector('audio') as HTMLAudioElementawait act(async () => {audio.dispatchEvent(new Event('ended'))})- expect(btn.querySelector('.i-ri-play-large-fill')).toBeInTheDocument()+ expect(btn.querySelector('.i-ri-play-large-fill'))!.toBeInTheDocument()})it('should disable the play button when an audio error occurs', async () => {@@ -165,7 +165,7 @@ describe('AudioPlayer — play/pause', () => {audio.dispatchEvent(new Event('error'))})- expect(screen.getByTestId('play-pause-btn')).toBeDisabled()+ expect(screen.getByTestId('play-pause-btn'))!.toBeDisabled()})})@@ -181,7 +181,7 @@ describe('AudioPlayer — audio events', () => {audio.dispatchEvent(new Event('loadedmetadata'))})- expect(screen.getByText('1:30')).toBeInTheDocument()+ expect(screen.getByText('1:30'))!.toBeInTheDocument()})it('should update bufferedTime on progress event', async () => {@@ -216,7 +216,7 @@ describe('AudioPlayer — audio events', () => {audio.dispatchEvent(new Event('error'))})- expect(screen.getByTestId('play-pause-btn')).toBeDisabled()+ expect(screen.getByTestId('play-pause-btn'))!.toBeDisabled()})})@@ -230,7 +230,7 @@ describe('AudioPlayer — waveform generation', () => {render(<AudioPlayer src="https://cdn.example/audio.mp3" />)await advanceWaveformTimer()- expect(screen.getByTestId('waveform-canvas')).toBeInTheDocument()+ expect(screen.getByTestId('waveform-canvas'))!.toBeInTheDocument()})it('should use fallback random waveform when fetch returns not-ok', async () => {@@ -240,7 +240,7 @@ describe('AudioPlayer — waveform generation', () => {render(<AudioPlayer src="https://cdn.example/audio.mp3" />)await advanceWaveformTimer()- expect(screen.getByTestId('waveform-canvas')).toBeInTheDocument()+ expect(screen.getByTestId('waveform-canvas'))!.toBeInTheDocument()})it('should use fallback waveform when decodeAudioData rejects', async () => {@@ -257,7 +257,7 @@ describe('AudioPlayer — waveform generation', () => {render(<AudioPlayer src="https://cdn.example/audio.mp3" />)await advanceWaveformTimer()- expect(screen.getByTestId('waveform-canvas')).toBeInTheDocument()+ expect(screen.getByTestId('waveform-canvas'))!.toBeInTheDocument()})it('should show Toast when AudioContext is not available', async () => {@@ -276,7 +276,7 @@ describe('AudioPlayer — waveform generation', () => {render(<AudioPlayer srcs={['blob:something']} />)await advanceWaveformTimer()- expect(screen.getByTestId('play-pause-btn')).toBeDisabled()+ expect(screen.getByTestId('play-pause-btn'))!.toBeDisabled()})it('should not trigger waveform generation when no src or srcs provided', async () => {@@ -305,7 +305,7 @@ describe('AudioPlayer — waveform generation', () => {render(<AudioPlayer src="https://cdn.example/audio.mp3" />)await advanceWaveformTimer()- expect(screen.getByTestId('waveform-canvas')).toBeInTheDocument()+ expect(screen.getByTestId('waveform-canvas'))!.toBeInTheDocument()})it('should use webkitAudioContext when AudioContext is unavailable', async () => {@@ -316,7 +316,7 @@ describe('AudioPlayer — waveform generation', () => {render(<AudioPlayer src="https://cdn.example/audio.mp3" />)await advanceWaveformTimer()- expect(screen.getByTestId('waveform-canvas')).toBeInTheDocument()+ expect(screen.getByTestId('waveform-canvas'))!.toBeInTheDocument()})})@@ -425,7 +425,7 @@ describe('AudioPlayer — missing coverage', () => {HTMLCanvasElement.prototype.getContext = vi.fn().mockReturnValue(null)render(<AudioPlayer src="https://example.com/audio.mp3" />)- expect(screen.getByTestId('waveform-canvas')).toBeInTheDocument()+ expect(screen.getByTestId('waveform-canvas'))!.toBeInTheDocument()HTMLCanvasElement.prototype.getContext = originalGetContext})@@ -535,7 +535,7 @@ describe('AudioPlayer — missing coverage', () => {fireEvent.click(btn)})- expect(btn).toBeDisabled()+ expect(btn)!.toBeDisabled()expect(HTMLMediaElement.prototype.play).not.toHaveBeenCalled()expect(toastSpy).not.toHaveBeenCalled()toastSpy.mockRestore()@@ -606,7 +606,7 @@ describe('AudioPlayer — additional branch coverage', () => {audio.dispatchEvent(new Event('error'))})- expect(screen.queryByTestId('play-pause-btn')).toBeDisabled()+ expect(screen.queryByTestId('play-pause-btn'))!.toBeDisabled()})it('should update current time on timeupdate event', async () => {@@ -632,7 +632,7 @@ describe('AudioPlayer — additional branch coverage', () => {fireEvent.click(btn)})- expect(btn).toBeDisabled()+ expect(btn)!.toBeDisabled()expect(HTMLMediaElement.prototype.play).not.toHaveBeenCalled()expect(toastSpy).not.toHaveBeenCalled()toastSpy.mockRestore()@@ -654,7 +654,7 @@ describe('AudioPlayer — additional branch coverage', () => {})await advanceWaveformTimer()- expect(screen.getByTestId('waveform-canvas')).toBeInTheDocument()+ expect(screen.getByTestId('waveform-canvas'))!.toBeInTheDocument()})it('should handle missing canvas/audio in handleCanvasInteraction/handleMouseMove', async () => {@@ -683,7 +683,7 @@ describe('AudioPlayer — additional branch coverage', () => {audio.dispatchEvent(new Event('timeupdate'))})- expect(canvas).toBeInTheDocument()+ expect(canvas)!.toBeInTheDocument()})it('should hit null-ref guards in canvas handlers after unmount', async () => {@@ -710,6 +710,6 @@ describe('AudioPlayer — additional branch coverage', () => {fireEvent.mouseMove(canvas, { clientX: 180 }) // time near 90, outside 0-10})- expect(canvas).toBeInTheDocument()+ expect(canvas)!.toBeInTheDocument()})})diff --git a/web/app/components/base/block-input/index.tsx b/web/app/components/base/block-input/index.tsxindex 3a467e97dce..70f66ad3adc 100644--- a/web/app/components/base/block-input/index.tsx+++ b/web/app/components/base/block-input/index.tsx@@ -75,7 +75,7 @@ const BlockInput: FC<IBlockInputProps> = ({return (<VarHighlightkey={`var-${index}`}- name={variableMatch[1]}+ name={variableMatch[1]!}/>)}diff --git a/web/app/components/base/carousel/__tests__/index.spec.tsx b/web/app/components/base/carousel/__tests__/index.spec.tsxindex e409b85757f..f448d02825f 100644--- a/web/app/components/base/carousel/__tests__/index.spec.tsx+++ b/web/app/components/base/carousel/__tests__/index.spec.tsx@@ -99,10 +99,10 @@ describe('Carousel', () => {it('should render region and slides when used with content and items', () => {renderCarouselWithControls()- expect(screen.getByRole('region')).toHaveAttribute('aria-roledescription', 'carousel')- expect(screen.getByTestId('carousel-content')).toHaveClass('flex')+ expect(screen.getByRole('region'))!.toHaveAttribute('aria-roledescription', 'carousel')+ expect(screen.getByTestId('carousel-content'))!.toHaveClass('flex')screen.getAllByRole('group').forEach((slide) => {- expect(slide).toHaveAttribute('aria-roledescription', 'slide')+ expect(slide)!.toHaveAttribute('aria-roledescription', 'slide')})})})@@ -130,7 +130,7 @@ describe('Carousel', () => {{ axis: 'y' },undefined,)- expect(screen.getByTestId('carousel-content')).toHaveClass('flex-col')+ expect(screen.getByTestId('carousel-content'))!.toHaveClass('flex-col')})})@@ -171,7 +171,7 @@ describe('Carousel', () => {renderCarouselWithControls()const dots = screen.getAllByRole('button', { name: 'Dot' })- fireEvent.click(dots[2])+ fireEvent.click(dots[2]!)expect(mockApi.scrollTo).toHaveBeenCalledWith(2)})@@ -191,9 +191,9 @@ describe('Carousel', () => {})const dots = screen.getAllByRole('button', { name: 'Dot' })- expect(screen.getByRole('button', { name: 'Prev' })).toBeEnabled()- expect(screen.getByRole('button', { name: 'Next' })).toBeEnabled()- expect(dots[2]).toHaveAttribute('data-state', 'active')+ expect(screen.getByRole('button', { name: 'Prev' }))!.toBeEnabled()+ expect(screen.getByRole('button', { name: 'Next' }))!.toBeEnabled()+ expect(dots[2])!.toHaveAttribute('data-state', 'active')})it('should subscribe to embla events and unsubscribe from select on unmount', () => {@@ -232,8 +232,8 @@ describe('Carousel', () => {renderCarouselWithControls()- expect(screen.getByRole('button', { name: 'Prev' })).toBeDisabled()- expect(screen.getByRole('button', { name: 'Next' })).toBeDisabled()+ expect(screen.getByRole('button', { name: 'Prev' }))!.toBeDisabled()+ expect(screen.getByRole('button', { name: 'Next' }))!.toBeDisabled()expect(screen.queryByRole('button', { name: 'Dot' })).not.toBeInTheDocument()})diff --git a/web/app/components/base/chat/__tests__/utils.spec.ts b/web/app/components/base/chat/__tests__/utils.spec.tsindex a9a05c60651..0951880f9c3 100644--- a/web/app/components/base/chat/__tests__/utils.spec.ts+++ b/web/app/components/base/chat/__tests__/utils.spec.ts@@ -418,11 +418,11 @@ describe('chat utils - url params and answer helpers', () => {const tree = buildChatItemTree(list)expect(tree.length).toBe(1)- expect(tree[0].id).toBe('q1')- expect(tree[0].children?.[0].id).toBe('a1')- expect(tree[0].children?.[0].children?.[0].id).toBe('q2')- expect(tree[0].children?.[0].children?.[0].children?.[0].id).toBe('a2')- expect(tree[0].children?.[0].children?.[0].children?.[0].siblingIndex).toBe(0)+ expect(tree[0]!.id).toBe('q1')+ expect(tree[0]!.children?.[0]!.id).toBe('a1')+ expect(tree[0]!.children?.[0]!.children?.[0]!.id).toBe('q2')+ expect(tree[0]!.children?.[0]!.children?.[0]!.children?.[0]!.id).toBe('a2')+ expect(tree[0]!.children?.[0]!.children?.[0]!.children?.[0]!.siblingIndex).toBe(0)})it('buildChatItemTree builds nested tree based on parentMessageId', () => {@@ -439,23 +439,23 @@ describe('chat utils - url params and answer helpers', () => {const tree = buildChatItemTree(list)expect(tree.length).toBe(2)- expect(tree[0].id).toBe('q1')- expect(tree[1].id).toBe('q4')-- const a1 = tree[0].children![0]- expect(a1.id).toBe('a1')- expect(a1.children?.length).toBe(2)- expect(a1.children![0].id).toBe('q2')- expect(a1.children![1].id).toBe('q3')- expect(a1.children![0].children![0].siblingIndex).toBe(0)- expect(a1.children![1].children![0].siblingIndex).toBe(1)+ expect(tree[0]!.id).toBe('q1')+ expect(tree[1]!.id).toBe('q4')++ const a1 = tree[0]!.children![0]+ expect(a1!.id).toBe('a1')+ expect(a1!.children?.length).toBe(2)+ expect(a1!.children![0]!.id).toBe('q2')+ expect(a1!.children![1]!.id).toBe('q3')+ expect(a1!.children![0]!.children![0]!.siblingIndex).toBe(0)+ expect(a1!.children![1]!.children![0]!.siblingIndex).toBe(1)})it('getThreadMessages node without children', () => {const tree = [{ id: 'q1', isAnswer: false }]const thread = getThreadMessages(tree as unknown as ChatItemInTree[], 'q1')expect(thread.length).toBe(1)- expect(thread[0].id).toBe('q1')+ expect(thread[0]!.id).toBe('q1')})it('getThreadMessages target not found', () => {@@ -494,8 +494,8 @@ describe('chat utils - url params and answer helpers', () => {const thread = getThreadMessages(tree as unknown as ChatItemInTree[])expect(thread.length).toBe(4)expect(thread.map(t => t.id)).toEqual(['q1', 'a1', 'q2', 'a2'])- expect(thread[1].siblingCount).toBe(1)- expect(thread[3].siblingCount).toBe(1)+ expect(thread[1]!.siblingCount).toBe(1)+ expect(thread[3]!.siblingCount).toBe(1)})it('getThreadMessages to specific target', () => {@@ -531,8 +531,8 @@ describe('chat utils - url params and answer helpers', () => {const thread = getThreadMessages(tree as unknown as ChatItemInTree[], 'a3')expect(thread.length).toBe(4)expect(thread.map(t => t.id)).toEqual(['q1', 'a1', 'q3', 'a3'])- expect(thread[3].prevSibling).toBe('a2')- expect(thread[3].nextSibling).toBeUndefined()+ expect(thread[3]!.prevSibling).toBe('a2')+ expect(thread[3]!.nextSibling).toBeUndefined()})it('getThreadMessages targetNode has descendants', () => {@@ -568,7 +568,7 @@ describe('chat utils - url params and answer helpers', () => {const thread = getThreadMessages(tree as unknown as ChatItemInTree[], 'a1')expect(thread.length).toBe(4)expect(thread.map(t => t.id)).toEqual(['q1', 'a1', 'q3', 'a3'])- expect(thread[3].prevSibling).toBe('a2')+ expect(thread[3]!.prevSibling).toBe('a2')})})})diff --git a/web/app/components/base/chat/chat-with-history/__tests__/chat-wrapper.spec.tsx b/web/app/components/base/chat/chat-with-history/__tests__/chat-wrapper.spec.tsxindex bd5f01bcdaf..83a8666e799 100644--- a/web/app/components/base/chat/chat-with-history/__tests__/chat-wrapper.spec.tsx+++ b/web/app/components/base/chat/chat-with-history/__tests__/chat-wrapper.spec.tsx@@ -151,8 +151,8 @@ describe('ChatWrapper', () => {render(<ChatWrapper />)- expect(await screen.findByText('Welcome')).toBeInTheDocument()- expect(await screen.findByText('Q1')).toBeInTheDocument()+ expect(await screen.findByText('Welcome'))!.toBeInTheDocument()+ expect(await screen.findByText('Q1'))!.toBeInTheDocument()fireEvent.click(screen.getByText('Q1'))expect(handleSend).toHaveBeenCalled()@@ -170,7 +170,7 @@ describe('ChatWrapper', () => {} as unknown as ChatHookReturn)render(<ChatWrapper />)- expect(screen.getByText('Default opening statement')).toBeInTheDocument()+ expect(screen.getByText('Default opening statement'))!.toBeInTheDocument()})it('should render welcome screen without suggested questions', async () => {@@ -186,7 +186,7 @@ describe('ChatWrapper', () => {} as unknown as ChatHookReturn)render(<ChatWrapper />)- expect(await screen.findByText('Welcome message')).toBeInTheDocument()+ expect(await screen.findByText('Welcome message'))!.toBeInTheDocument()})it('should show responding state', async () => {@@ -197,7 +197,7 @@ describe('ChatWrapper', () => {} as unknown as ChatHookReturn)render(<ChatWrapper />)- expect(await screen.findByText('Bot thinking...')).toBeInTheDocument()+ expect(await screen.findByText('Bot thinking...'))!.toBeInTheDocument()})it('should handle manual message input and stop responding', async () => {@@ -320,9 +320,9 @@ describe('ChatWrapper', () => {render(<ChatWrapper />)const textboxes = screen.getAllByRole('textbox')const chatInput = textboxes[textboxes.length - 1]- const disabledContainer = chatInput.closest('.pointer-events-none')- expect(disabledContainer).toBeInTheDocument()- expect(disabledContainer).toHaveClass('opacity-50')+ const disabledContainer = chatInput!.closest('.pointer-events-none')+ expect(disabledContainer)!.toBeInTheDocument()+ expect(disabledContainer)!.toHaveClass('opacity-50')})it('should not disable input when required field has value', () => {@@ -337,7 +337,7 @@ describe('ChatWrapper', () => {render(<ChatWrapper />)const textboxes = screen.getAllByRole('textbox')const chatInput = textboxes[textboxes.length - 1]- const container = chatInput.closest('.pointer-events-none')+ const container = chatInput!.closest('.pointer-events-none')expect(container).not.toBeInTheDocument()})@@ -361,8 +361,8 @@ describe('ChatWrapper', () => {render(<ChatWrapper />)const textboxes = screen.getAllByRole('textbox')const chatInput = textboxes[textboxes.length - 1]- const container = chatInput.closest('.pointer-events-none')- expect(container).toBeInTheDocument()+ const container = chatInput!.closest('.pointer-events-none')+ expect(container)!.toBeInTheDocument()})it('should not disable input when file is fully uploaded', () => {@@ -411,8 +411,8 @@ describe('ChatWrapper', () => {render(<ChatWrapper />)const textboxes = screen.getAllByRole('textbox')const chatInput = textboxes[textboxes.length - 1]- const container = chatInput.closest('.pointer-events-none')- expect(container).toBeInTheDocument()+ const container = chatInput!.closest('.pointer-events-none')+ expect(container)!.toBeInTheDocument()})it('should not disable when all files are uploaded', () => {@@ -457,7 +457,7 @@ describe('ChatWrapper', () => {render(<ChatWrapper />)const textarea = screen.getByRole('textbox')const container = textarea.closest('.pointer-events-none')- expect(container).toBeInTheDocument()+ expect(container)!.toBeInTheDocument()})it('should not disable input when allInputsHidden is true', () => {@@ -523,7 +523,7 @@ describe('ChatWrapper', () => {render(<ChatWrapper />)expect(handleSwitchSibling).toHaveBeenCalledWith('resume-node', expect.any(Object))- const resumeOptions = handleSwitchSibling.mock.calls[0][1]+ const resumeOptions = handleSwitchSibling.mock.calls[0]![1]resumeOptions.onGetSuggestedQuestions('response-from-resume')expect(fetchSuggestedQuestions).toHaveBeenCalledWith('response-from-resume', 'webApp', 'test-app-id')})@@ -619,7 +619,7 @@ describe('ChatWrapper', () => {render(<ChatWrapper />)- const onStopCallback = vi.mocked(useChat).mock.calls[0][3] as (taskId: string) => void+ const onStopCallback = vi.mocked(useChat).mock.calls[0]![3] as (taskId: string) => voidonStopCallback('taskId-123')expect(stopChatMessageResponding).toHaveBeenCalledWith('', 'taskId-123', 'webApp', 'test-app-id')})@@ -645,7 +645,7 @@ describe('ChatWrapper', () => {expect(handleSend).toHaveBeenCalled()// Get the options passed to handleSend- const options = handleSend.mock.calls[0][2]+ const options = handleSend.mock.calls[0]![2]expect(options.isPublicAPI).toBe(true)// Call onGetSuggestedQuestions@@ -679,7 +679,7 @@ describe('ChatWrapper', () => {fireEvent.click(nextButton)expect(handleSwitchSibling).toHaveBeenCalled()- const options = handleSwitchSibling.mock.calls[0][1]+ const options = handleSwitchSibling.mock.calls[0]![1]options.onGetSuggestedQuestions('response-id')expect(fetchSuggestedQuestions).toHaveBeenCalledWith('response-id', 'webApp', 'test-app-id')}@@ -708,8 +708,8 @@ describe('ChatWrapper', () => {expect(handleSend).toHaveBeenCalled()const args = handleSend.mock.calls[0]// args[1] is data- expect(args[1].query).toBe('Q1')- expect(args[1].parent_message_id).toBeNull()+ expect(args![1].query).toBe('Q1')+ expect(args![1].parent_message_id).toBeNull()}})@@ -737,7 +737,7 @@ describe('ChatWrapper', () => {fireEvent.click(regenerateBtn)expect(handleSend).toHaveBeenCalled()const args = handleSend.mock.calls[0]- expect(args[1].parent_message_id).toBe('a0')+ expect(args![1].parent_message_id).toBe('a0')}})@@ -774,10 +774,10 @@ describe('ChatWrapper', () => {} as unknown as ChatHookReturn)render(<ChatWrapper />)- expect(await screen.findByText('Node 1')).toBeInTheDocument()+ expect(await screen.findByText('Node 1'))!.toBeInTheDocument()const input = screen.getAllByRole('textbox').find(el => el.closest('.chat-answer-container')) || screen.getAllByRole('textbox')[0]- fireEvent.change(input, { target: { value: 'test' } })+ fireEvent.change(input!, { target: { value: 'test' } })const runButton = screen.getByText('Run')fireEvent.click(runButton)@@ -817,10 +817,10 @@ describe('ChatWrapper', () => {} as unknown as ChatHookReturn)render(<ChatWrapper />)- expect(await screen.findByText('Node Web 1')).toBeInTheDocument()+ expect(await screen.findByText('Node Web 1'))!.toBeInTheDocument()const input = screen.getAllByRole('textbox').find(el => el.closest('.chat-answer-container')) || screen.getAllByRole('textbox')[0]- fireEvent.change(input, { target: { value: 'web-test' } })+ fireEvent.change(input!, { target: { value: 'web-test' } })fireEvent.click(screen.getByText('Run'))await waitFor(() => {@@ -841,7 +841,7 @@ describe('ChatWrapper', () => {render(<ChatWrapper />)expect(document.querySelector('.chat-answer-container')).not.toBeInTheDocument()- expect(screen.getByText('Welcome')).toBeInTheDocument()+ expect(screen.getByText('Welcome'))!.toBeInTheDocument()})it('should show all messages including opening statement when there are multiple messages', () => {@@ -861,7 +861,7 @@ describe('ChatWrapper', () => {render(<ChatWrapper />)const welcomeElements = screen.getAllByText('Welcome')expect(welcomeElements.length).toBeGreaterThan(0)- expect(screen.getByText('User message')).toBeInTheDocument()+ expect(screen.getByText('User message'))!.toBeInTheDocument()})it('should show chatNode and inputs form on desktop for new conversation', () => {@@ -873,7 +873,7 @@ describe('ChatWrapper', () => {})render(<ChatWrapper />)- expect(screen.getByText('Test')).toBeInTheDocument()+ expect(screen.getByText('Test'))!.toBeInTheDocument()})it('should show chatNode on mobile for new conversation only', () => {@@ -885,7 +885,7 @@ describe('ChatWrapper', () => {})const { rerender } = render(<ChatWrapper />)- expect(screen.getByText('Test')).toBeInTheDocument()+ expect(screen.getByText('Test'))!.toBeInTheDocument()vi.mocked(useChatWithHistoryContext).mockReturnValue({...defaultContextValue,@@ -974,8 +974,8 @@ describe('ChatWrapper', () => {} as unknown as ChatHookReturn)render(<ChatWrapper />)- expect(screen.getByText('Answer')).toBeInTheDocument()- expect(screen.getByAltText('answer icon')).toBeInTheDocument()+ expect(screen.getByText('Answer'))!.toBeInTheDocument()+ expect(screen.getByAltText('answer icon'))!.toBeInTheDocument()})it('should render question icon fallback when user avatar is available', () => {@@ -993,7 +993,7 @@ describe('ChatWrapper', () => {} as unknown as ChatHookReturn)render(<ChatWrapper />)- expect(screen.getByText('J')).toBeInTheDocument()+ expect(screen.getByText('J'))!.toBeInTheDocument()})it('should use fallback values for nullable appData, appMeta and avatar name', () => {@@ -1012,8 +1012,8 @@ describe('ChatWrapper', () => {} as unknown as ChatHookReturn)render(<ChatWrapper />)- expect(screen.getByText('Question with fallback avatar name')).toBeInTheDocument()- expect(screen.getByText('U')).toBeInTheDocument()+ expect(screen.getByText('Question with fallback avatar name'))!.toBeInTheDocument()+ expect(screen.getByText('U'))!.toBeInTheDocument()})it('should set handleStop on currentChatInstanceRef', () => {@@ -1101,8 +1101,8 @@ describe('ChatWrapper', () => {render(<ChatWrapper />)const textboxes = screen.getAllByRole('textbox')const chatInput = textboxes[textboxes.length - 1]- const container = chatInput.closest('.pointer-events-none')- expect(container).toBeInTheDocument()+ const container = chatInput!.closest('.pointer-events-none')+ expect(container)!.toBeInTheDocument()})it('should call formatBooleanInputs when sending message', async () => {@@ -1223,7 +1223,8 @@ describe('ChatWrapper', () => {render(<ChatWrapper />)// This tests line 91 - using currentConversationItem.introduction- expect(screen.getByText('Custom introduction from conversation item')).toBeInTheDocument()+ // This tests line 91 - using currentConversationItem.introduction+ expect(screen.getByText('Custom introduction from conversation item'))!.toBeInTheDocument()})it('should handle early return when hasEmptyInput is already set', () => {@@ -1242,8 +1243,8 @@ describe('ChatWrapper', () => {// This tests line 106 - early return when hasEmptyInput is setconst textboxes = screen.getAllByRole('textbox')const chatInput = textboxes[textboxes.length - 1]- const container = chatInput.closest('.pointer-events-none')- expect(container).toBeInTheDocument()+ const container = chatInput!.closest('.pointer-events-none')+ expect(container)!.toBeInTheDocument()})it('should handle early return when fileIsUploading is already set', () => {@@ -1270,8 +1271,8 @@ describe('ChatWrapper', () => {// This tests line 109 - early return when fileIsUploading is setconst textboxes = screen.getAllByRole('textbox')const chatInput = textboxes[textboxes.length - 1]- const container = chatInput.closest('.pointer-events-none')- expect(container).toBeInTheDocument()+ const container = chatInput!.closest('.pointer-events-none')+ expect(container)!.toBeInTheDocument()})it('should handle doSend with no parent message id', async () => {@@ -1561,7 +1562,7 @@ describe('ChatWrapper', () => {} as unknown as ChatHookReturn)render(<ChatWrapper />)- expect(screen.getByText('Default opening statement')).toBeInTheDocument()+ expect(screen.getByText('Default opening statement'))!.toBeInTheDocument()})it('should handle doSend when regenerating with null parentAnswer', async () => {@@ -1609,7 +1610,9 @@ describe('ChatWrapper', () => {// Just verify the component renders - the actual editedQuestion flow// is tested through the doRegenerate callback that's passed to Chat- expect(screen.getByText('Answer')).toBeInTheDocument()+ // Just verify the component renders - the actual editedQuestion flow+ // is tested through the doRegenerate callback that's passed to Chat+ expect(screen.getByText('Answer'))!.toBeInTheDocument()expect(handleSend).toBeDefined()})@@ -1629,7 +1632,9 @@ describe('ChatWrapper', () => {// The doRegenerate is passed to Chat component and would be called// This ensures lines 198-200 are covered- expect(screen.getByText('A1')).toBeInTheDocument()+ // The doRegenerate is passed to Chat component and would be called+ // This ensures lines 198-200 are covered+ expect(screen.getByText('A1'))!.toBeInTheDocument()})it('should handle doRegenerate when question has message_files', async () => {@@ -1809,7 +1814,38 @@ describe('ChatWrapper', () => {render(<ChatWrapper />)const textboxes = screen.getAllByRole('textbox')const chatInput = textboxes[textboxes.length - 1]- const container = chatInput.closest('.pointer-events-none')+ const container = chatInput!.closest('.pointer-events-none')+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required+ // Should not be disabled because it's not required// Should not be disabled because it's not requiredexpect(container).not.toBeInTheDocument()})diff --git a/web/app/components/base/chat/chat-with-history/__tests__/header-in-mobile.spec.tsx b/web/app/components/base/chat/chat-with-history/__tests__/header-in-mobile.spec.tsxindex d75f9897a7a..a183a7670ba 100644--- a/web/app/components/base/chat/chat-with-history/__tests__/header-in-mobile.spec.tsx+++ b/web/app/components/base/chat/chat-with-history/__tests__/header-in-mobile.spec.tsx@@ -143,7 +143,7 @@ describe('HeaderInMobile', () => {it('should render title when no conversation', () => {render(<HeaderInMobile />)- expect(screen.getByText('Test Chat')).toBeInTheDocument()+ expect(screen.getByText('Test Chat'))!.toBeInTheDocument()})it('should render conversation name when active', async () => {@@ -154,7 +154,7 @@ describe('HeaderInMobile', () => {})render(<HeaderInMobile />)- expect(await screen.findByText('Conv 1')).toBeInTheDocument()+ expect(await screen.findByText('Conv 1'))!.toBeInTheDocument()})it('should open and close sidebar', async () => {@@ -162,11 +162,12 @@ describe('HeaderInMobile', () => {// Open sidebar (menu button is the first action btn)const menuButton = screen.getAllByRole('button')[0]- fireEvent.click(menuButton)+ fireEvent.click(menuButton!)// HeaderInMobile renders MobileSidebar which renders Sidebar and overlay- expect(await screen.findByTestId('mobile-sidebar-overlay')).toBeInTheDocument()- expect(screen.getByTestId('sidebar-content')).toBeInTheDocument()+ // HeaderInMobile renders MobileSidebar which renders Sidebar and overlay+ expect(await screen.findByTestId('mobile-sidebar-overlay'))!.toBeInTheDocument()+ expect(screen.getByTestId('sidebar-content'))!.toBeInTheDocument()// Close sidebar via overlay clickfireEvent.click(screen.getByTestId('mobile-sidebar-overlay'))@@ -180,15 +181,16 @@ describe('HeaderInMobile', () => {// Open sidebarconst menuButton = screen.getAllByRole('button')[0]- fireEvent.click(menuButton)+ fireEvent.click(menuButton!)- expect(await screen.findByTestId('mobile-sidebar-overlay')).toBeInTheDocument()+ expect(await screen.findByTestId('mobile-sidebar-overlay'))!.toBeInTheDocument()// Click inside sidebar content (should not close)fireEvent.click(screen.getByTestId('sidebar-content'))// Sidebar should still be visible- expect(screen.getByTestId('mobile-sidebar-overlay')).toBeInTheDocument()+ // Sidebar should still be visible+ expect(screen.getByTestId('mobile-sidebar-overlay'))!.toBeInTheDocument()})it('should open and close chat settings', async () => {@@ -204,12 +206,13 @@ describe('HeaderInMobile', () => {// Find and click "View Chat Settings"await waitFor(() => {- expect(screen.getByText(/share\.chat\.viewChatSettings/i)).toBeInTheDocument()+ expect(screen.getByText(/share\.chat\.viewChatSettings/i))!.toBeInTheDocument()})fireEvent.click(screen.getByText(/share\.chat\.viewChatSettings/i))// Check if chat settings overlay is open- expect(screen.getByTestId('mobile-chat-settings-overlay')).toBeInTheDocument()+ // Check if chat settings overlay is open+ expect(screen.getByTestId('mobile-chat-settings-overlay'))!.toBeInTheDocument()// Close chat settings via overlay clickfireEvent.click(screen.getByTestId('mobile-chat-settings-overlay'))@@ -229,18 +232,19 @@ describe('HeaderInMobile', () => {// Open dropdown and chat settingsfireEvent.click(await screen.findByTestId('mobile-more-btn'))await waitFor(() => {- expect(screen.getByText(/share\.chat\.viewChatSettings/i)).toBeInTheDocument()+ expect(screen.getByText(/share\.chat\.viewChatSettings/i))!.toBeInTheDocument()})fireEvent.click(screen.getByText(/share\.chat\.viewChatSettings/i))- expect(screen.getByTestId('mobile-chat-settings-overlay')).toBeInTheDocument()+ expect(screen.getByTestId('mobile-chat-settings-overlay'))!.toBeInTheDocument()// Click inside the settings panel (find the title)const settingsTitle = screen.getByText(/share\.chat\.chatSettingsTitle/i)fireEvent.click(settingsTitle)// Settings should still be visible- expect(screen.getByTestId('mobile-chat-settings-overlay')).toBeInTheDocument()+ // Settings should still be visible+ expect(screen.getByTestId('mobile-chat-settings-overlay'))!.toBeInTheDocument()})it('should hide chat settings option when no input forms', async () => {@@ -274,7 +278,7 @@ describe('HeaderInMobile', () => {// Click "New Conversation" or "Reset Chat"await waitFor(() => {- expect(screen.getByText(/share\.chat\.resetChat/i)).toBeInTheDocument()+ expect(screen.getByText(/share\.chat\.resetChat/i))!.toBeInTheDocument()})fireEvent.click(screen.getByText(/share\.chat\.resetChat/i))@@ -297,7 +301,7 @@ describe('HeaderInMobile', () => {fireEvent.click(await screen.findByText('Conv 1'))await waitFor(() => {- expect(screen.getByText(/explore\.sidebar\.action\.pin/i)).toBeInTheDocument()+ expect(screen.getByText(/explore\.sidebar\.action\.pin/i))!.toBeInTheDocument()})fireEvent.click(screen.getByText(/explore\.sidebar\.action\.pin/i))expect(handlePin).toHaveBeenCalledWith('1')@@ -319,7 +323,7 @@ describe('HeaderInMobile', () => {fireEvent.click(await screen.findByText('Conv 1'))await waitFor(() => {- expect(screen.getByText(/explore\.sidebar\.action\.unpin/i)).toBeInTheDocument()+ expect(screen.getByText(/explore\.sidebar\.action\.unpin/i))!.toBeInTheDocument()})fireEvent.click(screen.getByText(/explore\.sidebar\.action\.unpin/i))expect(handleUnpin).toHaveBeenCalledWith('1')@@ -339,12 +343,13 @@ describe('HeaderInMobile', () => {fireEvent.click(await screen.findByText('Conv 1'))await waitFor(() => {- expect(screen.getByText(/explore\.sidebar\.action\.rename/i)).toBeInTheDocument()+ expect(screen.getByText(/explore\.sidebar\.action\.rename/i))!.toBeInTheDocument()})fireEvent.click(screen.getByText(/explore\.sidebar\.action\.rename/i))// RenameModal should be visible- expect(screen.getByRole('dialog')).toBeInTheDocument()+ // RenameModal should be visible+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()const input = screen.getByDisplayValue('Conv 1')fireEvent.change(input, { target: { value: 'New Name' } })@@ -367,12 +372,13 @@ describe('HeaderInMobile', () => {fireEvent.click(await screen.findByText('Conv 1'))await waitFor(() => {- expect(screen.getByText(/explore\.sidebar\.action\.rename/i)).toBeInTheDocument()+ expect(screen.getByText(/explore\.sidebar\.action\.rename/i))!.toBeInTheDocument()})fireEvent.click(screen.getByText(/explore\.sidebar\.action\.rename/i))// RenameModal should be visible- expect(screen.getByRole('dialog')).toBeInTheDocument()+ // RenameModal should be visible+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()// Click cancel buttonconst cancelButton = screen.getByRole('button', { name: /common\.operation\.cancel/i })@@ -399,12 +405,13 @@ describe('HeaderInMobile', () => {fireEvent.click(await screen.findByText('Conv 1'))await waitFor(() => {- expect(screen.getByText(/explore\.sidebar\.action\.rename/i)).toBeInTheDocument()+ expect(screen.getByText(/explore\.sidebar\.action\.rename/i))!.toBeInTheDocument()})fireEvent.click(screen.getByText(/explore\.sidebar\.action\.rename/i))// RenameModal should be visible with loading state- expect(screen.getByRole('dialog')).toBeInTheDocument()+ // RenameModal should be visible with loading state+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})it('should handle delete conversation', async () => {@@ -421,13 +428,13 @@ describe('HeaderInMobile', () => {fireEvent.click(await screen.findByText('Conv 1'))await waitFor(() => {- expect(screen.getByText(/explore\.sidebar\.action\.delete/i)).toBeInTheDocument()+ expect(screen.getByText(/explore\.sidebar\.action\.delete/i))!.toBeInTheDocument()})fireEvent.click(screen.getByText(/explore\.sidebar\.action\.delete/i))// Confirm modalawait waitFor(() => {- expect(screen.getAllByText(/share\.chat\.deleteConversation\.title/i)[0]).toBeInTheDocument()+ expect(screen.getAllByText(/share\.chat\.deleteConversation\.title/i)[0])!.toBeInTheDocument()})fireEvent.click(screen.getByRole('button', { name: /common\.operation\.confirm/i }))expect(handleDelete).toHaveBeenCalledWith('1', expect.any(Object))@@ -447,13 +454,13 @@ describe('HeaderInMobile', () => {fireEvent.click(await screen.findByText('Conv 1'))await waitFor(() => {- expect(screen.getByText(/explore\.sidebar\.action\.delete/i)).toBeInTheDocument()+ expect(screen.getByText(/explore\.sidebar\.action\.delete/i))!.toBeInTheDocument()})fireEvent.click(screen.getByText(/explore\.sidebar\.action\.delete/i))// Confirm modal should be visibleawait waitFor(() => {- expect(screen.getAllByText(/share\.chat\.deleteConversation\.title/i)[0]).toBeInTheDocument()+ expect(screen.getAllByText(/share\.chat\.deleteConversation\.title/i)[0])!.toBeInTheDocument()})// Click cancel@@ -519,7 +526,7 @@ describe('HeaderInMobile', () => {})render(<HeaderInMobile />)- expect(screen.getByText('My App')).toBeInTheDocument()+ expect(screen.getByText('My App'))!.toBeInTheDocument()})it('should properly show and hide modals conditionally', async () => {@@ -537,6 +544,37 @@ describe('HeaderInMobile', () => {render(<HeaderInMobile />)+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals+ // Initially no modals// Initially no modalsexpect(screen.queryByRole('dialog')).not.toBeInTheDocument()expect(screen.queryByText('share.chat.deleteConversation.title')).not.toBeInTheDocument()@@ -565,7 +603,7 @@ describe('HeaderInMobile', () => {fireEvent.click(await screen.findByText('Conv 1'))fireEvent.click(await screen.findByText(/sidebar\.action\.delete/i))- expect(await screen.findByRole('button', { name: /common\.operation\.confirm|operation\.confirm/i })).toBeInTheDocument()+ expect(await screen.findByRole('button', { name: /common\.operation\.confirm|operation\.confirm/i }))!.toBeInTheDocument()fireEvent.click(screen.getByRole('button', { name: /common\.operation\.confirm|operation\.confirm/i }))expect(handleDelete).toHaveBeenCalledWith('1', expect.any(Object))}@@ -590,7 +628,7 @@ describe('HeaderInMobile', () => {fireEvent.click(await screen.findByText(/explore\.sidebar\.action\.rename|sidebar\.action\.rename/i))const input = await screen.findByRole('textbox')- expect(input).toHaveValue('')+ expect(input)!.toHaveValue('')fireEvent.change(input, { target: { value: 'Renamed from empty' } })fireEvent.click(screen.getByRole('button', { name: /common\.operation\.save/i }))diff --git a/web/app/components/base/chat/chat-with-history/__tests__/hooks.spec.tsx b/web/app/components/base/chat/chat-with-history/__tests__/hooks.spec.tsxindex f4c8ef0c458..3f69cab96f5 100644--- a/web/app/components/base/chat/chat-with-history/__tests__/hooks.spec.tsx+++ b/web/app/components/base/chat/chat-with-history/__tests__/hooks.spec.tsx@@ -497,7 +497,7 @@ describe('useChatWithHistory', () => {expect(mockRenameConversation).toHaveBeenCalledWith(AppSourceType.webApp, 'app-1', 'conversation-1', 'New Name')expect(onSuccess).toHaveBeenCalledTimes(1)await waitFor(() => {- expect(result!.current.conversationList[0].name).toBe('New Name')+ expect(result!.current.conversationList[0]!.name).toBe('New Name')})})@@ -615,7 +615,7 @@ describe('useChatWithHistory', () => {// Assert: new item with empty id prependedawait waitFor(() => {- expect(result!.current.conversationList[0].id).toBe('')+ expect(result!.current.conversationList[0]!.id).toBe('')})})})@@ -1597,7 +1597,7 @@ describe('useChatWithHistory', () => {})// Assert- expect(result!.current.conversationList[0].id).toBe('conversation-1')+ expect(result!.current.conversationList[0]!.id).toBe('conversation-1')})})@@ -1857,7 +1857,7 @@ describe('useChatWithHistory', () => {// Assertawait waitFor(() => {- expect(result!.current.conversationList[0].name).toBe('Updated Name')+ expect(result!.current.conversationList[0]!.name).toBe('Updated Name')})})})diff --git a/web/app/components/base/chat/chat-with-history/header/__tests__/index.spec.tsx b/web/app/components/base/chat/chat-with-history/header/__tests__/index.spec.tsxindex 5feaccd191d..b1c23a129bb 100644--- a/web/app/components/base/chat/chat-with-history/header/__tests__/index.spec.tsx+++ b/web/app/components/base/chat/chat-with-history/header/__tests__/index.spec.tsx@@ -108,7 +108,7 @@ describe('Header Component', () => {currentConversationItem: mockConv,sidebarCollapseState: true,})- expect(screen.getByText('My Chat')).toBeInTheDocument()+ expect(screen.getByText('My Chat'))!.toBeInTheDocument()})it('should render ViewFormDropdown trigger when inputsForms are present', () => {@@ -133,7 +133,7 @@ describe('Header Component', () => {const buttons = screen.getAllByRole('button')// Sidebar, NewChat, ResetChat (3)const resetChatBtn = buttons[buttons.length - 1]- await userEvent.click(resetChatBtn)+ await userEvent.click(resetChatBtn!)expect(handleNewConversation).toHaveBeenCalled()})@@ -144,7 +144,7 @@ describe('Header Component', () => {const buttons = screen.getAllByRole('button')const sidebarBtn = buttons[0]- await userEvent.click(sidebarBtn)+ await userEvent.click(sidebarBtn!)expect(handleSidebarCollapse).toHaveBeenCalledWith(false)})@@ -163,7 +163,7 @@ describe('Header Component', () => {await userEvent.click(trigger)const pinBtn = await screen.findByText('explore.sidebar.action.pin')- expect(pinBtn).toBeInTheDocument()+ expect(pinBtn)!.toBeInTheDocument()await userEvent.click(pinBtn)@@ -225,7 +225,7 @@ describe('Header Component', () => {const renameMenuBtn = await screen.findByText('explore.sidebar.action.rename')await userEvent.click(renameMenuBtn)- expect(await screen.findByText('common.chat.renameConversation')).toBeInTheDocument()+ expect(await screen.findByText('common.chat.renameConversation'))!.toBeInTheDocument()const input = screen.getByDisplayValue('My Chat')await userEvent.clear(input)@@ -236,7 +236,7 @@ describe('Header Component', () => {expect(handleRenameConversation).toHaveBeenCalledWith('conv-1', 'New Name', expect.any(Object))- const successCallback = handleRenameConversation.mock.calls[0][2].onSuccess+ const successCallback = handleRenameConversation.mock.calls[0]![2].onSuccessawait act(async () => {successCallback()})@@ -262,14 +262,14 @@ describe('Header Component', () => {await userEvent.click(deleteMenuBtn)expect(handleDeleteConversation).not.toHaveBeenCalled()- expect(await screen.findByText('share.chat.deleteConversation.title')).toBeInTheDocument()+ expect(await screen.findByText('share.chat.deleteConversation.title'))!.toBeInTheDocument()const confirmBtn = await screen.findByText('common.operation.confirm')await userEvent.click(confirmBtn)expect(handleDeleteConversation).toHaveBeenCalledWith('conv-1', expect.any(Object))- const successCallback = handleDeleteConversation.mock.calls[0][1].onSuccess+ const successCallback = handleDeleteConversation.mock.calls[0]![1].onSuccessawait act(async () => {successCallback()})@@ -311,7 +311,7 @@ describe('Header Component', () => {await userEvent.click(screen.getByText('My Chat'))await userEvent.click(await screen.findByText('explore.sidebar.action.delete'))- expect(await screen.findByText('share.chat.deleteConversation.title')).toBeInTheDocument()+ expect(await screen.findByText('share.chat.deleteConversation.title'))!.toBeInTheDocument()})})@@ -332,7 +332,7 @@ describe('Header Component', () => {it('should render system title if conversation id is missing', () => {setup({ currentConversationId: '', sidebarCollapseState: true })const titleEl = screen.getByText('Test App')- expect(titleEl).toHaveClass('system-md-semibold')+ expect(titleEl)!.toHaveClass('system-md-semibold')})it('should render app icon from URL when icon_url is provided', () => {@@ -347,7 +347,7 @@ describe('Header Component', () => {},})const img = screen.getByAltText('app icon')- expect(img).toHaveAttribute('src', 'https://example.com/icon.png')+ expect(img)!.toHaveAttribute('src', 'https://example.com/icon.png')})it('should handle undefined appData gracefully (optional chaining)', () => {@@ -364,7 +364,8 @@ describe('Header Component', () => {sidebarCollapseState: true,})// The separator is just a div with text content '/'- expect(screen.getByText('/')).toBeInTheDocument()+ // The separator is just a div with text content '/'+ expect(screen.getByText('/'))!.toBeInTheDocument()})it('should handle New Chat button state when currentConversationId is present but isResponding is true', () => {@@ -377,7 +378,7 @@ describe('Header Component', () => {const buttons = screen.getAllByRole('button')// Sidebar, NewChat, ResetChat (3)const newChatBtn = buttons[1]- expect(newChatBtn).toBeDisabled()+ expect(newChatBtn)!.toBeDisabled()})it('should handle New Chat button state when currentConversationId is missing and isResponding is false', () => {@@ -390,7 +391,7 @@ describe('Header Component', () => {const buttons = screen.getAllByRole('button')// Sidebar, NewChat (2)const newChatBtn = buttons[1]- expect(newChatBtn).toBeDisabled()+ expect(newChatBtn)!.toBeDisabled()})it('should not render operation menu if conversation id is missing', () => {diff --git a/web/app/components/base/chat/chat-with-history/hooks.tsx b/web/app/components/base/chat/chat-with-history/hooks.tsxindex e6f5657ff5b..df261d750c6 100644--- a/web/app/components/base/chat/chat-with-history/hooks.tsx+++ b/web/app/components/base/chat/chat-with-history/hooks.tsx@@ -452,7 +452,7 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => {toast.success(t('actionMsg.modifiedSuccessfully', { ns: 'common' }))setOriginConversationList(produce((draft) => {const index = originConversationList.findIndex(item => item.id === conversationId)- const item = draft[index]+ const item = draft[index]!draft[index] = {...item,name: newName,diff --git a/web/app/components/base/chat/chat/__tests__/hooks.spec.tsx b/web/app/components/base/chat/chat/__tests__/hooks.spec.tsxindex 89327341de8..9d65246a7f1 100644--- a/web/app/components/base/chat/chat/__tests__/hooks.spec.tsx+++ b/web/app/components/base/chat/chat/__tests__/hooks.spec.tsx@@ -102,8 +102,8 @@ describe('useChat', () => {const { result } = renderHook(() => useChat(config as ChatConfig, formSettings))expect(result.current.chatList).toHaveLength(1)- expect(result.current.chatList[0].content).toBe('Hello Alice')- expect(result.current.chatList[0].suggestedQuestions).toEqual(['One', 'Two'])+ expect(result.current.chatList[0]!.content).toBe('Hello Alice')+ expect(result.current.chatList[0]!.suggestedQuestions).toEqual(['One', 'Two'])})it('should update existing opening statement if already present in threadMessages', () => {@@ -121,7 +121,7 @@ describe('useChat', () => {const { result } = renderHook(() => useChat(config as ChatConfig, undefined, prevChatTree as ChatItemInTree[]))expect(result.current.chatList).toHaveLength(1)- expect(result.current.chatList[0].content).toBe('Hello updated')+ expect(result.current.chatList[0]!.content).toBe('Hello updated')})it('should update existing opening statement suggested questions using processed values', () => {@@ -143,8 +143,8 @@ describe('useChat', () => {const { result } = renderHook(() => useChat(config as ChatConfig, formSettings as UseChatFormSettings, prevChatTree as ChatItemInTree[]))- expect(result.current.chatList[0].content).toBe('Hello Bob')- expect(result.current.chatList[0].suggestedQuestions).toEqual(['Ask Bob'])+ expect(result.current.chatList[0]!.content).toBe('Hello Bob')+ expect(result.current.chatList[0]!.suggestedQuestions).toEqual(['Ask Bob'])})describe('opening statement referential stability', () => {@@ -162,8 +162,8 @@ describe('useChat', () => {const { result } = renderHook(() => useChat(config as ChatConfig))const openerInitial = result.current.chatList[0]- expect(openerInitial.isOpeningStatement).toBe(true)- expect(openerInitial.content).toBe('Welcome!')+ expect(openerInitial!.isOpeningStatement).toBe(true)+ expect(openerInitial!.content).toBe('Welcome!')act(() => {result.current.handleSend('url', { query: 'hello' }, {})@@ -207,8 +207,8 @@ describe('useChat', () => {)const openerBefore = result.current.chatList[0]- expect(openerBefore.content).toBe('Hello Alice')- expect(openerBefore.suggestedQuestions).toEqual(['Ask about Alice'])+ expect(openerBefore!.content).toBe('Hello Alice')+ expect(openerBefore!.suggestedQuestions).toEqual(['Ask about Alice'])rerender({ fs: { inputs: { name: 'Alice' }, inputsForm: [] } })@@ -232,8 +232,8 @@ describe('useChat', () => {const after = result.current.chatList[0]expect(after).not.toBe(before)- expect(after.content).toBe('Hello Bob')- expect(after.suggestedQuestions).toEqual(['Ask Bob'])+ expect(after!.content).toBe('Hello Bob')+ expect(after!.suggestedQuestions).toEqual(['Ask Bob'])})it('should keep content and suggestedQuestions stable for opener already in prevChatTree even when sibling metadata changes', () => {@@ -259,11 +259,11 @@ describe('useChat', () => {)const openerBefore = result.current.chatList[0]- expect(openerBefore.content).toBe('Hello updated')- expect(openerBefore.suggestedQuestions).toEqual(['S1'])+ expect(openerBefore!.content).toBe('Hello updated')+ expect(openerBefore!.suggestedQuestions).toEqual(['S1'])- const contentBefore = openerBefore.content- const suggestionsBefore = openerBefore.suggestedQuestions+ const contentBefore = openerBefore!.content+ const suggestionsBefore = openerBefore!.suggestedQuestionsact(() => {result.current.handleSend('url', { query: 'msg' }, {})@@ -274,15 +274,15 @@ describe('useChat', () => {expect(result.current.chatList.length).toBeGreaterThan(1)const openerAfter = result.current.chatList[0]- expect(openerAfter.content).toBe(contentBefore)- expect(openerAfter.suggestedQuestions).toBe(suggestionsBefore)+ expect(openerAfter!.content).toBe(contentBefore)+ expect(openerAfter!.suggestedQuestions).toBe(suggestionsBefore)})it('should use a stable id of "opening-statement"', () => {const { result } = renderHook(() =>useChat({ opening_statement: 'Hi' } as ChatConfig),)- expect(result.current.chatList[0].id).toBe('opening-statement')+ expect(result.current.chatList[0]!.id).toBe('opening-statement')})})@@ -329,8 +329,8 @@ describe('useChat', () => {})expect(result.current.isResponding).toBe(false)- expect(result.current.chatList[1].content).toBe('hi there')- expect(result.current.chatList[1].id).toBe('m-1')+ expect(result.current.chatList[1]!.content).toBe('hi there')+ expect(result.current.chatList[1]!.id).toBe('m-1')})it('should handle onThought and different workflow events', async () => {@@ -387,10 +387,10 @@ describe('useChat', () => {})const lastResponse = result.current.chatList[1]- expect(lastResponse.agent_thoughts).toHaveLength(2)- expect(lastResponse.agent_thoughts![0].thought).toContain('thinking...')- expect(lastResponse.agent_thoughts![1].thought).toContain('second thought')- expect(lastResponse.workflowProcess?.tracing).toHaveLength(3) // node, iteration, loop+ expect(lastResponse!.agent_thoughts).toHaveLength(2)+ expect(lastResponse!.agent_thoughts![0]!.thought).toContain('thinking...')+ expect(lastResponse!.agent_thoughts![1]!.thought).toContain('second thought')+ expect(lastResponse!.workflowProcess?.tracing).toHaveLength(3) // node, iteration, loop})it('should handle human input forms, pauses, TTS, and message ends', async () => {@@ -435,11 +435,11 @@ describe('useChat', () => {})const lastResponse = result.current.chatList[1]- expect(lastResponse.humanInputFormDataList).toHaveLength(0) // Removed when filled- expect(lastResponse.humanInputFilledFormDataList).toHaveLength(2)+ expect(lastResponse!.humanInputFormDataList).toHaveLength(0) // Removed when filled+ expect(lastResponse!.humanInputFilledFormDataList).toHaveLength(2)expect(sseGet).toHaveBeenCalled() // from workflowPaused- expect(lastResponse.annotation?.id).toBe('anno-1')- expect(lastResponse.content).toBe('Replaced content')+ expect(lastResponse!.annotation?.id).toBe('anno-1')+ expect(lastResponse!.content).toBe('Replaced content')expect(result.current.isResponding).toBe(false) // from onError})@@ -466,8 +466,8 @@ describe('useChat', () => {})const lastResponse = result.current.chatList[1]- expect(lastResponse.message_files).toHaveLength(1)- expect(lastResponse.agent_thoughts![0].message_files).toHaveLength(1)+ expect(lastResponse!.message_files).toHaveLength(1)+ expect(lastResponse!.agent_thoughts![0]!.message_files).toHaveLength(1)})it('should fetch conversation messages and suggested questions onCompleted', async () => {@@ -524,7 +524,7 @@ describe('useChat', () => {expect(onConversationComplete).toHaveBeenCalledWith('c-1')const updatedResponse = result.current.chatList[1]- expect(updatedResponse.content).toBe('Updated answer from history') // Fetched from mock+ expect(updatedResponse!.content).toBe('Updated answer from history') // Fetched from mockexpect(result.current.suggestedQuestions).toEqual(['Suggested 1', 'Suggested 2'])})@@ -590,8 +590,8 @@ describe('useChat', () => {})const lastResponse = result.current.chatList[1]- expect(lastResponse.workflowProcess?.tracing).toHaveLength(3) // node, iter, loop- expect(lastResponse.workflowProcess?.status).toBe('failed')+ expect(lastResponse!.workflowProcess?.tracing).toHaveLength(3) // node, iter, loop+ expect(lastResponse!.workflowProcess?.status).toBe('failed')})it('should handle early exits in tracing events during iteration or loop', async () => {@@ -629,7 +629,7 @@ describe('useChat', () => {callbacks.onNodeFinished({ data: { id: 'n-1', iteration_id: 'iter-1' } })})- const traceLen1 = result.current.chatList[result.current.chatList.length - 1].workflowProcess?.tracing?.length+ const traceLen1 = result.current.chatList[result.current.chatList.length - 1]!.workflowProcess?.tracing?.lengthexpect(traceLen1).toBe(0) // None added due to iteration early hits})@@ -678,8 +678,8 @@ describe('useChat', () => {})const lastResponse = result.current.chatList[1]- expect(lastResponse.workflowProcess?.tracing).toBeDefined()- expect(lastResponse.workflowProcess?.status).toBe('failed')+ expect(lastResponse!.workflowProcess?.tracing).toBeDefined()+ expect(lastResponse!.workflowProcess?.status).toBe('failed')})it('should insert and then replace child QA when sending with parent_message_id', () => {@@ -713,7 +713,7 @@ describe('useChat', () => {expect(result.current.chatList.some(item => item.id === 'question-m-child')).toBe(true)expect(result.current.chatList.some(item => item.id === 'm-child')).toBe(true)- expect(result.current.chatList[result.current.chatList.length - 1].content).toBe('child answer')+ expect(result.current.chatList[result.current.chatList.length - 1]!.content).toBe('child answer')})it('should strip local file urls before sending payload', () => {@@ -746,7 +746,7 @@ describe('useChat', () => {result.current.handleSend('test-url', { query: 'file payload', files: [localFile as FileEntity, remoteFile as FileEntity] }, {})})- const payload = vi.mocked(ssePost).mock.calls[0][1] as {+ const payload = vi.mocked(ssePost).mock.calls[0]![1] as {body: {files: Array<{transfer_method: string@@ -776,10 +776,10 @@ describe('useChat', () => {result.current.handleSend('test-url', { query: 'first request' }, {})})act(() => {- callbacksList[0].getAbortController(previousWorkflowAbort)+ callbacksList[0]!.getAbortController(previousWorkflowAbort)})await act(async () => {- await callbacksList[0].onCompleted(true)+ await callbacksList[0]!.onCompleted(true)})act(() => {@@ -811,7 +811,7 @@ describe('useChat', () => {})expect(onGetConversationMessages).toHaveBeenCalled()- expect(result.current.chatList[result.current.chatList.length - 1].content).toBe('streamed content')+ expect(result.current.chatList[result.current.chatList.length - 1]!.content).toBe('streamed content')})it('should clear suggested questions when suggestion fetch fails after completion', async () => {@@ -858,7 +858,7 @@ describe('useChat', () => {})const latestResponse = result.current.chatList[result.current.chatList.length - 1]- expect(latestResponse.workflowProcess?.tracing).toHaveLength(0)+ expect(latestResponse!.workflowProcess?.tracing).toHaveLength(0)})it('should handle paused workflow finish, thought id binding, empty tts chunk, and human-input pause updates', () => {@@ -885,11 +885,11 @@ describe('useChat', () => {})const latestResponse = result.current.chatList[result.current.chatList.length - 1]- expect(latestResponse.id).toBe('m-th-bind')- expect(latestResponse.conversationId).toBe('c-th-bind')- expect(latestResponse.workflowProcess?.status).toBe('succeeded')- expect(latestResponse.humanInputFormDataList?.map(item => item.node_id)).toEqual(['human-node', 'human-node-2'])- expect(latestResponse.workflowProcess?.tracing?.find(item => item.node_id === 'human-node')?.status).toBe('paused')+ expect(latestResponse!.id).toBe('m-th-bind')+ expect(latestResponse!.conversationId).toBe('c-th-bind')+ expect(latestResponse!.workflowProcess?.status).toBe('succeeded')+ expect(latestResponse!.humanInputFormDataList?.map(item => item.node_id)).toEqual(['human-node', 'human-node-2'])+ expect(latestResponse!.workflowProcess?.tracing?.find(item => item.node_id === 'human-node')?.status).toBe('paused')})})@@ -978,13 +978,13 @@ describe('useChat', () => {})const lastResponse = result.current.chatList[result.current.chatList.length - 1]- expect(lastResponse.agent_thoughts![0].thought).toContain('resumed')+ expect(lastResponse!.agent_thoughts![0]!.thought).toContain('resumed')- expect(lastResponse.workflowProcess?.tracing?.length).toBeGreaterThan(0)- expect(lastResponse.workflowProcess?.status).toBe('paused')- expect(lastResponse.humanInputFilledFormDataList).toHaveLength(1)- expect(lastResponse.humanInputFormDataList).toHaveLength(0)- expect(lastResponse.content).toBe('replaced resume')+ expect(lastResponse!.workflowProcess?.tracing?.length).toBeGreaterThan(0)+ expect(lastResponse!.workflowProcess?.status).toBe('paused')+ expect(lastResponse!.humanInputFilledFormDataList).toHaveLength(1)+ expect(lastResponse!.humanInputFormDataList).toHaveLength(0)+ expect(lastResponse!.content).toBe('replaced resume')})it('should handle non-agent mode resume', async () => {@@ -1017,7 +1017,7 @@ describe('useChat', () => {})const lastResponse = result.current.chatList[1]- expect(lastResponse.content).toBe('initial append')+ expect(lastResponse!.content).toBe('initial append')})it('should stop resume completion flow early when hasError is true', async () => {@@ -1084,7 +1084,7 @@ describe('useChat', () => {result.current.handleResume('m-resume', 'wr-1', { isPublicAPI: true })})act(() => {- callbacksList[0].getAbortController(previousWorkflowAbort)+ callbacksList[0]!.getAbortController(previousWorkflowAbort)})act(() => {result.current.handleResume('m-resume', 'wr-2', { isPublicAPI: true })@@ -1127,7 +1127,7 @@ describe('useChat', () => {callbacks.onTTSChunk('m-guard', '')})- expect(result.current.chatList[1].content).toBe('initial')+ expect(result.current.chatList[1]!.content).toBe('initial')})it('should clear suggested questions when resume suggestion fetch fails', async () => {@@ -1207,9 +1207,9 @@ describe('useChat', () => {})const lastResponse = result.current.chatList[1]- expect(lastResponse.humanInputFormDataList?.map(item => item.node_id)).toEqual(['node-2'])- expect(lastResponse.humanInputFilledFormDataList?.map(item => item.node_id)).toEqual(['node-1', 'node-3'])- expect(lastResponse.workflowProcess?.tracing?.find(item => item.node_id === 'node-1')?.status).toBe('paused')+ expect(lastResponse!.humanInputFormDataList?.map(item => item.node_id)).toEqual(['node-2'])+ expect(lastResponse!.humanInputFilledFormDataList?.map(item => item.node_id)).toEqual(['node-1', 'node-3'])+ expect(lastResponse!.workflowProcess?.tracing?.find(item => item.node_id === 'node-1')?.status).toBe('paused')})it('should handle resume non-annotation lifecycle branches and parallel node finish', () => {@@ -1256,11 +1256,11 @@ describe('useChat', () => {})const lastResponse = result.current.chatList[1]- expect(lastResponse.message_files).toHaveLength(1)- expect(lastResponse.conversationId).toBe('c-resume-branches')- expect(lastResponse.citation).toEqual([{ id: 'r-1' }])- expect(lastResponse.workflowProcess?.status).toBe('succeeded')- expect(lastResponse.workflowProcess?.tracing?.some(item => item.id === 'n-parallel')).toBe(true)+ expect(lastResponse!.message_files).toHaveLength(1)+ expect(lastResponse!.conversationId).toBe('c-resume-branches')+ expect(lastResponse!.citation).toEqual([{ id: 'r-1' }])+ expect(lastResponse!.workflowProcess?.status).toBe('succeeded')+ expect(lastResponse!.workflowProcess?.tracing?.some(item => item.id === 'n-parallel')).toBe(true)})})@@ -1349,7 +1349,7 @@ describe('useChat', () => {})// Simulate taskIdRef population- const callbacks = vi.mocked(ssePost).mock.calls[0][2] as HookCallbacks+ const callbacks = vi.mocked(ssePost).mock.calls[0]![2] as HookCallbacksact(() => {callbacks.onWorkflowStarted({ task_id: 'task-123' })})@@ -1467,21 +1467,21 @@ describe('useChat', () => {act(() => {result.current.handleAnnotationEdited('edited query', 'edited answer', 1)})- expect(result.current.chatList[0].content).toBe('edited query')- expect(result.current.chatList[1].content).toBe('edited answer')+ expect(result.current.chatList[0]!.content).toBe('edited query')+ expect(result.current.chatList[1]!.content).toBe('edited answer')// Addedact(() => {result.current.handleAnnotationAdded('anno-1', 'admin', 'q2', 'a2', 1)})- expect(result.current.chatList[1].annotation?.id).toBe('anno-1')- expect(result.current.chatList[1].annotation?.authorName).toBe('admin')+ expect(result.current.chatList[1]!.annotation?.id).toBe('anno-1')+ expect(result.current.chatList[1]!.annotation?.authorName).toBe('admin')// Removedact(() => {result.current.handleAnnotationRemoved(1)})- expect(result.current.chatList[1].annotation?.id).toBe('')+ expect(result.current.chatList[1]!.annotation?.id).toBe('')})it('should handle switch sibling and trigger handleResume if human input', () => {@@ -1554,13 +1554,13 @@ describe('useChat', () => {})const lastResponse = result.current.chatList[1]- expect(lastResponse.message_files).toHaveLength(3)- expect(lastResponse.message_files![0].type).toBe('video/mp4')- expect(lastResponse.message_files![0].supportFileType).toBe('video')- expect(lastResponse.message_files![1].type).toBe('audio/mpeg')- expect(lastResponse.message_files![1].supportFileType).toBe('audio')- expect(lastResponse.message_files![2].type).toBe('application/octet-stream')- expect(lastResponse.message_files![2].supportFileType).toBe('document')+ expect(lastResponse!.message_files).toHaveLength(3)+ expect(lastResponse!.message_files![0]!.type).toBe('video/mp4')+ expect(lastResponse!.message_files![0]!.supportFileType).toBe('video')+ expect(lastResponse!.message_files![1]!.type).toBe('audio/mpeg')+ expect(lastResponse!.message_files![1]!.supportFileType).toBe('audio')+ expect(lastResponse!.message_files![2]!.type).toBe('application/octet-stream')+ expect(lastResponse!.message_files![2]!.supportFileType).toBe('document')})it('should handle onMessageEnd empty citation and empty processed files fallbacks', () => {@@ -1580,7 +1580,7 @@ describe('useChat', () => {})const lastResponse = result.current.chatList[1]- expect(lastResponse.citation).toEqual([])+ expect(lastResponse!.citation).toEqual([])})it('should handle iteration and loop tracing edge cases (lazy arrays, node finish index -1)', () => {@@ -1660,9 +1660,9 @@ describe('useChat', () => {// Ensure the tracing array exists and holds the loop itemconst lastResponse = result3.current.chatList[1]- expect(lastResponse.workflowProcess?.tracing).toBeDefined()- expect(lastResponse.workflowProcess?.tracing).toHaveLength(1)- expect(lastResponse.workflowProcess?.tracing![0].node_id).toBe('loop-1')+ expect(lastResponse!.workflowProcess?.tracing).toBeDefined()+ expect(lastResponse!.workflowProcess?.tracing).toHaveLength(1)+ expect(lastResponse!.workflowProcess?.tracing![0]!.node_id).toBe('loop-1')})it('should handle onCompleted fallback to answer when agent thought does not match and provider latency is 0', async () => {@@ -1699,9 +1699,9 @@ describe('useChat', () => {})const lastResponse = result.current.chatList[1]- expect(lastResponse.content).toBe('final answer')- expect(lastResponse.more?.latency).toBe('0.00')- expect(lastResponse.more?.tokens_per_second).toBeUndefined()+ expect(lastResponse!.content).toBe('final answer')+ expect(lastResponse!.more?.latency).toBe('0.00')+ expect(lastResponse!.more?.tokens_per_second).toBeUndefined()})it('should handle onCompleted using agent thought when thought matches answer', async () => {@@ -1738,7 +1738,7 @@ describe('useChat', () => {})const lastResponse = result.current.chatList[1]- expect(lastResponse.content).toBe('') // isUseAgentThought sets content to empty string+ expect(lastResponse!.content).toBe('') // isUseAgentThought sets content to empty string})it('should cover pausedStateRef reset on workflowFinished and missing tracing arrays in node finish / human input', () => {@@ -1781,7 +1781,7 @@ describe('useChat', () => {})const lastResponse = result.current.chatList[1]- expect(lastResponse.workflowProcess?.status).toBe('succeeded')+ expect(lastResponse!.workflowProcess?.status).toBe('succeeded')})it('should cover onThought creating tracing and appending message correctly when isAgentMode=true', () => {@@ -1806,8 +1806,8 @@ describe('useChat', () => {})const lastResponse = result.current.chatList[result.current.chatList.length - 1]- expect(lastResponse.agent_thoughts).toHaveLength(1)- expect(lastResponse.agent_thoughts![0].thought).toBe('initial thought appended')+ expect(lastResponse!.agent_thoughts).toHaveLength(1)+ expect(lastResponse!.agent_thoughts![0]!.thought).toBe('initial thought appended')})})@@ -1897,10 +1897,10 @@ describe('useChat', () => {})const lastSendResponse = result.current.chatList[1]- expect(lastSendResponse.message_files).toHaveLength(2)+ expect(lastSendResponse!.message_files).toHaveLength(2)const lastResumeResponse = resumeResult.current.chatList[1]- expect(lastResumeResponse.message_files).toHaveLength(1)+ expect(lastResumeResponse!.message_files).toHaveLength(1)})it('should cover parallel_id tracing matches in iteration and loop finish', () => {@@ -1931,10 +1931,10 @@ describe('useChat', () => {})const lastResponse = result.current.chatList[1]- const tracing = lastResponse.workflowProcess!.tracing!+ const tracing = lastResponse!.workflowProcess!.tracing!expect(tracing).toHaveLength(3)- expect(tracing[0].status).toBe('succeeded')- expect(tracing[1].status).toBe('succeeded')+ expect(tracing[0]!.status).toBe('succeeded')+ expect(tracing[1]!.status).toBe('succeeded')})it('should cover baseFile with ALL fields, avoiding all fallbacks', () => {@@ -1964,9 +1964,9 @@ describe('useChat', () => {})const lastResponse = result.current.chatList[result.current.chatList.length - 1]- expect(lastResponse.message_files).toHaveLength(1)- expect(lastResponse.message_files![0].type).toBe('custom/mime')- expect(lastResponse.message_files![0].size).toBe(1024)+ expect(lastResponse!.message_files).toHaveLength(1)+ expect(lastResponse!.message_files![0]!.type).toBe('custom/mime')+ expect(lastResponse!.message_files![0]!.size).toBe(1024)})it('should cover handleResume missing branches for onMessageEnd, onFile fallbacks, and workflow edges', () => {@@ -2010,13 +2010,14 @@ describe('useChat', () => {resumeCallbacks.onHumanInputFormTimeout({ data: { node_id: 'timeout-id' } })// Empty file list- result.current.chatList[1].message_files = undefined+ // Empty file list+ result.current.chatList[1]!.message_files = undefined// Call onFile while agent_thoughts is empty/undefined to hit the `else` fallback branchresumeCallbacks.onFile({ id: 'f-agent', type: 'image', url: 'agent.png' })})const lastResponse = result.current.chatList[1]- expect(lastResponse.message_files![0]).toBeDefined()+ expect(lastResponse!.message_files![0]).toBeDefined()})it('should cover edge case where node_id is missing or index is -1 in handleResume onNodeFinished and onLoopFinish', () => {@@ -2054,7 +2055,7 @@ describe('useChat', () => {})const lastResponse = result.current.chatList[1]- expect(lastResponse.workflowProcess?.tracing).toHaveLength(0) // None were updated+ expect(lastResponse!.workflowProcess?.tracing).toHaveLength(0) // None were updated})it('should cover TTS chunks branching where audio is empty', () => {@@ -2092,7 +2093,8 @@ describe('useChat', () => {sendCallbacks.onData(' append', false, { conversationId: 'c-1' } as Record<string, unknown>)// Empty message files fallback- result.current.chatList[1].message_files = undefined+ // Empty message files fallback+ result.current.chatList[1]!.message_files = undefinedsendCallbacks.onFile({ id: 'f-send', type: 'image', url: 'img.png' })// Empty message files passing to processing fallback@@ -2113,7 +2115,7 @@ describe('useChat', () => {sendCallbacks.onHumanInputFormTimeout({ data: { node_id: 'timeout' } } as Record<string, unknown>)})- expect(result.current.chatList[1].message_files).toBeDefined()+ expect(result.current.chatList[1]!.message_files).toBeDefined()})it('should cover handleSwitchSibling target message not found early returns', () => {@@ -2137,7 +2139,7 @@ describe('useChat', () => {act(() => {sendCallbacks.onNodeStarted({ data: { node_id: 'n-new', id: 'n-new' } })})- expect(result.current.chatList[1].workflowProcess).toBeUndefined()+ expect(result.current.chatList[1]!.workflowProcess).toBeUndefined()})it('should cover handleSend onNodeStarted missing tracing in workflowProcess (L969)', () => {@@ -2155,14 +2157,14 @@ describe('useChat', () => {// Get the shared reference from the tree to mutate the local closed-over responseItem's workflowProcessact(() => {const response = result.current.chatList[1]- if (response.workflowProcess) {+ if (response!.workflowProcess) {// @ts-expect-error deliberately removing tracing to cover the fallback branchdelete response.workflowProcess.tracing}sendCallbacks.onNodeStarted({ data: { node_id: 'n-new', id: 'n-new' } })})- expect(result.current.chatList[1].workflowProcess?.tracing).toBeDefined()- expect(result.current.chatList[1].workflowProcess?.tracing?.length).toBe(1)+ expect(result.current.chatList[1]!.workflowProcess?.tracing).toBeDefined()+ expect(result.current.chatList[1]!.workflowProcess?.tracing?.length).toBe(1)})it('should cover handleSend onTTSChunk and onTTSEnd truthy audio strings', () => {@@ -2256,7 +2258,7 @@ describe('useChat', () => {sendCallbacks.onWorkflowStarted({ workflow_run_id: 'wr-1', task_id: 't-1' })})- expect(result.current.chatList[1].workflowProcess!.tracing).toHaveLength(1)+ expect(result.current.chatList[1]!.workflowProcess!.tracing).toHaveLength(1)})it('should cover handleResume onHumanInputFormFilled splicing and onHumanInputFormTimeout updating', () => {@@ -2292,8 +2294,8 @@ describe('useChat', () => {})const lastResponse = result.current.chatList[1]- expect(lastResponse.humanInputFormDataList).toHaveLength(0)- expect(lastResponse.humanInputFilledFormDataList).toHaveLength(1)+ expect(lastResponse!.humanInputFormDataList).toHaveLength(0)+ expect(lastResponse!.humanInputFilledFormDataList).toHaveLength(1)})it('should cover handleResume branches where workflowProcess exists but tracing is missing (L386, L414, L472)', () => {@@ -2333,7 +2335,7 @@ describe('useChat', () => {})const lastResponse = result.current.chatList[1]- expect(lastResponse.workflowProcess?.tracing).toHaveLength(3)+ expect(lastResponse!.workflowProcess?.tracing).toHaveLength(3)})it('should cover handleRestart with and without callback', () => {@@ -2363,10 +2365,10 @@ describe('useChat', () => {// (annotationId, authorName, query, answer, index)result.current.handleAnnotationAdded('anno-id', 'author', 'q-new', 'a-new', 1)})- expect(result.current.chatList[0].content).toBe('q-new')- expect(result.current.chatList[1].content).toBe('a')- expect(result.current.chatList[1].annotation?.logAnnotation?.content).toBe('a-new')- expect(result.current.chatList[1].annotation?.id).toBe('anno-id')+ expect(result.current.chatList[0]!.content).toBe('q-new')+ expect(result.current.chatList[1]!.content).toBe('a')+ expect(result.current.chatList[1]!.annotation?.logAnnotation?.content).toBe('a-new')+ expect(result.current.chatList[1]!.annotation?.id).toBe('anno-id')})it('should cover handleAnnotationEdited updating node', async () => {@@ -2381,8 +2383,8 @@ describe('useChat', () => {// (query, answer, index)result.current.handleAnnotationEdited('q-edit', 'a-edit', 1)})- expect(result.current.chatList[0].content).toBe('q-edit')- expect(result.current.chatList[1].content).toBe('a-edit')+ expect(result.current.chatList[0]!.content).toBe('q-edit')+ expect(result.current.chatList[1]!.content).toBe('a-edit')})it('should cover handleAnnotationRemoved updating node', () => {@@ -2402,6 +2404,6 @@ describe('useChat', () => {act(() => {result.current.handleAnnotationRemoved(1)})- expect(result.current.chatList[1].annotation?.id).toBe('')+ expect(result.current.chatList[1]!.annotation?.id).toBe('')})})diff --git a/web/app/components/base/chat/chat/answer/__tests__/operation.spec.tsx b/web/app/components/base/chat/chat/answer/__tests__/operation.spec.tsxindex 588b261323e..e3bc2dcd385 100644--- a/web/app/components/base/chat/chat/answer/__tests__/operation.spec.tsx+++ b/web/app/components/base/chat/chat/answer/__tests__/operation.spec.tsx@@ -219,8 +219,8 @@ describe('Operation', () => {it('should show copy and regenerate buttons', () => {renderOperation()- expect(screen.getByTestId('copy-btn')).toBeInTheDocument()- expect(screen.getByTestId('regenerate-btn')).toBeInTheDocument()+ expect(screen.getByTestId('copy-btn'))!.toBeInTheDocument()+ expect(screen.getByTestId('regenerate-btn'))!.toBeInTheDocument()})it('should hide regenerate button when noChatInput is true', () => {@@ -231,7 +231,7 @@ describe('Operation', () => {it('should show TTS button when text_to_speech is enabled', () => {mockContextValue.config = makeChatConfig({ text_to_speech: { enabled: true } })renderOperation()- expect(screen.getByTestId('audio-btn')).toBeInTheDocument()+ expect(screen.getByTestId('audio-btn'))!.toBeInTheDocument()})it('should show annotation button when config supports it', () => {@@ -240,12 +240,12 @@ describe('Operation', () => {annotation_reply: { id: 'ar-1', score_threshold: 0.5, embedding_model: { embedding_provider_name: '', embedding_model_name: '' }, enabled: true },})renderOperation()- expect(screen.getByTestId('annotation-ctrl')).toBeInTheDocument()+ expect(screen.getByTestId('annotation-ctrl'))!.toBeInTheDocument()})it('should show prompt log when showPromptLog is true', () => {renderOperation({ ...baseProps, showPromptLog: true })- expect(screen.getByTestId('log-btn')).toBeInTheDocument()+ expect(screen.getByTestId('log-btn'))!.toBeInTheDocument()})it('should not show prompt log for opening statements', () => {@@ -311,8 +311,8 @@ describe('Operation', () => {it('should show like/dislike buttons', () => {renderOperation()const bar = screen.getByTestId('operation-bar')- expect(bar.querySelector('.i-ri-thumb-up-line')).toBeInTheDocument()- expect(bar.querySelector('.i-ri-thumb-down-line')).toBeInTheDocument()+ expect(bar.querySelector('.i-ri-thumb-up-line'))!.toBeInTheDocument()+ expect(bar.querySelector('.i-ri-thumb-down-line'))!.toBeInTheDocument()})it('should call onFeedback with like on like click', async () => {@@ -328,7 +328,7 @@ describe('Operation', () => {renderOperation()const thumbDown = screen.getByTestId('operation-bar').querySelector('.i-ri-thumb-down-line')!.closest('button')!await user.click(thumbDown)- expect(screen.getByRole('textbox')).toBeInTheDocument()+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})it('should submit dislike feedback from modal', async () => {@@ -348,7 +348,7 @@ describe('Operation', () => {renderOperation()const thumbDown = screen.getByTestId('operation-bar').querySelector('.i-ri-thumb-down-line')!.closest('button')!await user.click(thumbDown)- expect(screen.getByRole('textbox')).toBeInTheDocument()+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()const cancelBtn = screen.getByText(/cancel/i)await user.click(cancelBtn)expect(screen.queryByRole('textbox')).not.toBeInTheDocument()@@ -405,14 +405,14 @@ describe('Operation', () => {const item = { ...baseItem, feedback: { rating: 'dislike' as const, content: 'Too slow' } }renderOperation({ ...baseProps, item })const bar = screen.getByTestId('operation-bar')- expect(bar.querySelector('.i-ri-thumb-down-line')).toBeInTheDocument()+ expect(bar.querySelector('.i-ri-thumb-down-line'))!.toBeInTheDocument()})it('should show tooltip with only rating', () => {const item = { ...baseItem, feedback: { rating: 'like' as const } }renderOperation({ ...baseProps, item })const bar = screen.getByTestId('operation-bar')- expect(bar.querySelector('.i-ri-thumb-up-line')).toBeInTheDocument()+ expect(bar.querySelector('.i-ri-thumb-up-line'))!.toBeInTheDocument()})it('should not show feedback bar for opening statements', () => {@@ -442,7 +442,8 @@ describe('Operation', () => {const thumbDown = screen.getByTestId('operation-bar').querySelector('.i-ri-thumb-down-line')!.closest('button')!await user.click(thumbDown)// Check if modal title/labels fallback works- expect(screen.getByRole('tooltip')).toBeInTheDocument()+ // Check if modal title/labels fallback works+ expect(screen.getByRole('tooltip'))!.toBeInTheDocument()mockT.mockImplementation(key => key)})})@@ -463,7 +464,7 @@ describe('Operation', () => {const user = userEvent.setup()renderOperation()const thumbs = screen.getByTestId('operation-bar').querySelectorAll('.i-ri-thumb-up-line')- const adminThumb = thumbs[thumbs.length - 1].closest('button')!+ const adminThumb = thumbs[thumbs.length - 1]!.closest('button')!await user.click(adminThumb)expect(mockContextValue.onFeedback).toHaveBeenCalledWith('msg-1', { rating: 'like', content: undefined })})@@ -472,9 +473,9 @@ describe('Operation', () => {const user = userEvent.setup()renderOperation()const thumbs = screen.getByTestId('operation-bar').querySelectorAll('.i-ri-thumb-down-line')- const adminThumb = thumbs[thumbs.length - 1].closest('button')!+ const adminThumb = thumbs[thumbs.length - 1]!.closest('button')!await user.click(adminThumb)- expect(screen.getByRole('textbox')).toBeInTheDocument()+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})it('should show user feedback read-only in admin bar when user has liked', () => {@@ -488,7 +489,7 @@ describe('Operation', () => {const item = { ...baseItem, feedback: { rating: 'dislike' as const } }renderOperation({ ...baseProps, item })const bar = screen.getByTestId('operation-bar')- expect(bar.querySelector('.bg-components-actionbar-border')).toBeInTheDocument()+ expect(bar.querySelector('.bg-components-actionbar-border'))!.toBeInTheDocument()})it('should show existing admin like feedback and allow undo', async () => {@@ -513,12 +514,12 @@ describe('Operation', () => {const user = userEvent.setup()renderOperation()const thumbs = screen.getByTestId('operation-bar').querySelectorAll('.i-ri-thumb-up-line')- const adminThumb = thumbs[thumbs.length - 1].closest('button')!+ const adminThumb = thumbs[thumbs.length - 1]!.closest('button')!await user.click(adminThumb)expect(mockContextValue.onFeedback).toHaveBeenCalledWith('msg-1', { rating: 'like', content: undefined })const thumbsUndo = screen.getByTestId('operation-bar').querySelectorAll('.i-ri-thumb-up-line')- const adminThumbUndo = thumbsUndo[thumbsUndo.length - 1].closest('button')!+ const adminThumbUndo = thumbsUndo[thumbsUndo.length - 1]!.closest('button')!await user.click(adminThumbUndo)expect(mockContextValue.onFeedback).toHaveBeenCalledWith('msg-1', { rating: null, content: undefined })})@@ -527,13 +528,13 @@ describe('Operation', () => {const user = userEvent.setup()renderOperation()const thumbs = screen.getByTestId('operation-bar').querySelectorAll('.i-ri-thumb-down-line')- const adminThumb = thumbs[thumbs.length - 1].closest('button')!+ const adminThumb = thumbs[thumbs.length - 1]!.closest('button')!await user.click(adminThumb)const submitBtn = screen.getByText(/submit/i)await user.click(submitBtn)const thumbsUndo = screen.getByTestId('operation-bar').querySelectorAll('.i-ri-thumb-down-line')- const adminThumbUndo = thumbsUndo[thumbsUndo.length - 1].closest('button')!+ const adminThumbUndo = thumbsUndo[thumbsUndo.length - 1]!.closest('button')!await user.click(adminThumbUndo)expect(mockContextValue.onFeedback).toHaveBeenCalledWith('msg-1', { rating: null, content: undefined })})@@ -554,7 +555,9 @@ describe('Operation', () => {renderOperation({ ...baseProps, item })// Since it renders the 'else' block for hasAdminFeedback (which is false due to !)// the like/dislike regular ActionButtons should hit the Default state- expect(screen.getByTestId('operation-bar')).toBeInTheDocument()+ // Since it renders the 'else' block for hasAdminFeedback (which is false due to !)+ // the like/dislike regular ActionButtons should hit the Default state+ expect(screen.getByTestId('operation-bar'))!.toBeInTheDocument()})})@@ -587,7 +590,7 @@ describe('Operation', () => {const item = { ...baseItem, feedback: { rating: 'like' as const }, adminFeedback: { rating: 'dislike' as const } }renderOperation({ ...baseProps, item, showPromptLog: true })const bar = screen.getByTestId('operation-bar')- expect(bar).toBeInTheDocument()+ expect(bar)!.toBeInTheDocument()})it('should show separator when user has feedback in admin mode', () => {@@ -595,7 +598,7 @@ describe('Operation', () => {const item = { ...baseItem, feedback: { rating: 'like' as const } }renderOperation({ ...baseProps, item })const bar = screen.getByTestId('operation-bar')- expect(bar.querySelector('.bg-components-actionbar-border')).toBeInTheDocument()+ expect(bar.querySelector('.bg-components-actionbar-border'))!.toBeInTheDocument()})it('should handle missing translation fallbacks in buildFeedbackTooltip', () => {@@ -608,7 +611,7 @@ describe('Operation', () => {})renderOperation()- expect(screen.getByTestId('operation-bar')).toBeInTheDocument()+ expect(screen.getByTestId('operation-bar'))!.toBeInTheDocument()// Reset to default behaviormockT.mockImplementation(key => key)@@ -625,7 +628,7 @@ describe('Operation', () => {})const itemLike = { ...baseItem, feedback: { rating: 'like' as const, content: 'test content' } }const { rerender } = renderOperation({ ...baseProps, item: itemLike })- expect(screen.getByTestId('operation-bar')).toBeInTheDocument()+ expect(screen.getByTestId('operation-bar'))!.toBeInTheDocument()const itemDislike = { ...baseItem, feedback: { rating: 'dislike' as const, content: 'test content' } }rerender(@@ -633,7 +636,7 @@ describe('Operation', () => {<Operation {...baseProps} item={itemDislike} /></div>,)- expect(screen.getByTestId('operation-bar')).toBeInTheDocument()+ expect(screen.getByTestId('operation-bar'))!.toBeInTheDocument()mockT.mockImplementation(key => key)})@@ -643,7 +646,7 @@ describe('Operation', () => {const item = { ...baseItem, feedback: { rating: null } as unknown as Record<string, unknown> } as unknown as ChatItemrenderOperation({ ...baseProps, item })const bar = screen.getByTestId('operation-bar')- expect(bar).toBeInTheDocument()+ expect(bar)!.toBeInTheDocument()})it('should handle missing onFeedback gracefully in handleFeedback', async () => {@@ -703,7 +706,7 @@ describe('Operation', () => {renderOperation({ ...baseProps, item })const editBtn = screen.getByTestId('annotation-edit-btn')await user.click(editBtn)- expect(screen.getByTestId('edit-reply-modal')).toBeInTheDocument()+ expect(screen.getByTestId('edit-reply-modal'))!.toBeInTheDocument()})it('should call onAnnotationEdited from edit reply modal', async () => {@@ -742,7 +745,7 @@ describe('Operation', () => {renderOperation({ ...baseProps, item })const editBtn = screen.getByTestId('annotation-edit-btn')await user.click(editBtn)- expect(screen.getByTestId('edit-reply-modal')).toBeInTheDocument()+ expect(screen.getByTestId('edit-reply-modal'))!.toBeInTheDocument()await user.click(screen.getByTestId('modal-hide'))expect(screen.queryByTestId('edit-reply-modal')).not.toBeInTheDocument()})@@ -755,7 +758,7 @@ describe('Operation', () => {it('should show audio play button when TTS enabled', () => {renderOperation()- expect(screen.getByTestId('audio-btn')).toBeInTheDocument()+ expect(screen.getByTestId('audio-btn'))!.toBeInTheDocument()})it('should not show audio button for humanInputFormDataList', () => {diff --git a/web/app/components/base/chat/chat/answer/__tests__/suggested-questions.spec.tsx b/web/app/components/base/chat/chat/answer/__tests__/suggested-questions.spec.tsxindex 16128759bd5..6fe7c959cbd 100644--- a/web/app/components/base/chat/chat/answer/__tests__/suggested-questions.spec.tsx+++ b/web/app/components/base/chat/chat/answer/__tests__/suggested-questions.spec.tsx@@ -35,8 +35,8 @@ describe('SuggestedQuestions', () => {const questions = screen.getAllByTestId('suggested-question')expect(questions).toHaveLength(2)- expect(questions[0]).toHaveTextContent('What is Dify?')- expect(questions[1]).toHaveTextContent('How to use it?')+ expect(questions[0])!.toHaveTextContent('What is Dify?')+ expect(questions[1])!.toHaveTextContent('How to use it?')})it('should call onSend when a question is clicked', async () => {@@ -44,7 +44,7 @@ describe('SuggestedQuestions', () => {render(<SuggestedQuestions item={mockItem} />)const questions = screen.getAllByTestId('suggested-question')- await user.click(questions[0])+ await user.click(questions[0]!)expect(mockOnSend).toHaveBeenCalledWith('What is Dify?')})@@ -74,10 +74,10 @@ describe('SuggestedQuestions', () => {render(<SuggestedQuestions item={mockItem} />)const questions = screen.getAllByTestId('suggested-question')- expect(questions[0]).toHaveClass('pointer-events-none')- expect(questions[0]).toHaveClass('opacity-50')+ expect(questions[0])!.toHaveClass('pointer-events-none')+ expect(questions[0])!.toHaveClass('opacity-50')- await user.click(questions[0])+ await user.click(questions[0]!)expect(mockOnSend).not.toHaveBeenCalled()})})diff --git a/web/app/components/base/chat/chat/answer/human-input-content/__tests__/human-input-form.spec.tsx b/web/app/components/base/chat/chat/answer/human-input-content/__tests__/human-input-form.spec.tsxindex 89ba71b2d9a..4b3f7b24454 100644--- a/web/app/components/base/chat/chat/answer/human-input-content/__tests__/human-input-form.spec.tsx+++ b/web/app/components/base/chat/chat/answer/human-input-content/__tests__/human-input-form.spec.tsx@@ -46,16 +46,16 @@ describe('HumanInputForm', () => {// splitByOutputVar should yield 3 parts: "Part 1 ", "{{#$output.field1#}}", " Part 2"const contentItems = screen.getAllByTestId('mock-content-item')expect(contentItems).toHaveLength(3)- expect(contentItems[0]).toHaveTextContent('Part 1')- expect(contentItems[1]).toHaveTextContent('{{#$output.field1#}}')- expect(contentItems[2]).toHaveTextContent('Part 2')+ expect(contentItems[0])!.toHaveTextContent('Part 1')+ expect(contentItems[1])!.toHaveTextContent('{{#$output.field1#}}')+ expect(contentItems[2])!.toHaveTextContent('Part 2')const buttons = screen.getAllByTestId('action-button')expect(buttons).toHaveLength(4)- expect(buttons[0]).toHaveTextContent('Submit')- expect(buttons[1]).toHaveTextContent('Cancel')- expect(buttons[2]).toHaveTextContent('Accent')- expect(buttons[3]).toHaveTextContent('Ghost')+ expect(buttons[0])!.toHaveTextContent('Submit')+ expect(buttons[1])!.toHaveTextContent('Cancel')+ expect(buttons[2])!.toHaveTextContent('Accent')+ expect(buttons[3])!.toHaveTextContent('Ghost')})it('should handle input changes and submit correctly', async () => {@@ -64,7 +64,7 @@ describe('HumanInputForm', () => {render(<HumanInputForm formData={mockFormData} onSubmit={mockOnSubmit} />)// Update input via mock ContentItem- await user.click(screen.getAllByTestId('update-input')[0])+ await user.click(screen.getAllByTestId('update-input')[0]!)// Submitconst submitButton = screen.getByRole('button', { name: 'Submit' })@@ -91,8 +91,8 @@ describe('HumanInputForm', () => {await user.click(submitButton)- expect(submitButton).toBeDisabled()- expect(cancelButton).toBeDisabled()+ expect(submitButton)!.toBeDisabled()+ expect(cancelButton)!.toBeDisabled()// Finish submissionawait act(async () => {diff --git a/web/app/components/base/chat/chat/answer/human-input-content/content-item.tsx b/web/app/components/base/chat/chat/answer/human-input-content/content-item.tsxindex 9649a921674..b958b48a17a 100644--- a/web/app/components/base/chat/chat/answer/human-input-content/content-item.tsx+++ b/web/app/components/base/chat/chat/answer/human-input-content/content-item.tsx@@ -18,7 +18,7 @@ const ContentItem = ({const extractFieldName = (str: string): string => {const outputVarRegex = /\{\{#\$output\.([^#]+)#\}\}/const match = outputVarRegex.exec(str)- return match ? match[1] : ''+ return match ? match[1]! : ''}const fieldName = useMemo(() => {@@ -43,7 +43,7 @@ const ContentItem = ({{formInputField.type === 'paragraph' && (<TextareaclassName="h-[104px] sm:text-xs"- value={inputs[fieldName]}+ value={inputs[fieldName]!}onChange={(e) => { onInputChange(fieldName, e.target.value) }}data-testid="content-item-textarea"/>diff --git a/web/app/components/base/chat/chat/chat-input-area/__tests__/operation.spec.tsx b/web/app/components/base/chat/chat/chat-input-area/__tests__/operation.spec.tsxindex 096b18d047f..bda994cd433 100644--- a/web/app/components/base/chat/chat/chat-input-area/__tests__/operation.spec.tsx+++ b/web/app/components/base/chat/chat/chat-input-area/__tests__/operation.spec.tsx@@ -26,7 +26,7 @@ describe('Operation', () => {it('should render send button always', () => {render(<Operation onSend={vi.fn()} />)- expect(screen.getByRole('button')).toBeInTheDocument()+ expect(screen.getByRole('button'))!.toBeInTheDocument()})it('should render file uploader when fileConfig.enabled is true', () => {@@ -39,7 +39,7 @@ describe('Operation', () => {/>,)- expect(screen.getByTestId('file-uploader')).toBeInTheDocument()+ expect(screen.getByTestId('file-uploader'))!.toBeInTheDocument()})it('should not render file uploader when fileConfig is undefined', () => {@@ -106,7 +106,7 @@ describe('Operation', () => {/>,)- expect(screen.getByRole('button')).toHaveStyle({+ expect(screen.getByRole('button'))!.toHaveStyle({backgroundColor: 'rgb(255, 0, 0)',})})@@ -139,7 +139,7 @@ describe('Operation', () => {const buttons = screen.getAllByRole('button')const voiceButton = buttons[0]- await user.click(voiceButton)+ await user.click(voiceButton!)expect(onShowVoiceInput).toHaveBeenCalledTimes(1)})@@ -160,9 +160,9 @@ describe('Operation', () => {const buttons = screen.getAllByRole('button')const voiceButton = buttons[0]- expect(voiceButton).toBeDisabled()+ expect(voiceButton)!.toBeDisabled()- await user.click(voiceButton)+ await user.click(voiceButton!)expect(onShowVoiceInput).not.toHaveBeenCalled()})diff --git a/web/app/components/base/chat/chat/chat-input-area/index.tsx b/web/app/components/base/chat/chat/chat-input-area/index.tsxindex f6a2b66c3b8..f5444a8d7b3 100644--- a/web/app/components/base/chat/chat/chat-input-area/index.tsx+++ b/web/app/components/base/chat/chat/chat-input-area/index.tsx@@ -112,14 +112,14 @@ const ChatInputArea = ({ readonly, botName, showFeatureBar, showFileUpload, feat// When the cmd + up key is pressed, output the previous elementif (currentIndex > 0) {setCurrentIndex(currentIndex - 1)- handleQueryChange(historyRef.current[currentIndex - 1])+ handleQueryChange(historyRef.current[currentIndex - 1]!)}}else if (e.key === 'ArrowDown' && !e.shiftKey && !e.nativeEvent.isComposing && e.metaKey) {// When the cmd + down key is pressed, output the next elementif (currentIndex < historyRef.current.length - 1) {setCurrentIndex(currentIndex + 1)- handleQueryChange(historyRef.current[currentIndex + 1])+ handleQueryChange(historyRef.current[currentIndex + 1]!)}else if (currentIndex === historyRef.current.length - 1) {// If it is the last element, clear the input boxdiff --git a/web/app/components/base/chat/chat/citation/__tests__/popup.spec.tsx b/web/app/components/base/chat/chat/citation/__tests__/popup.spec.tsxindex 7678c5e6545..3a2cec98200 100644--- a/web/app/components/base/chat/chat/citation/__tests__/popup.spec.tsx+++ b/web/app/components/base/chat/chat/citation/__tests__/popup.spec.tsx@@ -72,27 +72,27 @@ describe('Popup', () => {describe('Rendering – Trigger', () => {it('should render the trigger element', () => {render(<Popup data={makeData()} />)- expect(screen.getByTestId('popup-trigger')).toBeInTheDocument()+ expect(screen.getByTestId('popup-trigger'))!.toBeInTheDocument()})it('should show the document name in the trigger', () => {render(<Popup data={makeData({ documentName: 'My Report.pdf' })} />)- expect(screen.getByTestId('popup-trigger')).toHaveTextContent('My Report.pdf')+ expect(screen.getByTestId('popup-trigger'))!.toHaveTextContent('My Report.pdf')})it('should pass the extracted file extension to FileIcon for non-notion sources', () => {render(<Popup data={makeData({ documentName: 'report.pdf', dataSourceType: 'upload_file' })} />)- expect(screen.getAllByTestId('file-icon')[0]).toHaveAttribute('data-type', 'pdf')+ expect(screen.getAllByTestId('file-icon')[0])!.toHaveAttribute('data-type', 'pdf')})it('should pass notion as fileType to FileIcon for notion sources', () => {render(<Popup data={makeData({ documentName: 'Notion Page', dataSourceType: 'notion' })} />)- expect(screen.getAllByTestId('file-icon')[0]).toHaveAttribute('data-type', 'notion')+ expect(screen.getAllByTestId('file-icon')[0])!.toHaveAttribute('data-type', 'notion')})it('should pass empty string as fileType when document has no extension', () => {render(<Popup data={makeData({ documentName: 'nodotfile', dataSourceType: 'upload_file' })} />)- expect(screen.getAllByTestId('file-icon')[0]).toHaveAttribute('data-type', '')+ expect(screen.getAllByTestId('file-icon')[0])!.toHaveAttribute('data-type', '')})it('should not render popup content before trigger is clicked', () => {@@ -108,7 +108,7 @@ describe('Popup', () => {await openPopup(user)- expect(screen.getByTestId('popup-content')).toBeInTheDocument()+ expect(screen.getByTestId('popup-content'))!.toBeInTheDocument()})it('should close the popup on second trigger click', async () => {@@ -129,7 +129,7 @@ describe('Popup', () => {await openPopup(user)await openPopup(user)- expect(screen.getByTestId('popup-content')).toBeInTheDocument()+ expect(screen.getByTestId('popup-content'))!.toBeInTheDocument()})})@@ -140,7 +140,7 @@ describe('Popup', () => {await openPopup(user)- expect(screen.getByTestId('popup-download-btn')).toBeInTheDocument()+ expect(screen.getByTestId('popup-download-btn'))!.toBeInTheDocument()})it('should render download button in header for file dataSourceType with dataset_id', async () => {@@ -155,7 +155,7 @@ describe('Popup', () => {await openPopup(user)- expect(screen.getByTestId('popup-download-btn')).toBeInTheDocument()+ expect(screen.getByTestId('popup-download-btn'))!.toBeInTheDocument()})it('should render plain document name in header (no button) for notion type', async () => {@@ -199,7 +199,7 @@ describe('Popup', () => {await openPopup(user)- expect(screen.getByTestId('popup-download-btn')).toBeDisabled()+ expect(screen.getByTestId('popup-download-btn'))!.toBeDisabled()})})@@ -219,7 +219,7 @@ describe('Popup', () => {await openPopup(user)- expect(screen.getByTestId('popup-source-content')).toHaveTextContent('Unique content text')+ expect(screen.getByTestId('popup-source-content'))!.toHaveTextContent('Unique content text')})it('should show segment_position when it is truthy', async () => {@@ -228,7 +228,7 @@ describe('Popup', () => {await openPopup(user)- expect(screen.getByTestId('popup-segment-position')).toHaveTextContent('7')+ expect(screen.getByTestId('popup-segment-position'))!.toHaveTextContent('7')})it('should fall back to index + 1 when segment_position is 0', async () => {@@ -237,7 +237,7 @@ describe('Popup', () => {await openPopup(user)- expect(screen.getByTestId('popup-segment-position')).toHaveTextContent('1')+ expect(screen.getByTestId('popup-segment-position'))!.toHaveTextContent('1')})})@@ -332,7 +332,7 @@ describe('Popup', () => {await openPopup(user)- expect(screen.getByTestId('popup-dataset-link')).toBeInTheDocument()+ expect(screen.getByTestId('popup-dataset-link'))!.toBeInTheDocument()})it('should render the dataset link with correct href', async () => {@@ -341,9 +341,9 @@ describe('Popup', () => {await openPopup(user)- expect(screen.getByTestId('popup-dataset-link')).toHaveAttribute(+ expect(screen.getByTestId('popup-dataset-link'))!.toHaveAttribute('href',- `/datasets/${dataWithScore.sources[0].dataset_id}/documents/${dataWithScore.sources[0].document_id}`,+ `/datasets/${dataWithScore.sources[0]!.dataset_id}/documents/${dataWithScore.sources[0]!.document_id}`,)})@@ -353,7 +353,7 @@ describe('Popup', () => {await openPopup(user)- expect(screen.getByTestId('popup-dataset-link')).toHaveTextContent(/linkToDataset/i)+ expect(screen.getByTestId('popup-dataset-link'))!.toHaveTextContent(/linkToDataset/i)})it('should render hit info section when showHitInfo is true', async () => {@@ -362,7 +362,7 @@ describe('Popup', () => {await openPopup(user)- expect(screen.getByTestId('popup-hit-info')).toBeInTheDocument()+ expect(screen.getByTestId('popup-hit-info'))!.toBeInTheDocument()})it('should render three Tooltip components (characters, hitCount, vectorHash)', async () => {@@ -380,7 +380,7 @@ describe('Popup', () => {await openPopup(user)- expect(screen.getByTestId('progress-tooltip')).toBeInTheDocument()+ expect(screen.getByTestId('progress-tooltip'))!.toBeInTheDocument()})it('should not render ProgressTooltip when source score is 0', async () => {@@ -398,7 +398,7 @@ describe('Popup', () => {await openPopup(user)- expect(screen.getByTestId('progress-tooltip')).toHaveTextContent('0.86')+ expect(screen.getByTestId('progress-tooltip'))!.toHaveTextContent('0.86')})it('should pass word_count to the characters Tooltip', async () => {@@ -408,7 +408,7 @@ describe('Popup', () => {await openPopup(user)const tooltips = screen.getAllByTestId('citation-tooltip')- expect(tooltips[0]).toHaveTextContent('250')+ expect(tooltips[0])!.toHaveTextContent('250')})it('should pass hit_count to the hitCount Tooltip', async () => {@@ -418,7 +418,7 @@ describe('Popup', () => {await openPopup(user)const tooltips = screen.getAllByTestId('citation-tooltip')- expect(tooltips[1]).toHaveTextContent('7')+ expect(tooltips[1])!.toHaveTextContent('7')})it('should pass truncated index_node_hash (first 7 chars) to vectorHash Tooltip', async () => {@@ -428,7 +428,7 @@ describe('Popup', () => {await openPopup(user)const tooltips = screen.getAllByTestId('citation-tooltip')- expect(tooltips[2]).toHaveTextContent('abcdef1')+ expect(tooltips[2])!.toHaveTextContent('abcdef1')})it('should render hit info for each source when multiple sources are present', async () => {@@ -602,7 +602,7 @@ describe('Popup', () => {await openPopup(user)const tooltips = screen.getAllByTestId('citation-tooltip')- expect(tooltips[2]).toBeInTheDocument()+ expect(tooltips[2])!.toBeInTheDocument()})describe('Item Key Generation (Branch Coverage)', () => {@@ -617,7 +617,8 @@ describe('Popup', () => {)await openPopup(user)// Verify it renders without key collision (no console error expected, though not explicitly checked here)- expect(screen.getByTestId('popup-source-item')).toBeInTheDocument()+ // Verify it renders without key collision (no console error expected, though not explicitly checked here)+ expect(screen.getByTestId('popup-source-item'))!.toBeInTheDocument()})it('should use data.documentId when both source ids are missing', async () => {@@ -631,7 +632,7 @@ describe('Popup', () => {/>,)await openPopup(user)- expect(screen.getByTestId('popup-source-item')).toBeInTheDocument()+ expect(screen.getByTestId('popup-source-item'))!.toBeInTheDocument()})it('should fallback to \'doc\' when all ids are missing', async () => {@@ -645,7 +646,7 @@ describe('Popup', () => {/>,)await openPopup(user)- expect(screen.getByTestId('popup-source-item')).toBeInTheDocument()+ expect(screen.getByTestId('popup-source-item'))!.toBeInTheDocument()})it('should fallback to index when segment_position is missing', async () => {@@ -658,7 +659,7 @@ describe('Popup', () => {/>,)await openPopup(user)- expect(screen.getByTestId('popup-segment-position')).toHaveTextContent('1')+ expect(screen.getByTestId('popup-segment-position'))!.toHaveTextContent('1')})})@@ -676,6 +677,68 @@ describe('Popup', () => {await openPopup(user)// Even if the button is rendered (it shouldn't be based on line 71),// we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.+ // Even if the button is rendered (it shouldn't be based on line 71),+ // we check the handler directly if possible, or just the button absence.expect(screen.queryByTestId('popup-download-btn')).not.toBeInTheDocument()})diff --git a/web/app/components/base/chat/chat/citation/index.tsx b/web/app/components/base/chat/chat/citation/index.tsxindex 1123497878f..56eb0e602d5 100644--- a/web/app/components/base/chat/chat/citation/index.tsx+++ b/web/app/components/base/chat/chat/citation/index.tsx@@ -32,7 +32,7 @@ const Citation: FC<CitationProps> = ({const documentIndex = prev.findIndex(i => i.documentId === documentId)if (documentIndex > -1) {- prev[documentIndex].sources.push(next)+ prev[documentIndex]!.sources.push(next)}else {prev.push({@@ -51,10 +51,10 @@ const Citation: FC<CitationProps> = ({let totalWidth = 0let limit = 0for (let i = 0; i < resources.length; i++) {- totalWidth += elesRef.current[i].clientWidth+ totalWidth += elesRef.current[i]!.clientWidthif (totalWidth + i * 4 > containerWidth) {- totalWidth -= elesRef.current[i].clientWidth+ totalWidth -= elesRef.current[i]!.clientWidthif (totalWidth + 34 > containerWidth)limit = i - 1diff --git a/web/app/components/base/chat/chat/hooks.ts b/web/app/components/base/chat/chat/hooks.tsindex 30dd7e0db1c..d6e5c2f936e 100644--- a/web/app/components/base/chat/chat/hooks.ts+++ b/web/app/components/base/chat/chat/hooks.ts@@ -532,7 +532,7 @@ export const useChat = (if (responseItem.workflowProcess?.tracing) {const currentTracingIndex = responseItem.workflowProcess.tracing.findIndex(item => item.node_id === humanInputRequiredData.node_id)if (currentTracingIndex > -1)- responseItem.workflowProcess.tracing[currentTracingIndex].status = NodeRunningStatus.Paused+ responseItem.workflowProcess.tracing[currentTracingIndex]!.status = NodeRunningStatus.Paused}})},@@ -555,7 +555,7 @@ export const useChat = (updateChatTreeNode(messageId, (responseItem) => {if (responseItem.humanInputFormDataList?.length) {const currentFormIndex = responseItem.humanInputFormDataList.findIndex(item => item.node_id === humanInputFormTimeoutData.node_id)- responseItem.humanInputFormDataList[currentFormIndex].expiration_time = humanInputFormTimeoutData.expiration_time+ responseItem.humanInputFormDataList[currentFormIndex]!.expiration_time = humanInputFormTimeoutData.expiration_time}})},@@ -1098,7 +1098,7 @@ export const useChat = (}const currentTracingIndex = responseItem.workflowProcess!.tracing!.findIndex(item => item.node_id === humanInputRequiredData.node_id)if (currentTracingIndex > -1) {- responseItem.workflowProcess!.tracing[currentTracingIndex].status = NodeRunningStatus.Paused+ responseItem.workflowProcess!.tracing[currentTracingIndex]!.status = NodeRunningStatus.PausedupdateCurrentQAOnTree({placeholderQuestionId,questionItem,@@ -1128,7 +1128,7 @@ export const useChat = (onHumanInputFormTimeout: ({ data: humanInputFormTimeoutData }) => {if (responseItem.humanInputFormDataList?.length) {const currentFormIndex = responseItem.humanInputFormDataList!.findIndex(item => item.node_id === humanInputFormTimeoutData.node_id)- responseItem.humanInputFormDataList[currentFormIndex].expiration_time = humanInputFormTimeoutData.expiration_time+ responseItem.humanInputFormDataList[currentFormIndex]!.expiration_time = humanInputFormTimeoutData.expiration_time}updateCurrentQAOnTree({placeholderQuestionId,@@ -1181,8 +1181,8 @@ export const useChat = (])const handleAnnotationEdited = useCallback((query: string, answer: string, index: number) => {- const targetQuestionId = chatList[index - 1].id- const targetAnswerId = chatList[index].id+ const targetQuestionId = chatList[index - 1]!.id+ const targetAnswerId = chatList[index]!.idupdateChatTreeNode(targetQuestionId, {content: query,@@ -1190,22 +1190,22 @@ export const useChat = (updateChatTreeNode(targetAnswerId, {content: answer,annotation: {- ...chatList[index].annotation,+ ...chatList[index]!.annotation,logAnnotation: undefined,} as any,})}, [chatList, updateChatTreeNode])const handleAnnotationAdded = useCallback((annotationId: string, authorName: string, query: string, answer: string, index: number) => {- const targetQuestionId = chatList[index - 1].id- const targetAnswerId = chatList[index].id+ const targetQuestionId = chatList[index - 1]!.id+ const targetAnswerId = chatList[index]!.idupdateChatTreeNode(targetQuestionId, {content: query,})updateChatTreeNode(targetAnswerId, {- content: chatList[index].content,+ content: chatList[index]!.content,annotation: {id: annotationId,authorName,@@ -1222,12 +1222,12 @@ export const useChat = (}, [chatList, updateChatTreeNode])const handleAnnotationRemoved = useCallback((index: number) => {- const targetAnswerId = chatList[index].id+ const targetAnswerId = chatList[index]!.idupdateChatTreeNode(targetAnswerId, {- content: chatList[index].content,+ content: chatList[index]!.content,annotation: {- ...chatList[index].annotation,+ ...chatList[index]!.annotation,id: '',} as Annotation,})diff --git a/web/app/components/base/chat/chat/index.tsx b/web/app/components/base/chat/chat/index.tsxindex 0343366a7fb..35000592031 100644--- a/web/app/components/base/chat/chat/index.tsx+++ b/web/app/components/base/chat/chat/index.tsx@@ -177,7 +177,7 @@ const Chat: FC<ChatProps> = ({appData={appData}key={item.id}item={item}- question={chatList[index - 1]?.content}+ question={chatList[index - 1]?.content!}index={index}config={config}answerIcon={answerIcon}diff --git a/web/app/components/base/chat/chat/thought/__tests__/index.spec.tsx b/web/app/components/base/chat/chat/thought/__tests__/index.spec.tsxindex 8a4ea5717d5..dc1ba746743 100644--- a/web/app/components/base/chat/chat/thought/__tests__/index.spec.tsx+++ b/web/app/components/base/chat/chat/thought/__tests__/index.spec.tsx@@ -22,8 +22,8 @@ describe('Thought', () => {render(<Thought thought={thought} isFinished={true} />)- expect(screen.getByText(/used/i)).toBeInTheDocument()- expect(screen.getByText('test-tool')).toBeInTheDocument()+ expect(screen.getByText(/used/i))!.toBeInTheDocument()+ expect(screen.getByText('test-tool'))!.toBeInTheDocument()})it('should render multiple tool thoughts from JSON array', () => {@@ -36,8 +36,8 @@ describe('Thought', () => {render(<Thought thought={thought} isFinished={false} />)expect(screen.getAllByText(/using/i)).toHaveLength(2)- expect(screen.getByText('tool1')).toBeInTheDocument()- expect(screen.getByText('tool2')).toBeInTheDocument()+ expect(screen.getByText('tool1'))!.toBeInTheDocument()+ expect(screen.getByText('tool2'))!.toBeInTheDocument()})it('should show input and output when expanded', async () => {@@ -54,8 +54,8 @@ describe('Thought', () => {await user.click(screen.getByText(/used/i))- expect(screen.getByText('test input data')).toBeInTheDocument()- expect(screen.getByText('test output data')).toBeInTheDocument()+ expect(screen.getByText('test input data'))!.toBeInTheDocument()+ expect(screen.getByText('test output data'))!.toBeInTheDocument()})})@@ -65,7 +65,7 @@ describe('Thought', () => {render(<Thought thought={thought} isFinished={true} />)- expect(screen.getByText(/used/i)).toBeInTheDocument()+ expect(screen.getByText(/used/i))!.toBeInTheDocument()})it('should show in-progress state with correct text', () => {@@ -73,7 +73,7 @@ describe('Thought', () => {render(<Thought thought={thought} isFinished={false} />)- expect(screen.getByText(/using/i)).toBeInTheDocument()+ expect(screen.getByText(/using/i))!.toBeInTheDocument()})})@@ -85,7 +85,7 @@ describe('Thought', () => {render(<Thought thought={thought} isFinished={true} />)- expect(screen.getByText('custom-tool')).toBeInTheDocument()+ expect(screen.getByText('custom-tool'))!.toBeInTheDocument()})it('should fallback to tool name when tool_labels is undefined', () => {@@ -96,7 +96,7 @@ describe('Thought', () => {render(<Thought thought={thought} isFinished={true} />)- expect(screen.getByText('fallback-tool')).toBeInTheDocument()+ expect(screen.getByText('fallback-tool'))!.toBeInTheDocument()})it('should fallback to tool name when toolName property is missing', () => {@@ -107,7 +107,7 @@ describe('Thought', () => {render(<Thought thought={thought} isFinished={true} />)- expect(screen.getByText('another-tool')).toBeInTheDocument()+ expect(screen.getByText('another-tool'))!.toBeInTheDocument()})it('should fallback to tool name when language property is missing', () => {@@ -123,7 +123,7 @@ describe('Thought', () => {render(<Thought thought={thought} isFinished={true} />)- expect(screen.getByText('test-tool')).toBeInTheDocument()+ expect(screen.getByText('test-tool'))!.toBeInTheDocument()})it('should show knowledge label for dataset tools', () => {@@ -133,7 +133,7 @@ describe('Thought', () => {render(<Thought thought={thought} isFinished={true} />)- expect(screen.getByText(/knowledge/i)).toBeInTheDocument()+ expect(screen.getByText(/knowledge/i))!.toBeInTheDocument()})})@@ -145,7 +145,7 @@ describe('Thought', () => {render(<Thought thought={thought} isFinished={true} />)- expect(screen.getByText('invalid-json-{')).toBeInTheDocument()+ expect(screen.getByText('invalid-json-{'))!.toBeInTheDocument()})it('should handle non-array JSON in tool field', () => {@@ -155,7 +155,7 @@ describe('Thought', () => {render(<Thought thought={thought} isFinished={true} />)- expect(screen.getByText('{"name":"object-tool"}')).toBeInTheDocument()+ expect(screen.getByText('{"name":"object-tool"}'))!.toBeInTheDocument()})it('should handle invalid JSON in tool_input when parsing array', async () => {@@ -169,7 +169,7 @@ describe('Thought', () => {await user.click(screen.getByText(/used/i))- expect(screen.getByText('invalid-json-{')).toBeInTheDocument()+ expect(screen.getByText('invalid-json-{'))!.toBeInTheDocument()})it('should handle invalid JSON in observation when parsing array', async () => {@@ -183,7 +183,7 @@ describe('Thought', () => {await user.click(screen.getByText(/used/i))- expect(screen.getByText('invalid-json-[')).toBeInTheDocument()+ expect(screen.getByText('invalid-json-['))!.toBeInTheDocument()})it('should extract correct values from JSON arrays by index', async () => {@@ -199,17 +199,17 @@ describe('Thought', () => {const toolSections = screen.getAllByText(/used/i)expect(toolSections).toHaveLength(3)- await user.click(toolSections[0])- expect(screen.getByText('input1')).toBeInTheDocument()- expect(screen.getByText('output1')).toBeInTheDocument()+ await user.click(toolSections[0]!)+ expect(screen.getByText('input1'))!.toBeInTheDocument()+ expect(screen.getByText('output1'))!.toBeInTheDocument()- await user.click(toolSections[1])- expect(screen.getByText('input2')).toBeInTheDocument()- expect(screen.getByText('output2')).toBeInTheDocument()+ await user.click(toolSections[1]!)+ expect(screen.getByText('input2'))!.toBeInTheDocument()+ expect(screen.getByText('output2'))!.toBeInTheDocument()- await user.click(toolSections[2])- expect(screen.getByText('input3')).toBeInTheDocument()- expect(screen.getByText('output3')).toBeInTheDocument()+ await user.click(toolSections[2]!)+ expect(screen.getByText('input3'))!.toBeInTheDocument()+ expect(screen.getByText('output3'))!.toBeInTheDocument()})it('should use original value when isValueArray is false', async () => {@@ -224,8 +224,8 @@ describe('Thought', () => {await user.click(screen.getByText(/used/i))- expect(screen.getByText('regular input')).toBeInTheDocument()- expect(screen.getByText('regular output')).toBeInTheDocument()+ expect(screen.getByText('regular input'))!.toBeInTheDocument()+ expect(screen.getByText('regular output'))!.toBeInTheDocument()})})@@ -242,7 +242,7 @@ describe('Thought', () => {expect(screen.queryByText('test input')).not.toBeInTheDocument()await user.click(screen.getByText(/used/i))- expect(screen.getByText('test input')).toBeInTheDocument()+ expect(screen.getByText('test input'))!.toBeInTheDocument()await user.click(screen.getByText(/used/i))expect(screen.queryByText('test input')).not.toBeInTheDocument()@@ -260,13 +260,13 @@ describe('Thought', () => {const toolHeaders = screen.getAllByText(/used/i)- await user.click(toolHeaders[0])- expect(screen.getByText('input1')).toBeInTheDocument()+ await user.click(toolHeaders[0]!)+ expect(screen.getByText('input1'))!.toBeInTheDocument()expect(screen.queryByText('input2')).not.toBeInTheDocument()- await user.click(toolHeaders[1])- expect(screen.getByText('input1')).toBeInTheDocument()- expect(screen.getByText('input2')).toBeInTheDocument()+ await user.click(toolHeaders[1]!)+ expect(screen.getByText('input1'))!.toBeInTheDocument()+ expect(screen.getByText('input2'))!.toBeInTheDocument()})})@@ -292,8 +292,8 @@ describe('Thought', () => {render(<Thought thought={thought} isFinished={true} />)- expect(screen.getByText(/knowledge/i)).toBeInTheDocument()- expect(screen.getByText('regular-tool')).toBeInTheDocument()+ expect(screen.getByText(/knowledge/i))!.toBeInTheDocument()+ expect(screen.getByText('regular-tool'))!.toBeInTheDocument()})})@@ -309,7 +309,7 @@ describe('Thought', () => {await user.click(screen.getByText(/used/i))- expect(screen.getByText(/requestTitle/i)).toBeInTheDocument()+ expect(screen.getByText(/requestTitle/i))!.toBeInTheDocument()})it('should handle empty observation', async () => {@@ -323,7 +323,7 @@ describe('Thought', () => {await user.click(screen.getByText(/used/i))- expect(screen.getByText(/responseTitle/i)).toBeInTheDocument()+ expect(screen.getByText(/responseTitle/i))!.toBeInTheDocument()})it('should handle JSON array with undefined elements', async () => {@@ -337,9 +337,9 @@ describe('Thought', () => {render(<Thought thought={thought} isFinished={true} />)const toolHeaders = screen.getAllByText(/used/i)- await user.click(toolHeaders[1])+ await user.click(toolHeaders[1]!)- expect(screen.getByText('tool2')).toBeInTheDocument()+ expect(screen.getByText('tool2'))!.toBeInTheDocument()})})})diff --git a/web/app/components/base/chat/chat/use-chat-layout.ts b/web/app/components/base/chat/chat/use-chat-layout.tsindex 41f622c523a..712382070dd 100644--- a/web/app/components/base/chat/chat/use-chat-layout.ts+++ b/web/app/components/base/chat/chat/use-chat-layout.ts@@ -76,7 +76,7 @@ export const useChatLayout = ({ chatList, sidebarCollapseState }: UseChatLayoutOif (chatFooterRef.current && chatContainerRef.current) {const resizeContainerObserver = new ResizeObserver((entries) => {for (const entry of entries) {- const { blockSize } = entry.borderBoxSize[0]+ const { blockSize } = entry.borderBoxSize[0]!chatContainerRef.current!.style.paddingBottom = `${blockSize}px`handleScrollToBottom()}@@ -85,7 +85,7 @@ export const useChatLayout = ({ chatList, sidebarCollapseState }: UseChatLayoutOconst resizeFooterObserver = new ResizeObserver((entries) => {for (const entry of entries) {- const { inlineSize } = entry.borderBoxSize[0]+ const { inlineSize } = entry.borderBoxSize[0]!chatFooterRef.current!.style.width = `${inlineSize}px`}})diff --git a/web/app/components/base/chat/embedded-chatbot/inputs-form/__tests__/content.spec.tsx b/web/app/components/base/chat/embedded-chatbot/inputs-form/__tests__/content.spec.tsxindex 50c3790e838..526fca2061d 100644--- a/web/app/components/base/chat/embedded-chatbot/inputs-form/__tests__/content.spec.tsx+++ b/web/app/components/base/chat/embedded-chatbot/inputs-form/__tests__/content.spec.tsx@@ -153,7 +153,7 @@ describe('InputsFormContent', () => {it('should handle text input changes', async () => {render(<InputsFormContent />)const inputs = screen.getAllByPlaceholderText('Text Label')- await user.type(inputs[0], 'hello')+ await user.type(inputs[0]!, 'hello')expect(mockContextValue.setCurrentConversationInputs).toHaveBeenCalled()expect(mockContextValue.handleNewConversationInputsChange).toHaveBeenCalled()@@ -162,7 +162,7 @@ describe('InputsFormContent', () => {it('should handle number input changes', async () => {render(<InputsFormContent />)const inputs = screen.getAllByPlaceholderText('Number Label')- await user.type(inputs[0], '123')+ await user.type(inputs[0]!, '123')expect(mockContextValue.setCurrentConversationInputs).toHaveBeenCalled()expect(mockContextValue.handleNewConversationInputsChange).toHaveBeenCalled()@@ -171,7 +171,7 @@ describe('InputsFormContent', () => {it('should handle paragraph input changes', async () => {render(<InputsFormContent />)const inputs = screen.getAllByPlaceholderText('Paragraph Label')- await user.type(inputs[0], 'long text')+ await user.type(inputs[0]!, 'long text')expect(mockContextValue.setCurrentConversationInputs).toHaveBeenCalled()expect(mockContextValue.handleNewConversationInputsChange).toHaveBeenCalled()@@ -203,7 +203,7 @@ describe('InputsFormContent', () => {it('should handle single file upload change', async () => {render(<InputsFormContent />)const uploadButtons = screen.getAllByText('Upload')- await user.click(uploadButtons[0]) // First one is single file+ await user.click(uploadButtons[0]!) // First one is single fileexpect(mockContextValue.setCurrentConversationInputs).toHaveBeenCalled()expect(mockContextValue.handleNewConversationInputsChange).toHaveBeenCalled()@@ -212,7 +212,7 @@ describe('InputsFormContent', () => {it('should handle multi files upload change', async () => {render(<InputsFormContent />)const uploadButtons = screen.getAllByText('Upload')- await user.click(uploadButtons[1]) // Second one is multi files+ await user.click(uploadButtons[1]!) // Second one is multi filesexpect(mockContextValue.setCurrentConversationInputs).toHaveBeenCalled()expect(mockContextValue.handleNewConversationInputsChange).toHaveBeenCalled()@@ -229,7 +229,7 @@ describe('InputsFormContent', () => {it('should show tip when showTip is true', () => {render(<InputsFormContent showTip />)- expect(screen.getByText(/chat.chatFormTip/i)).toBeInTheDocument()+ expect(screen.getByText(/chat.chatFormTip/i))!.toBeInTheDocument()})it('should set initial values from context', () => {@@ -243,7 +243,7 @@ describe('InputsFormContent', () => {vi.mocked(useEmbeddedChatbotContext).mockReturnValue(contextWithValues as unknown as any)render(<InputsFormContent />)- expect(screen.getByDisplayValue('initial value')).toBeInTheDocument()+ expect(screen.getByDisplayValue('initial value'))!.toBeInTheDocument()})it('should use currentConversationInputs when currentConversationId exists', () => {@@ -258,6 +258,6 @@ describe('InputsFormContent', () => {vi.mocked(useEmbeddedChatbotContext).mockReturnValue(contextWithConv as unknown as any)render(<InputsFormContent />)- expect(screen.getByDisplayValue('conv value')).toBeInTheDocument()+ expect(screen.getByDisplayValue('conv value'))!.toBeInTheDocument()})})diff --git a/web/app/components/base/chat/embedded-chatbot/theme/utils.ts b/web/app/components/base/chat/embedded-chatbot/theme/utils.tsindex 812b9283aac..45effbb0faa 100644--- a/web/app/components/base/chat/embedded-chatbot/theme/utils.ts+++ b/web/app/components/base/chat/embedded-chatbot/theme/utils.ts@@ -22,7 +22,7 @@ export function CssTransform(cssString: string): object {for (const pair of propertyValuePairs) {if (pair.trim().length > 0) {const [property, value] = pair.split(':')- Object.assign(style, { [property.trim()]: value.trim() })+ Object.assign(style, { [property!.trim()]: value!.trim() })}}return stylediff --git a/web/app/components/base/chat/utils.ts b/web/app/components/base/chat/utils.tsindex 5881f565a49..ff9085c4e65 100644--- a/web/app/components/base/chat/utils.ts+++ b/web/app/components/base/chat/utils.ts@@ -94,7 +94,7 @@ function isValidGeneratedAnswer(item?: ChatItem | ChatItemInTree): boolean {function getLastAnswer<T extends ChatItem | ChatItemInTree>(chatList: T[]): T | null {for (let i = chatList.length - 1; i >= 0; i--) {- const item = chatList[i]+ const item = chatList[i]!if (isValidGeneratedAnswer(item))return item}@@ -158,7 +158,7 @@ function buildChatItemTree(allMessages: IChatItem[]): ChatItemInTree[] {rootNodes.push(questionNode)}else {- map[parentMessageId].children!.push(questionNode)+ map[parentMessageId]!.children!.push(questionNode)}}}@@ -188,8 +188,8 @@ function getThreadMessages(tree: ChatItemInTree[], targetMessageId?: string): Chconst parentAnswer = path[index - 2]const siblingCount = !parentAnswer ? tree.length : parentAnswer.children!.length- const prevSibling = !parentAnswer ? tree[item.siblingIndex! - 1]?.children?.[0]?.id : parentAnswer.children![item.siblingIndex! - 1]?.children?.[0].id- const nextSibling = !parentAnswer ? tree[item.siblingIndex! + 1]?.children?.[0]?.id : parentAnswer.children![item.siblingIndex! + 1]?.children?.[0].id+ const prevSibling = !parentAnswer ? tree[item.siblingIndex! - 1]?.children?.[0]?.id : parentAnswer.children![item.siblingIndex! - 1]?.children?.[0]!.id+ const nextSibling = !parentAnswer ? tree[item.siblingIndex! + 1]?.children?.[0]?.id : parentAnswer.children![item.siblingIndex! + 1]?.children?.[0]!.idreturn { ...item, siblingCount, prevSibling, nextSibling }})@@ -198,8 +198,8 @@ function getThreadMessages(tree: ChatItemInTree[], targetMessageId?: string): Chif (node.children) {for (let i = node.children.length - 1; i >= 0; i--) {stack.push({- node: node.children[i],- path: [...path, node.children[i]],+ node: node.children[i]!,+ path: [...path, node.children[i]!],})}}diff --git a/web/app/components/base/checkbox-list/__tests__/index.spec.tsx b/web/app/components/base/checkbox-list/__tests__/index.spec.tsxindex b4f816dda8d..10c390962b6 100644--- a/web/app/components/base/checkbox-list/__tests__/index.spec.tsx+++ b/web/app/components/base/checkbox-list/__tests__/index.spec.tsx@@ -18,10 +18,10 @@ describe('checkbox list component', () => {options={options}/>,)- expect(screen.getByText('Test Title')).toBeInTheDocument()- expect(screen.getByText('Test Description')).toBeInTheDocument()+ expect(screen.getByText('Test Title'))!.toBeInTheDocument()+ expect(screen.getByText('Test Description'))!.toBeInTheDocument()options.forEach((option) => {- expect(screen.getByText(option.label)).toBeInTheDocument()+ expect(screen.getByText(option.label))!.toBeInTheDocument()})})@@ -31,7 +31,7 @@ describe('checkbox list component', () => {const input = screen.getByRole('textbox')await userEvent.type(input, 'app')- expect(screen.getByText('Apple')).toBeInTheDocument()+ expect(screen.getByText('Apple'))!.toBeInTheDocument()expect(screen.queryByText('Option 2')).not.toBeInTheDocument()expect(screen.queryByText('Option 3')).not.toBeInTheDocument()})@@ -39,7 +39,7 @@ describe('checkbox list component', () => {it('renders select-all checkbox', () => {render(<CheckboxList options={options} showSelectAll />)const checkboxes = screen.getByTestId('checkbox-selectAll')- expect(checkboxes).toBeInTheDocument()+ expect(checkboxes)!.toBeInTheDocument()})it('selects all options when select-all is clicked', async () => {@@ -110,7 +110,7 @@ describe('checkbox list component', () => {)const selectAll = screen.getByTestId('checkbox-selectAll')- expect(selectAll.querySelector('[data-testid="check-icon-selectAll"]')).toBeInTheDocument()+ expect(selectAll.querySelector('[data-testid="check-icon-selectAll"]'))!.toBeInTheDocument()})it('hides select-all checkbox when searching', async () => {@@ -184,7 +184,7 @@ describe('checkbox list component', () => {const input = screen.getByRole('textbox')await userEvent.type(input, 'ban')await userEvent.click(screen.getByText('common.operation.resetKeywords'))- expect(input).toHaveValue('')+ expect(input)!.toHaveValue('')})it('does not toggle disabled option when clicked', async () => {@@ -221,8 +221,8 @@ describe('checkbox list component', () => {// Find option and click the div containerconst optionLabels = screen.getAllByText('Option 1')- const optionDiv = optionLabels[0].closest('[data-testid="option-item"]')- expect(optionDiv).toBeInTheDocument()+ const optionDiv = optionLabels[0]!.closest('[data-testid="option-item"]')+ expect(optionDiv)!.toBeInTheDocument()await userEvent.click(optionDiv as HTMLElement)expect(onChange).not.toHaveBeenCalled()})@@ -234,7 +234,7 @@ describe('checkbox list component', () => {label="Test Label"/>,)- expect(screen.getByText('Test Label')).toBeInTheDocument()+ expect(screen.getByText('Test Label'))!.toBeInTheDocument()})it('renders without showSelectAll, showCount, showSearch', () => {@@ -248,7 +248,7 @@ describe('checkbox list component', () => {)expect(screen.queryByTestId('checkbox-selectAll')).not.toBeInTheDocument()options.forEach((option) => {- expect(screen.getByText(option.label)).toBeInTheDocument()+ expect(screen.getByText(option.label))!.toBeInTheDocument()})})@@ -259,7 +259,7 @@ describe('checkbox list component', () => {containerClassName="custom-class"/>,)- expect(container.querySelector('.custom-class')).toBeInTheDocument()+ expect(container.querySelector('.custom-class'))!.toBeInTheDocument()})it('applies maxHeight style to options container', () => {@@ -270,7 +270,7 @@ describe('checkbox list component', () => {/>,)const optionsContainer = screen.getByTestId('options-container')- expect(optionsContainer).toHaveStyle({ maxHeight: '200px', overflowY: 'auto' })+ expect(optionsContainer)!.toHaveStyle({ maxHeight: '200px', overflowY: 'auto' })})it('shows indeterminate state when some options are selected', async () => {@@ -285,8 +285,8 @@ describe('checkbox list component', () => {)// When some but not all options are selected, clicking select-all should select all remaining optionsconst selectAll = screen.getByTestId('checkbox-selectAll')- expect(selectAll).toBeInTheDocument()- expect(selectAll).toHaveAttribute('aria-checked', 'mixed')+ expect(selectAll)!.toBeInTheDocument()+ expect(selectAll)!.toHaveAttribute('aria-checked', 'mixed')await userEvent.click(selectAll)expect(onChange).toHaveBeenCalledWith(['option1', 'option2', 'option3', 'apple'])@@ -298,9 +298,9 @@ describe('checkbox list component', () => {const input = screen.getByRole('textbox')await userEvent.type(input, 'option')- expect(screen.getByText('Option 1')).toBeInTheDocument()- expect(screen.getByText('Option 2')).toBeInTheDocument()- expect(screen.getByText('Option 3')).toBeInTheDocument()+ expect(screen.getByText('Option 1'))!.toBeInTheDocument()+ expect(screen.getByText('Option 2'))!.toBeInTheDocument()+ expect(screen.getByText('Option 3'))!.toBeInTheDocument()expect(screen.queryByText('Apple')).not.toBeInTheDocument()})@@ -310,7 +310,7 @@ describe('checkbox list component', () => {const input = screen.getByRole('textbox')await userEvent.type(input, 'xyz')- expect(screen.getByText(/common.operation.noSearchResults/i)).toBeInTheDocument()+ expect(screen.getByText(/common.operation.noSearchResults/i))!.toBeInTheDocument()})it('toggles option by clicking option row', async () => {@@ -327,7 +327,7 @@ describe('checkbox list component', () => {const optionLabel = screen.getByText('Option 1')const optionRow = optionLabel.closest('div[data-testid="option-item"]')- expect(optionRow).toBeInTheDocument()+ expect(optionRow)!.toBeInTheDocument()await userEvent.click(optionRow as HTMLElement)expect(onChange).toHaveBeenCalledWith(['option1'])@@ -348,7 +348,7 @@ describe('checkbox list component', () => {)const optionRow = screen.getByText('Option 1').closest('div[data-testid="option-item"]')- expect(optionRow).toBeInTheDocument()+ expect(optionRow)!.toBeInTheDocument()await userEvent.click(optionRow as HTMLElement)expect(onChange).not.toHaveBeenCalled()@@ -377,7 +377,7 @@ describe('checkbox list component', () => {const input = screen.getByRole('textbox')await userEvent.type(input, 'opt')- expect(screen.getByText(/operation.searchCount/i)).toBeInTheDocument()+ expect(screen.getByText(/operation.searchCount/i))!.toBeInTheDocument()})it('shows no data message when no options are provided', () => {@@ -386,7 +386,7 @@ describe('checkbox list component', () => {options={[]}/>,)- expect(screen.getByText('common.noData')).toBeInTheDocument()+ expect(screen.getByText('common.noData'))!.toBeInTheDocument()})it('does not toggle option when component is disabled even with enabled option', async () => {diff --git a/web/app/components/base/chip/__tests__/index.spec.tsx b/web/app/components/base/chip/__tests__/index.spec.tsxindex 24c04b51a58..ac3a68292c4 100644--- a/web/app/components/base/chip/__tests__/index.spec.tsx+++ b/web/app/components/base/chip/__tests__/index.spec.tsx@@ -54,13 +54,13 @@ describe('Chip', () => {it('should render without crashing', () => {renderChip()- expect(screen.getByText('All Items')).toBeInTheDocument()+ expect(screen.getByText('All Items'))!.toBeInTheDocument()})it('should display current selected item name', () => {renderChip({ value: 'active' })- expect(screen.getByText('Active')).toBeInTheDocument()+ expect(screen.getByText('Active'))!.toBeInTheDocument()})it('should display empty content when value does not match any item', () => {@@ -76,7 +76,7 @@ describe('Chip', () => {describe('Props', () => {it('should update displayed item name when value prop changes', () => {const { rerender } = renderChip({ value: 'all' })- expect(screen.getByText('All Items')).toBeInTheDocument()+ expect(screen.getByText('All Items'))!.toBeInTheDocument()rerender(<Chip@@ -86,7 +86,7 @@ describe('Chip', () => {onClear={onClear}/>,)- expect(screen.getByText('Archived')).toBeInTheDocument()+ expect(screen.getByText('Archived'))!.toBeInTheDocument()})it('should show left icon by default', () => {@@ -94,7 +94,7 @@ describe('Chip', () => {// The filter icon should be visibleconst svg = container.querySelector('svg')- expect(svg).toBeInTheDocument()+ expect(svg)!.toBeInTheDocument()})it('should hide left icon when showLeftIcon is false', () => {@@ -114,7 +114,7 @@ describe('Chip', () => {renderChip({ leftIcon: <CustomIcon /> })- expect(screen.getByTestId('custom-icon')).toBeInTheDocument()+ expect(screen.getByTestId('custom-icon'))!.toBeInTheDocument()})it('should apply custom className to trigger', () => {@@ -123,7 +123,7 @@ describe('Chip', () => {const { container } = renderChip({ className: customClass })const chipElement = container.querySelector(`.${customClass}`)- expect(chipElement).toBeInTheDocument()+ expect(chipElement)!.toBeInTheDocument()})it('should apply custom panelClassName to dropdown panel', () => {@@ -134,7 +134,7 @@ describe('Chip', () => {// Panel is rendered in a portal, so check document.bodyconst panel = document.body.querySelector(`.${customPanelClass}`)- expect(panel).toBeInTheDocument()+ expect(panel)!.toBeInTheDocument()})})@@ -144,18 +144,18 @@ describe('Chip', () => {// Initially closed - check data-state attributeconst trigger = getTrigger(container)- expect(trigger).toHaveAttribute('data-state', 'closed')+ expect(trigger)!.toHaveAttribute('data-state', 'closed')// Open panelopenPanel(container)- expect(trigger).toHaveAttribute('data-state', 'open')+ expect(trigger)!.toHaveAttribute('data-state', 'open')// Panel items should be visibleexpect(screen.getAllByText('All Items').length).toBeGreaterThan(1)// Close panelif (trigger)fireEvent.click(trigger)- expect(trigger).toHaveAttribute('data-state', 'closed')+ expect(trigger)!.toHaveAttribute('data-state', 'closed')})it('should close panel after selecting an item', () => {@@ -163,14 +163,14 @@ describe('Chip', () => {openPanel(container)const trigger = getTrigger(container)- expect(trigger).toHaveAttribute('data-state', 'open')+ expect(trigger)!.toHaveAttribute('data-state', 'open')// Click on an item in the dropdown panelconst activeItems = screen.getAllByText('Active')// The second one should be in the dropdown- fireEvent.click(activeItems[activeItems.length - 1])+ fireEvent.click(activeItems[activeItems.length - 1]!)- expect(trigger).toHaveAttribute('data-state', 'closed')+ expect(trigger)!.toHaveAttribute('data-state', 'closed')})})@@ -181,7 +181,7 @@ describe('Chip', () => {openPanel(container)// Get all "Active" texts and click the one in the dropdown (should be the last one)const activeItems = screen.getAllByText('Active')- fireEvent.click(activeItems[activeItems.length - 1])+ fireEvent.click(activeItems[activeItems.length - 1]!)expect(onSelect).toHaveBeenCalledTimes(1)expect(onSelect).toHaveBeenCalledWith(items[1])@@ -197,7 +197,7 @@ describe('Chip', () => {const closeIcon = svgs?.[svgs.length - 1]const clearButton = closeIcon?.parentElement- expect(clearButton).toBeInTheDocument()+ expect(clearButton)!.toBeInTheDocument()if (clearButton)fireEvent.click(clearButton)@@ -208,7 +208,7 @@ describe('Chip', () => {const { container } = renderChip({ value: 'active' })const trigger = getTrigger(container)- expect(trigger).toHaveAttribute('data-state', 'closed')+ expect(trigger)!.toHaveAttribute('data-state', 'closed')// Find the close icon (last SVG) and click its parentconst svgs = trigger?.querySelectorAll('svg')@@ -219,7 +219,8 @@ describe('Chip', () => {fireEvent.click(clearButton)// Panel should remain closed- expect(trigger).toHaveAttribute('data-state', 'closed')+ // Panel should remain closed+ expect(trigger)!.toHaveAttribute('data-state', 'closed')expect(onClear).toHaveBeenCalledTimes(1)})@@ -231,17 +232,17 @@ describe('Chip', () => {// Click 1: openif (trigger)fireEvent.click(trigger)- expect(trigger).toHaveAttribute('data-state', 'open')+ expect(trigger)!.toHaveAttribute('data-state', 'open')// Click 2: closeif (trigger)fireEvent.click(trigger)- expect(trigger).toHaveAttribute('data-state', 'closed')+ expect(trigger)!.toHaveAttribute('data-state', 'closed')// Click 3: open againif (trigger)fireEvent.click(trigger)- expect(trigger).toHaveAttribute('data-state', 'open')+ expect(trigger)!.toHaveAttribute('data-state', 'open')})})@@ -283,10 +284,11 @@ describe('Chip', () => {const trigger = getTrigger(container)// Closed by default- expect(trigger).toHaveAttribute('data-state', 'closed')+ // Closed by default+ expect(trigger)!.toHaveAttribute('data-state', 'closed')openPanel(container)- expect(trigger).toHaveAttribute('data-state', 'open')+ expect(trigger)!.toHaveAttribute('data-state', 'open')// Items should be duplicated (once in trigger, once in panel)expect(screen.getAllByText('All Items').length).toBeGreaterThan(1)})@@ -300,11 +302,11 @@ describe('Chip', () => {const allActiveTexts = screen.getAllByText('Active')// The dropdown item should be the last oneconst dropdownItem = allActiveTexts[allActiveTexts.length - 1]- const parentContainer = dropdownItem.parentElement+ const parentContainer = dropdownItem!.parentElement// The check icon should be a sibling within the parentconst checkIcon = parentContainer?.querySelector('svg')- expect(checkIcon).toBeInTheDocument()+ expect(checkIcon)!.toBeInTheDocument()})it('should render all items in dropdown when open', () => {@@ -326,14 +328,14 @@ describe('Chip', () => {// Trigger should still renderconst trigger = container.querySelector('[data-state]')- expect(trigger).toBeInTheDocument()+ expect(trigger)!.toBeInTheDocument()})it('should handle value not in items list', () => {const { container } = renderChip({ value: 'nonexistent' })const trigger = getTrigger(container)- expect(trigger).toBeInTheDocument()+ expect(trigger)!.toBeInTheDocument()// The trigger should not display any item name textexpect(trigger?.textContent?.trim()).toBeFalsy()@@ -346,7 +348,7 @@ describe('Chip', () => {// Click on the already selected item in the dropdownconst activeItems = screen.getAllByText('Active')- fireEvent.click(activeItems[activeItems.length - 1])+ fireEvent.click(activeItems[activeItems.length - 1]!)expect(onSelect).toHaveBeenCalledTimes(1)expect(onSelect).toHaveBeenCalledWith(items[1])@@ -361,13 +363,13 @@ describe('Chip', () => {const { container } = renderChip({ value: 2, items: numericItems })- expect(screen.getByText('Second')).toBeInTheDocument()+ expect(screen.getByText('Second'))!.toBeInTheDocument()// Open panel and select ThirdopenPanel(container)const thirdItems = screen.getAllByText('Third')- fireEvent.click(thirdItems[thirdItems.length - 1])+ fireEvent.click(thirdItems[thirdItems.length - 1]!)expect(onSelect).toHaveBeenCalledWith(numericItems[2])})@@ -380,13 +382,13 @@ describe('Chip', () => {const { container } = renderChip({ value: 'a', items: itemsWithExtra })- expect(screen.getByText('Item A')).toBeInTheDocument()+ expect(screen.getByText('Item A'))!.toBeInTheDocument()// Open panel and select Item BopenPanel(container)const itemBs = screen.getAllByText('Item B')- fireEvent.click(itemBs[itemBs.length - 1])+ fireEvent.click(itemBs[itemBs.length - 1]!)expect(onSelect).toHaveBeenCalledWith(itemsWithExtra[1])})diff --git a/web/app/components/base/date-and-time-picker/calendar/__tests__/index.spec.tsx b/web/app/components/base/date-and-time-picker/calendar/__tests__/index.spec.tsxindex 8839798c15e..c747d15be0e 100644--- a/web/app/components/base/date-and-time-picker/calendar/__tests__/index.spec.tsx+++ b/web/app/components/base/date-and-time-picker/calendar/__tests__/index.spec.tsx@@ -56,7 +56,7 @@ describe('Calendar', () => {// Verify the component renders successfully with wrapperClassNameconst dayLabels = screen.getAllByText(/daysInWeek/)expect(dayLabels).toHaveLength(7)- expect(container.firstChild).toHaveClass('custom-class')+ expect(container.firstChild)!.toHaveClass('custom-class')})})@@ -69,10 +69,10 @@ describe('Calendar', () => {render(<Calendar {...props} />)const dayButtons = screen.getAllByRole('button')- fireEvent.click(dayButtons[1])+ fireEvent.click(dayButtons[1]!)expect(onDateClick).toHaveBeenCalledTimes(1)- expect(onDateClick).toHaveBeenCalledWith(days[1].date)+ expect(onDateClick).toHaveBeenCalledWith(days[1]!.date)})})@@ -87,7 +87,7 @@ describe('Calendar', () => {render(<Calendar {...props} />)const dayButtons = screen.getAllByRole('button')- fireEvent.click(dayButtons[0])+ fireEvent.click(dayButtons[0]!)expect(onDateClick).not.toHaveBeenCalled()})diff --git a/web/app/components/base/date-and-time-picker/date-picker/__tests__/header.spec.tsx b/web/app/components/base/date-and-time-picker/date-picker/__tests__/header.spec.tsxindex dedb2ef68d1..ce30157ae6c 100644--- a/web/app/components/base/date-and-time-picker/date-picker/__tests__/header.spec.tsx+++ b/web/app/components/base/date-and-time-picker/date-picker/__tests__/header.spec.tsx@@ -24,7 +24,8 @@ describe('DatePicker Header', () => {render(<Header {...props} />)// The useMonths hook returns translated keys; check for year- expect(screen.getByText(/2024/)).toBeInTheDocument()+ // The useMonths hook returns translated keys; check for year+ expect(screen.getByText(/2024/))!.toBeInTheDocument()})it('should render navigation buttons', () => {@@ -46,7 +47,7 @@ describe('DatePicker Header', () => {// First button is the month/year displayconst buttons = screen.getAllByRole('button')- fireEvent.click(buttons[0])+ fireEvent.click(buttons[0]!)expect(handleOpenYearMonthPicker).toHaveBeenCalledTimes(1)})@@ -58,7 +59,7 @@ describe('DatePicker Header', () => {// Second button is prev monthconst buttons = screen.getAllByRole('button')- fireEvent.click(buttons[1])+ fireEvent.click(buttons[1]!)expect(onClickPrevMonth).toHaveBeenCalledTimes(1)})@@ -70,7 +71,7 @@ describe('DatePicker Header', () => {// Third button is next monthconst buttons = screen.getAllByRole('button')- fireEvent.click(buttons[2])+ fireEvent.click(buttons[2]!)expect(onClickNextMonth).toHaveBeenCalledTimes(1)})diff --git a/web/app/components/base/date-and-time-picker/date-picker/__tests__/index.spec.tsx b/web/app/components/base/date-and-time-picker/date-picker/__tests__/index.spec.tsxindex f324af37c18..ea4f1bb928a 100644--- a/web/app/components/base/date-and-time-picker/date-picker/__tests__/index.spec.tsx+++ b/web/app/components/base/date-and-time-picker/date-picker/__tests__/index.spec.tsx@@ -33,14 +33,14 @@ describe('DatePicker', () => {const props = createDatePickerProps()render(<DatePicker {...props} />)- expect(screen.getByRole('textbox')).toBeInTheDocument()+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})it('should render with custom placeholder', () => {const props = createDatePickerProps({ placeholder: 'Select date' })render(<DatePicker {...props} />)- expect(screen.getByRole('textbox')).toHaveAttribute('placeholder', 'Select date')+ expect(screen.getByRole('textbox'))!.toHaveAttribute('placeholder', 'Select date')})it('should display formatted date value when value is provided', () => {@@ -55,7 +55,7 @@ describe('DatePicker', () => {const props = createDatePickerProps()render(<DatePicker {...props} />)- expect(screen.getByRole('textbox')).toHaveValue('')+ expect(screen.getByRole('textbox'))!.toHaveValue('')})it('should normalize value with timezone applied', () => {@@ -93,7 +93,7 @@ describe('DatePicker', () => {openPicker()openPicker() // second click closes- expect(screen.getByRole('textbox')).toBeInTheDocument()+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})it('should restore selected date from value when reopening', () => {@@ -104,7 +104,8 @@ describe('DatePicker', () => {openPicker()// Calendar should be showing June 2024- expect(screen.getByText(/2024/)).toBeInTheDocument()+ // Calendar should be showing June 2024+ expect(screen.getByText(/2024/))!.toBeInTheDocument()})it('should close when clicking outside the container', () => {@@ -119,7 +120,8 @@ describe('DatePicker', () => {})// The picker should now be closed - input shows its value- expect(screen.getByRole('textbox')).toBeInTheDocument()+ // The picker should now be closed - input shows its value+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})})@@ -131,7 +133,7 @@ describe('DatePicker', () => {openPicker()- expect(screen.getByText('--:-- --')).toBeInTheDocument()+ expect(screen.getByText('--:-- --'))!.toBeInTheDocument()})it('should not show time toggle when needTimePicker is false', () => {@@ -153,7 +155,8 @@ describe('DatePicker', () => {fireEvent.click(screen.getByText('--:-- --'))// In time view, the "pickDate" text should appear instead of the time- expect(screen.getByText(/operation\.pickDate/)).toBeInTheDocument()+ // In time view, the "pickDate" text should appear instead of the time+ expect(screen.getByText(/operation\.pickDate/))!.toBeInTheDocument()})it('should switch back to date view when pickDate is clicked in time view', () => {@@ -181,8 +184,9 @@ describe('DatePicker', () => {fireEvent.click(screen.getByText(/\d{2}:\d{2}\s(AM|PM)/))// Should show AM/PM options (TimePickerOptions renders these)- expect(screen.getByText('AM')).toBeInTheDocument()- expect(screen.getByText('PM')).toBeInTheDocument()+ // Should show AM/PM options (TimePickerOptions renders these)+ expect(screen.getByText('AM'))!.toBeInTheDocument()+ expect(screen.getByText('PM'))!.toBeInTheDocument()})it('should update selected time when hour is selected in time view', () => {@@ -196,11 +200,12 @@ describe('DatePicker', () => {// Click hour "05" from the time optionsconst allLists = screen.getAllByRole('list')- const hourItems = within(allLists[0]).getAllByRole('listitem')- fireEvent.click(hourItems[4])+ const hourItems = within(allLists[0]!).getAllByRole('listitem')+ fireEvent.click(hourItems[4]!)// The picker should still be in time view- expect(screen.getByText(/operation\.pickDate/)).toBeInTheDocument()+ // The picker should still be in time view+ expect(screen.getByText(/operation\.pickDate/))!.toBeInTheDocument()})it('should update selected time when minute is selected in time view', () => {@@ -214,10 +219,10 @@ describe('DatePicker', () => {// Click minute "45" from the time optionsconst allLists = screen.getAllByRole('list')- const minuteItems = within(allLists[1]).getAllByRole('listitem')- fireEvent.click(minuteItems[45])+ const minuteItems = within(allLists[1]!).getAllByRole('listitem')+ fireEvent.click(minuteItems[45]!)- expect(screen.getByText(/operation\.pickDate/)).toBeInTheDocument()+ expect(screen.getByText(/operation\.pickDate/))!.toBeInTheDocument()})it('should update selected time when period is changed in time view', () => {@@ -232,7 +237,7 @@ describe('DatePicker', () => {// Click AM to switch periodfireEvent.click(screen.getByText('AM'))- expect(screen.getByText(/operation\.pickDate/)).toBeInTheDocument()+ expect(screen.getByText(/operation\.pickDate/))!.toBeInTheDocument()})it('should update time when no selectedDate exists and hour is selected', () => {@@ -246,10 +251,10 @@ describe('DatePicker', () => {// Click hour "03" from the time optionsconst allLists = screen.getAllByRole('list')- const hourItems = within(allLists[0]).getAllByRole('listitem')- fireEvent.click(hourItems[2])+ const hourItems = within(allLists[0]!).getAllByRole('listitem')+ fireEvent.click(hourItems[2]!)- expect(screen.getByText(/operation\.pickDate/)).toBeInTheDocument()+ expect(screen.getByText(/operation\.pickDate/))!.toBeInTheDocument()})it('should update time when no selectedDate exists and minute is selected', () => {@@ -260,10 +265,10 @@ describe('DatePicker', () => {fireEvent.click(screen.getByText('--:-- --'))const allLists = screen.getAllByRole('list')- const minuteItems = within(allLists[1]).getAllByRole('listitem')- fireEvent.click(minuteItems[15])+ const minuteItems = within(allLists[1]!).getAllByRole('listitem')+ fireEvent.click(minuteItems[15]!)- expect(screen.getByText(/operation\.pickDate/)).toBeInTheDocument()+ expect(screen.getByText(/operation\.pickDate/))!.toBeInTheDocument()})it('should update time when no selectedDate exists and period is selected', () => {@@ -274,7 +279,7 @@ describe('DatePicker', () => {fireEvent.click(screen.getByText('--:-- --'))fireEvent.click(screen.getByText('PM'))- expect(screen.getByText(/operation\.pickDate/)).toBeInTheDocument()+ expect(screen.getByText(/operation\.pickDate/))!.toBeInTheDocument()})})@@ -314,7 +319,8 @@ describe('DatePicker', () => {fireEvent.click(dayButton)// The date should now appear in the header/display- expect(screen.getByRole('textbox')).toBeInTheDocument()+ // The date should now appear in the header/display+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})it('should immediately confirm when noConfirm is true and a date is clicked', () => {@@ -420,7 +426,7 @@ describe('DatePicker', () => {// The header has: month/year button, prev button, next button// Then calendar days are also buttons. We need the 3rd button (next month).// Header buttons come first in DOM order.- fireEvent.click(allButtons[2]) // next month button+ fireEvent.click(allButtons[2]!) // next month buttonexpect(screen.getAllByRole('button').length).toBeGreaterThan(0)})@@ -432,7 +438,7 @@ describe('DatePicker', () => {openPicker()const allButtons = screen.getAllByRole('button')- fireEvent.click(allButtons[1]) // prev month button+ fireEvent.click(allButtons[1]!) // prev month buttonexpect(screen.getAllByRole('button').length).toBeGreaterThan(0)})@@ -450,7 +456,8 @@ describe('DatePicker', () => {fireEvent.click(headerButton)// Cancel button visible in year/month picker footer- expect(screen.getByText(/operation\.cancel/)).toBeInTheDocument()+ // Cancel button visible in year/month picker footer+ expect(screen.getByText(/operation\.cancel/))!.toBeInTheDocument()})it('should close year/month picker when cancel is clicked', () => {@@ -479,7 +486,7 @@ describe('DatePicker', () => {// Confirm - click the last OK button (year/month footer)const okButtons = screen.getAllByText(/operation\.ok/)- fireEvent.click(okButtons[okButtons.length - 1])+ fireEvent.click(okButtons[okButtons.length - 1]!)// Should return to date viewexpect(screen.getAllByText(/daysInWeek/).length).toBeGreaterThan(0)@@ -496,7 +503,7 @@ describe('DatePicker', () => {// The header in year/month view shows selected month/year with an up arrow// Clicking it closes the year/month pickerconst headerButtons = screen.getAllByRole('button')- fireEvent.click(headerButtons[0]) // First button in year/month view is the header+ fireEvent.click(headerButtons[0]!) // First button in year/month view is the header// Should return to date viewexpect(screen.getAllByText(/daysInWeek/).length).toBeGreaterThan(0)@@ -511,12 +518,12 @@ describe('DatePicker', () => {// Select a different month using RTL queriesconst allLists = screen.getAllByRole('list')- const monthItems = within(allLists[0]).getAllByRole('listitem')- fireEvent.click(monthItems[0])+ const monthItems = within(allLists[0]!).getAllByRole('listitem')+ fireEvent.click(monthItems[0]!)// Confirm the selection - click the last OK button (year/month footer)const okButtons = screen.getAllByText(/operation\.ok/)- fireEvent.click(okButtons[okButtons.length - 1])+ fireEvent.click(okButtons[okButtons.length - 1]!)// Should return to date viewexpect(screen.getAllByText(/daysInWeek/).length).toBeGreaterThan(0)@@ -547,7 +554,7 @@ describe('DatePicker', () => {const props = createDatePickerProps({ renderTrigger })render(<DatePicker {...props} />)- expect(screen.getByTestId('custom-trigger')).toBeInTheDocument()+ expect(screen.getByTestId('custom-trigger'))!.toBeInTheDocument()})it('should open picker when custom trigger is clicked', () => {@@ -591,7 +598,7 @@ describe('DatePicker', () => {})render(<DatePicker {...props} />)- expect(screen.getByRole('textbox')).toBeInTheDocument()+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})it('should call onChange when timezone changes with a value', () => {@@ -639,7 +646,7 @@ describe('DatePicker', () => {// Should have been called with the new timezone-adjusted valueexpect(onChange).toHaveBeenCalledTimes(1)- const emitted = onChange.mock.calls[0][0]+ const emitted = onChange.mock.calls[0]![0]expect(emitted.isValid()).toBe(true)})@@ -656,7 +663,7 @@ describe('DatePicker', () => {rerender(<DatePicker {...props} timezone="Asia/Tokyo" />)expect(onChange).toHaveBeenCalledTimes(1)- expect(screen.getByRole('textbox')).toBeInTheDocument()+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})})@@ -670,7 +677,8 @@ describe('DatePicker', () => {openPicker()// The footer should show the time from selectedDate (02:30 PM)- expect(screen.getByText(/\d{2}:\d{2}\s(AM|PM)/)).toBeInTheDocument()+ // The footer should show the time from selectedDate (02:30 PM)+ expect(screen.getByText(/\d{2}:\d{2}\s(AM|PM)/))!.toBeInTheDocument()})})})diff --git a/web/app/components/base/date-and-time-picker/time-picker/__tests__/index.spec.tsx b/web/app/components/base/date-and-time-picker/time-picker/__tests__/index.spec.tsxindex 199ed4ee411..7fbed3a736d 100644--- a/web/app/components/base/date-and-time-picker/time-picker/__tests__/index.spec.tsx+++ b/web/app/components/base/date-and-time-picker/time-picker/__tests__/index.spec.tsx@@ -28,7 +28,7 @@ describe('TimePicker', () => {/>,)- expect(screen.getByDisplayValue('06:45 PM')).toBeInTheDocument()+ expect(screen.getByDisplayValue('06:45 PM'))!.toBeInTheDocument()})it('confirms cleared value when confirming without selection', () => {@@ -71,7 +71,7 @@ describe('TimePicker', () => {fireEvent.click(nowButton)expect(onChange).toHaveBeenCalledTimes(1)- const emitted = onChange.mock.calls[0][0]+ const emitted = onChange.mock.calls[0]![0]expect(isDayjsObject(emitted)).toBe(true)expect(emitted?.utcOffset()).toBe(dayjs().tz('America/New_York').utcOffset())})@@ -82,7 +82,7 @@ describe('TimePicker', () => {render(<TimePicker {...baseProps} />)const input = screen.getByRole('textbox')- expect(input).toHaveAttribute('placeholder', expect.stringMatching(/defaultPlaceholder/i))+ expect(input)!.toHaveAttribute('placeholder', expect.stringMatching(/defaultPlaceholder/i))})it('should toggle open state when trigger is clicked', () => {@@ -91,11 +91,11 @@ describe('TimePicker', () => {const input = screen.getByRole('textbox')// OpenfireEvent.click(input)- expect(input).toHaveValue('')+ expect(input)!.toHaveValue('')// Close by clicking againfireEvent.click(input)- expect(input).toHaveValue('10:00 AM')+ expect(input)!.toHaveValue('10:00 AM')})it('should handle document mousedown listener while picker is open', () => {@@ -103,10 +103,10 @@ describe('TimePicker', () => {const input = screen.getByRole('textbox')fireEvent.click(input)- expect(input).toHaveValue('')+ expect(input)!.toHaveValue('')fireEvent.mouseDown(document.body)- expect(input).toHaveValue('')+ expect(input)!.toHaveValue('')})it('should call onClear when clear is clicked while picker is closed', () => {@@ -166,7 +166,7 @@ describe('TimePicker', () => {fireEvent.click(confirmButton)expect(onChange).toHaveBeenCalledTimes(1)- const emitted = onChange.mock.calls[0][0]+ const emitted = onChange.mock.calls[0]![0]expect(isDayjsObject(emitted)).toBe(true)expect(emitted.hour()).toBe(10)expect(emitted.minute()).toBe(0)@@ -202,7 +202,7 @@ describe('TimePicker', () => {fireEvent.click(confirmButton)expect(onChange).toHaveBeenCalledTimes(1)- const emitted = onChange.mock.calls[0][0]+ const emitted = onChange.mock.calls[0]![0]expect(isDayjsObject(emitted)).toBe(true)// Resynced from value prop: dayjs('2024-01-01T10:30:00Z') in UTC = 10:30 AMexpect(emitted.hour()).toBe(10)@@ -221,7 +221,7 @@ describe('TimePicker', () => {)const input = screen.getByRole('textbox')- expect(input).toHaveAttribute('placeholder', 'Select time')+ expect(input)!.toHaveAttribute('placeholder', 'Select time')})it('should render with triggerFullWidth prop without errors', () => {@@ -233,7 +233,8 @@ describe('TimePicker', () => {)// Verify the component renders successfully with triggerFullWidth- expect(screen.getByRole('textbox')).toBeInTheDocument()+ // Verify the component renders successfully with triggerFullWidth+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})it('should use renderTrigger when provided', () => {@@ -250,7 +251,7 @@ describe('TimePicker', () => {/>,)- expect(screen.getByTestId('custom-trigger')).toBeInTheDocument()+ expect(screen.getByTestId('custom-trigger'))!.toBeInTheDocument()expect(renderTrigger).toHaveBeenCalled()})@@ -265,7 +266,8 @@ describe('TimePicker', () => {)// In test env the icon stays in DOM, but must remain hidden when notClearable is set- expect(screen.getByRole('button', { name: /clear/i })).toHaveClass('hidden')+ // In test env the icon stays in DOM, but must remain hidden when notClearable is set+ expect(screen.getByRole('button', { name: /clear/i }))!.toHaveClass('hidden')})})@@ -289,7 +291,7 @@ describe('TimePicker', () => {fireEvent.click(confirmButton)expect(onChange).toHaveBeenCalledTimes(1)- const emitted = onChange.mock.calls[0][0]+ const emitted = onChange.mock.calls[0]![0]expect(isDayjsObject(emitted)).toBe(true)expect(emitted.hour()).toBe(10)expect(emitted.minute()).toBe(30)@@ -343,7 +345,7 @@ describe('TimePicker', () => {fireEvent.click(confirmButton)expect(onChange).toHaveBeenCalledTimes(1)- const emitted = onChange.mock.calls[0][0]+ const emitted = onChange.mock.calls[0]![0]expect(isDayjsObject(emitted)).toBe(true)// Hour 05 in AM (since original was 10:30 AM) = 5expect(emitted.hour()).toBe(5)@@ -371,7 +373,7 @@ describe('TimePicker', () => {fireEvent.click(confirmButton)expect(onChange).toHaveBeenCalledTimes(1)- const emitted = onChange.mock.calls[0][0]+ const emitted = onChange.mock.calls[0]![0]expect(emitted.minute()).toBe(45)})@@ -396,7 +398,7 @@ describe('TimePicker', () => {fireEvent.click(confirmButton)expect(onChange).toHaveBeenCalledTimes(1)- const emitted = onChange.mock.calls[0][0]+ const emitted = onChange.mock.calls[0]![0]// Original was 10:30 AM, switching to PM makes it 22:30expect(emitted.hour()).toBe(22)})@@ -422,7 +424,7 @@ describe('TimePicker', () => {fireEvent.click(confirmButton)expect(onChange).toHaveBeenCalledTimes(1)- const emitted = onChange.mock.calls[0][0]+ const emitted = onChange.mock.calls[0]![0]expect(isDayjsObject(emitted)).toBe(true)expect(emitted.hour()).toBe(3)})@@ -448,7 +450,7 @@ describe('TimePicker', () => {fireEvent.click(confirmButton)expect(onChange).toHaveBeenCalledTimes(1)- const emitted = onChange.mock.calls[0][0]+ const emitted = onChange.mock.calls[0]![0]expect(emitted.minute()).toBe(15)})@@ -472,7 +474,7 @@ describe('TimePicker', () => {fireEvent.click(confirmButton)expect(onChange).toHaveBeenCalledTimes(1)- const emitted = onChange.mock.calls[0][0]+ const emitted = onChange.mock.calls[0]![0]expect(isDayjsObject(emitted)).toBe(true)expect(emitted.hour()).toBeGreaterThanOrEqual(12)})@@ -491,7 +493,7 @@ describe('TimePicker', () => {fireEvent.click(confirmButton)expect(onChange).toHaveBeenCalledTimes(1)- const emitted = onChange.mock.calls[0][0]+ const emitted = onChange.mock.calls[0]![0]expect(emitted.hour()).toBe(3)})})@@ -523,7 +525,7 @@ describe('TimePicker', () => {expect(onChangeA).not.toHaveBeenCalled()expect(onChangeB).not.toHaveBeenCalled()- expect(screen.getByDisplayValue('10:30 AM')).toBeInTheDocument()+ expect(screen.getByDisplayValue('10:30 AM'))!.toBeInTheDocument()})it('should safely return when value changes to an unparsable time string', () => {@@ -548,7 +550,7 @@ describe('TimePicker', () => {)expect(onChange).not.toHaveBeenCalled()- expect(screen.getByRole('textbox')).toHaveValue('')+ expect(screen.getByRole('textbox'))!.toHaveValue('')})it('should call onChange when timezone changes with an existing value', () => {@@ -574,7 +576,7 @@ describe('TimePicker', () => {)expect(onChange).toHaveBeenCalledTimes(1)- const emitted = onChange.mock.calls[0][0]+ const emitted = onChange.mock.calls[0]![0]expect(isDayjsObject(emitted)).toBe(true)// 10:30 UTC converted to America/New_York (UTC-5 in Jan) = 05:30expect(emitted.utcOffset()).toBe(dayjs.tz('2024-01-01', 'America/New_York').utcOffset())@@ -607,7 +609,8 @@ describe('TimePicker', () => {expect(onChange).not.toHaveBeenCalled()// But the display should update- expect(screen.getByDisplayValue('02:00 PM')).toBeInTheDocument()+ // But the display should update+ expect(screen.getByDisplayValue('02:00 PM'))!.toBeInTheDocument()})it('should handle timezone change when value is undefined', () => {@@ -653,7 +656,8 @@ describe('TimePicker', () => {/>,)// Input should be empty now- expect(screen.getByRole('textbox')).toHaveValue('')+ // Input should be empty now+ expect(screen.getByRole('textbox'))!.toHaveValue('')// onChange should not fire when value is undefined, even if selectedTime was setexpect(onChange).not.toHaveBeenCalled()})@@ -682,7 +686,7 @@ describe('TimePicker', () => {fireEvent.click(screen.getByRole('button', { name: /operation\.ok/i }))expect(onChange).toHaveBeenCalledTimes(1)- const emitted = onChange.mock.calls[0][0]+ const emitted = onChange.mock.calls[0]![0]expect(isDayjsObject(emitted)).toBe(true)expect(emitted.hour()).toBe(10)expect(emitted.minute()).toBe(30)@@ -738,7 +742,8 @@ describe('TimePicker', () => {expect(onChange).not.toHaveBeenCalled()// 15:00 UTC in America/New_York (UTC-5) = 10:00 AM- expect(screen.getByDisplayValue('10:00 AM')).toBeInTheDocument()+ // 15:00 UTC in America/New_York (UTC-5) = 10:00 AM+ expect(screen.getByDisplayValue('10:00 AM'))!.toBeInTheDocument()})})@@ -747,7 +752,7 @@ describe('TimePicker', () => {it('should return empty string when value is undefined', () => {render(<TimePicker {...baseProps} />)- expect(screen.getByRole('textbox')).toHaveValue('')+ expect(screen.getByRole('textbox'))!.toHaveValue('')})it('should format dayjs value correctly', () => {@@ -759,7 +764,7 @@ describe('TimePicker', () => {/>,)- expect(screen.getByDisplayValue('02:30 PM')).toBeInTheDocument()+ expect(screen.getByDisplayValue('02:30 PM'))!.toBeInTheDocument()})it('should format string value correctly', () => {@@ -771,7 +776,7 @@ describe('TimePicker', () => {/>,)- expect(screen.getByDisplayValue('09:15 AM')).toBeInTheDocument()+ expect(screen.getByDisplayValue('09:15 AM'))!.toBeInTheDocument()})it('should return empty display value for an unparsable truthy string', () => {@@ -784,7 +789,7 @@ describe('TimePicker', () => {/>,)- expect(screen.getByRole('textbox')).toHaveValue('')+ expect(screen.getByRole('textbox'))!.toHaveValue('')})})@@ -825,8 +830,8 @@ describe('TimePicker', () => {)const timezoneLabel = screen.getByTitle(/Timezone: Asia\/Shanghai/)- expect(timezoneLabel).toBeInTheDocument()- expect(timezoneLabel).toHaveTextContent(/UTC[+-]\d+/)+ expect(timezoneLabel)!.toBeInTheDocument()+ expect(timezoneLabel)!.toHaveTextContent(/UTC[+-]\d+/)})it('should not display timezone label when showTimezone is true but timezone is not provided', () => {diff --git a/web/app/components/base/date-and-time-picker/time-picker/__tests__/options.spec.tsx b/web/app/components/base/date-and-time-picker/time-picker/__tests__/options.spec.tsxindex 9d945dcf2e7..d7fa3be7973 100644--- a/web/app/components/base/date-and-time-picker/time-picker/__tests__/options.spec.tsx+++ b/web/app/components/base/date-and-time-picker/time-picker/__tests__/options.spec.tsx@@ -43,8 +43,8 @@ describe('TimePickerOptions', () => {render(<Options {...props} />)- expect(screen.getByText('AM')).toBeInTheDocument()- expect(screen.getByText('PM')).toBeInTheDocument()+ expect(screen.getByText('AM'))!.toBeInTheDocument()+ expect(screen.getByText('PM'))!.toBeInTheDocument()})})@@ -65,13 +65,13 @@ describe('TimePickerOptions', () => {const props = createOptionsProps({ selectedTime: dayjs('2024-01-01 05:30:00') })render(<Options {...props} />)const selectedHour = screen.getAllByRole('listitem').find(item => item.textContent === '05')- expect(selectedHour).toHaveClass('bg-components-button-ghost-bg-hover')+ expect(selectedHour)!.toHaveClass('bg-components-button-ghost-bg-hover')})it('should render selected minute in the list', () => {const props = createOptionsProps({ selectedTime: dayjs('2024-01-01 05:30:00') })render(<Options {...props} />)const selectedMinute = screen.getAllByRole('listitem').find(item => item.textContent === '30')- expect(selectedMinute).toHaveClass('bg-components-button-ghost-bg-hover')+ expect(selectedMinute)!.toHaveClass('bg-components-button-ghost-bg-hover')})it('should call handleSelectPeriod when AM is clicked', () => {@@ -79,7 +79,7 @@ describe('TimePickerOptions', () => {const props = createOptionsProps({ handleSelectPeriod })render(<Options {...props} />)- fireEvent.click(screen.getAllByText('AM')[0])+ fireEvent.click(screen.getAllByText('AM')[0]!)expect(handleSelectPeriod).toHaveBeenCalledWith('AM')})@@ -89,7 +89,7 @@ describe('TimePickerOptions', () => {const props = createOptionsProps({ handleSelectPeriod })render(<Options {...props} />)- fireEvent.click(screen.getAllByText('PM')[0])+ fireEvent.click(screen.getAllByText('PM')[0]!)expect(handleSelectPeriod).toHaveBeenCalledWith('PM')})diff --git a/web/app/components/base/date-and-time-picker/utils/dayjs.ts b/web/app/components/base/date-and-time-picker/utils/dayjs.tsindex 3e20e51cf3d..ae5cb90701d 100644--- a/web/app/components/base/date-and-time-picker/utils/dayjs.ts+++ b/web/app/components/base/date-and-time-picker/utils/dayjs.ts@@ -116,8 +116,8 @@ export const convertTimezoneToOffsetStr = (timezone?: string) => {if (!offsetMatch)return DEFAULT_OFFSET_STR// Parse hours and minutes separately- const hours = Number.parseInt(offsetMatch[1], 10)- const minutes = Number.parseInt(offsetMatch[2], 10)+ const hours = Number.parseInt(offsetMatch[1]!, 10)+ const minutes = Number.parseInt(offsetMatch[2]!, 10)const sign = hours >= 0 ? '+' : ''// If minutes are non-zero, include them in the output (e.g., "UTC+5:30")// Otherwise, only show hours (e.g., "UTC+8")diff --git a/web/app/components/base/emoji-picker/__tests__/Inner.spec.tsx b/web/app/components/base/emoji-picker/__tests__/Inner.spec.tsxindex eac18dd48a4..f0cf3091d7f 100644--- a/web/app/components/base/emoji-picker/__tests__/Inner.spec.tsx+++ b/web/app/components/base/emoji-picker/__tests__/Inner.spec.tsx@@ -41,9 +41,9 @@ describe('EmojiPickerInner', () => {it('renders initial categories and emojis correctly', () => {render(<EmojiPickerInner onSelect={mockOnSelect} />)- expect(screen.getByText('nature')).toBeInTheDocument()- expect(screen.getByText('food')).toBeInTheDocument()- expect(screen.getByPlaceholderText('Search emojis...')).toBeInTheDocument()+ expect(screen.getByText('nature'))!.toBeInTheDocument()+ expect(screen.getByText('food'))!.toBeInTheDocument()+ expect(screen.getByPlaceholderText('Search emojis...'))!.toBeInTheDocument()})})@@ -57,7 +57,7 @@ describe('EmojiPickerInner', () => {})await waitFor(() => {- expect(screen.getByText('Search')).toBeInTheDocument()+ expect(screen.getByText('Search'))!.toBeInTheDocument()})const searchSection = screen.getByText('Search').parentElement@@ -69,7 +69,7 @@ describe('EmojiPickerInner', () => {const emojiContainers = screen.getAllByTestId(/^emoji-container-/)await act(async () => {- fireEvent.click(emojiContainers[0])+ fireEvent.click(emojiContainers[0]!)})expect(mockOnSelect).toHaveBeenCalledWith('rabbit', expect.any(String))@@ -81,13 +81,13 @@ describe('EmojiPickerInner', () => {expect(screen.queryByText('#FFEAD5')).not.toBeInTheDocument()const toggleButton = screen.getByTestId('toggle-colors')- expect(toggleButton).toBeInTheDocument()+ expect(toggleButton)!.toBeInTheDocument()await act(async () => {fireEvent.click(toggleButton!)})- expect(screen.getByText('Choose Style')).toBeInTheDocument()+ expect(screen.getByText('Choose Style'))!.toBeInTheDocument()const colorOptions = document.querySelectorAll('[style^="background:"]')expect(colorOptions.length).toBeGreaterThan(0)})@@ -102,14 +102,14 @@ describe('EmojiPickerInner', () => {const emojiContainers = screen.getAllByTestId(/^emoji-container-/)await act(async () => {- fireEvent.click(emojiContainers[0])+ fireEvent.click(emojiContainers[0]!)})mockOnSelect.mockClear()const colorOptions = document.querySelectorAll('[style^="background:"]')await act(async () => {- fireEvent.click(colorOptions[1].parentElement!)+ fireEvent.click(colorOptions[1]!.parentElement!)})expect(mockOnSelect).toHaveBeenCalledWith('rabbit', '#E4FBCC')@@ -127,7 +127,7 @@ describe('EmojiPickerInner', () => {const searchEmojis = screen.getAllByTestId(/^emoji-search-result-/)await act(async () => {- fireEvent.click(searchEmojis![0])+ fireEvent.click(searchEmojis![0]!)})expect(mockOnSelect).toHaveBeenCalledWith('dog', expect.any(String))@@ -141,7 +141,7 @@ describe('EmojiPickerInner', () => {await act(async () => {fireEvent.click(toggleButton!)})- expect(screen.getByText('Choose Style')).toBeInTheDocument()+ expect(screen.getByText('Choose Style'))!.toBeInTheDocument()await act(async () => {fireEvent.click(screen.getByTestId('toggle-colors')!) // It should be the other icon nowdiff --git a/web/app/components/base/emoji-picker/__tests__/index.spec.tsx b/web/app/components/base/emoji-picker/__tests__/index.spec.tsxindex 5eb6593213b..36b161b7c71 100644--- a/web/app/components/base/emoji-picker/__tests__/index.spec.tsx+++ b/web/app/components/base/emoji-picker/__tests__/index.spec.tsx@@ -46,9 +46,9 @@ describe('EmojiPicker', () => {<EmojiPicker isModal={true} />,)})- expect(screen.getByPlaceholderText('Search emojis...')).toBeInTheDocument()- expect(screen.getByText(/Cancel/i)).toBeInTheDocument()- expect(screen.getByText(/OK/i)).toBeInTheDocument()+ expect(screen.getByPlaceholderText('Search emojis...'))!.toBeInTheDocument()+ expect(screen.getByText(/Cancel/i))!.toBeInTheDocument()+ expect(screen.getByText(/OK/i))!.toBeInTheDocument()})it('OK button is disabled initially', async () => {@@ -58,7 +58,7 @@ describe('EmojiPicker', () => {)})const okButton = screen.getByText(/OK/i).closest('button')- expect(okButton).toBeDisabled()+ expect(okButton)!.toBeDisabled()})it('applies custom className to modal wrapper', async () => {@@ -69,7 +69,7 @@ describe('EmojiPicker', () => {)})const dialog = screen.getByRole('dialog')- expect(dialog).toHaveClass(customClass)+ expect(dialog)!.toHaveClass(customClass)})})@@ -84,7 +84,7 @@ describe('EmojiPicker', () => {const emojiWrappers = screen.getAllByTestId(/^emoji-container-/)expect(emojiWrappers.length).toBeGreaterThan(0)await act(async () => {- fireEvent.click(emojiWrappers[0])+ fireEvent.click(emojiWrappers[0]!)})const okButton = screen.getByText(/OK/i)diff --git a/web/app/components/base/features/new-feature-panel/annotation-reply/__tests__/use-annotation-config.spec.ts b/web/app/components/base/features/new-feature-panel/annotation-reply/__tests__/use-annotation-config.spec.tsindex 47caa70261b..14f6d68bdae 100644--- a/web/app/components/base/features/new-feature-panel/annotation-reply/__tests__/use-annotation-config.spec.ts+++ b/web/app/components/base/features/new-feature-panel/annotation-reply/__tests__/use-annotation-config.spec.ts@@ -101,7 +101,7 @@ describe('useAnnotationConfig', () => {})expect(setAnnotationConfig).toHaveBeenCalled()- const updatedConfig = setAnnotationConfig.mock.calls[0][0]+ const updatedConfig = setAnnotationConfig.mock.calls[0]![0]expect(updatedConfig.enabled).toBe(true)expect(updatedConfig.embedding_model.embedding_model_name).toBe('text-embedding-3-small')})@@ -123,7 +123,7 @@ describe('useAnnotationConfig', () => {})expect(setAnnotationConfig).toHaveBeenCalled()- const updatedConfig = setAnnotationConfig.mock.calls[0][0]+ const updatedConfig = setAnnotationConfig.mock.calls[0]![0]expect(updatedConfig.enabled).toBe(false)})@@ -158,7 +158,7 @@ describe('useAnnotationConfig', () => {})expect(setAnnotationConfig).toHaveBeenCalled()- const updatedConfig = setAnnotationConfig.mock.calls[0][0]+ const updatedConfig = setAnnotationConfig.mock.calls[0]![0]expect(updatedConfig.score_threshold).toBe(0.85)})@@ -178,7 +178,7 @@ describe('useAnnotationConfig', () => {})expect(setAnnotationConfig).toHaveBeenCalled()- const updatedConfig = setAnnotationConfig.mock.calls[0][0]+ const updatedConfig = setAnnotationConfig.mock.calls[0]![0]expect(updatedConfig.score_threshold).toBe(0.95)expect(updatedConfig.embedding_model.embedding_provider_name).toBe('cohere')})@@ -236,7 +236,7 @@ describe('useAnnotationConfig', () => {})expect(setAnnotationConfig).toHaveBeenCalled()- const updatedConfig = setAnnotationConfig.mock.calls[0][0]+ const updatedConfig = setAnnotationConfig.mock.calls[0]![0]expect(updatedConfig.enabled).toBe(true)expect(updatedConfig.score_threshold).toBeDefined()})diff --git a/web/app/components/base/features/new-feature-panel/conversation-opener/__tests__/index.spec.tsx b/web/app/components/base/features/new-feature-panel/conversation-opener/__tests__/index.spec.tsxindex b7ee5b39b2f..9e74a1d0df5 100644--- a/web/app/components/base/features/new-feature-panel/conversation-opener/__tests__/index.spec.tsx+++ b/web/app/components/base/features/new-feature-panel/conversation-opener/__tests__/index.spec.tsx@@ -43,19 +43,19 @@ describe('ConversationOpener', () => {it('should render the conversation opener title', () => {renderWithProvider()- expect(screen.getByText(/feature\.conversationOpener\.title/)).toBeInTheDocument()+ expect(screen.getByText(/feature\.conversationOpener\.title/))!.toBeInTheDocument()})it('should render description when not enabled', () => {renderWithProvider()- expect(screen.getByText(/feature\.conversationOpener\.description/)).toBeInTheDocument()+ expect(screen.getByText(/feature\.conversationOpener\.description/))!.toBeInTheDocument()})it('should render a switch toggle', () => {renderWithProvider()- expect(screen.getByRole('switch')).toBeInTheDocument()+ expect(screen.getByRole('switch'))!.toBeInTheDocument()})it('should call onChange when toggled', () => {@@ -72,7 +72,7 @@ describe('ConversationOpener', () => {opening: { enabled: true, opening_statement: 'Welcome to the app!' },})- expect(screen.getByText('Welcome to the app!')).toBeInTheDocument()+ expect(screen.getByText('Welcome to the app!'))!.toBeInTheDocument()})it('should show placeholder when enabled but no opening statement', () => {@@ -80,7 +80,7 @@ describe('ConversationOpener', () => {opening: { enabled: true, opening_statement: '' },})- expect(screen.getByText(/openingStatement\.placeholder/)).toBeInTheDocument()+ expect(screen.getByText(/openingStatement\.placeholder/))!.toBeInTheDocument()})it('should show edit button when hovering over enabled feature', () => {@@ -91,7 +91,7 @@ describe('ConversationOpener', () => {const card = screen.getByText(/feature\.conversationOpener\.title/).closest('[class]')!fireEvent.mouseEnter(card)- expect(screen.getByText(/openingStatement\.writeOpener/)).toBeInTheDocument()+ expect(screen.getByText(/openingStatement\.writeOpener/))!.toBeInTheDocument()})it('should open modal when edit button is clicked', () => {@@ -127,7 +127,7 @@ describe('ConversationOpener', () => {fireEvent.mouseEnter(card)fireEvent.click(screen.getByText(/openingStatement\.writeOpener/))- const modalCall = mockSetShowOpeningModal.mock.calls[0][0]+ const modalCall = mockSetShowOpeningModal.mock.calls[0]![0]expect(modalCall.payload).toBeDefined()expect(modalCall.onSaveCallback).toBeDefined()expect(modalCall.onCancelCallback).toBeDefined()@@ -143,7 +143,7 @@ describe('ConversationOpener', () => {fireEvent.mouseEnter(card)fireEvent.click(screen.getByText(/openingStatement\.writeOpener/))- const modalCall = mockSetShowOpeningModal.mock.calls[0][0]+ const modalCall = mockSetShowOpeningModal.mock.calls[0]![0]act(() => {modalCall.onSaveCallback({ enabled: true, opening_statement: 'Updated' })})@@ -161,7 +161,7 @@ describe('ConversationOpener', () => {fireEvent.mouseEnter(card)fireEvent.click(screen.getByText(/openingStatement\.writeOpener/))- const modalCall = mockSetShowOpeningModal.mock.calls[0][0]+ const modalCall = mockSetShowOpeningModal.mock.calls[0]![0]modalCall.onCancelCallback()expect(onChange).toHaveBeenCalled()@@ -173,18 +173,21 @@ describe('ConversationOpener', () => {})// Before hover, opening statement visible- expect(screen.getByText('Welcome!')).toBeInTheDocument()+ // Before hover, opening statement visible+ expect(screen.getByText('Welcome!'))!.toBeInTheDocument()const card = screen.getByText(/feature\.conversationOpener\.title/).closest('[class]')!fireEvent.mouseEnter(card)// After hover, button visible, statement hidden- expect(screen.getByText(/openingStatement\.writeOpener/)).toBeInTheDocument()+ // After hover, button visible, statement hidden+ expect(screen.getByText(/openingStatement\.writeOpener/))!.toBeInTheDocument()fireEvent.mouseLeave(card)// After leave, statement visible again- expect(screen.getByText('Welcome!')).toBeInTheDocument()+ // After leave, statement visible again+ expect(screen.getByText('Welcome!'))!.toBeInTheDocument()})it('should return early from opener handler when disabled and hovered', () => {@@ -208,7 +211,7 @@ describe('ConversationOpener', () => {fireEvent.mouseEnter(card)fireEvent.click(screen.getByText(/openingStatement\.writeOpener/))- const modalCall = mockSetShowOpeningModal.mock.calls[0][0]+ const modalCall = mockSetShowOpeningModal.mock.calls[0]![0]act(() => {modalCall.onSaveCallback({ enabled: true, opening_statement: 'Updated without callback' })modalCall.onCancelCallback()@@ -221,6 +224,6 @@ describe('ConversationOpener', () => {renderWithProvider()fireEvent.click(screen.getByRole('switch'))- expect(screen.getByRole('switch')).toBeInTheDocument()+ expect(screen.getByRole('switch'))!.toBeInTheDocument()})})diff --git a/web/app/components/base/features/new-feature-panel/file-upload/__tests__/setting-modal.spec.tsx b/web/app/components/base/features/new-feature-panel/file-upload/__tests__/setting-modal.spec.tsxindex afa690f31a5..dc111a680bb 100644--- a/web/app/components/base/features/new-feature-panel/file-upload/__tests__/setting-modal.spec.tsx+++ b/web/app/components/base/features/new-feature-panel/file-upload/__tests__/setting-modal.spec.tsx@@ -46,7 +46,7 @@ describe('FileUploadSettings (setting-modal)', () => {</FileUploadSettings>,)- expect(screen.getByText('Upload Settings')).toBeInTheDocument()+ expect(screen.getByText('Upload Settings'))!.toBeInTheDocument()})it('should render SettingContent in portal', async () => {@@ -57,7 +57,7 @@ describe('FileUploadSettings (setting-modal)', () => {)await waitFor(() => {- expect(screen.getByText(/feature\.fileUpload\.modalTitle/)).toBeInTheDocument()+ expect(screen.getByText(/feature\.fileUpload\.modalTitle/))!.toBeInTheDocument()})})@@ -73,7 +73,7 @@ describe('FileUploadSettings (setting-modal)', () => {expect(onOpen).toHaveBeenCalled()// The toggle function should flip the open state- const toggleFn = onOpen.mock.calls[0][0]+ const toggleFn = onOpen.mock.calls[0]![0]expect(typeof toggleFn).toBe('function')expect(toggleFn(false)).toBe(true)expect(toggleFn(true)).toBe(false)@@ -101,7 +101,7 @@ describe('FileUploadSettings (setting-modal)', () => {)await waitFor(() => {- expect(screen.getByText(/operation\.cancel/)).toBeInTheDocument()+ expect(screen.getByText(/operation\.cancel/))!.toBeInTheDocument()})fireEvent.click(screen.getByRole('button', { name: /operation\.cancel/ }))@@ -118,7 +118,7 @@ describe('FileUploadSettings (setting-modal)', () => {)await waitFor(() => {- expect(screen.getByText(/operation\.save/)).toBeInTheDocument()+ expect(screen.getByText(/operation\.save/))!.toBeInTheDocument()})fireEvent.click(screen.getByRole('button', { name: /operation\.save/ }))@@ -134,7 +134,7 @@ describe('FileUploadSettings (setting-modal)', () => {)await waitFor(() => {- expect(screen.getByText(/feature\.imageUpload\.modalTitle/)).toBeInTheDocument()+ expect(screen.getByText(/feature\.imageUpload\.modalTitle/))!.toBeInTheDocument()})})})diff --git a/web/app/components/base/features/new-feature-panel/moderation/__tests__/index.spec.tsx b/web/app/components/base/features/new-feature-panel/moderation/__tests__/index.spec.tsxindex 994213c779d..b5fb6c00435 100644--- a/web/app/components/base/features/new-feature-panel/moderation/__tests__/index.spec.tsx+++ b/web/app/components/base/features/new-feature-panel/moderation/__tests__/index.spec.tsx@@ -56,19 +56,19 @@ describe('Moderation', () => {it('should render the moderation title', () => {renderWithProvider()- expect(screen.getByText(/feature\.moderation\.title/)).toBeInTheDocument()+ expect(screen.getByText(/feature\.moderation\.title/))!.toBeInTheDocument()})it('should render description when not enabled', () => {renderWithProvider()- expect(screen.getByText(/feature\.moderation\.description/)).toBeInTheDocument()+ expect(screen.getByText(/feature\.moderation\.description/))!.toBeInTheDocument()})it('should render a switch toggle', () => {renderWithProvider()- expect(screen.getByRole('switch')).toBeInTheDocument()+ expect(screen.getByRole('switch'))!.toBeInTheDocument()})it('should open moderation setting modal when enabled without type', () => {@@ -91,7 +91,7 @@ describe('Moderation', () => {},})- expect(screen.getByText(/feature\.moderation\.modal\.provider\.openai/)).toBeInTheDocument()+ expect(screen.getByText(/feature\.moderation\.modal\.provider\.openai/))!.toBeInTheDocument()})it('should show provider info when enabled with keywords type', () => {@@ -106,7 +106,7 @@ describe('Moderation', () => {},})- expect(screen.getByText(/feature\.moderation\.modal\.provider\.keywords/)).toBeInTheDocument()+ expect(screen.getByText(/feature\.moderation\.modal\.provider\.keywords/))!.toBeInTheDocument()})it('should show allEnabled when both inputs and outputs are enabled', () => {@@ -121,7 +121,7 @@ describe('Moderation', () => {},})- expect(screen.getByText(/feature\.moderation\.allEnabled/)).toBeInTheDocument()+ expect(screen.getByText(/feature\.moderation\.allEnabled/))!.toBeInTheDocument()})it('should show inputEnabled when only inputs are enabled', () => {@@ -136,7 +136,7 @@ describe('Moderation', () => {},})- expect(screen.getByText(/feature\.moderation\.inputEnabled/)).toBeInTheDocument()+ expect(screen.getByText(/feature\.moderation\.inputEnabled/))!.toBeInTheDocument()})it('should show outputEnabled when only outputs are enabled', () => {@@ -151,7 +151,7 @@ describe('Moderation', () => {},})- expect(screen.getByText(/feature\.moderation\.outputEnabled/)).toBeInTheDocument()+ expect(screen.getByText(/feature\.moderation\.outputEnabled/))!.toBeInTheDocument()})it('should show settings button when hovering over enabled feature', () => {@@ -168,7 +168,7 @@ describe('Moderation', () => {const card = screen.getByText(/feature\.moderation\.title/).closest('[class]')!fireEvent.mouseEnter(card)- expect(screen.getByText(/operation\.settings/)).toBeInTheDocument()+ expect(screen.getByText(/operation\.settings/))!.toBeInTheDocument()})it('should open moderation modal when settings button is clicked', () => {@@ -218,7 +218,7 @@ describe('Moderation', () => {},})- expect(screen.getByText(/apiBasedExtension\.selector\.title/)).toBeInTheDocument()+ expect(screen.getByText(/apiBasedExtension\.selector\.title/))!.toBeInTheDocument()})it('should disable moderation and call onChange when switch is toggled off', () => {@@ -260,7 +260,7 @@ describe('Moderation', () => {fireEvent.click(screen.getByRole('switch'))// Extract the onSaveCallback from the modal call- const modalCall = mockSetShowModerationSettingModal.mock.calls[0][0]+ const modalCall = mockSetShowModerationSettingModal.mock.calls[0]![0]expect(modalCall.onSaveCallback).toBeDefined()expect(modalCall.onCancelCallback).toBeDefined()})@@ -281,7 +281,7 @@ describe('Moderation', () => {fireEvent.mouseEnter(card)fireEvent.click(screen.getByText(/operation\.settings/))- const modalCall = mockSetShowModerationSettingModal.mock.calls[0][0]+ const modalCall = mockSetShowModerationSettingModal.mock.calls[0]![0]modalCall.onCancelCallback()expect(onChange).toHaveBeenCalled()@@ -302,7 +302,7 @@ describe('Moderation', () => {fireEvent.mouseEnter(card)fireEvent.click(screen.getByText(/operation\.settings/))- const modalCall = mockSetShowModerationSettingModal.mock.calls[0][0]+ const modalCall = mockSetShowModerationSettingModal.mock.calls[0]![0]expect(() => modalCall.onCancelCallback()).not.toThrow()})@@ -322,7 +322,7 @@ describe('Moderation', () => {fireEvent.mouseEnter(card)fireEvent.click(screen.getByText(/operation\.settings/))- const modalCall = mockSetShowModerationSettingModal.mock.calls[0][0]+ const modalCall = mockSetShowModerationSettingModal.mock.calls[0]![0]modalCall.onSaveCallback({ enabled: true, type: 'keywords', config: {} })expect(onChange).toHaveBeenCalled()@@ -343,7 +343,7 @@ describe('Moderation', () => {fireEvent.mouseEnter(card)fireEvent.click(screen.getByText(/operation\.settings/))- const modalCall = mockSetShowModerationSettingModal.mock.calls[0][0]+ const modalCall = mockSetShowModerationSettingModal.mock.calls[0]![0]expect(() => modalCall.onSaveCallback({ enabled: true, type: 'keywords', config: {} })).not.toThrow()})@@ -359,7 +359,8 @@ describe('Moderation', () => {})// For unknown types, falls back to codeBasedExtensionList label or '-'- expect(screen.getByText('-')).toBeInTheDocument()+ // For unknown types, falls back to codeBasedExtensionList label or '-'+ expect(screen.getByText('-'))!.toBeInTheDocument()})it('should show code-based extension label when custom type is configured', () => {@@ -379,7 +380,7 @@ describe('Moderation', () => {},})- expect(screen.getByText('Custom Moderation')).toBeInTheDocument()+ expect(screen.getByText('Custom Moderation'))!.toBeInTheDocument()})it('should not show enable content text when both input and output moderation are disabled', () => {@@ -422,7 +423,7 @@ describe('Moderation', () => {fireEvent.click(screen.getByRole('switch'))- const modalCall = mockSetShowModerationSettingModal.mock.calls[0][0]+ const modalCall = mockSetShowModerationSettingModal.mock.calls[0]![0]// Execute the onSaveCallbackmodalCall.onSaveCallback({ enabled: true, type: 'keywords', config: {} })@@ -434,7 +435,7 @@ describe('Moderation', () => {fireEvent.click(screen.getByRole('switch'))- const modalCall = mockSetShowModerationSettingModal.mock.calls[0][0]+ const modalCall = mockSetShowModerationSettingModal.mock.calls[0]![0]expect(() => modalCall.onSaveCallback({ enabled: true, type: 'keywords', config: {} })).not.toThrow()})@@ -444,7 +445,7 @@ describe('Moderation', () => {fireEvent.click(screen.getByRole('switch'))- const modalCall = mockSetShowModerationSettingModal.mock.calls[0][0]+ const modalCall = mockSetShowModerationSettingModal.mock.calls[0]![0]// Execute the onCancelCallbackmodalCall.onCancelCallback()@@ -456,7 +457,7 @@ describe('Moderation', () => {fireEvent.click(screen.getByRole('switch'))- const modalCall = mockSetShowModerationSettingModal.mock.calls[0][0]+ const modalCall = mockSetShowModerationSettingModal.mock.calls[0]![0]expect(() => modalCall.onCancelCallback()).not.toThrow()})@@ -510,12 +511,14 @@ describe('Moderation', () => {const card = screen.getByText(/feature\.moderation\.title/).closest('[class]')!// Info is visible before hover- expect(screen.getByText(/feature\.moderation\.modal\.provider\.keywords/)).toBeInTheDocument()+ // Info is visible before hover+ expect(screen.getByText(/feature\.moderation\.modal\.provider\.keywords/))!.toBeInTheDocument()fireEvent.mouseEnter(card)// Info hidden, settings button shown- expect(screen.getByText(/operation\.settings/)).toBeInTheDocument()+ // Info hidden, settings button shown+ expect(screen.getByText(/operation\.settings/))!.toBeInTheDocument()})it('should show info display again when mouse leaves', () => {@@ -534,6 +537,6 @@ describe('Moderation', () => {fireEvent.mouseEnter(card)fireEvent.mouseLeave(card)- expect(screen.getByText(/feature\.moderation\.modal\.provider\.keywords/)).toBeInTheDocument()+ expect(screen.getByText(/feature\.moderation\.modal\.provider\.keywords/))!.toBeInTheDocument()})})diff --git a/web/app/components/base/features/new-feature-panel/moderation/__tests__/moderation-setting-modal.spec.tsx b/web/app/components/base/features/new-feature-panel/moderation/__tests__/moderation-setting-modal.spec.tsxindex 30b9ea13bd6..fd6ca654aa4 100644--- a/web/app/components/base/features/new-feature-panel/moderation/__tests__/moderation-setting-modal.spec.tsx+++ b/web/app/components/base/features/new-feature-panel/moderation/__tests__/moderation-setting-modal.spec.tsx@@ -111,7 +111,7 @@ describe('ModerationSettingModal', () => {/>,)- expect(screen.getByText(/feature\.moderation\.modal\.title/)).toBeInTheDocument()+ expect(screen.getByText(/feature\.moderation\.modal\.title/))!.toBeInTheDocument()})it('should render provider options', async () => {@@ -123,10 +123,10 @@ describe('ModerationSettingModal', () => {/>,)- expect(screen.getByText(/feature\.moderation\.modal\.provider\.openai/)).toBeInTheDocument()+ expect(screen.getByText(/feature\.moderation\.modal\.provider\.openai/))!.toBeInTheDocument()// Keywords text appears both as provider option and section labelexpect(screen.getAllByText(/feature\.moderation\.modal\.provider\.keywords/).length).toBeGreaterThanOrEqual(1)- expect(screen.getByText(/apiBasedExtension\.selector\.title/)).toBeInTheDocument()+ expect(screen.getByText(/apiBasedExtension\.selector\.title/))!.toBeInTheDocument()})it('should show keywords textarea when keywords type is selected', async () => {@@ -139,8 +139,8 @@ describe('ModerationSettingModal', () => {)const textarea = screen.getByPlaceholderText(/feature\.moderation\.modal\.keywords\.placeholder/) as HTMLTextAreaElement- expect(textarea).toBeInTheDocument()- expect(textarea).toHaveValue('bad\nword')+ expect(textarea)!.toBeInTheDocument()+ expect(textarea)!.toHaveValue('bad\nword')})it('should render cancel and save buttons', async () => {@@ -152,8 +152,8 @@ describe('ModerationSettingModal', () => {/>,)- expect(screen.getByText(/operation\.cancel/)).toBeInTheDocument()- expect(screen.getByText(/operation\.save/)).toBeInTheDocument()+ expect(screen.getByText(/operation\.cancel/))!.toBeInTheDocument()+ expect(screen.getByText(/operation\.save/))!.toBeInTheDocument()})it('should call onCancel when cancel is clicked', async () => {@@ -182,7 +182,7 @@ describe('ModerationSettingModal', () => {)const closeButton = document.querySelector('div[role="button"][tabindex="0"]') as HTMLElement- expect(closeButton).toBeInTheDocument()+ expect(closeButton)!.toBeInTheDocument()closeButton.focus()fireEvent.keyDown(closeButton, { key: 'Enter' })@@ -200,7 +200,7 @@ describe('ModerationSettingModal', () => {)const closeButton = document.querySelector('div[role="button"][tabindex="0"]') as HTMLElement- expect(closeButton).toBeInTheDocument()+ expect(closeButton)!.toBeInTheDocument()closeButton.focus()fireEvent.keyDown(closeButton, { key: ' ' })@@ -218,7 +218,7 @@ describe('ModerationSettingModal', () => {)const closeButton = document.querySelector('div[role="button"][tabindex="0"]') as HTMLElement- expect(closeButton).toBeInTheDocument()+ expect(closeButton)!.toBeInTheDocument()closeButton.focus()fireEvent.keyDown(closeButton, { key: 'Escape' })@@ -311,7 +311,7 @@ describe('ModerationSettingModal', () => {/>,)- expect(screen.getByTestId('api-selector')).toBeInTheDocument()+ expect(screen.getByTestId('api-selector'))!.toBeInTheDocument()})it('should switch provider type when clicked', async () => {@@ -326,6 +326,37 @@ describe('ModerationSettingModal', () => {// Click on openai_moderation providerfireEvent.click(screen.getByText(/feature\.moderation\.modal\.provider\.openai/))+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed+ // The keywords textarea should no longer be visible since type changed// The keywords textarea should no longer be visible since type changedexpect(screen.queryByPlaceholderText(/feature\.moderation\.modal\.keywords\.placeholder/)).not.toBeInTheDocument()})@@ -342,7 +373,7 @@ describe('ModerationSettingModal', () => {const textarea = screen.getByPlaceholderText(/feature\.moderation\.modal\.keywords\.placeholder/) as HTMLTextAreaElementfireEvent.change(textarea, { target: { value: 'new\nkeywords' } })- expect(textarea).toHaveValue('new\nkeywords')+ expect(textarea)!.toHaveValue('new\nkeywords')})it('should render moderation content sections', async () => {@@ -354,8 +385,8 @@ describe('ModerationSettingModal', () => {/>,)- expect(screen.getByText(/feature\.moderation\.modal\.content\.input/)).toBeInTheDocument()- expect(screen.getByText(/feature\.moderation\.modal\.content\.output/)).toBeInTheDocument()+ expect(screen.getByText(/feature\.moderation\.modal\.content\.input/))!.toBeInTheDocument()+ expect(screen.getByText(/feature\.moderation\.modal\.content\.output/))!.toBeInTheDocument()})it('should show error when inputs enabled but no preset_response for keywords type', async () => {@@ -471,7 +502,7 @@ describe('ModerationSettingModal', () => {const switches = screen.getAllByRole('switch')expect(screen.getAllByPlaceholderText(/feature\.moderation\.modal\.content\.placeholder/)).toHaveLength(1)- fireEvent.click(switches[0])+ fireEvent.click(switches[0]!)expect(screen.queryAllByPlaceholderText(/feature\.moderation\.modal\.content\.placeholder/)).toHaveLength(0)})@@ -488,7 +519,7 @@ describe('ModerationSettingModal', () => {const switches = screen.getAllByRole('switch')expect(screen.getAllByPlaceholderText(/feature\.moderation\.modal\.content\.placeholder/)).toHaveLength(1)- fireEvent.click(switches[1])+ fireEvent.click(switches[1]!)expect(screen.getAllByPlaceholderText(/feature\.moderation\.modal\.content\.placeholder/)).toHaveLength(2)})@@ -594,7 +625,8 @@ describe('ModerationSettingModal', () => {fireEvent.click(screen.getByText(/apiBasedExtension\.selector\.title/))// API selector should now be visible, keywords textarea should be hidden- expect(screen.getByTestId('api-selector')).toBeInTheDocument()+ // API selector should now be visible, keywords textarea should be hidden+ expect(screen.getByTestId('api-selector'))!.toBeInTheDocument()expect(screen.queryByPlaceholderText(/feature\.moderation\.modal\.keywords\.placeholder/)).not.toBeInTheDocument()})@@ -638,7 +670,7 @@ describe('ModerationSettingModal', () => {/>,)- expect(screen.getByText(/feature\.moderation\.modal\.openaiNotConfig\.before/)).toBeInTheDocument()+ expect(screen.getByText(/feature\.moderation\.modal\.openaiNotConfig\.before/))!.toBeInTheDocument()})it('should open settings modal when provider link is clicked in OpenAI warning', async () => {@@ -670,7 +702,7 @@ describe('ModerationSettingModal', () => {expect(mockSetShowAccountSettingModal).toHaveBeenCalled()- const modalCall = mockSetShowAccountSettingModal.mock.calls[0][0]+ const modalCall = mockSetShowAccountSettingModal.mock.calls[0]![0]modalCall.onCancelCallback()expect(mockModelProvidersData.refetch).toHaveBeenCalled()})@@ -726,7 +758,7 @@ describe('ModerationSettingModal', () => {/>,)- expect(screen.getByText('Custom Extension')).toBeInTheDocument()+ expect(screen.getByText('Custom Extension'))!.toBeInTheDocument()})it('should show form generation when code-based extension is selected', async () => {@@ -750,8 +782,8 @@ describe('ModerationSettingModal', () => {/>,)- expect(screen.getByText('API URL')).toBeInTheDocument()- expect(screen.getByPlaceholderText('Enter URL')).toBeInTheDocument()+ expect(screen.getByText('API URL'))!.toBeInTheDocument()+ expect(screen.getByPlaceholderText('Enter URL'))!.toBeInTheDocument()})it('should initialize config from form schema when switching to code-based extension', async () => {@@ -779,7 +811,8 @@ describe('ModerationSettingModal', () => {fireEvent.click(screen.getByText('Custom Extension'))// The form input should use the default value from form schema- expect(screen.getByDisplayValue('https://default.com')).toBeInTheDocument()+ // The form input should use the default value from form schema+ expect(screen.getByDisplayValue('https://default.com'))!.toBeInTheDocument()})it('should show error when required form schema field is empty on save', async () => {@@ -882,7 +915,7 @@ describe('ModerationSettingModal', () => {/>,)- expect(screen.getByText(/apiBasedExtension\.link/)).toBeInTheDocument()+ expect(screen.getByText(/apiBasedExtension\.link/))!.toBeInTheDocument()})it('should fallback missing inputs_config to disabled in formatted save data', async () => {@@ -933,7 +966,7 @@ describe('ModerationSettingModal', () => {)const textarea = screen.getAllByRole('textbox')[0]- expect(textarea).toHaveAttribute('placeholder', '')+ expect(textarea)!.toHaveAttribute('placeholder', '')useTranslationSpy.mockRestore()})})diff --git a/web/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal.tsx b/web/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal.tsxindex 1247321bd8d..438af2e9a12 100644--- a/web/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal.tsx+++ b/web/app/components/base/features/new-feature-panel/moderation/moderation-setting-modal.tsx@@ -205,8 +205,8 @@ const ModerationSettingModal: FC<ModerationSettingModalProps> = ({if (systemTypes.findIndex(t => t === localeData.type) < 0 && currentProvider?.form_schema) {for (let i = 0; i < currentProvider.form_schema.length; i++) {- if (!localeData.config?.[currentProvider.form_schema[i].variable] && currentProvider.form_schema[i].required) {- toast.error(t('errorMessage.valueOfVarRequired', { ns: 'appDebug', key: locale !== LanguagesSupported[1] ? currentProvider.form_schema[i].label['en-US'] : currentProvider.form_schema[i].label['zh-Hans'] }))+ if (!localeData.config?.[currentProvider.form_schema[i]!.variable] && currentProvider.form_schema[i]!.required) {+ toast.error(t('errorMessage.valueOfVarRequired', { ns: 'appDebug', key: locale !== LanguagesSupported[1] ? currentProvider.form_schema[i]!.label['en-US'] : currentProvider.form_schema[i]!.label['zh-Hans'] }))return}}diff --git a/web/app/components/base/features/new-feature-panel/text-to-speech/__tests__/param-config-content.spec.tsx b/web/app/components/base/features/new-feature-panel/text-to-speech/__tests__/param-config-content.spec.tsxindex 535d40e00a3..754bde98a6f 100644--- a/web/app/components/base/features/new-feature-panel/text-to-speech/__tests__/param-config-content.spec.tsx+++ b/web/app/components/base/features/new-feature-panel/text-to-speech/__tests__/param-config-content.spec.tsx@@ -83,35 +83,35 @@ describe('ParamConfigContent', () => {it('should render voice settings title', () => {renderWithProvider()- expect(screen.getByText(/voice\.voiceSettings\.title/)).toBeInTheDocument()+ expect(screen.getByText(/voice\.voiceSettings\.title/))!.toBeInTheDocument()})it('should render language label', () => {renderWithProvider()- expect(screen.getByText(/voice\.voiceSettings\.language/)).toBeInTheDocument()+ expect(screen.getByText(/voice\.voiceSettings\.language/))!.toBeInTheDocument()})it('should render voice label', () => {renderWithProvider()- expect(screen.getByText(/voice\.voiceSettings\.voice/)).toBeInTheDocument()+ expect(screen.getByText(/voice\.voiceSettings\.voice/))!.toBeInTheDocument()})it('should render autoPlay toggle', () => {renderWithProvider()- expect(screen.getByText(/voice\.voiceSettings\.autoPlay/)).toBeInTheDocument()- expect(screen.getByRole('switch')).toBeInTheDocument()+ expect(screen.getByText(/voice\.voiceSettings\.autoPlay/))!.toBeInTheDocument()+ expect(screen.getByRole('switch'))!.toBeInTheDocument()})it('should render tooltip icon for language', () => {renderWithProvider()const languageLabel = screen.getByText(/voice\.voiceSettings\.language/)- expect(languageLabel).toBeInTheDocument()+ expect(languageLabel)!.toBeInTheDocument()const tooltip = languageLabel.parentElement as HTMLElement- expect(tooltip.querySelector('svg')).toBeInTheDocument()+ expect(tooltip.querySelector('svg'))!.toBeInTheDocument()})it('should display language listbox button', () => {@@ -126,14 +126,14 @@ describe('ParamConfigContent', () => {const buttons = screen.getAllByRole('button')const voiceButton = buttons.find(btn => btn.textContent?.includes('Alloy'))- expect(voiceButton).toBeInTheDocument()+ expect(voiceButton)!.toBeInTheDocument()})it('should render audition button when language has example', () => {renderWithProvider()const auditionButton = screen.queryByTestId('audition-button')- expect(auditionButton).toBeInTheDocument()+ expect(auditionButton)!.toBeInTheDocument()})it('should not render audition button when language has no example', () => {@@ -164,7 +164,7 @@ describe('ParamConfigContent', () => {const buttons = screen.getAllByRole('button')const voiceButton = buttons.find(btn => btn.textContent?.includes('Alloy'))- expect(voiceButton).toBeInTheDocument()+ expect(voiceButton)!.toBeInTheDocument()})})@@ -221,11 +221,11 @@ describe('ParamConfigContent', () => {)const autoPlaySwitch = screen.getByRole('switch')- expect(autoPlaySwitch).toHaveAttribute('aria-checked', 'true')+ expect(autoPlaySwitch)!.toHaveAttribute('aria-checked', 'true')await userEvent.click(autoPlaySwitch)- expect(autoPlaySwitch).toHaveAttribute('aria-checked', 'false')+ expect(autoPlaySwitch)!.toHaveAttribute('aria-checked', 'false')expect(onChange).toHaveBeenCalled()})@@ -234,7 +234,7 @@ describe('ParamConfigContent', () => {await userEvent.click(screen.getByRole('switch'))- expect(screen.getByRole('switch')).toBeInTheDocument()+ expect(screen.getByRole('switch'))!.toBeInTheDocument()})it('should open language listbox and show options', async () => {@@ -259,7 +259,7 @@ describe('ParamConfigContent', () => {await userEvent.click(languageButton!)const options = await screen.findAllByRole('option')expect(options.length).toBeGreaterThan(1)- await userEvent.click(options[1])+ await userEvent.click(options[1]!)expect(onChange).toHaveBeenCalled()})@@ -273,7 +273,7 @@ describe('ParamConfigContent', () => {await userEvent.click(voiceButton!)const options = await screen.findAllByRole('option')expect(options.length).toBeGreaterThan(1)- await userEvent.click(options[1])+ await userEvent.click(options[1]!)expect(onChange).toHaveBeenCalled()})@@ -289,7 +289,7 @@ describe('ParamConfigContent', () => {const selectedOption = options.find(opt => opt.textContent?.includes('voice.language.enUS'))expect(selectedOption).toBeDefined()- expect(selectedOption).toHaveAttribute('aria-selected', 'true')+ expect(selectedOption)!.toHaveAttribute('aria-selected', 'true')})it('should show selected voice option in listbox', async () => {@@ -304,7 +304,7 @@ describe('ParamConfigContent', () => {const selectedOption = options.find(opt => opt.textContent?.includes('Alloy'))expect(selectedOption).toBeDefined()- expect(selectedOption).toHaveAttribute('aria-selected', 'true')+ expect(selectedOption)!.toHaveAttribute('aria-selected', 'true')})})@@ -343,7 +343,7 @@ describe('ParamConfigContent', () => {text2speech: { enabled: true, language: '', voice: '', autoPlay: TtsAutoPlay.disabled },})- expect(screen.getByText(/voice\.language\./)).toBeInTheDocument()+ expect(screen.getByText(/voice\.language\./))!.toBeInTheDocument()})})})diff --git a/web/app/components/base/features/new-feature-panel/text-to-speech/__tests__/voice-settings.spec.tsx b/web/app/components/base/features/new-feature-panel/text-to-speech/__tests__/voice-settings.spec.tsxindex f77802c1332..574aeddd4ab 100644--- a/web/app/components/base/features/new-feature-panel/text-to-speech/__tests__/voice-settings.spec.tsx+++ b/web/app/components/base/features/new-feature-panel/text-to-speech/__tests__/voice-settings.spec.tsx@@ -78,7 +78,7 @@ describe('VoiceSettings', () => {</VoiceSettings>,)- expect(screen.getByText('Settings')).toBeInTheDocument()+ expect(screen.getByText('Settings'))!.toBeInTheDocument()})it('should render ParamConfigContent in portal', () => {@@ -88,7 +88,7 @@ describe('VoiceSettings', () => {</VoiceSettings>,)- expect(screen.getByText(/voice\.voiceSettings\.title/)).toBeInTheDocument()+ expect(screen.getByText(/voice\.voiceSettings\.title/))!.toBeInTheDocument()})it('should call onOpen with toggle function when trigger is clicked', () => {@@ -103,7 +103,7 @@ describe('VoiceSettings', () => {expect(onOpen).toHaveBeenCalled()// The toggle function should flip the open state- const toggleFn = onOpen.mock.calls[0][0]+ const toggleFn = onOpen.mock.calls[0]![0]expect(typeof toggleFn).toBe('function')expect(toggleFn(false)).toBe(true)expect(toggleFn(true)).toBe(false)@@ -146,7 +146,7 @@ describe('VoiceSettings', () => {.find(item => item.hasAttribute('data-main-axis'))expect(portal).toBeDefined()- expect(portal).toHaveAttribute('data-placement', 'top')- expect(portal).toHaveAttribute('data-main-axis', '4')+ expect(portal)!.toHaveAttribute('data-placement', 'top')+ expect(portal)!.toHaveAttribute('data-main-axis', '4')})})diff --git a/web/app/components/base/file-uploader/__tests__/hooks.spec.ts b/web/app/components/base/file-uploader/__tests__/hooks.spec.tsindex 017a1391633..e9c3675c2f8 100644--- a/web/app/components/base/file-uploader/__tests__/hooks.spec.ts+++ b/web/app/components/base/file-uploader/__tests__/hooks.spec.ts@@ -225,7 +225,7 @@ describe('useFile', () => {const { result } = renderHook(() => useFile(defaultFileConfig))result.current.handleReUploadFile('file-1')- const uploadCall = mockFileUpload.mock.calls[0][0]+ const uploadCall = mockFileUpload.mock.calls[0]![0]uploadCall.onProgressCallback(50)expect(mockSetFiles).toHaveBeenCalled()})@@ -246,7 +246,7 @@ describe('useFile', () => {const { result } = renderHook(() => useFile(defaultFileConfig))result.current.handleReUploadFile('file-1')- const uploadCall = mockFileUpload.mock.calls[0][0]+ const uploadCall = mockFileUpload.mock.calls[0]![0]uploadCall.onSuccessCallback({ id: 'uploaded-1' })expect(mockSetFiles).toHaveBeenCalled()})@@ -267,7 +267,7 @@ describe('useFile', () => {const { result } = renderHook(() => useFile(defaultFileConfig))result.current.handleReUploadFile('file-1')- const uploadCall = mockFileUpload.mock.calls[0][0]+ const uploadCall = mockFileUpload.mock.calls[0]![0]uploadCall.onErrorCallback(new Error('fail'))expect(mockNotify).toHaveBeenCalledWith(expect.objectContaining({ type: 'error' }))})@@ -668,7 +668,7 @@ describe('useFile', () => {expect(mockSetFiles).toHaveBeenCalled()// The file should have been added with base64Url set (for image type)- const addedFiles = mockSetFiles.mock.calls[0][0]+ const addedFiles = mockSetFiles.mock.calls[0]![0]expect(addedFiles[0].base64Url).toBe('data:text/plain;base64,Y29udGVudA==')})@@ -680,7 +680,7 @@ describe('useFile', () => {result.current.handleLocalFileUpload(file)expect(mockSetFiles).toHaveBeenCalled()- const addedFiles = mockSetFiles.mock.calls[0][0]+ const addedFiles = mockSetFiles.mock.calls[0]![0]expect(addedFiles[0].base64Url).toBe('')})@@ -691,7 +691,7 @@ describe('useFile', () => {result.current.handleLocalFileUpload(file)expect(mockFileUpload).toHaveBeenCalled()- const uploadCall = mockFileUpload.mock.calls[0][0]+ const uploadCall = mockFileUpload.mock.calls[0]![0]// Test progress callbackuploadCall.onProgressCallback(50)@@ -708,7 +708,7 @@ describe('useFile', () => {const { result } = renderHook(() => useFile(defaultFileConfig))result.current.handleLocalFileUpload(file)- const uploadCall = mockFileUpload.mock.calls[0][0]+ const uploadCall = mockFileUpload.mock.calls[0]![0]uploadCall.onErrorCallback(new Error('upload failed'))expect(mockNotify).toHaveBeenCalledWith(expect.objectContaining({ type: 'error' }))diff --git a/web/app/components/base/file-uploader/__tests__/utils.spec.ts b/web/app/components/base/file-uploader/__tests__/utils.spec.tsindex 7a4956307d5..4c85bfa3f8f 100644--- a/web/app/components/base/file-uploader/__tests__/utils.spec.ts+++ b/web/app/components/base/file-uploader/__tests__/utils.spec.ts@@ -340,7 +340,7 @@ describe('file-uploader utils', () => {}] as unknown as FileEntity[]const result = getProcessedFiles(files)- expect(result[0].url).toBe('')+ expect(result[0]!.url).toBe('')})it('should fallback to empty string when uploadedId is missing', () => {@@ -357,7 +357,7 @@ describe('file-uploader utils', () => {}] as unknown as FileEntity[]const result = getProcessedFiles(files)- expect(result[0].upload_file_id).toBe('')+ expect(result[0]!.upload_file_id).toBe('')})it('should filter out files with progress -1', () => {@@ -384,7 +384,7 @@ describe('file-uploader utils', () => {const result = getProcessedFiles(files)expect(result).toHaveLength(1)- expect(result[0].upload_file_id).toBe('1')+ expect(result[0]!.upload_file_id).toBe('1')})})@@ -432,7 +432,7 @@ describe('file-uploader utils', () => {}]const result = getProcessedFilesFromResponse(files)- expect(result[0].supportFileType).toBe('image')+ expect(result[0]!.supportFileType).toBe('image')})it('should correct video file misclassified as document', () => {@@ -450,7 +450,7 @@ describe('file-uploader utils', () => {}]const result = getProcessedFilesFromResponse(files)- expect(result[0].supportFileType).toBe('video')+ expect(result[0]!.supportFileType).toBe('video')})it('should correct audio file misclassified as document', () => {@@ -468,7 +468,7 @@ describe('file-uploader utils', () => {}]const result = getProcessedFilesFromResponse(files)- expect(result[0].supportFileType).toBe('audio')+ expect(result[0]!.supportFileType).toBe('audio')})it('should correct document file misclassified as image', () => {@@ -486,7 +486,7 @@ describe('file-uploader utils', () => {}]const result = getProcessedFilesFromResponse(files)- expect(result[0].supportFileType).toBe('document')+ expect(result[0]!.supportFileType).toBe('document')})it('should NOT correct when filename and MIME type conflict', () => {@@ -504,7 +504,7 @@ describe('file-uploader utils', () => {}]const result = getProcessedFilesFromResponse(files)- expect(result[0].supportFileType).toBe('document')+ expect(result[0]!.supportFileType).toBe('document')})it('should NOT correct when filename and MIME type both point to same type', () => {@@ -522,7 +522,7 @@ describe('file-uploader utils', () => {}]const result = getProcessedFilesFromResponse(files)- expect(result[0].supportFileType).toBe('image')+ expect(result[0]!.supportFileType).toBe('image')})it('should handle files with missing filename', () => {@@ -540,7 +540,7 @@ describe('file-uploader utils', () => {}]const result = getProcessedFilesFromResponse(files)- expect(result[0].supportFileType).toBe('document')+ expect(result[0]!.supportFileType).toBe('document')})it('should handle files with missing MIME type', () => {@@ -558,7 +558,7 @@ describe('file-uploader utils', () => {}]const result = getProcessedFilesFromResponse(files)- expect(result[0].supportFileType).toBe('document')+ expect(result[0]!.supportFileType).toBe('document')})it('should handle files with unknown extensions', () => {@@ -576,7 +576,7 @@ describe('file-uploader utils', () => {}]const result = getProcessedFilesFromResponse(files)- expect(result[0].supportFileType).toBe('document')+ expect(result[0]!.supportFileType).toBe('document')})it('should handle multiple different file types correctly', () => {@@ -621,9 +621,9 @@ describe('file-uploader utils', () => {const result = getProcessedFilesFromResponse(files)- expect(result[0].supportFileType).toBe('image') // correct, no change- expect(result[1].supportFileType).toBe('image') // corrected from document to image- expect(result[2].supportFileType).toBe('document') // conflict, no change+ expect(result[0]!.supportFileType).toBe('image') // correct, no change+ expect(result[1]!.supportFileType).toBe('image') // corrected from document to image+ expect(result[2]!.supportFileType).toBe('document') // conflict, no change})})diff --git a/web/app/components/base/file-uploader/file-input.tsx b/web/app/components/base/file-uploader/file-input.tsxindex 56d71f59abd..f4cd4514e71 100644--- a/web/app/components/base/file-uploader/file-input.tsx+++ b/web/app/components/base/file-uploader/file-input.tsx@@ -19,11 +19,11 @@ const FileInput = ({if (fileConfig.number_limits) {for (let i = 0; i < targetFiles.length; i++) {if (i + 1 + files.length <= fileConfig.number_limits)- handleLocalFileUpload(targetFiles[i])+ handleLocalFileUpload(targetFiles[i]!)}}else {- handleLocalFileUpload(targetFiles[0])+ handleLocalFileUpload(targetFiles[0]!)}}}diff --git a/web/app/components/base/file-uploader/file-uploader-in-attachment/__tests__/file-item.spec.tsx b/web/app/components/base/file-uploader/file-uploader-in-attachment/__tests__/file-item.spec.tsxindex b2198680f5f..002eced6ca0 100644--- a/web/app/components/base/file-uploader/file-uploader-in-attachment/__tests__/file-item.spec.tsx+++ b/web/app/components/base/file-uploader/file-uploader-in-attachment/__tests__/file-item.spec.tsx@@ -33,20 +33,20 @@ describe('FileInAttachmentItem', () => {it('should render file name and extension', () => {render(<FileInAttachmentItem file={createFile()} />)- expect(screen.getByText(/document\.pdf/i)).toBeInTheDocument()- expect(screen.getByText(/^pdf$/i)).toBeInTheDocument()+ expect(screen.getByText(/document\.pdf/i))!.toBeInTheDocument()+ expect(screen.getByText(/^pdf$/i))!.toBeInTheDocument()})it('should render file size', () => {render(<FileInAttachmentItem file={createFile({ size: 2048 })} />)- expect(screen.getByText(/2048B/)).toBeInTheDocument()+ expect(screen.getByText(/2048B/))!.toBeInTheDocument()})it('should render FileTypeIcon for non-image files', () => {const { container } = render(<FileInAttachmentItem file={createFile()} />)- expect(container.querySelector('svg')).toBeInTheDocument()+ expect(container.querySelector('svg'))!.toBeInTheDocument()})it('should render FileImageRender for image files', () => {@@ -59,8 +59,8 @@ describe('FileInAttachmentItem', () => {)const img = screen.getByRole('img')- expect(img).toBeInTheDocument()- expect(img).toHaveAttribute('src', 'data:image/png;base64,abc')+ expect(img)!.toBeInTheDocument()+ expect(img)!.toHaveAttribute('src', 'data:image/png;base64,abc')})it('should render delete button when showDeleteAction is true', () => {@@ -102,9 +102,9 @@ describe('FileInAttachmentItem', () => {// ProgressCircle renders an SVG with a <circle> and <path> elementconst svg = container.querySelector('svg')- expect(svg).toBeInTheDocument()+ expect(svg)!.toBeInTheDocument()const circle = container.querySelector('circle')- expect(circle).toBeInTheDocument()+ expect(circle)!.toBeInTheDocument()})it('should render replay icon when upload failed', () => {@@ -112,7 +112,7 @@ describe('FileInAttachmentItem', () => {// ReplayLine renders an SVG with data-icon="ReplayLine"const replayIcon = container.querySelector('[data-icon="ReplayLine"]')- expect(replayIcon).toBeInTheDocument()+ expect(replayIcon)!.toBeInTheDocument()})it('should call onReUpload when replay icon is clicked', () => {@@ -131,7 +131,7 @@ describe('FileInAttachmentItem', () => {// Error state is confirmed by the presence of the replay iconconst replayIcon = container.querySelector('[data-icon="ReplayLine"]')- expect(replayIcon).toBeInTheDocument()+ expect(replayIcon)!.toBeInTheDocument()})it('should render eye icon for previewable image files', () => {@@ -164,7 +164,7 @@ describe('FileInAttachmentItem', () => {// The eye button is rendered before the download button for image filesconst buttons = screen.getAllByRole('button')// Click the eye button (the first action button for image preview)- fireEvent.click(buttons[0])+ fireEvent.click(buttons[0]!)// ImagePreview renders a portal with an img elementconst previewImages = document.querySelectorAll('img')@@ -184,16 +184,47 @@ describe('FileInAttachmentItem', () => {)const buttons = screen.getAllByRole('button')- fireEvent.click(buttons[0])+ fireEvent.click(buttons[0]!)// ImagePreview renders via createPortal with class "image-preview-container"const previewContainer = document.querySelector('.image-preview-container')!- expect(previewContainer).toBeInTheDocument()+ expect(previewContainer)!.toBeInTheDocument()// Close button is the last clickable div with an SVG in the preview containerconst closeIcon = screen.getByTestId('image-preview-close-button')fireEvent.click(closeIcon.parentElement!)+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed+ // Preview should be removed// Preview should be removedexpect(document.querySelector('.image-preview-container')).not.toBeInTheDocument()})@@ -287,7 +318,7 @@ describe('FileInAttachmentItem', () => {)const img = screen.getByRole('img')- expect(img).toHaveAttribute('src', 'https://example.com/img.png')+ expect(img)!.toHaveAttribute('src', 'https://example.com/img.png')})it('should render image element even when both urls are empty', () => {@@ -301,7 +332,7 @@ describe('FileInAttachmentItem', () => {)const img = screen.getByRole('img')- expect(img).toBeInTheDocument()+ expect(img)!.toBeInTheDocument()})it('should not render eye icon when canPreview is false for image files', () => {@@ -347,7 +378,8 @@ describe('FileInAttachmentItem', () => {render(<FileInAttachmentItem file={createFile({ name: 'noext' })} />)// The file name should still show- expect(screen.getByText(/noext/)).toBeInTheDocument()+ // The file name should still show+ expect(screen.getByText(/noext/))!.toBeInTheDocument()})it('should show image preview with empty url when url is undefined', () => {@@ -364,8 +396,70 @@ describe('FileInAttachmentItem', () => {const buttons = screen.getAllByRole('button')// Click the eye preview button- fireEvent.click(buttons[0])+ fireEvent.click(buttons[0]!)+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render+ // setImagePreviewUrl(url || '') = setImagePreviewUrl('')+ // Empty string is falsy, so preview should NOT render// setImagePreviewUrl(url || '') = setImagePreviewUrl('')// Empty string is falsy, so preview should NOT renderexpect(document.querySelector('.image-preview-container')).not.toBeInTheDocument()diff --git a/web/app/components/base/file-uploader/file-uploader-in-chat-input/__tests__/file-image-item.spec.tsx b/web/app/components/base/file-uploader/file-uploader-in-chat-input/__tests__/file-image-item.spec.tsxindex 2bc418cf1de..cfe6719b20c 100644--- a/web/app/components/base/file-uploader/file-uploader-in-chat-input/__tests__/file-image-item.spec.tsx+++ b/web/app/components/base/file-uploader/file-uploader-in-chat-input/__tests__/file-image-item.spec.tsx@@ -30,15 +30,15 @@ describe('FileImageItem', () => {render(<FileImageItem file={createFile()} />)const img = screen.getByRole('img')- expect(img).toBeInTheDocument()- expect(img).toHaveAttribute('src', 'data:image/png;base64,abc')+ expect(img)!.toBeInTheDocument()+ expect(img)!.toHaveAttribute('src', 'data:image/png;base64,abc')})it('should use url when base64Url is not available', () => {render(<FileImageItem file={createFile({ base64Url: undefined })} />)const img = screen.getByRole('img')- expect(img).toHaveAttribute('src', 'https://example.com/photo.png')+ expect(img)!.toHaveAttribute('src', 'https://example.com/photo.png')})it('should render delete button when showDeleteAction is true', () => {@@ -53,7 +53,7 @@ describe('FileImageItem', () => {render(<FileImageItem file={createFile()} showDeleteAction onRemove={onRemove} />)const buttons = screen.getAllByRole('button')- fireEvent.click(buttons[0])+ fireEvent.click(buttons[0]!)expect(onRemove).toHaveBeenCalledWith('file-1')})@@ -65,7 +65,7 @@ describe('FileImageItem', () => {const svgs = container.querySelectorAll('svg')const progressSvg = Array.from(svgs).find(svg => svg.querySelector('circle'))- expect(progressSvg).toBeInTheDocument()+ expect(progressSvg)!.toBeInTheDocument()})it('should render replay icon when upload failed', () => {@@ -73,7 +73,7 @@ describe('FileImageItem', () => {// ReplayLine renders as an SVG icon with data-icon attributeconst replaySvg = container.querySelector('svg[data-icon="ReplayLine"]')- expect(replaySvg).toBeInTheDocument()+ expect(replaySvg)!.toBeInTheDocument()})it('should call onReUpload when replay icon is clicked', () => {@@ -96,7 +96,8 @@ describe('FileImageItem', () => {fireEvent.click(img.parentElement!)// ImagePreview renders via createPortal with class "image-preview-container", not role="dialog"- expect(document.querySelector('.image-preview-container')).toBeInTheDocument()+ // ImagePreview renders via createPortal with class "image-preview-container", not role="dialog"+ expect(document.querySelector('.image-preview-container'))!.toBeInTheDocument()})it('should not show image preview when canPreview is false', () => {@@ -115,7 +116,7 @@ describe('FileImageItem', () => {fireEvent.click(img.parentElement!)// ImagePreview renders via createPortal with class "image-preview-container"const previewContainer = document.querySelector('.image-preview-container')!- expect(previewContainer).toBeInTheDocument()+ expect(previewContainer)!.toBeInTheDocument()// Close button is the last clickable div with an SVG in the preview containerconst closeIcon = screen.getByTestId('image-preview-close-button')@@ -156,14 +157,14 @@ describe('FileImageItem', () => {render(<FileImageItem file={createFile({ base64Url: undefined, url: 'https://example.com/img.png' })} />)const img = screen.getByRole('img')- expect(img).toHaveAttribute('src', 'https://example.com/img.png')+ expect(img)!.toHaveAttribute('src', 'https://example.com/img.png')})it('should render image element even when both base64Url and url are undefined', () => {render(<FileImageItem file={createFile({ base64Url: undefined, url: undefined })} />)const img = screen.getByRole('img')- expect(img).toBeInTheDocument()+ expect(img)!.toBeInTheDocument()})it('should use url with attachment param for download_url when url is available', async () => {@@ -205,7 +206,7 @@ describe('FileImageItem', () => {const img = screen.getByRole('img')fireEvent.click(img.parentElement!)- expect(document.querySelector('.image-preview-container')).toBeInTheDocument()+ expect(document.querySelector('.image-preview-container'))!.toBeInTheDocument()})it('should set preview url using url when base64Url is not available', () => {@@ -214,7 +215,7 @@ describe('FileImageItem', () => {const img = screen.getByRole('img')fireEvent.click(img.parentElement!)- expect(document.querySelector('.image-preview-container')).toBeInTheDocument()+ expect(document.querySelector('.image-preview-container'))!.toBeInTheDocument()})it('should set preview url to empty string when both base64Url and url are undefined', () => {@@ -223,6 +224,37 @@ describe('FileImageItem', () => {const img = screen.getByRole('img')fireEvent.click(img.parentElement!)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)+ // Preview won't show because imagePreviewUrl is empty string (falsy)// Preview won't show because imagePreviewUrl is empty string (falsy)expect(document.querySelector('.image-preview-container')).not.toBeInTheDocument()})diff --git a/web/app/components/base/file-uploader/hooks.ts b/web/app/components/base/file-uploader/hooks.tsindex 6c7b75aebfa..2df4b005af4 100644--- a/web/app/components/base/file-uploader/hooks.ts+++ b/web/app/components/base/file-uploader/hooks.ts@@ -151,13 +151,13 @@ export const useFile = (fileConfig: FileUpload, noNeedToCheckEnable = true) => {const index = files.findIndex(file => file.id === fileId)if (index > -1) {- const uploadingFile = files[index]+ const uploadingFile = files[index]!const newFiles = produce(files, (draft) => {- draft[index].progress = 0+ draft[index]!.progress = 0})setFiles(newFiles)fileUpload({- file: uploadingFile.originalFile!,+ file: uploadingFile!.originalFile!,onProgressCallback: (progress) => {handleUpdateFile({ ...uploadingFile, progress })},diff --git a/web/app/components/base/file-uploader/utils.ts b/web/app/components/base/file-uploader/utils.tsindex 23e460db512..3229667bd26 100644--- a/web/app/components/base/file-uploader/utils.ts+++ b/web/app/components/base/file-uploader/utils.ts@@ -95,7 +95,7 @@ export const getFileExtension = (fileName: string, fileMimetype: string, isRemotconst fileNamePairLength = fileNamePair.lengthif (fileNamePairLength > 1) {- extensionInFileName = fileNamePair[fileNamePairLength - 1].toLowerCase()+ extensionInFileName = fileNamePair[fileNamePairLength - 1]!.toLowerCase()if (extensions.has(extensionInFileName))extension = extensionInFileName}@@ -122,13 +122,13 @@ export const getFileAppearanceType = (fileName: string, fileMimetype: string) =>if (extension === 'gif')return FileAppearanceTypeEnum.gif- if (FILE_EXTS.image.includes(extension.toUpperCase()))+ if (FILE_EXTS.image!.includes(extension.toUpperCase()))return FileAppearanceTypeEnum.image- if (FILE_EXTS.video.includes(extension.toUpperCase()))+ if (FILE_EXTS.video!.includes(extension.toUpperCase()))return FileAppearanceTypeEnum.video- if (FILE_EXTS.audio.includes(extension.toUpperCase()))+ if (FILE_EXTS.audio!.includes(extension.toUpperCase()))return FileAppearanceTypeEnum.audioif (extension === 'html')@@ -149,7 +149,7 @@ export const getFileAppearanceType = (fileName: string, fileMimetype: string) =>if (extension === 'pptx' || extension === 'ppt')return FileAppearanceTypeEnum.ppt- if (FILE_EXTS.document.includes(extension.toUpperCase()))+ if (FILE_EXTS.document!.includes(extension.toUpperCase()))return FileAppearanceTypeEnum.documentreturn FileAppearanceTypeEnum.custom@@ -161,7 +161,7 @@ export const getSupportFileType = (fileName: string, fileMimetype: string, isCusconst extension = getFileExtension(fileName, fileMimetype)for (const key in FILE_EXTS) {- if ((FILE_EXTS[key]).includes(extension.toUpperCase()))+ if ((FILE_EXTS[key])!.includes(extension.toUpperCase()))return key}diff --git a/web/app/components/base/form/components/base/__tests__/base-form.spec.tsx b/web/app/components/base/form/components/base/__tests__/base-form.spec.tsxindex 387dcb0658e..e89b0e6271f 100644--- a/web/app/components/base/form/components/base/__tests__/base-form.spec.tsx+++ b/web/app/components/base/form/components/base/__tests__/base-form.spec.tsx@@ -60,8 +60,8 @@ describe('BaseForm', () => {it('should render fields with default values from schema', () => {render(<BaseForm formSchemas={baseSchemas} />)- expect(screen.getByDisplayValue('show')).toBeInTheDocument()- expect(screen.getByDisplayValue('Initial title')).toBeInTheDocument()+ expect(screen.getByDisplayValue('show'))!.toBeInTheDocument()+ expect(screen.getByDisplayValue('Initial title'))!.toBeInTheDocument()})it('should hide conditional fields when show_on conditions are not met', () => {@@ -72,7 +72,7 @@ describe('BaseForm', () => {/>,)- expect(screen.getByDisplayValue('hide')).toBeInTheDocument()+ expect(screen.getByDisplayValue('hide'))!.toBeInTheDocument()expect(screen.queryByDisplayValue('Hidden title')).not.toBeInTheDocument()})@@ -117,8 +117,8 @@ describe('BaseForm', () => {])})- expect(screen.getByDisplayValue('Changed title')).toBeInTheDocument()- expect(screen.getByText('Title is invalid')).toBeInTheDocument()+ expect(screen.getByDisplayValue('Changed title'))!.toBeInTheDocument()+ expect(screen.getByText('Title is invalid'))!.toBeInTheDocument()expect(formRef.current?.getForm()).toBeTruthy()expect(formRef.current?.getFormValues({})).toBeTruthy()})@@ -141,7 +141,7 @@ describe('BaseForm', () => {])})- expect(screen.getByText('Title warning')).toBeInTheDocument()+ expect(screen.getByText('Title warning'))!.toBeInTheDocument()})it('should use formFromProps if provided', () => {@@ -160,7 +160,7 @@ describe('BaseForm', () => {setFieldValue: vi.fn(),}render(<BaseForm formSchemas={baseSchemas} formFromProps={mockForm as unknown as AnyFormApi} />)- expect(screen.getByText('Kind')).toBeInTheDocument()+ expect(screen.getByText('Kind'))!.toBeInTheDocument()})it('should handle setFields with explicit validateStatus', async () => {@@ -174,7 +174,7 @@ describe('BaseForm', () => {errors: ['Explicit error'],}])})- expect(screen.getByText('Explicit error')).toBeInTheDocument()+ expect(screen.getByText('Explicit error'))!.toBeInTheDocument()})it('should handle setFields with no value change', async () => {@@ -187,12 +187,12 @@ describe('BaseForm', () => {errors: ['Error only'],}])})- expect(screen.getByText('Error only')).toBeInTheDocument()+ expect(screen.getByText('Error only'))!.toBeInTheDocument()})it('should use default values from schema when defaultValues prop is missing', () => {render(<BaseForm formSchemas={baseSchemas} />)- expect(screen.getByDisplayValue('show')).toBeInTheDocument()+ expect(screen.getByDisplayValue('show'))!.toBeInTheDocument()})it('should handle submit without preventDefaultSubmit', async () => {@@ -225,23 +225,23 @@ describe('BaseForm', () => {it('should handle undefined formSchemas', () => {const { container } = render(<BaseForm formSchemas={undefined as unknown as FormSchema[]} />)- expect(container).toBeEmptyDOMElement()+ expect(container)!.toBeEmptyDOMElement()})it('should handle empty array formSchemas', () => {const { container } = render(<BaseForm formSchemas={[]} />)- expect(container).toBeEmptyDOMElement()+ expect(container)!.toBeEmptyDOMElement()})it('should fallback to schema class names if props are missing', () => {const schemaWithClasses: FormSchema[] = [{- ...baseSchemas[0],+ ...baseSchemas[0]!,fieldClassName: 'schema-field',labelClassName: 'schema-label',}]render(<BaseForm formSchemas={schemaWithClasses} />)- expect(screen.getByText('Kind')).toHaveClass('schema-label')- expect(screen.getByText('Kind').parentElement).toHaveClass('schema-field')+ expect(screen.getByText('Kind'))!.toHaveClass('schema-label')+ expect(screen.getByText('Kind').parentElement)!.toHaveClass('schema-field')})it('should handle preventDefaultSubmit', async () => {@@ -292,7 +292,7 @@ describe('BaseForm', () => {value: 'new-show',}])})- expect(screen.getByDisplayValue('new-show')).toBeInTheDocument()+ expect(screen.getByDisplayValue('new-show'))!.toBeInTheDocument()})it('should handle schema without show_on in showOnValues', () => {@@ -304,7 +304,7 @@ describe('BaseForm', () => {}]// Simply rendering should trigger showOnValues selectorrender(<BaseForm formSchemas={schemaNoShowOn} />)- expect(screen.getByText('Test')).toBeInTheDocument()+ expect(screen.getByText('Test'))!.toBeInTheDocument()})it('should apply prop-based class names', () => {@@ -316,6 +316,6 @@ describe('BaseForm', () => {/>,)const label = screen.getByText('Kind')- expect(label).toHaveClass('custom-label')+ expect(label)!.toHaveClass('custom-label')})})diff --git a/web/app/components/base/form/components/field/__tests__/file-uploader.spec.tsx b/web/app/components/base/form/components/field/__tests__/file-uploader.spec.tsxindex bff8e9cbf99..67716a00c88 100644--- a/web/app/components/base/form/components/field/__tests__/file-uploader.spec.tsx+++ b/web/app/components/base/form/components/field/__tests__/file-uploader.spec.tsx@@ -60,8 +60,8 @@ describe('FileUploaderField', () => {/>,)- expect(screen.getByText('Attachments')).toBeInTheDocument()- expect(screen.getByText('report.pdf')).toBeInTheDocument()+ expect(screen.getByText('Attachments'))!.toBeInTheDocument()+ expect(screen.getByText('report.pdf'))!.toBeInTheDocument()})it('should update field value when users remove a file', () => {@@ -76,7 +76,7 @@ describe('FileUploaderField', () => {)const deleteButtons = screen.getAllByRole('button')- fireEvent.click(deleteButtons[1])+ fireEvent.click(deleteButtons[1]!)expect(mockField.handleChange).toHaveBeenCalledWith([])})})diff --git a/web/app/components/base/form/components/field/__tests__/variable-or-constant-input.spec.tsx b/web/app/components/base/form/components/field/__tests__/variable-or-constant-input.spec.tsxindex 4f1c9234fc2..b4aa8bd24e7 100644--- a/web/app/components/base/form/components/field/__tests__/variable-or-constant-input.spec.tsx+++ b/web/app/components/base/form/components/field/__tests__/variable-or-constant-input.spec.tsx@@ -16,33 +16,33 @@ describe('VariableOrConstantInputField', () => {it('should render variable picker by default', () => {render(<VariableOrConstantInputField label="Input source" />)- expect(screen.getByRole('button', { name: 'Variable picker' })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'Variable picker' }))!.toBeInTheDocument()})it('should switch to constant input when users choose constant', () => {render(<VariableOrConstantInputField label="Input source" />)- fireEvent.click(screen.getAllByRole('button')[1])+ fireEvent.click(screen.getAllByRole('button')[1]!)expect(screen.queryByRole('button', { name: 'Variable picker' })).not.toBeInTheDocument()- expect(screen.getByRole('textbox')).toBeInTheDocument()+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})it('should show typed constant value in the input', () => {render(<VariableOrConstantInputField label="Input source" />)- fireEvent.click(screen.getAllByRole('button')[1])+ fireEvent.click(screen.getAllByRole('button')[1]!)const textbox = screen.getByRole('textbox')fireEvent.change(textbox, { target: { value: 'constant-value' } })- expect(textbox).toHaveValue('constant-value')+ expect(textbox)!.toHaveValue('constant-value')})it('should switch back to variable mode when users choose variable again', () => {render(<VariableOrConstantInputField label="Input source" />)const modeButtons = screen.getAllByRole('button')- fireEvent.click(modeButtons[1])- expect(screen.getByRole('textbox')).toBeInTheDocument()+ fireEvent.click(modeButtons[1]!)+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()- fireEvent.click(modeButtons[0])- expect(screen.getByRole('button', { name: 'Variable picker' })).toBeInTheDocument()+ fireEvent.click(modeButtons[0]!)+ expect(screen.getByRole('button', { name: 'Variable picker' }))!.toBeInTheDocument()})it('should handle variable picker changes', () => {diff --git a/web/app/components/base/form/form-scenarios/base/index.tsx b/web/app/components/base/form/form-scenarios/base/index.tsxindex af552e4a815..3cc2d197aed 100644--- a/web/app/components/base/form/form-scenarios/base/index.tsx+++ b/web/app/components/base/form/form-scenarios/base/index.tsx@@ -23,7 +23,7 @@ const BaseForm = ({const result = schema.safeParse(value)if (!result.success) {const issues = result.error.issues- const firstIssue = issues[0].message+ const firstIssue = issues[0]!.messagereturn firstIssue}return undefineddiff --git a/web/app/components/base/form/form-scenarios/demo/index.tsx b/web/app/components/base/form/form-scenarios/demo/index.tsxindex f1a11b47884..44f59b67138 100644--- a/web/app/components/base/form/form-scenarios/demo/index.tsx+++ b/web/app/components/base/form/form-scenarios/demo/index.tsx@@ -14,7 +14,7 @@ const DemoForm = () => {if (!result.success) {const issues = result.error.issuesconsole.log('Validation errors:', issues)- return issues[0].message+ return issues[0]!.message}return undefined},diff --git a/web/app/components/base/form/hooks/use-check-validated.ts b/web/app/components/base/form/hooks/use-check-validated.tsindex 0a6cb20fc02..6530b3f0be5 100644--- a/web/app/components/base/form/hooks/use-check-validated.ts+++ b/web/app/components/base/form/hooks/use-check-validated.ts@@ -20,7 +20,7 @@ export const useCheckValidated = (form: AnyFormApi, FormSchemas: FormSchema[]) =const conditionValue = showOnValues[condition.variable]return conditionValue === condition.value})- const errors: any[] = show ? fields[key].errors : []+ const errors: any[] = show ? fields[key]!.errors : []return [...acc, ...errors]}, [] as string[])if (errorArray.length) {diff --git a/web/app/components/base/form/index.stories.tsx b/web/app/components/base/form/index.stories.tsxindex 0cd28379de7..c6d6638e3c9 100644--- a/web/app/components/base/form/index.stories.tsx+++ b/web/app/components/base/form/index.stories.tsx@@ -106,7 +106,7 @@ const FormPlayground = () => {onSubmit: ({ value: formValue }) => {const result = UserSchema.safeParse(formValue as typeof demoFormOpts.defaultValues)if (!result.success)- return result.error.issues[0].message+ return result.error.issues[0]!.messagereturn undefined},},diff --git a/web/app/components/base/form/utils/secret-input/index.ts b/web/app/components/base/form/utils/secret-input/index.tsindex e8458f90b2a..ba0eafce27d 100644--- a/web/app/components/base/form/utils/secret-input/index.ts+++ b/web/app/components/base/form/utils/secret-input/index.ts@@ -18,10 +18,10 @@ export const getTransformedValuesWhenSecretInputPristine = (formSchemas: FormSchconst isPristineSecretInputNames: string[] = []for (let i = 0; i < formSchemas.length; i++) {const schema = formSchemas[i]- if (schema.type === FormTypeEnum.secretInput) {- const fieldMeta = form?.getFieldMeta(schema.name)+ if (schema!.type === FormTypeEnum.secretInput) {+ const fieldMeta = form?.getFieldMeta(schema!.name)if (fieldMeta?.isPristine)- isPristineSecretInputNames.push(schema.name)+ isPristineSecretInputNames.push(schema!.name)}}diff --git a/web/app/components/base/grid-mask/__tests__/index.spec.tsx b/web/app/components/base/grid-mask/__tests__/index.spec.tsxindex 302d23a61ad..267e454ef05 100644--- a/web/app/components/base/grid-mask/__tests__/index.spec.tsx+++ b/web/app/components/base/grid-mask/__tests__/index.spec.tsx@@ -15,48 +15,48 @@ describe('GridMask', () => {describe('Rendering', () => {it('should render children in the content layer', () => {renderGridMask({}, <button>Run</button>)- expect(screen.getByRole('button', { name: 'Run' })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'Run' }))!.toBeInTheDocument()})it('should render correctly without optional className props', () => {const { wrapper, canvasLayer, gradientLayer, contentLayer } = renderGridMask({}, <span>Plain child</span>)- expect(wrapper).toHaveClass('bg-saas-background')- expect(canvasLayer).toHaveClass('absolute')- expect(gradientLayer).toHaveClass('absolute')- expect(contentLayer).toHaveTextContent('Plain child')+ expect(wrapper)!.toHaveClass('bg-saas-background')+ expect(canvasLayer)!.toHaveClass('absolute')+ expect(gradientLayer)!.toHaveClass('absolute')+ expect(contentLayer)!.toHaveTextContent('Plain child')})it('should render wrapper, canvas, gradient and content layers in order', () => {const { wrapper, canvasLayer, gradientLayer, contentLayer } = renderGridMask({}, <span>Content</span>)- expect(wrapper).toBeInTheDocument()+ expect(wrapper)!.toBeInTheDocument()expect(wrapper.children).toHaveLength(3)- expect(canvasLayer).toHaveClass('z-0')- expect(gradientLayer).toHaveClass('z-1')- expect(contentLayer).toHaveClass('z-2')- expect(contentLayer).toHaveTextContent('Content')+ expect(canvasLayer)!.toHaveClass('z-0')+ expect(gradientLayer)!.toHaveClass('z-1')+ expect(contentLayer)!.toHaveClass('z-2')+ expect(contentLayer)!.toHaveTextContent('Content')})})describe('Props', () => {it('should apply wrapperClassName to wrapper element', () => {const { wrapper } = renderGridMask({ wrapperClassName: 'custom-wrapper' }, <span>Child</span>)- expect(wrapper).toHaveClass('custom-wrapper')- expect(wrapper).toHaveClass('relative')+ expect(wrapper)!.toHaveClass('custom-wrapper')+ expect(wrapper)!.toHaveClass('relative')})it('should apply canvasClassName and grid background class to canvas layer', () => {const { canvasLayer } = renderGridMask({ canvasClassName: 'custom-canvas' }, <span>Child</span>)- expect(canvasLayer).toHaveClass('custom-canvas')- expect(canvasLayer).toHaveClass(Style.gridBg)+ expect(canvasLayer)!.toHaveClass('custom-canvas')+ expect(canvasLayer)!.toHaveClass(Style.gridBg!)})it('should apply gradientClassName to gradient layer', () => {const { gradientLayer } = renderGridMask({ gradientClassName: 'custom-gradient' }, <span>Child</span>)- expect(gradientLayer).toHaveClass('custom-gradient')- expect(gradientLayer).toHaveClass('bg-grid-mask-background')+ expect(gradientLayer)!.toHaveClass('custom-gradient')+ expect(gradientLayer)!.toHaveClass('bg-grid-mask-background')})})})diff --git a/web/app/components/base/icons/icon-gallery.stories.tsx b/web/app/components/base/icons/icon-gallery.stories.tsxindex 8d49f70ce20..d91e5672c3a 100644--- a/web/app/components/base/icons/icon-gallery.stories.tsx+++ b/web/app/components/base/icons/icon-gallery.stories.tsx@@ -59,7 +59,7 @@ const groupByCategory = (entries: IconEntry[]) => entries.reduce((acc, entry) =>if (!acc[entry.category])acc[entry.category] = []- acc[entry.category].push(entry)+ acc[entry.category]!.push(entry)return acc}, {} as Record<string, IconEntry[]>)@@ -221,7 +221,7 @@ const IconGalleryStory = () => {<section key={category} style={sectionStyle}><h2 style={{ margin: 0, fontSize: 18 }}>{category}</h2><div style={gridStyle}>- {grouped[category].map(entry => (+ {grouped[category]!.map(entry => (<div key={entry.path} style={cardStyle}><divstyle={{diff --git a/web/app/components/base/icons/utils.ts b/web/app/components/base/icons/utils.tsindex 51a1d705689..a26b276513f 100644--- a/web/app/components/base/icons/utils.ts+++ b/web/app/components/base/icons/utils.ts@@ -28,8 +28,8 @@ export function normalizeAttrs(attrs: Attrs = {}): Attrs {if (val === undefined)return acc- key = key.replace(/(-\w)/g, (g: string) => g[1].toUpperCase())- key = key.replace(/(:\w)/g, (g: string) => g[1].toUpperCase())+ key = key.replace(/(-\w)/g, (g: string) => g[1]!.toUpperCase())+ key = key.replace(/(:\w)/g, (g: string) => g[1]!.toUpperCase())// Additional filter after camelCase conversionif (key === 'xmlnsInkscape'@@ -49,7 +49,7 @@ export function normalizeAttrs(attrs: Attrs = {}): Attrs {const pairs = next?.split(':')if (pairs[0] && pairs[1]) {- const k = pairs[0].replace(/(-\w)/g, (g: string) => g[1].toUpperCase())+ const k = pairs[0].replace(/(-\w)/g, (g: string) => g[1]!.toUpperCase())prev[k] = pairs[1]}diff --git a/web/app/components/base/image-gallery/__tests__/index.spec.tsx b/web/app/components/base/image-gallery/__tests__/index.spec.tsxindex 61187f1c5f9..4975ac8f1cf 100644--- a/web/app/components/base/image-gallery/__tests__/index.spec.tsx+++ b/web/app/components/base/image-gallery/__tests__/index.spec.tsx@@ -11,7 +11,7 @@ describe('ImageGallery', () => {const imgs = getImages(container)expect(imgs).toHaveLength(1)- expect(imgs[0]).toHaveAttribute('src', 'https://example.com/img1.png')+ expect(imgs[0])!.toHaveAttribute('src', 'https://example.com/img1.png')})it('should render multiple images', () => {@@ -46,7 +46,7 @@ describe('ImageGallery', () => {const { container } = render(<ImageGallery srcs={['https://example.com/1.png']} />)const img = getImages(container)[0]- expect(img.style.maxWidth).toBe('100%')+ expect(img!.style.maxWidth).toBe('100%')})it('should apply calc(50% - 4px) width for 2 images', () => {@@ -88,11 +88,11 @@ describe('ImageGallery', () => {it('should show ImagePreview when an image is clicked', async () => {const user = userEvent.setup()const { container } = render(<ImageGallery srcs={['https://example.com/img1.png']} />)- await user.click(getImages(container)[0])+ await user.click(getImages(container)[0]!)const previewContainer = screen.queryByTestId('image-preview-container')- expect(previewContainer).toBeInTheDocument()- expect(previewContainer?.querySelector('img')).toHaveAttribute('src', 'https://example.com/img1.png')+ expect(previewContainer)!.toBeInTheDocument()+ expect(previewContainer?.querySelector('img'))!.toHaveAttribute('src', 'https://example.com/img1.png')})it('should show preview for the specific clicked image', async () => {@@ -100,18 +100,18 @@ describe('ImageGallery', () => {const srcs = ['https://example.com/1.png', 'https://example.com/2.png']const { container } = render(<ImageGallery srcs={srcs} />)- await user.click(getImages(container)[1])+ await user.click(getImages(container)[1]!)const previewContainer = screen.queryByTestId('image-preview-container')- expect(previewContainer?.querySelector('img')).toHaveAttribute('src', 'https://example.com/2.png')+ expect(previewContainer?.querySelector('img'))!.toHaveAttribute('src', 'https://example.com/2.png')})it('should hide ImagePreview when Escape is pressed', async () => {const user = userEvent.setup()const { container } = render(<ImageGallery srcs={['https://example.com/img1.png']} />)- await user.click(getImages(container)[0])- expect(screen.queryByTestId('image-preview-container')).toBeInTheDocument()+ await user.click(getImages(container)[0]!)+ expect(screen.queryByTestId('image-preview-container'))!.toBeInTheDocument()await user.keyboard('{Escape}')@@ -126,7 +126,7 @@ describe('ImageGallery', () => {const { container } = render(<ImageGallery srcs={['https://example.com/broken.png']} />)const img = getImages(container)[0]- fireEvent.error(img)+ fireEvent.error(img!)expect(getImages(container)).toHaveLength(0)})diff --git a/web/app/components/base/image-uploader/__tests__/hooks.spec.ts b/web/app/components/base/image-uploader/__tests__/hooks.spec.tsindex b3b1469f445..f01f00b779d 100644--- a/web/app/components/base/image-uploader/__tests__/hooks.spec.ts+++ b/web/app/components/base/image-uploader/__tests__/hooks.spec.ts@@ -64,7 +64,7 @@ describe('useImageFiles', () => {})expect(result.current.files).toHaveLength(1)- expect(result.current.files[0]._id).toBe('file-1')+ expect(result.current.files[0]!._id).toBe('file-1')})it('should update an existing file via onUpload when _id matches', () => {@@ -80,7 +80,7 @@ describe('useImageFiles', () => {})expect(result.current.files).toHaveLength(1)- expect(result.current.files[0].progress).toBe(50)+ expect(result.current.files[0]!.progress).toBe(50)})it('should mark a file as deleted via onRemove', () => {@@ -127,7 +127,7 @@ describe('useImageFiles', () => {result.current.onImageLinkLoadError('file-1')})- expect(result.current.files[0].progress).toBe(-1)+ expect(result.current.files[0]!.progress).toBe(-1)})it('should not modify files when onImageLinkLoadError is called with non-existent id', () => {@@ -142,7 +142,7 @@ describe('useImageFiles', () => {result.current.onImageLinkLoadError('non-existent')})- expect(result.current.files[0].progress).toBe(0)+ expect(result.current.files[0]!.progress).toBe(0)})it('should set progress to 100 via onImageLinkLoadSuccess', () => {@@ -157,7 +157,7 @@ describe('useImageFiles', () => {result.current.onImageLinkLoadSuccess('file-1')})- expect(result.current.files[0].progress).toBe(100)+ expect(result.current.files[0]!.progress).toBe(100)})it('should not modify files when onImageLinkLoadSuccess is called with non-existent id', () => {@@ -172,7 +172,7 @@ describe('useImageFiles', () => {result.current.onImageLinkLoadSuccess('non-existent')})- expect(result.current.files[0].progress).toBe(50)+ expect(result.current.files[0]!.progress).toBe(50)})it('should clear all files via onClear', () => {@@ -241,13 +241,13 @@ describe('useImageFiles', () => {result.current.onReUpload('file-1')})- const uploadCall = mockImageUpload.mock.calls[0][0]+ const uploadCall = mockImageUpload.mock.calls[0]![0]act(() => {uploadCall.onProgressCallback(50)})- expect(result.current.files[0].progress).toBe(50)+ expect(result.current.files[0]!.progress).toBe(50)})it('should update fileId and progress on success callback during re-upload', () => {@@ -263,14 +263,14 @@ describe('useImageFiles', () => {result.current.onReUpload('file-1')})- const uploadCall = mockImageUpload.mock.calls[0][0]+ const uploadCall = mockImageUpload.mock.calls[0]![0]act(() => {uploadCall.onSuccessCallback({ id: 'server-file-123' })})- expect(result.current.files[0].fileId).toBe('server-file-123')- expect(result.current.files[0].progress).toBe(100)+ expect(result.current.files[0]!.fileId).toBe('server-file-123')+ expect(result.current.files[0]!.progress).toBe(100)})it('should set progress to -1 and notify on error callback during re-upload', () => {@@ -286,13 +286,13 @@ describe('useImageFiles', () => {result.current.onReUpload('file-1')})- const uploadCall = mockImageUpload.mock.calls[0][0]+ const uploadCall = mockImageUpload.mock.calls[0]![0]act(() => {uploadCall.onErrorCallback(new Error('Network error'))})- expect(result.current.files[0].progress).toBe(-1)+ expect(result.current.files[0]!.progress).toBe(-1)expect(mockNotify).toHaveBeenCalledWith({ type: 'error', message: 'Upload error' })})})@@ -425,7 +425,7 @@ describe('useLocalFileUploader', () => {expect(mockImageUpload).toHaveBeenCalled()})- const uploadCall = mockImageUpload.mock.calls[0][0]+ const uploadCall = mockImageUpload.mock.calls[0]![0]act(() => {uploadCall.onProgressCallback(75)@@ -452,7 +452,7 @@ describe('useLocalFileUploader', () => {expect(mockImageUpload).toHaveBeenCalled()})- const uploadCall = mockImageUpload.mock.calls[0][0]+ const uploadCall = mockImageUpload.mock.calls[0]![0]act(() => {uploadCall.onSuccessCallback({ id: 'uploaded-id' })@@ -479,7 +479,7 @@ describe('useLocalFileUploader', () => {expect(mockImageUpload).toHaveBeenCalled()})- const uploadCall = mockImageUpload.mock.calls[0][0]+ const uploadCall = mockImageUpload.mock.calls[0]![0]act(() => {uploadCall.onErrorCallback(new Error('fail'))diff --git a/web/app/components/base/image-uploader/__tests__/utils.spec.ts b/web/app/components/base/image-uploader/__tests__/utils.spec.tsindex 05962876545..2bbea9c23bd 100644--- a/web/app/components/base/image-uploader/__tests__/utils.spec.ts+++ b/web/app/components/base/image-uploader/__tests__/utils.spec.ts@@ -78,7 +78,7 @@ describe('image-uploader utils', () => {expect(upload).toHaveBeenCalledTimes(1)- const [options, isPublic, url] = vi.mocked(upload).mock.calls[0]+ const [options, isPublic, url] = (vi.mocked(upload).mock.calls[0] ?? []) as [any, any, any]expect(isPublic).toBe(true)expect(url).toBe('/files/upload')expect(options.xhr).toBeInstanceOf(XMLHttpRequest)diff --git a/web/app/components/base/image-uploader/hooks.ts b/web/app/components/base/image-uploader/hooks.tsindex 8a1a082b0fc..ec1b1248f18 100644--- a/web/app/components/base/image-uploader/hooks.ts+++ b/web/app/components/base/image-uploader/hooks.ts@@ -31,7 +31,7 @@ export const useImageFiles = () => {const files = filesRef.currentconst index = files.findIndex(file => file._id === imageFileId)if (index > -1) {- const currentFile = files[index]+ const currentFile = files[index]!const newFiles = [...files.slice(0, index), { ...currentFile, deleted: true }, ...files.slice(index + 1)]setFiles(newFiles)filesRef.current = newFiles@@ -41,7 +41,7 @@ export const useImageFiles = () => {const files = filesRef.currentconst index = files.findIndex(file => file._id === imageFileId)if (index > -1) {- const currentFile = files[index]+ const currentFile = files[index]!const newFiles = [...files.slice(0, index), { ...currentFile, progress: -1 }, ...files.slice(index + 1)]filesRef.current = newFilessetFiles(newFiles)@@ -51,7 +51,7 @@ export const useImageFiles = () => {const files = filesRef.currentconst index = files.findIndex(file => file._id === imageFileId)if (index > -1) {- const currentImageFile = files[index]+ const currentImageFile = files[index]!const newFiles = [...files.slice(0, index), { ...currentImageFile, progress: 100 }, ...files.slice(index + 1)]filesRef.current = newFilessetFiles(newFiles)@@ -61,9 +61,9 @@ export const useImageFiles = () => {const files = filesRef.currentconst index = files.findIndex(file => file._id === imageFileId)if (index > -1) {- const currentImageFile = files[index]+ const currentImageFile = files[index]!imageUpload({- file: currentImageFile.file!,+ file: currentImageFile!.file!,onProgressCallback: (progress) => {const newFiles = [...files.slice(0, index), { ...currentImageFile, progress }, ...files.slice(index + 1)]filesRef.current = newFiles@@ -114,7 +114,7 @@ export const useLocalFileUploader = ({ limit, disabled = false, onUpload }: useL// TODO: leave some warnings?return}- if (!ALLOW_FILE_EXTENSIONS.includes(file.type.split('/')[1]))+ if (!ALLOW_FILE_EXTENSIONS.includes(file.type.split('/')[1]!))returnif (limit && file.size > limit * 1024 * 1024) {toast.error(t('imageUploader.uploadFromComputerLimit', { ns: 'common', size: limit }))diff --git a/web/app/components/base/image-uploader/image-preview.tsx b/web/app/components/base/image-uploader/image-preview.tsxindex d906132e9b2..4ae6ccb7e6a 100644--- a/web/app/components/base/image-uploader/image-preview.tsx+++ b/web/app/components/base/image-uploader/image-preview.tsx@@ -99,7 +99,7 @@ const ImagePreview: FC<ImagePreviewProps> = ({const shareImage = async () => {try {const base64Data = url.split(',')[1]- const blob = imageBase64ToBlob(base64Data, 'image/png')+ const blob = imageBase64ToBlob(base64Data!, 'image/png')await navigator.clipboard.write([new ClipboardItem({diff --git a/web/app/components/base/input/__tests__/index.spec.tsx b/web/app/components/base/input/__tests__/index.spec.tsxindex 1c50454962c..7dc5d22eabc 100644--- a/web/app/components/base/input/__tests__/index.spec.tsx+++ b/web/app/components/base/input/__tests__/index.spec.tsx@@ -36,7 +36,7 @@ describe('Input component', () => {it('renders correctly with default props', () => {render(<Input />)const input = screen.getByPlaceholderText(/input/i)- expect(input).toBeInTheDocument()+ expect(input)!.toBeInTheDocument()expect(input).not.toBeDisabled()expect(input).not.toHaveClass('cursor-not-allowed')})@@ -44,17 +44,17 @@ describe('Input component', () => {it('shows left icon when showLeftIcon is true', () => {render(<Input showLeftIcon />)const searchIcon = document.querySelector('.i-ri-search-line')- expect(searchIcon).toBeInTheDocument()+ expect(searchIcon)!.toBeInTheDocument()const input = screen.getByPlaceholderText(/search/i)- expect(input).toHaveClass('pl-[26px]')+ expect(input)!.toHaveClass('pl-[26px]')})it('shows clear icon when showClearIcon is true and has value', () => {render(<Input showClearIcon value="test" />)const clearIcon = document.querySelector('.i-ri-close-circle-fill')- expect(clearIcon).toBeInTheDocument()+ expect(clearIcon)!.toBeInTheDocument()const input = screen.getByDisplayValue('test')- expect(input).toHaveClass('pr-[26px]')+ expect(input)!.toHaveClass('pr-[26px]')})it('does not show clear icon when disabled, even with value', () => {@@ -74,23 +74,23 @@ describe('Input component', () => {it('shows warning icon when destructive is true', () => {render(<Input destructive />)const warningIcon = document.querySelector('.i-ri-error-warning-line')- expect(warningIcon).toBeInTheDocument()+ expect(warningIcon)!.toBeInTheDocument()const input = screen.getByPlaceholderText(/input/i)- expect(input).toHaveClass('border-components-input-border-destructive')+ expect(input)!.toHaveClass('border-components-input-border-destructive')})it('applies disabled styles when disabled', () => {render(<Input disabled />)const input = screen.getByPlaceholderText(/input/i)- expect(input).toBeDisabled()- expect(input).toHaveClass('cursor-not-allowed')- expect(input).toHaveClass('bg-components-input-bg-disabled')+ expect(input)!.toBeDisabled()+ expect(input)!.toHaveClass('cursor-not-allowed')+ expect(input)!.toHaveClass('bg-components-input-bg-disabled')})it('displays custom unit when provided', () => {render(<Input unit="km" />)const unitElement = screen.getByText('km')- expect(unitElement).toBeInTheDocument()+ expect(unitElement)!.toBeInTheDocument()})it('applies custom className and style', () => {@@ -98,8 +98,8 @@ describe('Input component', () => {const customStyle = { color: 'red' }render(<Input className={customClass} styleCss={customStyle} />)const input = screen.getByPlaceholderText(/input/i)- expect(input).toHaveClass(customClass)- expect(input).toHaveStyle({ color: 'red' })+ expect(input)!.toHaveClass(customClass)+ expect(input)!.toHaveStyle({ color: 'red' })})it('applies large size variant correctly', () => {@@ -112,41 +112,41 @@ describe('Input component', () => {const placeholder = 'Custom placeholder'render(<Input placeholder={placeholder} />)const input = screen.getByPlaceholderText(placeholder)- expect(input).toBeInTheDocument()+ expect(input)!.toBeInTheDocument()})describe('Additional Layout Branches', () => {it('applies pl-7 when showLeftIcon and size is large', () => {render(<Input showLeftIcon size="large" />)const input = screen.getByRole('textbox')- expect(input).toHaveClass('pl-7')+ expect(input)!.toHaveClass('pl-7')})it('applies pr-7 when showClearIcon, has value, and size is large', () => {render(<Input showClearIcon value="123" size="large" onChange={vi.fn()} />)const input = screen.getByRole('textbox')- expect(input).toHaveClass('pr-7')+ expect(input)!.toHaveClass('pr-7')})it('applies pr-7 when destructive and size is large', () => {render(<Input destructive size="large" />)const input = screen.getByRole('textbox')- expect(input).toHaveClass('pr-7')+ expect(input)!.toHaveClass('pr-7')})it('shows copy icon and applies pr-[26px] when showCopyIcon is true', () => {render(<Input showCopyIcon />)const input = screen.getByRole('textbox')- expect(input).toHaveClass('pr-[26px]')+ expect(input)!.toHaveClass('pr-[26px]')// Assert that CopyFeedbackNew wrapper is presentconst copyWrapper = document.querySelector('.group.absolute.right-0')- expect(copyWrapper).toBeInTheDocument()+ expect(copyWrapper)!.toBeInTheDocument()})it('shows copy icon and applies pr-7 when showCopyIcon and size is large', () => {render(<Input showCopyIcon size="large" value="my-val" onChange={vi.fn()} />)const input = screen.getByRole('textbox')- expect(input).toHaveClass('pr-7')+ expect(input)!.toHaveClass('pr-7')})})@@ -198,10 +198,10 @@ describe('Input component', () => {fireEvent.blur(input)expect(onChange).toHaveBeenCalledTimes(1)- expect(onChange.mock.calls[0][0].type).toBe('change')- expect(onChange.mock.calls[0][0].target.value).toBe('12')+ expect(onChange.mock.calls[0]![0].type).toBe('change')+ expect(onChange.mock.calls[0]![0].target.value).toBe('12')expect(onBlur).toHaveBeenCalledTimes(1)- expect(onBlur.mock.calls[0][0].target.value).toBe('12')+ expect(onBlur.mock.calls[0]![0].target.value).toBe('12')})it('does not trigger change on blur-sm when value is already normalized', () => {@@ -214,7 +214,7 @@ describe('Input component', () => {expect(onChange).not.toHaveBeenCalled()expect(onBlur).toHaveBeenCalledTimes(1)- expect(onBlur.mock.calls[0][0].target.value).toBe('12')+ expect(onBlur.mock.calls[0]![0].target.value).toBe('12')})})})diff --git a/web/app/components/base/markdown-blocks/__tests__/code-block.spec.tsx b/web/app/components/base/markdown-blocks/__tests__/code-block.spec.tsxindex 2eebe44af9f..a3d28a3b5e9 100644--- a/web/app/components/base/markdown-blocks/__tests__/code-block.spec.tsx+++ b/web/app/components/base/markdown-blocks/__tests__/code-block.spec.tsx@@ -121,7 +121,7 @@ vi.mock('@/app/components/base/mermaid', () => ({const findEchartsHost = async () => {await waitFor(() => {- expect(document.querySelector('.echarts-for-react')).toBeInTheDocument()+ expect(document.querySelector('.echarts-for-react'))!.toBeInTheDocument()})return document.querySelector('.echarts-for-react') as HTMLDivElement}@@ -214,7 +214,7 @@ describe('CodeBlock', () => {it('should render syntax-highlighted output when language is standard', async () => {render(<CodeBlock className="language-javascript">const x = 1;</CodeBlock>)- expect(screen.getByText('JavaScript')).toBeInTheDocument()+ expect(screen.getByText('JavaScript'))!.toBeInTheDocument()await waitFor(() => {expect(document.querySelector('code.language-javascript')?.textContent).toContain('const x = 1;')})@@ -223,7 +223,7 @@ describe('CodeBlock', () => {it('should format unknown language labels with capitalized fallback when language is not in map', () => {render(<CodeBlock className="language-ruby">puts "ok"</CodeBlock>)- expect(screen.getByText('Ruby')).toBeInTheDocument()+ expect(screen.getByText('Ruby'))!.toBeInTheDocument()})// it('should render mermaid controls when language is mermaid', async () => {@@ -235,24 +235,24 @@ describe('CodeBlock', () => {it('should render mermaid block when language is mermaid', async () => {render(<CodeBlock className="language-mermaid">{'graph TD; A-->B;'}</CodeBlock>)- expect(screen.getByText('Mermaid')).toBeInTheDocument()- expect(await screen.findByTestId('mock-mermaid')).toHaveTextContent('graph TD; A-->B;')+ expect(screen.getByText('Mermaid'))!.toBeInTheDocument()+ expect(await screen.findByTestId('mock-mermaid'))!.toHaveTextContent('graph TD; A-->B;')})it('should render abc section header when language is abc', () => {render(<CodeBlock className="language-abc">X:1\nT:test</CodeBlock>)- expect(screen.getByText('ABC')).toBeInTheDocument()+ expect(screen.getByText('ABC'))!.toBeInTheDocument()})it('should hide svg renderer when toggle is clicked for svg language', async () => {const user = userEvent.setup()render(<CodeBlock className="language-svg">{'<svg/>'}</CodeBlock>)- expect(await screen.findByText(/Error rendering SVG/i)).toBeInTheDocument()+ expect(await screen.findByText(/Error rendering SVG/i))!.toBeInTheDocument()const svgToggleButton = screen.getAllByRole('button')[0]- await user.click(svgToggleButton)+ await user.click(svgToggleButton!)expect(screen.queryByText(/Error rendering SVG/i)).not.toBeInTheDocument()})@@ -262,7 +262,7 @@ describe('CodeBlock', () => {render(<CodeBlock className="language-javascript">const y = 2;</CodeBlock>)- expect(screen.getByText('JavaScript')).toBeInTheDocument()+ expect(screen.getByText('JavaScript'))!.toBeInTheDocument()await waitFor(() => {expect(document.querySelector('code.language-javascript')?.textContent).toContain('const y = 2;')})@@ -274,7 +274,7 @@ describe('CodeBlock', () => {render(<CodeBlock className="language-javascript">const z = 3;</CodeBlock>)await waitFor(() => {- expect(screen.getByText('const z = 3;')).toBeInTheDocument()+ expect(screen.getByText('const z = 3;'))!.toBeInTheDocument()})expect(document.querySelector('code.language-javascript')).toBeNull()})@@ -285,53 +285,53 @@ describe('CodeBlock', () => {it('should show loading indicator when echarts content is empty', () => {render(<CodeBlock className="language-echarts"></CodeBlock>)- expect(screen.getByText(/Chart loading.../i)).toBeInTheDocument()+ expect(screen.getByText(/Chart loading.../i))!.toBeInTheDocument()})it('should keep loading when echarts content is whitespace only', () => {render(<CodeBlock className="language-echarts">{' '}</CodeBlock>)- expect(screen.getByText(/Chart loading.../i)).toBeInTheDocument()+ expect(screen.getByText(/Chart loading.../i))!.toBeInTheDocument()})it('should render echarts with parsed option when JSON is valid', async () => {const option = { title: [{ text: 'Hello' }] }render(<CodeBlock className="language-echarts">{JSON.stringify(option)}</CodeBlock>)- expect(await findEchartsHost()).toBeInTheDocument()+ expect(await findEchartsHost())!.toBeInTheDocument()expect(screen.queryByText(/Chart loading.../i)).not.toBeInTheDocument()})it('should use error option when echarts content is invalid but structurally complete', async () => {render(<CodeBlock className="language-echarts">{'{a:1}'}</CodeBlock>)- expect(await findEchartsHost()).toBeInTheDocument()+ expect(await findEchartsHost())!.toBeInTheDocument()expect(screen.queryByText(/Chart loading.../i)).not.toBeInTheDocument()})it('should use error option when echarts content is invalid non-structured text', async () => {render(<CodeBlock className="language-echarts">{'not a json {'}</CodeBlock>)- expect(await findEchartsHost()).toBeInTheDocument()+ expect(await findEchartsHost())!.toBeInTheDocument()expect(screen.queryByText(/Chart loading.../i)).not.toBeInTheDocument()})it('should keep loading when option is valid JSON but not an object', async () => {render(<CodeBlock className="language-echarts">"text-value"</CodeBlock>)- expect(await screen.findByText(/Chart loading.../i)).toBeInTheDocument()+ expect(await screen.findByText(/Chart loading.../i))!.toBeInTheDocument()})it('should keep loading when echarts content matches incomplete quote-pattern guard', async () => {render(<CodeBlock className="language-echarts">{'x{"a":1'}</CodeBlock>)- expect(await screen.findByText(/Chart loading.../i)).toBeInTheDocument()+ expect(await screen.findByText(/Chart loading.../i))!.toBeInTheDocument()})it('should keep loading when echarts content has unmatched opening array bracket', async () => {render(<CodeBlock className="language-echarts">[[1,2]</CodeBlock>)- expect(await screen.findByText(/Chart loading.../i)).toBeInTheDocument()+ expect(await screen.findByText(/Chart loading.../i))!.toBeInTheDocument()})it('should keep chart instance stable when window resize is triggered', async () => {@@ -343,7 +343,7 @@ describe('CodeBlock', () => {window.dispatchEvent(new Event('resize'))})- expect(await findEchartsHost()).toBeInTheDocument()+ expect(await findEchartsHost())!.toBeInTheDocument()})it('should keep rendering when echarts content updates repeatedly', async () => {@@ -355,7 +355,7 @@ describe('CodeBlock', () => {rerender(<CodeBlock className="language-echarts">{'{"a":4}'}</CodeBlock>)rerender(<CodeBlock className="language-echarts">{'{"a":5}'}</CodeBlock>)- expect(await findEchartsHost()).toBeInTheDocument()+ expect(await findEchartsHost())!.toBeInTheDocument()})it('should stop processing extra finished events when chart finished callback fires repeatedly', async () => {@@ -374,27 +374,27 @@ describe('CodeBlock', () => {await new Promise(resolve => setTimeout(resolve, 500))})- expect(await findEchartsHost()).toBeInTheDocument()+ expect(await findEchartsHost())!.toBeInTheDocument()})it('should switch from loading to chart when streaming content becomes valid JSON', async () => {const { rerender } = render(<CodeBlock className="language-echarts">{'{ "a":'}</CodeBlock>)- expect(screen.getByText(/Chart loading.../i)).toBeInTheDocument()+ expect(screen.getByText(/Chart loading.../i))!.toBeInTheDocument()rerender(<CodeBlock className="language-echarts">{'{ "a": 1 }'}</CodeBlock>)- expect(await findEchartsHost()).toBeInTheDocument()+ expect(await findEchartsHost())!.toBeInTheDocument()})it('should parse array JSON after previously incomplete streaming content', async () => {const parseSpy = vi.spyOn(JSON, 'parse')parseSpy.mockImplementationOnce(() => ({ series: [] }) as unknown as object)const { rerender } = render(<CodeBlock className="language-echarts">[1, 2</CodeBlock>)- expect(screen.getByText(/Chart loading.../i)).toBeInTheDocument()+ expect(screen.getByText(/Chart loading.../i))!.toBeInTheDocument()rerender(<CodeBlock className="language-echarts">[1, 2]</CodeBlock>)- expect(await findEchartsHost()).toBeInTheDocument()+ expect(await findEchartsHost())!.toBeInTheDocument()parseSpy.mockRestore()})@@ -404,7 +404,7 @@ describe('CodeBlock', () => {render(<CodeBlock className="language-echarts">abcde</CodeBlock>)- expect(await findEchartsHost()).toBeInTheDocument()+ expect(await findEchartsHost())!.toBeInTheDocument()parseSpy.mockRestore()})@@ -412,14 +412,14 @@ describe('CodeBlock', () => {mockUseTheme.mockReturnValue({ theme: Theme.dark })render(<CodeBlock className="language-echarts">{'{"series":[]}'}</CodeBlock>)- expect(await findEchartsHost()).toBeInTheDocument()+ expect(await findEchartsHost())!.toBeInTheDocument()})it('should render dark mode error option when app theme is dark and echarts content is invalid', async () => {mockUseTheme.mockReturnValue({ theme: Theme.dark })render(<CodeBlock className="language-echarts">{'{a:1}'}</CodeBlock>)- expect(await findEchartsHost()).toBeInTheDocument()+ expect(await findEchartsHost())!.toBeInTheDocument()})it('should wire resize listener when echarts view re-enters with a ready chart instance', async () => {@@ -433,7 +433,7 @@ describe('CodeBlock', () => {window.dispatchEvent(new Event('resize'))})- expect(await findEchartsHost()).toBeInTheDocument()+ expect(await findEchartsHost())!.toBeInTheDocument()unmount()})diff --git a/web/app/components/base/markdown-blocks/__tests__/form.spec.tsx b/web/app/components/base/markdown-blocks/__tests__/form.spec.tsxindex 9c88b8a0a62..ebf70b6b77c 100644--- a/web/app/components/base/markdown-blocks/__tests__/form.spec.tsx+++ b/web/app/components/base/markdown-blocks/__tests__/form.spec.tsx@@ -92,11 +92,11 @@ describe('MarkdownForm', () => {render(<MarkdownForm node={node} />)- expect(screen.getByText('Name')).toBeInTheDocument()- expect(screen.getByPlaceholderText('Enter name')).toBeInTheDocument()- expect(screen.getByPlaceholderText('Enter bio')).toBeInTheDocument()- expect(screen.getByRole('button', { name: 'Submit' })).toBeInTheDocument()- expect(screen.getByText(UNSUPPORTED_TAG_ARTICLE_RE)).toBeInTheDocument()+ expect(screen.getByText('Name'))!.toBeInTheDocument()+ expect(screen.getByPlaceholderText('Enter name'))!.toBeInTheDocument()+ expect(screen.getByPlaceholderText('Enter bio'))!.toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'Submit' }))!.toBeInTheDocument()+ expect(screen.getByText(UNSUPPORTED_TAG_ARTICLE_RE))!.toBeInTheDocument()})})@@ -221,7 +221,7 @@ describe('MarkdownForm', () => {try {render(<MarkdownForm node={node} />)- expect(screen.getByRole('button', { name: 'Submit' })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'Submit' }))!.toBeInTheDocument()expect(consoleErrorSpy).toHaveBeenCalled()}finally {@@ -413,7 +413,7 @@ describe('MarkdownForm', () => {// Click the "Now" button in the footer to select current time (calls onChange)const nowButtons = await screen.findAllByText('time.operation.now')- await user.click(nowButtons[0])+ await user.click(nowButtons[0]!)// Submit the formawait user.click(screen.getByRole('button', { name: 'Submit' }))@@ -529,7 +529,7 @@ describe('MarkdownForm', () => {await user.click(button)await waitFor(() => {- expect(button).toBeDisabled()+ expect(button)!.toBeDisabled()})})@@ -586,7 +586,7 @@ describe('MarkdownForm', () => {render(<MarkdownForm node={node} />)const button = screen.getByRole('button', { name: 'Go' })- expect(button).toBeInTheDocument()+ expect(button)!.toBeInTheDocument()})it('should ignore invalid variant and size values', () => {@@ -596,7 +596,7 @@ describe('MarkdownForm', () => {render(<MarkdownForm node={node} />)- expect(screen.getByRole('button', { name: 'Go' })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'Go' }))!.toBeInTheDocument()})})@@ -610,7 +610,7 @@ describe('MarkdownForm', () => {render(<MarkdownForm node={node} />)const input = screen.getByPlaceholderText('Password')- expect(input).toHaveAttribute('type', 'password')+ expect(input)!.toHaveAttribute('type', 'password')})it('should render email input', () => {@@ -620,7 +620,7 @@ describe('MarkdownForm', () => {render(<MarkdownForm node={node} />)- expect(screen.getByPlaceholderText('Email')).toHaveAttribute('type', 'email')+ expect(screen.getByPlaceholderText('Email'))!.toHaveAttribute('type', 'email')})it('should render number input', () => {@@ -630,7 +630,7 @@ describe('MarkdownForm', () => {render(<MarkdownForm node={node} />)- expect(screen.getByPlaceholderText('Age')).toHaveAttribute('type', 'number')+ expect(screen.getByPlaceholderText('Age'))!.toHaveAttribute('type', 'number')})it('should submit typed value from password input', async () => {@@ -664,7 +664,7 @@ describe('MarkdownForm', () => {render(<MarkdownForm node={node} />)expect(screen.queryByRole('slider')).not.toBeInTheDocument()- expect(screen.getByText(UNSUPPORTED_TAG_RE)).toBeInTheDocument()+ expect(screen.getByText(UNSUPPORTED_TAG_RE))!.toBeInTheDocument()})})@@ -689,7 +689,7 @@ describe('MarkdownForm', () => {render(<MarkdownForm node={node} />)- expect(screen.getByTestId('checkbox-agree')).toBeInTheDocument()+ expect(screen.getByTestId('checkbox-agree'))!.toBeInTheDocument()})it('should render select with no options when dataOptions is missing', () => {@@ -700,7 +700,8 @@ describe('MarkdownForm', () => {render(<MarkdownForm node={node} />)// Select renders with empty items list- expect(screen.getByTestId('markdown-form')).toBeInTheDocument()+ // Select renders with empty items list+ expect(screen.getByTestId('markdown-form'))!.toBeInTheDocument()})it('should render button with empty text when children array is empty', () => {diff --git a/web/app/components/base/markdown-with-directive/index.tsx b/web/app/components/base/markdown-with-directive/index.tsxindex 8b5f5162c06..552d8a3aaa2 100644--- a/web/app/components/base/markdown-with-directive/index.tsx+++ b/web/app/components/base/markdown-with-directive/index.tsx@@ -104,9 +104,9 @@ function buildDirectiveRehypePlugins(): PluggableList {}return [- defaultRehypePlugins.raw,+ defaultRehypePlugins.raw!,[sanitizePlugin, sanitizeSchema] as Pluggable,- defaultRehypePlugins.harden,+ defaultRehypePlugins.harden!,]}@@ -122,12 +122,12 @@ function normalizeDirectiveAttributeBlocks(markdown: string): string {const directivePrefix = match[1]const attributeBlocks = match[2]- const attrMatches = [...attributeBlocks.matchAll(ATTRIBUTE_BLOCK_REGEX)]+ const attrMatches = [...attributeBlocks!.matchAll(ATTRIBUTE_BLOCK_REGEX)]if (attrMatches.length === 0)return lineconst mergedAttributes = attrMatches- .map(result => result[1].trim())+ .map(result => result[1]!.trim()).filter(Boolean).join(' ')diff --git a/web/app/components/base/markdown/__tests__/index.spec.tsx b/web/app/components/base/markdown/__tests__/index.spec.tsxindex 8e4ce7e0ce4..f28635650a2 100644--- a/web/app/components/base/markdown/__tests__/index.spec.tsx+++ b/web/app/components/base/markdown/__tests__/index.spec.tsx@@ -32,7 +32,7 @@ type CapturedProps = {const getLastWrapperProps = (): CapturedProps => {const calls = mockReactMarkdownWrapper.mock.callsconst lastCall = calls[calls.length - 1]- return lastCall[0] as CapturedProps+ return lastCall![0] as CapturedProps}describe('Markdown', () => {@@ -42,19 +42,19 @@ describe('Markdown', () => {it('should render wrapper content', () => {render(<Markdown content="Hello World" />)- expect(screen.getByTestId('react-markdown-wrapper')).toHaveTextContent('Hello World')+ expect(screen.getByTestId('react-markdown-wrapper'))!.toHaveTextContent('Hello World')})it('should apply default classes', () => {const { container } = render(<Markdown content="Test" />)const markdownDiv = container.querySelector('.markdown-body')- expect(markdownDiv).toHaveClass('markdown-body', 'text-text-primary!')+ expect(markdownDiv)!.toHaveClass('markdown-body', 'text-text-primary!')})it('should merge custom className with default classes', () => {const { container } = render(<Markdown content="Test" className="custom another" />)const markdownDiv = container.querySelector('.markdown-body')- expect(markdownDiv).toHaveClass('markdown-body', 'text-text-primary!', 'custom', 'another')+ expect(markdownDiv)!.toHaveClass('markdown-body', 'text-text-primary!', 'custom', 'another')})it('should not include undefined in className', () => {diff --git a/web/app/components/base/markdown/__tests__/streamdown-wrapper.spec.tsx b/web/app/components/base/markdown/__tests__/streamdown-wrapper.spec.tsxindex 7bc4748339b..2db4d9218c8 100644--- a/web/app/components/base/markdown/__tests__/streamdown-wrapper.spec.tsx+++ b/web/app/components/base/markdown/__tests__/streamdown-wrapper.spec.tsx@@ -37,7 +37,9 @@ describe('StreamdownWrapper', () => {// Assert - check that ~ is rendered as text, not as strikethrough (del element)// The content should contain the tilde as literal text- expect(screen.getByText(TILDE_RANGE_RE)).toBeInTheDocument()+ // Assert - check that ~ is rendered as text, not as strikethrough (del element)+ // The content should contain the tilde as literal text+ expect(screen.getByText(TILDE_RANGE_RE))!.toBeInTheDocument()expect(document.querySelector('del')).toBeNull()})@@ -65,10 +67,11 @@ describe('StreamdownWrapper', () => {// Only double tildes should create strikethroughconst delElements = document.querySelectorAll('del')expect(delElements).toHaveLength(1)- expect(delElements[0].textContent).toBe('removed feature')+ expect(delElements[0]!.textContent).toBe('removed feature')// Single tilde should remain as literal text- expect(screen.getByText(TILDE_RANGE_RE)).toBeInTheDocument()+ // Single tilde should remain as literal text+ expect(screen.getByText(TILDE_RANGE_RE))!.toBeInTheDocument()})})@@ -81,7 +84,8 @@ describe('StreamdownWrapper', () => {render(<StreamdownWrapper latexContent={content} />)// Assert- expect(screen.getByText('Hello World')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('Hello World'))!.toBeInTheDocument()})it('should render bold text', () => {@@ -92,7 +96,8 @@ describe('StreamdownWrapper', () => {render(<StreamdownWrapper latexContent={content} />)// Assert- expect(screen.getByText('bold text')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('bold text'))!.toBeInTheDocument()expect(document.querySelector('[data-streamdown="strong"]')).not.toBeNull()})@@ -104,7 +109,8 @@ describe('StreamdownWrapper', () => {render(<StreamdownWrapper latexContent={content} />)// Assert- expect(screen.getByText('italic text')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('italic text'))!.toBeInTheDocument()expect(document.querySelector('em')).not.toBeNull()})@@ -113,7 +119,8 @@ describe('StreamdownWrapper', () => {render(<StreamdownWrapper latexContent="" />)// Assert- expect(screen.getByTestId('img')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('img'))!.toBeInTheDocument()})it('should render a CodeBlock component for code markdown', async () => {@@ -126,7 +133,7 @@ describe('StreamdownWrapper', () => {// Assert// We mocked code block to return <code>{children}</code>const codeElement = await screen.findByText('console.log("hello")')- expect(codeElement).toBeInTheDocument()+ expect(codeElement)!.toBeInTheDocument()})})@@ -140,7 +147,8 @@ describe('StreamdownWrapper', () => {render(<StreamdownWrapper latexContent={content} pluginInfo={pluginInfo} />)// Assert- expect(screen.getByTestId('plugin-img')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('plugin-img'))!.toBeInTheDocument()expect(screen.queryByTestId('img')).toBeNull()expect(screen.getAllByTestId('plugin-paragraph').length).toBeGreaterThan(0)@@ -159,7 +167,8 @@ describe('StreamdownWrapper', () => {render(<StreamdownWrapper latexContent="[link](https://example.com)" customComponents={customComponents} />)// Assert- expect(screen.getByTestId('custom-link')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('custom-link'))!.toBeInTheDocument()})it('should disallow customDisallowedElements', () => {@@ -177,7 +186,8 @@ describe('StreamdownWrapper', () => {render(<StreamdownWrapper latexContent={'<div ref="someRef">content</div>'} />)// Assert - ref attribute should be removed- expect(screen.getByText('content')).toBeInTheDocument()+ // Assert - ref attribute should be removed+ expect(screen.getByText('content'))!.toBeInTheDocument()expect(document.querySelector('[ref="someRef"]')).toBeNull()})@@ -186,7 +196,8 @@ describe('StreamdownWrapper', () => {render(<StreamdownWrapper latexContent="<custom-element>content</custom-element>" />)// Assert - rehype-sanitize strips the tag but keeps inner text- expect(screen.getByText('content')).toBeInTheDocument()+ // Assert - rehype-sanitize strips the tag but keeps inner text+ expect(screen.getByText('content'))!.toBeInTheDocument()expect(document.querySelector('custom-element')).toBeNull()})})diff --git a/web/app/components/base/markdown/streamdown-wrapper.tsx b/web/app/components/base/markdown/streamdown-wrapper.tsxindex e20898135b1..342f5cf44b3 100644--- a/web/app/components/base/markdown/streamdown-wrapper.tsx+++ b/web/app/components/base/markdown/streamdown-wrapper.tsx@@ -101,10 +101,10 @@ function buildRehypePlugins(extraPlugins?: PluggableList): PluggableList {const name = typeof entry === 'string' ? entry : entry[0]return !overrideNames.has(name as string)})- mergedAttributes[tag] = [...filtered, ...ALLOWED_TAGS[tag]]+ mergedAttributes[tag] = [...filtered, ...(ALLOWED_TAGS[tag] ?? [])]}else {- mergedAttributes[tag] = ALLOWED_TAGS[tag]+ mergedAttributes[tag] = ALLOWED_TAGS[tag]!}}@@ -132,10 +132,10 @@ function buildRehypePlugins(extraPlugins?: PluggableList): PluggableList {}return [- defaultRehypePlugins.raw,+ defaultRehypePlugins.raw!,...(extraPlugins ?? []),[sanitizePlugin, customSchema] as Pluggable,- defaultRehypePlugins.harden,+ defaultRehypePlugins.harden!,]}diff --git a/web/app/components/base/mermaid/index.tsx b/web/app/components/base/mermaid/index.tsxindex 9af1024ba9e..75bc201071a 100644--- a/web/app/components/base/mermaid/index.tsx+++ b/web/app/components/base/mermaid/index.tsx@@ -239,8 +239,8 @@ const Flowchart = (props: FlowchartProps) => {if (!taskMatch)return line // Not a task line, return as is.- const taskName = taskMatch[1].trim()- let paramsStr = taskMatch[2].trim()+ const taskName = taskMatch[1]!.trim()+ let paramsStr = taskMatch[2]!.trim()// Rule 1: Correct multiple "after" dependencies ONLY if they exist.// This is a common mistake, e.g., "..., after task1, after task2, ..."diff --git a/web/app/components/base/message-log-modal/__tests__/index.spec.tsx b/web/app/components/base/message-log-modal/__tests__/index.spec.tsxindex 2955d29b264..525f1907431 100644--- a/web/app/components/base/message-log-modal/__tests__/index.spec.tsx+++ b/web/app/components/base/message-log-modal/__tests__/index.spec.tsx@@ -60,8 +60,8 @@ describe('MessageLogModal', () => {it('renders modal with correct title and Run component', () => {render(<MessageLogModal width={800} onCancel={onCancel} currentLogItem={mockLog} />)- expect(screen.getByText(/title/i)).toBeInTheDocument()- expect(screen.getByTestId('workflow-run')).toBeInTheDocument()+ expect(screen.getByText(/title/i))!.toBeInTheDocument()+ expect(screen.getByTestId('workflow-run'))!.toBeInTheDocument()})})@@ -92,7 +92,7 @@ describe('MessageLogModal', () => {it('calls onCancel when close icon is clicked', () => {render(<MessageLogModal width={800} onCancel={onCancel} currentLogItem={mockLog} />)const closeButton = screen.getByTestId('close-button')- expect(closeButton).toBeInTheDocument()+ expect(closeButton)!.toBeInTheDocument()fireEvent.click(closeButton)expect(onCancel).toHaveBeenCalledTimes(1)})@@ -107,7 +107,7 @@ describe('MessageLogModal', () => {it('does not call onCancel when clicked away if not mounted', () => {render(<MessageLogModal width={800} onCancel={onCancel} currentLogItem={mockLog} />)expect(clickAwayHandlers.length).toBeGreaterThan(0)- clickAwayHandlers[0]() // This is the closure from the initial render, where mounted is false+ clickAwayHandlers[0]!() // This is the closure from the initial render, where mounted is falseexpect(onCancel).not.toHaveBeenCalled()})})diff --git a/web/app/components/base/new-audio-button/__tests__/index.spec.tsx b/web/app/components/base/new-audio-button/__tests__/index.spec.tsxindex 23696fca746..0e5444c4e44 100644--- a/web/app/components/base/new-audio-button/__tests__/index.spec.tsx+++ b/web/app/components/base/new-audio-button/__tests__/index.spec.tsx@@ -28,7 +28,7 @@ describe('AudioBtn', () => {const hoverAndCheckTooltip = async (expectedText: string) => {const button = getButton()await userEvent.hover(button)- expect(await screen.findByText(expectedText)).toBeInTheDocument()+ expect(await screen.findByText(expectedText))!.toBeInTheDocument()}const getAudioCallback = () => {@@ -61,8 +61,8 @@ describe('AudioBtn', () => {await userEvent.click(getButton())await waitFor(() => expect(mockGetAudioPlayer).toHaveBeenCalled())- expect(mockGetAudioPlayer.mock.calls[0][0]).toBe('/text-to-audio')- expect(mockGetAudioPlayer.mock.calls[0][1]).toBe(true)+ expect(mockGetAudioPlayer.mock.calls[0]![0]).toBe('/text-to-audio')+ expect(mockGetAudioPlayer.mock.calls[0]![1]).toBe(true)})it('should generate app URL when appId is present', async () => {@@ -73,8 +73,8 @@ describe('AudioBtn', () => {await userEvent.click(getButton())await waitFor(() => expect(mockGetAudioPlayer).toHaveBeenCalled())- expect(mockGetAudioPlayer.mock.calls[0][0]).toBe('/apps/123/text-to-audio')- expect(mockGetAudioPlayer.mock.calls[0][1]).toBe(false)+ expect(mockGetAudioPlayer.mock.calls[0]![0]).toBe('/apps/123/text-to-audio')+ expect(mockGetAudioPlayer.mock.calls[0]![1]).toBe(false)})it('should generate installed app URL correctly', async () => {@@ -85,7 +85,7 @@ describe('AudioBtn', () => {await userEvent.click(getButton())await waitFor(() => expect(mockGetAudioPlayer).toHaveBeenCalled())- expect(mockGetAudioPlayer.mock.calls[0][0]).toBe('/installed-apps/456/text-to-audio')+ expect(mockGetAudioPlayer.mock.calls[0]![0]).toBe('/installed-apps/456/text-to-audio')})})@@ -94,7 +94,7 @@ describe('AudioBtn', () => {render(<AudioBtn value="test" />)await hoverAndCheckTooltip('play')- expect(getButton()).toHaveClass('action-btn')+ expect(getButton())!.toHaveClass('action-btn')expect(getButton()).not.toBeDisabled()})@@ -107,7 +107,7 @@ describe('AudioBtn', () => {})await hoverAndCheckTooltip('playing')- expect(getButton()).toHaveClass('action-btn-active')+ expect(getButton())!.toHaveClass('action-btn-active')})it('should transition to ended state', async () => {@@ -186,7 +186,7 @@ describe('AudioBtn', () => {render(<AudioBtn value="test" />)await userEvent.click(getButton())- await waitFor(() => expect(getButton()).toBeDisabled())+ await waitFor(() => expect(getButton())!.toBeDisabled())})})@@ -197,9 +197,9 @@ describe('AudioBtn', () => {await waitFor(() => expect(mockGetAudioPlayer).toHaveBeenCalled())const call = mockGetAudioPlayer.mock.calls[0]- expect(call[2]).toBe('msg-1')- expect(call[3]).toBe('hello')- expect(call[4]).toBe('en-US')+ expect(call![2]).toBe('msg-1')+ expect(call![3]).toBe('hello')+ expect(call![4]).toBe('en-US')})})})diff --git a/web/app/components/base/notion-icon/index.tsx b/web/app/components/base/notion-icon/index.tsxindex 62fcef1dc13..f2b5146d73f 100644--- a/web/app/components/base/notion-icon/index.tsx+++ b/web/app/components/base/notion-icon/index.tsx@@ -31,7 +31,7 @@ const NotionIcon = ({)}return (- <div className={cn('flex h-5 w-5 items-center justify-center rounded-sm bg-gray-200 text-xs font-medium text-gray-500', className)}>{name?.[0].toLocaleUpperCase()}</div>+ <div className={cn('flex h-5 w-5 items-center justify-center rounded-sm bg-gray-200 text-xs font-medium text-gray-500', className)}>{name?.[0]!.toLocaleUpperCase()}</div>)}diff --git a/web/app/components/base/notion-page-selector/base.tsx b/web/app/components/base/notion-page-selector/base.tsxindex 34926849a67..23dd3be69af 100644--- a/web/app/components/base/notion-page-selector/base.tsx+++ b/web/app/components/base/notion-page-selector/base.tsx@@ -119,14 +119,14 @@ const NotionPageSelector = ({}, [currentCredentialId, datasetId, invalidPreImportNotionPages, onSelect])const handleSelectPages = useCallback((newSelectedPagesId: Set<string>) => {- const selectedPages = Array.from(newSelectedPagesId).map(pageId => pagesMapAndSelectedPagesId[0][pageId])+ const selectedPages = Array.from(newSelectedPagesId).map(pageId => pagesMapAndSelectedPagesId[0][pageId]!)onSelect(selectedPages)}, [pagesMapAndSelectedPagesId, onSelect])const handlePreviewPage = useCallback((previewPageId: string) => {if (onPreview)- onPreview(pagesMapAndSelectedPagesId[0][previewPageId])+ onPreview(pagesMapAndSelectedPagesId[0][previewPageId]!)}, [pagesMapAndSelectedPagesId, onPreview])const handleConfigureNotion = useCallback(() => {@@ -177,7 +177,7 @@ const NotionPageSelector = ({value={selectedPagesId}disabledValue={pagesMapAndSelectedPagesId[2]}searchValue={searchValue}- list={notionsPages!.notion_info?.[0].pages || []}+ list={notionsPages!.notion_info?.[0]!.pages || []}pagesMap={pagesMapAndSelectedPagesId[0]}onSelect={handleSelectPages}canPreview={canPreview}diff --git a/web/app/components/base/notion-page-selector/page-selector/__tests__/index.spec.tsx b/web/app/components/base/notion-page-selector/page-selector/__tests__/index.spec.tsxindex d4b559452e2..21a7a08d636 100644--- a/web/app/components/base/notion-page-selector/page-selector/__tests__/index.spec.tsx+++ b/web/app/components/base/notion-page-selector/page-selector/__tests__/index.spec.tsx@@ -24,11 +24,11 @@ const mockList: DataSourceNotionPage[] = []const mockPagesMap: DataSourceNotionPageMap = {- 'root-1': { ...mockList[0], workspace_id: 'workspace-1' },- 'child-1': { ...mockList[1], workspace_id: 'workspace-1' },- 'grandchild-1': { ...mockList[2], workspace_id: 'workspace-1' },- 'child-2': { ...mockList[3], workspace_id: 'workspace-1' },- 'root-2': { ...mockList[4], workspace_id: 'workspace-1' },+ 'root-1': { ...mockList[0]!, workspace_id: 'workspace-1' },+ 'child-1': { ...mockList[1]!, workspace_id: 'workspace-1' },+ 'grandchild-1': { ...mockList[2]!, workspace_id: 'workspace-1' },+ 'child-2': { ...mockList[3]!, workspace_id: 'workspace-1' },+ 'root-2': { ...mockList[4]!, workspace_id: 'workspace-1' },}describe('PageSelector', () => {@@ -39,7 +39,7 @@ describe('PageSelector', () => {it('should render root level pages initially', () => {render(<PageSelector value={new Set()} disabledValue={new Set()} searchValue="" pagesMap={mockPagesMap} list={mockList} onSelect={vi.fn()} />)- expect(screen.getByText('Root 1')).toBeInTheDocument()+ expect(screen.getByText('Root 1'))!.toBeInTheDocument()expect(screen.queryByText('Child 1')).not.toBeInTheDocument()})@@ -50,13 +50,13 @@ describe('PageSelector', () => {const toggle = screen.getByTestId('notion-page-toggle-root-1')await user.click(toggle)- expect(screen.getByText('Child 1')).toBeInTheDocument()+ expect(screen.getByText('Child 1'))!.toBeInTheDocument()})it('should call onSelect with descendants when parent is selected', async () => {const handleSelect = vi.fn()const user = userEvent.setup()- render(<PageSelector value={new Set()} disabledValue={new Set()} searchValue="" pagesMap={mockPagesMap} list={[mockList[0], mockList[1], mockList[2]]} onSelect={handleSelect} />)+ render(<PageSelector value={new Set()} disabledValue={new Set()} searchValue="" pagesMap={mockPagesMap} list={[mockList[0]!, mockList[1]!, mockList[2]!]} onSelect={handleSelect} />)const checkbox = screen.getByTestId('checkbox-notion-page-checkbox-root-1')await user.click(checkbox)@@ -78,7 +78,7 @@ describe('PageSelector', () => {it('should show breadcrumbs when searching', () => {render(<PageSelector value={new Set()} disabledValue={new Set()} searchValue="Grandchild" pagesMap={mockPagesMap} list={mockList} onSelect={vi.fn()} />)- expect(screen.getByText('Root 1 / Child 1 / Grandchild 1')).toBeInTheDocument()+ expect(screen.getByText('Root 1 / Child 1 / Grandchild 1'))!.toBeInTheDocument()})it('should call onPreview when preview button is clicked', async () => {@@ -95,7 +95,7 @@ describe('PageSelector', () => {it('should show no result message when search returns nothing', () => {render(<PageSelector value={new Set()} disabledValue={new Set()} searchValue="nonexistent" pagesMap={mockPagesMap} list={[]} onSelect={vi.fn()} />)- expect(screen.getByText('common.dataSource.notion.selector.noSearchResult')).toBeInTheDocument()+ expect(screen.getByText('common.dataSource.notion.selector.noSearchResult'))!.toBeInTheDocument()})it('should handle selection when searchValue is present', async () => {@@ -124,7 +124,7 @@ describe('PageSelector', () => {const toggleBtn = screen.getByTestId('notion-page-toggle-root-1')await user.click(toggleBtn) // Expand- await waitFor(() => expect(screen.queryByText('Child 1')).toBeInTheDocument())+ await waitFor(() => expect(screen.queryByText('Child 1'))!.toBeInTheDocument())await user.click(toggleBtn) // Collapseawait waitFor(() => expect(screen.queryByText('Child 1')).not.toBeInTheDocument())@@ -149,14 +149,14 @@ describe('PageSelector', () => {it('should render preview button when canPreview is true', () => {render(<PageSelector value={new Set()} disabledValue={new Set()} searchValue="" pagesMap={mockPagesMap} list={mockList} onSelect={vi.fn()} canPreview={true} />)- expect(screen.getByTestId('notion-page-preview-root-1')).toBeInTheDocument()+ expect(screen.getByTestId('notion-page-preview-root-1'))!.toBeInTheDocument()})it('should use previewPageId prop when provided', () => {const { rerender } = render(<PageSelector value={new Set()} disabledValue={new Set()} searchValue="" pagesMap={mockPagesMap} list={mockList} onSelect={vi.fn()} previewPageId="root-1" />)let row = screen.getByTestId('notion-page-row-root-1')- expect(row).toHaveClass('bg-state-base-hover')+ expect(row)!.toHaveClass('bg-state-base-hover')rerender(<PageSelector value={new Set()} disabledValue={new Set()} searchValue="" pagesMap={mockPagesMap} list={mockList} onSelect={vi.fn()} previewPageId="root-2" />)@@ -190,8 +190,9 @@ describe('PageSelector', () => {await user.click(toggle)// Both children should be visible- expect(screen.getByText('Child 1')).toBeInTheDocument()- expect(screen.getByText('Child 2')).toBeInTheDocument()+ // Both children should be visible+ expect(screen.getByText('Child 1'))!.toBeInTheDocument()+ expect(screen.getByText('Child 2'))!.toBeInTheDocument()})it('should expand nested children when toggling parent', async () => {@@ -201,12 +202,12 @@ describe('PageSelector', () => {// Expand root-1let toggle = screen.getByTestId('notion-page-toggle-root-1')await user.click(toggle)- expect(screen.getByText('Child 1')).toBeInTheDocument()+ expect(screen.getByText('Child 1'))!.toBeInTheDocument()// Expand child-1toggle = screen.getByTestId('notion-page-toggle-child-1')await user.click(toggle)- expect(screen.getByText('Grandchild 1')).toBeInTheDocument()+ expect(screen.getByText('Grandchild 1'))!.toBeInTheDocument()// Collapse child-1await user.click(toggle)@@ -227,7 +228,7 @@ describe('PageSelector', () => {it('should only select the item when searching (no descendants)', async () => {const handleSelect = vi.fn()const user = userEvent.setup()- render(<PageSelector value={new Set()} disabledValue={new Set()} searchValue="Child" pagesMap={mockPagesMap} list={[mockList[1]]} onSelect={handleSelect} />)+ render(<PageSelector value={new Set()} disabledValue={new Set()} searchValue="Child" pagesMap={mockPagesMap} list={[mockList[1]!]} onSelect={handleSelect} />)const checkbox = screen.getByTestId('checkbox-notion-page-checkbox-child-1')await user.click(checkbox)@@ -239,7 +240,7 @@ describe('PageSelector', () => {it('should deselect only the item when searching (no descendants)', async () => {const handleSelect = vi.fn()const user = userEvent.setup()- render(<PageSelector value={new Set(['child-1'])} disabledValue={new Set()} searchValue="Child" pagesMap={mockPagesMap} list={[mockList[1]]} onSelect={handleSelect} />)+ render(<PageSelector value={new Set(['child-1'])} disabledValue={new Set()} searchValue="Child" pagesMap={mockPagesMap} list={[mockList[1]!]} onSelect={handleSelect} />)const checkbox = screen.getByTestId('checkbox-notion-page-checkbox-child-1')await user.click(checkbox)@@ -250,8 +251,8 @@ describe('PageSelector', () => {it('should handle multiple root pages', async () => {render(<PageSelector value={new Set()} disabledValue={new Set()} searchValue="" pagesMap={mockPagesMap} list={mockList} onSelect={vi.fn()} />)- expect(screen.getByText('Root 1')).toBeInTheDocument()- expect(screen.getByText('Root 2')).toBeInTheDocument()+ expect(screen.getByText('Root 1'))!.toBeInTheDocument()+ expect(screen.getByText('Root 2'))!.toBeInTheDocument()})it('should update preview when clicking preview button with onPreview provided', async () => {@@ -276,29 +277,61 @@ describe('PageSelector', () => {rerender(<PageSelector value={new Set()} disabledValue={new Set()} searchValue="" pagesMap={mockPagesMap} list={mockList} onSelect={vi.fn()} canPreview={true} />)const row = screen.getByTestId('notion-page-row-root-1')- expect(row).toHaveClass('bg-state-base-hover')+ expect(row)!.toHaveClass('bg-state-base-hover')})it('should render page name with correct title attribute', () => {render(<PageSelector value={new Set()} disabledValue={new Set()} searchValue="" pagesMap={mockPagesMap} list={mockList} onSelect={vi.fn()} />)const pageName = screen.getByTestId('notion-page-name-root-1')- expect(pageName).toHaveAttribute('title', 'Root 1')+ expect(pageName)!.toHaveAttribute('title', 'Root 1')})it('should handle empty list gracefully', () => {render(<PageSelector value={new Set()} disabledValue={new Set()} searchValue="" pagesMap={mockPagesMap} list={[]} onSelect={vi.fn()} />)- expect(screen.getByText('common.dataSource.notion.selector.noSearchResult')).toBeInTheDocument()+ expect(screen.getByText('common.dataSource.notion.selector.noSearchResult'))!.toBeInTheDocument()})it('should filter search results correctly with partial matches', () => {render(<PageSelector value={new Set()} disabledValue={new Set()} searchValue="1" pagesMap={mockPagesMap} list={mockList} onSelect={vi.fn()} />)// Should show Root 1, Child 1, and Grandchild 1- expect(screen.getByTestId('notion-page-name-root-1')).toBeInTheDocument()- expect(screen.getByTestId('notion-page-name-child-1')).toBeInTheDocument()- expect(screen.getByTestId('notion-page-name-grandchild-1')).toBeInTheDocument()+ // Should show Root 1, Child 1, and Grandchild 1+ expect(screen.getByTestId('notion-page-name-root-1'))!.toBeInTheDocument()+ expect(screen.getByTestId('notion-page-name-child-1'))!.toBeInTheDocument()+ expect(screen.getByTestId('notion-page-name-grandchild-1'))!.toBeInTheDocument()+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2+ // Should not show Root 2, Child 2// Should not show Root 2, Child 2expect(screen.queryByTestId('notion-page-name-root-2')).not.toBeInTheDocument()expect(screen.queryByTestId('notion-page-name-child-2')).not.toBeInTheDocument()@@ -313,6 +346,7 @@ describe('PageSelector', () => {await user.click(toggle)// Should expand even though parent is disabled- expect(screen.getByText('Child 1')).toBeInTheDocument()+ // Should expand even though parent is disabled+ expect(screen.getByText('Child 1'))!.toBeInTheDocument()})})diff --git a/web/app/components/base/notion-page-selector/page-selector/__tests__/use-page-selector-model.spec.ts b/web/app/components/base/notion-page-selector/page-selector/__tests__/use-page-selector-model.spec.tsindex d90c50308d4..04166f1d839 100644--- a/web/app/components/base/notion-page-selector/page-selector/__tests__/use-page-selector-model.spec.ts+++ b/web/app/components/base/notion-page-selector/page-selector/__tests__/use-page-selector-model.spec.ts@@ -20,10 +20,10 @@ const list: DataSourceNotionPage[] = []const pagesMap: DataSourceNotionPageMap = {- 'root-1': { ...list[0], workspace_id: 'workspace-1' },- 'child-1': { ...list[1], workspace_id: 'workspace-1' },- 'grandchild-1': { ...list[2], workspace_id: 'workspace-1' },- 'child-2': { ...list[3], workspace_id: 'workspace-1' },+ 'root-1': { ...list[0]!, workspace_id: 'workspace-1' },+ 'child-1': { ...list[1]!, workspace_id: 'workspace-1' },+ 'grandchild-1': { ...list[2]!, workspace_id: 'workspace-1' },+ 'child-2': { ...list[3]!, workspace_id: 'workspace-1' },}const createProps = (diff --git a/web/app/components/base/notion-page-selector/page-selector/__tests__/utils.spec.ts b/web/app/components/base/notion-page-selector/page-selector/__tests__/utils.spec.tsindex 2e6005c573b..b0ad0b05b68 100644--- a/web/app/components/base/notion-page-selector/page-selector/__tests__/utils.spec.ts+++ b/web/app/components/base/notion-page-selector/page-selector/__tests__/utils.spec.ts@@ -25,21 +25,21 @@ const list: DataSourceNotionPage[] = []const pagesMap: DataSourceNotionPageMap = {- 'root-1': { ...list[0], workspace_id: 'workspace-1' },- 'child-1': { ...list[1], workspace_id: 'workspace-1' },- 'grandchild-1': { ...list[2], workspace_id: 'workspace-1' },- 'child-2': { ...list[3], workspace_id: 'workspace-1' },- 'orphan-1': { ...list[4], workspace_id: 'workspace-1' },+ 'root-1': { ...list[0]!, workspace_id: 'workspace-1' },+ 'child-1': { ...list[1]!, workspace_id: 'workspace-1' },+ 'grandchild-1': { ...list[2]!, workspace_id: 'workspace-1' },+ 'child-2': { ...list[3]!, workspace_id: 'workspace-1' },+ 'orphan-1': { ...list[4]!, workspace_id: 'workspace-1' },}describe('page-selector utils', () => {it('should build a tree with descendants, depth, and ancestors', () => {const treeMap = buildNotionPageTree(list, pagesMap)- expect(treeMap['root-1'].children).toEqual(new Set(['child-1', 'child-2']))- expect(treeMap['root-1'].descendants).toEqual(new Set(['child-1', 'grandchild-1', 'child-2']))- expect(treeMap['grandchild-1'].depth).toBe(2)- expect(treeMap['grandchild-1'].ancestors).toEqual(['Root 1', 'Child 1'])+ expect(treeMap['root-1']!.children).toEqual(new Set(['child-1', 'child-2']))+ expect(treeMap['root-1']!.descendants).toEqual(new Set(['child-1', 'grandchild-1', 'child-2']))+ expect(treeMap['grandchild-1']!.depth).toBe(2)+ expect(treeMap['grandchild-1']!.ancestors).toEqual(['Root 1', 'Child 1'])})it('should return root page ids for true roots and pages with missing parents', () => {diff --git a/web/app/components/base/notion-page-selector/page-selector/virtual-page-list.tsx b/web/app/components/base/notion-page-selector/page-selector/virtual-page-list.tsxindex 6fec6c0b841..07f56b015d2 100644--- a/web/app/components/base/notion-page-selector/page-selector/virtual-page-list.tsx+++ b/web/app/components/base/notion-page-selector/page-selector/virtual-page-list.tsx@@ -58,8 +58,8 @@ const VirtualPageList = ({}}>{virtualRows.map((virtualRow) => {- const row = rows[virtualRow.index]- const pageId = row.page.page_id+ const row = rows[virtualRow.index]!+ const pageId = row!.page.page_idreturn (<PageRowdiff --git a/web/app/components/base/pagination/__tests__/index.spec.tsx b/web/app/components/base/pagination/__tests__/index.spec.tsxindex 426751ec9d1..7267d84f543 100644--- a/web/app/components/base/pagination/__tests__/index.spec.tsx+++ b/web/app/components/base/pagination/__tests__/index.spec.tsx@@ -16,14 +16,16 @@ describe('CustomizedPagination', () => {describe('Rendering', () => {it('should render without crashing', () => {const { container } = render(<CustomizedPagination {...defaultProps} />)- expect(container).toBeInTheDocument()+ expect(container)!.toBeInTheDocument()})it('should display current page and total pages', () => {render(<CustomizedPagination {...defaultProps} current={0} total={100} limit={10} />)// current + 1 = 1, totalPages = 10// The page info display shows "1 / 10" and page buttons also show numbers- expect(screen.getByText('/')).toBeInTheDocument()+ // current + 1 = 1, totalPages = 10+ // The page info display shows "1 / 10" and page buttons also show numbers+ expect(screen.getByText('/'))!.toBeInTheDocument()expect(screen.getAllByText('1').length).toBeGreaterThanOrEqual(1)})@@ -36,13 +38,14 @@ describe('CustomizedPagination', () => {it('should render page number buttons', () => {render(<CustomizedPagination {...defaultProps} total={50} limit={10} />)// 5 pages total, should see page numbers- expect(screen.getByText('2')).toBeInTheDocument()- expect(screen.getByText('3')).toBeInTheDocument()+ // 5 pages total, should see page numbers+ expect(screen.getByText('2'))!.toBeInTheDocument()+ expect(screen.getByText('3'))!.toBeInTheDocument()})it('should display slash separator between current page and total', () => {render(<CustomizedPagination {...defaultProps} />)- expect(screen.getByText('/')).toBeInTheDocument()+ expect(screen.getByText('/'))!.toBeInTheDocument()})})@@ -50,7 +53,7 @@ describe('CustomizedPagination', () => {it('should apply custom className', () => {const { container } = render(<CustomizedPagination {...defaultProps} className="my-custom" />)const wrapper = container.firstChild as HTMLElement- expect(wrapper).toHaveClass('my-custom')+ expect(wrapper)!.toHaveClass('my-custom')})it('should default limit to 10', () => {@@ -69,14 +72,16 @@ describe('CustomizedPagination', () => {render(<CustomizedPagination {...defaultProps} current={0} />)const buttons = screen.getAllByRole('button')// First button is prev- expect(buttons[0]).toBeDisabled()+ // First button is prev+ expect(buttons[0])!.toBeDisabled()})it('should disable next button on last page', () => {render(<CustomizedPagination {...defaultProps} current={9} total={100} limit={10} />)const buttons = screen.getAllByRole('button')// Last button is next- expect(buttons[buttons.length - 1]).toBeDisabled()+ // Last button is next+ expect(buttons[buttons.length - 1])!.toBeDisabled()})it('should not render limit selector when onLimitChange is not provided', () => {@@ -88,8 +93,9 @@ describe('CustomizedPagination', () => {const onLimitChange = vi.fn()render(<CustomizedPagination {...defaultProps} onLimitChange={onLimitChange} />)// Should show limit options 10, 25, 50- expect(screen.getByText('25')).toBeInTheDocument()- expect(screen.getByText('50')).toBeInTheDocument()+ // Should show limit options 10, 25, 50+ expect(screen.getByText('25'))!.toBeInTheDocument()+ expect(screen.getByText('50'))!.toBeInTheDocument()})})@@ -99,7 +105,7 @@ describe('CustomizedPagination', () => {render(<CustomizedPagination {...defaultProps} current={0} onChange={onChange} />)const buttons = screen.getAllByRole('button')const nextButton = buttons[buttons.length - 1]- fireEvent.click(nextButton)+ fireEvent.click(nextButton!)expect(onChange).toHaveBeenCalledWith(1)})@@ -107,7 +113,7 @@ describe('CustomizedPagination', () => {const onChange = vi.fn()render(<CustomizedPagination {...defaultProps} current={5} onChange={onChange} />)const buttons = screen.getAllByRole('button')- fireEvent.click(buttons[0])+ fireEvent.click(buttons[0]!)expect(onChange).toHaveBeenCalledWith(4)})@@ -116,7 +122,8 @@ describe('CustomizedPagination', () => {// Click the current page display (the div containing "1 / 10")fireEvent.click(screen.getByText('/'))// Input should appear- expect(screen.getByRole('textbox')).toBeInTheDocument()+ // Input should appear+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})it('should navigate to entered page on Enter key', () => {@@ -139,8 +146,39 @@ describe('CustomizedPagination', () => {const input = screen.getByRole('textbox')fireEvent.keyDown(input, { key: 'Escape' })// Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should return+ // Input should be hidden and page display should returnexpect(screen.queryByRole('textbox')).not.toBeInTheDocument()- expect(screen.getByText('/')).toBeInTheDocument()+ expect(screen.getByText('/'))!.toBeInTheDocument()})it('should confirm input on blur-sm', () => {@@ -191,10 +229,10 @@ describe('CustomizedPagination', () => {const input = screen.getByRole('textbox')fireEvent.change(input, { target: { value: 'abc' } })- expect(input).toHaveValue('')+ expect(input)!.toHaveValue('')fireEvent.change(input, { target: { value: '' } })- expect(input).toHaveValue('')+ expect(input)!.toHaveValue('')})it('should show per page tip on hover and hide on leave', () => {@@ -205,7 +243,8 @@ describe('CustomizedPagination', () => {fireEvent.mouseEnter(container)// I18n mock returns ns.key- expect(screen.getByText('common.pagination.perPage')).toBeInTheDocument()+ // I18n mock returns ns.key+ expect(screen.getByText('common.pagination.perPage'))!.toBeInTheDocument()fireEvent.mouseLeave(container)expect(screen.queryByText('common.pagination.perPage')).not.toBeInTheDocument()@@ -247,19 +286,19 @@ describe('CustomizedPagination', () => {// Test limit 25const { container: containerA } = render(<CustomizedPagination current={0} total={100} limit={25} onChange={vi.fn()} onLimitChange={vi.fn()} />)const wrapper25 = Array.from(containerA.querySelectorAll('div.system-sm-medium')).find(el => el.textContent === '25')!- expect(wrapper25).toHaveClass('bg-components-segmented-control-item-active-bg')+ expect(wrapper25)!.toHaveClass('bg-components-segmented-control-item-active-bg')// Test limit 50const { container: containerB } = render(<CustomizedPagination current={0} total={100} limit={50} onChange={vi.fn()} onLimitChange={vi.fn()} />)const wrapper50 = Array.from(containerB.querySelectorAll('div.system-sm-medium')).find(el => el.textContent === '50')!- expect(wrapper50).toHaveClass('bg-components-segmented-control-item-active-bg')+ expect(wrapper50)!.toHaveClass('bg-components-segmented-control-item-active-bg')})})describe('Edge Cases', () => {it('should handle total of 0', () => {const { container } = render(<CustomizedPagination {...defaultProps} total={0} />)- expect(container).toBeInTheDocument()+ expect(container)!.toBeInTheDocument()})it('should handle confirm when input value is unchanged (covers false branch of empty string check)', () => {@@ -287,7 +326,7 @@ describe('CustomizedPagination', () => {const input = screen.getByRole('textbox')fireEvent.keyDown(input, { key: 'a' })- expect(screen.getByRole('textbox')).toBeInTheDocument()+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})it('should trigger handleInputConfirm with empty string specifically on keydown Enter', async () => {@@ -303,6 +342,37 @@ describe('CustomizedPagination', () => {// Wait for debounce 500msawait new Promise(r => setTimeout(r, 600))+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter+ // Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enter// Validates `inputValue === ''` path under `handleInputConfirm` triggered by Enterexpect(screen.queryByRole('textbox')).not.toBeInTheDocument()})@@ -326,8 +396,8 @@ describe('CustomizedPagination', () => {render(<CustomizedPagination {...defaultProps} total={5} limit={10} />)// totalPages = 1, both buttons should be disabledconst buttons = screen.getAllByRole('button')- expect(buttons[0]).toBeDisabled()- expect(buttons[buttons.length - 1]).toBeDisabled()+ expect(buttons[0])!.toBeDisabled()+ expect(buttons[buttons.length - 1])!.toBeDisabled()})it('should restore input value when blurred with empty value', () => {@@ -337,6 +407,37 @@ describe('CustomizedPagination', () => {fireEvent.change(input, { target: { value: '' } })fireEvent.blur(input)// Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1+ // Should close input without calling onChange, restoring to current + 1expect(screen.queryByRole('textbox')).not.toBeInTheDocument()})})diff --git a/web/app/components/base/pagination/hook.ts b/web/app/components/base/pagination/hook.tsindex 25fa24cb26b..0b9fd87989d 100644--- a/web/app/components/base/pagination/hook.ts+++ b/web/app/components/base/pagination/hook.ts@@ -34,7 +34,7 @@ const usePagination = ({}, [currentPage, isReachedToFirst, isReachedToLast, middlePagesSiblingCount, pages])const getAllPreviousPages = useCallback(() => {- return pages.slice(0, middlePages[0] - 1)+ return pages.slice(0, middlePages[0]! - 1)}, [middlePages, pages])const previousPages = React.useMemo(() => {@@ -67,12 +67,12 @@ const usePagination = ({const isPreviousTruncable = React.useMemo(() => {// Is truncable if first value of middlePage is larger than last value of previousPages- return middlePages[0] > previousPages[previousPages.length - 1] + 1+ return middlePages[0]! > previousPages[previousPages.length - 1]! + 1}, [previousPages, middlePages])const isNextTruncable = React.useMemo(() => {// Is truncable if last value of middlePage is larger than first value of previousPages- return middlePages[middlePages.length - 1] + 1 < nextPages[0]+ return middlePages[middlePages.length - 1]! + 1 < nextPages[0]!}, [nextPages, middlePages])return {diff --git a/web/app/components/base/param-item/index.stories.tsx b/web/app/components/base/param-item/index.stories.tsxindex 0cf6c401461..6ba6650dd43 100644--- a/web/app/components/base/param-item/index.stories.tsx+++ b/web/app/components/base/param-item/index.stories.tsx@@ -56,7 +56,7 @@ const ParamItemPlayground = () => {setState(prev => ({...prev,[id]: {- ...prev[id],+ ...prev[id]!,value: Number.parseFloat(value.toFixed(3)),},}))@@ -66,7 +66,7 @@ const ParamItemPlayground = () => {setState(prev => ({...prev,[id]: {- ...prev[id],+ ...prev[id]!,enabled,},}))@@ -87,8 +87,8 @@ const ParamItemPlayground = () => {id={param.id}name={param.name}tip={param.tip}- value={state[param.id].value}- enable={state[param.id].enabled}+ value={state[param.id]!.value}+ enable={state[param.id]!.enabled}min={param.min}max={param.max}step={param.step}diff --git a/web/app/components/base/portal-to-follow-elem/__tests__/index.spec.tsx b/web/app/components/base/portal-to-follow-elem/__tests__/index.spec.tsxindex 373ae018c77..3c1b09d947a 100644--- a/web/app/components/base/portal-to-follow-elem/__tests__/index.spec.tsx+++ b/web/app/components/base/portal-to-follow-elem/__tests__/index.spec.tsx@@ -68,7 +68,7 @@ describe('PortalToFollowElem', () => {<PortalToFollowElemTrigger>Trigger Text</PortalToFollowElemTrigger></PortalToFollowElem>,)- expect(getByText('Trigger Text')).toBeInTheDocument()+ expect(getByText('Trigger Text'))!.toBeInTheDocument()})it('should handle asChild prop correctly', () => {@@ -80,7 +80,7 @@ describe('PortalToFollowElem', () => {</PortalToFollowElem>,)- expect(getByRole('button')).toHaveTextContent('Button Trigger')+ expect(getByRole('button'))!.toHaveTextContent('Button Trigger')})})@@ -104,7 +104,7 @@ describe('PortalToFollowElem', () => {</PortalToFollowElem>,)- expect(getByText('Popup Content')).toBeInTheDocument()+ expect(getByText('Popup Content'))!.toBeInTheDocument()})})@@ -161,7 +161,7 @@ describe('PortalToFollowElem', () => {}]}- const sizeMiddleware = useFloatingMock.mock.calls[0][0].middleware.find(+ const sizeMiddleware = useFloatingMock.mock.calls[0]![0].middleware.find((m: { name: string }) => m.name === 'size',) as SizeMiddlewareexpect(sizeMiddleware).toBeDefined()@@ -193,7 +193,7 @@ describe('PortalToFollowElem', () => {</PortalToFollowElemTrigger></PortalToFollowElem>,)- expect(getByRole('button')).toHaveAttribute('data-state', 'open')+ expect(getByRole('button'))!.toHaveAttribute('data-state', 'open')})it('should handle missing ref on child', () => {@@ -204,7 +204,7 @@ describe('PortalToFollowElem', () => {</PortalToFollowElemTrigger></PortalToFollowElem>,)- expect(getByRole('button')).toBeInTheDocument()+ expect(getByRole('button'))!.toBeInTheDocument()})})@@ -223,7 +223,7 @@ describe('PortalToFollowElem', () => {</PortalToFollowElem>,)- expect(getByTestId('content')).toHaveStyle('visibility: hidden')+ expect(getByTestId('content'))!.toHaveStyle('visibility: hidden')mockFloatingData = {}})})diff --git a/web/app/components/base/progress-bar/__tests__/progress-circle.spec.tsx b/web/app/components/base/progress-bar/__tests__/progress-circle.spec.tsxindex 4a3ee2e6537..14bb9896e38 100644--- a/web/app/components/base/progress-bar/__tests__/progress-circle.spec.tsx+++ b/web/app/components/base/progress-bar/__tests__/progress-circle.spec.tsx@@ -5,7 +5,7 @@ const extractLargeArcFlag = (pathData: string): string => {const afterA = pathData.slice(pathData.indexOf('A') + 1)const tokens = afterA.replace(/,/g, ' ').trim().split(/\s+/)// Arc syntax: A rx ry x-axis-rotation large-arc-flag sweep-flag x y- return tokens[3]+ return tokens[3]!}describe('ProgressCircle', () => {@@ -17,9 +17,9 @@ describe('ProgressCircle', () => {const circle = container.querySelector('circle')const path = container.querySelector('path')- expect(svg).toBeInTheDocument()- expect(circle).toBeInTheDocument()- expect(path).toBeInTheDocument()+ expect(svg)!.toBeInTheDocument()+ expect(circle)!.toBeInTheDocument()+ expect(path)!.toBeInTheDocument()})})@@ -34,9 +34,9 @@ describe('ProgressCircle', () => {const svg = container.querySelector('svg') as SVGElement- expect(svg).toHaveAttribute('width', String(size + strokeWidth))- expect(svg).toHaveAttribute('height', String(size + strokeWidth))- expect(svg).toHaveAttribute(+ expect(svg)!.toHaveAttribute('width', String(size + strokeWidth))+ expect(svg)!.toHaveAttribute('height', String(size + strokeWidth))+ expect(svg)!.toHaveAttribute('viewBox',`0 0 ${size + strokeWidth} ${size + strokeWidth}`,)@@ -50,8 +50,8 @@ describe('ProgressCircle', () => {/>,)const circle = container.querySelector('circle')!- expect(circle!).toHaveClass('stroke-red-500')- expect(circle!).toHaveClass('fill-red-100')+ expect(circle!)!.toHaveClass('stroke-red-500')+ expect(circle!)!.toHaveClass('fill-red-100')})it('applies custom sector fill color to the path', () => {@@ -59,7 +59,7 @@ describe('ProgressCircle', () => {<ProgressCircle sectorFillColor="fill-blue-500" />,)const path = container.querySelector('path')!- expect(path!).toHaveClass('fill-blue-500')+ expect(path!)!.toHaveClass('fill-blue-500')})it('uses large arc flag when percentage is greater than 50', () => {diff --git a/web/app/components/base/prompt-editor/__tests__/hooks.spec.tsx b/web/app/components/base/prompt-editor/__tests__/hooks.spec.tsxindex c8451ee596c..9917918628a 100644--- a/web/app/components/base/prompt-editor/__tests__/hooks.spec.tsx+++ b/web/app/components/base/prompt-editor/__tests__/hooks.spec.tsx@@ -359,23 +359,23 @@ describe('prompt-editor/hooks', () => {const user = userEvent.setup()render(<TriggerHarness />)- expect(screen.getByText('closed')).toBeInTheDocument()+ expect(screen.getByText('closed'))!.toBeInTheDocument()await user.click(screen.getByTestId('trigger-target'))- expect(screen.getByText('open')).toBeInTheDocument()+ expect(screen.getByText('open'))!.toBeInTheDocument()await user.click(screen.getByTestId('trigger-target'))- expect(screen.getByText('closed')).toBeInTheDocument()+ expect(screen.getByText('closed'))!.toBeInTheDocument()})it('should keep state unchanged when consumer does not attach the returned ref', async () => {const user = userEvent.setup()const { unmount } = render(<TriggerNoRefHarness />)- expect(screen.getByTestId('trigger-no-ref-state')).toHaveTextContent('closed')+ expect(screen.getByTestId('trigger-no-ref-state'))!.toHaveTextContent('closed')await user.click(screen.getByTestId('trigger-no-ref-state'))- expect(screen.getByTestId('trigger-no-ref-state')).toHaveTextContent('closed')+ expect(screen.getByTestId('trigger-no-ref-state'))!.toHaveTextContent('closed')expect(() => unmount()).not.toThrow()})@@ -399,8 +399,8 @@ describe('prompt-editor/hooks', () => {expect(mockState.editor.registerNodeTransform).toHaveBeenCalledTimes(2)// Verify the first call uses TextNode, not MockTargetNodeconst calls = mockState.editor.registerNodeTransform.mock.calls- expect(calls[0][0]).not.toBe(MockTargetNode)- expect(typeof calls[0][0]).toBe('function')+ expect(calls[0]![0]).not.toBe(MockTargetNode)+ expect(typeof calls[0]![0]).toBe('function')expect(mockState.editor.registerNodeTransform).toHaveBeenCalledWith(MockTargetNode,expect.any(Function),diff --git a/web/app/components/base/prompt-editor/__tests__/utils.spec.ts b/web/app/components/base/prompt-editor/__tests__/utils.spec.tsindex 443f7a5d6df..af1bab1562b 100644--- a/web/app/components/base/prompt-editor/__tests__/utils.spec.ts+++ b/web/app/components/base/prompt-editor/__tests__/utils.spec.ts@@ -151,7 +151,7 @@ describe('prompt-editor/utils', () => {const createNode = vi.fn((node: TextNode) => node as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)- const reverseTransform = registerNodeTransform.mock.calls[1][1] as (n: TN) => void+ const reverseTransform = registerNodeTransform.mock.calls[1]![1] as (n: TN) => voidconst node = new TargetNode() as TNreverseTransform(node)@@ -181,7 +181,7 @@ describe('prompt-editor/utils', () => {const createNode = vi.fn((n: TextNode) => n as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)- const reverseTransform = registerNodeTransform.mock.calls[1][1] as (n: TN) => void+ const reverseTransform = registerNodeTransform.mock.calls[1]![1] as (n: TN) => voidconst node = new TargetNode() as TNreverseTransform(node)@@ -206,7 +206,7 @@ describe('prompt-editor/utils', () => {const createNode = vi.fn((n: TextNode) => n as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)- const reverseTransform = registerNodeTransform.mock.calls[1][1] as (n: TN) => void+ const reverseTransform = registerNodeTransform.mock.calls[1]![1] as (n: TN) => voidconst node = new TargetNode() as TNreverseTransform(node)@@ -240,7 +240,7 @@ describe('prompt-editor/utils', () => {const createNode = vi.fn((n: TextNode) => n as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)- const reverseTransform = registerNodeTransform.mock.calls[1][1] as (n: TN) => void+ const reverseTransform = registerNodeTransform.mock.calls[1]![1] as (n: TN) => voidconst node = new TargetNode() as TNreverseTransform(node)@@ -275,7 +275,7 @@ describe('prompt-editor/utils', () => {const createNode = vi.fn((n: TextNode) => n as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)- const reverseTransform = registerNodeTransform.mock.calls[1][1] as (n: TN) => void+ const reverseTransform = registerNodeTransform.mock.calls[1]![1] as (n: TN) => voidconst node = new TargetNode() as TNreverseTransform(node)@@ -330,7 +330,7 @@ describe('prompt-editor/utils', () => {const createNode = vi.fn((n: TextNode) => n as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)- const textTransform = registerNodeTransform.mock.calls[0][1] as (n: TextNode) => void+ const textTransform = registerNodeTransform.mock.calls[0]![1] as (n: TextNode) => voidconst node = new NodeUnderTest() as unknown as TextNodetextTransform(node)@@ -367,7 +367,7 @@ describe('prompt-editor/utils', () => {const createNode = vi.fn((n: TextNode) => n as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)- const textTransform = registerNodeTransform.mock.calls[0][1] as (n: TextNode) => void+ const textTransform = registerNodeTransform.mock.calls[0]![1] as (n: TextNode) => voidconst node = new NodeUnderTest() as unknown as TextNodetextTransform(node)@@ -403,7 +403,7 @@ describe('prompt-editor/utils', () => {const createNode = vi.fn((n: TextNode) => n as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)- const textTransform = registerNodeTransform.mock.calls[0][1] as (n: TextNode) => void+ const textTransform = registerNodeTransform.mock.calls[0]![1] as (n: TextNode) => voidconst node = new NodeUnderTest() as unknown as TextNodetextTransform(node)@@ -438,7 +438,7 @@ describe('prompt-editor/utils', () => {const createNode = vi.fn(() => replacementNode as unknown as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)- const textTransform = registerNodeTransform.mock.calls[0][1] as (n: TextNode) => void+ const textTransform = registerNodeTransform.mock.calls[0]![1] as (n: TextNode) => voidconst node = new NodeUnderTest() as unknown as TextNodetextTransform(node)@@ -765,7 +765,7 @@ describe('prompt-editor/utils', () => {const createNode = vi.fn((n: TextNode) => n as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)- const textTransform = registerNodeTransform.mock.calls[0][1] as (n: TextNode) => void+ const textTransform = registerNodeTransform.mock.calls[0]![1] as (n: TextNode) => voidconst node = new NodeUnderTest() as unknown as TextNodetextTransform(node)@@ -804,7 +804,7 @@ describe('prompt-editor/utils', () => {const createNode = vi.fn((node: TextNode) => node as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)- const textTransform = registerNodeTransform.mock.calls[0][1] as (n: TextNode) => void+ const textTransform = registerNodeTransform.mock.calls[0]![1] as (n: TextNode) => voidtextTransform(new NodeUnderTest() as unknown as TextNode)// nextMatch.start !== 0 → return (line 123)@@ -849,7 +849,7 @@ describe('prompt-editor/utils', () => {const createNode = vi.fn(() => replacementNode as unknown as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)- const textTransform = registerNodeTransform.mock.calls[0][1] as (n: TextNode) => void+ const textTransform = registerNodeTransform.mock.calls[0]![1] as (n: TextNode) => voidtextTransform(new NodeUnderTest() as unknown as TextNode)// createNode was called (first match replacement) and currentNode=null exits loop at 152@@ -904,7 +904,7 @@ describe('prompt-editor/utils', () => {const createNode = vi.fn((node: TextNode) => node as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)- const textTransform = registerNodeTransform.mock.calls[0][1] as (n: TextNode) => void+ const textTransform = registerNodeTransform.mock.calls[0]![1] as (n: TextNode) => voidtextTransform(new NodeUnderTest() as unknown as TextNode)// continue was executed (createNode skipped for the continue iteration), exits via match=null@@ -1000,7 +1000,7 @@ describe('prompt-editor/utils', () => {const createNode = vi.fn((n: TextNode) => n as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)- const textTransform = registerNodeTransform.mock.calls[0][1] as (n: TextNode) => void+ const textTransform = registerNodeTransform.mock.calls[0]![1] as (n: TextNode) => voidtextTransform(new NodeUnderTest() as unknown as TextNode)// isSimpleText returns false → return at line 59, getMatch never called@@ -1059,7 +1059,7 @@ describe('prompt-editor/utils', () => {}registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)- const textTransform = registerNodeTransform.mock.calls[0][1] as (n: TextNode) => void+ const textTransform = registerNodeTransform.mock.calls[0]![1] as (n: TextNode) => voidtextTransform(new NodeUnderTest2() as unknown as TextNode)// diff=1, text.length=2 → remaining='d' → setTextContent called with '@ab'+'c'='@abc'@@ -1116,7 +1116,7 @@ describe('prompt-editor/utils', () => {const createNode = vi.fn((n: TextNode) => n as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)- const textTransform = registerNodeTransform.mock.calls[0][1] as (n: TextNode) => void+ const textTransform = registerNodeTransform.mock.calls[0]![1] as (n: TextNode) => voidconst node = new NodeUnderTest() as unknown as TextNodetextTransform(node)@@ -1158,7 +1158,7 @@ describe('prompt-editor/utils', () => {const createNode = vi.fn((n: TextNode) => n as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)- const textTransform = registerNodeTransform.mock.calls[0][1] as (n: TextNode) => void+ const textTransform = registerNodeTransform.mock.calls[0]![1] as (n: TextNode) => voidtextTransform(new NodeUnderTest() as unknown as TextNode)// Returns at line 131 because nextMatch.start===0 for nextText → no split/replacediff --git a/web/app/components/base/prompt-editor/constants.tsx b/web/app/components/base/prompt-editor/constants.tsxindex 2dcc62706a4..f3d906ffeec 100644--- a/web/app/components/base/prompt-editor/constants.tsx+++ b/web/app/components/base/prompt-editor/constants.tsx@@ -52,7 +52,7 @@ export const getInputVars = (text: string): ValueSelector[] => {.filter(item => item.includes('.')).map((item) => {const valueSelector = item.replace('{{#', '').replace('#}}', '').split('.')- if (valueSelector[1] === 'sys' && /^\d+$/.test(valueSelector[0]))+ if (valueSelector[1] === 'sys' && /^\d+$/.test(valueSelector[0]!))return valueSelector.slice(1)return valueSelectordiff --git a/web/app/components/base/prompt-editor/hooks.ts b/web/app/components/base/prompt-editor/hooks.tsindex 49fc6a8eb0f..dd6c6295a61 100644--- a/web/app/components/base/prompt-editor/hooks.ts+++ b/web/app/components/base/prompt-editor/hooks.ts@@ -171,12 +171,12 @@ export function useBasicTypeaheadTriggerMatch(const match = TypeaheadTriggerRegex.exec(text)if (match !== null) {const maybeLeadingWhitespace = match[1]- const matchingString = match[3]- if (matchingString.length >= minLength) {+ const matchingString = match[3]!+ if (matchingString!.length >= minLength) {return {- leadOffset: match.index + maybeLeadingWhitespace.length,- matchingString,- replaceableString: match[2],+ leadOffset: match.index + maybeLeadingWhitespace!.length,+ matchingString: matchingString!,+ replaceableString: match[2]!,}}}diff --git a/web/app/components/base/prompt-editor/plugins/__tests__/tree-view.spec.tsx b/web/app/components/base/prompt-editor/plugins/__tests__/tree-view.spec.tsxindex c2c9fe92378..a61e9dd209a 100644--- a/web/app/components/base/prompt-editor/plugins/__tests__/tree-view.spec.tsx+++ b/web/app/components/base/prompt-editor/plugins/__tests__/tree-view.spec.tsx@@ -43,9 +43,9 @@ describe('TreeViewPlugin', () => {await waitFor(() => {expect(editor).not.toBeNull()})- expect(screen.getByTestId('lexical-tree-view')).toBeInTheDocument()+ expect(screen.getByTestId('lexical-tree-view'))!.toBeInTheDocument()- const firstCallProps = mockTreeView.mock.calls[0][0] as Record<string, unknown>+ const firstCallProps = mockTreeView.mock.calls[0]![0] as Record<string, unknown>expect(firstCallProps.editor).toBe(editor)expect(firstCallProps.viewClassName).toBe('tree-view-output')diff --git a/web/app/components/base/prompt-editor/plugins/component-picker-block/__tests__/hooks.spec.tsx b/web/app/components/base/prompt-editor/plugins/component-picker-block/__tests__/hooks.spec.tsxindex e28304dd158..c21ad324568 100644--- a/web/app/components/base/prompt-editor/plugins/component-picker-block/__tests__/hooks.spec.tsx+++ b/web/app/components/base/prompt-editor/plugins/component-picker-block/__tests__/hooks.spec.tsx@@ -148,7 +148,7 @@ describe('usePromptOptions', () => {{ wrapper },)expect(result.current).toHaveLength(1)- expect(result.current[0].group).toBe('prompt context')+ expect(result.current[0]!.group).toBe('prompt context')})it('should render the context PromptMenuItem without crashing', () => {@@ -157,7 +157,7 @@ describe('usePromptOptions', () => {{ wrapper },)// renderMenuOption returns a React element – just verify it's truthy- const el = result.current[0].renderMenuOption(renderProps)+ const el = result.current[0]!.renderMenuOption(renderProps)expect(el).toBeTruthy()})@@ -175,7 +175,7 @@ describe('usePromptOptions', () => {)const spy = vi.spyOn(capturedEditor!, 'dispatchCommand')- result.current[0].onSelectMenuOption()+ result.current[0]!.onSelectMenuOption()expect(spy).toHaveBeenCalledTimes(1)})@@ -192,7 +192,7 @@ describe('usePromptOptions', () => {)const spy = vi.spyOn(capturedEditor!, 'dispatchCommand')- result.current[0].onSelectMenuOption()+ result.current[0]!.onSelectMenuOption()expect(spy).not.toHaveBeenCalled()})})@@ -215,7 +215,7 @@ describe('usePromptOptions', () => {{ wrapper },)expect(result.current).toHaveLength(1)- expect(result.current[0].group).toBe('prompt query')+ expect(result.current[0]!.group).toBe('prompt query')})it('should render the query PromptMenuItem without crashing', () => {@@ -223,7 +223,7 @@ describe('usePromptOptions', () => {() => usePromptOptions(undefined, makeQueryBlock()),{ wrapper },)- const el = result.current[0].renderMenuOption(renderProps)+ const el = result.current[0]!.renderMenuOption(renderProps)expect(el).toBeTruthy()})@@ -238,7 +238,7 @@ describe('usePromptOptions', () => {{ wrapper },)const spy = vi.spyOn(capturedEditor!, 'dispatchCommand')- result.current[0].onSelectMenuOption()+ result.current[0]!.onSelectMenuOption()expect(spy).toHaveBeenCalledTimes(1)})@@ -253,7 +253,7 @@ describe('usePromptOptions', () => {{ wrapper },)const spy = vi.spyOn(capturedEditor!, 'dispatchCommand')- result.current[0].onSelectMenuOption()+ result.current[0]!.onSelectMenuOption()expect(spy).not.toHaveBeenCalled()})})@@ -276,7 +276,7 @@ describe('usePromptOptions', () => {{ wrapper },)expect(result.current).toHaveLength(1)- expect(result.current[0].group).toBe('request URL')+ expect(result.current[0]!.group).toBe('request URL')})it('should render the requestURL PromptMenuItem without crashing', () => {@@ -284,7 +284,7 @@ describe('usePromptOptions', () => {() => usePromptOptions(undefined, undefined, undefined, makeRequestURLBlock()),{ wrapper },)- const el = result.current[0].renderMenuOption(renderProps)+ const el = result.current[0]!.renderMenuOption(renderProps)expect(el).toBeTruthy()})@@ -299,7 +299,7 @@ describe('usePromptOptions', () => {{ wrapper },)const spy = vi.spyOn(capturedEditor!, 'dispatchCommand')- result.current[0].onSelectMenuOption()+ result.current[0]!.onSelectMenuOption()expect(spy).toHaveBeenCalledTimes(1)})@@ -314,7 +314,7 @@ describe('usePromptOptions', () => {{ wrapper },)const spy = vi.spyOn(capturedEditor!, 'dispatchCommand')- result.current[0].onSelectMenuOption()+ result.current[0]!.onSelectMenuOption()expect(spy).not.toHaveBeenCalled()})})@@ -337,7 +337,7 @@ describe('usePromptOptions', () => {{ wrapper },)expect(result.current).toHaveLength(1)- expect(result.current[0].group).toBe('prompt history')+ expect(result.current[0]!.group).toBe('prompt history')})it('should render the history PromptMenuItem without crashing', () => {@@ -345,7 +345,7 @@ describe('usePromptOptions', () => {() => usePromptOptions(undefined, undefined, makeHistoryBlock()),{ wrapper },)- const el = result.current[0].renderMenuOption(renderProps)+ const el = result.current[0]!.renderMenuOption(renderProps)expect(el).toBeTruthy()})@@ -360,7 +360,7 @@ describe('usePromptOptions', () => {{ wrapper },)const spy = vi.spyOn(capturedEditor!, 'dispatchCommand')- result.current[0].onSelectMenuOption()+ result.current[0]!.onSelectMenuOption()expect(spy).toHaveBeenCalledTimes(1)})@@ -375,7 +375,7 @@ describe('usePromptOptions', () => {{ wrapper },)const spy = vi.spyOn(capturedEditor!, 'dispatchCommand')- result.current[0].onSelectMenuOption()+ result.current[0]!.onSelectMenuOption()expect(spy).not.toHaveBeenCalled()})})@@ -398,11 +398,11 @@ describe('usePromptOptions', () => {{ wrapper },)expect(result.current).toHaveLength(4)- expect(result.current[0].group).toBe('prompt context')- expect(result.current[1].group).toBe('prompt query')+ expect(result.current[0]!.group).toBe('prompt context')+ expect(result.current[1]!.group).toBe('prompt query')// requestURL is pushed 3rd – before historyBlock- expect(result.current[2].group).toBe('request URL')- expect(result.current[3].group).toBe('prompt history')+ expect(result.current[2]!.group).toBe('request URL')+ expect(result.current[3]!.group).toBe('prompt history')})})})@@ -455,7 +455,7 @@ describe('useVariableOptions', () => {{ wrapper },)expect(result.current).toHaveLength(1)- expect(result.current[0].group).toBe('prompt variable')+ expect(result.current[0]!.group).toBe('prompt variable')})})@@ -474,8 +474,8 @@ describe('useVariableOptions', () => {)// 2 variable options + 1 addOption = 3expect(result.current).toHaveLength(3)- expect(result.current[0].key).toBe('alpha')- expect(result.current[1].key).toBe('beta')+ expect(result.current[0]!.key).toBe('alpha')+ expect(result.current[1]!.key).toBe('beta')})it('should render variable VariableMenuItems without crashing', () => {@@ -485,7 +485,7 @@ describe('useVariableOptions', () => {{ wrapper },)// Pass a queryString so we exercise the highlight splitting code path in VariableMenuItem- const el = result.current[0].renderMenuOption({ ...renderProps, queryString: 'my' })+ const el = result.current[0]!.renderMenuOption({ ...renderProps, queryString: 'my' })expect(el).toBeTruthy()})@@ -501,7 +501,7 @@ describe('useVariableOptions', () => {{ wrapper },)const spy = vi.spyOn(capturedEditor!, 'dispatchCommand')- result.current[0].onSelectMenuOption()+ result.current[0]!.onSelectMenuOption()// The command payload wraps the value in {{ }}expect(spy).toHaveBeenCalledWith(expect.anything(), '{{myvar}}')})@@ -523,8 +523,8 @@ describe('useVariableOptions', () => {)// 'alpha' regex (case-insensitive) matches 'alpha' and 'ALPHA_UPPER'; addOption is always appendedexpect(result.current).toHaveLength(3)- expect(result.current[0].key).toBe('alpha')- expect(result.current[1].key).toBe('ALPHA_UPPER')+ expect(result.current[0]!.key).toBe('alpha')+ expect(result.current[1]!.key).toBe('ALPHA_UPPER')})it('should return only addOption when no variables match the queryString', () => {@@ -554,7 +554,7 @@ describe('useVariableOptions', () => {{ wrapper },)const lastOption = result.current[result.current.length - 1]- const el = lastOption.renderMenuOption(renderProps)+ const el = lastOption!.renderMenuOption(renderProps)expect(el).toBeTruthy()})@@ -570,7 +570,7 @@ describe('useVariableOptions', () => {)const spy = vi.spyOn(capturedEditor!, 'update')const lastOption = result.current[result.current.length - 1]- lastOption.onSelectMenuOption()+ lastOption!.onSelectMenuOption()expect(spy).toHaveBeenCalledTimes(1)})})@@ -630,7 +630,7 @@ describe('useExternalToolOptions', () => {{ wrapper },)expect(result.current).toHaveLength(1)- expect(result.current[0].group).toBe('external tool')+ expect(result.current[0]!.group).toBe('external tool')})})@@ -648,8 +648,8 @@ describe('useExternalToolOptions', () => {{ wrapper },)expect(result.current).toHaveLength(3)- expect(result.current[0].key).toBe('tool-a')- expect(result.current[1].key).toBe('tool-b')+ expect(result.current[0]!.key).toBe('tool-a')+ expect(result.current[1]!.key).toBe('tool-b')})it('should render tool VariableMenuItem (with AppIcon and variableName extra element) without crashing', () => {@@ -658,7 +658,7 @@ describe('useExternalToolOptions', () => {{ wrapper },)// pass a queryString to also exercise the highlighting code path- const el = result.current[0].renderMenuOption({ ...renderProps, queryString: 'wea' })+ const el = result.current[0]!.renderMenuOption({ ...renderProps, queryString: 'wea' })expect(el).toBeTruthy()})@@ -673,7 +673,7 @@ describe('useExternalToolOptions', () => {{ wrapper },)const spy = vi.spyOn(capturedEditor!, 'dispatchCommand')- result.current[0].onSelectMenuOption()+ result.current[0]!.onSelectMenuOption()// variableName is 'weather_tool', wrapped in {{ }}expect(spy).toHaveBeenCalledWith(expect.anything(), '{{weather_tool}}')})@@ -694,7 +694,7 @@ describe('useExternalToolOptions', () => {)// 'weather' regex matches 'WeatherTool'; addOption is always appendedexpect(result.current).toHaveLength(2)- expect(result.current[0].key).toBe('WeatherTool')+ expect(result.current[0]!.key).toBe('WeatherTool')})it('should return only addOption when no tools match', () => {@@ -718,7 +718,7 @@ describe('useExternalToolOptions', () => {{ wrapper },)const lastOption = result.current[result.current.length - 1]- const el = lastOption.renderMenuOption(renderProps)+ const el = lastOption!.renderMenuOption(renderProps)expect(el).toBeTruthy()})@@ -729,7 +729,7 @@ describe('useExternalToolOptions', () => {{ wrapper },)const lastOption = result.current[result.current.length - 1]- lastOption.onSelectMenuOption()+ lastOption!.onSelectMenuOption()expect(onAddExternalTool).toHaveBeenCalledTimes(1)})@@ -742,7 +742,7 @@ describe('useExternalToolOptions', () => {{ wrapper },)const lastOption = result.current[result.current.length - 1]- expect(() => lastOption.onSelectMenuOption()).not.toThrow()+ expect(() => lastOption!.onSelectMenuOption()).not.toThrow()})})})@@ -828,7 +828,7 @@ describe('useOptions', () => {{ wrapper },)expect(result.current.workflowVariableOptions).toHaveLength(1)- expect(result.current.workflowVariableOptions[0].nodeId).toBe('node-1')+ expect(result.current.workflowVariableOptions[0]!.nodeId).toBe('node-1')})})@@ -873,9 +873,9 @@ describe('useOptions', () => {),{ wrapper },)- expect(result.current.workflowVariableOptions[0].nodeId).toBe('error_message')- expect(result.current.workflowVariableOptions[0].vars[0].variable).toBe('error_message')- expect(result.current.workflowVariableOptions[0].vars[0].type).toBe(VarType.string)+ expect(result.current.workflowVariableOptions[0]!.nodeId).toBe('error_message')+ expect(result.current.workflowVariableOptions[0]!.vars[0]!.variable).toBe('error_message')+ expect(result.current.workflowVariableOptions[0]!.vars[0]!.type).toBe(VarType.string)})it('should NOT inject error_message when already present in variables', () => {@@ -942,8 +942,8 @@ describe('useOptions', () => {),{ wrapper },)- expect(result.current.workflowVariableOptions[0].nodeId).toBe('last_run')- expect(result.current.workflowVariableOptions[0].vars[0].type).toBe(VarType.object)+ expect(result.current.workflowVariableOptions[0]!.nodeId).toBe('last_run')+ expect(result.current.workflowVariableOptions[0]!.vars[0]!.type).toBe(VarType.object)})it('should NOT inject last_run when already present in variables', () => {@@ -1014,7 +1014,7 @@ describe('useOptions', () => {const currentNode = result.current.workflowVariableOptions.find(v => v.nodeId === 'current')expect(currentNode).toBeDefined()expect(currentNode!.title).toBe('current_prompt')- expect(currentNode!.vars[0].type).toBe(VarType.string)+ expect(currentNode!.vars[0]!.type).toBe(VarType.string)})it('should prepend current node with title "current_code" when generatorType is not prompt', () => {@@ -1153,10 +1153,10 @@ describe('useOptions', () => {// workflowVariableOptions: current + last_run + error_message + node-x = 4expect(result.current.workflowVariableOptions).toHaveLength(4)- expect(result.current.workflowVariableOptions[0].nodeId).toBe('current')- expect(result.current.workflowVariableOptions[1].nodeId).toBe('last_run')- expect(result.current.workflowVariableOptions[2].nodeId).toBe('error_message')- expect(result.current.workflowVariableOptions[3].nodeId).toBe('node-x')+ expect(result.current.workflowVariableOptions[0]!.nodeId).toBe('current')+ expect(result.current.workflowVariableOptions[1]!.nodeId).toBe('last_run')+ expect(result.current.workflowVariableOptions[2]!.nodeId).toBe('error_message')+ expect(result.current.workflowVariableOptions[3]!.nodeId).toBe('node-x')})})})diff --git a/web/app/components/base/prompt-editor/plugins/context-block/__tests__/context-block-replacement-block.spec.tsx b/web/app/components/base/prompt-editor/plugins/context-block/__tests__/context-block-replacement-block.spec.tsxindex 09ff3f9b90e..4f629416011 100644--- a/web/app/components/base/prompt-editor/plugins/context-block/__tests__/context-block-replacement-block.spec.tsx+++ b/web/app/components/base/prompt-editor/plugins/context-block/__tests__/context-block-replacement-block.spec.tsx@@ -75,8 +75,8 @@ function insertTextAndRead(text: string): ReadResult {const nodes = $nodesOfType(ContextBlockNode)result.count = nodes.lengthif (nodes.length > 0) {- result.datasets = nodes[0].getDatasets()- result.canNotAddContext = nodes[0].getCanNotAddContext()+ result.datasets = nodes[0]!.getDatasets()+ result.canNotAddContext = nodes[0]!.getCanNotAddContext()}})return resultdiff --git a/web/app/components/base/prompt-editor/plugins/context-block/__tests__/index.spec.tsx b/web/app/components/base/prompt-editor/plugins/context-block/__tests__/index.spec.tsxindex 8ca0d80ef23..807b1f7aa4e 100644--- a/web/app/components/base/prompt-editor/plugins/context-block/__tests__/index.spec.tsx+++ b/web/app/components/base/prompt-editor/plugins/context-block/__tests__/index.spec.tsx@@ -184,7 +184,7 @@ describe('ContextBlock', () => {renderWithEditor(<ContextBlock />)dispatchInsert()- const onAddContextArg = mockCreateContextBlockNode.mock.calls[0][1] as () => void+ const onAddContextArg = mockCreateContextBlockNode.mock.calls[0]![1] as () => voidexpect(typeof onAddContextArg).toBe('function')expect(() => onAddContextArg()).not.toThrow()diff --git a/web/app/components/base/prompt-editor/plugins/error-message-block/__tests__/error-message-block-replacement-block.spec.tsx b/web/app/components/base/prompt-editor/plugins/error-message-block/__tests__/error-message-block-replacement-block.spec.tsxindex ccef57867af..21606240d37 100644--- a/web/app/components/base/prompt-editor/plugins/error-message-block/__tests__/error-message-block-replacement-block.spec.tsx+++ b/web/app/components/base/prompt-editor/plugins/error-message-block/__tests__/error-message-block-replacement-block.spec.tsx@@ -75,7 +75,7 @@ describe('ErrorMessageBlockReplacementBlock', () => {it('should pass matcher and creator to decoratorTransform and match placeholder text', () => {renderWithLexicalContext(<ErrorMessageBlockReplacementBlock />)- const transformCallback = mockRegisterNodeTransform.mock.calls[0][1] as (node: LexicalNode) => void+ const transformCallback = mockRegisterNodeTransform.mock.calls[0]![1] as (node: LexicalNode) => voidconst textNode = { id: 't-1' } as unknown as LexicalNodetransformCallback(textNode)@@ -85,7 +85,7 @@ describe('ErrorMessageBlockReplacementBlock', () => {expect.any(Function),)- const getMatch = vi.mocked(decoratorTransform).mock.calls[0][1] as (text: string) => EntityMatch | null+ const getMatch = vi.mocked(decoratorTransform).mock.calls[0]![1] as (text: string) => EntityMatch | nullconst match = getMatch(`hello ${ERROR_MESSAGE_PLACEHOLDER_TEXT} world`)expect(match).toEqual({@@ -99,10 +99,10 @@ describe('ErrorMessageBlockReplacementBlock', () => {const onInsert = vi.fn()renderWithLexicalContext(<ErrorMessageBlockReplacementBlock onInsert={onInsert} />)- const transformCallback = mockRegisterNodeTransform.mock.calls[0][1] as (node: LexicalNode) => void+ const transformCallback = mockRegisterNodeTransform.mock.calls[0]![1] as (node: LexicalNode) => voidtransformCallback({ id: 't-1' } as unknown as LexicalNode)- const createNode = vi.mocked(decoratorTransform).mock.calls[0][2] as () => ErrorMessageBlockNode+ const createNode = vi.mocked(decoratorTransform).mock.calls[0]![2] as () => ErrorMessageBlockNodeconst created = createNode()expect(onInsert).toHaveBeenCalledTimes(1)@@ -114,10 +114,10 @@ describe('ErrorMessageBlockReplacementBlock', () => {it('should create replacement node without onInsert callback', () => {renderWithLexicalContext(<ErrorMessageBlockReplacementBlock />)- const transformCallback = mockRegisterNodeTransform.mock.calls[0][1] as (node: LexicalNode) => void+ const transformCallback = mockRegisterNodeTransform.mock.calls[0]![1] as (node: LexicalNode) => voidtransformCallback({ id: 't-1' } as unknown as LexicalNode)- const createNode = vi.mocked(decoratorTransform).mock.calls[0][2] as () => ErrorMessageBlockNode+ const createNode = vi.mocked(decoratorTransform).mock.calls[0]![2] as () => ErrorMessageBlockNodeexpect(() => createNode()).not.toThrow()expect($createErrorMessageBlockNode).toHaveBeenCalled()diff --git a/web/app/components/base/prompt-editor/plugins/error-message-block/__tests__/index.spec.tsx b/web/app/components/base/prompt-editor/plugins/error-message-block/__tests__/index.spec.tsxindex fa52df0a23f..bd7b5b266de 100644--- a/web/app/components/base/prompt-editor/plugins/error-message-block/__tests__/index.spec.tsx+++ b/web/app/components/base/prompt-editor/plugins/error-message-block/__tests__/index.spec.tsx@@ -90,7 +90,7 @@ describe('ErrorMessageBlock', () => {const onInsert = vi.fn()renderWithLexicalContext(<ErrorMessageBlock onInsert={onInsert} />)- const insertHandler = mockRegisterCommand.mock.calls[0][1] as () => boolean+ const insertHandler = mockRegisterCommand.mock.calls[0]![1] as () => booleanconst result = insertHandler()expect($createErrorMessageBlockNode).toHaveBeenCalledTimes(1)@@ -102,7 +102,7 @@ describe('ErrorMessageBlock', () => {it('should return true on insert command without onInsert callback', () => {renderWithLexicalContext(<ErrorMessageBlock />)- const insertHandler = mockRegisterCommand.mock.calls[0][1] as () => boolean+ const insertHandler = mockRegisterCommand.mock.calls[0]![1] as () => booleanexpect(insertHandler()).toBe(true)expect($insertNodes).toHaveBeenCalled()@@ -112,7 +112,7 @@ describe('ErrorMessageBlock', () => {const onDelete = vi.fn()renderWithLexicalContext(<ErrorMessageBlock onDelete={onDelete} />)- const deleteHandler = mockRegisterCommand.mock.calls[1][1] as () => boolean+ const deleteHandler = mockRegisterCommand.mock.calls[1]![1] as () => booleanconst result = deleteHandler()expect(onDelete).toHaveBeenCalledTimes(1)@@ -122,7 +122,7 @@ describe('ErrorMessageBlock', () => {it('should return true on delete command without onDelete callback', () => {renderWithLexicalContext(<ErrorMessageBlock />)- const deleteHandler = mockRegisterCommand.mock.calls[1][1] as () => boolean+ const deleteHandler = mockRegisterCommand.mock.calls[1]![1] as () => booleanexpect(deleteHandler()).toBe(true)})diff --git a/web/app/components/base/prompt-editor/plugins/hitl-input-block/__tests__/component.spec.tsx b/web/app/components/base/prompt-editor/plugins/hitl-input-block/__tests__/component.spec.tsxindex f219f2f8055..ee82595d1c3 100644--- a/web/app/components/base/prompt-editor/plugins/hitl-input-block/__tests__/component.spec.tsx+++ b/web/app/components/base/prompt-editor/plugins/hitl-input-block/__tests__/component.spec.tsx@@ -100,8 +100,8 @@ describe('HITLInputComponent', () => {await user.click(screen.getByRole('button', { name: 'emit-same-name' }))expect(onChange).toHaveBeenCalledTimes(1)- expect(onChange.mock.calls[0][0]).toHaveLength(1)- expect(onChange.mock.calls[0][0][0].output_variable_name).toBe('user_name')+ expect(onChange.mock.calls[0]![0]).toHaveLength(1)+ expect(onChange.mock.calls[0]![0][0].output_variable_name).toBe('user_name')})it('should replace payload when variable name is renamed', async () => {@@ -124,7 +124,7 @@ describe('HITLInputComponent', () => {await user.click(screen.getByRole('button', { name: 'emit-rename' }))expect(onChange).toHaveBeenCalledTimes(1)- expect(onChange.mock.calls[0][0][0].output_variable_name).toBe('renamed_name')+ expect(onChange.mock.calls[0]![0][0].output_variable_name).toBe('renamed_name')})it('should update existing payload when variable name stays the same', async () => {@@ -157,9 +157,9 @@ describe('HITLInputComponent', () => {await user.click(screen.getByRole('button', { name: 'emit-update' }))expect(onChange).toHaveBeenCalledTimes(1)- expect(onChange.mock.calls[0][0][0].default.value).toBe('updated')- expect(onChange.mock.calls[0][0][0].output_variable_name).toBe('user_name')- expect(onChange.mock.calls[0][0][1].output_variable_name).toBe('other_name')- expect(onChange.mock.calls[0][0][1].default.value).toBe('other')+ expect(onChange.mock.calls[0]![0][0].default.value).toBe('updated')+ expect(onChange.mock.calls[0]![0][0].output_variable_name).toBe('user_name')+ expect(onChange.mock.calls[0]![0][1].output_variable_name).toBe('other_name')+ expect(onChange.mock.calls[0]![0][1].default.value).toBe('other')})})diff --git a/web/app/components/base/prompt-editor/plugins/hitl-input-block/__tests__/input-field.spec.tsx b/web/app/components/base/prompt-editor/plugins/hitl-input-block/__tests__/input-field.spec.tsxindex 949295a8a88..ad6ef42a0fa 100644--- a/web/app/components/base/prompt-editor/plugins/hitl-input-block/__tests__/input-field.spec.tsx+++ b/web/app/components/base/prompt-editor/plugins/hitl-input-block/__tests__/input-field.spec.tsx@@ -49,11 +49,11 @@ describe('InputField', () => {)const inputs = screen.getAllByRole('textbox')- await user.clear(inputs[0])- await user.type(inputs[0], 'invalid name')+ await user.clear(inputs[0]!)+ await user.type(inputs[0]!, 'invalid name')- expect(screen.getByText('workflow.nodes.humanInput.insertInputField.variableNameInvalid')).toBeInTheDocument()- expect(screen.getByRole('button', { name: 'common.operation.save' })).toBeDisabled()+ expect(screen.getByText('workflow.nodes.humanInput.insertInputField.variableNameInvalid'))!.toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'common.operation.save' }))!.toBeDisabled()await user.click(screen.getByRole('button', { name: 'common.operation.save' }))await user.keyboard('{Control>}{Enter}{/Control}')expect(onChange).not.toHaveBeenCalled()@@ -76,7 +76,7 @@ describe('InputField', () => {await user.click(screen.getByRole('button', { name: 'common.operation.save' }))expect(onChange).toHaveBeenCalledTimes(1)- expect(onChange.mock.calls[0][0]).toEqual(createPayload())+ expect(onChange.mock.calls[0]![0]).toEqual(createPayload())})it('should call onCancel when cancel button is clicked', async () => {@@ -112,11 +112,11 @@ describe('InputField', () => {)const nameInput = screen.getAllByRole('textbox')[0]- await user.type(nameInput, 'generated_name')+ await user.type(nameInput!, 'generated_name')await user.click(screen.getByRole('button', { name: /workflow\.nodes\.humanInput\.insertInputField\.insert/i }))expect(onChange).toHaveBeenCalledTimes(1)- expect(onChange.mock.calls[0][0]).toEqual({+ expect(onChange.mock.calls[0]![0]).toEqual({type: InputVarType.paragraph,output_variable_name: 'generated_name',default: {@@ -149,11 +149,11 @@ describe('InputField', () => {await user.keyboard('{Tab}')const inputs = screen.getAllByRole('textbox')- await user.type(inputs[1], 'constant-default')+ await user.type(inputs[1]!, 'constant-default')await user.keyboard('{Control>}{Enter}{/Control}')expect(onChange).toHaveBeenCalledTimes(1)- expect(onChange.mock.calls[0][0].default).toEqual({+ expect(onChange.mock.calls[0]![0].default).toEqual({type: 'constant',selector: [],value: 'constant-default',@@ -184,7 +184,7 @@ describe('InputField', () => {await user.click(screen.getByRole('button', { name: /workflow\.nodes\.humanInput\.insertInputField\.insert/i }))expect(onChange).toHaveBeenCalledTimes(1)- expect(onChange.mock.calls[0][0].default.type).toBe('variable')+ expect(onChange.mock.calls[0]![0].default.type).toBe('variable')})it('should switch to constant mode when variable mode type switch is clicked', async () => {@@ -211,7 +211,7 @@ describe('InputField', () => {await user.click(screen.getByRole('button', { name: /workflow\.nodes\.humanInput\.insertInputField\.insert/i }))expect(onChange).toHaveBeenCalledTimes(1)- expect(onChange.mock.calls[0][0].default.type).toBe('constant')+ expect(onChange.mock.calls[0]![0].default.type).toBe('constant')})it('should update default selector when variable picker is used', async () => {@@ -238,7 +238,7 @@ describe('InputField', () => {await user.click(screen.getByRole('button', { name: /workflow\.nodes\.humanInput\.insertInputField\.insert/i }))expect(onChange).toHaveBeenCalledTimes(1)- expect(onChange.mock.calls[0][0].default).toEqual({+ expect(onChange.mock.calls[0]![0].default).toEqual({type: 'variable',selector: ['node-a', 'var-a'],value: '',@@ -268,7 +268,7 @@ describe('InputField', () => {await user.click(screen.getByRole('button', { name: /workflow\.nodes\.humanInput\.insertInputField\.insert/i }))expect(onChange).toHaveBeenCalledTimes(1)- expect(onChange.mock.calls[0][0].default).toEqual({+ expect(onChange.mock.calls[0]![0].default).toEqual({type: 'variable',selector: [],value: '',diff --git a/web/app/components/base/prompt-editor/plugins/hitl-input-block/__tests__/pre-populate.spec.tsx b/web/app/components/base/prompt-editor/plugins/hitl-input-block/__tests__/pre-populate.spec.tsxindex f5efc52c239..990a7ced4a3 100644--- a/web/app/components/base/prompt-editor/plugins/hitl-input-block/__tests__/pre-populate.spec.tsx+++ b/web/app/components/base/prompt-editor/plugins/hitl-input-block/__tests__/pre-populate.spec.tsx@@ -82,12 +82,12 @@ describe('PrePopulate', () => {/>,)- expect(screen.getByText('Static Content')).toBeInTheDocument()+ expect(screen.getByText('Static Content'))!.toBeInTheDocument()await user.keyboard('{Tab}')expect(screen.queryByText('Static Content')).not.toBeInTheDocument()- expect(screen.getByRole('textbox')).toBeInTheDocument()+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})it('should update constant value and toggle to variable mode when type switch is clicked', async () => {@@ -154,7 +154,7 @@ describe('PrePopulate', () => {/>,)- const pickerProps = mockVarReferencePicker.mock.calls[0][0] as VarReferencePickerProps+ const pickerProps = mockVarReferencePicker.mock.calls[0]![0] as VarReferencePickerPropsconst allowString = pickerProps.filterVar({ type: 'string' } as Var)const allowNumber = pickerProps.filterVar({ type: 'number' } as Var)diff --git a/web/app/components/base/prompt-editor/plugins/hitl-input-block/hitl-input-block-replacement-block.tsx b/web/app/components/base/prompt-editor/plugins/hitl-input-block/hitl-input-block-replacement-block.tsxindex 0da99b91553..a63d694e2b0 100644--- a/web/app/components/base/prompt-editor/plugins/hitl-input-block/hitl-input-block-replacement-block.tsx+++ b/web/app/components/base/prompt-editor/plugins/hitl-input-block/hitl-input-block-replacement-block.tsx@@ -45,7 +45,7 @@ const HITLInputReplacementBlock = ({}, [editor])const createHITLInputBlockNode = useCallback((textNode: TextNode): HITLInputNode => {- const varName = textNode.getTextContent().split('.')[1].replace(/#\}\}$/, '')+ const varName = textNode.getTextContent().split('.')[1]!.replace(/#\}\}$/, '')return $applyNodeReplacement($createHITLInputNode(varName,nodeId,diff --git a/web/app/components/base/prompt-editor/plugins/hitl-input-block/variable-block.tsx b/web/app/components/base/prompt-editor/plugins/hitl-input-block/variable-block.tsxindex a466d64eff0..44303c8faaa 100644--- a/web/app/components/base/prompt-editor/plugins/hitl-input-block/variable-block.tsx+++ b/web/app/components/base/prompt-editor/plugins/hitl-input-block/variable-block.tsx@@ -63,7 +63,7 @@ const HITLInputVariableBlockComponent = ({})()const [localWorkflowNodesMap, setLocalWorkflowNodesMap] = useState<WorkflowNodesMap>(workflowNodesMap)- const node = localWorkflowNodesMap![variables[isRagVar ? 1 : 0]]+ const node = localWorkflowNodesMap![variables[isRagVar ? 1 : 0]!]const isException = isExceptionVariable(varName, node?.type)const variableValid = useMemo(() => {@@ -131,7 +131,7 @@ const HITLInputVariableBlockComponent = ({path={variables.slice(1)}varType={getVarType? getVarType({- nodeId: variables[0],+ nodeId: variables[0]!,valueSelector: variables,}): Type.string}diff --git a/web/app/components/base/prompt-editor/plugins/shortcuts-popup-plugin/index.tsx b/web/app/components/base/prompt-editor/plugins/shortcuts-popup-plugin/index.tsxindex 2dedc9768b8..19a2efb5bcb 100644--- a/web/app/components/base/prompt-editor/plugins/shortcuts-popup-plugin/index.tsx+++ b/web/app/components/base/prompt-editor/plugins/shortcuts-popup-plugin/index.tsx@@ -203,7 +203,7 @@ export default function ShortcutsPopupPlugin({let rect: DOMRect | null = nullif (rects && rects.length)- rect = rects[rects.length - 1]+ rect = rects[rects.length - 1]!elserect = range.getBoundingClientRect()diff --git a/web/app/components/base/prompt-editor/plugins/variable-value-block/__tests__/index.spec.tsx b/web/app/components/base/prompt-editor/plugins/variable-value-block/__tests__/index.spec.tsxindex a77c62859b9..cb36a2e8de6 100644--- a/web/app/components/base/prompt-editor/plugins/variable-value-block/__tests__/index.spec.tsx+++ b/web/app/components/base/prompt-editor/plugins/variable-value-block/__tests__/index.spec.tsx@@ -62,7 +62,7 @@ describe('VariableValueBlock', () => {it('should return match offsets when placeholder exists and null when not present', () => {renderWithLexicalContext(<VariableValueBlock />)- const getMatch = vi.mocked(useLexicalTextEntity).mock.calls[0][0] as (text: string) => EntityMatch | null+ const getMatch = vi.mocked(useLexicalTextEntity).mock.calls[0]![0] as (text: string) => EntityMatch | nullconst match = getMatch('prefix {{foo_1}} suffix')expect(match).toEqual({ start: 7, end: 16 })@@ -73,7 +73,7 @@ describe('VariableValueBlock', () => {it('should create variable node from text node content in create callback', () => {renderWithLexicalContext(<VariableValueBlock />)- const createNode = vi.mocked(useLexicalTextEntity).mock.calls[0][2] as (+ const createNode = vi.mocked(useLexicalTextEntity).mock.calls[0]![2] as (textNode: { getTextContent: () => string },) => VariableValueBlockNodediff --git a/web/app/components/base/prompt-editor/plugins/workflow-variable-block/__tests__/component.spec.tsx b/web/app/components/base/prompt-editor/plugins/workflow-variable-block/__tests__/component.spec.tsxindex a6cb70ddb69..804d4653cec 100644--- a/web/app/components/base/prompt-editor/plugins/workflow-variable-block/__tests__/component.spec.tsx+++ b/web/app/components/base/prompt-editor/plugins/workflow-variable-block/__tests__/component.spec.tsx@@ -129,7 +129,7 @@ describe('WorkflowVariableBlockComponent', () => {/>,)- expect(screen.getByRole('button', { name: 'label' })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'label' }))!.toBeInTheDocument()expect(mockHasNodes).toHaveBeenCalledWith([WorkflowVariableBlockNode])expect(mockRegisterCommand).toHaveBeenCalledWith(UPDATE_WORKFLOW_NODES_MAP,@@ -188,7 +188,7 @@ describe('WorkflowVariableBlockComponent', () => {/>,)- expect(screen.getByRole('button', { name: 'label' })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'label' }))!.toBeInTheDocument()})it('should pass computed varType when getVarType is provided', () => {@@ -489,7 +489,7 @@ describe('WorkflowVariableBlockComponent', () => {/>,)- const updateHandler = mockRegisterCommand.mock.calls[0][1] as (payload: UpdateWorkflowNodesMapPayload) => boolean+ const updateHandler = mockRegisterCommand.mock.calls[0]![1] as (payload: UpdateWorkflowNodesMapPayload) => booleanlet result = falseact(() => {result = updateHandler({diff --git a/web/app/components/base/prompt-editor/plugins/workflow-variable-block/__tests__/index.spec.tsx b/web/app/components/base/prompt-editor/plugins/workflow-variable-block/__tests__/index.spec.tsxindex 00b5b66660f..7494d73b8d1 100644--- a/web/app/components/base/prompt-editor/plugins/workflow-variable-block/__tests__/index.spec.tsx+++ b/web/app/components/base/prompt-editor/plugins/workflow-variable-block/__tests__/index.spec.tsx@@ -133,7 +133,7 @@ describe('WorkflowVariableBlock', () => {/>,)- const insertHandler = mockRegisterCommand.mock.calls[0][1] as (variables: string[]) => boolean+ const insertHandler = mockRegisterCommand.mock.calls[0]![1] as (variables: string[]) => booleanconst result = insertHandler(['node-1', 'answer'])expect($createWorkflowVariableBlockNode).toHaveBeenCalledWith(@@ -154,7 +154,7 @@ describe('WorkflowVariableBlock', () => {/>,)- const insertHandler = mockRegisterCommand.mock.calls[0][1] as (variables: string[]) => boolean+ const insertHandler = mockRegisterCommand.mock.calls[0]![1] as (variables: string[]) => booleanexpect(insertHandler(['node-1', 'answer'])).toBe(true)})@@ -168,7 +168,7 @@ describe('WorkflowVariableBlock', () => {/>,)- const deleteHandler = mockRegisterCommand.mock.calls[1][1] as () => boolean+ const deleteHandler = mockRegisterCommand.mock.calls[1]![1] as () => booleanconst result = deleteHandler()expect(onDelete).toHaveBeenCalledTimes(1)@@ -182,7 +182,7 @@ describe('WorkflowVariableBlock', () => {/>,)- const deleteHandler = mockRegisterCommand.mock.calls[1][1] as () => boolean+ const deleteHandler = mockRegisterCommand.mock.calls[1]![1] as () => booleanexpect(deleteHandler()).toBe(true)})diff --git a/web/app/components/base/prompt-editor/plugins/workflow-variable-block/__tests__/workflow-variable-block-replacement-block.spec.tsx b/web/app/components/base/prompt-editor/plugins/workflow-variable-block/__tests__/workflow-variable-block-replacement-block.spec.tsxindex 9dcc37ec354..6b6729a3a2c 100644--- a/web/app/components/base/prompt-editor/plugins/workflow-variable-block/__tests__/workflow-variable-block-replacement-block.spec.tsx+++ b/web/app/components/base/prompt-editor/plugins/workflow-variable-block/__tests__/workflow-variable-block-replacement-block.spec.tsx@@ -123,7 +123,7 @@ describe('WorkflowVariableBlockReplacementBlock', () => {/>,)- const transformCallback = mockRegisterNodeTransform.mock.calls[0][1] as (node: LexicalNode) => void+ const transformCallback = mockRegisterNodeTransform.mock.calls[0]![1] as (node: LexicalNode) => voidconst textNode = { id: 'text-node' } as unknown as LexicalNodetransformCallback(textNode)@@ -141,10 +141,10 @@ describe('WorkflowVariableBlockReplacementBlock', () => {/>,)- const transformCallback = mockRegisterNodeTransform.mock.calls[0][1] as (node: LexicalNode) => void+ const transformCallback = mockRegisterNodeTransform.mock.calls[0]![1] as (node: LexicalNode) => voidtransformCallback({ id: 'text-node' } as unknown as LexicalNode)- const getMatch = vi.mocked(decoratorTransform).mock.calls[0][1] as (text: string) => EntityMatch | null+ const getMatch = vi.mocked(decoratorTransform).mock.calls[0]![1] as (text: string) => EntityMatch | nullconst match = getMatch('prefix {{#node-1.output#}} suffix')expect(match).toEqual({@@ -167,10 +167,10 @@ describe('WorkflowVariableBlockReplacementBlock', () => {/>,)- const transformCallback = mockRegisterNodeTransform.mock.calls[0][1] as (node: LexicalNode) => void+ const transformCallback = mockRegisterNodeTransform.mock.calls[0]![1] as (node: LexicalNode) => voidtransformCallback({ id: 'text-node' } as unknown as LexicalNode)- const createNode = vi.mocked(decoratorTransform).mock.calls[0][2] as (+ const createNode = vi.mocked(decoratorTransform).mock.calls[0]![2] as (textNode: { getTextContent: () => string },) => WorkflowVariableBlockNode@@ -196,10 +196,10 @@ describe('WorkflowVariableBlockReplacementBlock', () => {/>,)- const transformCallback = mockRegisterNodeTransform.mock.calls[0][1] as (node: LexicalNode) => void+ const transformCallback = mockRegisterNodeTransform.mock.calls[0]![1] as (node: LexicalNode) => voidtransformCallback({ id: 'text-node' } as unknown as LexicalNode)- const createNode = vi.mocked(decoratorTransform).mock.calls[0][2] as (+ const createNode = vi.mocked(decoratorTransform).mock.calls[0]![2] as (textNode: { getTextContent: () => string },) => WorkflowVariableBlockNodediff --git a/web/app/components/base/prompt-editor/plugins/workflow-variable-block/component.tsx b/web/app/components/base/prompt-editor/plugins/workflow-variable-block/component.tsxindex bf91d258345..f30970ba6d1 100644--- a/web/app/components/base/prompt-editor/plugins/workflow-variable-block/component.tsx+++ b/web/app/components/base/prompt-editor/plugins/workflow-variable-block/component.tsx@@ -69,11 +69,11 @@ const WorkflowVariableBlockComponent = ({)()const [localWorkflowNodesMap, setLocalWorkflowNodesMap] = useState<WorkflowNodesMap>(workflowNodesMap)const [localAvailableVariables, setLocalAvailableVariables] = useState<NodeOutPutVar[]>(availableVariables || [])- const node = localWorkflowNodesMap![variables[isRagVar ? 1 : 0]]+ const node = localWorkflowNodesMap![variables[isRagVar ? 1 : 0]!]const isException = isExceptionVariable(varName, node?.type)const sourceNodeId = variables[isRagVar ? 1 : 0]- const isLlmModelInstalled = useLlmModelPluginInstalled(sourceNodeId, localWorkflowNodesMap)+ const isLlmModelInstalled = useLlmModelPluginInstalled(sourceNodeId!, localWorkflowNodesMap)const variableValid = useMemo(() => {if (isSpecialVar(variables[0] ?? ''))return true@@ -120,10 +120,10 @@ const WorkflowVariableBlockComponent = ({} = reactflowconst { transform } = store.getState()const zoom = transform[2]- const position = node.position+ const position = node!.positionsetViewport({- x: (clientWidth - 400 - node.width! * zoom) / 2 - position!.x * zoom,- y: (clientHeight - node.height! * zoom) / 2 - position!.y * zoom,+ x: (clientWidth - 400 - node!.width! * zoom) / 2 - position!.x * zoom,+ y: (clientHeight - node!.height! * zoom) / 2 - position!.y * zoom,zoom: transform[2],})}, [node, reactflow, store])@@ -163,7 +163,7 @@ const WorkflowVariableBlockComponent = ({path={variables.slice(1)}varType={getVarType? getVarType({- nodeId: variables[0],+ nodeId: variables[0]!,valueSelector: variables,}): Type.string}diff --git a/web/app/components/base/prompt-editor/utils.ts b/web/app/components/base/prompt-editor/utils.tsindex d81820fa167..af1d0524009 100644--- a/web/app/components/base/prompt-editor/utils.ts+++ b/web/app/components/base/prompt-editor/utils.ts@@ -140,13 +140,13 @@ export function registerLexicalTextEntity<T extends TextNode>(let nodeToReplaceif (match.start === 0)- [nodeToReplace, currentNode] = currentNode.splitText(match.end)+ [nodeToReplace, currentNode] = (currentNode.splitText(match.end)) as [any, TextNode]else- [, nodeToReplace, currentNode] = currentNode.splitText(match.start, match.end)+ [, nodeToReplace, currentNode] = (currentNode.splitText(match.start, match.end)) as [unknown, any, TextNode]- const replacementNode = createNode(nodeToReplace)- replacementNode.setFormat(nodeToReplace.getFormat())- nodeToReplace.replace(replacementNode)+ const replacementNode = createNode(nodeToReplace!)+ replacementNode.setFormat(nodeToReplace!.getFormat())+ nodeToReplace!.replace(replacementNode)if (currentNode == null)return@@ -240,12 +240,12 @@ export const decoratorTransform = (let nodeToReplaceif (match.start === 0)- [nodeToReplace, currentNode] = currentNode.splitText(match.end)+ [nodeToReplace, currentNode] = (currentNode.splitText(match.end)) as [any, CustomTextNode]else- [, nodeToReplace, currentNode] = currentNode.splitText(match.start, match.end)+ [, nodeToReplace, currentNode] = (currentNode.splitText(match.start, match.end)) as [unknown, any, CustomTextNode]- const replacementNode = createNode(nodeToReplace)- nodeToReplace.replace(replacementNode)+ const replacementNode = createNode(nodeToReplace!)+ nodeToReplace!.replace(replacementNode)if (currentNode == null)return@@ -292,7 +292,7 @@ export function $splitNodeContainingQuery(match: MenuTextMatch): TextNode | nullelse[, newNode] = anchorNode.splitText(startOffset, selectionOffset)- return newNode+ return newNode!}export function textToEditorState(text: string) {diff --git a/web/app/components/base/prompt-log-modal/__tests__/index.spec.tsx b/web/app/components/base/prompt-log-modal/__tests__/index.spec.tsxindex 01902f2e999..95de5aff39c 100644--- a/web/app/components/base/prompt-log-modal/__tests__/index.spec.tsx+++ b/web/app/components/base/prompt-log-modal/__tests__/index.spec.tsx@@ -32,8 +32,8 @@ describe('PromptLogModal', () => {describe('Render', () => {it('renders correctly when currentLogItem is provided', () => {render(<PromptLogModal {...defaultProps} />)- expect(screen.getByText('PROMPT LOG')).toBeInTheDocument()- expect(screen.getByText('Hello')).toBeInTheDocument()+ expect(screen.getByText('PROMPT LOG'))!.toBeInTheDocument()+ expect(screen.getByText('Hello'))!.toBeInTheDocument()})it('returns null when currentLogItem is missing', () => {@@ -43,7 +43,7 @@ describe('PromptLogModal', () => {it('renders copy feedback when log length is 1', () => {render(<PromptLogModal {...defaultProps} />)- expect(screen.getByTestId('close-btn-container')).toBeInTheDocument()+ expect(screen.getByTestId('close-btn-container'))!.toBeInTheDocument()})it('renders multiple logs in Card correctly', () => {@@ -58,9 +58,9 @@ describe('PromptLogModal', () => {},} as unknown as Parameters<typeof PromptLogModal>[0]render(<PromptLogModal {...props} />)- expect(screen.getByText('USER')).toBeInTheDocument()- expect(screen.getByText('ASSISTANT')).toBeInTheDocument()- expect(screen.getByText('Hi there')).toBeInTheDocument()+ expect(screen.getByText('USER'))!.toBeInTheDocument()+ expect(screen.getByText('ASSISTANT'))!.toBeInTheDocument()+ expect(screen.getByText('Hi there'))!.toBeInTheDocument()})it('returns null when currentLogItem.log is missing', () => {@@ -73,7 +73,7 @@ describe('PromptLogModal', () => {it('calls onCancel when close button is clicked', () => {render(<PromptLogModal {...defaultProps} />)const closeBtn = screen.getByTestId('close-btn')- expect(closeBtn).toBeInTheDocument()+ expect(closeBtn)!.toBeInTheDocument()fireEvent.click(closeBtn)expect(defaultProps.onCancel).toHaveBeenCalled()})@@ -88,7 +88,8 @@ describe('PromptLogModal', () => {expect(clickAwayHandlers.length).toBeGreaterThan(0)// Call the last registered handler (simulating click away)- clickAwayHandlers[clickAwayHandlers.length - 1]()+ // Call the last registered handler (simulating click away)+ clickAwayHandlers[clickAwayHandlers.length - 1]!()expect(onCancel).toHaveBeenCalled()})@@ -98,7 +99,8 @@ describe('PromptLogModal', () => {expect(clickAwayHandlers.length).toBeGreaterThan(0)// The first handler in the array is captured during the initial render before useEffect runs- clickAwayHandlers[0]()+ // The first handler in the array is captured during the initial render before useEffect runs+ clickAwayHandlers[0]!()expect(onCancel).not.toHaveBeenCalled()})})diff --git a/web/app/components/base/prompt-log-modal/card.tsx b/web/app/components/base/prompt-log-modal/card.tsxindex ca03837c6b9..515fa6bf2cc 100644--- a/web/app/components/base/prompt-log-modal/card.tsx+++ b/web/app/components/base/prompt-log-modal/card.tsx@@ -13,7 +13,7 @@ const Card: FC<CardProps> = ({log.length === 1 && (<div className="px-4 py-2"><div className="whitespace-pre-line text-text-secondary">- {log[0].text}+ {log[0]!.text}</div></div>)diff --git a/web/app/components/base/prompt-log-modal/index.tsx b/web/app/components/base/prompt-log-modal/index.tsxindex 6a79dfffebf..5b9468a501c 100644--- a/web/app/components/base/prompt-log-modal/index.tsx+++ b/web/app/components/base/prompt-log-modal/index.tsx@@ -48,7 +48,7 @@ const PromptLogModal: FC<PromptLogModalProps> = ({{currentLogItem.log?.length === 1 && (<>- <CopyFeedbackNew className="h-6 w-6" content={currentLogItem.log[0].text} />+ <CopyFeedbackNew className="h-6 w-6" content={currentLogItem.log[0]!.text} /><div className="mx-2.5 h-[14px] w-px bg-divider-regular" /></>)diff --git a/web/app/components/base/select/__tests__/index.spec.tsx b/web/app/components/base/select/__tests__/index.spec.tsxindex e76768953dc..6ddc51c1773 100644--- a/web/app/components/base/select/__tests__/index.spec.tsx+++ b/web/app/components/base/select/__tests__/index.spec.tsx@@ -25,7 +25,7 @@ describe('Select', () => {/>,)- expect(screen.getByTitle('Banana')).toBeInTheDocument()+ expect(screen.getByTitle('Banana'))!.toBeInTheDocument()})it('should render null selectedItem when defaultValue does not match any item', () => {@@ -38,6 +38,37 @@ describe('Select', () => {/>,)+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default+ // No item title should appear for a non-matching default// No item title should appear for a non-matching defaultexpect(screen.queryByTitle('Apple')).not.toBeInTheDocument()expect(screen.queryByTitle('Banana')).not.toBeInTheDocument()@@ -53,7 +84,7 @@ describe('Select', () => {/>,)- expect(screen.getByRole('combobox')).toBeInTheDocument()+ expect(screen.getByRole('combobox'))!.toBeInTheDocument()})it('should apply custom bgClassName', () => {@@ -67,7 +98,7 @@ describe('Select', () => {/>,)- expect(screen.getByTitle('Apple')).toBeInTheDocument()+ expect(screen.getByTitle('Apple'))!.toBeInTheDocument()})})@@ -128,13 +159,44 @@ describe('Select', () => {// First, click the chevron button to open the dropdownconst buttons = screen.getAllByRole('button')- await user.click(buttons[0])+ await user.click(buttons[0]!)// Now type in the search input to filterconst input = screen.getByRole('combobox')await user.clear(input)await user.type(input, 'ban')+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away+ // Citrus should be filtered away// Citrus should be filtered awayexpect(screen.queryByText('Citrus')).not.toBeInTheDocument()})@@ -155,6 +217,68 @@ describe('Select', () => {// we must use fireEvent because userEvent throws on disabled inputsfireEvent.change(input, { target: { value: 'ban' } })+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.+ // We just want to ensure it doesn't throw and covers the !disabled branch in onChange.+ // Since it's disabled, no search dropdown should appear.// We just want to ensure it doesn't throw and covers the !disabled branch in onChange.// Since it's disabled, no search dropdown should appear.expect(screen.queryByRole('listbox')).not.toBeInTheDocument()@@ -206,6 +330,37 @@ describe('Select', () => {fireEvent.click(button)fireEvent.click(chevron)+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it+ // Dropdown options should not appear because the internal `if (!disabled)` guards it// Dropdown options should not appear because the internal `if (!disabled)` guards itexpect(screen.queryByText('Banana')).not.toBeInTheDocument()})@@ -226,7 +381,7 @@ describe('Select', () => {}}/>,)- expect(screen.getByText('Custom: Fallback')).toBeInTheDocument()+ expect(screen.getByText('Custom: Fallback'))!.toBeInTheDocument()})it('should render with custom renderOption', async () => {@@ -249,8 +404,8 @@ describe('Select', () => {await user.click(screen.getByTitle('Apple'))- expect(screen.getByTestId('custom-opt-apple')).toBeInTheDocument()- expect(screen.getByTestId('custom-opt-banana')).toBeInTheDocument()+ expect(screen.getByTestId('custom-opt-apple'))!.toBeInTheDocument()+ expect(screen.getByTestId('custom-opt-banana'))!.toBeInTheDocument()})it('should show ChevronUpIcon when open and ChevronDownIcon when closed', async () => {@@ -268,7 +423,8 @@ describe('Select', () => {// Initially closed — should have a chevron buttonawait user.click(screen.getByTitle('Apple'))// Dropdown is now open- expect(screen.getByText('Banana')).toBeInTheDocument()+ // Dropdown is now open+ expect(screen.getByText('Banana'))!.toBeInTheDocument()})})})@@ -291,7 +447,7 @@ describe('SimpleSelect', () => {/>,)- expect(screen.getByText(/select/i)).toBeInTheDocument()+ expect(screen.getByText(/select/i))!.toBeInTheDocument()})it('should render custom placeholder when provided', () => {@@ -304,7 +460,7 @@ describe('SimpleSelect', () => {/>,)- expect(screen.getByText('Pick one')).toBeInTheDocument()+ expect(screen.getByText('Pick one'))!.toBeInTheDocument()})it('should render selected item name when defaultValue matches', () => {@@ -316,7 +472,7 @@ describe('SimpleSelect', () => {/>,)- expect(screen.getByText('Banana')).toBeInTheDocument()+ expect(screen.getByText('Banana'))!.toBeInTheDocument()})it('should render with isLoading=true showing spinner', () => {@@ -330,7 +486,8 @@ describe('SimpleSelect', () => {)// Loader icon should be rendered (RiLoader4Line has aria hidden)- expect(screen.getByText('Apple')).toBeInTheDocument()+ // Loader icon should be rendered (RiLoader4Line has aria hidden)+ expect(screen.getByText('Apple'))!.toBeInTheDocument()})it('should render group items as non-selectable headers', async () => {@@ -350,7 +507,7 @@ describe('SimpleSelect', () => {)await user.click(screen.getByRole('button'))- expect(screen.getByText('Fruits')).toBeInTheDocument()+ expect(screen.getByText('Fruits'))!.toBeInTheDocument()})it('should not render ListboxOptions when disabled', () => {@@ -363,7 +520,7 @@ describe('SimpleSelect', () => {/>,)- expect(screen.getByText('Apple')).toBeInTheDocument()+ expect(screen.getByText('Apple'))!.toBeInTheDocument()})it('should not open SimpleSelect when disabled', async () => {@@ -381,6 +538,37 @@ describe('SimpleSelect', () => {const button = screen.getByRole('button')await user.click(button)+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open+ // Banana should not be visible as it won't open// Banana should not be visible as it won't openexpect(screen.queryByText('Banana')).not.toBeInTheDocument()})@@ -426,7 +614,7 @@ describe('SimpleSelect', () => {value: 'apple',name: 'Apple',}))- expect(screen.getByText('Apple')).toBeInTheDocument()+ expect(screen.getByText('Apple'))!.toBeInTheDocument()})it('should pass open state into renderTrigger', async () => {@@ -443,9 +631,9 @@ describe('SimpleSelect', () => {/>,)- expect(screen.getByText('none-closed')).toBeInTheDocument()+ expect(screen.getByText('none-closed'))!.toBeInTheDocument()await user.click(screen.getByText('none-closed'))- expect(screen.getByText('none-open')).toBeInTheDocument()+ expect(screen.getByText('none-open'))!.toBeInTheDocument()})it('should clear selection when XMark is clicked (notClearable=false)', async () => {@@ -463,7 +651,7 @@ describe('SimpleSelect', () => {// The clear button (XMarkIcon) should be visible when an item is selectedconst clearBtn = screen.getByRole('button').querySelector('[aria-hidden="false"]')- expect(clearBtn).toBeInTheDocument()+ expect(clearBtn)!.toBeInTheDocument()await user.click(clearBtn!)@@ -519,10 +707,11 @@ describe('SimpleSelect', () => {)await user.click(screen.getByRole('button'))- expect(screen.getByTestId('simple-opt-apple')).toBeInTheDocument()- expect(screen.getByTestId('simple-opt-banana')).toBeInTheDocument()+ expect(screen.getByTestId('simple-opt-apple'))!.toBeInTheDocument()+ expect(screen.getByTestId('simple-opt-banana'))!.toBeInTheDocument()+ // Verify the custom render shows selected state// Verify the custom render shows selected state- expect(screen.getByTestId('simple-opt-apple')).toHaveTextContent('Apple (selected)')+ expect(screen.getByTestId('simple-opt-apple'))!.toHaveTextContent('Apple (selected)')})it('should call onOpenChange when the button is clicked', async () => {@@ -561,7 +750,8 @@ describe('SimpleSelect', () => {await user.click(screen.getByRole('button'))// Banana should be rendered but not selectable- expect(screen.getByText('Banana')).toBeInTheDocument()+ // Banana should be rendered but not selectable+ expect(screen.getByText('Banana'))!.toBeInTheDocument()})})})@@ -584,7 +774,7 @@ describe('PortalSelect', () => {/>,)- expect(screen.getByText(/select/i)).toBeInTheDocument()+ expect(screen.getByText(/select/i))!.toBeInTheDocument()})it('should show selected item name when value matches', () => {@@ -596,7 +786,7 @@ describe('PortalSelect', () => {/>,)- expect(screen.getByTitle('Banana')).toBeInTheDocument()+ expect(screen.getByTitle('Banana'))!.toBeInTheDocument()})it('should render with custom placeholder', () => {@@ -609,7 +799,7 @@ describe('PortalSelect', () => {/>,)- expect(screen.getByText('Choose fruit')).toBeInTheDocument()+ expect(screen.getByText('Choose fruit'))!.toBeInTheDocument()})it('should render with renderTrigger', () => {@@ -624,7 +814,7 @@ describe('PortalSelect', () => {/>,)- expect(screen.getByTestId('custom-trigger')).toHaveTextContent('Apple')+ expect(screen.getByTestId('custom-trigger'))!.toHaveTextContent('Apple')})it('should show INSTALLED badge when installedValue differs from selected value', () => {@@ -637,7 +827,7 @@ describe('PortalSelect', () => {/>,)- expect(screen.getByTitle('Banana')).toBeInTheDocument()+ expect(screen.getByTitle('Banana'))!.toBeInTheDocument()})it('should apply triggerClassNameFn', () => {@@ -741,7 +931,8 @@ describe('PortalSelect', () => {await user.click(screen.getByTitle('Banana'))// The installed badge should appear in the dropdown- expect(screen.getByText('INSTALLED')).toBeInTheDocument()+ // The installed badge should appear in the dropdown+ expect(screen.getByText('INSTALLED'))!.toBeInTheDocument()})it('should render item.extra content in dropdown', async () => {@@ -760,7 +951,7 @@ describe('PortalSelect', () => {)await user.click(screen.getByText(/select/i))- expect(screen.getByTestId('extra-apple')).toBeInTheDocument()+ expect(screen.getByTestId('extra-apple'))!.toBeInTheDocument()})})})diff --git a/web/app/components/base/select/__tests__/pure.spec.tsx b/web/app/components/base/select/__tests__/pure.spec.tsxindex c92cc408fb7..7b62754ec46 100644--- a/web/app/components/base/select/__tests__/pure.spec.tsx+++ b/web/app/components/base/select/__tests__/pure.spec.tsx@@ -18,27 +18,27 @@ describe('PureSelect', () => {describe('Rendering', () => {it('should render i18n placeholder when single value is empty', () => {render(<PureSelect options={options} />)- expect(screen.getByTitle(/select/i)).toBeInTheDocument()+ expect(screen.getByTitle(/select/i))!.toBeInTheDocument()})it('should render custom placeholder when provided', () => {render(<PureSelect options={options} placeholder="Choose value" />)- expect(screen.getByTitle('Choose value')).toBeInTheDocument()+ expect(screen.getByTitle('Choose value'))!.toBeInTheDocument()})it('should render selected option label in single mode', () => {render(<PureSelect options={options} value="banana" />)- expect(screen.getByTitle('Banana')).toBeInTheDocument()+ expect(screen.getByTitle('Banana'))!.toBeInTheDocument()})it('should render selected count text in multiple mode', () => {render(<PureSelect options={options} multiple={true} value={['apple', 'banana']} />)- expect(screen.getByText(/selected/i)).toBeInTheDocument()+ expect(screen.getByText(/selected/i))!.toBeInTheDocument()})it('should render placeholder in multiple mode when selected values are empty', () => {render(<PureSelect options={options} multiple={true} value={[]} placeholder="Pick fruits" />)- expect(screen.getByTitle('Pick fruits')).toBeInTheDocument()+ expect(screen.getByTitle('Pick fruits'))!.toBeInTheDocument()})})@@ -51,7 +51,7 @@ describe('PureSelect', () => {render(<PureSelect options={options} onChange={onChange} />)await user.click(screen.getByTitle(/select/i))- expect(screen.getByTitle('Banana')).toBeInTheDocument()+ expect(screen.getByTitle('Banana'))!.toBeInTheDocument()await user.click(screen.getByTitle('Banana'))@@ -73,7 +73,7 @@ describe('PureSelect', () => {)await user.click(screen.getByText(/common\.dynamicSelect\.selected/i))- await user.click(screen.getAllByTitle('Banana')[0])+ await user.click(screen.getAllByTitle('Banana')[0]!)expect(onChange).toHaveBeenCalledWith(['apple', 'banana'])})@@ -92,7 +92,7 @@ describe('PureSelect', () => {)await user.click(screen.getByText(/common\.dynamicSelect\.selected/i))- await user.click(screen.getAllByTitle('Apple')[0])+ await user.click(screen.getAllByTitle('Apple')[0]!)expect(onChange).toHaveBeenCalledWith(['banana'])})@@ -110,7 +110,7 @@ describe('PureSelect', () => {/>,)- await user.click(screen.getAllByTitle('Apple')[0])+ await user.click(screen.getAllByTitle('Apple')[0]!)expect(onChange).toHaveBeenCalledWith(['apple'])})})@@ -128,7 +128,7 @@ describe('PureSelect', () => {/>,)- expect(screen.getByTitle('Apple')).toBeInTheDocument()+ expect(screen.getByTitle('Apple'))!.toBeInTheDocument()await user.click(screen.getByTitle(/select/i))expect(onOpenChange).toHaveBeenCalledWith(false)@@ -161,7 +161,7 @@ describe('PureSelect', () => {/>,)- await user.click(screen.getAllByTitle('Apple')[0])+ await user.click(screen.getAllByTitle('Apple')[0]!)expect(onChange).not.toHaveBeenCalled()})})@@ -187,11 +187,11 @@ describe('PureSelect', () => {const triggerLabel = screen.getByTitle(/select/i)const trigger = triggerLabel.parentElement- expect(trigger).toHaveClass('trigger-class')- expect(document.querySelector('.wrapper-class')).toBeInTheDocument()- expect(document.querySelector('.popup-class')).toBeInTheDocument()+ expect(trigger)!.toHaveClass('trigger-class')+ expect(document.querySelector('.wrapper-class'))!.toBeInTheDocument()+ expect(document.querySelector('.popup-class'))!.toBeInTheDocument()expect(document.querySelectorAll('.item-class')).toHaveLength(options.length)- expect(screen.getByText('Available options')).toHaveClass('title-class')+ expect(screen.getByText('Available options'))!.toHaveClass('title-class')})})})diff --git a/web/app/components/base/svg-gallery/__tests__/index.spec.tsx b/web/app/components/base/svg-gallery/__tests__/index.spec.tsxindex f88856dce2d..c08b527d941 100644--- a/web/app/components/base/svg-gallery/__tests__/index.spec.tsx+++ b/web/app/components/base/svg-gallery/__tests__/index.spec.tsx@@ -64,7 +64,7 @@ describe('SVGRenderer', () => {render(<SVGRenderer content="invalid" />)await waitFor(() => {- expect(screen.getByText(/Error rendering SVG/)).toBeInTheDocument()+ expect(screen.getByText(/Error rendering SVG/))!.toBeInTheDocument()})})@@ -104,14 +104,14 @@ describe('SVGRenderer', () => {await waitFor(() => {expect(mockClick).toHaveBeenCalled()})- const clickHandler = mockClick.mock.calls[0][0]+ const clickHandler = mockClick.mock.calls[0]![0]await act(async () => {clickHandler()})const img = screen.getByAltText('Preview')- expect(img).toBeInTheDocument()- expect(img).toHaveAttribute(+ expect(img)!.toBeInTheDocument()+ expect(img)!.toHaveAttribute('src',expect.stringContaining('data:image/svg+xml;base64'),)@@ -124,12 +124,12 @@ describe('SVGRenderer', () => {await waitFor(() => {expect(mockClick).toHaveBeenCalled()})- const clickHandler = mockClick.mock.calls[0][0]+ const clickHandler = mockClick.mock.calls[0]![0]await act(async () => {clickHandler()})- expect(screen.getByAltText('Preview')).toBeInTheDocument()+ expect(screen.getByAltText('Preview'))!.toBeInTheDocument()await user.click(screen.getByTestId('image-preview-close-button'))diff --git a/web/app/components/base/svg/__tests__/index.spec.tsx b/web/app/components/base/svg/__tests__/index.spec.tsxindex 88d59697297..43c8c23c35b 100644--- a/web/app/components/base/svg/__tests__/index.spec.tsx+++ b/web/app/components/base/svg/__tests__/index.spec.tsx@@ -6,7 +6,7 @@ describe('SVGBtn', () => {it('renders correctly', () => {const setIsSVG = vi.fn()render(<SVGBtn isSVG={false} setIsSVG={setIsSVG} />)- expect(screen.getByRole('button')).toBeInTheDocument()+ expect(screen.getByRole('button'))!.toBeInTheDocument()})})@@ -19,7 +19,7 @@ describe('SVGBtn', () => {fireEvent.click(button)expect(setIsSVG).toHaveBeenCalledTimes(1)- const toggleFunc = setIsSVG.mock.calls[0][0]+ const toggleFunc = setIsSVG.mock.calls[0]![0]expect(typeof toggleFunc).toBe('function')expect(toggleFunc(false)).toBe(true)expect(toggleFunc(true)).toBe(false)diff --git a/web/app/components/base/tag-input/__tests__/index.spec.tsx b/web/app/components/base/tag-input/__tests__/index.spec.tsxindex 4edd34c3771..82ace7f49b3 100644--- a/web/app/components/base/tag-input/__tests__/index.spec.tsx+++ b/web/app/components/base/tag-input/__tests__/index.spec.tsx@@ -37,21 +37,21 @@ describe('TagInput', () => {it('should render existing tags and default placeholder', () => {renderTagInput({ items: ['alpha', 'beta'] })- expect(screen.getByText('alpha')).toBeInTheDocument()- expect(screen.getByText('beta')).toBeInTheDocument()- expect(screen.getByPlaceholderText('datasetDocuments.segment.addKeyWord')).toBeInTheDocument()+ expect(screen.getByText('alpha'))!.toBeInTheDocument()+ expect(screen.getByText('beta'))!.toBeInTheDocument()+ expect(screen.getByPlaceholderText('datasetDocuments.segment.addKeyWord'))!.toBeInTheDocument()})it('should render special mode placeholder when confirm key is Tab', () => {renderTagInput({ customizedConfirmKey: 'Tab' })- expect(screen.getByPlaceholderText('common.model.params.stop_sequencesPlaceholder')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('common.model.params.stop_sequencesPlaceholder'))!.toBeInTheDocument()})it('should render custom placeholder when placeholder prop is provided', () => {renderTagInput({ placeholder: 'Custom placeholder' })- expect(screen.getByPlaceholderText('Custom placeholder')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('Custom placeholder'))!.toBeInTheDocument()})it('should hide input when add is disabled', () => {@@ -71,11 +71,11 @@ describe('TagInput', () => {const input = screen.getByRole('textbox')const inputContainer = input.parentElement- expect(inputContainer).toHaveClass('border-transparent')+ expect(inputContainer)!.toHaveClass('border-transparent')await userEvent.click(input)- expect(inputContainer).toHaveClass('border-dashed')+ expect(inputContainer)!.toHaveClass('border-dashed')})})@@ -85,7 +85,7 @@ describe('TagInput', () => {const removeControl = screen.getAllByTestId('remove-tag')[0]- await userEvent.click(removeControl)+ await userEvent.click(removeControl!)expect(onChange).toHaveBeenCalledWith(['beta'])})@@ -99,7 +99,7 @@ describe('TagInput', () => {expect(onChange).toHaveBeenCalledWith(['new-tag'])await waitFor(() => {- expect(input).toHaveValue('')+ expect(input)!.toHaveValue('')})})@@ -122,7 +122,7 @@ describe('TagInput', () => {await user.type(input, 'stop')await user.keyboard('{Enter}')- expect(input).toHaveValue('stop↵')+ expect(input)!.toHaveValue('stop↵')expect(onChange).not.toHaveBeenCalled()// Low-level test for preventDefaultdiff --git a/web/app/components/base/tag-management/__tests__/panel.spec.tsx b/web/app/components/base/tag-management/__tests__/panel.spec.tsxindex 2bdf5798ab7..4f985497832 100644--- a/web/app/components/base/tag-management/__tests__/panel.spec.tsx+++ b/web/app/components/base/tag-management/__tests__/panel.spec.tsx@@ -61,8 +61,8 @@ const knowledgeTag: Tag = { id: 'tag-k1', name: 'KnowledgeDB', type: 'knowledge'const defaultProps = {targetID: 'target-1',type: 'app' as const,- value: ['tag-1'], // tag-1 is already selected/bound- selectedTags: [appTags[0]], // pre-selected tags shown separately+ value: ['tag-1'!], // tag-1 is already selected/bound+ selectedTags: [appTags[0]!], // pre-selected tags shown separatelyonCacheUpdate: vi.fn<(tags: Tag[]) => void>(),onChange: vi.fn<() => void>(),onCreate: vi.fn<() => void>(),@@ -82,13 +82,13 @@ describe('Panel', () => {describe('Rendering', () => {it('should render without crashing', () => {render(<Panel {...defaultProps} />)- expect(screen.getByPlaceholderText(i18n.selectorPlaceholder)).toBeInTheDocument()+ expect(screen.getByPlaceholderText(i18n.selectorPlaceholder))!.toBeInTheDocument()})it('should render the search input', () => {render(<Panel {...defaultProps} />)const input = screen.getByPlaceholderText(i18n.selectorPlaceholder)- expect(input).toBeInTheDocument()+ expect(input)!.toBeInTheDocument()expect(input.tagName).toBe('INPUT')})@@ -103,30 +103,62 @@ describe('Panel', () => {render(<Panel {...defaultProps} />)- expect(screen.getByRole('textbox')).toHaveAttribute('placeholder', '')+ expect(screen.getByRole('textbox'))!.toHaveAttribute('placeholder', '')})it('should render selected tags from selectedTags prop', () => {render(<Panel {...defaultProps} />)- expect(screen.getByText('Frontend')).toBeInTheDocument()+ expect(screen.getByText('Frontend'))!.toBeInTheDocument()})it('should render unselected tags matching the type', () => {render(<Panel {...defaultProps} />)// tag-2 and tag-3 are app type and not in value[]- expect(screen.getByText('Backend')).toBeInTheDocument()- expect(screen.getByText('API')).toBeInTheDocument()+ // tag-2 and tag-3 are app type and not in value[]+ expect(screen.getByText('Backend'))!.toBeInTheDocument()+ expect(screen.getByText('API'))!.toBeInTheDocument()})it('should not render tags of a different type', () => {render(<Panel {...defaultProps} />)// knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appear+ // knowledgeTag is type 'knowledge', should not appearexpect(screen.queryByText('KnowledgeDB')).not.toBeInTheDocument()})it('should render the manage tags button', () => {render(<Panel {...defaultProps} />)- expect(screen.getByText(i18n.manageTags)).toBeInTheDocument()+ expect(screen.getByText(i18n.manageTags))!.toBeInTheDocument()})it('should show no-tag message when there are no tags', () => {@@ -134,7 +166,7 @@ describe('Panel', () => {useTagStore.setState({ tagList: [] })})render(<Panel {...defaultProps} value={[]} selectedTags={[]} />)- expect(screen.getByText(i18n.noTag)).toBeInTheDocument()+ expect(screen.getByText(i18n.noTag))!.toBeInTheDocument()})it('should not show no-tag message when tags exist', () => {@@ -151,7 +183,7 @@ describe('Panel', () => {const input = screen.getByPlaceholderText(i18n.selectorPlaceholder)await user.type(input, 'Back')- expect(screen.getByText('Backend')).toBeInTheDocument()+ expect(screen.getByText('Backend'))!.toBeInTheDocument()expect(screen.queryByText('API')).not.toBeInTheDocument()})@@ -162,7 +194,7 @@ describe('Panel', () => {const input = screen.getByPlaceholderText(i18n.selectorPlaceholder)await user.type(input, 'Front')- expect(screen.getByText('Frontend')).toBeInTheDocument()+ expect(screen.getByText('Frontend'))!.toBeInTheDocument()expect(screen.queryByText('Backend')).not.toBeInTheDocument()})@@ -179,8 +211,9 @@ describe('Panel', () => {await user.type(input, 'BrandNewTag')// The create row shows "Create 'BrandNewTag'"- expect(screen.getByText(/BrandNewTag/)).toBeInTheDocument()- expect(screen.getByText(i18n.create, { exact: false })).toBeInTheDocument()+ // The create row shows "Create 'BrandNewTag'"+ expect(screen.getByText(/BrandNewTag/))!.toBeInTheDocument()+ expect(screen.getByText(i18n.create, { exact: false }))!.toBeInTheDocument()})it('should not show create option when keyword matches an existing tag name', async () => {@@ -194,6 +227,37 @@ describe('Panel', () => {const input = screen.getByPlaceholderText(i18n.selectorPlaceholder)await user.type(input, 'Frontend')+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false+ // 'Frontend' matches tag-1 name, so notExisted = false// 'Frontend' matches tag-1 name, so notExisted = falseexpect(screen.queryByText(i18n.create, { exact: false })).not.toBeInTheDocument()})@@ -204,16 +268,17 @@ describe('Panel', () => {const input = screen.getByPlaceholderText(i18n.selectorPlaceholder)await user.type(input, 'Back')- expect(input).toHaveValue('Back')+ expect(input)!.toHaveValue('Back')// The Input component renders a clear icon with data-testid="input-clear"const clearButton = screen.getByTestId('input-clear')await user.click(clearButton)- expect(input).toHaveValue('')+ expect(input)!.toHaveValue('')+ // All tags should be visible again// All tags should be visible again- expect(screen.getByText('Backend')).toBeInTheDocument()- expect(screen.getByText('API')).toBeInTheDocument()+ expect(screen.getByText('Backend'))!.toBeInTheDocument()+ expect(screen.getByText('API'))!.toBeInTheDocument()})})@@ -234,7 +299,7 @@ describe('Panel', () => {await user.click(screen.getByText('Backend'))const backendRowAfterSelect = getTagRow('Backend')- expect(within(backendRowAfterSelect).getByTestId('check-icon-tag-2')).toBeInTheDocument()+ expect(within(backendRowAfterSelect).getByTestId('check-icon-tag-2'))!.toBeInTheDocument()})it('should deselect a selected tag when clicked', async () => {@@ -242,7 +307,7 @@ describe('Panel', () => {render(<Panel {...defaultProps} />)const frontendRowBeforeDeselect = getTagRow('Frontend')- expect(within(frontendRowBeforeDeselect).getByTestId('check-icon-tag-1')).toBeInTheDocument()+ expect(within(frontendRowBeforeDeselect).getByTestId('check-icon-tag-1'))!.toBeInTheDocument()await user.click(screen.getByText('Frontend'))@@ -260,7 +325,7 @@ describe('Panel', () => {await user.click(screen.getByText('Backend'))const backendRowAfterFirstClick = getTagRow('Backend')- expect(within(backendRowAfterFirstClick).getByTestId('check-icon-tag-2')).toBeInTheDocument()+ expect(within(backendRowAfterFirstClick).getByTestId('check-icon-tag-2'))!.toBeInTheDocument()await user.click(screen.getByText('Backend'))@@ -321,7 +386,7 @@ describe('Panel', () => {await user.click(createOption)await waitFor(() => {- expect(input).toHaveValue('')+ expect(input)!.toHaveValue('')})})@@ -382,6 +447,37 @@ describe('Panel', () => {it('should not create tag when keywords is empty', () => {render(<Panel {...defaultProps} />)+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords+ // The create option should not appear when no keywords// The create option should not appear when no keywordsexpect(screen.queryByText(i18n.create, { exact: false })).not.toBeInTheDocument()expect(createTag).not.toHaveBeenCalled()@@ -459,8 +555,8 @@ describe('Panel', () => {expect(defaultProps.onCacheUpdate).toHaveBeenCalledTimes(1)})- const [updatedTags] = vi.mocked(defaultProps.onCacheUpdate).mock.calls[0]- expect(updatedTags.map(tag => tag.id)).toEqual(['tag-1', 'tag-2'])+ const [updatedTags] = (vi.mocked(defaultProps.onCacheUpdate).mock.calls[0] ?? []) as [any]+ expect(updatedTags.map((tag: any) => tag.id)).toEqual(['tag-1', 'tag-2'])})it('should not call bind/unbind when value has not changed', async () => {@@ -568,9 +664,10 @@ describe('Panel', () => {it('should handle empty value array', () => {render(<Panel {...defaultProps} value={[]} selectedTags={[]} />)// All app-type tags should appear in the unselected list- expect(screen.getByText('Frontend')).toBeInTheDocument()- expect(screen.getByText('Backend')).toBeInTheDocument()- expect(screen.getByText('API')).toBeInTheDocument()+ // All app-type tags should appear in the unselected list+ expect(screen.getByText('Frontend'))!.toBeInTheDocument()+ expect(screen.getByText('Backend'))!.toBeInTheDocument()+ expect(screen.getByText('API'))!.toBeInTheDocument()})it('should handle empty tagList in store', () => {@@ -578,7 +675,7 @@ describe('Panel', () => {useTagStore.setState({ tagList: [] })})render(<Panel {...defaultProps} value={[]} selectedTags={[]} />)- expect(screen.getByText(i18n.noTag)).toBeInTheDocument()+ expect(screen.getByText(i18n.noTag))!.toBeInTheDocument()})it('should handle all tags already selected', () => {@@ -590,9 +687,10 @@ describe('Panel', () => {/>,)// All app tags appear in selectedTags, filteredTagList should be empty- expect(screen.getByText('Frontend')).toBeInTheDocument()- expect(screen.getByText('Backend')).toBeInTheDocument()- expect(screen.getByText('API')).toBeInTheDocument()+ // All app tags appear in selectedTags, filteredTagList should be empty+ expect(screen.getByText('Frontend'))!.toBeInTheDocument()+ expect(screen.getByText('Backend'))!.toBeInTheDocument()+ expect(screen.getByText('API'))!.toBeInTheDocument()})it('should show divider between create option and tag list when both present', async () => {@@ -622,7 +720,7 @@ describe('Panel', () => {selectedTags={[]}/>,)- expect(screen.getByText('KnowledgeDB')).toBeInTheDocument()+ expect(screen.getByText('KnowledgeDB'))!.toBeInTheDocument()})})})diff --git a/web/app/components/base/tag-management/__tests__/selector.spec.tsx b/web/app/components/base/tag-management/__tests__/selector.spec.tsxindex 62851641931..b12ed449d0f 100644--- a/web/app/components/base/tag-management/__tests__/selector.spec.tsx+++ b/web/app/components/base/tag-management/__tests__/selector.spec.tsx@@ -53,8 +53,8 @@ const appTags: Tag[] = [const defaultProps = {targetID: 'target-1',type: 'app' as const,- value: ['tag-1'],- selectedTags: [appTags[0]],+ value: ['tag-1'!],+ selectedTags: [appTags[0]!],onCacheUpdate: vi.fn(),onChange: vi.fn(),}@@ -80,29 +80,31 @@ describe('TagSelector', () => {describe('Rendering', () => {it('should render TagSelector trigger with selected tag names from defaultProps when isPopover defaults to true', () => {render(<TagSelector {...defaultProps} />)- expect(screen.getByText('Frontend')).toBeInTheDocument()+ expect(screen.getByText('Frontend'))!.toBeInTheDocument()})it('should render TagSelector add-tag placeholder when defaultProps are overridden with empty selectedTags and value', () => {render(<TagSelector {...defaultProps} selectedTags={[]} value={[]} />)- expect(screen.getByText(i18n.addTag)).toBeInTheDocument()+ expect(screen.getByText(i18n.addTag))!.toBeInTheDocument()})it('should render nothing when isPopover is false', () => {const { container } = render(<TagSelector {...defaultProps} isPopover={false} />)// Only the empty fragment wrapper- expect(container).toBeEmptyDOMElement()+ // Only the empty fragment wrapper+ expect(container)!.toBeEmptyDOMElement()})it('should render the popover trigger button', () => {render(<TagSelector {...defaultProps} />)// The trigger is wrapped in a PopoverButton- expect(screen.getByRole('button')).toBeInTheDocument()+ // The trigger is wrapped in a PopoverButton+ expect(screen.getByRole('button'))!.toBeInTheDocument()})it('should render when minWidth is provided', () => {render(<TagSelector {...defaultProps} minWidth="320px" />)- expect(screen.getByRole('button')).toBeInTheDocument()+ expect(screen.getByRole('button'))!.toBeInTheDocument()})})@@ -112,12 +114,13 @@ describe('TagSelector', () => {render(<TagSelector{...defaultProps}- selectedTags={[appTags[0], unknownTag]}+ selectedTags={[appTags[0]!, unknownTag]}value={['tag-1', 'unknown']}/>,)// 'Frontend' is in tagList, 'Unknown' is not- expect(screen.getByText('Frontend')).toBeInTheDocument()+ // 'Frontend' is in tagList, 'Unknown' is not+ expect(screen.getByText('Frontend'))!.toBeInTheDocument()expect(screen.queryByText('Unknown')).not.toBeInTheDocument()})@@ -129,8 +132,8 @@ describe('TagSelector', () => {value={['tag-1', 'tag-2']}/>,)- expect(screen.getByText('Frontend')).toBeInTheDocument()- expect(screen.getByText('Backend')).toBeInTheDocument()+ expect(screen.getByText('Frontend'))!.toBeInTheDocument()+ expect(screen.getByText('Backend'))!.toBeInTheDocument()})})@@ -143,8 +146,8 @@ describe('TagSelector', () => {// Panel renders the search input and manage tagsawait waitFor(() => {- expect(screen.getByPlaceholderText(i18n.selectorPlaceholder)).toBeInTheDocument()- expect(screen.getByText(i18n.manageTags)).toBeInTheDocument()+ expect(screen.getByPlaceholderText(i18n.selectorPlaceholder))!.toBeInTheDocument()+ expect(screen.getByText(i18n.manageTags))!.toBeInTheDocument()})})@@ -155,7 +158,7 @@ describe('TagSelector', () => {await user.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText('Backend')).toBeInTheDocument()+ expect(screen.getByText('Backend'))!.toBeInTheDocument()})})@@ -169,7 +172,7 @@ describe('TagSelector', () => {await user.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText(i18n.noTag)).toBeInTheDocument()+ expect(screen.getByText(i18n.noTag))!.toBeInTheDocument()})})@@ -231,7 +234,7 @@ describe('TagSelector', () => {await user.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByPlaceholderText(i18n.selectorPlaceholder)).toBeInTheDocument()+ expect(screen.getByPlaceholderText(i18n.selectorPlaceholder))!.toBeInTheDocument()})const input = screen.getByPlaceholderText(i18n.selectorPlaceholder)@@ -267,8 +270,39 @@ describe('TagSelector', () => {/>,)// Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []+ // Orphan tag is not in store tagList, so tags memo returns []expect(screen.queryByText('Orphan')).not.toBeInTheDocument()- expect(screen.getByText(i18n.addTag)).toBeInTheDocument()+ expect(screen.getByText(i18n.addTag))!.toBeInTheDocument()})it('should handle knowledge type', async () => {@@ -290,13 +324,13 @@ describe('TagSelector', () => {/>,)- expect(screen.getByText('KnowledgeDB')).toBeInTheDocument()+ expect(screen.getByText('KnowledgeDB'))!.toBeInTheDocument()// Open popover and verify panel uses knowledge typeawait user.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByPlaceholderText(i18n.selectorPlaceholder)).toBeInTheDocument()+ expect(screen.getByPlaceholderText(i18n.selectorPlaceholder))!.toBeInTheDocument()})const input = screen.getByPlaceholderText(i18n.selectorPlaceholder)diff --git a/web/app/components/base/video-gallery/__tests__/VideoPlayer.spec.tsx b/web/app/components/base/video-gallery/__tests__/VideoPlayer.spec.tsxindex f78155d5c84..20a62984190 100644--- a/web/app/components/base/video-gallery/__tests__/VideoPlayer.spec.tsx+++ b/web/app/components/base/video-gallery/__tests__/VideoPlayer.spec.tsx@@ -89,8 +89,8 @@ describe('VideoPlayer', () => {render(<VideoPlayer srcs={mockSrcs} />)const sources = screen.getByTestId('video-element').querySelectorAll('source')expect(sources).toHaveLength(2)- expect(sources[0].src).toContain(mockSrcs[0])- expect(sources[1].src).toContain(mockSrcs[1])+ expect(sources[0]!.src).toContain(mockSrcs[0])+ expect(sources[1]!.src).toContain(mockSrcs[1])})})@@ -155,11 +155,11 @@ describe('VideoPlayer', () => {const video = screen.getByTestId('video-element') as HTMLVideoElementfireEvent(video, new Event('loadedmetadata'))- expect(screen.getByTestId('video-time-display')).toHaveTextContent('00:00 / 01:40')+ expect(screen.getByTestId('video-time-display'))!.toHaveTextContent('00:00 / 01:40')Object.defineProperty(video, 'currentTime', { value: 30, configurable: true })fireEvent(video, new Event('timeupdate'))- expect(screen.getByTestId('video-time-display')).toHaveTextContent('00:30 / 01:40')+ expect(screen.getByTestId('video-time-display'))!.toHaveTextContent('00:30 / 01:40')})it('should handle video end', async () => {@@ -171,7 +171,7 @@ describe('VideoPlayer', () => {await user.click(playPauseBtn)fireEvent(video, new Event('ended'))- expect(playPauseBtn).toBeInTheDocument()+ expect(playPauseBtn)!.toBeInTheDocument()})it('should show/hide controls on mouse move and timeout', () => {@@ -198,7 +198,7 @@ describe('VideoPlayer', () => {// HoverfireEvent.mouseMove(progressBar, { clientX: 50 })- expect(screen.getByTestId('video-hover-time')).toHaveTextContent('00:50')+ expect(screen.getByTestId('video-hover-time'))!.toHaveTextContent('00:50')fireEvent.mouseLeave(progressBar)expect(screen.queryByTestId('video-hover-time')).not.toBeInTheDocument()@@ -262,7 +262,7 @@ describe('VideoPlayer', () => {})await waitFor(() => {- expect(screen.getByTestId('video-time-display')).toBeInTheDocument()+ expect(screen.getByTestId('video-time-display'))!.toBeInTheDocument()})})@@ -318,7 +318,7 @@ describe('VideoPlayer', () => {// mouseLeave while dragging — hoverTime should remain visiblefireEvent.mouseLeave(progressBar)- expect(screen.getByTestId('video-hover-time')).toBeInTheDocument()+ expect(screen.getByTestId('video-hover-time'))!.toBeInTheDocument()// End dragfireEvent.mouseUp(document)@@ -345,7 +345,7 @@ describe('VideoPlayer', () => {it('should render without src or srcs', () => {render(<VideoPlayer />)const video = screen.getByTestId('video-element') as HTMLVideoElement- expect(video).toBeInTheDocument()+ expect(video)!.toBeInTheDocument()expect(video.getAttribute('src')).toBeNull()expect(video.querySelectorAll('source')).toHaveLength(0)})@@ -357,18 +357,19 @@ describe('VideoPlayer', () => {const controls = screen.getByTestId('video-controls')// Initial state: visible- expect(controls).toHaveAttribute('data-is-visible', 'true')+ // Initial state: visible+ expect(controls)!.toHaveAttribute('data-is-visible', 'true')// Let controls hidefireEvent.mouseMove(container)act(() => {vi.advanceTimersByTime(3001)})- expect(controls).toHaveAttribute('data-is-visible', 'false')+ expect(controls)!.toHaveAttribute('data-is-visible', 'false')// mouseEnter should show controls againfireEvent.mouseEnter(container)- expect(controls).toHaveAttribute('data-is-visible', 'true')+ expect(controls)!.toHaveAttribute('data-is-visible', 'true')vi.useRealTimers()})diff --git a/web/app/components/base/voice-input/__tests__/index.spec.tsx b/web/app/components/base/voice-input/__tests__/index.spec.tsxindex e252c42f841..4de7a0bdaab 100644--- a/web/app/components/base/voice-input/__tests__/index.spec.tsx+++ b/web/app/components/base/voice-input/__tests__/index.spec.tsx@@ -101,9 +101,9 @@ describe('VoiceInput', () => {// eslint-disable-next-line ts/no-explicit-anyconst recorder = mockState.recorderInstances[0] as anyexpect(recorder.start).toHaveBeenCalled()- expect(await screen.findByText('common.voiceInput.speaking')).toBeInTheDocument()- expect(screen.getByTestId('voice-input-stop')).toBeInTheDocument()- expect(screen.getByTestId('voice-input-timer')).toHaveTextContent('00:00')+ expect(await screen.findByText('common.voiceInput.speaking'))!.toBeInTheDocument()+ expect(screen.getByTestId('voice-input-stop'))!.toBeInTheDocument()+ expect(screen.getByTestId('voice-input-timer'))!.toHaveTextContent('00:00')})it('should call onCancel when recording start fails', async () => {@@ -126,9 +126,9 @@ describe('VoiceInput', () => {// eslint-disable-next-line ts/no-explicit-anyconst recorder = mockState.recorderInstances[0] as any- expect(await screen.findByTestId('voice-input-converting-text')).toBeInTheDocument()- expect(screen.getByText('common.voiceInput.converting')).toBeInTheDocument()- expect(screen.getByTestId('voice-input-loader')).toBeInTheDocument()+ expect(await screen.findByTestId('voice-input-converting-text'))!.toBeInTheDocument()+ expect(screen.getByText('common.voiceInput.converting'))!.toBeInTheDocument()+ expect(screen.getByTestId('voice-input-loader'))!.toBeInTheDocument()await waitFor(() => {expect(recorder.stop).toHaveBeenCalled()@@ -216,7 +216,7 @@ describe('VoiceInput', () => {await waitFor(() => {expect(audioToText).toHaveBeenCalled()- const formData = vi.mocked(audioToText).mock.calls[0][2] as FormData+ const formData = vi.mocked(audioToText).mock.calls[0]![2] as FormDataexpect(formData.get('word_timestamps')).toBe('enabled')})})@@ -311,13 +311,13 @@ describe('VoiceInput', () => {render(<VoiceInput onConverted={onConverted} onCancel={onCancel} />)const timer = await screen.findByTestId('voice-input-timer')- expect(timer).toHaveTextContent('00:00')+ expect(timer)!.toHaveTextContent('00:00')await act(async () => {if (rafState.callback)rafState.callback()})- expect(timer).toHaveTextContent('00:01')+ expect(timer)!.toHaveTextContent('00:01')for (let i = 0; i < 9; i++) {await act(async () => {@@ -325,7 +325,7 @@ describe('VoiceInput', () => {rafState.callback()})}- expect(timer).toHaveTextContent('00:10')+ expect(timer)!.toHaveTextContent('00:10')})it('should show timer element with formatted time', async () => {@@ -333,7 +333,7 @@ describe('VoiceInput', () => {render(<VoiceInput onConverted={onConverted} onCancel={onCancel} />)const timer = screen.getByTestId('voice-input-timer')- expect(timer).toBeInTheDocument()+ expect(timer)!.toBeInTheDocument()// Initial state should show 00:00expect(timer.textContent).toMatch(/0\d:\d{2}/)})@@ -364,7 +364,7 @@ describe('VoiceInput', () => {render(<VoiceInput onConverted={onConverted} onCancel={onCancel} />)await screen.findByTestId('voice-input-stop')- expect(screen.getByTestId('voice-input-stop')).toBeInTheDocument()+ expect(screen.getByTestId('voice-input-stop'))!.toBeInTheDocument()dprSpy.mockRestore()})@@ -387,7 +387,7 @@ describe('VoiceInput', () => {it('should render speaking state indicator', async () => {render(<VoiceInput onConverted={onConverted} onCancel={onCancel} />)- expect(await screen.findByText('common.voiceInput.speaking')).toBeInTheDocument()+ expect(await screen.findByText('common.voiceInput.speaking'))!.toBeInTheDocument()})it('should cleanup on unmount', () => {@@ -442,7 +442,7 @@ describe('VoiceInput', () => {await waitFor(() => {const calls = vi.mocked(audioToText).mock.callsexpect(calls.length).toBeGreaterThan(0)- const [url, sourceType, formData] = calls[0]+ const [url, sourceType, formData] = (calls[0] ?? []) as [any, any, any]expect(url).toBe('/audio-to-text')expect(sourceType).toBe('webApp')expect(formData.get('word_timestamps')).toBe('enabled')@@ -471,12 +471,12 @@ describe('VoiceInput', () => {it('should render timer with initial 00:00 value', () => {render(<VoiceInput onConverted={onConverted} onCancel={onCancel} />)const timer = screen.getByTestId('voice-input-timer')- expect(timer).toHaveTextContent('00:00')+ expect(timer)!.toHaveTextContent('00:00')})it('should render stop button during recording', async () => {render(<VoiceInput onConverted={onConverted} onCancel={onCancel} />)- expect(await screen.findByTestId('voice-input-stop')).toBeInTheDocument()+ expect(await screen.findByTestId('voice-input-stop'))!.toBeInTheDocument()})it('should render converting UI after stopping', async () => {@@ -489,8 +489,8 @@ describe('VoiceInput', () => {await user.click(stopBtn)await screen.findByTestId('voice-input-loader')- expect(screen.getByTestId('voice-input-converting-text')).toBeInTheDocument()- expect(screen.getByTestId('voice-input-cancel')).toBeInTheDocument()+ expect(screen.getByTestId('voice-input-converting-text'))!.toBeInTheDocument()+ expect(screen.getByTestId('voice-input-cancel'))!.toBeInTheDocument()})it('should auto-stop recording and convert audio when duration reaches 10 minutes (600s)', async () => {@@ -498,7 +498,7 @@ describe('VoiceInput', () => {mockState.params = { token: 'abc' }render(<VoiceInput onConverted={onConverted} onCancel={onCancel} />)- expect(await screen.findByTestId('voice-input-stop')).toBeInTheDocument()+ expect(await screen.findByTestId('voice-input-stop'))!.toBeInTheDocument()for (let i = 0; i < 601; i++) {await act(async () => {@@ -507,7 +507,7 @@ describe('VoiceInput', () => {})}- expect(await screen.findByTestId('voice-input-converting-text')).toBeInTheDocument()+ expect(await screen.findByTestId('voice-input-converting-text'))!.toBeInTheDocument()await waitFor(() => {expect(onConverted).toHaveBeenCalledWith('auto-stopped text')})diff --git a/web/app/components/billing/billing-page/__tests__/index.spec.tsx b/web/app/components/billing/billing-page/__tests__/index.spec.tsxindex fe99fe3e4ac..929e16afb20 100644--- a/web/app/components/billing/billing-page/__tests__/index.spec.tsx+++ b/web/app/components/billing/billing-page/__tests__/index.spec.tsx@@ -66,7 +66,7 @@ describe('Billing', () => {fireEvent.click(actionButton)await waitFor(() => expect(openAsyncWindowMock).toHaveBeenCalled())- const [, options] = openAsyncWindowMock.mock.calls[0]+ const [, options] = (openAsyncWindowMock.mock.calls[0] ?? []) as [unknown, any]expect(options).toMatchObject({immediateUrl: currentBillingUrl,features: 'noopener,noreferrer',@@ -82,7 +82,7 @@ describe('Billing', () => {fireEvent.click(actionButton)await waitFor(() => expect(openAsyncWindowMock).toHaveBeenCalled())- const [asyncCallback] = openAsyncWindowMock.mock.calls[0]+ const [asyncCallback] = (openAsyncWindowMock.mock.calls[0] ?? []) as [any]// Execute the async callback passed to openAsyncWindowconst result = await asyncCallback()@@ -98,7 +98,7 @@ describe('Billing', () => {fireEvent.click(actionButton)await waitFor(() => expect(openAsyncWindowMock).toHaveBeenCalled())- const [asyncCallback] = openAsyncWindowMock.mock.calls[0]+ const [asyncCallback] = (openAsyncWindowMock.mock.calls[0] ?? []) as [any]// Execute the async callback when url is nullconst result = await asyncCallback()@@ -113,7 +113,7 @@ describe('Billing', () => {fireEvent.click(actionButton)await waitFor(() => expect(openAsyncWindowMock).toHaveBeenCalled())- const [, options] = openAsyncWindowMock.mock.calls[0]+ const [, options] = (openAsyncWindowMock.mock.calls[0] ?? []) as [unknown, any]// Execute the onError callbackconst testError = new Error('Test error')@@ -128,6 +128,6 @@ describe('Billing', () => {render(<Billing />)const actionButton = screen.getByRole('button', { name: /billing\.viewBillingTitle/ })- expect(actionButton).toBeDisabled()+ expect(actionButton)!.toBeDisabled()})})diff --git a/web/app/components/billing/plan/__tests__/index.spec.tsx b/web/app/components/billing/plan/__tests__/index.spec.tsxindex bed7ebd9fb2..27f6b3005d2 100644--- a/web/app/components/billing/plan/__tests__/index.spec.tsx+++ b/web/app/components/billing/plan/__tests__/index.spec.tsx@@ -95,8 +95,8 @@ describe('PlanComp', () => {it('renders plan info and handles education verify success', async () => {render(<PlanComp loc="billing-page" />)- expect(screen.getByText('billing.plans.professional.name')).toBeInTheDocument()- expect(screen.getByTestId('plan-upgrade-btn')).toBeInTheDocument()+ expect(screen.getByText('billing.plans.professional.name'))!.toBeInTheDocument()+ expect(screen.getByTestId('plan-upgrade-btn'))!.toBeInTheDocument()const verifyBtn = screen.getByText('education.toVerified')fireEvent.click(verifyBtn)@@ -143,7 +143,7 @@ describe('PlanComp', () => {})render(<PlanComp loc="billing-page" />)- expect(screen.getByText('billing.plans.sandbox.name')).toBeInTheDocument()+ expect(screen.getByText('billing.plans.sandbox.name'))!.toBeInTheDocument()})it('renders team plan', () => {@@ -155,7 +155,7 @@ describe('PlanComp', () => {})render(<PlanComp loc="billing-page" />)- expect(screen.getByText('billing.plans.team.name')).toBeInTheDocument()+ expect(screen.getByText('billing.plans.team.name'))!.toBeInTheDocument()})it('shows verify button when education account is about to expire', () => {@@ -167,7 +167,7 @@ describe('PlanComp', () => {})render(<PlanComp loc="billing-page" />)- expect(screen.getByText('education.toVerified')).toBeInTheDocument()+ expect(screen.getByText('education.toVerified'))!.toBeInTheDocument()})it('renders enterprise plan without upgrade button', () => {@@ -179,7 +179,7 @@ describe('PlanComp', () => {})render(<PlanComp loc="billing-page" />)- expect(screen.getByText('billing.plans.enterprise.name')).toBeInTheDocument()+ expect(screen.getByText('billing.plans.enterprise.name'))!.toBeInTheDocument()expect(screen.queryByTestId('plan-upgrade-btn')).not.toBeInTheDocument()})@@ -198,7 +198,8 @@ describe('PlanComp', () => {render(<PlanComp loc="billing-page" />)// Sandbox plan with finite apiRateLimit and null reset uses getDaysUntilEndOfMonth()- expect(screen.getByText('billing.plans.sandbox.name')).toBeInTheDocument()+ // Sandbox plan with finite apiRateLimit and null reset uses getDaysUntilEndOfMonth()+ expect(screen.getByText('billing.plans.sandbox.name'))!.toBeInTheDocument()})it('shows apiRateLimit reset info when reset is a number', () => {@@ -215,7 +216,7 @@ describe('PlanComp', () => {})render(<PlanComp loc="billing-page" />)- expect(screen.getByText('billing.plans.professional.name')).toBeInTheDocument()+ expect(screen.getByText('billing.plans.professional.name'))!.toBeInTheDocument()})it('does not show education verify when enableEducationPlan is false', () => {@@ -241,7 +242,7 @@ describe('PlanComp', () => {await waitFor(() => expect(screen.getByTestId('verify-modal').getAttribute('data-is-show')).toBe('true'))// Get the props passed to the modal and call onConfirm/onCancel- const lastCall = verifyStateModalMock.mock.calls[verifyStateModalMock.mock.calls.length - 1][0]+ const lastCall = verifyStateModalMock.mock.calls[verifyStateModalMock.mock.calls.length - 1]![0]expect(lastCall.onConfirm).toBeDefined()expect(lastCall.onCancel).toBeDefined()diff --git a/web/app/components/billing/plan/assets/__tests__/index.spec.tsx b/web/app/components/billing/plan/assets/__tests__/index.spec.tsxindex 9fde4a4094b..99da2d9ce37 100644--- a/web/app/components/billing/plan/assets/__tests__/index.spec.tsx+++ b/web/app/components/billing/plan/assets/__tests__/index.spec.tsx@@ -73,36 +73,36 @@ describe('Billing Plan Assets - Integration Tests', () => {const { container } = render(<Sandbox />)const svg = container.querySelector('svg')- expect(svg).toBeInTheDocument()- expect(svg).toHaveAttribute('width', '32')- expect(svg).toHaveAttribute('height', '32')+ expect(svg)!.toBeInTheDocument()+ expect(svg)!.toHaveAttribute('width', '32')+ expect(svg)!.toHaveAttribute('height', '32')})it('should render Professional component correctly', () => {const { container } = render(<Professional />)const svg = container.querySelector('svg')- expect(svg).toBeInTheDocument()- expect(svg).toHaveAttribute('width', '32')- expect(svg).toHaveAttribute('height', '32')+ expect(svg)!.toBeInTheDocument()+ expect(svg)!.toHaveAttribute('width', '32')+ expect(svg)!.toHaveAttribute('height', '32')})it('should render Team component correctly', () => {const { container } = render(<Team />)const svg = container.querySelector('svg')- expect(svg).toBeInTheDocument()- expect(svg).toHaveAttribute('width', '32')- expect(svg).toHaveAttribute('height', '32')+ expect(svg)!.toBeInTheDocument()+ expect(svg)!.toHaveAttribute('width', '32')+ expect(svg)!.toHaveAttribute('height', '32')})it('should render Enterprise component correctly', () => {const { container } = render(<Enterprise />)const svg = container.querySelector('svg')- expect(svg).toBeInTheDocument()- expect(svg).toHaveAttribute('width', '32')- expect(svg).toHaveAttribute('height', '32')+ expect(svg)!.toBeInTheDocument()+ expect(svg)!.toHaveAttribute('width', '32')+ expect(svg)!.toHaveAttribute('height', '32')})})@@ -119,9 +119,9 @@ describe('Billing Plan Assets - Integration Tests', () => {const { container } = render(component)const svg = container.querySelector('svg')- expect(svg).toHaveAttribute('width', '32')- expect(svg).toHaveAttribute('height', '32')- expect(svg).toHaveAttribute('viewBox', '0 0 32 32')+ expect(svg)!.toHaveAttribute('width', '32')+ expect(svg)!.toHaveAttribute('height', '32')+ expect(svg)!.toHaveAttribute('viewBox', '0 0 32 32')})})@@ -148,8 +148,9 @@ describe('Billing Plan Assets - Integration Tests', () => {const svg2 = container2.querySelector('svg')// Components should not affect each other- expect(svg1).toBeInTheDocument()- expect(svg2).toBeInTheDocument()+ // Components should not affect each other+ expect(svg1)!.toBeInTheDocument()+ expect(svg2)!.toBeInTheDocument()expect(svg1).not.toBe(svg2)})@@ -158,7 +159,7 @@ describe('Billing Plan Assets - Integration Tests', () => {const { container } = render(<Team />)const svg = container.querySelector('svg')- expect(svg).toBeInTheDocument()+ expect(svg)!.toBeInTheDocument()})})@@ -179,7 +180,7 @@ describe('Billing Plan Assets - Integration Tests', () => {// Component can be function or object (React.memo wraps it)expect(['function', 'object']).toContain(typeof Component)const { container } = render(<Component />)- expect(container.querySelector('svg')).toBeInTheDocument()+ expect(container.querySelector('svg'))!.toBeInTheDocument()})})})@@ -299,7 +300,7 @@ describe('Billing Plan Assets - Integration Tests', () => {<div>{Array.from({ length: 20 }).map((_, i) => {const components = [Sandbox, Professional, Team, Enterprise]- const Component = components[i % 4]+ const Component = components[i % 4]!return <Component key={i} />})}</div>,diff --git a/web/app/components/billing/pricing/plans/__tests__/index.spec.tsx b/web/app/components/billing/pricing/plans/__tests__/index.spec.tsxindex 0a407de39a2..0c506b1ba22 100644--- a/web/app/components/billing/pricing/plans/__tests__/index.spec.tsx+++ b/web/app/components/billing/pricing/plans/__tests__/index.spec.tsx@@ -58,11 +58,11 @@ describe('Plans', () => {/>,)- expect(screen.getByTestId('cloud-plan-sandbox')).toBeInTheDocument()- expect(screen.getByTestId('cloud-plan-professional')).toBeInTheDocument()- expect(screen.getByTestId('cloud-plan-team')).toBeInTheDocument()+ expect(screen.getByTestId('cloud-plan-sandbox'))!.toBeInTheDocument()+ expect(screen.getByTestId('cloud-plan-professional'))!.toBeInTheDocument()+ expect(screen.getByTestId('cloud-plan-team'))!.toBeInTheDocument()- const firstCallProps = (cloudPlanItem as unknown as Mock).mock.calls[0][0]+ const firstCallProps = (cloudPlanItem as unknown as Mock).mock.calls[0]![0]expect(firstCallProps.plan).toBe(Plan.sandbox)// Enterprise should be normalized to team when passed downexpect(firstCallProps.currentPlan).toBe(Plan.team)@@ -81,9 +81,9 @@ describe('Plans', () => {/>,)- expect(screen.getByTestId('self-plan-community')).toBeInTheDocument()- expect(screen.getByTestId('self-plan-premium')).toBeInTheDocument()- expect(screen.getByTestId('self-plan-enterprise')).toBeInTheDocument()+ expect(screen.getByTestId('self-plan-community'))!.toBeInTheDocument()+ expect(screen.getByTestId('self-plan-premium'))!.toBeInTheDocument()+ expect(screen.getByTestId('self-plan-enterprise'))!.toBeInTheDocument()expect(selfHostedPlanItem).toHaveBeenCalledTimes(3)})diff --git a/web/app/components/billing/pricing/plans/cloud-plan-item/__tests__/index.spec.tsx b/web/app/components/billing/pricing/plans/cloud-plan-item/__tests__/index.spec.tsxindex 0ae553ec012..a4b8888b276 100644--- a/web/app/components/billing/pricing/plans/cloud-plan-item/__tests__/index.spec.tsx+++ b/web/app/components/billing/pricing/plans/cloud-plan-item/__tests__/index.spec.tsx@@ -98,10 +98,10 @@ describe('CloudPlanItem', () => {/>,)- expect(screen.getByText('billing.plans.sandbox.name')).toBeInTheDocument()- expect(screen.getByText('billing.plans.sandbox.description')).toBeInTheDocument()- expect(screen.getByText('billing.plansCommon.free')).toBeInTheDocument()- expect(screen.getByRole('button', { name: 'billing.plansCommon.currentPlan' })).toBeInTheDocument()+ expect(screen.getByText('billing.plans.sandbox.name'))!.toBeInTheDocument()+ expect(screen.getByText('billing.plans.sandbox.description'))!.toBeInTheDocument()+ expect(screen.getByText('billing.plansCommon.free'))!.toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'billing.plansCommon.currentPlan' }))!.toBeInTheDocument()})it('should display yearly pricing with discount when planRange is yearly', () => {@@ -115,9 +115,9 @@ describe('CloudPlanItem', () => {)const professionalPlan = ALL_PLANS[Plan.professional]- expect(screen.getByText(`$${professionalPlan.price * 12}`)).toBeInTheDocument()- expect(screen.getByText(`$${professionalPlan.price * 10}`)).toBeInTheDocument()- expect(screen.getByText(/billing\.plansCommon\.priceTip.*billing\.plansCommon\.year/)).toBeInTheDocument()+ expect(screen.getByText(`$${professionalPlan.price * 12}`))!.toBeInTheDocument()+ expect(screen.getByText(`$${professionalPlan.price * 10}`))!.toBeInTheDocument()+ expect(screen.getByText(/billing\.plansCommon\.priceTip.*billing\.plansCommon\.year/))!.toBeInTheDocument()})it('should show "most popular" badge for professional plan', () => {@@ -130,7 +130,7 @@ describe('CloudPlanItem', () => {/>,)- expect(screen.getByText('billing.plansCommon.mostPopular')).toBeInTheDocument()+ expect(screen.getByText('billing.plansCommon.mostPopular'))!.toBeInTheDocument()})it('should not show "most popular" badge for non-professional plans', () => {@@ -157,7 +157,7 @@ describe('CloudPlanItem', () => {)const button = screen.getByRole('button', { name: 'billing.plansCommon.startBuilding' })- expect(button).toBeDisabled()+ expect(button)!.toBeDisabled()})})@@ -176,7 +176,7 @@ describe('CloudPlanItem', () => {)fireEvent.click(screen.getByRole('button', { name: 'billing.plansCommon.startBuilding' }))- expect(screen.getByText('billing.buyPermissionDeniedTip')).toBeInTheDocument()+ expect(screen.getByText('billing.buyPermissionDeniedTip'))!.toBeInTheDocument()expect(mockBillingInvoices).not.toHaveBeenCalled()})@@ -320,7 +320,7 @@ describe('CloudPlanItem', () => {expect(openWindow).toHaveBeenCalledTimes(1)// The onError callback should have been passed to openAsyncWindowconst callArgs = openWindow.mock.calls[0]- expect(callArgs[1]).toHaveProperty('onError')+ expect(callArgs![1]).toHaveProperty('onError')})})@@ -336,8 +336,39 @@ describe('CloudPlanItem', () => {)const teamPlan = ALL_PLANS[Plan.team]- expect(screen.getByText(`$${teamPlan.price}`)).toBeInTheDocument()- expect(screen.getByText(/billing\.plansCommon\.priceTip.*billing\.plansCommon\.month/)).toBeInTheDocument()+ expect(screen.getByText(`$${teamPlan.price}`))!.toBeInTheDocument()+ expect(screen.getByText(/billing\.plansCommon\.priceTip.*billing\.plansCommon\.month/))!.toBeInTheDocument()+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price+ // Should NOT show crossed-out yearly price// Should NOT show crossed-out yearly priceexpect(screen.queryByText(`$${teamPlan.price * 12}`)).not.toBeInTheDocument()})diff --git a/web/app/components/billing/trigger-events-limit-modal/__tests__/index.spec.tsx b/web/app/components/billing/trigger-events-limit-modal/__tests__/index.spec.tsxindex b0ada6ff167..47577a5b488 100644--- a/web/app/components/billing/trigger-events-limit-modal/__tests__/index.spec.tsx+++ b/web/app/components/billing/trigger-events-limit-modal/__tests__/index.spec.tsx@@ -42,13 +42,13 @@ describe('TriggerEventsLimitModal', () => {expect(modal.getAttribute('data-description')).toContain('billing.triggerLimitModal.description')expect(planUpgradeModalMock).toHaveBeenCalled()- const passedProps = planUpgradeModalMock.mock.calls[0][0]+ const passedProps = planUpgradeModalMock.mock.calls[0]![0]expect(passedProps.onClose).toBe(mockOnClose)expect(passedProps.onUpgrade).toBe(mockOnUpgrade)- expect(screen.getByText('billing.triggerLimitModal.usageTitle')).toBeInTheDocument()- expect(screen.getByText('12')).toBeInTheDocument()- expect(screen.getByText('20')).toBeInTheDocument()+ expect(screen.getByText('billing.triggerLimitModal.usageTitle'))!.toBeInTheDocument()+ expect(screen.getByText('12'))!.toBeInTheDocument()+ expect(screen.getByText('20'))!.toBeInTheDocument()})it('renders even when trigger modal is hidden', () => {@@ -78,9 +78,9 @@ describe('TriggerEventsLimitModal', () => {/>,)- expect(screen.getByText('billing.triggerLimitModal.usageTitle')).toBeInTheDocument()- expect(screen.getByText('18000')).toBeInTheDocument()- expect(screen.getByText('20000')).toBeInTheDocument()+ expect(screen.getByText('billing.triggerLimitModal.usageTitle'))!.toBeInTheDocument()+ expect(screen.getByText('18000'))!.toBeInTheDocument()+ expect(screen.getByText('20000'))!.toBeInTheDocument()})it('passes correct title and description translations', () => {@@ -110,7 +110,7 @@ describe('TriggerEventsLimitModal', () => {/>,)- const passedProps = planUpgradeModalMock.mock.calls[0][0]+ const passedProps = planUpgradeModalMock.mock.calls[0]![0]expect(passedProps.onClose).toBe(mockOnClose)expect(passedProps.onUpgrade).toBe(mockOnUpgrade)})diff --git a/web/app/components/billing/utils/index.ts b/web/app/components/billing/utils/index.tsindex 6974f89c8b5..2d37eecbd55 100644--- a/web/app/components/billing/utils/index.ts+++ b/web/app/components/billing/utils/index.ts@@ -11,8 +11,8 @@ export const parseVectorSpaceToMB = (vectorSpace: string): number => {if (!match)return 0- const value = Number.parseInt(match[1], 10)- const unit = match[2].toUpperCase()+ const value = Number.parseInt(match[1]!, 10)+ const unit = match[2]!.toUpperCase()return unit === 'GB' ? value * 1024 : value}diff --git a/web/app/components/datasets/common/image-list/__tests__/index.spec.tsx b/web/app/components/datasets/common/image-list/__tests__/index.spec.tsxindex 3b04b2708e0..e1fde328bb7 100644--- a/web/app/components/datasets/common/image-list/__tests__/index.spec.tsx+++ b/web/app/components/datasets/common/image-list/__tests__/index.spec.tsx@@ -72,7 +72,7 @@ describe('ImageList', () => {it('should render without crashing', () => {const images = createMockImages(3)const { container } = render(<ImageList images={images} size="md" />)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})it('should render all images when count is below limit', () => {@@ -87,7 +87,8 @@ describe('ImageList', () => {const images = createMockImages(15)render(<ImageList images={images} size="md" limit={9} />)// More button should be visible- expect(screen.getByText(/\+6/)).toBeInTheDocument()+ // More button should be visible+ expect(screen.getByText(/\+6/))!.toBeInTheDocument()})})@@ -97,33 +98,35 @@ describe('ImageList', () => {const { container } = render(<ImageList images={images} size="md" className="custom-class" />,)- expect(container.firstChild).toHaveClass('custom-class')+ expect(container.firstChild)!.toHaveClass('custom-class')})it('should use default limit of 9', () => {const images = createMockImages(12)render(<ImageList images={images} size="md" />)// Should show "+3" for remaining images- expect(screen.getByText(/\+3/)).toBeInTheDocument()+ // Should show "+3" for remaining images+ expect(screen.getByText(/\+3/))!.toBeInTheDocument()})it('should respect custom limit', () => {const images = createMockImages(10)render(<ImageList images={images} size="md" limit={5} />)// Should show "+5" for remaining images- expect(screen.getByText(/\+5/)).toBeInTheDocument()+ // Should show "+5" for remaining images+ expect(screen.getByText(/\+5/))!.toBeInTheDocument()})it('should handle size prop sm', () => {const images = createMockImages(2)const { container } = render(<ImageList images={images} size="sm" />)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})it('should handle size prop md', () => {const images = createMockImages(2)const { container } = render(<ImageList images={images} size="md" />)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})})@@ -135,6 +138,37 @@ describe('ImageList', () => {const moreButton = screen.getByText(/\+6/)fireEvent.click(moreButton)+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear+ // More button should disappear// More button should disappearexpect(screen.queryByText(/\+6/)).not.toBeInTheDocument()})@@ -146,9 +180,10 @@ describe('ImageList', () => {// Find and click an image thumbnailconst thumbnails = document.querySelectorAll('[class*="cursor-pointer"]')if (thumbnails.length > 0) {- fireEvent.click(thumbnails[0])+ fireEvent.click(thumbnails[0]!)+ // Preview should open// Preview should open- expect(screen.getByTestId('image-previewer')).toBeInTheDocument()+ expect(screen.getByTestId('image-previewer'))!.toBeInTheDocument()}})@@ -159,12 +194,43 @@ describe('ImageList', () => {// Open previewconst thumbnails = document.querySelectorAll('[class*="cursor-pointer"]')if (thumbnails.length > 0) {- fireEvent.click(thumbnails[0])+ fireEvent.click(thumbnails[0]!)// Close previewconst closeButton = screen.getByTestId('close-preview')fireEvent.click(closeButton)+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed+ // Preview should be closed// Preview should be closedexpect(screen.queryByTestId('image-previewer')).not.toBeInTheDocument()}@@ -174,7 +240,7 @@ describe('ImageList', () => {describe('Edge Cases', () => {it('should handle empty images array', () => {const { container } = render(<ImageList images={[]} size="md" />)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})it('should not open preview when clicked image not found in list (index === -1)', () => {@@ -185,7 +251,8 @@ describe('ImageList', () => {fireEvent.click(firstThumb)// Preview should open for valid image- expect(screen.getByTestId('image-previewer')).toBeInTheDocument()+ // Preview should open for valid image+ expect(screen.getByTestId('image-previewer'))!.toBeInTheDocument()// Close previewfireEvent.click(screen.getByTestId('close-preview'))@@ -197,7 +264,7 @@ describe('ImageList', () => {const validThumb = screen.getByTestId('file-thumb-https://example.com/image-1.png')fireEvent.click(validThumb)- expect(screen.getByTestId('image-previewer')).toBeInTheDocument()+ expect(screen.getByTestId('image-previewer'))!.toBeInTheDocument()})it('should return early when file sourceUrl is not found in limitedImages (index === -1)', () => {@@ -216,6 +283,37 @@ describe('ImageList', () => {})}+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages+ // Preview should NOT open because the file was not found in limitedImages// Preview should NOT open because the file was not found in limitedImagesexpect(screen.queryByTestId('image-previewer')).not.toBeInTheDocument()})@@ -223,7 +321,7 @@ describe('ImageList', () => {it('should handle single image', () => {const images = createMockImages(1)const { container } = render(<ImageList images={images} size="md" />)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})it('should not show More button when images count equals limit', () => {@@ -236,13 +334,45 @@ describe('ImageList', () => {const images = createMockImages(5)render(<ImageList images={images} size="md" limit={0} />)// Should show "+5" for all images- expect(screen.getByText(/\+5/)).toBeInTheDocument()+ // Should show "+5" for all images+ expect(screen.getByText(/\+5/))!.toBeInTheDocument()})it('should handle limit larger than images count', () => {const images = createMockImages(5)render(<ImageList images={images} size="md" limit={100} />)// Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More button+ // Should not show More buttonexpect(screen.queryByText(/\+/)).not.toBeInTheDocument()})})diff --git a/web/app/components/datasets/common/image-previewer/__tests__/index.spec.tsx b/web/app/components/datasets/common/image-previewer/__tests__/index.spec.tsxindex 44f0e95c08d..1ff5cb33f8d 100644--- a/web/app/components/datasets/common/image-previewer/__tests__/index.spec.tsx+++ b/web/app/components/datasets/common/image-previewer/__tests__/index.spec.tsx@@ -65,7 +65,8 @@ describe('ImagePreviewer', () => {})// Should render in portal- expect(document.body.querySelector('.image-previewer')).toBeInTheDocument()+ // Should render in portal+ expect(document.body.querySelector('.image-previewer'))!.toBeInTheDocument()})it('should render close button', async () => {@@ -77,7 +78,8 @@ describe('ImagePreviewer', () => {})// Esc text should be visible- expect(screen.getByText('Esc')).toBeInTheDocument()+ // Esc text should be visible+ expect(screen.getByText('Esc'))!.toBeInTheDocument()})it('should show loading state initially', async () => {@@ -92,7 +94,8 @@ describe('ImagePreviewer', () => {})// Loading component should be visible- expect(document.body.querySelector('.image-previewer')).toBeInTheDocument()+ // Loading component should be visible+ expect(document.body.querySelector('.image-previewer'))!.toBeInTheDocument()})})@@ -107,7 +110,8 @@ describe('ImagePreviewer', () => {await waitFor(() => {// Should start at second image- expect(screen.getByText('image2.png')).toBeInTheDocument()+ // Should start at second image+ expect(screen.getByText('image2.png'))!.toBeInTheDocument()})})@@ -120,7 +124,7 @@ describe('ImagePreviewer', () => {})await waitFor(() => {- expect(screen.getByText('image1.png')).toBeInTheDocument()+ expect(screen.getByText('image1.png'))!.toBeInTheDocument()})})})@@ -151,7 +155,7 @@ describe('ImagePreviewer', () => {})await waitFor(() => {- expect(screen.getByText('image1.png')).toBeInTheDocument()+ expect(screen.getByText('image1.png'))!.toBeInTheDocument()})// Find and click next button (right arrow)@@ -166,7 +170,7 @@ describe('ImagePreviewer', () => {})await waitFor(() => {- expect(screen.getByText('image2.png')).toBeInTheDocument()+ expect(screen.getByText('image2.png'))!.toBeInTheDocument()})}})@@ -180,7 +184,7 @@ describe('ImagePreviewer', () => {})await waitFor(() => {- expect(screen.getByText('image2.png')).toBeInTheDocument()+ expect(screen.getByText('image2.png'))!.toBeInTheDocument()})// Find and click prev button (left arrow)@@ -195,7 +199,7 @@ describe('ImagePreviewer', () => {})await waitFor(() => {- expect(screen.getByText('image1.png')).toBeInTheDocument()+ expect(screen.getByText('image1.png'))!.toBeInTheDocument()})}})@@ -213,7 +217,7 @@ describe('ImagePreviewer', () => {btn.className.includes('left-8'),)- expect(prevButton).toBeDisabled()+ expect(prevButton)!.toBeDisabled()})it('should disable next button at last image', async () => {@@ -229,7 +233,7 @@ describe('ImagePreviewer', () => {btn.className.includes('right-8'),)- expect(nextButton).toBeDisabled()+ expect(nextButton)!.toBeDisabled()})})@@ -258,7 +262,7 @@ describe('ImagePreviewer', () => {})await waitFor(() => {- expect(screen.getByText(/Failed to load image/)).toBeInTheDocument()+ expect(screen.getByText(/Failed to load image/))!.toBeInTheDocument()})})@@ -275,7 +279,7 @@ describe('ImagePreviewer', () => {await waitFor(() => {// Retry button should be visibleconst retryButton = document.querySelector('button.rounded-full')- expect(retryButton).toBeInTheDocument()+ expect(retryButton)!.toBeInTheDocument()})})})@@ -290,7 +294,7 @@ describe('ImagePreviewer', () => {})await waitFor(() => {- expect(screen.getByText('image1.png')).toBeInTheDocument()+ expect(screen.getByText('image1.png'))!.toBeInTheDocument()})const buttons = document.querySelectorAll('button')@@ -306,7 +310,7 @@ describe('ImagePreviewer', () => {// Should still be at first imageawait waitFor(() => {- expect(screen.getByText('image1.png')).toBeInTheDocument()+ expect(screen.getByText('image1.png'))!.toBeInTheDocument()})}})@@ -320,7 +324,7 @@ describe('ImagePreviewer', () => {})await waitFor(() => {- expect(screen.getByText('image3.png')).toBeInTheDocument()+ expect(screen.getByText('image3.png'))!.toBeInTheDocument()})const buttons = document.querySelectorAll('button')@@ -336,7 +340,7 @@ describe('ImagePreviewer', () => {// Should still be at last imageawait waitFor(() => {- expect(screen.getByText('image3.png')).toBeInTheDocument()+ expect(screen.getByText('image3.png'))!.toBeInTheDocument()})}})@@ -366,7 +370,7 @@ describe('ImagePreviewer', () => {// Wait for error stateawait waitFor(() => {- expect(screen.getByText(/Failed to load image/)).toBeInTheDocument()+ expect(screen.getByText(/Failed to load image/))!.toBeInTheDocument()})const retryButton = document.querySelector('button.rounded-full')@@ -393,7 +397,7 @@ describe('ImagePreviewer', () => {})await waitFor(() => {- expect(screen.getByText(/Failed to load image/)).toBeInTheDocument()+ expect(screen.getByText(/Failed to load image/))!.toBeInTheDocument()})// Find and click the retry button (not the nav buttons)@@ -402,7 +406,7 @@ describe('ImagePreviewer', () => {btn.className.includes('rounded-full') && !btn.className.includes('left-8') && !btn.className.includes('right-8'),)- expect(retryButton).toBeInTheDocument()+ expect(retryButton)!.toBeInTheDocument()if (retryButton) {mockFetch.mockClear()@@ -451,7 +455,7 @@ describe('ImagePreviewer', () => {describe('Edge Cases', () => {it('should handle single image', async () => {const onClose = vi.fn()- const images = [createMockImages()[0]]+ const images = [createMockImages()[0]!]await act(async () => {render(<ImagePreviewer images={images} onClose={onClose} />)@@ -466,8 +470,8 @@ describe('ImagePreviewer', () => {btn.className.includes('right-8'),)- expect(prevButton).toBeDisabled()- expect(nextButton).toBeDisabled()+ expect(prevButton)!.toBeDisabled()+ expect(nextButton)!.toBeDisabled()})it('should stop event propagation on container click', async () => {@@ -500,7 +504,8 @@ describe('ImagePreviewer', () => {await waitFor(() => {// Should display dimensions (800 × 600 from MockImage)- expect(screen.getByText(/800.*600/)).toBeInTheDocument()+ // Should display dimensions (800 × 600 from MockImage)+ expect(screen.getByText(/800.*600/))!.toBeInTheDocument()})})@@ -514,7 +519,8 @@ describe('ImagePreviewer', () => {await waitFor(() => {// Should display formatted file size- expect(screen.getByText('image1.png')).toBeInTheDocument()+ // Should display formatted file size+ expect(screen.getByText('image1.png'))!.toBeInTheDocument()})})})diff --git a/web/app/components/datasets/common/image-previewer/index.tsx b/web/app/components/datasets/common/image-previewer/index.tsxindex f899dcb33d0..2cc51a3be5d 100644--- a/web/app/components/datasets/common/image-previewer/index.tsx+++ b/web/app/components/datasets/common/image-previewer/index.tsx@@ -137,7 +137,7 @@ const ImagePreviewer = ({return {...prev,[image.url]: {- ...prev[image.url],+ ...prev[image.url]!,status: 'loading',},}@@ -168,15 +168,15 @@ const ImagePreviewer = ({Esc</span></div>- {cachedImages[currentImage.url].status === 'loading' && (+ {cachedImages[currentImage!.url]!.status === 'loading' && (<Loading type="app" />)}- {cachedImages[currentImage.url].status === 'error' && (+ {cachedImages[currentImage!.url]!.status === 'error' && (<div className="flex max-w-sm flex-col items-center gap-y-2 system-sm-regular text-text-tertiary">- <span>{`Failed to load image: ${currentImage.url}. Please try again.`}</span>+ <span>{`Failed to load image: ${currentImage!.url}. Please try again.`}</span><Buttonvariant="secondary"- onClick={() => retryImage(currentImage)}+ onClick={() => retryImage(currentImage!)}className="size-9 rounded-full p-0"size="large">@@ -184,19 +184,19 @@ const ImagePreviewer = ({</Button></div>)}- {cachedImages[currentImage.url].status === 'loaded' && (+ {cachedImages[currentImage!.url]!.status === 'loaded' && (<div className="flex size-full flex-col items-center justify-center gap-y-2"><img- alt={currentImage.name}- src={cachedImages[currentImage.url].blobUrl}+ alt={currentImage!.name}+ src={cachedImages[currentImage!.url]!.blobUrl}className="max-h-[calc(100%-2.5rem)] max-w-full object-contain shadow-lg ring-8 ring-effects-image-frame backdrop-blur-[5px]"/><div className="flex shrink-0 gap-x-2 pt-3 pb-1 system-sm-regular text-text-tertiary">- <span>{currentImage.name}</span>+ <span>{currentImage!.name}</span><span>·</span>- <span>{`${cachedImages[currentImage.url].width} × ${cachedImages[currentImage.url].height}`}</span>+ <span>{`${cachedImages[currentImage!.url]!.width} × ${cachedImages[currentImage!.url]!.height}`}</span><span>·</span>- <span>{formatFileSize(currentImage.size)}</span>+ <span>{formatFileSize(currentImage!.size)}</span></div></div>)}diff --git a/web/app/components/datasets/common/image-uploader/__tests__/utils.spec.ts b/web/app/components/datasets/common/image-uploader/__tests__/utils.spec.tsindex 8bf66ea3493..cf9e2402757 100644--- a/web/app/components/datasets/common/image-uploader/__tests__/utils.spec.ts+++ b/web/app/components/datasets/common/image-uploader/__tests__/utils.spec.ts@@ -235,8 +235,8 @@ describe('image-uploader utils', () => {const result = await traverseFileEntry(mockEntry)expect(result).toHaveLength(1)- expect(result[0].name).toBe('test.png')- expect(result[0].relativePath).toBe('test.png')+ expect(result[0]!.name).toBe('test.png')+ expect(result[0]!.relativePath).toBe('test.png')})it('should resolve with file array with prefix for nested file', async () => {@@ -249,7 +249,7 @@ describe('image-uploader utils', () => {const result = await traverseFileEntry(mockEntry, 'folder/')expect(result).toHaveLength(1)- expect(result[0].relativePath).toBe('folder/test.png')+ expect(result[0]!.relativePath).toBe('folder/test.png')})it('should resolve empty array for unknown entry type', async () => {@@ -312,8 +312,8 @@ describe('image-uploader utils', () => {const result = await traverseFileEntry(mockEntry)expect(result).toHaveLength(2)- expect(result[0].relativePath).toBe('folder/file1.png')- expect(result[1].relativePath).toBe('folder/file2.png')+ expect(result[0]!.relativePath).toBe('folder/file1.png')+ expect(result[1]!.relativePath).toBe('folder/file2.png')})})})diff --git a/web/app/components/datasets/common/image-uploader/hooks/use-upload.ts b/web/app/components/datasets/common/image-uploader/hooks/use-upload.tsindex d262401f4b8..2c8bc611dc8 100644--- a/web/app/components/datasets/common/image-uploader/hooks/use-upload.ts+++ b/web/app/components/datasets/common/image-uploader/hooks/use-upload.ts@@ -44,7 +44,7 @@ export const useUpload = () => {const checkFileType = useCallback((file: File) => {const ext = getFileType(file)- return ACCEPT_TYPES.includes(ext.toLowerCase())+ return ACCEPT_TYPES.includes(ext!.toLowerCase())}, [])const checkFileSize = useCallback((file: File) => {@@ -131,13 +131,13 @@ export const useUpload = () => {const index = files.findIndex(file => file.id === fileId)if (index > -1) {- const uploadingFile = files[index]+ const uploadingFile = files[index]!const newFiles = produce(files, (draft) => {- draft[index].progress = 0+ draft[index]!.progress = 0})setFiles(newFiles)fileUpload({- file: uploadingFile.originalFile!,+ file: uploadingFile!.originalFile!,onProgressCallback: (progress) => {handleUpdateFile({ ...uploadingFile, progress })},diff --git a/web/app/components/datasets/common/image-uploader/utils.ts b/web/app/components/datasets/common/image-uploader/utils.tsindex d8c8582e2a8..952c82a0c43 100644--- a/web/app/components/datasets/common/image-uploader/utils.ts+++ b/web/app/components/datasets/common/image-uploader/utils.ts@@ -11,7 +11,7 @@ export const getFileType = (currentFile: File) => {return ''const arr = currentFile.name.split('.')- return arr[arr.length - 1]+ return arr[arr.length - 1]!}type FileWithPath = {diff --git a/web/app/components/datasets/common/retrieval-param-config/__tests__/index.spec.tsx b/web/app/components/datasets/common/retrieval-param-config/__tests__/index.spec.tsxindex f5c85b518e3..6566aa5951e 100644--- a/web/app/components/datasets/common/retrieval-param-config/__tests__/index.spec.tsx+++ b/web/app/components/datasets/common/retrieval-param-config/__tests__/index.spec.tsx@@ -173,7 +173,7 @@ describe('RetrievalParamConfig', () => {/>,)- expect(screen.getByTestId('rerank-switch')).toBeInTheDocument()+ expect(screen.getByTestId('rerank-switch'))!.toBeInTheDocument()})it('should render model selector when reranking is enabled', () => {@@ -186,7 +186,7 @@ describe('RetrievalParamConfig', () => {/>,)- expect(screen.getByTestId('model-selector')).toBeInTheDocument()+ expect(screen.getByTestId('model-selector'))!.toBeInTheDocument()})it('should not render model selector when reranking is disabled', () => {@@ -212,8 +212,8 @@ describe('RetrievalParamConfig', () => {/>,)- expect(screen.getByTestId('top-k-item')).toBeInTheDocument()- expect(screen.getByTestId('top-k-item')).toHaveAttribute('data-value', '5')+ expect(screen.getByTestId('top-k-item'))!.toBeInTheDocument()+ expect(screen.getByTestId('top-k-item'))!.toHaveAttribute('data-value', '5')})it('should render score threshold item when reranking is enabled', () => {@@ -226,7 +226,7 @@ describe('RetrievalParamConfig', () => {/>,)- expect(screen.getByTestId('score-threshold-item')).toBeInTheDocument()+ expect(screen.getByTestId('score-threshold-item'))!.toBeInTheDocument()})it('should toggle reranking enable', () => {@@ -349,7 +349,7 @@ describe('RetrievalParamConfig', () => {/>,)- expect(screen.getByText('datasetSettings.form.retrievalSetting.multiModalTip')).toBeInTheDocument()+ expect(screen.getByText('datasetSettings.form.retrievalSetting.multiModalTip'))!.toBeInTheDocument()})it('should not show multimodal tip when showMultiModalTip is false', () => {@@ -378,7 +378,7 @@ describe('RetrievalParamConfig', () => {/>,)- expect(screen.getByTestId('rerank-switch')).toBeInTheDocument()+ expect(screen.getByTestId('rerank-switch'))!.toBeInTheDocument()})it('should hide score threshold when reranking is disabled for full text search', () => {@@ -410,7 +410,7 @@ describe('RetrievalParamConfig', () => {/>,)- expect(screen.getByTestId('score-threshold-item')).toBeInTheDocument()+ expect(screen.getByTestId('score-threshold-item'))!.toBeInTheDocument()})})@@ -451,7 +451,7 @@ describe('RetrievalParamConfig', () => {/>,)- expect(screen.getByTestId('top-k-item')).toBeInTheDocument()+ expect(screen.getByTestId('top-k-item'))!.toBeInTheDocument()})it('should not render score threshold for keyword search', () => {@@ -496,7 +496,7 @@ describe('RetrievalParamConfig', () => {/>,)- expect(screen.getByText('dataset.weightedScore.title')).toBeInTheDocument()+ expect(screen.getByText('dataset.weightedScore.title'))!.toBeInTheDocument()})it('should have RerankingModel option', () => {@@ -508,7 +508,7 @@ describe('RetrievalParamConfig', () => {/>,)- expect(screen.getByText('common.modelProvider.rerankModel.key')).toBeInTheDocument()+ expect(screen.getByText('common.modelProvider.rerankModel.key'))!.toBeInTheDocument()})it('should show model selector when RerankingModel mode is selected', () => {@@ -520,7 +520,7 @@ describe('RetrievalParamConfig', () => {/>,)- expect(screen.getByTestId('model-selector')).toBeInTheDocument()+ expect(screen.getByTestId('model-selector'))!.toBeInTheDocument()})it('should show WeightedScore component when WeightedScore mode is selected', () => {@@ -547,7 +547,7 @@ describe('RetrievalParamConfig', () => {/>,)- expect(screen.getByTestId('weighted-score')).toBeInTheDocument()+ expect(screen.getByTestId('weighted-score'))!.toBeInTheDocument()expect(screen.queryByTestId('model-selector')).not.toBeInTheDocument()})@@ -565,7 +565,7 @@ describe('RetrievalParamConfig', () => {fireEvent.click(weightedScoreCard!)expect(mockOnChange).toHaveBeenCalled()- const calledWith = mockOnChange.mock.calls[0][0]+ const calledWith = mockOnChange.mock.calls[0]![0]expect(calledWith.reranking_mode).toBe(RerankingModeEnum.WeightedScore)expect(calledWith.weights).toBeDefined()})@@ -645,7 +645,7 @@ describe('RetrievalParamConfig', () => {fireEvent.click(screen.getByTestId('change-weights-btn'))expect(mockOnChange).toHaveBeenCalled()- const calledWith = mockOnChange.mock.calls[0][0]+ const calledWith = mockOnChange.mock.calls[0]![0]expect(calledWith.weights.vector_setting.vector_weight).toBe(0.6)expect(calledWith.weights.keyword_setting.keyword_weight).toBe(0.4)})@@ -659,8 +659,8 @@ describe('RetrievalParamConfig', () => {/>,)- expect(screen.getByTestId('top-k-item')).toBeInTheDocument()- expect(screen.getByTestId('score-threshold-item')).toBeInTheDocument()+ expect(screen.getByTestId('top-k-item'))!.toBeInTheDocument()+ expect(screen.getByTestId('score-threshold-item'))!.toBeInTheDocument()})it('should update top_k for hybrid search', () => {@@ -724,7 +724,7 @@ describe('RetrievalParamConfig', () => {/>,)- expect(screen.getByText('datasetSettings.form.retrievalSetting.multiModalTip')).toBeInTheDocument()+ expect(screen.getByText('datasetSettings.form.retrievalSetting.multiModalTip'))!.toBeInTheDocument()})it('should not show multimodal tip for hybrid search with WeightedScore', () => {@@ -799,7 +799,7 @@ describe('RetrievalParamConfig', () => {/>,)- expect(screen.getByTestId('tooltip')).toBeInTheDocument()+ expect(screen.getByTestId('tooltip'))!.toBeInTheDocument()})})@@ -814,7 +814,7 @@ describe('RetrievalParamConfig', () => {/>,)- expect(screen.getByText('common.modelProvider.rerankModel.key')).toBeInTheDocument()+ expect(screen.getByText('common.modelProvider.rerankModel.key'))!.toBeInTheDocument()})})@@ -838,7 +838,7 @@ describe('RetrievalParamConfig', () => {fireEvent.click(weightedScoreCard!)expect(mockOnChange).toHaveBeenCalled()- const calledWith = mockOnChange.mock.calls[0][0]+ const calledWith = mockOnChange.mock.calls[0]![0]expect(calledWith.weights).toBeDefined()expect(calledWith.weights.weight_type).toBe(WeightedScoreEnum.Customized)})@@ -872,7 +872,7 @@ describe('RetrievalParamConfig', () => {fireEvent.click(weightedScoreCard!)expect(mockOnChange).toHaveBeenCalled()- const calledWith = mockOnChange.mock.calls[0][0]+ const calledWith = mockOnChange.mock.calls[0]![0]expect(calledWith.weights.vector_setting.vector_weight).toBe(0.8)})})diff --git a/web/app/components/datasets/common/retrieval-param-config/index.tsx b/web/app/components/datasets/common/retrieval-param-config/index.tsxindex 5fbe1db5b19..9f227baa227 100644--- a/web/app/components/datasets/common/retrieval-param-config/index.tsx+++ b/web/app/components/datasets/common/retrieval-param-config/index.tsx@@ -246,11 +246,11 @@ const RetrievalParamConfig: FC<Props> = ({...value.weights!,vector_setting: {...value.weights!.vector_setting,- vector_weight: v.value[0],+ vector_weight: v.value[0]!,},keyword_setting: {...value.weights!.keyword_setting,- keyword_weight: v.value[1],+ keyword_weight: v.value[1]!,},},})diff --git a/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/__tests__/index.spec.tsx b/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/__tests__/index.spec.tsxindex 8ad70696feb..7719c5b7443 100644--- a/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/__tests__/index.spec.tsx+++ b/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/__tests__/index.spec.tsx@@ -113,7 +113,7 @@ describe('CreateFromDSLModal', () => {{ wrapper: createWrapper() },)- expect(screen.getByText('app.importFromDSL')).toBeInTheDocument()+ expect(screen.getByText('app.importFromDSL'))!.toBeInTheDocument()})it('should not render modal content when show is false', () => {@@ -139,8 +139,8 @@ describe('CreateFromDSLModal', () => {{ wrapper: createWrapper() },)- expect(screen.getByText('app.importFromDSLFile')).toBeInTheDocument()- expect(screen.getByText('app.importFromDSLUrl')).toBeInTheDocument()+ expect(screen.getByText('app.importFromDSLFile'))!.toBeInTheDocument()+ expect(screen.getByText('app.importFromDSLUrl'))!.toBeInTheDocument()})it('should render cancel and import buttons', () => {@@ -152,8 +152,8 @@ describe('CreateFromDSLModal', () => {{ wrapper: createWrapper() },)- expect(screen.getByText('app.newApp.Cancel')).toBeInTheDocument()- expect(screen.getByText('app.newApp.import')).toBeInTheDocument()+ expect(screen.getByText('app.newApp.Cancel'))!.toBeInTheDocument()+ expect(screen.getByText('app.newApp.import'))!.toBeInTheDocument()})it('should render uploader when file tab is active', () => {@@ -166,7 +166,7 @@ describe('CreateFromDSLModal', () => {{ wrapper: createWrapper() },)- expect(screen.getByText('app.dslUploader.button')).toBeInTheDocument()+ expect(screen.getByText('app.dslUploader.button'))!.toBeInTheDocument()})it('should render URL input when URL tab is active', () => {@@ -179,8 +179,8 @@ describe('CreateFromDSLModal', () => {{ wrapper: createWrapper() },)- expect(screen.getByText('DSL URL')).toBeInTheDocument()- expect(screen.getByPlaceholderText('app.importFromDSLUrlPlaceholder')).toBeInTheDocument()+ expect(screen.getByText('DSL URL'))!.toBeInTheDocument()+ expect(screen.getByPlaceholderText('app.importFromDSLUrlPlaceholder'))!.toBeInTheDocument()})})@@ -195,7 +195,8 @@ describe('CreateFromDSLModal', () => {)// File tab content should be visible- expect(screen.getByText('app.dslUploader.button')).toBeInTheDocument()+ // File tab content should be visible+ expect(screen.getByText('app.dslUploader.button'))!.toBeInTheDocument()})it('should use provided activeTab prop', () => {@@ -208,7 +209,7 @@ describe('CreateFromDSLModal', () => {{ wrapper: createWrapper() },)- expect(screen.getByText('DSL URL')).toBeInTheDocument()+ expect(screen.getByText('DSL URL'))!.toBeInTheDocument()})it('should use provided dslUrl prop', () => {@@ -223,7 +224,7 @@ describe('CreateFromDSLModal', () => {)const input = screen.getByPlaceholderText('app.importFromDSLUrlPlaceholder')- expect(input).toHaveValue('https://example.com/test.pipeline')+ expect(input)!.toHaveValue('https://example.com/test.pipeline')})it('should call onClose when cancel button is clicked', () => {@@ -252,12 +253,14 @@ describe('CreateFromDSLModal', () => {)// Initially file tab is active- expect(screen.getByText('app.dslUploader.button')).toBeInTheDocument()+ // Initially file tab is active+ expect(screen.getByText('app.dslUploader.button'))!.toBeInTheDocument()fireEvent.click(screen.getByText('app.importFromDSLUrl'))// URL input should be visible- expect(screen.getByText('DSL URL')).toBeInTheDocument()+ // URL input should be visible+ expect(screen.getByText('DSL URL'))!.toBeInTheDocument()})it('should update URL value when typing', () => {@@ -273,7 +276,7 @@ describe('CreateFromDSLModal', () => {const input = screen.getByPlaceholderText('app.importFromDSLUrlPlaceholder')fireEvent.change(input, { target: { value: 'https://example.com/test.pipeline' } })- expect(input).toHaveValue('https://example.com/test.pipeline')+ expect(input)!.toHaveValue('https://example.com/test.pipeline')})it('should have disabled import button when no file is selected in file tab', () => {@@ -287,7 +290,7 @@ describe('CreateFromDSLModal', () => {)const importButton = screen.getByText('app.newApp.import').closest('button')- expect(importButton).toBeDisabled()+ expect(importButton)!.toBeDisabled()})it('should have disabled import button when no URL is entered in URL tab', () => {@@ -301,7 +304,7 @@ describe('CreateFromDSLModal', () => {)const importButton = screen.getByText('app.newApp.import').closest('button')- expect(importButton).toBeDisabled()+ expect(importButton)!.toBeDisabled()})it('should enable import button when URL is entered', () => {@@ -445,7 +448,7 @@ describe('CreateFromDSLModal', () => {})await waitFor(() => {- expect(screen.getByText('app.newApp.appCreateDSLErrorTitle')).toBeInTheDocument()+ expect(screen.getByText('app.newApp.appCreateDSLErrorTitle'))!.toBeInTheDocument()})vi.useRealTimers()@@ -663,14 +666,14 @@ describe('CreateFromDSLModal', () => {// File tab with no file - disabledlet importButton = screen.getByText('app.newApp.import').closest('button')- expect(importButton).toBeDisabled()+ expect(importButton)!.toBeDisabled()// Switch to URL tab by clicking on itfireEvent.click(screen.getByText('app.importFromDSLUrl'))// Still disabled (no URL)importButton = screen.getByText('app.newApp.import').closest('button')- expect(importButton).toBeDisabled()+ expect(importButton)!.toBeDisabled()// Add URL value - should enableconst input = screen.getByPlaceholderText('app.importFromDSLUrlPlaceholder')@@ -902,7 +905,7 @@ describe('CreateFromDSLModal', () => {// Wait for file to be displayedawait waitFor(() => {- expect(screen.getByText('test.pipeline')).toBeInTheDocument()+ expect(screen.getByText('test.pipeline'))!.toBeInTheDocument()})// Now remove the file by clicking delete button (inside ActionButton)@@ -912,7 +915,7 @@ describe('CreateFromDSLModal', () => {fireEvent.click(deleteButton)// File should be removed - uploader prompt should show againawait waitFor(() => {- expect(screen.getByText('app.dslUploader.button')).toBeInTheDocument()+ expect(screen.getByText('app.dslUploader.button'))!.toBeInTheDocument()})}})@@ -968,7 +971,7 @@ describe('CreateFromDSLModal', () => {})await waitFor(() => {- expect(screen.getByText('app.newApp.Confirm')).toBeInTheDocument()+ expect(screen.getByText('app.newApp.Confirm'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('app.newApp.Confirm'))@@ -1016,7 +1019,7 @@ describe('CreateFromDSLModal', () => {})await waitFor(() => {- expect(screen.getByText('app.newApp.Confirm')).toBeInTheDocument()+ expect(screen.getByText('app.newApp.Confirm'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('app.newApp.Confirm'))@@ -1056,7 +1059,7 @@ describe('CreateFromDSLModal', () => {})await waitFor(() => {- expect(screen.getByText('app.newApp.Confirm')).toBeInTheDocument()+ expect(screen.getByText('app.newApp.Confirm'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('app.newApp.Confirm'))@@ -1103,7 +1106,7 @@ describe('CreateFromDSLModal', () => {})await waitFor(() => {- expect(screen.getByText('app.newApp.Confirm')).toBeInTheDocument()+ expect(screen.getByText('app.newApp.Confirm'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('app.newApp.Confirm'))@@ -1144,13 +1147,13 @@ describe('CreateFromDSLModal', () => {// Error modal should be visibleawait waitFor(() => {- expect(screen.getByText('app.newApp.appCreateDSLErrorTitle')).toBeInTheDocument()+ expect(screen.getByText('app.newApp.appCreateDSLErrorTitle'))!.toBeInTheDocument()})// There are two Cancel buttons now (one in main modal footer, one in error modal)// Find the Cancel button in the error modal contextconst cancelButtons = screen.getAllByText('app.newApp.Cancel')- fireEvent.click(cancelButtons[cancelButtons.length - 1])+ fireEvent.click(cancelButtons[cancelButtons.length - 1]!)vi.useRealTimers()})@@ -1166,14 +1169,14 @@ describe('Header', () => {describe('Rendering', () => {it('should render title', () => {render(<Header onClose={vi.fn()} />)- expect(screen.getByText('app.importFromDSL')).toBeInTheDocument()+ expect(screen.getByText('app.importFromDSL'))!.toBeInTheDocument()})it('should render close icon', () => {render(<Header onClose={vi.fn()} />)// Check for close icon containerconst closeButton = document.querySelector('[class*="cursor-pointer"]')- expect(closeButton).toBeInTheDocument()+ expect(closeButton)!.toBeInTheDocument()})})@@ -1205,8 +1208,8 @@ describe('Tab', () => {/>,)- expect(screen.getByText('app.importFromDSLFile')).toBeInTheDocument()- expect(screen.getByText('app.importFromDSLUrl')).toBeInTheDocument()+ expect(screen.getByText('app.importFromDSLFile'))!.toBeInTheDocument()+ expect(screen.getByText('app.importFromDSLUrl'))!.toBeInTheDocument()})})@@ -1223,7 +1226,7 @@ describe('Tab', () => {fireEvent.click(screen.getByText('app.importFromDSLFile'))// Tab uses bind() which passes the key as first argument and event as secondexpect(setCurrentTab).toHaveBeenCalled()- expect(setCurrentTab.mock.calls[0][0]).toBe(CreateFromDSLModalTab.FROM_FILE)+ expect(setCurrentTab.mock.calls[0]![0]).toBe(CreateFromDSLModalTab.FROM_FILE)})it('should call setCurrentTab when clicking URL tab', () => {@@ -1238,7 +1241,7 @@ describe('Tab', () => {fireEvent.click(screen.getByText('app.importFromDSLUrl'))// Tab uses bind() which passes the key as first argument and event as secondexpect(setCurrentTab).toHaveBeenCalled()- expect(setCurrentTab.mock.calls[0][0]).toBe(CreateFromDSLModalTab.FROM_URL)+ expect(setCurrentTab.mock.calls[0]![0]).toBe(CreateFromDSLModalTab.FROM_URL)})})})@@ -1259,7 +1262,7 @@ describe('TabItem', () => {/>,)- expect(screen.getByText('Test Tab')).toBeInTheDocument()+ expect(screen.getByText('Test Tab'))!.toBeInTheDocument()})it('should render active indicator when active', () => {@@ -1273,7 +1276,7 @@ describe('TabItem', () => {// Active indicator is the bottom border divconst indicator = document.querySelector('[class*="bg-util-colors-blue"]')- expect(indicator).toBeInTheDocument()+ expect(indicator)!.toBeInTheDocument()})it('should not render active indicator when inactive', () => {@@ -1348,8 +1351,8 @@ describe('Uploader', () => {/>,)- expect(screen.getByText('app.dslUploader.button')).toBeInTheDocument()- expect(screen.getByText('app.dslUploader.browse')).toBeInTheDocument()+ expect(screen.getByText('app.dslUploader.button'))!.toBeInTheDocument()+ expect(screen.getByText('app.dslUploader.browse'))!.toBeInTheDocument()})it('should render file info when file is selected', () => {@@ -1362,8 +1365,8 @@ describe('Uploader', () => {/>,)- expect(screen.getByText('test.pipeline')).toBeInTheDocument()- expect(screen.getByText('PIPELINE')).toBeInTheDocument()+ expect(screen.getByText('test.pipeline'))!.toBeInTheDocument()+ expect(screen.getByText('PIPELINE'))!.toBeInTheDocument()})it('should apply custom className', () => {@@ -1375,7 +1378,7 @@ describe('Uploader', () => {/>,)- expect(container.firstChild).toHaveClass('custom-class')+ expect(container.firstChild)!.toHaveClass('custom-class')})})@@ -1484,7 +1487,8 @@ describe('Uploader', () => {dropArea.dispatchEvent(dragOverEvent)// Event should be handled without errors- expect(dropArea).toBeInTheDocument()+ // Event should be handled without errors+ expect(dropArea)!.toBeInTheDocument()})it('should handle dragLeave event and reset dragging state when target is dragRef', async () => {@@ -1513,7 +1517,7 @@ describe('Uploader', () => {// The dragRef div appears when dragging is trueconst dragRefDiv = document.querySelector('[class*="absolute top-0 left-0"]')- expect(dragRefDiv).toBeInTheDocument()+ expect(dragRefDiv)!.toBeInTheDocument()// When dragLeave happens on the dragRef element, setDragging(false) is calledif (dragRefDiv) {@@ -1648,7 +1652,7 @@ describe('Uploader', () => {// Get the file inputconst fileInput = document.querySelector('input[type="file"]') as HTMLInputElement- expect(fileInput).toBeInTheDocument()+ expect(fileInput)!.toBeInTheDocument()// Spy on input click before triggering selectHandleconst clickSpy = vi.spyOn(fileInput, 'click').mockImplementation(() => {@@ -1715,7 +1719,7 @@ describe('Uploader', () => {// Find and click delete buttonconst deleteButton = document.querySelector('button')- expect(deleteButton).toBeInTheDocument()+ expect(deleteButton)!.toBeInTheDocument()if (deleteButton) {fireEvent.click(deleteButton)@@ -1745,7 +1749,7 @@ describe('DSLConfirmModal', () => {/>,)- expect(screen.getByText('app.newApp.appCreateDSLErrorTitle')).toBeInTheDocument()+ expect(screen.getByText('app.newApp.appCreateDSLErrorTitle'))!.toBeInTheDocument()})it('should render version information', () => {@@ -1760,8 +1764,8 @@ describe('DSLConfirmModal', () => {/>,)- expect(screen.getByText('0.9.0')).toBeInTheDocument()- expect(screen.getByText('1.0.0')).toBeInTheDocument()+ expect(screen.getByText('0.9.0'))!.toBeInTheDocument()+ expect(screen.getByText('1.0.0'))!.toBeInTheDocument()})it('should render cancel and confirm buttons', () => {@@ -1772,8 +1776,8 @@ describe('DSLConfirmModal', () => {/>,)- expect(screen.getByText('app.newApp.Cancel')).toBeInTheDocument()- expect(screen.getByText('app.newApp.Confirm')).toBeInTheDocument()+ expect(screen.getByText('app.newApp.Cancel'))!.toBeInTheDocument()+ expect(screen.getByText('app.newApp.Confirm'))!.toBeInTheDocument()})it('should render with default empty versions', () => {@@ -1785,7 +1789,8 @@ describe('DSLConfirmModal', () => {)// Should not crash with default empty strings- expect(screen.getByText('app.newApp.appCreateDSLErrorTitle')).toBeInTheDocument()+ // Should not crash with default empty strings+ expect(screen.getByText('app.newApp.appCreateDSLErrorTitle'))!.toBeInTheDocument()})it('should disable confirm button when confirmDisabled is true', () => {@@ -1798,7 +1803,7 @@ describe('DSLConfirmModal', () => {)const confirmButton = screen.getByText('app.newApp.Confirm').closest('button')- expect(confirmButton).toBeDisabled()+ expect(confirmButton)!.toBeDisabled()})})@@ -1879,7 +1884,8 @@ describe('DSLConfirmModal', () => {)// Component should render without crashing- expect(screen.getByText('app.newApp.appCreateDSLErrorTitle')).toBeInTheDocument()+ // Component should render without crashing+ expect(screen.getByText('app.newApp.appCreateDSLErrorTitle'))!.toBeInTheDocument()})it('should use default confirmDisabled when not provided', () => {@@ -1988,7 +1994,7 @@ describe('CreateFromDSLModal Integration', () => {// Verify error modal is shownawait waitFor(() => {- expect(screen.getByText('app.newApp.appCreateDSLErrorTitle')).toBeInTheDocument()+ expect(screen.getByText('app.newApp.appCreateDSLErrorTitle'))!.toBeInTheDocument()})vi.useRealTimers()diff --git a/web/app/components/datasets/create/__tests__/index.spec.tsx b/web/app/components/datasets/create/__tests__/index.spec.tsxindex 59d5dd891af..7ad5f0b6bd7 100644--- a/web/app/components/datasets/create/__tests__/index.spec.tsx+++ b/web/app/components/datasets/create/__tests__/index.spec.tsx@@ -302,20 +302,20 @@ describe('DatasetUpdateForm', () => {it('should render without crashing', () => {render(<DatasetUpdateForm />)- expect(screen.getByTestId('top-bar')).toBeInTheDocument()- expect(screen.getByTestId('step-one')).toBeInTheDocument()+ expect(screen.getByTestId('top-bar'))!.toBeInTheDocument()+ expect(screen.getByTestId('step-one'))!.toBeInTheDocument()})it('should render TopBar with correct active index for step 1', () => {render(<DatasetUpdateForm />)- expect(screen.getByTestId('top-bar-active-index')).toHaveTextContent('0')+ expect(screen.getByTestId('top-bar-active-index'))!.toHaveTextContent('0')})it('should render StepOne by default', () => {render(<DatasetUpdateForm />)- expect(screen.getByTestId('step-one')).toBeInTheDocument()+ expect(screen.getByTestId('step-one'))!.toBeInTheDocument()expect(screen.queryByTestId('step-two')).not.toBeInTheDocument()expect(screen.queryByTestId('step-three')).not.toBeInTheDocument()})@@ -325,6 +325,37 @@ describe('DatasetUpdateForm', () => {render(<DatasetUpdateForm />)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)+ // Assert - Loading component should be rendered (not the steps)// Assert - Loading component should be rendered (not the steps)expect(screen.queryByTestId('step-one')).not.toBeInTheDocument()})@@ -334,7 +365,7 @@ describe('DatasetUpdateForm', () => {render(<DatasetUpdateForm />)- expect(screen.getByText('datasetCreation.error.unavailable')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.error.unavailable'))!.toBeInTheDocument()})})@@ -344,7 +375,7 @@ describe('DatasetUpdateForm', () => {it('should pass datasetId to TopBar', () => {render(<DatasetUpdateForm datasetId="dataset-abc" />)- expect(screen.getByTestId('top-bar-dataset-id')).toHaveTextContent('dataset-abc')+ expect(screen.getByTestId('top-bar-dataset-id'))!.toHaveTextContent('dataset-abc')})it('should pass datasetId to StepOne', () => {@@ -356,7 +387,7 @@ describe('DatasetUpdateForm', () => {it('should render without datasetId', () => {render(<DatasetUpdateForm />)- expect(screen.getByTestId('top-bar-dataset-id')).toHaveTextContent('none')+ expect(screen.getByTestId('top-bar-dataset-id'))!.toHaveTextContent('none')expect(stepOneProps.datasetId).toBeUndefined()})})@@ -368,7 +399,7 @@ describe('DatasetUpdateForm', () => {it('should initialize with FILE data source type', () => {render(<DatasetUpdateForm />)- expect(screen.getByTestId('step-one-data-source-type')).toHaveTextContent(DataSourceType.FILE)+ expect(screen.getByTestId('step-one-data-source-type'))!.toHaveTextContent(DataSourceType.FILE)})it('should update dataSourceType when changeType is called', () => {@@ -376,7 +407,7 @@ describe('DatasetUpdateForm', () => {fireEvent.click(screen.getByTestId('step-one-change-type'))- expect(screen.getByTestId('step-one-data-source-type')).toHaveTextContent(DataSourceType.NOTION)+ expect(screen.getByTestId('step-one-data-source-type'))!.toHaveTextContent(DataSourceType.NOTION)})})@@ -384,8 +415,8 @@ describe('DatasetUpdateForm', () => {it('should initialize at step 1', () => {render(<DatasetUpdateForm />)- expect(screen.getByTestId('step-one')).toBeInTheDocument()- expect(screen.getByTestId('top-bar-active-index')).toHaveTextContent('0')+ expect(screen.getByTestId('step-one'))!.toBeInTheDocument()+ expect(screen.getByTestId('top-bar-active-index'))!.toHaveTextContent('0')})it('should transition to step 2 when nextStep is called', () => {@@ -394,8 +425,8 @@ describe('DatasetUpdateForm', () => {fireEvent.click(screen.getByTestId('step-one-next'))expect(screen.queryByTestId('step-one')).not.toBeInTheDocument()- expect(screen.getByTestId('step-two')).toBeInTheDocument()- expect(screen.getByTestId('top-bar-active-index')).toHaveTextContent('1')+ expect(screen.getByTestId('step-two'))!.toBeInTheDocument()+ expect(screen.getByTestId('top-bar-active-index'))!.toHaveTextContent('1')})it('should transition to step 3 from step 2', () => {@@ -408,8 +439,8 @@ describe('DatasetUpdateForm', () => {fireEvent.click(screen.getByTestId('step-two-next'))expect(screen.queryByTestId('step-two')).not.toBeInTheDocument()- expect(screen.getByTestId('step-three')).toBeInTheDocument()- expect(screen.getByTestId('top-bar-active-index')).toHaveTextContent('2')+ expect(screen.getByTestId('step-three'))!.toBeInTheDocument()+ expect(screen.getByTestId('top-bar-active-index'))!.toHaveTextContent('2')})it('should go back to step 1 from step 2', () => {@@ -418,7 +449,7 @@ describe('DatasetUpdateForm', () => {fireEvent.click(screen.getByTestId('step-two-prev'))- expect(screen.getByTestId('step-one')).toBeInTheDocument()+ expect(screen.getByTestId('step-one'))!.toBeInTheDocument()expect(screen.queryByTestId('step-two')).not.toBeInTheDocument()})})@@ -427,7 +458,7 @@ describe('DatasetUpdateForm', () => {it('should initialize with empty file list', () => {render(<DatasetUpdateForm />)- expect(screen.getByTestId('step-one-files-count')).toHaveTextContent('0')+ expect(screen.getByTestId('step-one-files-count'))!.toHaveTextContent('0')})it('should update file list when updateFileList is called', () => {@@ -435,7 +466,7 @@ describe('DatasetUpdateForm', () => {fireEvent.click(screen.getByTestId('step-one-update-files'))- expect(screen.getByTestId('step-one-files-count')).toHaveTextContent('1')+ expect(screen.getByTestId('step-one-files-count'))!.toHaveTextContent('1')})})@@ -443,7 +474,7 @@ describe('DatasetUpdateForm', () => {it('should initialize with empty notion pages', () => {render(<DatasetUpdateForm />)- expect(screen.getByTestId('step-one-notion-pages-count')).toHaveTextContent('0')+ expect(screen.getByTestId('step-one-notion-pages-count'))!.toHaveTextContent('0')})it('should update notion pages when updateNotionPages is called', () => {@@ -451,7 +482,7 @@ describe('DatasetUpdateForm', () => {fireEvent.click(screen.getByTestId('step-one-update-notion-pages'))- expect(screen.getByTestId('step-one-notion-pages-count')).toHaveTextContent('1')+ expect(screen.getByTestId('step-one-notion-pages-count'))!.toHaveTextContent('1')})})@@ -459,7 +490,7 @@ describe('DatasetUpdateForm', () => {it('should initialize with empty website pages', () => {render(<DatasetUpdateForm />)- expect(screen.getByTestId('step-one-website-pages-count')).toHaveTextContent('0')+ expect(screen.getByTestId('step-one-website-pages-count'))!.toHaveTextContent('0')})it('should update website pages when setWebsitePages is called', () => {@@ -467,7 +498,7 @@ describe('DatasetUpdateForm', () => {fireEvent.click(screen.getByTestId('step-one-update-website-pages'))- expect(screen.getByTestId('step-one-website-pages-count')).toHaveTextContent('1')+ expect(screen.getByTestId('step-one-website-pages-count'))!.toHaveTextContent('1')})})})@@ -579,7 +610,7 @@ describe('DatasetUpdateForm', () => {fireEvent.click(screen.getByTestId('step-one-update-file-progress'))// Assert - Progress should be updated- expect(stepOneProps.files[0].progress).toBe(50)+ expect(stepOneProps.files[0]!.progress).toBe(50)})it('should update notion credential id', () => {@@ -599,7 +630,7 @@ describe('DatasetUpdateForm', () => {fireEvent.click(screen.getByTestId('step-one-next'))- expect(screen.getByTestId('step-two-is-api-key-set')).toHaveTextContent('true')+ expect(screen.getByTestId('step-two-is-api-key-set'))!.toHaveTextContent('true')})it('should pass isAPIKeySet as false when embeddingsDefaultModel is undefined', () => {@@ -608,7 +639,7 @@ describe('DatasetUpdateForm', () => {fireEvent.click(screen.getByTestId('step-one-next'))- expect(screen.getByTestId('step-two-is-api-key-set')).toHaveTextContent('false')+ expect(screen.getByTestId('step-two-is-api-key-set'))!.toHaveTextContent('false')})it('should pass correct dataSourceType to StepTwo', () => {@@ -617,7 +648,7 @@ describe('DatasetUpdateForm', () => {fireEvent.click(screen.getByTestId('step-one-next'))- expect(screen.getByTestId('step-two-data-source-type')).toHaveTextContent(DataSourceType.NOTION)+ expect(screen.getByTestId('step-two-data-source-type'))!.toHaveTextContent(DataSourceType.NOTION)})it('should pass files mapped to file property to StepTwo', () => {@@ -626,7 +657,7 @@ describe('DatasetUpdateForm', () => {fireEvent.click(screen.getByTestId('step-one-next'))- expect(screen.getByTestId('step-two-files-count')).toHaveTextContent('1')+ expect(screen.getByTestId('step-two-files-count'))!.toHaveTextContent('1')})it('should update indexing type cache from StepTwo', () => {@@ -637,7 +668,7 @@ describe('DatasetUpdateForm', () => {// Assert - Go to step 3 and verifyfireEvent.click(screen.getByTestId('step-two-next'))- expect(screen.getByTestId('step-three-indexing-type')).toHaveTextContent('high_quality')+ expect(screen.getByTestId('step-three-indexing-type'))!.toHaveTextContent('high_quality')})it('should update retrieval method cache from StepTwo', () => {@@ -648,7 +679,7 @@ describe('DatasetUpdateForm', () => {// Assert - Go to step 3 and verifyfireEvent.click(screen.getByTestId('step-two-next'))- expect(screen.getByTestId('step-three-retrieval-method')).toHaveTextContent('semantic_search')+ expect(screen.getByTestId('step-three-retrieval-method'))!.toHaveTextContent('semantic_search')})it('should update result cache from StepTwo', () => {@@ -672,6 +703,37 @@ describe('DatasetUpdateForm', () => {fireEvent.click(screen.getByTestId('step-one-next'))+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition+ // Assert - StepTwo should not render due to condition// Assert - StepTwo should not render due to conditionexpect(screen.queryByTestId('step-two')).not.toBeInTheDocument()})@@ -682,7 +744,7 @@ describe('DatasetUpdateForm', () => {fireEvent.click(screen.getByTestId('step-one-next'))- expect(screen.getByTestId('step-two')).toBeInTheDocument()+ expect(screen.getByTestId('step-two'))!.toBeInTheDocument()})it('should pass indexingType from datasetDetail to StepTwo', () => {@@ -706,7 +768,7 @@ describe('DatasetUpdateForm', () => {fireEvent.click(screen.getByTestId('step-one-next'))fireEvent.click(screen.getByTestId('step-two-next'))- expect(screen.getByTestId('step-three-dataset-id')).toHaveTextContent('dataset-456')+ expect(screen.getByTestId('step-three-dataset-id'))!.toHaveTextContent('dataset-456')})it('should pass datasetName from datasetDetail to StepThree', () => {@@ -716,7 +778,7 @@ describe('DatasetUpdateForm', () => {fireEvent.click(screen.getByTestId('step-one-next'))fireEvent.click(screen.getByTestId('step-two-next'))- expect(screen.getByTestId('step-three-dataset-name')).toHaveTextContent('My Special Dataset')+ expect(screen.getByTestId('step-three-dataset-name'))!.toHaveTextContent('My Special Dataset')})it('should use cached indexing type when datasetDetail indexing_technique is not available', () => {@@ -729,7 +791,7 @@ describe('DatasetUpdateForm', () => {// Act - Navigate to step 3fireEvent.click(screen.getByTestId('step-two-next'))- expect(screen.getByTestId('step-three-indexing-type')).toHaveTextContent('high_quality')+ expect(screen.getByTestId('step-three-indexing-type'))!.toHaveTextContent('high_quality')})it('should use datasetDetail indexing_technique over cached value', () => {@@ -744,7 +806,8 @@ describe('DatasetUpdateForm', () => {fireEvent.click(screen.getByTestId('step-two-next'))// Assert - Should use datasetDetail value, not cache- expect(screen.getByTestId('step-three-indexing-type')).toHaveTextContent('economy')+ // Assert - Should use datasetDetail value, not cache+ expect(screen.getByTestId('step-three-indexing-type'))!.toHaveTextContent('economy')})it('should use retrieval method from datasetDetail when available', () => {@@ -758,7 +821,7 @@ describe('DatasetUpdateForm', () => {fireEvent.click(screen.getByTestId('step-one-next'))fireEvent.click(screen.getByTestId('step-two-next'))- expect(screen.getByTestId('step-three-retrieval-method')).toHaveTextContent('full_text_search')+ expect(screen.getByTestId('step-three-retrieval-method'))!.toHaveTextContent('full_text_search')})})@@ -833,7 +896,8 @@ describe('DatasetUpdateForm', () => {fireEvent.click(screen.getByTestId('step-two-next'))// Assert - Should use cached value- expect(screen.getByTestId('step-three-retrieval-method')).toHaveTextContent('semantic_search')+ // Assert - Should use cached value+ expect(screen.getByTestId('step-three-retrieval-method'))!.toHaveTextContent('semantic_search')})it('should handle step state correctly after multiple navigations', () => {@@ -845,8 +909,8 @@ describe('DatasetUpdateForm', () => {fireEvent.click(screen.getByTestId('step-one-next')) // to step 2fireEvent.click(screen.getByTestId('step-two-next')) // to step 3- expect(screen.getByTestId('step-three')).toBeInTheDocument()- expect(screen.getByTestId('top-bar-active-index')).toHaveTextContent('2')+ expect(screen.getByTestId('step-three'))!.toBeInTheDocument()+ expect(screen.getByTestId('top-bar-active-index'))!.toHaveTextContent('2')})it('should handle result cache being undefined', () => {@@ -887,9 +951,10 @@ describe('DatasetUpdateForm', () => {fireEvent.click(screen.getByTestId('step-two-prev'))// Assert - All state should be preserved- expect(screen.getByTestId('step-one-data-source-type')).toHaveTextContent(DataSourceType.NOTION)- expect(screen.getByTestId('step-one-files-count')).toHaveTextContent('1')- expect(screen.getByTestId('step-one-notion-pages-count')).toHaveTextContent('1')+ // Assert - All state should be preserved+ expect(screen.getByTestId('step-one-data-source-type'))!.toHaveTextContent(DataSourceType.NOTION)+ expect(screen.getByTestId('step-one-files-count'))!.toHaveTextContent('1')+ expect(screen.getByTestId('step-one-notion-pages-count'))!.toHaveTextContent('1')})})@@ -909,8 +974,9 @@ describe('DatasetUpdateForm', () => {fireEvent.click(screen.getByTestId('step-two-next'))// Assert - All data flows through to Step 3- expect(screen.getByTestId('step-three-indexing-type')).toHaveTextContent('high_quality')- expect(screen.getByTestId('step-three-retrieval-method')).toHaveTextContent('semantic_search')+ // Assert - All data flows through to Step 3+ expect(screen.getByTestId('step-three-indexing-type'))!.toHaveTextContent('high_quality')+ expect(screen.getByTestId('step-three-retrieval-method'))!.toHaveTextContent('semantic_search')expect(stepThreeProps.creationCache?.batch).toBe('batch-1')})@@ -970,8 +1036,9 @@ describe('DatasetUpdateForm', () => {fireEvent.click(screen.getByTestId('step-two-next'))// Assert - Step 3 should show dataset details- expect(screen.getByTestId('step-three-dataset-name')).toHaveTextContent('Existing Dataset')- expect(screen.getByTestId('step-three-indexing-type')).toHaveTextContent('high_quality')+ // Assert - Step 3 should show dataset details+ expect(screen.getByTestId('step-three-dataset-name'))!.toHaveTextContent('Existing Dataset')+ expect(screen.getByTestId('step-three-indexing-type'))!.toHaveTextContent('high_quality')})})@@ -1014,7 +1081,7 @@ describe('DatasetUpdateForm', () => {render(<DatasetUpdateForm />)const errorElement = screen.getByText('datasetCreation.error.unavailable')- expect(errorElement).toBeInTheDocument()+ expect(errorElement)!.toBeInTheDocument()})it('should not render steps when in error state', () => {@@ -1033,7 +1100,8 @@ describe('DatasetUpdateForm', () => {render(<DatasetUpdateForm />)// Assert - Error state renders AppUnavailable, not the normal layout- expect(screen.getByText('500')).toBeInTheDocument()+ // Assert - Error state renders AppUnavailable, not the normal layout+ expect(screen.getByText('500'))!.toBeInTheDocument()expect(screen.queryByTestId('top-bar')).not.toBeInTheDocument()})})@@ -1053,13 +1121,44 @@ describe('DatasetUpdateForm', () => {render(<DatasetUpdateForm />)- expect(screen.getByTestId('top-bar')).toBeInTheDocument()+ expect(screen.getByTestId('top-bar'))!.toBeInTheDocument()})it('should render StepOne after loading completes', async () => {mockIsLoadingDataSourceList = trueconst { rerender } = render(<DatasetUpdateForm />)+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered+ // Assert - Initially not rendered// Assert - Initially not renderedexpect(screen.queryByTestId('step-one')).not.toBeInTheDocument()@@ -1069,7 +1168,7 @@ describe('DatasetUpdateForm', () => {// Assert - Now renderedawait waitFor(() => {- expect(screen.getByTestId('step-one')).toBeInTheDocument()+ expect(screen.getByTestId('step-one'))!.toBeInTheDocument()})})})diff --git a/web/app/components/datasets/create/embedding-process/__tests__/rule-detail.spec.tsx b/web/app/components/datasets/create/embedding-process/__tests__/rule-detail.spec.tsxindex ba557a55f16..5213e9f6858 100644--- a/web/app/components/datasets/create/embedding-process/__tests__/rule-detail.spec.tsx+++ b/web/app/components/datasets/create/embedding-process/__tests__/rule-detail.spec.tsx@@ -58,7 +58,7 @@ describe('RuleDetail', () => {)const values = screen.getAllByTestId('field-value')- expect(values[0].textContent).toContain('embedding.custom')+ expect(values[0]!.textContent).toContain('embedding.custom')})it('should display hierarchical mode with parent mode label', () => {@@ -78,7 +78,7 @@ describe('RuleDetail', () => {)const values = screen.getAllByTestId('field-value')- expect(values[0].textContent).toContain('embedding.hierarchical')+ expect(values[0]!.textContent).toContain('embedding.hierarchical')})it('should display "-" when no sourceData mode', () => {@@ -90,7 +90,7 @@ describe('RuleDetail', () => {)const values = screen.getAllByTestId('field-value')- expect(values[0].textContent).toBe('-')+ expect(values[0]!.textContent).toBe('-')})it('should display segment length for general mode', () => {@@ -102,7 +102,7 @@ describe('RuleDetail', () => {)const values = screen.getAllByTestId('field-value')- expect(values[1].textContent).toBe('500')+ expect(values[1]!.textContent).toBe('500')})it('should display enabled pre-processing rules', () => {@@ -115,7 +115,7 @@ describe('RuleDetail', () => {const values = screen.getAllByTestId('field-value')// Only remove_extra_spaces is enabled- expect(values[2].textContent).toContain('stepTwo.removeExtraSpaces')+ expect(values[2]!.textContent).toContain('stepTwo.removeExtraSpaces')})it('should display economical index mode', () => {@@ -128,7 +128,7 @@ describe('RuleDetail', () => {const values = screen.getAllByTestId('field-value')// Index mode field is 4th (index 3)- expect(values[3].textContent).toContain('stepTwo.economical')+ expect(values[3]!.textContent).toContain('stepTwo.economical')})it('should display qualified index mode for high_quality', () => {@@ -140,6 +140,6 @@ describe('RuleDetail', () => {)const values = screen.getAllByTestId('field-value')- expect(values[3].textContent).toContain('stepTwo.qualified')+ expect(values[3]!.textContent).toContain('stepTwo.qualified')})})diff --git a/web/app/components/datasets/create/embedding-process/rule-detail.tsx b/web/app/components/datasets/create/embedding-process/rule-detail.tsxindex 553c7510562..5e5d4923a72 100644--- a/web/app/components/datasets/create/embedding-process/rule-detail.tsx+++ b/web/app/components/datasets/create/embedding-process/rule-detail.tsx@@ -112,7 +112,7 @@ const RuleDetail: FC<RuleDetailProps> = ({ sourceData, indexingType, retrievalMe<FieldInfokey={field}label={segmentationRuleLabels[field as keyof typeof segmentationRuleLabels]}- displayedValue={String(fieldValueGetters[field]())}+ displayedValue={String(fieldValueGetters[field]!())}/>))}<FieldInfodiff --git a/web/app/components/datasets/create/file-preview/__tests__/index.spec.tsx b/web/app/components/datasets/create/file-preview/__tests__/index.spec.tsxindex 2b4bb343ff5..6839a8cc87a 100644--- a/web/app/components/datasets/create/file-preview/__tests__/index.spec.tsx+++ b/web/app/components/datasets/create/file-preview/__tests__/index.spec.tsx@@ -62,23 +62,23 @@ describe('FilePreview', () => {renderFilePreview()await waitFor(() => {- expect(screen.getByText('datasetCreation.stepOne.filePreview')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepOne.filePreview'))!.toBeInTheDocument()})})it('should render file preview header', async () => {renderFilePreview()- expect(screen.getByText('datasetCreation.stepOne.filePreview')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepOne.filePreview'))!.toBeInTheDocument()})it('should render close button with XMarkIcon', async () => {const { container } = renderFilePreview()const closeButton = container.querySelector('.cursor-pointer')- expect(closeButton).toBeInTheDocument()+ expect(closeButton)!.toBeInTheDocument()const xMarkIcon = closeButton?.querySelector('svg')- expect(xMarkIcon).toBeInTheDocument()+ expect(xMarkIcon)!.toBeInTheDocument()})it('should render file name without extension', async () => {@@ -87,7 +87,7 @@ describe('FilePreview', () => {renderFilePreview({ file })await waitFor(() => {- expect(screen.getByText('document')).toBeInTheDocument()+ expect(screen.getByText('document'))!.toBeInTheDocument()})})@@ -96,14 +96,14 @@ describe('FilePreview', () => {renderFilePreview({ file })- expect(screen.getByText('.pdf')).toBeInTheDocument()+ expect(screen.getByText('.pdf'))!.toBeInTheDocument()})it('should apply correct CSS classes to container', async () => {const { container } = renderFilePreview()const wrapper = container.firstChild as HTMLElement- expect(wrapper).toHaveClass('h-full')+ expect(wrapper)!.toHaveClass('h-full')})})@@ -119,7 +119,7 @@ describe('FilePreview', () => {// Assert - Loading should be visible initially (using spin-animation class)const loadingElement = findLoadingSpinner(container)- expect(loadingElement).toBeInTheDocument()+ expect(loadingElement)!.toBeInTheDocument()})it('should hide loading indicator after content loads', async () => {@@ -128,7 +128,7 @@ describe('FilePreview', () => {const { container } = renderFilePreview()await waitFor(() => {- expect(screen.getByText('Loaded content')).toBeInTheDocument()+ expect(screen.getByText('Loaded content'))!.toBeInTheDocument()})// Loading should be goneconst loadingElement = findLoadingSpinner(container)@@ -152,7 +152,8 @@ describe('FilePreview', () => {)// First file loading - spinner should be visible- expect(findLoadingSpinner(container)).toBeInTheDocument()+ // First file loading - spinner should be visible+ expect(findLoadingSpinner(container))!.toBeInTheDocument()// Resolve first fileawait act(async () => {@@ -160,7 +161,7 @@ describe('FilePreview', () => {})await waitFor(() => {- expect(screen.getByText('Content 1')).toBeInTheDocument()+ expect(screen.getByText('Content 1'))!.toBeInTheDocument()})// Rerender with new file@@ -168,7 +169,7 @@ describe('FilePreview', () => {// Should show loading againawait waitFor(() => {- expect(findLoadingSpinner(container)).toBeInTheDocument()+ expect(findLoadingSpinner(container))!.toBeInTheDocument()})// Resolve second file@@ -177,7 +178,7 @@ describe('FilePreview', () => {})await waitFor(() => {- expect(screen.getByText('Content 2')).toBeInTheDocument()+ expect(screen.getByText('Content 2'))!.toBeInTheDocument()})})})@@ -234,7 +235,7 @@ describe('FilePreview', () => {renderFilePreview()await waitFor(() => {- expect(screen.getByText('File preview content from API')).toBeInTheDocument()+ expect(screen.getByText('File preview content from API'))!.toBeInTheDocument()})})@@ -245,10 +246,11 @@ describe('FilePreview', () => {// Assert - Component should not crash, loading may persistawait waitFor(() => {- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})// No error thrown, component still rendered- expect(screen.getByText('datasetCreation.stepOne.filePreview')).toBeInTheDocument()+ // No error thrown, component still rendered+ expect(screen.getByText('datasetCreation.stepOne.filePreview'))!.toBeInTheDocument()})it('should handle empty content response', async () => {@@ -284,7 +286,7 @@ describe('FilePreview', () => {// Assert - onClick receives the event objectexpect(hidePreview).toHaveBeenCalled()- expect(hidePreview.mock.calls[0][0]).toBeDefined()+ expect(hidePreview.mock.calls[0]![0]).toBeDefined()})it('should handle multiple clicks on close button', async () => {@@ -308,7 +310,7 @@ describe('FilePreview', () => {const { container } = renderFilePreview()const loadingElement = findLoadingSpinner(container)- expect(loadingElement).toBeInTheDocument()+ expect(loadingElement)!.toBeInTheDocument()})it('should update previewContent state after successful fetch', async () => {@@ -317,7 +319,7 @@ describe('FilePreview', () => {renderFilePreview()await waitFor(() => {- expect(screen.getByText('New preview content')).toBeInTheDocument()+ expect(screen.getByText('New preview content'))!.toBeInTheDocument()})})@@ -334,7 +336,7 @@ describe('FilePreview', () => {)await waitFor(() => {- expect(screen.getByText('Content 1')).toBeInTheDocument()+ expect(screen.getByText('Content 1'))!.toBeInTheDocument()})// Change file@@ -343,7 +345,7 @@ describe('FilePreview', () => {// Assert - Loading should be shown againawait waitFor(() => {const loadingElement = findLoadingSpinner(container)- expect(loadingElement).toBeInTheDocument()+ expect(loadingElement)!.toBeInTheDocument()})})@@ -362,7 +364,7 @@ describe('FilePreview', () => {)await waitFor(() => {- expect(screen.getByText('Content 1')).toBeInTheDocument()+ expect(screen.getByText('Content 1'))!.toBeInTheDocument()})// Change file - loading should replace content@@ -374,7 +376,7 @@ describe('FilePreview', () => {})await waitFor(() => {- expect(screen.getByText('Content 2')).toBeInTheDocument()+ expect(screen.getByText('Content 2'))!.toBeInTheDocument()expect(screen.queryByText('Content 1')).not.toBeInTheDocument()})})@@ -387,15 +389,16 @@ describe('FilePreview', () => {renderFilePreview({ file })- expect(screen.getByText('my-document')).toBeInTheDocument()- expect(screen.getByText('.pdf')).toBeInTheDocument()+ expect(screen.getByText('my-document'))!.toBeInTheDocument()+ expect(screen.getByText('.pdf'))!.toBeInTheDocument()})it('should render correctly without file prop', async () => {renderFilePreview({ file: undefined })// Assert - Header should still render- expect(screen.getByText('datasetCreation.stepOne.filePreview')).toBeInTheDocument()+ // Assert - Header should still render+ expect(screen.getByText('datasetCreation.stepOne.filePreview'))!.toBeInTheDocument()})it('should handle file with multiple dots in name', async () => {@@ -404,7 +407,8 @@ describe('FilePreview', () => {renderFilePreview({ file })// Assert - Should join all parts except last with comma- expect(screen.getByText('my,document,v2')).toBeInTheDocument()+ // Assert - Should join all parts except last with comma+ expect(screen.getByText('my,document,v2'))!.toBeInTheDocument()})it('should handle file with no extension in name', async () => {@@ -414,7 +418,7 @@ describe('FilePreview', () => {// Assert - getFileName returns empty for single segment, but component still rendersconst fileNameElement = container.querySelector('[class*="fileName"]')- expect(fileNameElement).toBeInTheDocument()+ expect(fileNameElement)!.toBeInTheDocument()// The first span (file name) should be emptyconst fileNameSpan = fileNameElement?.querySelector('span:first-child')expect(fileNameSpan?.textContent).toBe('')@@ -426,7 +430,8 @@ describe('FilePreview', () => {const { container } = renderFilePreview({ file })// Assert - Should not crash- expect(container.firstChild).toBeInTheDocument()+ // Assert - Should not crash+ expect(container.firstChild)!.toBeInTheDocument()})})@@ -437,7 +442,8 @@ describe('FilePreview', () => {renderFilePreview({ hidePreview })// Assert - No errors thrown- expect(screen.getByText('datasetCreation.stepOne.filePreview')).toBeInTheDocument()+ // Assert - No errors thrown+ expect(screen.getByText('datasetCreation.stepOne.filePreview'))!.toBeInTheDocument()})})})@@ -450,7 +456,7 @@ describe('FilePreview', () => {// Assert - Should not call API, remain in loading stateexpect(mockFetchFilePreview).not.toHaveBeenCalled()- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})it('should handle file with empty string id', async () => {@@ -468,7 +474,7 @@ describe('FilePreview', () => {renderFilePreview({ file })- expect(screen.getByText('a'.repeat(200))).toBeInTheDocument()+ expect(screen.getByText('a'.repeat(200)))!.toBeInTheDocument()})it('should handle file with special characters in name', async () => {@@ -476,7 +482,7 @@ describe('FilePreview', () => {renderFilePreview({ file })- expect(screen.getByText('file-with_special@#$%')).toBeInTheDocument()+ expect(screen.getByText('file-with_special@#$%'))!.toBeInTheDocument()})it('should handle very long preview content', async () => {@@ -486,7 +492,7 @@ describe('FilePreview', () => {renderFilePreview()await waitFor(() => {- expect(screen.getByText(longContent)).toBeInTheDocument()+ expect(screen.getByText(longContent))!.toBeInTheDocument()})})@@ -499,7 +505,7 @@ describe('FilePreview', () => {// Assert - Should render as text, not execute scriptsawait waitFor(() => {const contentDiv = container.querySelector('[class*="fileContent"]')- expect(contentDiv).toBeInTheDocument()+ expect(contentDiv)!.toBeInTheDocument()// Content is escaped by React, so HTML entities are displayedexpect(contentDiv?.textContent).toContain('alert')})@@ -512,7 +518,7 @@ describe('FilePreview', () => {renderFilePreview()await waitFor(() => {- expect(screen.getByText(unicodeContent)).toBeInTheDocument()+ expect(screen.getByText(unicodeContent))!.toBeInTheDocument()})})@@ -525,7 +531,7 @@ describe('FilePreview', () => {// Assert - Content should be in the DOMawait waitFor(() => {const contentDiv = container.querySelector('[class*="fileContent"]')- expect(contentDiv).toBeInTheDocument()+ expect(contentDiv)!.toBeInTheDocument()expect(contentDiv?.textContent).toContain('Line 1')expect(contentDiv?.textContent).toContain('Line 2')expect(contentDiv?.textContent).toContain('Line 3')@@ -539,7 +545,7 @@ describe('FilePreview', () => {// Assert - Should not crashawait waitFor(() => {- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})})})@@ -633,7 +639,8 @@ describe('FilePreview', () => {rerender(<FilePreview file={undefined} hidePreview={vi.fn()} />)// Assert - Should not crash, API should not be called again- expect(container.firstChild).toBeInTheDocument()+ // Assert - Should not crash, API should not be called again+ expect(container.firstChild)!.toBeInTheDocument()expect(mockFetchFilePreview).toHaveBeenCalledTimes(1)})})@@ -645,7 +652,7 @@ describe('FilePreview', () => {renderFilePreview({ file })- expect(screen.getByText('document')).toBeInTheDocument()+ expect(screen.getByText('document'))!.toBeInTheDocument()})it('should handle filename with multiple dots', async () => {@@ -654,7 +661,8 @@ describe('FilePreview', () => {renderFilePreview({ file })// Assert - Should join all parts except last with comma- expect(screen.getByText('file,name,with,dots')).toBeInTheDocument()+ // Assert - Should join all parts except last with comma+ expect(screen.getByText('file,name,with,dots'))!.toBeInTheDocument()})it('should return empty for filename without dot', async () => {@@ -673,7 +681,7 @@ describe('FilePreview', () => {// Assert - File name area should have empty first spanconst fileNameElement = container.querySelector('.system-xs-medium')- expect(fileNameElement).toBeInTheDocument()+ expect(fileNameElement)!.toBeInTheDocument()})})@@ -682,14 +690,14 @@ describe('FilePreview', () => {const { container } = renderFilePreview()const closeButton = container.querySelector('.cursor-pointer')- expect(closeButton).toBeInTheDocument()- expect(closeButton).toHaveClass('cursor-pointer')+ expect(closeButton)!.toBeInTheDocument()+ expect(closeButton)!.toHaveClass('cursor-pointer')})it('should have proper heading structure', async () => {renderFilePreview()- expect(screen.getByText('datasetCreation.stepOne.filePreview')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepOne.filePreview'))!.toBeInTheDocument()})})@@ -702,7 +710,7 @@ describe('FilePreview', () => {// Assert - Component should still renderawait waitFor(() => {- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})})@@ -712,7 +720,7 @@ describe('FilePreview', () => {const { container } = renderFilePreview()await waitFor(() => {- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})})@@ -722,7 +730,7 @@ describe('FilePreview', () => {const { container } = renderFilePreview()await waitFor(() => {- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})})})diff --git a/web/app/components/datasets/create/file-uploader/hooks/__tests__/use-file-upload.spec.tsx b/web/app/components/datasets/create/file-uploader/hooks/__tests__/use-file-upload.spec.tsxindex d47053fb806..bde599320c3 100644--- a/web/app/components/datasets/create/file-uploader/hooks/__tests__/use-file-upload.spec.tsx+++ b/web/app/components/datasets/create/file-uploader/hooks/__tests__/use-file-upload.spec.tsx@@ -294,7 +294,7 @@ describe('useFileUpload', () => {// Should be called with at most batch_count_limit filesif (prepareFileList.mock.calls.length > 0) {- const calledFiles = prepareFileList.mock.calls[0][0]+ const calledFiles = prepareFileList.mock.calls[0]![0]expect(calledFiles.length).toBeLessThanOrEqual(mockFileUploadConfig.batch_count_limit)}})@@ -413,7 +413,7 @@ describe('useFileUpload', () => {dropzone.dispatchEvent(dragOverEvent)})- expect(dropzone).toBeInTheDocument()+ expect(dropzone)!.toBeInTheDocument()})it('should set dragging false on dragleave from drag overlay', async () => {@@ -532,7 +532,7 @@ describe('useFileUpload', () => {await waitFor(() => {if (prepareFileList.mock.calls.length > 0) {- const calledFiles = prepareFileList.mock.calls[0][0]+ const calledFiles = prepareFileList.mock.calls[0]![0]expect(calledFiles.length).toBe(1)}})@@ -900,7 +900,7 @@ describe('useFileUpload', () => {await waitFor(() => {if (prepareFileList.mock.calls.length > 0) {- const files = prepareFileList.mock.calls[0][0]+ const files = prepareFileList.mock.calls[0]![0]expect(files[0].progress).toBe(PROGRESS_NOT_STARTED)}})diff --git a/web/app/components/datasets/create/index.tsx b/web/app/components/datasets/create/index.tsxindex a028bc07756..717582444a6 100644--- a/web/app/components/datasets/create/index.tsx+++ b/web/app/components/datasets/create/index.tsx@@ -76,7 +76,7 @@ const DatasetUpdateForm = ({ datasetId }: DatasetUpdateFormProps) => {const targetIndex = list.findIndex(file => file.fileID === fileItem.fileID)const newList = produce(list, (draft) => {draft[targetIndex] = {- ...draft[targetIndex],+ ...draft[targetIndex]!,progress,}})diff --git a/web/app/components/datasets/create/step-two/__tests__/index.spec.tsx b/web/app/components/datasets/create/step-two/__tests__/index.spec.tsxindex 86e8ec2ab51..a5318430be3 100644--- a/web/app/components/datasets/create/step-two/__tests__/index.spec.tsx+++ b/web/app/components/datasets/create/step-two/__tests__/index.spec.tsx@@ -1717,22 +1717,23 @@ describe('StepTwoFooter', () => {render(<StepTwoFooter {...defaultProps} />)// Should render Previous and Next buttons with correct text- expect(screen.getByText(/previousStep/i)).toBeInTheDocument()- expect(screen.getByText(/nextStep/i)).toBeInTheDocument()+ // Should render Previous and Next buttons with correct text+ expect(screen.getByText(/previousStep/i))!.toBeInTheDocument()+ expect(screen.getByText(/nextStep/i))!.toBeInTheDocument()})it('should render Previous and Next buttons when not in setting mode', () => {render(<StepTwoFooter {...defaultProps} />)- expect(screen.getByText(/previousStep/i)).toBeInTheDocument()- expect(screen.getByText(/nextStep/i)).toBeInTheDocument()+ expect(screen.getByText(/previousStep/i))!.toBeInTheDocument()+ expect(screen.getByText(/nextStep/i))!.toBeInTheDocument()})it('should render Save and Cancel buttons when in setting mode', () => {render(<StepTwoFooter {...defaultProps} isSetting={true} />)- expect(screen.getByText(/save/i)).toBeInTheDocument()- expect(screen.getByText(/cancel/i)).toBeInTheDocument()+ expect(screen.getByText(/save/i))!.toBeInTheDocument()+ expect(screen.getByText(/cancel/i))!.toBeInTheDocument()})})@@ -1772,14 +1773,14 @@ describe('StepTwoFooter', () => {render(<StepTwoFooter {...defaultProps} isCreating={true} />)const nextButton = screen.getByText(/nextStep/i).closest('button')- expect(nextButton).toBeDisabled()+ expect(nextButton)!.toBeDisabled()})it('should show loading state on Save button when creating in setting mode', () => {render(<StepTwoFooter {...defaultProps} isSetting={true} isCreating={true} />)const saveButton = screen.getByText(/save/i).closest('button')- expect(saveButton).toBeDisabled()+ expect(saveButton)!.toBeDisabled()})})})@@ -1811,18 +1812,50 @@ describe('PreviewPanel', () => {render(<PreviewPanel {...defaultProps} />)// Check for the preview header title text- expect(screen.getByText('datasetCreation.stepTwo.preview')).toBeInTheDocument()+ // Check for the preview header title text+ expect(screen.getByText('datasetCreation.stepTwo.preview'))!.toBeInTheDocument()})it('should render idle state when isIdle is true', () => {render(<PreviewPanel {...defaultProps} isIdle={true} />)- expect(screen.getByText(/previewChunkTip/i)).toBeInTheDocument()+ expect(screen.getByText(/previewChunkTip/i))!.toBeInTheDocument()})it('should render loading skeleton when isPending is true', () => {render(<PreviewPanel {...defaultProps} isIdle={false} isPending={true} />)+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers+ // Should show skeleton containers// Should show skeleton containersexpect(screen.queryByText(/previewChunkTip/i)).not.toBeInTheDocument()})@@ -1841,7 +1874,7 @@ describe('PreviewPanel', () => {/>,)- expect(screen.getByText('Chunk 1 content')).toBeInTheDocument()+ expect(screen.getByText('Chunk 1 content'))!.toBeInTheDocument()})it('should render QA preview when docForm is qa', () => {@@ -1855,8 +1888,8 @@ describe('PreviewPanel', () => {/>,)- expect(screen.getByText('Q1')).toBeInTheDocument()- expect(screen.getByText('A1')).toBeInTheDocument()+ expect(screen.getByText('Q1'))!.toBeInTheDocument()+ expect(screen.getByText('A1'))!.toBeInTheDocument()})it('should show chunk count badge for non-QA doc form', () => {@@ -1870,7 +1903,7 @@ describe('PreviewPanel', () => {/>,)- expect(screen.getByText(/25/)).toBeInTheDocument()+ expect(screen.getByText(/25/))!.toBeInTheDocument()})it('should render parent-child preview when docForm is parentChild', () => {@@ -1893,11 +1926,13 @@ describe('PreviewPanel', () => {)// Should render parent chunk label- expect(screen.getByText('Chunk-1')).toBeInTheDocument()+ // Should render parent chunk label+ expect(screen.getByText('Chunk-1'))!.toBeInTheDocument()+ // Should render child chunks// Should render child chunks- expect(screen.getByText('Child 1')).toBeInTheDocument()- expect(screen.getByText('Child 2')).toBeInTheDocument()- expect(screen.getByText('Child 3')).toBeInTheDocument()+ expect(screen.getByText('Child 1'))!.toBeInTheDocument()+ expect(screen.getByText('Child 2'))!.toBeInTheDocument()+ expect(screen.getByText('Child 3'))!.toBeInTheDocument()})it('should limit child chunks when chunkForContext is full-doc', () => {@@ -1920,10 +1955,43 @@ describe('PreviewPanel', () => {)// Should render parent chunk- expect(screen.getByText('Chunk-1')).toBeInTheDocument()+ // Should render parent chunk+ expect(screen.getByText('Chunk-1'))!.toBeInTheDocument()+ // full-doc mode limits to FULL_DOC_PREVIEW_LENGTH (50)// full-doc mode limits to FULL_DOC_PREVIEW_LENGTH (50)- expect(screen.getByText('ChildChunk1')).toBeInTheDocument()- expect(screen.getByText('ChildChunk50')).toBeInTheDocument()+ expect(screen.getByText('ChildChunk1'))!.toBeInTheDocument()+ expect(screen.getByText('ChildChunk50'))!.toBeInTheDocument()+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit+ // Should not render beyond the limit// Should not render beyond the limitexpect(screen.queryByText('ChildChunk51')).not.toBeInTheDocument()})@@ -1944,10 +2012,10 @@ describe('PreviewPanel', () => {/>,)- expect(screen.getByText('Chunk-1')).toBeInTheDocument()- expect(screen.getByText('Chunk-2')).toBeInTheDocument()- expect(screen.getByText('P1-C1')).toBeInTheDocument()- expect(screen.getByText('P2-C1')).toBeInTheDocument()+ expect(screen.getByText('Chunk-1'))!.toBeInTheDocument()+ expect(screen.getByText('Chunk-2'))!.toBeInTheDocument()+ expect(screen.getByText('P1-C1'))!.toBeInTheDocument()+ expect(screen.getByText('P2-C1'))!.toBeInTheDocument()})})@@ -2222,19 +2290,20 @@ describe('StepTwo Component', () => {describe('Rendering', () => {it('should render without crashing', () => {render(<StepTwo {...defaultStepTwoProps} />)- expect(screen.getByText(/stepTwo\.segmentation/i)).toBeInTheDocument()+ expect(screen.getByText(/stepTwo\.segmentation/i))!.toBeInTheDocument()})it('should show general chunking options when not in upload', () => {render(<StepTwo {...defaultStepTwoProps} />)// Should render the segmentation section- expect(screen.getByText(/stepTwo\.segmentation/i)).toBeInTheDocument()+ // Should render the segmentation section+ expect(screen.getByText(/stepTwo\.segmentation/i))!.toBeInTheDocument()})it('should show footer with Previous and Next buttons', () => {render(<StepTwo {...defaultStepTwoProps} />)- expect(screen.getByText(/stepTwo\.previousStep/i)).toBeInTheDocument()- expect(screen.getByText(/stepTwo\.nextStep/i)).toBeInTheDocument()+ expect(screen.getByText(/stepTwo\.previousStep/i))!.toBeInTheDocument()+ expect(screen.getByText(/stepTwo\.nextStep/i))!.toBeInTheDocument()})})@@ -2282,7 +2351,7 @@ describe('StepTwo Component', () => {render(<StepTwo {...defaultStepTwoProps} />)// GeneralChunkingOptions renders a "Preview Chunk" buttonconst previewButtons = screen.getAllByText(/stepTwo\.previewChunk/i)- fireEvent.click(previewButtons[0])+ fireEvent.click(previewButtons[0]!)// updatePreview calls estimateHook.fetchEstimate()// No error means the handler executed successfully})@@ -2292,7 +2361,7 @@ describe('StepTwo Component', () => {// ParentChildOptions renders an OptionCard; find the title element and click its parent cardconst parentChildTitles = screen.getAllByText(/stepTwo\.parentChild/i)// The first match is the title; click it to trigger onDocFormChange- fireEvent.click(parentChildTitles[0])+ fireEvent.click(parentChildTitles[0]!)// handleDocFormChange sets docForm, segmentationType, and resets estimate})})@@ -2307,7 +2376,8 @@ describe('StepTwo Component', () => {/>,)// When currentDataset has parentChild doc_form, should show parent-child option- expect(screen.getByText(/stepTwo\.segmentation/i)).toBeInTheDocument()+ // When currentDataset has parentChild doc_form, should show parent-child option+ expect(screen.getByText(/stepTwo\.segmentation/i))!.toBeInTheDocument()})it('should render setting mode with Save/Cancel buttons', () => {@@ -2320,8 +2390,8 @@ describe('StepTwo Component', () => {datasetId="test-id"/>,)- expect(screen.getByText(/stepTwo\.save/i)).toBeInTheDocument()- expect(screen.getByText(/stepTwo\.cancel/i)).toBeInTheDocument()+ expect(screen.getByText(/stepTwo\.save/i))!.toBeInTheDocument()+ expect(screen.getByText(/stepTwo\.cancel/i))!.toBeInTheDocument()})it('should call onCancel when Cancel button is clicked in setting mode', () => {@@ -2362,8 +2432,9 @@ describe('StepTwo Component', () => {it('should show both general and parent-child options in create page', () => {render(<StepTwo {...defaultStepTwoProps} />)// When isInInit (no datasetId, no isSetting), both options should show- expect(screen.getByText('datasetCreation.stepTwo.general')).toBeInTheDocument()- expect(screen.getByText('datasetCreation.stepTwo.parentChild')).toBeInTheDocument()+ // When isInInit (no datasetId, no isSetting), both options should show+ expect(screen.getByText('datasetCreation.stepTwo.general'))!.toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepTwo.parentChild'))!.toBeInTheDocument()})it('should only show parent-child option when dataset has parentChild doc_form', () => {@@ -2376,7 +2447,9 @@ describe('StepTwo Component', () => {)// showGeneralOption should be false (parentChild not in [text, qa])// showParentChildOption should be true- expect(screen.getByText('datasetCreation.stepTwo.parentChild')).toBeInTheDocument()+ // showGeneralOption should be false (parentChild not in [text, qa])+ // showParentChildOption should be true+ expect(screen.getByText('datasetCreation.stepTwo.parentChild'))!.toBeInTheDocument()})it('should show general option only when dataset has text doc_form', () => {@@ -2388,7 +2461,8 @@ describe('StepTwo Component', () => {/>,)// showGeneralOption should be true (text is in [text, qa])- expect(screen.getByText('datasetCreation.stepTwo.general')).toBeInTheDocument()+ // showGeneralOption should be true (text is in [text, qa])+ expect(screen.getByText('datasetCreation.stepTwo.general'))!.toBeInTheDocument()})})@@ -2401,7 +2475,7 @@ describe('StepTwo Component', () => {datasetId="test-id"/>,)- expect(screen.getByText(/stepTwo\.segmentation/i)).toBeInTheDocument()+ expect(screen.getByText(/stepTwo\.segmentation/i))!.toBeInTheDocument()})it('should show general option for empty dataset (no doc_form)', () => {@@ -2413,7 +2487,7 @@ describe('StepTwo Component', () => {datasetId="test-id"/>,)- expect(screen.getByText(/stepTwo\.segmentation/i)).toBeInTheDocument()+ expect(screen.getByText(/stepTwo\.segmentation/i))!.toBeInTheDocument()})it('should show both options in empty dataset upload', () => {@@ -2426,8 +2500,9 @@ describe('StepTwo Component', () => {/>,)// isUploadInEmptyDataset=true shows both options- expect(screen.getByText('datasetCreation.stepTwo.general')).toBeInTheDocument()- expect(screen.getByText('datasetCreation.stepTwo.parentChild')).toBeInTheDocument()+ // isUploadInEmptyDataset=true shows both options+ expect(screen.getByText('datasetCreation.stepTwo.general'))!.toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepTwo.parentChild'))!.toBeInTheDocument()})})@@ -2435,19 +2510,22 @@ describe('StepTwo Component', () => {it('should render indexing mode section', () => {render(<StepTwo {...defaultStepTwoProps} />)// IndexingModeSection renders the index mode title- expect(screen.getByText(/stepTwo\.indexMode/i)).toBeInTheDocument()+ // IndexingModeSection renders the index mode title+ expect(screen.getByText(/stepTwo\.indexMode/i))!.toBeInTheDocument()})it('should render embedding model selector when QUALIFIED', () => {render(<StepTwo {...defaultStepTwoProps} />)// ModelSelector is mocked and rendered with data-testid- expect(screen.getByTestId('model-selector')).toBeInTheDocument()+ // ModelSelector is mocked and rendered with data-testid+ expect(screen.getByTestId('model-selector'))!.toBeInTheDocument()})it('should render retrieval method config', () => {render(<StepTwo {...defaultStepTwoProps} />)// RetrievalMethodConfig is mocked with data-testid- expect(screen.getByTestId('retrieval-method-config')).toBeInTheDocument()+ // RetrievalMethodConfig is mocked with data-testid+ expect(screen.getByTestId('retrieval-method-config'))!.toBeInTheDocument()})it('should disable model and retrieval config when datasetId has existing data source', () => {@@ -2460,14 +2538,14 @@ describe('StepTwo Component', () => {)// isModelAndRetrievalConfigDisabled should be trueconst modelSelector = screen.getByTestId('model-selector')- expect(modelSelector).toHaveAttribute('data-readonly', 'true')+ expect(modelSelector)!.toHaveAttribute('data-readonly', 'true')})})describe('Preview Panel', () => {it('should render preview panel', () => {render(<StepTwo {...defaultStepTwoProps} />)- expect(screen.getByText('datasetCreation.stepTwo.preview')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepTwo.preview'))!.toBeInTheDocument()})it('should hide document picker in setting mode', () => {@@ -2481,7 +2559,8 @@ describe('StepTwo Component', () => {/>,)// Preview panel should still render- expect(screen.getByText('datasetCreation.stepTwo.preview')).toBeInTheDocument()+ // Preview panel should still render+ expect(screen.getByText('datasetCreation.stepTwo.preview'))!.toBeInTheDocument()})})@@ -2498,35 +2577,35 @@ describe('StepTwo Component', () => {it('should switch to QUALIFIED when selecting parentChild in ECONOMICAL mode', async () => {render(<StepTwo {...defaultStepTwoProps} isAPIKeySet={false} />)await vi.waitFor(() => {- expect(screen.getByText(/stepTwo\.segmentation/i)).toBeInTheDocument()+ expect(screen.getByText(/stepTwo\.segmentation/i))!.toBeInTheDocument()})const parentChildTitles = screen.getAllByText(/stepTwo\.parentChild/i)- fireEvent.click(parentChildTitles[0])+ fireEvent.click(parentChildTitles[0]!)})it('should open QA confirm dialog and confirm switch when QA selected in ECONOMICAL mode', async () => {render(<StepTwo {...defaultStepTwoProps} isAPIKeySet={false} />)await vi.waitFor(() => {- expect(screen.getByText(/stepTwo\.segmentation/i)).toBeInTheDocument()+ expect(screen.getByText(/stepTwo\.segmentation/i))!.toBeInTheDocument()})const qaCheckbox = screen.getByText(/stepTwo\.useQALanguage/i)fireEvent.click(qaCheckbox)// Dialog should open → click Switch to confirm (triggers handleQAConfirm)const switchButton = await screen.findByText(/stepTwo\.switch/i)- expect(switchButton).toBeInTheDocument()+ expect(switchButton)!.toBeInTheDocument()fireEvent.click(switchButton)})it('should close QA confirm dialog when cancel is clicked', async () => {render(<StepTwo {...defaultStepTwoProps} isAPIKeySet={false} />)await vi.waitFor(() => {- expect(screen.getByText(/stepTwo\.segmentation/i)).toBeInTheDocument()+ expect(screen.getByText(/stepTwo\.segmentation/i))!.toBeInTheDocument()})// Open QA confirm dialogconst qaCheckbox = screen.getByText(/stepTwo\.useQALanguage/i)fireEvent.click(qaCheckbox)const dialogCancelButtons = await screen.findAllByText(/stepTwo\.cancel/i)- fireEvent.click(dialogCancelButtons[0])+ fireEvent.click(dialogCancelButtons[0]!)})it('should handle picker change when selecting a different file', () => {@@ -2545,7 +2624,7 @@ describe('StepTwo Component', () => {render(<StepTwo {...defaultStepTwoProps} />)// The default maxChunkLength (1024) now exceeds the limit (100)const previewButtons = screen.getAllByText(/stepTwo\.previewChunk/i)- fireEvent.click(previewButtons[0])+ fireEvent.click(previewButtons[0]!)// Restoredocument.body.removeAttribute('data-public-indexing-max-segmentation-tokens-length')})diff --git a/web/app/components/datasets/create/step-two/components/__tests__/indexing-mode-section.spec.tsx b/web/app/components/datasets/create/step-two/components/__tests__/indexing-mode-section.spec.tsxindex e46ff6d484d..64011c1ebe6 100644--- a/web/app/components/datasets/create/step-two/components/__tests__/indexing-mode-section.spec.tsx+++ b/web/app/components/datasets/create/step-two/components/__tests__/indexing-mode-section.spec.tsx@@ -81,28 +81,28 @@ describe('IndexingModeSection', () => {describe('Rendering', () => {it('should render index mode title', () => {render(<IndexingModeSection {...defaultProps} />)- expect(screen.getByText(`${ns}.stepTwo.indexMode`)).toBeInTheDocument()+ expect(screen.getByText(`${ns}.stepTwo.indexMode`))!.toBeInTheDocument()})it('should render qualified option when not locked to economical', () => {render(<IndexingModeSection {...defaultProps} />)- expect(screen.getByText(`${ns}.stepTwo.qualified`)).toBeInTheDocument()+ expect(screen.getByText(`${ns}.stepTwo.qualified`))!.toBeInTheDocument()})it('should render economical option when not locked to qualified', () => {render(<IndexingModeSection {...defaultProps} />)- expect(screen.getByText(`${ns}.stepTwo.economical`)).toBeInTheDocument()+ expect(screen.getByText(`${ns}.stepTwo.economical`))!.toBeInTheDocument()})it('should only show qualified option when hasSetIndexType and type is qualified', () => {render(<IndexingModeSection {...defaultProps} hasSetIndexType indexType={IndexingType.QUALIFIED} />)- expect(screen.getByText(`${ns}.stepTwo.qualified`)).toBeInTheDocument()+ expect(screen.getByText(`${ns}.stepTwo.qualified`))!.toBeInTheDocument()expect(screen.queryByText(`${ns}.stepTwo.economical`)).not.toBeInTheDocument()})it('should only show economical option when hasSetIndexType and type is economical', () => {render(<IndexingModeSection {...defaultProps} hasSetIndexType indexType={IndexingType.ECONOMICAL} />)- expect(screen.getByText(`${ns}.stepTwo.economical`)).toBeInTheDocument()+ expect(screen.getByText(`${ns}.stepTwo.economical`))!.toBeInTheDocument()expect(screen.queryByText(`${ns}.stepTwo.qualified`)).not.toBeInTheDocument()})})@@ -110,7 +110,7 @@ describe('IndexingModeSection', () => {describe('Embedding Model', () => {it('should show model selector when indexType is qualified', () => {render(<IndexingModeSection {...defaultProps} indexType={IndexingType.QUALIFIED} />)- expect(screen.getByTestId('model-selector')).toBeInTheDocument()+ expect(screen.getByTestId('model-selector'))!.toBeInTheDocument()})it('should not show model selector when indexType is economical', () => {@@ -120,7 +120,7 @@ describe('IndexingModeSection', () => {it('should mark model selector as readonly when disabled', () => {render(<IndexingModeSection {...defaultProps} isModelAndRetrievalConfigDisabled />)- expect(screen.getByTestId('model-selector')).toHaveAttribute('data-readonly', 'true')+ expect(screen.getByTestId('model-selector'))!.toHaveAttribute('data-readonly', 'true')})it('should call onEmbeddingModelChange when model selected', () => {@@ -134,12 +134,12 @@ describe('IndexingModeSection', () => {describe('Retrieval Config', () => {it('should show RetrievalMethodConfig when qualified', () => {render(<IndexingModeSection {...defaultProps} indexType={IndexingType.QUALIFIED} />)- expect(screen.getByTestId('retrieval-method-config')).toBeInTheDocument()+ expect(screen.getByTestId('retrieval-method-config'))!.toBeInTheDocument()})it('should show EconomicalRetrievalMethodConfig when economical', () => {render(<IndexingModeSection {...defaultProps} indexType={IndexingType.ECONOMICAL} />)- expect(screen.getByTestId('economical-retrieval-config')).toBeInTheDocument()+ expect(screen.getByTestId('economical-retrieval-config'))!.toBeInTheDocument()})it('should call onRetrievalConfigChange from qualified config', () => {@@ -164,14 +164,14 @@ describe('IndexingModeSection', () => {// The economical option card should have disabled stylingconst economicalText = screen.getByText(`${ns}.stepTwo.economical`)const card = economicalText.closest('[class*="rounded-xl"]')- expect(card).toHaveClass('pointer-events-none')+ expect(card)!.toHaveClass('pointer-events-none')})})describe('High Quality Tip', () => {it('should show high quality tip when qualified is selected and not locked', () => {render(<IndexingModeSection {...defaultProps} indexType={IndexingType.QUALIFIED} hasSetIndexType={false} />)- expect(screen.getByText(`${ns}.stepTwo.highQualityTip`)).toBeInTheDocument()+ expect(screen.getByText(`${ns}.stepTwo.highQualityTip`))!.toBeInTheDocument()})it('should not show high quality tip when index type is locked', () => {@@ -185,7 +185,7 @@ describe('IndexingModeSection', () => {const onClose = vi.fn()render(<IndexingModeSection {...defaultProps} isQAConfirmDialogOpen onQAConfirmDialogClose={onClose} />)const cancelBtns = screen.getAllByText(`${ns}.stepTwo.cancel`)- fireEvent.click(cancelBtns[0])+ fireEvent.click(cancelBtns[0]!)expect(onClose).toHaveBeenCalled()})@@ -200,8 +200,8 @@ describe('IndexingModeSection', () => {describe('Dataset Settings Link', () => {it('should show settings link when economical and hasSetIndexType', () => {render(<IndexingModeSection {...defaultProps} hasSetIndexType indexType={IndexingType.ECONOMICAL} datasetId="ds-123" />)- expect(screen.getByText(`${ns}.stepTwo.datasetSettingLink`)).toBeInTheDocument()- expect(screen.getByText(`${ns}.stepTwo.datasetSettingLink`).closest('a')).toHaveAttribute('href', '/datasets/ds-123/settings')+ expect(screen.getByText(`${ns}.stepTwo.datasetSettingLink`))!.toBeInTheDocument()+ expect(screen.getByText(`${ns}.stepTwo.datasetSettingLink`).closest('a'))!.toHaveAttribute('href', '/datasets/ds-123/settings')})it('should show settings link under model selector when disabled', () => {diff --git a/web/app/components/datasets/create/step-two/components/__tests__/inputs.spec.tsx b/web/app/components/datasets/create/step-two/components/__tests__/inputs.spec.tsxindex 2c0480e508e..f1ab5392ce6 100644--- a/web/app/components/datasets/create/step-two/components/__tests__/inputs.spec.tsx+++ b/web/app/components/datasets/create/step-two/components/__tests__/inputs.spec.tsx@@ -12,26 +12,27 @@ describe('DelimiterInput', () => {it('should render separator label', () => {render(<DelimiterInput />)- expect(screen.getByText(`${ns}.stepTwo.separator`)).toBeInTheDocument()+ expect(screen.getByText(`${ns}.stepTwo.separator`))!.toBeInTheDocument()})it('should render text input with placeholder', () => {render(<DelimiterInput />)const input = screen.getByPlaceholderText(`${ns}.stepTwo.separatorPlaceholder`)- expect(input).toBeInTheDocument()- expect(input).toHaveAttribute('type', 'text')+ expect(input)!.toBeInTheDocument()+ expect(input)!.toHaveAttribute('type', 'text')})it('should pass through value and onChange props', () => {const onChange = vi.fn()render(<DelimiterInput value="test-val" onChange={onChange} />)- expect(screen.getByDisplayValue('test-val')).toBeInTheDocument()+ expect(screen.getByDisplayValue('test-val'))!.toBeInTheDocument()})it('should render tooltip content', () => {render(<DelimiterInput />)// Tooltip triggers render; component mounts without error- expect(screen.getByText(`${ns}.stepTwo.separator`)).toBeInTheDocument()+ // Tooltip triggers render; component mounts without error+ expect(screen.getByText(`${ns}.stepTwo.separator`))!.toBeInTheDocument()})it('should suppress onChange during IME composition', () => {@@ -47,7 +48,7 @@ describe('DelimiterInput', () => {fireEvent.compositionEnd(input)expect(onChange).toHaveBeenCalledTimes(1)- expect(onChange.mock.calls[0][0].target.value).toBe(finalValue)+ expect(onChange.mock.calls[0]![0].target.value).toBe(finalValue)})})@@ -58,24 +59,24 @@ describe('MaxLengthInput', () => {it('should render max length label', () => {render(<MaxLengthInput onChange={vi.fn()} />)- expect(screen.getByText(`${ns}.stepTwo.maxLength`)).toBeInTheDocument()+ expect(screen.getByText(`${ns}.stepTwo.maxLength`))!.toBeInTheDocument()})it('should render number input', () => {render(<MaxLengthInput onChange={vi.fn()} />)const input = screen.getByRole('textbox')- expect(input).toBeInTheDocument()+ expect(input)!.toBeInTheDocument()})it('should accept value prop', () => {render(<MaxLengthInput value={500} onChange={vi.fn()} />)- expect(screen.getByRole('textbox')).toHaveValue('500')+ expect(screen.getByRole('textbox'))!.toHaveValue('500')})it('should have min of 1', () => {render(<MaxLengthInput onChange={vi.fn()} />)const input = screen.getByRole('textbox')- expect(input).toBeInTheDocument()+ expect(input)!.toBeInTheDocument()})it('should reset to the minimum when users clear the value', () => {@@ -107,18 +108,18 @@ describe('OverlapInput', () => {it('should render number input', () => {render(<OverlapInput onChange={vi.fn()} />)const input = screen.getByRole('textbox')- expect(input).toBeInTheDocument()+ expect(input)!.toBeInTheDocument()})it('should accept value prop', () => {render(<OverlapInput value={50} onChange={vi.fn()} />)- expect(screen.getByRole('textbox')).toHaveValue('50')+ expect(screen.getByRole('textbox'))!.toHaveValue('50')})it('should have min of 1', () => {render(<OverlapInput onChange={vi.fn()} />)const input = screen.getByRole('textbox')- expect(input).toBeInTheDocument()+ expect(input)!.toBeInTheDocument()})it('should reset to the minimum when users clear the value', () => {diff --git a/web/app/components/datasets/create/step-two/hooks/__tests__/use-segmentation-state.spec.ts b/web/app/components/datasets/create/step-two/hooks/__tests__/use-segmentation-state.spec.tsindex bdf0de31e44..c80c54bf96f 100644--- a/web/app/components/datasets/create/step-two/hooks/__tests__/use-segmentation-state.spec.ts+++ b/web/app/components/datasets/create/step-two/hooks/__tests__/use-segmentation-state.spec.ts@@ -133,8 +133,8 @@ describe('useSegmentationState', () => {result.current.toggleRule('remove_extra_spaces')})- expect(result.current.rules[0].enabled).toBe(false)- expect(result.current.rules[1].enabled).toBe(false)+ expect(result.current.rules[0]!.enabled).toBe(false)+ expect(result.current.rules[1]!.enabled).toBe(false)})it('should toggle second rule without affecting first', () => {@@ -151,8 +151,8 @@ describe('useSegmentationState', () => {result.current.toggleRule('remove_urls_emails')})- expect(result.current.rules[0].enabled).toBe(true)- expect(result.current.rules[1].enabled).toBe(true)+ expect(result.current.rules[0]!.enabled).toBe(true)+ expect(result.current.rules[1]!.enabled).toBe(true)})})diff --git a/web/app/components/datasets/create/step-two/hooks/unescape.ts b/web/app/components/datasets/create/step-two/hooks/unescape.tsindex fae3e96ee26..b12cfb25cd8 100644--- a/web/app/components/datasets/create/step-two/hooks/unescape.ts+++ b/web/app/components/datasets/create/step-two/hooks/unescape.ts@@ -47,7 +47,7 @@ const unescape = (str: string) => {else if (python !== undefined)return fromHex(python)else- return usualEscapeSequences[specialCharacter]+ return usualEscapeSequences[specialCharacter]!})}diff --git a/web/app/components/datasets/create/stop-embedding-modal/__tests__/index.spec.tsx b/web/app/components/datasets/create/stop-embedding-modal/__tests__/index.spec.tsxindex 5dc30be00fc..1b3abfeadc5 100644--- a/web/app/components/datasets/create/stop-embedding-modal/__tests__/index.spec.tsx+++ b/web/app/components/datasets/create/stop-embedding-modal/__tests__/index.spec.tsx@@ -49,31 +49,31 @@ describe('StopEmbeddingModal', () => {it('should render without crashing when show is true', () => {renderStopEmbeddingModal({ show: true })- expect(screen.getByText('datasetCreation.stepThree.modelTitle')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepThree.modelTitle'))!.toBeInTheDocument()})it('should render modal title', () => {renderStopEmbeddingModal({ show: true })- expect(screen.getByText('datasetCreation.stepThree.modelTitle')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepThree.modelTitle'))!.toBeInTheDocument()})it('should render modal content', () => {renderStopEmbeddingModal({ show: true })- expect(screen.getByText('datasetCreation.stepThree.modelContent')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepThree.modelContent'))!.toBeInTheDocument()})it('should render confirm button with correct text', () => {renderStopEmbeddingModal({ show: true })- expect(screen.getByText('datasetCreation.stepThree.modelButtonConfirm')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepThree.modelButtonConfirm'))!.toBeInTheDocument()})it('should render cancel button with correct text', () => {renderStopEmbeddingModal({ show: true })- expect(screen.getByText('datasetCreation.stepThree.modelButtonCancel')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepThree.modelButtonCancel'))!.toBeInTheDocument()})it('should not render modal content when show is false', () => {@@ -94,24 +94,25 @@ describe('StopEmbeddingModal', () => {renderStopEmbeddingModal({ show: true })const confirmButton = screen.getByText('datasetCreation.stepThree.modelButtonConfirm')- expect(confirmButton).toHaveClass('ml-2', 'w-24')+ expect(confirmButton)!.toHaveClass('ml-2', 'w-24')})it('should render cancel button with default styling', () => {renderStopEmbeddingModal({ show: true })const cancelButton = screen.getByText('datasetCreation.stepThree.modelButtonCancel')- expect(cancelButton).toHaveClass('w-24')+ expect(cancelButton)!.toHaveClass('w-24')})it('should render all modal elements', () => {renderStopEmbeddingModal({ show: true })// Assert - Modal should contain title, content, and buttons- expect(screen.getByText('datasetCreation.stepThree.modelTitle')).toBeInTheDocument()- expect(screen.getByText('datasetCreation.stepThree.modelContent')).toBeInTheDocument()- expect(screen.getByText('datasetCreation.stepThree.modelButtonConfirm')).toBeInTheDocument()- expect(screen.getByText('datasetCreation.stepThree.modelButtonCancel')).toBeInTheDocument()+ // Assert - Modal should contain title, content, and buttons+ expect(screen.getByText('datasetCreation.stepThree.modelTitle'))!.toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepThree.modelContent'))!.toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepThree.modelButtonConfirm'))!.toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepThree.modelButtonCancel'))!.toBeInTheDocument()})})@@ -121,7 +122,7 @@ describe('StopEmbeddingModal', () => {it('should show modal when show is true', () => {renderStopEmbeddingModal({ show: true })- expect(screen.getByText('datasetCreation.stepThree.modelTitle')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepThree.modelTitle'))!.toBeInTheDocument()})it('should hide modal when show is false', () => {@@ -155,7 +156,7 @@ describe('StopEmbeddingModal', () => {// Assert - Modal should be visibleawait waitFor(() => {- expect(screen.getByText('datasetCreation.stepThree.modelTitle')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepThree.modelTitle'))!.toBeInTheDocument()})})})@@ -167,7 +168,8 @@ describe('StopEmbeddingModal', () => {renderStopEmbeddingModal({ onConfirm })// Assert - No errors thrown- expect(screen.getByText('datasetCreation.stepThree.modelTitle')).toBeInTheDocument()+ // Assert - No errors thrown+ expect(screen.getByText('datasetCreation.stepThree.modelTitle'))!.toBeInTheDocument()})})@@ -178,7 +180,8 @@ describe('StopEmbeddingModal', () => {renderStopEmbeddingModal({ onHide })// Assert - No errors thrown- expect(screen.getByText('datasetCreation.stepThree.modelTitle')).toBeInTheDocument()+ // Assert - No errors thrown+ expect(screen.getByText('datasetCreation.stepThree.modelTitle'))!.toBeInTheDocument()})})})@@ -308,7 +311,8 @@ describe('StopEmbeddingModal', () => {}else {// If no close span found with class, just verify the modal renders- expect(screen.getByText('datasetCreation.stepThree.modelTitle')).toBeInTheDocument()+ // If no close span found with class, just verify the modal renders+ expect(screen.getByText('datasetCreation.stepThree.modelTitle'))!.toBeInTheDocument()}})@@ -431,8 +435,8 @@ describe('StopEmbeddingModal', () => {/>,)- expect(screen.getByText('datasetCreation.stepThree.modelTitle')).toBeInTheDocument()- expect(screen.getByText('datasetCreation.stepThree.modelContent')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepThree.modelTitle'))!.toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepThree.modelContent'))!.toBeInTheDocument()})})@@ -442,14 +446,14 @@ describe('StopEmbeddingModal', () => {renderStopEmbeddingModal({ show: true })const buttons = screen.getAllByRole('button')- expect(buttons[0].closest('div')).toHaveClass('flex', 'flex-row-reverse')+ expect(buttons[0]!.closest('div'))!.toHaveClass('flex', 'flex-row-reverse')})it('should render title and content elements', () => {renderStopEmbeddingModal({ show: true })- expect(screen.getByText('datasetCreation.stepThree.modelTitle')).toBeInTheDocument()- expect(screen.getByText('datasetCreation.stepThree.modelContent')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepThree.modelTitle'))!.toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepThree.modelContent'))!.toBeInTheDocument()})it('should render two buttons', () => {@@ -532,7 +536,8 @@ describe('StopEmbeddingModal', () => {)// Assert - Modal should be visible- expect(screen.getByText('datasetCreation.stepThree.modelTitle')).toBeInTheDocument()+ // Assert - Modal should be visible+ expect(screen.getByText('datasetCreation.stepThree.modelTitle'))!.toBeInTheDocument()// Act - Hide modalawait act(async () => {@@ -566,10 +571,10 @@ describe('StopEmbeddingModal', () => {it('should have accessible text content', () => {renderStopEmbeddingModal({ show: true })- expect(screen.getByText('datasetCreation.stepThree.modelTitle')).toBeVisible()- expect(screen.getByText('datasetCreation.stepThree.modelContent')).toBeVisible()- expect(screen.getByText('datasetCreation.stepThree.modelButtonConfirm')).toBeVisible()- expect(screen.getByText('datasetCreation.stepThree.modelButtonCancel')).toBeVisible()+ expect(screen.getByText('datasetCreation.stepThree.modelTitle'))!.toBeVisible()+ expect(screen.getByText('datasetCreation.stepThree.modelContent'))!.toBeVisible()+ expect(screen.getByText('datasetCreation.stepThree.modelButtonConfirm'))!.toBeVisible()+ expect(screen.getByText('datasetCreation.stepThree.modelButtonCancel'))!.toBeVisible()})})@@ -608,7 +613,8 @@ describe('StopEmbeddingModal', () => {)// Verify initial render- expect(screen.getByText('datasetCreation.stepThree.modelTitle')).toBeInTheDocument()+ // Verify initial render+ expect(screen.getByText('datasetCreation.stepThree.modelTitle'))!.toBeInTheDocument()// Update propsawait act(async () => {@@ -616,7 +622,8 @@ describe('StopEmbeddingModal', () => {})// Assert - Still renders correctly- expect(screen.getByText('datasetCreation.stepThree.modelTitle')).toBeInTheDocument()+ // Assert - Still renders correctly+ expect(screen.getByText('datasetCreation.stepThree.modelTitle'))!.toBeInTheDocument()})})})diff --git a/web/app/components/datasets/create/website/__tests__/base.spec.tsx b/web/app/components/datasets/create/website/__tests__/base.spec.tsxindex 980d1b83823..3a3954f305d 100644--- a/web/app/components/datasets/create/website/__tests__/base.spec.tsx+++ b/web/app/components/datasets/create/website/__tests__/base.spec.tsx@@ -33,8 +33,8 @@ describe('Input', () => {render(<Input {...props} />)const input = screen.getByRole('textbox')- expect(input).toBeInTheDocument()- expect(input).toHaveAttribute('type', 'text')+ expect(input)!.toBeInTheDocument()+ expect(input)!.toHaveAttribute('type', 'text')})it('should render number input when isNumber is true', () => {@@ -42,23 +42,23 @@ describe('Input', () => {render(<Input {...props} />)const input = screen.getByRole('spinbutton')- expect(input).toBeInTheDocument()- expect(input).toHaveAttribute('type', 'number')- expect(input).toHaveAttribute('min', '0')+ expect(input)!.toBeInTheDocument()+ expect(input)!.toHaveAttribute('type', 'number')+ expect(input)!.toHaveAttribute('min', '0')})it('should render with placeholder', () => {const props = createInputProps({ placeholder: 'Enter URL' })render(<Input {...props} />)- expect(screen.getByPlaceholderText('Enter URL')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('Enter URL'))!.toBeInTheDocument()})it('should render with initial value', () => {const props = createInputProps({ value: 'test value' })render(<Input {...props} />)- expect(screen.getByDisplayValue('test value')).toBeInTheDocument()+ expect(screen.getByDisplayValue('test value'))!.toBeInTheDocument()})})@@ -164,7 +164,7 @@ describe('Header', () => {const props = createHeaderProps()render(<Header {...props} />)- expect(screen.getByText('Test Title')).toBeInTheDocument()+ expect(screen.getByText('Test Title'))!.toBeInTheDocument()})it('should render doc link', () => {@@ -172,15 +172,15 @@ describe('Header', () => {render(<Header {...props} />)const link = screen.getByRole('link')- expect(link).toHaveAttribute('href', 'https://docs.example.com')- expect(link).toHaveAttribute('target', '_blank')+ expect(link)!.toHaveAttribute('href', 'https://docs.example.com')+ expect(link)!.toHaveAttribute('target', '_blank')})it('should render button text when not in pipeline', () => {const props = createHeaderProps({ buttonText: 'Configure' })render(<Header {...props} />)- expect(screen.getByText('Configure')).toBeInTheDocument()+ expect(screen.getByText('Configure'))!.toBeInTheDocument()})it('should not render button text when in pipeline', () => {@@ -197,7 +197,7 @@ describe('Header', () => {render(<Header {...props} />)const titleElement = screen.getByText('Test Title')- expect(titleElement).toHaveClass('system-sm-semibold')+ expect(titleElement)!.toHaveClass('system-sm-semibold')})it('should apply default styles when isInPipeline is false', () => {@@ -205,7 +205,7 @@ describe('Header', () => {render(<Header {...props} />)const titleElement = screen.getByText('Test Title')- expect(titleElement).toHaveClass('system-md-semibold')+ expect(titleElement)!.toHaveClass('system-md-semibold')})it('should apply compact button styles when isInPipeline is true', () => {@@ -213,8 +213,8 @@ describe('Header', () => {render(<Header {...props} />)const button = screen.getByRole('button')- expect(button).toHaveClass('size-6')- expect(button).toHaveClass('px-1')+ expect(button)!.toHaveClass('size-6')+ expect(button)!.toHaveClass('px-1')})it('should apply default button styles when isInPipeline is false', () => {@@ -222,8 +222,8 @@ describe('Header', () => {render(<Header {...props} />)const button = screen.getByRole('button')- expect(button).toHaveClass('gap-x-0.5')- expect(button).toHaveClass('px-1.5')+ expect(button)!.toHaveClass('gap-x-0.5')+ expect(button)!.toHaveClass('px-1.5')})})@@ -269,8 +269,8 @@ describe('CrawledResultItem', () => {})render(<CrawledResultItem {...props} />)- expect(screen.getByText('My Page')).toBeInTheDocument()- expect(screen.getByText('https://mysite.com')).toBeInTheDocument()+ expect(screen.getByText('My Page'))!.toBeInTheDocument()+ expect(screen.getByText('https://mysite.com'))!.toBeInTheDocument()})it('should render checkbox (custom Checkbox component)', () => {@@ -279,14 +279,14 @@ describe('CrawledResultItem', () => {// Find checkbox by data-testidconst checkbox = screen.getByTestId('checkbox-test-item')- expect(checkbox).toBeInTheDocument()+ expect(checkbox)!.toBeInTheDocument()})it('should render preview button', () => {const props = createItemProps()render(<CrawledResultItem {...props} />)- expect(screen.getByText('datasetCreation.stepOne.website.preview')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepOne.website.preview'))!.toBeInTheDocument()})})@@ -330,7 +330,7 @@ describe('CrawledResultItem', () => {const { container } = render(<CrawledResultItem {...props} />)const wrapper = container.firstChild- expect(wrapper).toHaveClass('bg-state-base-active')+ expect(wrapper)!.toHaveClass('bg-state-base-active')})it('should not apply active style when isPreview is false', () => {@@ -374,9 +374,9 @@ describe('CrawledResult', () => {const props = createResultProps()render(<CrawledResult {...props} />)- expect(screen.getByText('Page 1')).toBeInTheDocument()- expect(screen.getByText('Page 2')).toBeInTheDocument()- expect(screen.getByText('Page 3')).toBeInTheDocument()+ expect(screen.getByText('Page 1'))!.toBeInTheDocument()+ expect(screen.getByText('Page 2'))!.toBeInTheDocument()+ expect(screen.getByText('Page 3'))!.toBeInTheDocument()})it('should render time info', () => {@@ -384,14 +384,15 @@ describe('CrawledResult', () => {render(<CrawledResult {...props} />)// The component uses i18n, so we check for the key pattern- expect(screen.getByText(/scrapTimeInfo/)).toBeInTheDocument()+ // The component uses i18n, so we check for the key pattern+ expect(screen.getByText(/scrapTimeInfo/))!.toBeInTheDocument()})it('should render select all checkbox', () => {const props = createResultProps()render(<CrawledResult {...props} />)- expect(screen.getByText('datasetCreation.stepOne.website.selectAll')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepOne.website.selectAll'))!.toBeInTheDocument()})it('should render reset all when all items are checked', () => {@@ -402,7 +403,7 @@ describe('CrawledResult', () => {const props = createResultProps({ list, checkedList: list })render(<CrawledResult {...props} />)- expect(screen.getByText('datasetCreation.stepOne.website.resetAll')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepOne.website.resetAll'))!.toBeInTheDocument()})})@@ -457,7 +458,7 @@ describe('CrawledResult', () => {createCrawlResultItem({ source_url: 'https://page1.com', title: 'Page 1' }),createCrawlResultItem({ source_url: 'https://page2.com', title: 'Page 2' }),]- const props = createResultProps({ list, checkedList: [list[0]], onSelectedChange })+ const props = createResultProps({ list, checkedList: [list[0]!], onSelectedChange })render(<CrawledResult {...props} />)await userEvent.click(getItemCheckbox(0))@@ -472,7 +473,7 @@ describe('CrawledResult', () => {createCrawlResultItem({ source_url: 'https://page2.com', title: 'Page 2' }),createCrawlResultItem({ source_url: 'https://page3.com', title: 'Page 3' }),]- const props = createResultProps({ list, checkedList: [list[0], list[1]], onSelectedChange })+ const props = createResultProps({ list, checkedList: [list[0]!, list[1]!], onSelectedChange })render(<CrawledResult {...props} />)await userEvent.click(getItemCheckbox(0))@@ -493,7 +494,7 @@ describe('CrawledResult', () => {render(<CrawledResult {...props} />)const previewButtons = screen.getAllByText('datasetCreation.stepOne.website.preview')- await userEvent.click(previewButtons[1])+ await userEvent.click(previewButtons[1]!)expect(onPreview).toHaveBeenCalledWith(list[1])})@@ -509,7 +510,7 @@ describe('CrawledResult', () => {render(<CrawledResult {...props} />)const previewButtons = screen.getAllByText('datasetCreation.stepOne.website.preview')- await userEvent.click(previewButtons[0])+ await userEvent.click(previewButtons[0]!)expect(onPreview).toHaveBeenCalledWith(list[0])})@@ -527,14 +528,15 @@ describe('CrawledResult', () => {render(<CrawledResult {...props} />)// Should still render the header with resetAll (empty list = all checked)- expect(screen.getByText('datasetCreation.stepOne.website.resetAll')).toBeInTheDocument()+ // Should still render the header with resetAll (empty list = all checked)+ expect(screen.getByText('datasetCreation.stepOne.website.resetAll'))!.toBeInTheDocument()})it('should handle className prop', () => {const props = createResultProps({ className: 'custom-class' })const { container } = render(<CrawledResult {...props} />)- expect(container.firstChild).toHaveClass('custom-class')+ expect(container.firstChild)!.toHaveClass('custom-class')})})})diff --git a/web/app/components/datasets/create/website/base/__tests__/crawled-result.spec.tsx b/web/app/components/datasets/create/website/base/__tests__/crawled-result.spec.tsxindex 922ae2adc9d..749b50e6f44 100644--- a/web/app/components/datasets/create/website/base/__tests__/crawled-result.spec.tsx+++ b/web/app/components/datasets/create/website/base/__tests__/crawled-result.spec.tsx@@ -80,7 +80,7 @@ describe('CrawledResult', () => {/>,)- expect(screen.getByTestId('select-all')).toBeInTheDocument()+ expect(screen.getByTestId('select-all'))!.toBeInTheDocument()})it('should render all items from list', () => {@@ -95,9 +95,9 @@ describe('CrawledResult', () => {/>,)- expect(screen.getByTestId('item-0')).toBeInTheDocument()- expect(screen.getByTestId('item-1')).toBeInTheDocument()- expect(screen.getByTestId('item-2')).toBeInTheDocument()+ expect(screen.getByTestId('item-0'))!.toBeInTheDocument()+ expect(screen.getByTestId('item-1'))!.toBeInTheDocument()+ expect(screen.getByTestId('item-2'))!.toBeInTheDocument()})it('should render scrap time info', () => {@@ -112,7 +112,7 @@ describe('CrawledResult', () => {/>,)- expect(screen.getByText(/scrapTimeInfo/i)).toBeInTheDocument()+ expect(screen.getByText(/scrapTimeInfo/i))!.toBeInTheDocument()})it('should apply custom className', () => {@@ -129,7 +129,7 @@ describe('CrawledResult', () => {)const rootElement = container.firstChild as HTMLElement- expect(rootElement).toHaveClass('custom-class')+ expect(rootElement)!.toHaveClass('custom-class')})})@@ -139,7 +139,7 @@ describe('CrawledResult', () => {render(<CrawledResultlist={list}- checkedList={[list[0]]}+ checkedList={[list[0]!]}onSelectedChange={mockOnSelectedChange}onPreview={mockOnPreview}usedTime={1.5}@@ -175,14 +175,14 @@ describe('CrawledResult', () => {render(<CrawledResultlist={list}- checkedList={[list[0]]}+ checkedList={[list[0]!]}onSelectedChange={mockOnSelectedChange}onPreview={mockOnPreview}usedTime={1.5}/>,)- expect(screen.getByText(/selectAll/i)).toBeInTheDocument()+ expect(screen.getByText(/selectAll/i))!.toBeInTheDocument()})it('should show resetAll label when all checked', () => {@@ -197,14 +197,14 @@ describe('CrawledResult', () => {/>,)- expect(screen.getByText(/resetAll/i)).toBeInTheDocument()+ expect(screen.getByText(/resetAll/i))!.toBeInTheDocument()})})describe('Individual Item Check', () => {it('should call onSelectedChange with added item when checking', () => {const list = createMockList()- const checkedList = [list[0]]+ const checkedList = [list[0]!]render(<CrawledResultlist={list}@@ -223,7 +223,7 @@ describe('CrawledResult', () => {it('should call onSelectedChange with removed item when unchecking', () => {const list = createMockList()- const checkedList = [list[0], list[1]]+ const checkedList = [list[0]!, list[1]!]render(<CrawledResultlist={list}@@ -276,7 +276,7 @@ describe('CrawledResult', () => {fireEvent.click(previewButton)const item0 = screen.getByTestId('item-0')- expect(item0).toHaveAttribute('data-preview', 'true')+ expect(item0)!.toHaveAttribute('data-preview', 'true')})})@@ -292,7 +292,7 @@ describe('CrawledResult', () => {/>,)- expect(screen.getByTestId('select-all')).toBeInTheDocument()+ expect(screen.getByTestId('select-all'))!.toBeInTheDocument()})it('should handle single item list', () => {@@ -307,7 +307,7 @@ describe('CrawledResult', () => {/>,)- expect(screen.getByTestId('item-0')).toBeInTheDocument()+ expect(screen.getByTestId('item-0'))!.toBeInTheDocument()})})})diff --git a/web/app/components/datasets/create/website/base/crawled-result.tsx b/web/app/components/datasets/create/website/base/crawled-result.tsxindex 0f72cc51729..8f34b75d37a 100644--- a/web/app/components/datasets/create/website/base/crawled-result.tsx+++ b/web/app/components/datasets/create/website/base/crawled-result.tsx@@ -53,7 +53,7 @@ const CrawledResult: FC<Props> = ({const handlePreview = useCallback((index: number) => {return () => {setPreviewIndex(index)- onPreview(list[index])+ onPreview(list[index]!)}}, [list, onPreview])diff --git a/web/app/components/datasets/create/website/firecrawl/__tests__/index.spec.tsx b/web/app/components/datasets/create/website/firecrawl/__tests__/index.spec.tsxindex c154c1a534f..32b536c8f0d 100644--- a/web/app/components/datasets/create/website/firecrawl/__tests__/index.spec.tsx+++ b/web/app/components/datasets/create/website/firecrawl/__tests__/index.spec.tsx@@ -102,34 +102,65 @@ describe('FireCrawl', () => {it('should render without crashing', () => {render(<FireCrawl {...defaultProps} />)- expect(screen.getByText(/firecrawlTitle/i)).toBeInTheDocument()+ expect(screen.getByText(/firecrawlTitle/i))!.toBeInTheDocument()})it('should render Header component with correct props', () => {render(<FireCrawl {...defaultProps} />)- expect(screen.getByText(/firecrawlTitle/i)).toBeInTheDocument()- expect(screen.getByText(/configureFirecrawl/i)).toBeInTheDocument()- expect(screen.getByText(/firecrawlDoc/i)).toBeInTheDocument()+ expect(screen.getByText(/firecrawlTitle/i))!.toBeInTheDocument()+ expect(screen.getByText(/configureFirecrawl/i))!.toBeInTheDocument()+ expect(screen.getByText(/firecrawlDoc/i))!.toBeInTheDocument()})it('should render UrlInput component', () => {render(<FireCrawl {...defaultProps} />)- expect(getUrlInput()).toBeInTheDocument()- expect(screen.getByRole('button', { name: /run/i })).toBeInTheDocument()+ expect(getUrlInput())!.toBeInTheDocument()+ expect(screen.getByRole('button', { name: /run/i }))!.toBeInTheDocument()})it('should render Options component', () => {render(<FireCrawl {...defaultProps} />)- expect(screen.getByText(/crawlSubPage/i)).toBeInTheDocument()- expect(screen.getByText(/limit/i)).toBeInTheDocument()+ expect(screen.getByText(/crawlSubPage/i))!.toBeInTheDocument()+ expect(screen.getByText(/limit/i))!.toBeInTheDocument()})it('should not render crawling or result components initially', () => {render(<FireCrawl {...defaultProps} />)+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state+ // Crawling and result components should not be visible in init state// Crawling and result components should not be visible in init stateexpect(screen.queryByText(/crawling/i)).not.toBeInTheDocument()})@@ -443,7 +474,7 @@ describe('FireCrawl', () => {await user.click(runButton)await waitFor(() => {- expect(screen.getByText(/exceptionErrorTitle/i)).toBeInTheDocument()+ expect(screen.getByText(/exceptionErrorTitle/i))!.toBeInTheDocument()})})@@ -465,7 +496,7 @@ describe('FireCrawl', () => {await user.click(runButton)await waitFor(() => {- expect(screen.getByText(/exceptionErrorTitle/i)).toBeInTheDocument()+ expect(screen.getByText(/exceptionErrorTitle/i))!.toBeInTheDocument()})})@@ -547,7 +578,7 @@ describe('FireCrawl', () => {await user.click(runButton)await waitFor(() => {- expect(screen.getByText(/exceptionErrorTitle/i)).toBeInTheDocument()+ expect(screen.getByText(/exceptionErrorTitle/i))!.toBeInTheDocument()})})@@ -567,7 +598,7 @@ describe('FireCrawl', () => {await user.click(runButton)await waitFor(() => {- expect(screen.getByText(/exceptionErrorTitle/i)).toBeInTheDocument()+ expect(screen.getByText(/exceptionErrorTitle/i))!.toBeInTheDocument()})})@@ -589,7 +620,7 @@ describe('FireCrawl', () => {await user.click(runButton)await waitFor(() => {- expect(screen.getByText('Custom error message')).toBeInTheDocument()+ expect(screen.getByText('Custom error message'))!.toBeInTheDocument()})})@@ -611,7 +642,7 @@ describe('FireCrawl', () => {await user.click(runButton)await waitFor(() => {- expect(screen.getByText(/unknownError/i)).toBeInTheDocument()+ expect(screen.getByText(/unknownError/i))!.toBeInTheDocument()})})})@@ -635,7 +666,7 @@ describe('FireCrawl', () => {// Use data-testid to find checkboxes since they are custom div elementsconst checkboxes = container.querySelectorAll('[data-testid^="checkbox-"]')- fireEvent.click(checkboxes[0]) // crawl_sub_pages+ fireEvent.click(checkboxes[0]!) // crawl_sub_pagesexpect(mockOnCrawlOptionsChange).toHaveBeenCalledWith(expect.objectContaining({ crawl_sub_pages: false }),@@ -669,8 +700,8 @@ describe('FireCrawl', () => {await user.click(runButton)await waitFor(() => {- expect(screen.getByText('Result Page 1')).toBeInTheDocument()- expect(screen.getByText('Result Page 2')).toBeInTheDocument()+ expect(screen.getByText('Result Page 1'))!.toBeInTheDocument()+ expect(screen.getByText('Result Page 2'))!.toBeInTheDocument()})})@@ -710,7 +741,7 @@ describe('FireCrawl', () => {rerender(<FireCrawl {...defaultProps} />)- expect(screen.getByText(/firecrawlTitle/i)).toBeInTheDocument()+ expect(screen.getByText(/firecrawlTitle/i))!.toBeInTheDocument()})})})diff --git a/web/app/components/datasets/create/website/firecrawl/__tests__/options.spec.tsx b/web/app/components/datasets/create/website/firecrawl/__tests__/options.spec.tsxindex 313ad9c0512..946c04aa93b 100644--- a/web/app/components/datasets/create/website/firecrawl/__tests__/options.spec.tsx+++ b/web/app/components/datasets/create/website/firecrawl/__tests__/options.spec.tsx@@ -35,9 +35,10 @@ describe('Options', () => {render(<Options payload={payload} onChange={mockOnChange} />)// Check that key elements are rendered- expect(screen.getByText(/crawlSubPage/i)).toBeInTheDocument()- expect(screen.getByText(/limit/i)).toBeInTheDocument()- expect(screen.getByText(/maxDepth/i)).toBeInTheDocument()+ // Check that key elements are rendered+ expect(screen.getByText(/crawlSubPage/i))!.toBeInTheDocument()+ expect(screen.getByText(/limit/i))!.toBeInTheDocument()+ expect(screen.getByText(/maxDepth/i))!.toBeInTheDocument()})it('should render all form fields', () => {@@ -45,14 +46,16 @@ describe('Options', () => {render(<Options payload={payload} onChange={mockOnChange} />)// Checkboxes- expect(screen.getByText(/crawlSubPage/i)).toBeInTheDocument()- expect(screen.getByText(/extractOnlyMainContent/i)).toBeInTheDocument()+ // Checkboxes+ expect(screen.getByText(/crawlSubPage/i))!.toBeInTheDocument()+ expect(screen.getByText(/extractOnlyMainContent/i))!.toBeInTheDocument()// Text/Number fields- expect(screen.getByText(/limit/i)).toBeInTheDocument()- expect(screen.getByText(/maxDepth/i)).toBeInTheDocument()- expect(screen.getByText(/excludePaths/i)).toBeInTheDocument()- expect(screen.getByText(/includeOnlyPaths/i)).toBeInTheDocument()+ // Text/Number fields+ expect(screen.getByText(/limit/i))!.toBeInTheDocument()+ expect(screen.getByText(/maxDepth/i))!.toBeInTheDocument()+ expect(screen.getByText(/excludePaths/i))!.toBeInTheDocument()+ expect(screen.getByText(/includeOnlyPaths/i))!.toBeInTheDocument()})it('should render with custom className', () => {@@ -62,7 +65,7 @@ describe('Options', () => {)const rootElement = container.firstChild as HTMLElement- expect(rootElement).toHaveClass('custom-class')+ expect(rootElement)!.toHaveClass('custom-class')})it('should render limit field with required indicator', () => {@@ -71,7 +74,7 @@ describe('Options', () => {// Limit field should have required indicator (*)const requiredIndicator = screen.getByText('*')- expect(requiredIndicator).toBeInTheDocument()+ expect(requiredIndicator)!.toBeInTheDocument()})it('should render placeholder for excludes field', () => {@@ -79,7 +82,7 @@ describe('Options', () => {render(<Options payload={payload} onChange={mockOnChange} />)const excludesInput = screen.getByPlaceholderText('blog/*, /about/*')- expect(excludesInput).toBeInTheDocument()+ expect(excludesInput)!.toBeInTheDocument()})it('should render placeholder for includes field', () => {@@ -87,7 +90,7 @@ describe('Options', () => {render(<Options payload={payload} onChange={mockOnChange} />)const includesInput = screen.getByPlaceholderText('articles/*')- expect(includesInput).toBeInTheDocument()+ expect(includesInput)!.toBeInTheDocument()})it('should render two checkboxes', () => {@@ -106,7 +109,8 @@ describe('Options', () => {render(<Options payload={payload} onChange={mockOnChange} />)// First checkbox should have check icon when checked- expect(screen.queryByTestId('check-icon-crawl-sub-page')).toBeInTheDocument()+ // First checkbox should have check icon when checked+ expect(screen.queryByTestId('check-icon-crawl-sub-page'))!.toBeInTheDocument()})it('should display crawl_sub_pages checkbox without check icon when false', () => {@@ -118,7 +122,7 @@ describe('Options', () => {it('should display only_main_content checkbox with check icon when true', () => {const payload = createMockCrawlOptions({ only_main_content: true })render(<Options payload={payload} onChange={mockOnChange} />)- expect(screen.getByTestId('check-icon-only-main-content')).toBeInTheDocument()+ expect(screen.getByTestId('check-icon-only-main-content'))!.toBeInTheDocument()})it('should display only_main_content checkbox without check icon when false', () => {@@ -132,7 +136,7 @@ describe('Options', () => {render(<Options payload={payload} onChange={mockOnChange} />)const limitInput = screen.getByDisplayValue('25')- expect(limitInput).toBeInTheDocument()+ expect(limitInput)!.toBeInTheDocument()})it('should display max_depth value in input', () => {@@ -140,7 +144,7 @@ describe('Options', () => {render(<Options payload={payload} onChange={mockOnChange} />)const maxDepthInput = screen.getByDisplayValue('5')- expect(maxDepthInput).toBeInTheDocument()+ expect(maxDepthInput)!.toBeInTheDocument()})it('should display excludes value in input', () => {@@ -148,7 +152,7 @@ describe('Options', () => {render(<Options payload={payload} onChange={mockOnChange} />)const excludesInput = screen.getByDisplayValue('test/*')- expect(excludesInput).toBeInTheDocument()+ expect(excludesInput)!.toBeInTheDocument()})it('should display includes value in input', () => {@@ -156,7 +160,7 @@ describe('Options', () => {render(<Options payload={payload} onChange={mockOnChange} />)const includesInput = screen.getByDisplayValue('docs/*')- expect(includesInput).toBeInTheDocument()+ expect(includesInput)!.toBeInTheDocument()})})@@ -166,7 +170,7 @@ describe('Options', () => {const { container } = render(<Options payload={payload} onChange={mockOnChange} />)const checkboxes = getCheckboxes(container)- fireEvent.click(checkboxes[0])+ fireEvent.click(checkboxes[0]!)expect(mockOnChange).toHaveBeenCalledWith({...payload,@@ -179,7 +183,7 @@ describe('Options', () => {const { container } = render(<Options payload={payload} onChange={mockOnChange} />)const checkboxes = getCheckboxes(container)- fireEvent.click(checkboxes[1])+ fireEvent.click(checkboxes[1]!)expect(mockOnChange).toHaveBeenCalledWith({...payload,@@ -251,7 +255,8 @@ describe('Options', () => {render(<Options payload={payload} onChange={mockOnChange} />)// Component should render without crashing- expect(screen.getByText(/limit/i)).toBeInTheDocument()+ // Component should render without crashing+ expect(screen.getByText(/limit/i))!.toBeInTheDocument()})it('should handle zero values', () => {@@ -273,8 +278,8 @@ describe('Options', () => {})render(<Options payload={payload} onChange={mockOnChange} />)- expect(screen.getByDisplayValue('9999')).toBeInTheDocument()- expect(screen.getByDisplayValue('100')).toBeInTheDocument()+ expect(screen.getByDisplayValue('9999'))!.toBeInTheDocument()+ expect(screen.getByDisplayValue('100'))!.toBeInTheDocument()})it('should handle special characters in text fields', () => {@@ -284,8 +289,8 @@ describe('Options', () => {})render(<Options payload={payload} onChange={mockOnChange} />)- expect(screen.getByDisplayValue('path/*/file?query=1¶m=2')).toBeInTheDocument()- expect(screen.getByDisplayValue('docs/**/*.md')).toBeInTheDocument()+ expect(screen.getByDisplayValue('path/*/file?query=1¶m=2'))!.toBeInTheDocument()+ expect(screen.getByDisplayValue('docs/**/*.md'))!.toBeInTheDocument()})it('should preserve other payload fields when updating one field', () => {@@ -357,7 +362,7 @@ describe('Options', () => {rerender(<Options payload={payload} onChange={mockOnChange} />)- expect(screen.getByText(/limit/i)).toBeInTheDocument()+ expect(screen.getByText(/limit/i))!.toBeInTheDocument()})it('should re-render when payload changes', () => {@@ -365,10 +370,10 @@ describe('Options', () => {const payload2 = createMockCrawlOptions({ limit: 20 })const { rerender } = render(<Options payload={payload1} onChange={mockOnChange} />)- expect(screen.getByDisplayValue('10')).toBeInTheDocument()+ expect(screen.getByDisplayValue('10'))!.toBeInTheDocument()rerender(<Options payload={payload2} onChange={mockOnChange} />)- expect(screen.getByDisplayValue('20')).toBeInTheDocument()+ expect(screen.getByDisplayValue('20'))!.toBeInTheDocument()})})})diff --git a/web/app/components/datasets/create/website/jina-reader/__tests__/index.spec.tsx b/web/app/components/datasets/create/website/jina-reader/__tests__/index.spec.tsxindex b8829b10421..16896df2bb2 100644--- a/web/app/components/datasets/create/website/jina-reader/__tests__/index.spec.tsx+++ b/web/app/components/datasets/create/website/jina-reader/__tests__/index.spec.tsx@@ -75,7 +75,7 @@ describe('JinaReader', () => {render(<JinaReader {...props} />)- expect(screen.getByText('datasetCreation.stepOne.website.jinaReaderTitle')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepOne.website.jinaReaderTitle'))!.toBeInTheDocument()})it('should render header with configuration button', () => {@@ -83,7 +83,7 @@ describe('JinaReader', () => {render(<JinaReader {...props} />)- expect(screen.getByText('datasetCreation.stepOne.website.configureJinaReader')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepOne.website.configureJinaReader'))!.toBeInTheDocument()})it('should render URL input field', () => {@@ -91,7 +91,7 @@ describe('JinaReader', () => {render(<JinaReader {...props} />)- expect(screen.getByRole('textbox')).toBeInTheDocument()+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})it('should render run button', () => {@@ -99,7 +99,7 @@ describe('JinaReader', () => {render(<JinaReader {...props} />)- expect(screen.getByRole('button', { name: /run/i })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: /run/i }))!.toBeInTheDocument()})it('should render options section', () => {@@ -107,7 +107,7 @@ describe('JinaReader', () => {render(<JinaReader {...props} />)- expect(screen.getByText('datasetCreation.stepOne.website.options')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepOne.website.options'))!.toBeInTheDocument()})it('should render doc link to Jina Reader', () => {@@ -116,7 +116,7 @@ describe('JinaReader', () => {render(<JinaReader {...props} />)const docLink = screen.getByRole('link')- expect(docLink).toHaveAttribute('href', 'https://jina.ai/reader')+ expect(docLink)!.toHaveAttribute('href', 'https://jina.ai/reader')})it('should not render crawling or result components initially', () => {@@ -152,7 +152,8 @@ describe('JinaReader', () => {}else {// Options might not be visible, just verify component renders- expect(screen.getByText('datasetCreation.stepOne.website.options')).toBeInTheDocument()+ // Options might not be visible, just verify component renders+ expect(screen.getByText('datasetCreation.stepOne.website.options'))!.toBeInTheDocument()}})@@ -191,7 +192,8 @@ describe('JinaReader', () => {render(<JinaReader {...props} />)// Assert - component renders with empty limit- expect(screen.getByRole('textbox')).toBeInTheDocument()+ // Assert - component renders with empty limit+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})})@@ -208,14 +210,14 @@ describe('JinaReader', () => {render(<JinaReader {...props} />)const urlInput = screen.getAllByRole('textbox')[0]- await userEvent.type(urlInput, 'https://example.com')+ await userEvent.type(urlInput!, 'https://example.com')const runButton = screen.getByRole('button', { name: /run/i })fireEvent.click(runButton)// Assert - crawling indicator should appearawait waitFor(() => {- expect(screen.getByText(/totalPageScraped/i)).toBeInTheDocument()+ expect(screen.getByText(/totalPageScraped/i))!.toBeInTheDocument()})// Cleanup - resolve the promise and wait for component to finish@@ -244,7 +246,7 @@ describe('JinaReader', () => {await userEvent.click(screen.getByRole('button', { name: /run/i }))await waitFor(() => {- expect(screen.getByText(/selectAll|resetAll/i)).toBeInTheDocument()+ expect(screen.getByText(/selectAll|resetAll/i))!.toBeInTheDocument()})})@@ -305,7 +307,8 @@ describe('JinaReader', () => {render(<JinaReader {...props} />)// Options should be visible initially- expect(screen.getByText('datasetCreation.stepOne.website.crawlSubPage')).toBeInTheDocument()+ // Options should be visible initially+ expect(screen.getByText('datasetCreation.stepOne.website.crawlSubPage'))!.toBeInTheDocument()const input = screen.getByRole('textbox')await userEvent.type(input, 'https://example.com')@@ -355,7 +358,8 @@ describe('JinaReader', () => {render(<JinaReader {...props} />)// Initially options should be visible- expect(screen.getByText('datasetCreation.stepOne.website.options')).toBeInTheDocument()+ // Initially options should be visible+ expect(screen.getByText('datasetCreation.stepOne.website.options'))!.toBeInTheDocument()const input = screen.getByRole('textbox')await userEvent.type(input, 'https://example.com')@@ -363,7 +367,7 @@ describe('JinaReader', () => {// Assert - the crawling indicator should appearawait waitFor(() => {- expect(screen.getByText(/totalPageScraped/i)).toBeInTheDocument()+ expect(screen.getByText(/totalPageScraped/i))!.toBeInTheDocument()})// Cleanup - resolve the promise@@ -411,7 +415,8 @@ describe('JinaReader', () => {rerender(<JinaReader {...props} />)// Assert - component should still work correctly- expect(screen.getByRole('textbox')).toBeInTheDocument()+ // Assert - component should still work correctly+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})})@@ -476,7 +481,7 @@ describe('JinaReader', () => {// Assert - result should be displayedawait waitFor(() => {- expect(screen.getByText('Preview Test')).toBeInTheDocument()+ expect(screen.getByText('Preview Test'))!.toBeInTheDocument()})const previewButton = screen.getByText('datasetCreation.stepOne.website.preview')@@ -508,18 +513,51 @@ describe('JinaReader', () => {render(<JinaReader {...props} />)// Options content should be visible initially- expect(screen.getByText('datasetCreation.stepOne.website.crawlSubPage')).toBeInTheDocument()+ // Options content should be visible initially+ expect(screen.getByText('datasetCreation.stepOne.website.crawlSubPage'))!.toBeInTheDocument()const optionsHeader = screen.getByText('datasetCreation.stepOne.website.options')await userEvent.click(optionsHeader)+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden// Assert - options should be hiddenexpect(screen.queryByText('datasetCreation.stepOne.website.crawlSubPage')).not.toBeInTheDocument()await userEvent.click(optionsHeader)// Options should be visible again- expect(screen.getByText('datasetCreation.stepOne.website.crawlSubPage')).toBeInTheDocument()+ // Options should be visible again+ expect(screen.getByText('datasetCreation.stepOne.website.crawlSubPage'))!.toBeInTheDocument()})})@@ -627,10 +665,10 @@ describe('JinaReader', () => {await userEvent.click(screen.getByRole('button', { name: /run/i }))await waitFor(() => {- expect(screen.getByText('datasetCreation.stepOne.website.exceptionErrorTitle')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepOne.website.exceptionErrorTitle'))!.toBeInTheDocument()})- expect(screen.getByText('Crawl failed due to network error')).toBeInTheDocument()+ expect(screen.getByText('Crawl failed due to network error'))!.toBeInTheDocument()})it('should handle API error during status check', async () => {@@ -650,7 +688,7 @@ describe('JinaReader', () => {await userEvent.click(screen.getByRole('button', { name: /run/i }))await waitFor(() => {- expect(screen.getByText('datasetCreation.stepOne.website.exceptionErrorTitle')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepOne.website.exceptionErrorTitle'))!.toBeInTheDocument()})})@@ -810,7 +848,7 @@ describe('JinaReader', () => {await userEvent.click(screen.getByRole('button', { name: /run/i }))await waitFor(() => {- expect(screen.getByText('datasetCreation.stepOne.website.exceptionErrorTitle')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepOne.website.exceptionErrorTitle'))!.toBeInTheDocument()})consoleSpy.mockRestore()@@ -834,7 +872,7 @@ describe('JinaReader', () => {await userEvent.click(screen.getByRole('button', { name: /run/i }))await waitFor(() => {- expect(screen.getByText('datasetCreation.stepOne.website.exceptionErrorTitle')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepOne.website.exceptionErrorTitle'))!.toBeInTheDocument()})})@@ -856,7 +894,7 @@ describe('JinaReader', () => {await userEvent.click(screen.getByRole('button', { name: /run/i }))await waitFor(() => {- expect(screen.getByText('datasetCreation.stepOne.website.unknownError')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepOne.website.unknownError'))!.toBeInTheDocument()})})@@ -964,7 +1002,7 @@ describe('JinaReader', () => {// Assert - should show 0/10 when crawlResult is undefinedawait waitFor(() => {- expect(screen.getByText(/totalPageScraped.*0\/10/)).toBeInTheDocument()+ expect(screen.getByText(/totalPageScraped.*0\/10/))!.toBeInTheDocument()})// Cleanup - resolve the promise@@ -996,7 +1034,7 @@ describe('JinaReader', () => {// Assert - should show 0/0 when limit parses to 0await waitFor(() => {- expect(screen.getByText(/totalPageScraped.*0\/0/)).toBeInTheDocument()+ expect(screen.getByText(/totalPageScraped.*0\/0/))!.toBeInTheDocument()})// Cleanup - resolve the promise@@ -1029,7 +1067,7 @@ describe('JinaReader', () => {// Assert - should complete and show results even if emptyawait waitFor(() => {- expect(screen.getByText(/scrapTimeInfo/i)).toBeInTheDocument()+ expect(screen.getByText(/scrapTimeInfo/i))!.toBeInTheDocument()})})@@ -1055,7 +1093,7 @@ describe('JinaReader', () => {// Assert - should use limit (15) as totalawait waitFor(() => {- expect(screen.getByText(/totalPageScraped.*0\/15/)).toBeInTheDocument()+ expect(screen.getByText(/totalPageScraped.*0\/15/))!.toBeInTheDocument()})// Cleanup - resolve the promise@@ -1094,7 +1132,7 @@ describe('JinaReader', () => {// Assert - should show progress indicatorawait waitFor(() => {- expect(screen.getByText(/totalPageScraped/)).toBeInTheDocument()+ expect(screen.getByText(/totalPageScraped/))!.toBeInTheDocument()})// Cleanup - resolve the promise@@ -1329,7 +1367,7 @@ describe('JinaReader', () => {await userEvent.click(screen.getByRole('button', { name: /run/i }))await waitFor(() => {- expect(screen.getByText(/totalPageScraped.*0\/10/)).toBeInTheDocument()+ expect(screen.getByText(/totalPageScraped.*0\/10/))!.toBeInTheDocument()})// Cleanup - resolve the promise@@ -1354,7 +1392,7 @@ describe('JinaReader', () => {await userEvent.click(screen.getByRole('button', { name: /run/i }))await waitFor(() => {- expect(screen.getByText(/scrapTimeInfo/i)).toBeInTheDocument()+ expect(screen.getByText(/scrapTimeInfo/i))!.toBeInTheDocument()})})@@ -1378,7 +1416,7 @@ describe('JinaReader', () => {await userEvent.click(screen.getByRole('button', { name: /run/i }))await waitFor(() => {- expect(screen.getByText('Result Page')).toBeInTheDocument()+ expect(screen.getByText('Result Page'))!.toBeInTheDocument()})})@@ -1397,7 +1435,7 @@ describe('JinaReader', () => {await userEvent.click(screen.getByRole('button', { name: /run/i }))await waitFor(() => {- expect(screen.getByText('datasetCreation.stepOne.website.exceptionErrorTitle')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepOne.website.exceptionErrorTitle'))!.toBeInTheDocument()})})})@@ -1453,8 +1491,8 @@ describe('JinaReader', () => {// Assert - final results should be displayedawait waitFor(() => {- expect(screen.getByText('Page 1')).toBeInTheDocument()- expect(screen.getByText('Page 5')).toBeInTheDocument()+ expect(screen.getByText('Page 1'))!.toBeInTheDocument()+ expect(screen.getByText('Page 5'))!.toBeInTheDocument()})// Assert - checked results should be updated@@ -1483,7 +1521,7 @@ describe('JinaReader', () => {// Wait for resultsawait waitFor(() => {- expect(screen.getByText('Single')).toBeInTheDocument()+ expect(screen.getByText('Single'))!.toBeInTheDocument()})const selectAllCheckbox = screen.getByText(/selectAll|resetAll/i)diff --git a/web/app/components/datasets/create/website/watercrawl/__tests__/index.spec.tsx b/web/app/components/datasets/create/website/watercrawl/__tests__/index.spec.tsxindex e9d933cc031..1023cbd045f 100644--- a/web/app/components/datasets/create/website/watercrawl/__tests__/index.spec.tsx+++ b/web/app/components/datasets/create/website/watercrawl/__tests__/index.spec.tsx@@ -77,7 +77,7 @@ describe('WaterCrawl', () => {render(<WaterCrawl {...props} />)- expect(screen.getByText('datasetCreation.stepOne.website.watercrawlTitle')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepOne.website.watercrawlTitle'))!.toBeInTheDocument()})it('should render header with configuration button', () => {@@ -85,7 +85,7 @@ describe('WaterCrawl', () => {render(<WaterCrawl {...props} />)- expect(screen.getByText('datasetCreation.stepOne.website.configureWatercrawl')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepOne.website.configureWatercrawl'))!.toBeInTheDocument()})it('should render URL input field', () => {@@ -94,7 +94,8 @@ describe('WaterCrawl', () => {render(<WaterCrawl {...props} />)// Assert - URL input has specific placeholder- expect(screen.getByPlaceholderText('https://docs.dify.ai/en/')).toBeInTheDocument()+ // Assert - URL input has specific placeholder+ expect(screen.getByPlaceholderText('https://docs.dify.ai/en/'))!.toBeInTheDocument()})it('should render run button', () => {@@ -102,7 +103,7 @@ describe('WaterCrawl', () => {render(<WaterCrawl {...props} />)- expect(screen.getByRole('button', { name: /run/i })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: /run/i }))!.toBeInTheDocument()})it('should render options section', () => {@@ -110,7 +111,7 @@ describe('WaterCrawl', () => {render(<WaterCrawl {...props} />)- expect(screen.getByText('datasetCreation.stepOne.website.options')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepOne.website.options'))!.toBeInTheDocument()})it('should render doc link to WaterCrawl', () => {@@ -119,7 +120,7 @@ describe('WaterCrawl', () => {render(<WaterCrawl {...props} />)const docLink = screen.getByRole('link')- expect(docLink).toHaveAttribute('href', 'https://docs.watercrawl.dev/')+ expect(docLink)!.toHaveAttribute('href', 'https://docs.watercrawl.dev/')})it('should not render crawling or result components initially', () => {@@ -155,7 +156,8 @@ describe('WaterCrawl', () => {}else {// Options might not be visible, just verify component renders- expect(screen.getByText('datasetCreation.stepOne.website.options')).toBeInTheDocument()+ // Options might not be visible, just verify component renders+ expect(screen.getByText('datasetCreation.stepOne.website.options'))!.toBeInTheDocument()}})@@ -195,7 +197,8 @@ describe('WaterCrawl', () => {render(<WaterCrawl {...props} />)// Assert - component renders with empty limit- expect(screen.getByPlaceholderText('https://docs.dify.ai/en/')).toBeInTheDocument()+ // Assert - component renders with empty limit+ expect(screen.getByPlaceholderText('https://docs.dify.ai/en/'))!.toBeInTheDocument()})})@@ -218,7 +221,7 @@ describe('WaterCrawl', () => {// Assert - crawling indicator should appearawait waitFor(() => {- expect(screen.getByText(/totalPageScraped/i)).toBeInTheDocument()+ expect(screen.getByText(/totalPageScraped/i))!.toBeInTheDocument()})// Cleanup - resolve the promise@@ -245,7 +248,7 @@ describe('WaterCrawl', () => {await userEvent.click(screen.getByRole('button', { name: /run/i }))await waitFor(() => {- expect(screen.getByText(/selectAll|resetAll/i)).toBeInTheDocument()+ expect(screen.getByText(/selectAll|resetAll/i))!.toBeInTheDocument()})})@@ -307,7 +310,8 @@ describe('WaterCrawl', () => {render(<WaterCrawl {...props} />)// Options should be visible initially- expect(screen.getByText('datasetCreation.stepOne.website.crawlSubPage')).toBeInTheDocument()+ // Options should be visible initially+ expect(screen.getByText('datasetCreation.stepOne.website.crawlSubPage'))!.toBeInTheDocument()const input = screen.getByPlaceholderText('https://docs.dify.ai/en/')await userEvent.type(input, 'https://example.com')@@ -353,7 +357,8 @@ describe('WaterCrawl', () => {render(<WaterCrawl {...props} />)// Initially options should be visible- expect(screen.getByText('datasetCreation.stepOne.website.options')).toBeInTheDocument()+ // Initially options should be visible+ expect(screen.getByText('datasetCreation.stepOne.website.options'))!.toBeInTheDocument()const input = screen.getByPlaceholderText('https://docs.dify.ai/en/')await userEvent.type(input, 'https://example.com')@@ -361,7 +366,7 @@ describe('WaterCrawl', () => {// Assert - the crawling indicator should appearawait waitFor(() => {- expect(screen.getByText(/totalPageScraped/i)).toBeInTheDocument()+ expect(screen.getByText(/totalPageScraped/i))!.toBeInTheDocument()})})})@@ -411,7 +416,8 @@ describe('WaterCrawl', () => {rerender(<WaterCrawl {...props} />)// Assert - component should still work correctly- expect(screen.getByPlaceholderText('https://docs.dify.ai/en/')).toBeInTheDocument()+ // Assert - component should still work correctly+ expect(screen.getByPlaceholderText('https://docs.dify.ai/en/'))!.toBeInTheDocument()})})@@ -478,7 +484,7 @@ describe('WaterCrawl', () => {// Assert - result should be displayedawait waitFor(() => {- expect(screen.getByText('Preview Test')).toBeInTheDocument()+ expect(screen.getByText('Preview Test'))!.toBeInTheDocument()})const previewButton = screen.getByText('datasetCreation.stepOne.website.preview')@@ -510,18 +516,51 @@ describe('WaterCrawl', () => {render(<WaterCrawl {...props} />)// Options content should be visible initially- expect(screen.getByText('datasetCreation.stepOne.website.crawlSubPage')).toBeInTheDocument()+ // Options content should be visible initially+ expect(screen.getByText('datasetCreation.stepOne.website.crawlSubPage'))!.toBeInTheDocument()const optionsHeader = screen.getByText('datasetCreation.stepOne.website.options')await userEvent.click(optionsHeader)+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden+ // Assert - options should be hidden// Assert - options should be hiddenexpect(screen.queryByText('datasetCreation.stepOne.website.crawlSubPage')).not.toBeInTheDocument()await userEvent.click(optionsHeader)// Options should be visible again- expect(screen.getByText('datasetCreation.stepOne.website.crawlSubPage')).toBeInTheDocument()+ // Options should be visible again+ expect(screen.getByText('datasetCreation.stepOne.website.crawlSubPage'))!.toBeInTheDocument()})})@@ -577,7 +616,7 @@ describe('WaterCrawl', () => {// Assert - max_depth should be deleted from the requestawait waitFor(() => {- const callArgs = mockCreateTask.mock.calls[0][0]+ const callArgs = mockCreateTask.mock.calls[0]![0]expect(callArgs.options).not.toHaveProperty('max_depth')})})@@ -632,10 +671,10 @@ describe('WaterCrawl', () => {await userEvent.click(screen.getByRole('button', { name: /run/i }))await waitFor(() => {- expect(screen.getByText('datasetCreation.stepOne.website.exceptionErrorTitle')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepOne.website.exceptionErrorTitle'))!.toBeInTheDocument()})- expect(screen.getByText('Crawl failed due to network error')).toBeInTheDocument()+ expect(screen.getByText('Crawl failed due to network error'))!.toBeInTheDocument()})it('should handle API error during status check', async () => {@@ -655,7 +694,7 @@ describe('WaterCrawl', () => {await userEvent.click(screen.getByRole('button', { name: /run/i }))await waitFor(() => {- expect(screen.getByText('datasetCreation.stepOne.website.exceptionErrorTitle')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepOne.website.exceptionErrorTitle'))!.toBeInTheDocument()})})@@ -706,7 +745,7 @@ describe('WaterCrawl', () => {await userEvent.click(screen.getByRole('button', { name: /run/i }))await waitFor(() => {- expect(screen.getByText('datasetCreation.stepOne.website.exceptionErrorTitle')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepOne.website.exceptionErrorTitle'))!.toBeInTheDocument()})})})@@ -843,7 +882,7 @@ describe('WaterCrawl', () => {await userEvent.click(screen.getByRole('button', { name: /run/i }))await waitFor(() => {- expect(screen.getByText('datasetCreation.stepOne.website.exceptionErrorTitle')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepOne.website.exceptionErrorTitle'))!.toBeInTheDocument()})consoleSpy.mockRestore()@@ -867,7 +906,7 @@ describe('WaterCrawl', () => {await userEvent.click(screen.getByRole('button', { name: /run/i }))await waitFor(() => {- expect(screen.getByText('datasetCreation.stepOne.website.unknownError')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepOne.website.unknownError'))!.toBeInTheDocument()})})@@ -971,7 +1010,7 @@ describe('WaterCrawl', () => {// Assert - should show 0/10 in crawling indicatorawait waitFor(() => {- expect(screen.getByText(/totalPageScraped.*0\/10/)).toBeInTheDocument()+ expect(screen.getByText(/totalPageScraped.*0\/10/))!.toBeInTheDocument()})})@@ -993,7 +1032,7 @@ describe('WaterCrawl', () => {// Assert - should show 0/0await waitFor(() => {- expect(screen.getByText(/totalPageScraped.*0\/0/)).toBeInTheDocument()+ expect(screen.getByText(/totalPageScraped.*0\/0/))!.toBeInTheDocument()})})@@ -1020,7 +1059,7 @@ describe('WaterCrawl', () => {// Assert - should complete and show resultsawait waitFor(() => {- expect(screen.getByText(/scrapTimeInfo/i)).toBeInTheDocument()+ expect(screen.getByText(/scrapTimeInfo/i))!.toBeInTheDocument()})})@@ -1042,7 +1081,7 @@ describe('WaterCrawl', () => {// Assert - should use limit (15) as totalawait waitFor(() => {- expect(screen.getByText(/totalPageScraped.*0\/15/)).toBeInTheDocument()+ expect(screen.getByText(/totalPageScraped.*0\/15/))!.toBeInTheDocument()})})@@ -1070,7 +1109,7 @@ describe('WaterCrawl', () => {await userEvent.click(screen.getByRole('button', { name: /run/i }))await waitFor(() => {- expect(screen.getByText(/totalPageScraped/)).toBeInTheDocument()+ expect(screen.getByText(/totalPageScraped/))!.toBeInTheDocument()})})})@@ -1335,7 +1374,7 @@ describe('WaterCrawl', () => {await userEvent.click(screen.getByRole('button', { name: /run/i }))await waitFor(() => {- expect(screen.getByText(/totalPageScraped.*0\/10/)).toBeInTheDocument()+ expect(screen.getByText(/totalPageScraped.*0\/10/))!.toBeInTheDocument()})})@@ -1360,7 +1399,7 @@ describe('WaterCrawl', () => {await userEvent.click(screen.getByRole('button', { name: /run/i }))await waitFor(() => {- expect(screen.getByText(/scrapTimeInfo/i)).toBeInTheDocument()+ expect(screen.getByText(/scrapTimeInfo/i))!.toBeInTheDocument()})})@@ -1384,7 +1423,7 @@ describe('WaterCrawl', () => {await userEvent.click(screen.getByRole('button', { name: /run/i }))await waitFor(() => {- expect(screen.getByText('Result Page')).toBeInTheDocument()+ expect(screen.getByText('Result Page'))!.toBeInTheDocument()})})@@ -1403,7 +1442,7 @@ describe('WaterCrawl', () => {await userEvent.click(screen.getByRole('button', { name: /run/i }))await waitFor(() => {- expect(screen.getByText('datasetCreation.stepOne.website.exceptionErrorTitle')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepOne.website.exceptionErrorTitle'))!.toBeInTheDocument()})})@@ -1515,8 +1554,8 @@ describe('WaterCrawl', () => {// Assert - final results should be displayedawait waitFor(() => {- expect(screen.getByText('Page 1')).toBeInTheDocument()- expect(screen.getByText('Page 5')).toBeInTheDocument()+ expect(screen.getByText('Page 1'))!.toBeInTheDocument()+ expect(screen.getByText('Page 5'))!.toBeInTheDocument()})// Assert - checked results should be updated@@ -1550,7 +1589,7 @@ describe('WaterCrawl', () => {// Wait for resultsawait waitFor(() => {- expect(screen.getByText('Single')).toBeInTheDocument()+ expect(screen.getByText('Single'))!.toBeInTheDocument()})const selectAllCheckbox = screen.getByText(/selectAll|resetAll/i)@@ -1596,7 +1635,7 @@ describe('WaterCrawl', () => {// Step 3: Wait for completionawait waitFor(() => {- expect(screen.getByText('Preview Page')).toBeInTheDocument()+ expect(screen.getByText('Preview Page'))!.toBeInTheDocument()})// Step 4: Click previewdiff --git a/web/app/components/datasets/create/website/watercrawl/__tests__/options.spec.tsx b/web/app/components/datasets/create/website/watercrawl/__tests__/options.spec.tsxindex bda01dc152e..b65df109ad3 100644--- a/web/app/components/datasets/create/website/watercrawl/__tests__/options.spec.tsx+++ b/web/app/components/datasets/create/website/watercrawl/__tests__/options.spec.tsx@@ -34,12 +34,12 @@ describe('Options (watercrawl)', () => {const payload = createMockCrawlOptions()render(<Options payload={payload} onChange={mockOnChange} />)- expect(screen.getByText(/crawlSubPage/i)).toBeInTheDocument()- expect(screen.getByText(/extractOnlyMainContent/i)).toBeInTheDocument()- expect(screen.getByText(/limit/i)).toBeInTheDocument()- expect(screen.getByText(/maxDepth/i)).toBeInTheDocument()- expect(screen.getByText(/excludePaths/i)).toBeInTheDocument()- expect(screen.getByText(/includeOnlyPaths/i)).toBeInTheDocument()+ expect(screen.getByText(/crawlSubPage/i))!.toBeInTheDocument()+ expect(screen.getByText(/extractOnlyMainContent/i))!.toBeInTheDocument()+ expect(screen.getByText(/limit/i))!.toBeInTheDocument()+ expect(screen.getByText(/maxDepth/i))!.toBeInTheDocument()+ expect(screen.getByText(/excludePaths/i))!.toBeInTheDocument()+ expect(screen.getByText(/includeOnlyPaths/i))!.toBeInTheDocument()})it('should render two checkboxes', () => {@@ -55,21 +55,21 @@ describe('Options (watercrawl)', () => {render(<Options payload={payload} onChange={mockOnChange} />)const requiredIndicator = screen.getByText('*')- expect(requiredIndicator).toBeInTheDocument()+ expect(requiredIndicator)!.toBeInTheDocument()})it('should render placeholder for excludes field', () => {const payload = createMockCrawlOptions()render(<Options payload={payload} onChange={mockOnChange} />)- expect(screen.getByPlaceholderText('blog/*, /about/*')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('blog/*, /about/*'))!.toBeInTheDocument()})it('should render placeholder for includes field', () => {const payload = createMockCrawlOptions()render(<Options payload={payload} onChange={mockOnChange} />)- expect(screen.getByPlaceholderText('articles/*')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('articles/*'))!.toBeInTheDocument()})it('should render with custom className', () => {@@ -79,7 +79,7 @@ describe('Options (watercrawl)', () => {)const rootElement = container.firstChild as HTMLElement- expect(rootElement).toHaveClass('custom-class')+ expect(rootElement)!.toHaveClass('custom-class')})})@@ -89,7 +89,7 @@ describe('Options (watercrawl)', () => {const payload = createMockCrawlOptions({ crawl_sub_pages: true })render(<Options payload={payload} onChange={mockOnChange} />)- expect(screen.getByTestId('check-icon-crawl-sub-pages')).toBeInTheDocument()+ expect(screen.getByTestId('check-icon-crawl-sub-pages'))!.toBeInTheDocument()})it('should display crawl_sub_pages checkbox without check icon when false', () => {@@ -97,13 +97,13 @@ describe('Options (watercrawl)', () => {const { container } = render(<Options payload={payload} onChange={mockOnChange} />)const checkboxes = getCheckboxes(container)- expect(checkboxes[0].querySelector('svg')).not.toBeInTheDocument()+ expect(checkboxes[0]!.querySelector('svg')).not.toBeInTheDocument()})it('should display only_main_content checkbox with check icon when true', () => {const payload = createMockCrawlOptions({ only_main_content: true })render(<Options payload={payload} onChange={mockOnChange} />)- expect(screen.getByTestId('check-icon-only-main-content')).toBeInTheDocument()+ expect(screen.getByTestId('check-icon-only-main-content'))!.toBeInTheDocument()})it('should display only_main_content checkbox without check icon when false', () => {@@ -111,35 +111,35 @@ describe('Options (watercrawl)', () => {const { container } = render(<Options payload={payload} onChange={mockOnChange} />)const checkboxes = getCheckboxes(container)- expect(checkboxes[1].querySelector('svg')).not.toBeInTheDocument()+ expect(checkboxes[1]!.querySelector('svg')).not.toBeInTheDocument()})it('should display limit value in input', () => {const payload = createMockCrawlOptions({ limit: 25 })render(<Options payload={payload} onChange={mockOnChange} />)- expect(screen.getByDisplayValue('25')).toBeInTheDocument()+ expect(screen.getByDisplayValue('25'))!.toBeInTheDocument()})it('should display max_depth value in input', () => {const payload = createMockCrawlOptions({ max_depth: 5 })render(<Options payload={payload} onChange={mockOnChange} />)- expect(screen.getByDisplayValue('5')).toBeInTheDocument()+ expect(screen.getByDisplayValue('5'))!.toBeInTheDocument()})it('should display excludes value in input', () => {const payload = createMockCrawlOptions({ excludes: 'test/*' })render(<Options payload={payload} onChange={mockOnChange} />)- expect(screen.getByDisplayValue('test/*')).toBeInTheDocument()+ expect(screen.getByDisplayValue('test/*'))!.toBeInTheDocument()})it('should display includes value in input', () => {const payload = createMockCrawlOptions({ includes: 'docs/*' })render(<Options payload={payload} onChange={mockOnChange} />)- expect(screen.getByDisplayValue('docs/*')).toBeInTheDocument()+ expect(screen.getByDisplayValue('docs/*'))!.toBeInTheDocument()})})@@ -149,7 +149,7 @@ describe('Options (watercrawl)', () => {const { container } = render(<Options payload={payload} onChange={mockOnChange} />)const checkboxes = getCheckboxes(container)- fireEvent.click(checkboxes[0])+ fireEvent.click(checkboxes[0]!)expect(mockOnChange).toHaveBeenCalledWith({...payload,@@ -162,7 +162,7 @@ describe('Options (watercrawl)', () => {const { container } = render(<Options payload={payload} onChange={mockOnChange} />)const checkboxes = getCheckboxes(container)- fireEvent.click(checkboxes[1])+ fireEvent.click(checkboxes[1]!)expect(mockOnChange).toHaveBeenCalledWith({...payload,@@ -264,10 +264,10 @@ describe('Options (watercrawl)', () => {const payload2 = createMockCrawlOptions({ limit: 20 })const { rerender } = render(<Options payload={payload1} onChange={mockOnChange} />)- expect(screen.getByDisplayValue('10')).toBeInTheDocument()+ expect(screen.getByDisplayValue('10'))!.toBeInTheDocument()rerender(<Options payload={payload2} onChange={mockOnChange} />)- expect(screen.getByDisplayValue('20')).toBeInTheDocument()+ expect(screen.getByDisplayValue('20'))!.toBeInTheDocument()})})})diff --git a/web/app/components/datasets/documents/components/__tests__/operations.spec.tsx b/web/app/components/datasets/documents/components/__tests__/operations.spec.tsxindex 0d60ef86dbf..c89059d1852 100644--- a/web/app/components/datasets/documents/components/__tests__/operations.spec.tsx+++ b/web/app/components/datasets/documents/components/__tests__/operations.spec.tsx@@ -105,7 +105,7 @@ describe('Operations', () => {describe('rendering', () => {it('should render without crashing', () => {render(<Operations {...defaultProps} />)- expect(document.querySelector('.flex.items-center')).toBeInTheDocument()+ expect(document.querySelector('.flex.items-center'))!.toBeInTheDocument()})it('should render buttons when embeddingAvailable', () => {@@ -122,7 +122,7 @@ describe('Operations', () => {it('should render disabled switch when embeddingAvailable is false in list scene', () => {render(<Operations {...defaultProps} embeddingAvailable={false} scene="list" />)const disabledSwitch = screen.getByRole('switch')- expect(disabledSwitch).toHaveAttribute('aria-disabled', 'true')+ expect(disabledSwitch)!.toHaveAttribute('aria-disabled', 'true')})})@@ -209,7 +209,7 @@ describe('Operations', () => {const buttons = screen.getAllByRole('button')const settingsButton = buttons[0]await act(async () => {- fireEvent.click(settingsButton)+ fireEvent.click(settingsButton!)})expect(mockPush).toHaveBeenCalledWith('/datasets/dataset-1/documents/doc-1/settings')})@@ -219,7 +219,7 @@ describe('Operations', () => {it('should render differently in detail scene', () => {render(<Operations {...defaultProps} scene="detail" />)const container = document.querySelector('.flex.items-center')- expect(container).toBeInTheDocument()+ expect(container)!.toBeInTheDocument()})it('should not render switch in detail scene', () => {@@ -239,7 +239,7 @@ describe('Operations', () => {onSelectedIdChange={mockOnSelectedIdChange}/>,)- expect(document.querySelector('.flex.items-center')).toBeInTheDocument()+ expect(document.querySelector('.flex.items-center'))!.toBeInTheDocument()})})@@ -257,7 +257,8 @@ describe('Operations', () => {render(<Operations {...defaultProps} />)await openPopover()// Check if popover content is visible- expect(screen.getByText('datasetDocuments.list.table.rename')).toBeInTheDocument()+ // Check if popover content is visible+ expect(screen.getByText('datasetDocuments.list.table.rename'))!.toBeInTheDocument()})it('should call archive when archive action is clicked', async () => {@@ -297,7 +298,8 @@ describe('Operations', () => {fireEvent.click(deleteButton)})// Check if confirmation modal is shown- expect(screen.getByText('datasetDocuments.list.delete.title')).toBeInTheDocument()+ // Check if confirmation modal is shown+ expect(screen.getByText('datasetDocuments.list.delete.title'))!.toBeInTheDocument()})it('should call delete when confirm is clicked in delete modal', async () => {@@ -324,7 +326,8 @@ describe('Operations', () => {fireEvent.click(deleteButton)})// Verify modal is shown- expect(screen.getByText('datasetDocuments.list.delete.title')).toBeInTheDocument()+ // Verify modal is shown+ expect(screen.getByText('datasetDocuments.list.delete.title'))!.toBeInTheDocument()// Find and click the cancel buttonconst cancelButton = screen.getByText('common.operation.cancel')await act(async () => {@@ -366,7 +369,7 @@ describe('Operations', () => {await user.click(renameAction)const renameInput = await screen.findByRole('textbox')- expect(renameInput).toHaveValue('Test Document')+ expect(renameInput)!.toHaveValue('Test Document')})it('should call sync for notion data source', async () => {@@ -458,7 +461,7 @@ describe('Operations', () => {/>,)await openPopover()- expect(screen.getByText('datasetDocuments.list.action.download')).toBeInTheDocument()+ expect(screen.getByText('datasetDocuments.list.action.download'))!.toBeInTheDocument()})it('should download archived file when download is clicked', async () => {@@ -543,7 +546,7 @@ describe('Operations', () => {detail={{ ...defaultDetail, display_status: 'indexing' }}/>,)- expect(document.querySelector('.flex.items-center')).toBeInTheDocument()+ expect(document.querySelector('.flex.items-center'))!.toBeInTheDocument()})it('should render resume action when status is paused', () => {@@ -553,7 +556,7 @@ describe('Operations', () => {detail={{ ...defaultDetail, display_status: 'paused' }}/>,)- expect(document.querySelector('.flex.items-center')).toBeInTheDocument()+ expect(document.querySelector('.flex.items-center'))!.toBeInTheDocument()})it('should not show pause/resume for available status', async () => {@@ -582,7 +585,7 @@ describe('Operations', () => {detail={{ ...defaultDetail, data_source_type: 'notion_import' }}/>,)- expect(document.querySelector('.flex.items-center')).toBeInTheDocument()+ expect(document.querySelector('.flex.items-center'))!.toBeInTheDocument()})it('should handle web data source type', () => {@@ -592,7 +595,7 @@ describe('Operations', () => {detail={{ ...defaultDetail, data_source_type: 'website_crawl' }}/>,)- expect(document.querySelector('.flex.items-center')).toBeInTheDocument()+ expect(document.querySelector('.flex.items-center'))!.toBeInTheDocument()})it('should not show download for non-file data source', async () => {@@ -622,7 +625,7 @@ describe('Operations', () => {it('should accept custom className prop', () => {// The className is passed to CustomPopover, verify component renders without errorsrender(<Operations {...defaultProps} className="custom-class" />)- expect(document.querySelector('.flex.items-center')).toBeInTheDocument()+ expect(document.querySelector('.flex.items-center'))!.toBeInTheDocument()})})})diff --git a/web/app/components/datasets/documents/components/document-list/__tests__/index.spec.tsx b/web/app/components/datasets/documents/components/document-list/__tests__/index.spec.tsxindex 97ae1c92a13..01d62994926 100644--- a/web/app/components/datasets/documents/components/document-list/__tests__/index.spec.tsx+++ b/web/app/components/datasets/documents/components/document-list/__tests__/index.spec.tsx@@ -112,25 +112,26 @@ describe('DocumentList', () => {describe('Rendering', () => {it('should render without crashing', () => {render(<DocumentList {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByRole('table')).toBeInTheDocument()+ expect(screen.getByRole('table'))!.toBeInTheDocument()})it('should render all documents', () => {render(<DocumentList {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByText('Document 1.txt')).toBeInTheDocument()- expect(screen.getByText('Document 2.txt')).toBeInTheDocument()- expect(screen.getByText('Document 3.txt')).toBeInTheDocument()+ expect(screen.getByText('Document 1.txt'))!.toBeInTheDocument()+ expect(screen.getByText('Document 2.txt'))!.toBeInTheDocument()+ expect(screen.getByText('Document 3.txt'))!.toBeInTheDocument()})it('should render table headers', () => {render(<DocumentList {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByText('#')).toBeInTheDocument()+ expect(screen.getByText('#'))!.toBeInTheDocument()})it('should render pagination when total is provided', () => {render(<DocumentList {...defaultProps} />, { wrapper: createWrapper() })// Pagination component should be present- expect(screen.getByRole('table')).toBeInTheDocument()+ // Pagination component should be present+ expect(screen.getByRole('table'))!.toBeInTheDocument()})it('should not render pagination when total is 0', () => {@@ -139,13 +140,13 @@ describe('DocumentList', () => {pagination: { ...defaultPagination, total: 0 },}render(<DocumentList {...props} />, { wrapper: createWrapper() })- expect(screen.getByRole('table')).toBeInTheDocument()+ expect(screen.getByRole('table'))!.toBeInTheDocument()})it('should render empty table when no documents', () => {const props = { ...defaultProps, documents: [] }render(<DocumentList {...props} />, { wrapper: createWrapper() })- expect(screen.getByRole('table')).toBeInTheDocument()+ expect(screen.getByRole('table'))!.toBeInTheDocument()})})@@ -165,7 +166,8 @@ describe('DocumentList', () => {const props = { ...defaultProps, embeddingAvailable: false }render(<DocumentList {...props} />, { wrapper: createWrapper() })// Row checkboxes should still be there, but header checkbox should be hidden- expect(screen.getByRole('table')).toBeInTheDocument()+ // Row checkboxes should still be there, but header checkbox should be hidden+ expect(screen.getByRole('table'))!.toBeInTheDocument()})it('should call onSelectedIdChange when select all is clicked', () => {@@ -175,7 +177,7 @@ describe('DocumentList', () => {const checkboxes = findCheckboxes(container)if (checkboxes.length > 0) {- fireEvent.click(checkboxes[0])+ fireEvent.click(checkboxes[0]!)expect(onSelectedIdChange).toHaveBeenCalled()}})@@ -190,7 +192,7 @@ describe('DocumentList', () => {// When checked, checkbox should have a check icon (svg) insideprops.selectedIds.forEach((id) => {const checkIcon = screen.getByTestId(`check-icon-doc-row-${id}`)- expect(checkIcon).toBeInTheDocument()+ expect(checkIcon)!.toBeInTheDocument()})})@@ -206,7 +208,9 @@ describe('DocumentList', () => {expect(checkboxes.length).toBeGreaterThan(0)// Header checkbox should show indeterminate icon, not check icon// Just verify it's rendered- expect(checkboxes[0]).toBeInTheDocument()+ // Header checkbox should show indeterminate icon, not check icon+ // Just verify it's rendered+ expect(checkboxes[0])!.toBeInTheDocument()})it('should call onSelectedIdChange with single document when row checkbox is clicked', () => {@@ -216,7 +220,7 @@ describe('DocumentList', () => {const checkboxes = findCheckboxes(container)if (checkboxes.length > 1) {- fireEvent.click(checkboxes[1])+ fireEvent.click(checkboxes[1]!)expect(onSelectedIdChange).toHaveBeenCalled()}})@@ -236,7 +240,7 @@ describe('DocumentList', () => {const sortableHeaders = container.querySelectorAll('thead button')if (sortableHeaders.length > 0)- fireEvent.click(sortableHeaders[0])+ fireEvent.click(sortableHeaders[0]!)expect(onSortChange).toHaveBeenCalled()})@@ -251,14 +255,16 @@ describe('DocumentList', () => {render(<DocumentList {...props} />, { wrapper: createWrapper() })// BatchAction component should be visible- expect(screen.getByRole('table')).toBeInTheDocument()+ // BatchAction component should be visible+ expect(screen.getByRole('table'))!.toBeInTheDocument()})it('should not show batch action bar when no documents selected', () => {render(<DocumentList {...defaultProps} />, { wrapper: createWrapper() })// BatchAction should not be present- expect(screen.getByRole('table')).toBeInTheDocument()+ // BatchAction should not be present+ expect(screen.getByRole('table'))!.toBeInTheDocument()})it('should render batch action bar with archive option', () => {@@ -269,7 +275,8 @@ describe('DocumentList', () => {render(<DocumentList {...props} />, { wrapper: createWrapper() })// BatchAction component should be visible when documents are selected- expect(screen.getByRole('table')).toBeInTheDocument()+ // BatchAction component should be visible when documents are selected+ expect(screen.getByRole('table'))!.toBeInTheDocument()})it('should render batch action bar with enable option', () => {@@ -279,7 +286,7 @@ describe('DocumentList', () => {}render(<DocumentList {...props} />, { wrapper: createWrapper() })- expect(screen.getByRole('table')).toBeInTheDocument()+ expect(screen.getByRole('table'))!.toBeInTheDocument()})it('should render batch action bar with disable option', () => {@@ -289,7 +296,7 @@ describe('DocumentList', () => {}render(<DocumentList {...props} />, { wrapper: createWrapper() })- expect(screen.getByRole('table')).toBeInTheDocument()+ expect(screen.getByRole('table'))!.toBeInTheDocument()})it('should render batch action bar with delete option', () => {@@ -299,7 +306,7 @@ describe('DocumentList', () => {}render(<DocumentList {...props} />, { wrapper: createWrapper() })- expect(screen.getByRole('table')).toBeInTheDocument()+ expect(screen.getByRole('table'))!.toBeInTheDocument()})it('should clear selection when cancel is clicked', () => {@@ -329,7 +336,8 @@ describe('DocumentList', () => {render(<DocumentList {...props} />, { wrapper: createWrapper() })// BatchAction should be visible- expect(screen.getByRole('table')).toBeInTheDocument()+ // BatchAction should be visible+ expect(screen.getByRole('table'))!.toBeInTheDocument()})it('should show re-index option for error documents', () => {@@ -343,7 +351,8 @@ describe('DocumentList', () => {render(<DocumentList {...props} />, { wrapper: createWrapper() })// BatchAction with re-index should be present for error documents- expect(screen.getByRole('table')).toBeInTheDocument()+ // BatchAction with re-index should be present for error documents+ expect(screen.getByRole('table'))!.toBeInTheDocument()})})@@ -354,7 +363,7 @@ describe('DocumentList', () => {const rows = screen.getAllByRole('row')// First row is header, second row is first documentif (rows.length > 1) {- fireEvent.click(rows[1])+ fireEvent.click(rows[1]!)expect(mockPush).toHaveBeenCalledWith('/datasets/dataset-1/documents/doc-1')}})@@ -376,11 +385,11 @@ describe('DocumentList', () => {const renameButtons = container.querySelectorAll('.cursor-pointer.rounded-md')if (renameButtons.length > 0) {await act(async () => {- fireEvent.click(renameButtons[0])+ fireEvent.click(renameButtons[0]!)})}- expect(screen.getByRole('dialog', { name: 'datasetDocuments.list.table.rename' })).toBeInTheDocument()+ expect(screen.getByRole('dialog', { name: 'datasetDocuments.list.table.rename' }))!.toBeInTheDocument()})it('should call onUpdate when document is renamed', () => {@@ -389,7 +398,8 @@ describe('DocumentList', () => {render(<DocumentList {...props} />, { wrapper: createWrapper() })// The handleRenamed callback wraps onUpdate- expect(screen.getByRole('table')).toBeInTheDocument()+ // The handleRenamed callback wraps onUpdate+ expect(screen.getByRole('table'))!.toBeInTheDocument()})})@@ -408,7 +418,7 @@ describe('DocumentList', () => {})}- expect(screen.getByRole('table')).toBeInTheDocument()+ expect(screen.getByRole('table'))!.toBeInTheDocument()})it('should call onManageMetadata when manage metadata is triggered', () => {@@ -421,26 +431,27 @@ describe('DocumentList', () => {render(<DocumentList {...props} />, { wrapper: createWrapper() })// The onShowManage callback in EditMetadataBatchModal should call hideEditModal then onManageMetadata- expect(screen.getByRole('table')).toBeInTheDocument()+ // The onShowManage callback in EditMetadataBatchModal should call hideEditModal then onManageMetadata+ expect(screen.getByRole('table'))!.toBeInTheDocument()})})describe('Chunking Mode', () => {it('should render with general mode', () => {render(<DocumentList {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByRole('table')).toBeInTheDocument()+ expect(screen.getByRole('table'))!.toBeInTheDocument()})it('should render with QA mode', () => {// This test uses the default mock which returns ChunkingMode.text// The component will compute isQAMode based on doc_formrender(<DocumentList {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByRole('table')).toBeInTheDocument()+ expect(screen.getByRole('table'))!.toBeInTheDocument()})it('should render with parent-child mode', () => {render(<DocumentList {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByRole('table')).toBeInTheDocument()+ expect(screen.getByRole('table'))!.toBeInTheDocument()})})@@ -449,7 +460,7 @@ describe('DocumentList', () => {const props = { ...defaultProps, documents: [] }render(<DocumentList {...props} />, { wrapper: createWrapper() })- expect(screen.getByRole('table')).toBeInTheDocument()+ expect(screen.getByRole('table'))!.toBeInTheDocument()})it('should handle documents with missing optional fields', () => {@@ -463,7 +474,7 @@ describe('DocumentList', () => {}render(<DocumentList {...props} />, { wrapper: createWrapper() })- expect(screen.getByRole('table')).toBeInTheDocument()+ expect(screen.getByRole('table'))!.toBeInTheDocument()})it('should handle remote sort value', () => {@@ -473,7 +484,7 @@ describe('DocumentList', () => {}render(<DocumentList {...props} />, { wrapper: createWrapper() })- expect(screen.getByRole('table')).toBeInTheDocument()+ expect(screen.getByRole('table'))!.toBeInTheDocument()})it('should handle large number of documents', () => {@@ -482,7 +493,7 @@ describe('DocumentList', () => {const props = { ...defaultProps, documents: manyDocs }render(<DocumentList {...props} />, { wrapper: createWrapper() })- expect(screen.getByRole('table')).toBeInTheDocument()+ expect(screen.getByRole('table'))!.toBeInTheDocument()}, 10000)})})diff --git a/web/app/components/datasets/documents/components/document-list/components/__tests__/document-table-row.spec.tsx b/web/app/components/datasets/documents/components/document-list/components/__tests__/document-table-row.spec.tsxindex d5e4f480bea..b6b02ed8292 100644--- a/web/app/components/datasets/documents/components/document-list/components/__tests__/document-table-row.spec.tsx+++ b/web/app/components/datasets/documents/components/document-list/components/__tests__/document-table-row.spec.tsx@@ -103,23 +103,23 @@ describe('DocumentTableRow', () => {describe('Rendering', () => {it('should render without crashing', () => {render(<DocumentTableRow {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByText('test-document.txt')).toBeInTheDocument()+ expect(screen.getByText('test-document.txt'))!.toBeInTheDocument()})it('should render index number correctly', () => {render(<DocumentTableRow {...defaultProps} index={5} />, { wrapper: createWrapper() })- expect(screen.getByText('6')).toBeInTheDocument()+ expect(screen.getByText('6'))!.toBeInTheDocument()})it('should render document name with tooltip', () => {render(<DocumentTableRow {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByText('test-document.txt')).toBeInTheDocument()+ expect(screen.getByText('test-document.txt'))!.toBeInTheDocument()})it('should render checkbox element', () => {const { container } = render(<DocumentTableRow {...defaultProps} />, { wrapper: createWrapper() })const checkbox = findCheckbox(container)- expect(checkbox).toBeInTheDocument()+ expect(checkbox)!.toBeInTheDocument()})})@@ -127,14 +127,14 @@ describe('DocumentTableRow', () => {it('should show check icon when isSelected is true', () => {const { container } = render(<DocumentTableRow {...defaultProps} isSelected />, { wrapper: createWrapper() })const checkbox = findCheckbox(container)- expect(checkbox).toBeInTheDocument()- expect(screen.getByTestId('check-icon-doc-row-doc-1')).toBeInTheDocument()+ expect(checkbox)!.toBeInTheDocument()+ expect(screen.getByTestId('check-icon-doc-row-doc-1'))!.toBeInTheDocument()})it('should not show check icon when isSelected is false', () => {const { container } = render(<DocumentTableRow {...defaultProps} isSelected={false} />, { wrapper: createWrapper() })const checkbox = findCheckbox(container)- expect(checkbox).toBeInTheDocument()+ expect(checkbox)!.toBeInTheDocument()expect(screen.queryByTestId('check-icon-doc-row-doc-1')).not.toBeInTheDocument()})@@ -200,13 +200,13 @@ describe('DocumentTableRow', () => {it('should display word count less than 1000 as is', () => {const doc = createMockDoc({ word_count: 500 })render(<DocumentTableRow {...defaultProps} doc={doc} />, { wrapper: createWrapper() })- expect(screen.getByText('500')).toBeInTheDocument()+ expect(screen.getByText('500'))!.toBeInTheDocument()})it('should display word count 1000 or more in k format', () => {const doc = createMockDoc({ word_count: 1500 })render(<DocumentTableRow {...defaultProps} doc={doc} />, { wrapper: createWrapper() })- expect(screen.getByText('1.5k')).toBeInTheDocument()+ expect(screen.getByText('1.5k'))!.toBeInTheDocument()})it('should display 0 with empty style when word_count is 0', () => {@@ -219,7 +219,7 @@ describe('DocumentTableRow', () => {it('should handle undefined word_count', () => {const doc = createMockDoc({ word_count: undefined as unknown as number })const { container } = render(<DocumentTableRow {...defaultProps} doc={doc} />, { wrapper: createWrapper() })- expect(container).toBeInTheDocument()+ expect(container)!.toBeInTheDocument()})})@@ -227,13 +227,13 @@ describe('DocumentTableRow', () => {it('should display hit count less than 1000 as is', () => {const doc = createMockDoc({ hit_count: 100 })render(<DocumentTableRow {...defaultProps} doc={doc} />, { wrapper: createWrapper() })- expect(screen.getByText('100')).toBeInTheDocument()+ expect(screen.getByText('100'))!.toBeInTheDocument()})it('should display hit count 1000 or more in k format', () => {const doc = createMockDoc({ hit_count: 2500 })render(<DocumentTableRow {...defaultProps} doc={doc} />, { wrapper: createWrapper() })- expect(screen.getByText('2.5k')).toBeInTheDocument()+ expect(screen.getByText('2.5k'))!.toBeInTheDocument()})it('should display 0 with empty style when hit_count is 0', () => {@@ -248,12 +248,13 @@ describe('DocumentTableRow', () => {it('should render ChunkingModeLabel with general mode', () => {render(<DocumentTableRow {...defaultProps} isGeneralMode isQAMode={false} />, { wrapper: createWrapper() })// ChunkingModeLabel should be rendered- expect(screen.getByRole('row')).toBeInTheDocument()+ // ChunkingModeLabel should be rendered+ expect(screen.getByRole('row'))!.toBeInTheDocument()})it('should render ChunkingModeLabel with QA mode', () => {render(<DocumentTableRow {...defaultProps} isGeneralMode={false} isQAMode />, { wrapper: createWrapper() })- expect(screen.getByRole('row')).toBeInTheDocument()+ expect(screen.getByRole('row'))!.toBeInTheDocument()})})@@ -261,13 +262,13 @@ describe('DocumentTableRow', () => {it('should render SummaryStatus when summary_index_status is present', () => {const doc = createMockDoc({ summary_index_status: 'completed' })render(<DocumentTableRow {...defaultProps} doc={doc} />, { wrapper: createWrapper() })- expect(screen.getByRole('row')).toBeInTheDocument()+ expect(screen.getByRole('row'))!.toBeInTheDocument()})it('should not render SummaryStatus when summary_index_status is absent', () => {const doc = createMockDoc({ summary_index_status: undefined })render(<DocumentTableRow {...defaultProps} doc={doc} />, { wrapper: createWrapper() })- expect(screen.getByRole('row')).toBeInTheDocument()+ expect(screen.getByRole('row'))!.toBeInTheDocument()})})@@ -282,7 +283,7 @@ describe('DocumentTableRow', () => {// Find the rename button by finding the RiEditLine icon's parentconst renameButtons = container.querySelectorAll('.cursor-pointer.rounded-md')if (renameButtons.length > 0) {- fireEvent.click(renameButtons[0])+ fireEvent.click(renameButtons[0]!)expect(onShowRenameModal).toHaveBeenCalledWith(defaultProps.doc)expect(mockPush).not.toHaveBeenCalled()}@@ -292,13 +293,13 @@ describe('DocumentTableRow', () => {describe('Operations', () => {it('should pass selectedIds to Operations component', () => {render(<DocumentTableRow {...defaultProps} selectedIds={['doc-1', 'doc-2']} />, { wrapper: createWrapper() })- expect(screen.getByRole('row')).toBeInTheDocument()+ expect(screen.getByRole('row'))!.toBeInTheDocument()})it('should pass onSelectedIdChange to Operations component', () => {const onSelectedIdChange = vi.fn()render(<DocumentTableRow {...defaultProps} onSelectedIdChange={onSelectedIdChange} />, { wrapper: createWrapper() })- expect(screen.getByRole('row')).toBeInTheDocument()+ expect(screen.getByRole('row'))!.toBeInTheDocument()})})@@ -306,7 +307,7 @@ describe('DocumentTableRow', () => {it('should render with FILE data source type', () => {const doc = createMockDoc({ data_source_type: DataSourceType.FILE })render(<DocumentTableRow {...defaultProps} doc={doc} />, { wrapper: createWrapper() })- expect(screen.getByRole('row')).toBeInTheDocument()+ expect(screen.getByRole('row'))!.toBeInTheDocument()})it('should render with NOTION data source type', () => {@@ -315,13 +316,13 @@ describe('DocumentTableRow', () => {data_source_info: { notion_page_icon: 'icon.png' },})render(<DocumentTableRow {...defaultProps} doc={doc} />, { wrapper: createWrapper() })- expect(screen.getByRole('row')).toBeInTheDocument()+ expect(screen.getByRole('row'))!.toBeInTheDocument()})it('should render with WEB data source type', () => {const doc = createMockDoc({ data_source_type: DataSourceType.WEB })render(<DocumentTableRow {...defaultProps} doc={doc} />, { wrapper: createWrapper() })- expect(screen.getByRole('row')).toBeInTheDocument()+ expect(screen.getByRole('row'))!.toBeInTheDocument()})})@@ -329,13 +330,13 @@ describe('DocumentTableRow', () => {it('should handle document with very long name', () => {const doc = createMockDoc({ name: `${'a'.repeat(500)}.txt` })render(<DocumentTableRow {...defaultProps} doc={doc} />, { wrapper: createWrapper() })- expect(screen.getByRole('row')).toBeInTheDocument()+ expect(screen.getByRole('row'))!.toBeInTheDocument()})it('should handle document with special characters in name', () => {const doc = createMockDoc({ name: '<script>test</script>.txt' })render(<DocumentTableRow {...defaultProps} doc={doc} />, { wrapper: createWrapper() })- expect(screen.getByText('<script>test</script>.txt')).toBeInTheDocument()+ expect(screen.getByText('<script>test</script>.txt'))!.toBeInTheDocument()})it('should memoize the component', () => {@@ -343,7 +344,7 @@ describe('DocumentTableRow', () => {const { rerender } = render(<DocumentTableRow {...defaultProps} />, { wrapper })rerender(<DocumentTableRow {...defaultProps} />)- expect(screen.getByRole('row')).toBeInTheDocument()+ expect(screen.getByRole('row'))!.toBeInTheDocument()})})})diff --git a/web/app/components/datasets/documents/components/document-list/components/document-source-icon.tsx b/web/app/components/datasets/documents/components/document-list/components/document-source-icon.tsxindex 5461f349212..0d51837cf29 100644--- a/web/app/components/datasets/documents/components/document-list/components/document-source-icon.tsx+++ b/web/app/components/datasets/documents/components/document-list/components/document-source-icon.tsx@@ -39,7 +39,7 @@ const getFileExtension = (fileName: string): string => {const parts = fileName.split('.')if (parts.length <= 1 || (parts[0] === '' && parts.length === 2))return ''- return parts[parts.length - 1].toLowerCase()+ return parts[parts.length - 1]!.toLowerCase()}const DocumentSourceIcon: FC<DocumentSourceIconProps> = React.memo(({diff --git a/web/app/components/datasets/documents/create-from-pipeline/__tests__/index.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/__tests__/index.spec.tsxindex 8a2e2517700..7daff43a8b2 100644--- a/web/app/components/datasets/documents/create-from-pipeline/__tests__/index.spec.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/__tests__/index.spec.tsx@@ -569,7 +569,7 @@ describe('StepOneContent', () => {it('should render VectorSpaceFull when isShowVectorSpaceFull is true', () => {render(<StepOneContent {...defaultProps} isShowVectorSpaceFull={true} />)- expect(screen.getByTestId('vector-space-full')).toBeInTheDocument()+ expect(screen.getByTestId('vector-space-full'))!.toBeInTheDocument()})it('should not render VectorSpaceFull when isShowVectorSpaceFull is false', () => {@@ -587,7 +587,7 @@ describe('StepOneContent', () => {localFileListLength={2}/>,)- expect(screen.getByTestId('upgrade-card')).toBeInTheDocument()+ expect(screen.getByTestId('upgrade-card'))!.toBeInTheDocument()})it('should not render UpgradeCard when supportBatchUpload is true', () => {@@ -618,7 +618,7 @@ describe('StepOneContent', () => {render(<StepOneContent {...defaultProps} nextBtnDisabled={true} />)const nextButton = screen.getByRole('button', { name: /datasetCreation.stepOne.button/i })- expect(nextButton).toBeDisabled()+ expect(nextButton)!.toBeDisabled()})})@@ -664,17 +664,17 @@ describe('StepTwoContent', () => {it('should render ProcessDocuments component', () => {render(<StepTwoContent {...defaultProps} />)- expect(screen.getByTestId('process-documents')).toBeInTheDocument()+ expect(screen.getByTestId('process-documents'))!.toBeInTheDocument()})it('should pass dataSourceNodeId to ProcessDocuments', () => {render(<StepTwoContent {...defaultProps} dataSourceNodeId="custom-node" />)- expect(screen.getByTestId('datasource-node-id')).toHaveTextContent('custom-node')+ expect(screen.getByTestId('datasource-node-id'))!.toHaveTextContent('custom-node')})it('should pass isRunning to ProcessDocuments', () => {render(<StepTwoContent {...defaultProps} isRunning={true} />)- expect(screen.getByTestId('is-running')).toHaveTextContent('true')+ expect(screen.getByTestId('is-running'))!.toHaveTextContent('true')})it('should call onProcess when process button is clicked', () => {@@ -709,18 +709,18 @@ describe('StepThreeContent', () => {it('should render Processing component', () => {render(<StepThreeContent batchId="batch-123" documents={[]} />)- expect(screen.getByTestId('processing')).toBeInTheDocument()+ expect(screen.getByTestId('processing'))!.toBeInTheDocument()})it('should pass batchId to Processing', () => {render(<StepThreeContent batchId="batch-123" documents={[]} />)- expect(screen.getByTestId('batch-id')).toHaveTextContent('batch-123')+ expect(screen.getByTestId('batch-id'))!.toHaveTextContent('batch-123')})it('should pass documents count to Processing', () => {const documents = [{ id: '1' }, { id: '2' }]render(<StepThreeContent batchId="batch-123" documents={documents as InitialDocumentDetail[]} />)- expect(screen.getByTestId('documents-count')).toHaveTextContent('2')+ expect(screen.getByTestId('documents-count'))!.toHaveTextContent('2')})})@@ -787,8 +787,8 @@ describe('StepOnePreview', () => {currentLocalFile={createMockFile()}/>,)- expect(screen.getByTestId('file-preview')).toBeInTheDocument()- expect(screen.getByTestId('file-name')).toHaveTextContent('test.txt')+ expect(screen.getByTestId('file-preview'))!.toBeInTheDocument()+ expect(screen.getByTestId('file-name'))!.toHaveTextContent('test.txt')})it('should render OnlineDocumentPreview when currentDocument is set', () => {@@ -799,7 +799,7 @@ describe('StepOnePreview', () => {currentDocument={createMockNotionPage()}/>,)- expect(screen.getByTestId('online-document-preview')).toBeInTheDocument()+ expect(screen.getByTestId('online-document-preview'))!.toBeInTheDocument()})it('should render WebsitePreview when currentWebsite is set', () => {@@ -809,7 +809,7 @@ describe('StepOnePreview', () => {currentWebsite={createMockCrawlResult()}/>,)- expect(screen.getByTestId('web-preview')).toBeInTheDocument()+ expect(screen.getByTestId('web-preview'))!.toBeInTheDocument()})it('should call hidePreviewLocalFile when hide button is clicked', () => {@@ -868,22 +868,22 @@ describe('StepTwoPreview', () => {it('should render ChunkPreview component', () => {render(<StepTwoPreview {...defaultProps} />)- expect(screen.getByTestId('chunk-preview')).toBeInTheDocument()+ expect(screen.getByTestId('chunk-preview'))!.toBeInTheDocument()})it('should pass datasourceType to ChunkPreview', () => {render(<StepTwoPreview {...defaultProps} datasourceType={DatasourceType.onlineDocument} />)- expect(screen.getByTestId('datasource-type')).toHaveTextContent(DatasourceType.onlineDocument)+ expect(screen.getByTestId('datasource-type'))!.toHaveTextContent(DatasourceType.onlineDocument)})it('should pass isIdle to ChunkPreview', () => {render(<StepTwoPreview {...defaultProps} isIdle={false} />)- expect(screen.getByTestId('is-idle')).toHaveTextContent('false')+ expect(screen.getByTestId('is-idle'))!.toHaveTextContent('false')})it('should pass isPendingPreview to ChunkPreview', () => {render(<StepTwoPreview {...defaultProps} isPendingPreview={true} />)- expect(screen.getByTestId('is-pending')).toHaveTextContent('true')+ expect(screen.getByTestId('is-pending'))!.toHaveTextContent('true')})it('should call onPreview when preview button is clicked', () => {@@ -1092,7 +1092,7 @@ describe('Store Hooks', () => {mockStoreState.selectedFileIds = ['file-1']const { result } = renderHook(() => useOnlineDrive())expect(result.current.selectedOnlineDriveFileList).toHaveLength(1)- expect(result.current.selectedOnlineDriveFileList[0].id).toBe('file-1')+ expect(result.current.selectedOnlineDriveFileList[0]!.id).toBe('file-1')})})})@@ -1166,8 +1166,8 @@ describe('useDatasourceOptions', () => {const { result } = renderHook(() => useDatasourceOptions(mockNodes))expect(result.current).toHaveLength(1)- expect(result.current[0].label).toBe('Local File Source')- expect(result.current[0].value).toBe('node-1')+ expect(result.current[0]!.label).toBe('Local File Source')+ expect(result.current[0]!.value).toBe('node-1')})it('should return multiple options for multiple data source nodes', () => {@@ -1616,7 +1616,7 @@ describe('StepOneContent - All Datasource Types', () => {datasourceType={DatasourceType.onlineDocument}/>,)- expect(screen.getByTestId('online-documents-component')).toBeInTheDocument()+ expect(screen.getByTestId('online-documents-component'))!.toBeInTheDocument()})it('should render WebsiteCrawl when datasourceType is websiteCrawl', () => {@@ -1632,7 +1632,7 @@ describe('StepOneContent - All Datasource Types', () => {datasourceType={DatasourceType.websiteCrawl}/>,)- expect(screen.getByTestId('website-crawl-component')).toBeInTheDocument()+ expect(screen.getByTestId('website-crawl-component'))!.toBeInTheDocument()})it('should render OnlineDrive when datasourceType is onlineDrive', () => {@@ -1648,7 +1648,7 @@ describe('StepOneContent - All Datasource Types', () => {datasourceType={DatasourceType.onlineDrive}/>,)- expect(screen.getByTestId('online-drive-component')).toBeInTheDocument()+ expect(screen.getByTestId('online-drive-component'))!.toBeInTheDocument()})it('should render LocalFile when datasourceType is localFile', () => {@@ -1659,7 +1659,7 @@ describe('StepOneContent - All Datasource Types', () => {datasourceType={DatasourceType.localFile}/>,)- expect(screen.getByTestId('local-file-component')).toBeInTheDocument()+ expect(screen.getByTestId('local-file-component'))!.toBeInTheDocument()})})@@ -1690,7 +1690,8 @@ describe('StepTwoPreview - File List Mapping', () => {)// ChunkPreview should be rendered- expect(screen.getByTestId('chunk-preview')).toBeInTheDocument()+ // ChunkPreview should be rendered+ expect(screen.getByTestId('chunk-preview'))!.toBeInTheDocument()})})diff --git a/web/app/components/datasets/documents/create-from-pipeline/__tests__/step-indicator.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/__tests__/step-indicator.spec.tsxindex 7103dced26a..7bffe3577ee 100644--- a/web/app/components/datasets/documents/create-from-pipeline/__tests__/step-indicator.spec.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/__tests__/step-indicator.spec.tsx@@ -19,14 +19,14 @@ describe('StepIndicator', () => {const { container } = render(<StepIndicator steps={steps} currentStep={2} />)const dots = container.querySelectorAll('.rounded-lg')// Second step (index 1) should be active- expect(dots[1].className).toContain('bg-state-accent-solid')- expect(dots[1].className).toContain('w-2')+ expect(dots[1]!.className).toContain('bg-state-accent-solid')+ expect(dots[1]!.className).toContain('w-2')})it('should not apply active style to non-current steps', () => {const { container } = render(<StepIndicator steps={steps} currentStep={1} />)const dots = container.querySelectorAll('.rounded-lg')- expect(dots[1].className).toContain('bg-divider-solid')- expect(dots[2].className).toContain('bg-divider-solid')+ expect(dots[1]!.className).toContain('bg-divider-solid')+ expect(dots[2]!.className).toContain('bg-divider-solid')})})diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source-options/__tests__/index.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source-options/__tests__/index.spec.tsxindex 0ac2dfce209..78542ad5229 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source-options/__tests__/index.spec.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source-options/__tests__/index.spec.tsx@@ -129,7 +129,7 @@ describe('DatasourceIcon', () => {it('should render without crashing', () => {const { container } = render(<DatasourceIcon iconUrl="https://example.com/icon.png" />)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})it('should render icon with background image', () => {@@ -138,15 +138,16 @@ describe('DatasourceIcon', () => {const { container } = render(<DatasourceIcon iconUrl={iconUrl} />)const iconDiv = container.querySelector('[style*="background-image"]')- expect(iconDiv).toHaveStyle({ backgroundImage: `url(${iconUrl})` })+ expect(iconDiv)!.toHaveStyle({ backgroundImage: `url(${iconUrl})` })})it('should render with default size (sm)', () => {const { container } = render(<DatasourceIcon iconUrl="https://example.com/icon.png" />)// Assert - Default size is 'sm' which maps to 'w-5 h-5'- expect(container.firstChild).toHaveClass('w-5')- expect(container.firstChild).toHaveClass('h-5')+ // Assert - Default size is 'sm' which maps to 'w-5 h-5'+ expect(container.firstChild)!.toHaveClass('w-5')+ expect(container.firstChild)!.toHaveClass('h-5')})})@@ -157,9 +158,9 @@ describe('DatasourceIcon', () => {<DatasourceIcon iconUrl="https://example.com/icon.png" size="xs" />,)- expect(container.firstChild).toHaveClass('w-4')- expect(container.firstChild).toHaveClass('h-4')- expect(container.firstChild).toHaveClass('rounded-[5px]')+ expect(container.firstChild)!.toHaveClass('w-4')+ expect(container.firstChild)!.toHaveClass('h-4')+ expect(container.firstChild)!.toHaveClass('rounded-[5px]')})it('should render with sm size', () => {@@ -167,9 +168,9 @@ describe('DatasourceIcon', () => {<DatasourceIcon iconUrl="https://example.com/icon.png" size="sm" />,)- expect(container.firstChild).toHaveClass('w-5')- expect(container.firstChild).toHaveClass('h-5')- expect(container.firstChild).toHaveClass('rounded-md')+ expect(container.firstChild)!.toHaveClass('w-5')+ expect(container.firstChild)!.toHaveClass('h-5')+ expect(container.firstChild)!.toHaveClass('rounded-md')})it('should render with md size', () => {@@ -177,9 +178,9 @@ describe('DatasourceIcon', () => {<DatasourceIcon iconUrl="https://example.com/icon.png" size="md" />,)- expect(container.firstChild).toHaveClass('w-6')- expect(container.firstChild).toHaveClass('h-6')- expect(container.firstChild).toHaveClass('rounded-lg')+ expect(container.firstChild)!.toHaveClass('w-6')+ expect(container.firstChild)!.toHaveClass('h-6')+ expect(container.firstChild)!.toHaveClass('rounded-lg')})})@@ -189,7 +190,7 @@ describe('DatasourceIcon', () => {<DatasourceIcon iconUrl="https://example.com/icon.png" className="custom-class" />,)- expect(container.firstChild).toHaveClass('custom-class')+ expect(container.firstChild)!.toHaveClass('custom-class')})it('should merge custom className with default classes', () => {@@ -197,9 +198,9 @@ describe('DatasourceIcon', () => {<DatasourceIcon iconUrl="https://example.com/icon.png" className="custom-class" size="sm" />,)- expect(container.firstChild).toHaveClass('custom-class')- expect(container.firstChild).toHaveClass('w-5')- expect(container.firstChild).toHaveClass('h-5')+ expect(container.firstChild)!.toHaveClass('custom-class')+ expect(container.firstChild)!.toHaveClass('w-5')+ expect(container.firstChild)!.toHaveClass('h-5')})})@@ -208,7 +209,7 @@ describe('DatasourceIcon', () => {const { container } = render(<DatasourceIcon iconUrl="" />)const iconDiv = container.querySelector('[style*="background-image"]')- expect(iconDiv).toHaveStyle({ backgroundImage: 'url()' })+ expect(iconDiv)!.toHaveStyle({ backgroundImage: 'url()' })})it('should handle special characters in iconUrl', () => {@@ -217,7 +218,7 @@ describe('DatasourceIcon', () => {const { container } = render(<DatasourceIcon iconUrl={iconUrl} />)const iconDiv = container.querySelector('[style*="background-image"]')- expect(iconDiv).toHaveStyle({ backgroundImage: `url(${iconUrl})` })+ expect(iconDiv)!.toHaveStyle({ backgroundImage: `url(${iconUrl})` })})it('should handle data URL as iconUrl', () => {@@ -226,7 +227,7 @@ describe('DatasourceIcon', () => {const { container } = render(<DatasourceIcon iconUrl={dataUrl} />)const iconDiv = container.querySelector('[style*="background-image"]')- expect(iconDiv).toBeInTheDocument()+ expect(iconDiv)!.toBeInTheDocument()})})})@@ -235,25 +236,26 @@ describe('DatasourceIcon', () => {it('should have flex container classes', () => {const { container } = render(<DatasourceIcon iconUrl="https://example.com/icon.png" />)- expect(container.firstChild).toHaveClass('flex')- expect(container.firstChild).toHaveClass('items-center')- expect(container.firstChild).toHaveClass('justify-center')+ expect(container.firstChild)!.toHaveClass('flex')+ expect(container.firstChild)!.toHaveClass('items-center')+ expect(container.firstChild)!.toHaveClass('justify-center')})it('should have shadow-xs class from size map', () => {const { container } = render(<DatasourceIcon iconUrl="https://example.com/icon.png" />)// Assert - Default size 'sm' has shadow-xs- expect(container.firstChild).toHaveClass('shadow-xs')+ // Assert - Default size 'sm' has shadow-xs+ expect(container.firstChild)!.toHaveClass('shadow-xs')})it('should have inner div with bg-cover class', () => {const { container } = render(<DatasourceIcon iconUrl="https://example.com/icon.png" />)const innerDiv = container.querySelector('.bg-cover')- expect(innerDiv).toBeInTheDocument()- expect(innerDiv).toHaveClass('bg-center')- expect(innerDiv).toHaveClass('rounded-md')+ expect(innerDiv)!.toBeInTheDocument()+ expect(innerDiv)!.toHaveClass('bg-center')+ expect(innerDiv)!.toHaveClass('rounded-md')})})})@@ -519,13 +521,13 @@ describe('OptionCard', () => {it('should render without crashing', () => {renderWithProviders(<OptionCard {...defaultProps} />)- expect(screen.getByText('Test Option')).toBeInTheDocument()+ expect(screen.getByText('Test Option'))!.toBeInTheDocument()})it('should render label text', () => {renderWithProviders(<OptionCard {...defaultProps} label="Custom Label" />)- expect(screen.getByText('Custom Label')).toBeInTheDocument()+ expect(screen.getByText('Custom Label'))!.toBeInTheDocument()})it('should render DatasourceIcon component', () => {@@ -533,7 +535,7 @@ describe('OptionCard', () => {// Assert - DatasourceIcon container should existconst iconContainer = container.querySelector('.size-8')- expect(iconContainer).toBeInTheDocument()+ expect(iconContainer)!.toBeInTheDocument()})it('should set title attribute for label truncation', () => {@@ -542,7 +544,7 @@ describe('OptionCard', () => {renderWithProviders(<OptionCard {...defaultProps} label={longLabel} />)const labelElement = screen.getByText(longLabel)- expect(labelElement).toHaveAttribute('title', longLabel)+ expect(labelElement)!.toHaveAttribute('title', longLabel)})})@@ -554,8 +556,8 @@ describe('OptionCard', () => {)const card = container.firstChild- expect(card).toHaveClass('border-components-option-card-option-selected-border')- expect(card).toHaveClass('bg-components-option-card-option-selected-bg')+ expect(card)!.toHaveClass('border-components-option-card-option-selected-border')+ expect(card)!.toHaveClass('bg-components-option-card-option-selected-bg')})it('should apply unselected styles when selected is false', () => {@@ -564,22 +566,22 @@ describe('OptionCard', () => {)const card = container.firstChild- expect(card).toHaveClass('border-components-option-card-option-border')- expect(card).toHaveClass('bg-components-option-card-option-bg')+ expect(card)!.toHaveClass('border-components-option-card-option-border')+ expect(card)!.toHaveClass('bg-components-option-card-option-bg')})it('should apply text-text-primary to label when selected', () => {renderWithProviders(<OptionCard {...defaultProps} selected={true} />)const label = screen.getByText('Test Option')- expect(label).toHaveClass('text-text-primary')+ expect(label)!.toHaveClass('text-text-primary')})it('should apply text-text-secondary to label when not selected', () => {renderWithProviders(<OptionCard {...defaultProps} selected={false} />)const label = screen.getByText('Test Option')- expect(label).toHaveClass('text-text-secondary')+ expect(label)!.toHaveClass('text-text-secondary')})})@@ -593,7 +595,7 @@ describe('OptionCard', () => {// Act - Click on the label text's parent cardconst labelElement = screen.getByText('Test Option')const card = labelElement.closest('[class*="cursor-pointer"]')- expect(card).toBeInTheDocument()+ expect(card)!.toBeInTheDocument()fireEvent.click(card!)expect(mockOnClick).toHaveBeenCalledTimes(1)@@ -607,11 +609,12 @@ describe('OptionCard', () => {// Act - Click on the label text's parent card should not throwconst labelElement = screen.getByText('Test Option')const card = labelElement.closest('[class*="cursor-pointer"]')- expect(card).toBeInTheDocument()+ expect(card)!.toBeInTheDocument()fireEvent.click(card!)// Assert - Component should still be rendered- expect(screen.getByText('Test Option')).toBeInTheDocument()+ // Assert - Component should still be rendered+ expect(screen.getByText('Test Option'))!.toBeInTheDocument()})})@@ -631,35 +634,35 @@ describe('OptionCard', () => {it('should have cursor-pointer class', () => {const { container } = renderWithProviders(<OptionCard {...defaultProps} />)- expect(container.firstChild).toHaveClass('cursor-pointer')+ expect(container.firstChild)!.toHaveClass('cursor-pointer')})it('should have flex layout classes', () => {const { container } = renderWithProviders(<OptionCard {...defaultProps} />)- expect(container.firstChild).toHaveClass('flex')- expect(container.firstChild).toHaveClass('items-center')- expect(container.firstChild).toHaveClass('gap-2')+ expect(container.firstChild)!.toHaveClass('flex')+ expect(container.firstChild)!.toHaveClass('items-center')+ expect(container.firstChild)!.toHaveClass('gap-2')})it('should have rounded-xl border', () => {const { container } = renderWithProviders(<OptionCard {...defaultProps} />)- expect(container.firstChild).toHaveClass('rounded-xl')- expect(container.firstChild).toHaveClass('border')+ expect(container.firstChild)!.toHaveClass('rounded-xl')+ expect(container.firstChild)!.toHaveClass('border')})it('should have padding p-3', () => {const { container } = renderWithProviders(<OptionCard {...defaultProps} />)- expect(container.firstChild).toHaveClass('p-3')+ expect(container.firstChild)!.toHaveClass('p-3')})it('should have line-clamp-2 for label truncation', () => {renderWithProviders(<OptionCard {...defaultProps} />)const label = screen.getByText('Test Option')- expect(label).toHaveClass('line-clamp-2')+ expect(label)!.toHaveClass('line-clamp-2')})})@@ -669,7 +672,7 @@ describe('OptionCard', () => {expect(OptionCard).toBeDefined()// React.memo wraps the component, so we check it renders correctlyconst { container } = renderWithProviders(<OptionCard {...defaultProps} />)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})})})@@ -698,27 +701,27 @@ describe('DataSourceOptions', () => {it('should render without crashing', () => {renderWithProviders(<DataSourceOptions {...defaultProps} />)- expect(screen.getByText('Data Source 1')).toBeInTheDocument()- expect(screen.getByText('Data Source 2')).toBeInTheDocument()- expect(screen.getByText('Data Source 3')).toBeInTheDocument()+ expect(screen.getByText('Data Source 1'))!.toBeInTheDocument()+ expect(screen.getByText('Data Source 2'))!.toBeInTheDocument()+ expect(screen.getByText('Data Source 3'))!.toBeInTheDocument()})it('should render correct number of option cards', () => {renderWithProviders(<DataSourceOptions {...defaultProps} />)- expect(screen.getByText('Data Source 1')).toBeInTheDocument()- expect(screen.getByText('Data Source 2')).toBeInTheDocument()- expect(screen.getByText('Data Source 3')).toBeInTheDocument()+ expect(screen.getByText('Data Source 1'))!.toBeInTheDocument()+ expect(screen.getByText('Data Source 2'))!.toBeInTheDocument()+ expect(screen.getByText('Data Source 3'))!.toBeInTheDocument()})it('should render with grid layout', () => {const { container } = renderWithProviders(<DataSourceOptions {...defaultProps} />)const gridContainer = container.firstChild- expect(gridContainer).toHaveClass('grid')- expect(gridContainer).toHaveClass('w-full')- expect(gridContainer).toHaveClass('grid-cols-4')- expect(gridContainer).toHaveClass('gap-1')+ expect(gridContainer)!.toHaveClass('grid')+ expect(gridContainer)!.toHaveClass('w-full')+ expect(gridContainer)!.toHaveClass('grid-cols-4')+ expect(gridContainer)!.toHaveClass('gap-1')})it('should render no option cards when options is empty', () => {@@ -728,16 +731,17 @@ describe('DataSourceOptions', () => {expect(screen.queryByText('Data Source')).not.toBeInTheDocument()// Grid container should still exist- expect(container.firstChild).toHaveClass('grid')+ // Grid container should still exist+ expect(container.firstChild)!.toHaveClass('grid')})it('should render single option card when only one option exists', () => {- const singleOption = [createMockDatasourceOption(defaultNodes[0])]+ const singleOption = [createMockDatasourceOption(defaultNodes[0]!)]mockUseDatasourceOptions.mockReturnValue(singleOption)renderWithProviders(<DataSourceOptions {...defaultProps} />)- expect(screen.getByText('Data Source 1')).toBeInTheDocument()+ expect(screen.getByText('Data Source 1'))!.toBeInTheDocument()expect(screen.queryByText('Data Source 2')).not.toBeInTheDocument()})})@@ -778,7 +782,7 @@ describe('DataSourceOptions', () => {// Assert - Check for selected styling on second cardconst cards = container.querySelectorAll('.rounded-xl.border')- expect(cards[1]).toHaveClass('border-components-option-card-option-selected-border')+ expect(cards[1])!.toHaveClass('border-components-option-card-option-selected-border')})it('should show no selection when datasourceNodeId is empty', () => {@@ -816,7 +820,7 @@ describe('DataSourceOptions', () => {// Assert initial selectionlet cards = container.querySelectorAll('.rounded-xl.border')- expect(cards[0]).toHaveClass('border-components-option-card-option-selected-border')+ expect(cards[0])!.toHaveClass('border-components-option-card-option-selected-border')// Act - Change selectionrerender(@@ -831,7 +835,7 @@ describe('DataSourceOptions', () => {// Assert new selectioncards = container.querySelectorAll('.rounded-xl.border')expect(cards[0]).not.toHaveClass('border-components-option-card-option-selected-border')- expect(cards[1]).toHaveClass('border-components-option-card-option-selected-border')+ expect(cards[1])!.toHaveClass('border-components-option-card-option-selected-border')})})@@ -847,7 +851,8 @@ describe('DataSourceOptions', () => {)// Assert - Component renders without error- expect(screen.getByText('Data Source 1')).toBeInTheDocument()+ // Assert - Component renders without error+ expect(screen.getByText('Data Source 1'))!.toBeInTheDocument()})})})@@ -870,7 +875,7 @@ describe('DataSourceOptions', () => {expect(mockOnSelect).toHaveBeenCalledTimes(1)expect(mockOnSelect).toHaveBeenCalledWith({nodeId: 'node-1',- nodeData: defaultOptions[0].data,+ nodeData: defaultOptions[0]!.data,} satisfies Datasource)})@@ -948,7 +953,8 @@ describe('DataSourceOptions', () => {)// Get initial click handlers- expect(screen.getByText('Data Source 1')).toBeInTheDocument()+ // Get initial click handlers+ expect(screen.getByText('Data Source 1'))!.toBeInTheDocument()// Trigger clicks to test handlers workfireEvent.click(screen.getByText('Data Source 1'))@@ -1003,7 +1009,7 @@ describe('DataSourceOptions', () => {expect(mockOnSelect2).toHaveBeenCalledTimes(1)expect(mockOnSelect2).toHaveBeenCalledWith({nodeId: 'node-3',- nodeData: defaultOptions[2].data,+ nodeData: defaultOptions[2]!.data,})})@@ -1022,7 +1028,7 @@ describe('DataSourceOptions', () => {fireEvent.click(screen.getByText('Data Source 1'))expect(mockOnSelect).toHaveBeenCalledWith({nodeId: 'node-1',- nodeData: defaultOptions[0].data,+ nodeData: defaultOptions[0]!.data,})// Act - Change options@@ -1045,8 +1051,8 @@ describe('DataSourceOptions', () => {// Assert - Callback receives new option dataexpect(mockOnSelect).toHaveBeenLastCalledWith({- nodeId: newOptions[0].value,- nodeData: newOptions[0].data,+ nodeId: newOptions[0]!.value,+ nodeData: newOptions[0]!.data,})})})@@ -1070,7 +1076,7 @@ describe('DataSourceOptions', () => {expect(mockOnSelect).toHaveBeenCalledTimes(1)expect(mockOnSelect).toHaveBeenCalledWith({nodeId: 'node-2',- nodeData: defaultOptions[1].data,+ nodeData: defaultOptions[1]!.data,} satisfies Datasource)})@@ -1090,7 +1096,7 @@ describe('DataSourceOptions', () => {expect(mockOnSelect).toHaveBeenCalledTimes(1)expect(mockOnSelect).toHaveBeenCalledWith({nodeId: 'node-1',- nodeData: defaultOptions[0].data,+ nodeData: defaultOptions[0]!.data,})})@@ -1112,15 +1118,15 @@ describe('DataSourceOptions', () => {expect(mockOnSelect).toHaveBeenCalledTimes(3)expect(mockOnSelect).toHaveBeenNthCalledWith(1, {nodeId: 'node-1',- nodeData: defaultOptions[0].data,+ nodeData: defaultOptions[0]!.data,})expect(mockOnSelect).toHaveBeenNthCalledWith(2, {nodeId: 'node-2',- nodeData: defaultOptions[1].data,+ nodeData: defaultOptions[1]!.data,})expect(mockOnSelect).toHaveBeenNthCalledWith(3, {nodeId: 'node-3',- nodeData: defaultOptions[2].data,+ nodeData: defaultOptions[2]!.data,})})})@@ -1164,7 +1170,7 @@ describe('DataSourceOptions', () => {/>,)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})it('should not crash when datasourceNodeId is undefined', () => {@@ -1176,7 +1182,7 @@ describe('DataSourceOptions', () => {/>,)- expect(screen.getByText('Data Source 1')).toBeInTheDocument()+ expect(screen.getByText('Data Source 1'))!.toBeInTheDocument()})})@@ -1202,7 +1208,7 @@ describe('DataSourceOptions', () => {renderWithProviders(<DataSourceOptions {...defaultProps} />)- expect(screen.getByText('Minimal Option')).toBeInTheDocument()+ expect(screen.getByText('Minimal Option'))!.toBeInTheDocument()})})@@ -1219,8 +1225,8 @@ describe('DataSourceOptions', () => {/>,)- expect(screen.getByText('Data Source 1')).toBeInTheDocument()- expect(screen.getByText('Data Source 50')).toBeInTheDocument()+ expect(screen.getByText('Data Source 1'))!.toBeInTheDocument()+ expect(screen.getByText('Data Source 50'))!.toBeInTheDocument()})})@@ -1243,7 +1249,8 @@ describe('DataSourceOptions', () => {)// Assert - Special characters should be escaped/rendered safely- expect(screen.getByText('Data Source <script>alert("xss")</script>')).toBeInTheDocument()+ // Assert - Special characters should be escaped/rendered safely+ expect(screen.getByText('Data Source <script>alert("xss")</script>'))!.toBeInTheDocument()})it('should handle unicode characters in option labels', () => {@@ -1263,7 +1270,7 @@ describe('DataSourceOptions', () => {/>,)- expect(screen.getByText('数据源 📁 Source émoji')).toBeInTheDocument()+ expect(screen.getByText('数据源 📁 Source émoji'))!.toBeInTheDocument()})it('should handle empty string as option value', () => {@@ -1276,13 +1283,13 @@ describe('DataSourceOptions', () => {renderWithProviders(<DataSourceOptions {...defaultProps} />)- expect(screen.getByText('Empty Value Option')).toBeInTheDocument()+ expect(screen.getByText('Empty Value Option'))!.toBeInTheDocument()})})describe('Boundary Conditions', () => {it('should handle single option selection correctly', () => {- const singleOption = [createMockDatasourceOption(defaultNodes[0])]+ const singleOption = [createMockDatasourceOption(defaultNodes[0]!)]mockUseDatasourceOptions.mockReturnValue(singleOption)const mockOnSelect = vi.fn()@@ -1327,7 +1334,7 @@ describe('DataSourceOptions', () => {const labels = screen.getAllByText('Duplicate Label')expect(labels).toHaveLength(2)- fireEvent.click(labels[1])+ fireEvent.click(labels[1]!)expect(mockOnSelect).toHaveBeenCalledWith({nodeId: 'node-b',nodeData: expect.objectContaining({ plugin_id: 'plugin-b' }),@@ -1347,6 +1354,37 @@ describe('DataSourceOptions', () => {unmount()+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted+ // Assert - No errors thrown, component cleanly unmounted// Assert - No errors thrown, component cleanly unmountedexpect(screen.queryByText('Data Source 1')).not.toBeInTheDocument()})@@ -1367,6 +1405,37 @@ describe('DataSourceOptions', () => {// Unmount during/after interactionunmount()+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw+ // Assert - Should not throw// Assert - Should not throwexpect(screen.queryByText('Data Source 1')).not.toBeInTheDocument()})@@ -1392,7 +1461,7 @@ describe('DataSourceOptions', () => {const cards = container.querySelectorAll('.rounded-xl.border')expect(cards[0]).not.toHaveClass('border-components-option-card-option-selected-border')- expect(cards[1]).toHaveClass('border-components-option-card-option-selected-border')+ expect(cards[1])!.toHaveClass('border-components-option-card-option-selected-border')expect(cards[2]).not.toHaveClass('border-components-option-card-option-selected-border')})@@ -1427,7 +1496,7 @@ describe('DataSourceOptions', () => {/>,)- expect(screen.getByText('Data Source 1')).toBeInTheDocument()+ expect(screen.getByText('Data Source 1'))!.toBeInTheDocument()})it.each([@@ -1449,7 +1518,7 @@ describe('DataSourceOptions', () => {)if (count > 0)- expect(screen.getByText('Data Source 1')).toBeInTheDocument()+ expect(screen.getByText('Data Source 1'))!.toBeInTheDocument()elseexpect(screen.queryByText('Data Source 1')).not.toBeInTheDocument()})diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source-options/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source-options/index.tsxindex 8e3a29cfe51..51cf34d2734 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source-options/index.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source-options/index.tsx@@ -31,7 +31,7 @@ const DataSourceOptions = ({useEffect(() => {if (options.length > 0 && !datasourceNodeId)- handelSelect(options[0].value)+ handelSelect(options[0]!.value)}, [])return (diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/base/credential-selector/__tests__/index.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/base/credential-selector/__tests__/index.spec.tsxindex d595a50fe12..49b0cb07893 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/base/credential-selector/__tests__/index.spec.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/base/credential-selector/__tests__/index.spec.tsx@@ -97,8 +97,8 @@ describe('CredentialSelector', () => {render(<CredentialSelector {...props} />)- expect(screen.getByTestId('portal-root')).toBeInTheDocument()- expect(screen.getByTestId('portal-trigger')).toBeInTheDocument()+ expect(screen.getByTestId('portal-root'))!.toBeInTheDocument()+ expect(screen.getByTestId('portal-trigger'))!.toBeInTheDocument()})it('should render current credential name in trigger', () => {@@ -106,7 +106,7 @@ describe('CredentialSelector', () => {render(<CredentialSelector {...props} />)- expect(screen.getByText('Credential 1')).toBeInTheDocument()+ expect(screen.getByText('Credential 1'))!.toBeInTheDocument()})it('should render credential icon with correct props', () => {@@ -116,8 +116,8 @@ describe('CredentialSelector', () => {// Assert - CredentialIcon renders an img when avatarUrl is providedconst iconImg = container.querySelector('img')- expect(iconImg).toBeInTheDocument()- expect(iconImg).toHaveAttribute('src', 'https://example.com/avatar-1.png')+ expect(iconImg)!.toBeInTheDocument()+ expect(iconImg)!.toHaveAttribute('src', 'https://example.com/avatar-1.png')})it('should render dropdown arrow icon', () => {@@ -126,7 +126,7 @@ describe('CredentialSelector', () => {const { container } = render(<CredentialSelector {...props} />)const svgIcon = container.querySelector('svg')- expect(svgIcon).toBeInTheDocument()+ expect(svgIcon)!.toBeInTheDocument()})it('should not render dropdown content initially', () => {@@ -146,7 +146,8 @@ describe('CredentialSelector', () => {fireEvent.click(trigger)// Assert - All credentials should be visible (current credential appears in both trigger and list)- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ // Assert - All credentials should be visible (current credential appears in both trigger and list)+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()// 3 in dropdown list + 1 in trigger (current) = 4 totalexpect(screen.getAllByText(/Credential \d/)).toHaveLength(4)})@@ -160,7 +161,7 @@ describe('CredentialSelector', () => {render(<CredentialSelector {...props} />)- expect(screen.getByText('Credential 1')).toBeInTheDocument()+ expect(screen.getByText('Credential 1'))!.toBeInTheDocument()})it('should display second credential when currentCredentialId matches second', () => {@@ -168,7 +169,7 @@ describe('CredentialSelector', () => {render(<CredentialSelector {...props} />)- expect(screen.getByText('Credential 2')).toBeInTheDocument()+ expect(screen.getByText('Credential 2'))!.toBeInTheDocument()})it('should display third credential when currentCredentialId matches third', () => {@@ -176,7 +177,7 @@ describe('CredentialSelector', () => {render(<CredentialSelector {...props} />)- expect(screen.getByText('Credential 3')).toBeInTheDocument()+ expect(screen.getByText('Credential 3'))!.toBeInTheDocument()})it.each([@@ -188,7 +189,7 @@ describe('CredentialSelector', () => {render(<CredentialSelector {...props} />)- expect(screen.getByText(expectedName)).toBeInTheDocument()+ expect(screen.getByText(expectedName))!.toBeInTheDocument()})})@@ -201,7 +202,7 @@ describe('CredentialSelector', () => {render(<CredentialSelector {...props} />)- expect(screen.getByText('Test Credential')).toBeInTheDocument()+ expect(screen.getByText('Test Credential'))!.toBeInTheDocument()})it('should render multiple credentials in dropdown', () => {@@ -226,7 +227,7 @@ describe('CredentialSelector', () => {render(<CredentialSelector {...props} />)- expect(screen.getByText('Test & Credential <special>')).toBeInTheDocument()+ expect(screen.getByText('Test & Credential <special>'))!.toBeInTheDocument()})})@@ -293,6 +294,37 @@ describe('CredentialSelector', () => {const props = createDefaultProps()render(<CredentialSelector {...props} />)+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed+ // Assert - Initially closed// Assert - Initially closedexpect(screen.queryByTestId('portal-content')).not.toBeInTheDocument()@@ -301,7 +333,8 @@ describe('CredentialSelector', () => {fireEvent.click(trigger)// Assert - Now open- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ // Assert - Now open+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()})it('should call onCredentialChange when clicking a credential item', () => {@@ -327,7 +360,7 @@ describe('CredentialSelector', () => {const trigger = screen.getByTestId('portal-trigger')fireEvent.click(trigger)- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()const credential2 = screen.getByText('Credential 2')fireEvent.click(credential2)@@ -347,7 +380,8 @@ describe('CredentialSelector', () => {fireEvent.click(trigger)// Assert - Should not crash- expect(trigger).toBeInTheDocument()+ // Assert - Should not crash+ expect(trigger)!.toBeInTheDocument()})it('should allow selecting credentials multiple times', () => {@@ -504,7 +538,8 @@ describe('CredentialSelector', () => {render(<CredentialSelector {...props} />)// Assert - Should display credential 2- expect(screen.getByText('Credential 2')).toBeInTheDocument()+ // Assert - Should display credential 2+ expect(screen.getByText('Credential 2'))!.toBeInTheDocument()})it('should update currentCredential when currentCredentialId changes', () => {@@ -512,13 +547,15 @@ describe('CredentialSelector', () => {const { rerender } = render(<CredentialSelector {...props} />)// Assert initial- expect(screen.getByText('Credential 1')).toBeInTheDocument()+ // Assert initial+ expect(screen.getByText('Credential 1'))!.toBeInTheDocument()// Act - Change currentCredentialIdrerender(<CredentialSelector {...props} currentCredentialId="cred-3" />)// Assert - Should now display credential 3- expect(screen.getByText('Credential 3')).toBeInTheDocument()+ // Assert - Should now display credential 3+ expect(screen.getByText('Credential 3'))!.toBeInTheDocument()})it('should update currentCredential when credentials array changes', () => {@@ -526,7 +563,8 @@ describe('CredentialSelector', () => {const { rerender } = render(<CredentialSelector {...props} />)// Assert initial- expect(screen.getByText('Credential 1')).toBeInTheDocument()+ // Assert initial+ expect(screen.getByText('Credential 1'))!.toBeInTheDocument()// Act - Change credentialsconst newCredentials = [@@ -535,7 +573,8 @@ describe('CredentialSelector', () => {rerender(<CredentialSelector {...props} credentials={newCredentials} />)// Assert - Should display updated name- expect(screen.getByText('Updated Credential 1')).toBeInTheDocument()+ // Assert - Should display updated name+ expect(screen.getByText('Updated Credential 1'))!.toBeInTheDocument()})it('should return undefined currentCredential when id not found', () => {@@ -581,11 +620,12 @@ describe('CredentialSelector', () => {const { rerender } = render(<CredentialSelector {...props} />)// Assert initial- expect(screen.getByText('Credential 1')).toBeInTheDocument()+ // Assert initial+ expect(screen.getByText('Credential 1'))!.toBeInTheDocument()rerender(<CredentialSelector {...props} currentCredentialId="cred-2" />)- expect(screen.getByText('Credential 2')).toBeInTheDocument()+ expect(screen.getByText('Credential 2'))!.toBeInTheDocument()})it('should re-render when credentials array reference changes', () => {@@ -598,7 +638,7 @@ describe('CredentialSelector', () => {]rerender(<CredentialSelector {...props} credentials={newCredentials} />)- expect(screen.getByText('New Name 1')).toBeInTheDocument()+ expect(screen.getByText('New Name 1'))!.toBeInTheDocument()})it('should re-render when onCredentialChange reference changes', () => {@@ -631,7 +671,8 @@ describe('CredentialSelector', () => {render(<CredentialSelector {...props} />)// Assert - Should render without crashing- expect(screen.getByTestId('portal-root')).toBeInTheDocument()+ // Assert - Should render without crashing+ expect(screen.getByTestId('portal-root'))!.toBeInTheDocument()})it('should handle undefined avatar_url in credential', () => {@@ -648,12 +689,14 @@ describe('CredentialSelector', () => {const { container } = render(<CredentialSelector {...props} />)// Assert - Should render without crashing and show first letter fallback- expect(screen.getByText('No Avatar Credential')).toBeInTheDocument()+ // Assert - Should render without crashing and show first letter fallback+ expect(screen.getByText('No Avatar Credential'))!.toBeInTheDocument()// When avatar_url is undefined, CredentialIcon shows first letter instead of imgconst iconImg = container.querySelector('img')expect(iconImg).not.toBeInTheDocument()// First letter 'N' should be displayed- expect(screen.getByText('N')).toBeInTheDocument()+ // First letter 'N' should be displayed+ expect(screen.getByText('N'))!.toBeInTheDocument()})it('should handle empty string name in credential', () => {@@ -669,7 +712,8 @@ describe('CredentialSelector', () => {render(<CredentialSelector {...props} />)// Assert - Should render without crashing- expect(screen.getByTestId('portal-trigger')).toBeInTheDocument()+ // Assert - Should render without crashing+ expect(screen.getByTestId('portal-trigger'))!.toBeInTheDocument()})it('should handle very long credential name', () => {@@ -685,7 +729,7 @@ describe('CredentialSelector', () => {render(<CredentialSelector {...props} />)- expect(screen.getByText(longName)).toBeInTheDocument()+ expect(screen.getByText(longName))!.toBeInTheDocument()})it('should handle special characters in credential name', () => {@@ -701,7 +745,7 @@ describe('CredentialSelector', () => {render(<CredentialSelector {...props} />)- expect(screen.getByText(specialName)).toBeInTheDocument()+ expect(screen.getByText(specialName))!.toBeInTheDocument()})it('should handle numeric id as string', () => {@@ -716,7 +760,7 @@ describe('CredentialSelector', () => {render(<CredentialSelector {...props} />)- expect(screen.getByText('Numeric ID Credential')).toBeInTheDocument()+ expect(screen.getByText('Numeric ID Credential'))!.toBeInTheDocument()})it('should handle large number of credentials', () => {@@ -728,7 +772,7 @@ describe('CredentialSelector', () => {render(<CredentialSelector {...props} />)- expect(screen.getByText('Credential 50')).toBeInTheDocument()+ expect(screen.getByText('Credential 50'))!.toBeInTheDocument()})it('should handle credential selection with duplicate names', () => {@@ -752,7 +796,7 @@ describe('CredentialSelector', () => {const sameNameElements = screen.getAllByText('Same Name')expect(sameNameElements.length).toBe(3)- fireEvent.click(sameNameElements[2])+ fireEvent.click(sameNameElements[2]!)// Assert - Should call with the correct id even with duplicate namesexpect(mockOnChange).toHaveBeenCalledWith('cred-2')@@ -787,7 +831,8 @@ describe('CredentialSelector', () => {render(<CredentialSelector {...props} />)// Assert - Should render without crashing- expect(screen.getByTestId('portal-trigger')).toBeInTheDocument()+ // Assert - Should render without crashing+ expect(screen.getByTestId('portal-trigger'))!.toBeInTheDocument()})})@@ -799,7 +844,7 @@ describe('CredentialSelector', () => {render(<CredentialSelector {...props} />)const trigger = screen.getByTestId('portal-trigger')- expect(trigger).toHaveClass('overflow-hidden')+ expect(trigger)!.toHaveClass('overflow-hidden')})it('should apply grow class to trigger', () => {@@ -808,7 +853,7 @@ describe('CredentialSelector', () => {render(<CredentialSelector {...props} />)const trigger = screen.getByTestId('portal-trigger')- expect(trigger).toHaveClass('grow')+ expect(trigger)!.toHaveClass('grow')})it('should apply z-10 class to dropdown content', () => {@@ -819,7 +864,7 @@ describe('CredentialSelector', () => {fireEvent.click(trigger)const content = screen.getByTestId('portal-content')- expect(content).toHaveClass('z-10')+ expect(content)!.toHaveClass('z-10')})})@@ -831,7 +876,8 @@ describe('CredentialSelector', () => {render(<CredentialSelector {...props} />)// Assert - Trigger should display the correct credential- expect(screen.getByText('Credential 2')).toBeInTheDocument()+ // Assert - Trigger should display the correct credential+ expect(screen.getByText('Credential 2'))!.toBeInTheDocument()})it('should pass isOpen state to Trigger component', () => {@@ -840,14 +886,15 @@ describe('CredentialSelector', () => {// Assert - Initially closedconst portalRoot = screen.getByTestId('portal-root')- expect(portalRoot).toHaveAttribute('data-open', 'false')+ expect(portalRoot)!.toHaveAttribute('data-open', 'false')// Act - Openconst trigger = screen.getByTestId('portal-trigger')fireEvent.click(trigger)// Assert - Now open- expect(portalRoot).toHaveAttribute('data-open', 'true')+ // Assert - Now open+ expect(portalRoot)!.toHaveAttribute('data-open', 'true')})it('should pass credentials to List component', () => {@@ -899,7 +946,7 @@ describe('CredentialSelector', () => {const props = createDefaultProps()render(<CredentialSelector {...props} />)- expect(screen.getByTestId('portal-root')).toBeInTheDocument()+ expect(screen.getByTestId('portal-root'))!.toBeInTheDocument()})it('should configure PortalToFollowElem with offset mainAxis 4', () => {@@ -907,7 +954,7 @@ describe('CredentialSelector', () => {const props = createDefaultProps()render(<CredentialSelector {...props} />)- expect(screen.getByTestId('portal-root')).toBeInTheDocument()+ expect(screen.getByTestId('portal-root'))!.toBeInTheDocument()})})})diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/base/credential-selector/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/base/credential-selector/index.tsxindex 2f14b0f3b8b..116b762277e 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/base/credential-selector/index.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/base/credential-selector/index.tsx@@ -29,7 +29,7 @@ const CredentialSelector = ({useEffect(() => {if (!currentCredential && credentials.length)- onCredentialChange(credentials[0].id)+ onCredentialChange(credentials[0]!.id)}, [currentCredential, credentials])const handleCredentialChange = useCallback((credentialId: string) => {diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/local-file/hooks/__tests__/use-local-file-upload.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/local-file/hooks/__tests__/use-local-file-upload.spec.tsxindex cc531aad8f4..80a8fc854d9 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/local-file/hooks/__tests__/use-local-file-upload.spec.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/local-file/hooks/__tests__/use-local-file-upload.spec.tsx@@ -404,7 +404,7 @@ describe('useLocalFileUpload', () => {// Should only process first 5 files (batch_count_limit)const firstCall = mockSetLocalFileList.mock.calls[0]- expect(firstCall[0].length).toBeLessThanOrEqual(5)+ expect(firstCall![0].length).toBeLessThanOrEqual(5)})})@@ -591,7 +591,8 @@ describe('useLocalFileUpload', () => {})// dragover should not throw- expect(dropzone).toBeInTheDocument()+ // dragover should not throw+ expect(dropzone)!.toBeInTheDocument()})it('should set dragging false on dragleave from drag overlay', async () => {@@ -715,7 +716,7 @@ describe('useLocalFileUpload', () => {await waitFor(() => {expect(mockSetLocalFileList).toHaveBeenCalled()// Should only have 1 file (limited by supportBatchUpload: false)- const callArgs = mockSetLocalFileList.mock.calls[0][0]+ const callArgs = mockSetLocalFileList.mock.calls[0]![0]expect(callArgs.length).toBe(1)})})@@ -873,7 +874,7 @@ describe('useLocalFileUpload', () => {})await waitFor(() => {- const callArgs = mockSetLocalFileList.mock.calls[0][0]+ const callArgs = mockSetLocalFileList.mock.calls[0]![0]expect(callArgs[0].progress).toBe(PROGRESS_NOT_STARTED)})})@@ -899,7 +900,7 @@ describe('useLocalFileUpload', () => {await waitFor(() => {const calls = mockSetLocalFileList.mock.calls- const lastCall = calls[calls.length - 1][0]+ const lastCall = calls[calls.length - 1]![0]expect(lastCall.some((f: FileItem) => f.progress === PROGRESS_ERROR)).toBe(true)})})diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/index.tsxindex 5051d343cb5..5321986cd78 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/index.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/index.tsx@@ -115,7 +115,7 @@ const OnlineDocuments = ({const handleSelectPages = useCallback((newSelectedPagesId: Set<string>) => {const { setSelectedPagesId, setOnlineDocuments } = dataSourceStore.getState()- const selectedPages = Array.from(newSelectedPagesId).map(pageId => PagesMapAndSelectedPagesId[pageId])+ const selectedPages = Array.from(newSelectedPagesId).map(pageId => PagesMapAndSelectedPagesId[pageId]!)setSelectedPagesId(new Set(Array.from(newSelectedPagesId)))setOnlineDocuments(selectedPages)}, [dataSourceStore, PagesMapAndSelectedPagesId])@@ -160,7 +160,7 @@ const OnlineDocuments = ({checkedIds={selectedPagesId}disabledValue={new Set()}searchValue={searchValue}- list={documentsData[0].pages || []}+ list={documentsData[0]!.pages || []}pagesMap={PagesMapAndSelectedPagesId}onSelect={handleSelectPages}canPreview={!isInPipeline}diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/page-selector/__tests__/index.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/page-selector/__tests__/index.spec.tsxindex a6d5738e2d0..04676156e6f 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/page-selector/__tests__/index.spec.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/page-selector/__tests__/index.spec.tsx@@ -83,7 +83,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)- expect(screen.getByTestId('virtual-list')).toBeInTheDocument()+ expect(screen.getByTestId('virtual-list'))!.toBeInTheDocument()})it('should render empty state when list is empty', () => {@@ -94,7 +94,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)- expect(screen.getByText('common.dataSource.notion.selector.noSearchResult')).toBeInTheDocument()+ expect(screen.getByText('common.dataSource.notion.selector.noSearchResult'))!.toBeInTheDocument()expect(screen.queryByTestId('virtual-list')).not.toBeInTheDocument()})@@ -110,8 +110,8 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)- expect(screen.getByText('Page 1')).toBeInTheDocument()- expect(screen.getByText('Page 2')).toBeInTheDocument()+ expect(screen.getByText('Page 1'))!.toBeInTheDocument()+ expect(screen.getByText('Page 2'))!.toBeInTheDocument()})it('should render checkboxes when isMultipleChoice is true', () => {@@ -119,7 +119,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)- expect(getCheckbox()).toBeInTheDocument()+ expect(getCheckbox())!.toBeInTheDocument()})it('should render radio buttons when isMultipleChoice is false', () => {@@ -127,7 +127,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)- expect(getRadio()).toBeInTheDocument()+ expect(getRadio())!.toBeInTheDocument()})it('should render preview button when canPreview is true', () => {@@ -135,7 +135,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)- expect(screen.getByText('common.dataSource.notion.selector.preview')).toBeInTheDocument()+ expect(screen.getByText('common.dataSource.notion.selector.preview'))!.toBeInTheDocument()})it('should not render preview button when canPreview is false', () => {@@ -153,7 +153,7 @@ describe('PageSelector', () => {// Assert - NotionIcon renders svg when page_icon is nullconst notionIcon = document.querySelector('.h-5.w-5')- expect(notionIcon).toBeInTheDocument()+ expect(notionIcon)!.toBeInTheDocument()})it('should render page name', () => {@@ -164,7 +164,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)- expect(screen.getByText('My Custom Page')).toBeInTheDocument()+ expect(screen.getByText('My Custom Page'))!.toBeInTheDocument()})})@@ -181,7 +181,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)const checkbox = getCheckbox()- expect(checkbox).toBeInTheDocument()+ expect(checkbox)!.toBeInTheDocument()expect(isCheckboxChecked(checkbox)).toBe(true)})@@ -196,7 +196,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)const checkbox = getCheckbox()- expect(checkbox).toBeInTheDocument()+ expect(checkbox)!.toBeInTheDocument()expect(isCheckboxChecked(checkbox)).toBe(false)})@@ -206,7 +206,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)const checkbox = getCheckbox()- expect(checkbox).toBeInTheDocument()+ expect(checkbox)!.toBeInTheDocument()expect(isCheckboxChecked(checkbox)).toBe(false)})@@ -225,9 +225,9 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)const checkboxes = getAllCheckboxes()- expect(isCheckboxChecked(checkboxes[0])).toBe(true)- expect(isCheckboxChecked(checkboxes[1])).toBe(false)- expect(isCheckboxChecked(checkboxes[2])).toBe(true)+ expect(isCheckboxChecked(checkboxes[0]!)).toBe(true)+ expect(isCheckboxChecked(checkboxes[1]!)).toBe(false)+ expect(isCheckboxChecked(checkboxes[2]!)).toBe(true)})})@@ -243,7 +243,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)const checkbox = getCheckbox()- expect(checkbox).toBeInTheDocument()+ expect(checkbox)!.toBeInTheDocument()expect(isCheckboxDisabled(checkbox)).toBe(true)})@@ -258,7 +258,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)const checkbox = getCheckbox()- expect(checkbox).toBeInTheDocument()+ expect(checkbox)!.toBeInTheDocument()expect(isCheckboxDisabled(checkbox)).toBe(false)})@@ -276,8 +276,8 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)const checkboxes = getAllCheckboxes()- expect(isCheckboxDisabled(checkboxes[0])).toBe(true)- expect(isCheckboxDisabled(checkboxes[1])).toBe(false)+ expect(isCheckboxDisabled(checkboxes[0]!)).toBe(true)+ expect(isCheckboxDisabled(checkboxes[1]!)).toBe(false)})})@@ -301,6 +301,37 @@ describe('PageSelector', () => {expect(screen.getAllByText('Apple Page').length).toBeGreaterThan(0)expect(screen.getAllByText('Apple Pie').length).toBeGreaterThan(0)// Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"+ // Banana Page is filtered out because it doesn't contain "Apple"expect(screen.queryByText('Banana Page')).not.toBeInTheDocument()})@@ -314,7 +345,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)- expect(screen.getByText('common.dataSource.notion.selector.noSearchResult')).toBeInTheDocument()+ expect(screen.getByText('common.dataSource.notion.selector.noSearchResult'))!.toBeInTheDocument()})it('should show all pages when searchValue is empty', () => {@@ -330,8 +361,8 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)- expect(screen.getByText('Page 1')).toBeInTheDocument()- expect(screen.getByText('Page 2')).toBeInTheDocument()+ expect(screen.getByText('Page 1'))!.toBeInTheDocument()+ expect(screen.getByText('Page 2'))!.toBeInTheDocument()})it('should show breadcrumbs when searchValue is present', () => {@@ -345,7 +376,8 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)// Assert - page name should be visible- expect(screen.getByText('Grandchild 1')).toBeInTheDocument()+ // Assert - page name should be visible+ expect(screen.getByText('Grandchild 1'))!.toBeInTheDocument()})it('should perform case-sensitive search', () => {@@ -374,7 +406,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)- expect(screen.getByText('common.dataSource.notion.selector.preview')).toBeInTheDocument()+ expect(screen.getByText('common.dataSource.notion.selector.preview'))!.toBeInTheDocument()})it('should hide preview button when canPreview is false', () => {@@ -391,7 +423,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)- expect(screen.getByText('common.dataSource.notion.selector.preview')).toBeInTheDocument()+ expect(screen.getByText('common.dataSource.notion.selector.preview'))!.toBeInTheDocument()})})@@ -401,7 +433,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)- expect(getCheckbox()).toBeInTheDocument()+ expect(getCheckbox())!.toBeInTheDocument()expect(getRadio()).not.toBeInTheDocument()})@@ -410,7 +442,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)- expect(getRadio()).toBeInTheDocument()+ expect(getRadio())!.toBeInTheDocument()expect(getCheckbox()).not.toBeInTheDocument()})@@ -420,7 +452,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)- expect(getCheckbox()).toBeInTheDocument()+ expect(getCheckbox())!.toBeInTheDocument()})})@@ -449,7 +481,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)fireEvent.click(getCheckbox())- const calledSet = mockOnSelect.mock.calls[0][0] as Set<string>+ const calledSet = mockOnSelect.mock.calls[0]![0] as Set<string>expect(calledSet.has('page-1')).toBe(true)})})@@ -498,13 +530,15 @@ describe('PageSelector', () => {const { rerender } = render(<PageSelector {...props} />)// Assert - Initial render- expect(screen.getByText('Page 1')).toBeInTheDocument()+ // Assert - Initial render+ expect(screen.getByText('Page 1'))!.toBeInTheDocument()// Rerender with new credentialrerender(<PageSelector {...props} currentCredentialId="cred-2" />)// Assert - Should still show pages (reset and rebuild)- expect(screen.getByText('Page 1')).toBeInTheDocument()+ // Assert - Should still show pages (reset and rebuild)+ expect(screen.getByText('Page 1'))!.toBeInTheDocument()})})})@@ -521,7 +555,39 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)// Assert - Only root level page should be visible initially- expect(screen.getByText(rootPage.page_name)).toBeInTheDocument()+ // Assert - Only root level page should be visible initially+ expect(screen.getByText(rootPage.page_name))!.toBeInTheDocument()+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded+ // Child pages should not be visible until expanded// Child pages should not be visible until expandedexpect(screen.queryByText(childPage1.page_name)).not.toBeInTheDocument()})@@ -540,9 +606,9 @@ describe('PageSelector', () => {if (arrowButton)fireEvent.click(arrowButton)- expect(screen.getByText(rootPage.page_name)).toBeInTheDocument()- expect(screen.getByText(childPage1.page_name)).toBeInTheDocument()- expect(screen.getByText(childPage2.page_name)).toBeInTheDocument()+ expect(screen.getByText(rootPage.page_name))!.toBeInTheDocument()+ expect(screen.getByText(childPage1.page_name))!.toBeInTheDocument()+ expect(screen.getByText(childPage2.page_name))!.toBeInTheDocument()})it('should maintain currentPreviewPageId state', () => {@@ -560,7 +626,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)const previewButtons = screen.getAllByText('common.dataSource.notion.selector.preview')- fireEvent.click(previewButtons[0])+ fireEvent.click(previewButtons[0]!)expect(mockOnPreview).toHaveBeenCalledWith('page-1')})@@ -596,13 +662,14 @@ describe('PageSelector', () => {})const { rerender } = render(<PageSelector {...props} />)- expect(screen.getByText('Page 1')).toBeInTheDocument()+ expect(screen.getByText('Page 1'))!.toBeInTheDocument()// Change credentialrerender(<PageSelector {...props} currentCredentialId="cred-2" />)// Assert - Component should still render correctly- expect(screen.getByText('Page 1')).toBeInTheDocument()+ // Assert - Component should still render correctly+ expect(screen.getByText('Page 1'))!.toBeInTheDocument()})it('should filter root pages correctly on initialization', () => {@@ -615,7 +682,8 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)// Assert - Only root level pages visible- expect(screen.getByText(rootPage.page_name)).toBeInTheDocument()+ // Assert - Only root level pages visible+ expect(screen.getByText(rootPage.page_name))!.toBeInTheDocument()expect(screen.queryByText(childPage1.page_name)).not.toBeInTheDocument()})@@ -633,7 +701,8 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)// Assert - Orphan page should be visible at root level- expect(screen.getByText('Orphan Page')).toBeInTheDocument()+ // Assert - Orphan page should be visible at root level+ expect(screen.getByText('Orphan Page'))!.toBeInTheDocument()})})@@ -654,8 +723,9 @@ describe('PageSelector', () => {fireEvent.click(expandArrow)// Assert - Children should be visible- expect(screen.getByText(childPage1.page_name)).toBeInTheDocument()- expect(screen.getByText(childPage2.page_name)).toBeInTheDocument()+ // Assert - Children should be visible+ expect(screen.getByText(childPage1.page_name))!.toBeInTheDocument()+ expect(screen.getByText(childPage2.page_name))!.toBeInTheDocument()})it('should have stable handleToggle that collapses descendants', () => {@@ -675,6 +745,37 @@ describe('PageSelector', () => {fireEvent.click(expandArrow)}+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again+ // Assert - Children should be hidden again// Assert - Children should be hidden againexpect(screen.queryByText(childPage1.page_name)).not.toBeInTheDocument()expect(screen.queryByText(childPage2.page_name)).not.toBeInTheDocument()@@ -698,7 +799,7 @@ describe('PageSelector', () => {// Assert - onSelect should be called with the page and its descendantsexpect(mockOnSelect).toHaveBeenCalled()- const selectedSet = mockOnSelect.mock.calls[0][0] as Set<string>+ const selectedSet = mockOnSelect.mock.calls[0]![0] as Set<string>expect(selectedSet.has('root-page')).toBe(true)})@@ -752,7 +853,7 @@ describe('PageSelector', () => {// Assert - Tree structure should be built (verified by expand functionality)const expandArrow = document.querySelector('[class*="hover:bg-components-button-ghost-bg-hover"]')- expect(expandArrow).toBeInTheDocument() // Root page has children+ expect(expandArrow)!.toBeInTheDocument() // Root page has children})it('should recompute listMapWithChildrenAndDescendants when list changes', () => {@@ -763,7 +864,7 @@ describe('PageSelector', () => {})const { rerender } = render(<PageSelector {...props} />)- expect(screen.getByText('Page 1')).toBeInTheDocument()+ expect(screen.getByText('Page 1'))!.toBeInTheDocument()// Update with new listconst newList = [@@ -772,7 +873,7 @@ describe('PageSelector', () => {]rerender(<PageSelector {...props} list={newList} pagesMap={createMockPagesMap(newList)} />)- expect(screen.getByText('Page 1')).toBeInTheDocument()+ expect(screen.getByText('Page 1'))!.toBeInTheDocument()// Page 2 won't show because dataList state hasn't updated (only resets on credentialId change)})@@ -793,7 +894,8 @@ describe('PageSelector', () => {rerender(<PageSelector {...props} pagesMap={newPagesMap} />)// Assert - Should not throw- expect(screen.getByText('Page 1')).toBeInTheDocument()+ // Assert - Should not throw+ expect(screen.getByText('Page 1'))!.toBeInTheDocument()})it('should handle empty list in memoization', () => {@@ -804,7 +906,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)- expect(screen.getByText('common.dataSource.notion.selector.noSearchResult')).toBeInTheDocument()+ expect(screen.getByText('common.dataSource.notion.selector.noSearchResult'))!.toBeInTheDocument()})})@@ -819,6 +921,37 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden+ // Initially children are hidden// Initially children are hiddenexpect(screen.queryByText(childPage1.page_name)).not.toBeInTheDocument()@@ -827,7 +960,8 @@ describe('PageSelector', () => {fireEvent.click(expandArrow)// Children become visible- expect(screen.getByText(childPage1.page_name)).toBeInTheDocument()+ // Children become visible+ expect(screen.getByText(childPage1.page_name))!.toBeInTheDocument()})it('should check/uncheck page when clicking checkbox', () => {@@ -873,11 +1007,11 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)const radios = getAllRadios()- fireEvent.click(radios[1]) // Click on page-2+ fireEvent.click(radios[1]!) // Click on page-2// Assert - Should clear page-1 and select page-2expect(mockOnSelect).toHaveBeenCalled()- const selectedSet = mockOnSelect.mock.calls[0][0] as Set<string>+ const selectedSet = mockOnSelect.mock.calls[0]![0] as Set<string>expect(selectedSet.has('page-2')).toBe(true)expect(selectedSet.has('page-1')).toBe(false)})@@ -912,7 +1046,7 @@ describe('PageSelector', () => {// Assert - Only the clicked page should be selected (no descendants)expect(mockOnSelect).toHaveBeenCalled()- const selectedSet = mockOnSelect.mock.calls[0][0] as Set<string>+ const selectedSet = mockOnSelect.mock.calls[0]![0] as Set<string>expect(selectedSet.size).toBe(1)expect(selectedSet.has('root-page')).toBe(true)})@@ -927,7 +1061,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)- expect(screen.getByText('common.dataSource.notion.selector.noSearchResult')).toBeInTheDocument()+ expect(screen.getByText('common.dataSource.notion.selector.noSearchResult'))!.toBeInTheDocument()})it('should handle null page_icon', () => {@@ -941,7 +1075,7 @@ describe('PageSelector', () => {// Assert - NotionIcon renders svg (RiFileTextLine) when page_icon is nullconst notionIcon = document.querySelector('.h-5.w-5')- expect(notionIcon).toBeInTheDocument()+ expect(notionIcon)!.toBeInTheDocument()})it('should handle page_icon with all properties', () => {@@ -956,7 +1090,8 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)// Assert - NotionIcon renders the emoji- expect(screen.getByText('📄')).toBeInTheDocument()+ // Assert - NotionIcon renders the emoji+ expect(screen.getByText('📄'))!.toBeInTheDocument()})it('should handle empty searchValue correctly', () => {@@ -964,7 +1099,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)- expect(screen.getByTestId('virtual-list')).toBeInTheDocument()+ expect(screen.getByTestId('virtual-list'))!.toBeInTheDocument()})it('should handle special characters in page name', () => {@@ -976,7 +1111,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)- expect(screen.getByText('Test <script>alert("xss")</script>')).toBeInTheDocument()+ expect(screen.getByText('Test <script>alert("xss")</script>'))!.toBeInTheDocument()})it('should handle unicode characters in page name', () => {@@ -988,7 +1123,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)- expect(screen.getByText('测试页面 🔍 привет')).toBeInTheDocument()+ expect(screen.getByText('测试页面 🔍 привет'))!.toBeInTheDocument()})it('should handle very long page names', () => {@@ -1001,7 +1136,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)- expect(screen.getByText(longName)).toBeInTheDocument()+ expect(screen.getByText(longName))!.toBeInTheDocument()})it('should handle deeply nested hierarchy', () => {@@ -1027,7 +1162,8 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)// Assert - Only root level visible- expect(screen.getByText('Level 0')).toBeInTheDocument()+ // Assert - Only root level visible+ expect(screen.getByText('Level 0'))!.toBeInTheDocument()expect(screen.queryByText('Level 1')).not.toBeInTheDocument()})@@ -1048,7 +1184,8 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)// Assert - Should render the orphan page at root level- expect(screen.getByText('Orphan Page')).toBeInTheDocument()+ // Assert - Should render the orphan page at root level+ expect(screen.getByText('Orphan Page'))!.toBeInTheDocument()})it('should handle empty checkedIds Set', () => {@@ -1057,7 +1194,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)const checkbox = getCheckbox()- expect(checkbox).toBeInTheDocument()+ expect(checkbox)!.toBeInTheDocument()expect(isCheckboxChecked(checkbox)).toBe(false)})@@ -1067,7 +1204,7 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)const checkbox = getCheckbox()- expect(checkbox).toBeInTheDocument()+ expect(checkbox)!.toBeInTheDocument()expect(isCheckboxDisabled(checkbox)).toBe(false)})@@ -1112,16 +1249,16 @@ describe('PageSelector', () => {render(<PageSelector {...props} />)- expect(screen.getByTestId('virtual-list')).toBeInTheDocument()+ expect(screen.getByTestId('virtual-list'))!.toBeInTheDocument()if (propVariation.canPreview)- expect(screen.getByText('common.dataSource.notion.selector.preview')).toBeInTheDocument()+ expect(screen.getByText('common.dataSource.notion.selector.preview'))!.toBeInTheDocument()elseexpect(screen.queryByText('common.dataSource.notion.selector.preview')).not.toBeInTheDocument()if (propVariation.isMultipleChoice)- expect(getCheckbox()).toBeInTheDocument()+ expect(getCheckbox())!.toBeInTheDocument()else- expect(getRadio()).toBeInTheDocument()+ expect(getRadio())!.toBeInTheDocument()})it('should handle all default prop values', () => {@@ -1140,8 +1277,9 @@ describe('PageSelector', () => {render(<PageSelector {...minimalProps} />)// Assert - Defaults should be applied- expect(getCheckbox()).toBeInTheDocument()- expect(screen.getByText('common.dataSource.notion.selector.preview')).toBeInTheDocument()+ // Assert - Defaults should be applied+ expect(getCheckbox())!.toBeInTheDocument()+ expect(screen.getByText('common.dataSource.notion.selector.preview'))!.toBeInTheDocument()})})@@ -1166,8 +1304,8 @@ describe('PageSelector', () => {recursivePushInParentDescendants(pagesMap, listTreeMap, childEntry, childEntry)expect(listTreeMap.parent).toBeDefined()- expect(listTreeMap.parent.children.has('child')).toBe(true)- expect(listTreeMap.parent.descendants.has('child')).toBe(true)+ expect(listTreeMap.parent!.children.has('child')).toBe(true)+ expect(listTreeMap.parent!.descendants.has('child')).toBe(true)expect(childEntry.depth).toBe(1)expect(childEntry.ancestors).toContain('Parent')})@@ -1274,8 +1412,8 @@ describe('PageSelector', () => {expect(l2Entry.depth).toBe(2)expect(l2Entry.ancestors).toEqual(['Level 0', 'Level 1'])- expect(listTreeMap.l1.children.has('l2')).toBe(true)- expect(listTreeMap.l0.descendants.has('l2')).toBe(true)+ expect(listTreeMap.l1!.children.has('l2')).toBe(true)+ expect(listTreeMap.l0!.descendants.has('l2')).toBe(true)})it('should update existing parent entry', () => {@@ -1329,7 +1467,7 @@ describe('PageSelector', () => {// Assert - Item should have preview styling classconst itemContainer = screen.getByText('Test Page').closest('[class*="group"]')- expect(itemContainer).toHaveClass('bg-state-base-hover')+ expect(itemContainer)!.toHaveClass('bg-state-base-hover')})it('should show arrow for pages with children', () => {@@ -1343,7 +1481,7 @@ describe('PageSelector', () => {// Assert - Root page should have expand arrowconst arrowContainer = document.querySelector('[class*="hover:bg-components-button-ghost-bg-hover"]')- expect(arrowContainer).toBeInTheDocument()+ expect(arrowContainer)!.toBeInTheDocument()})it('should not show arrow for leaf pages', () => {diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/page-selector/__tests__/utils.spec.ts b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/page-selector/__tests__/utils.spec.tsindex 2a081ef4189..a7175a47de0 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/page-selector/__tests__/utils.spec.ts+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/page-selector/__tests__/utils.spec.ts@@ -28,11 +28,11 @@ describe('recursivePushInParentDescendants', () => {child1: makePageEntry({ page_id: 'child1', parent_id: 'parent1', page_name: 'Child' }),}- recursivePushInParentDescendants(pagesMap, listTreeMap, listTreeMap.child1, listTreeMap.child1)+ recursivePushInParentDescendants(pagesMap, listTreeMap, listTreeMap.child1!, listTreeMap.child1!)expect(listTreeMap.parent1).toBeDefined()- expect(listTreeMap.parent1.children.has('child1')).toBe(true)- expect(listTreeMap.parent1.descendants.has('child1')).toBe(true)+ expect(listTreeMap.parent1!.children.has('child1')).toBe(true)+ expect(listTreeMap.parent1!.descendants.has('child1')).toBe(true)})it('should recursively populate ancestors for deeply nested items', () => {@@ -47,11 +47,11 @@ describe('recursivePushInParentDescendants', () => {child: makePageEntry({ page_id: 'child', parent_id: 'parent', page_name: 'Child' }),}- recursivePushInParentDescendants(pagesMap, listTreeMap, listTreeMap.child, listTreeMap.child)+ recursivePushInParentDescendants(pagesMap, listTreeMap, listTreeMap.child!, listTreeMap.child!)- expect(listTreeMap.child.depth).toBe(2)- expect(listTreeMap.child.ancestors).toContain('Grandparent')- expect(listTreeMap.child.ancestors).toContain('Parent')+ expect(listTreeMap.child!.depth).toBe(2)+ expect(listTreeMap.child!.ancestors).toContain('Grandparent')+ expect(listTreeMap.child!.ancestors).toContain('Parent')})it('should do nothing for root parent', () => {@@ -63,7 +63,7 @@ describe('recursivePushInParentDescendants', () => {root_child: makePageEntry({ page_id: 'root_child', parent_id: 'root', page_name: 'Root Child' }),}- recursivePushInParentDescendants(pagesMap, listTreeMap, listTreeMap.root_child, listTreeMap.root_child)+ recursivePushInParentDescendants(pagesMap, listTreeMap, listTreeMap.root_child!, listTreeMap.root_child!)// No new entries should be added since parent is rootexpect(Object.keys(listTreeMap)).toEqual(['root_child'])@@ -76,7 +76,7 @@ describe('recursivePushInParentDescendants', () => {// Should not throwrecursivePushInParentDescendants(pagesMap, listTreeMap, current, current)- expect(listTreeMap.orphan.depth).toBe(0)+ expect(listTreeMap.orphan!.depth).toBe(0)})it('should add to existing parent entry when parent already in tree', () => {@@ -91,10 +91,10 @@ describe('recursivePushInParentDescendants', () => {child2: makePageEntry({ page_id: 'child2', parent_id: 'parent', page_name: 'Child2' }),}- recursivePushInParentDescendants(pagesMap, listTreeMap, listTreeMap.child2, listTreeMap.child2)+ recursivePushInParentDescendants(pagesMap, listTreeMap, listTreeMap.child2!, listTreeMap.child2!)- expect(listTreeMap.parent.children.has('child2')).toBe(true)- expect(listTreeMap.parent.descendants.has('child2')).toBe(true)- expect(listTreeMap.parent.children.has('child1')).toBe(true)+ expect(listTreeMap.parent!.children.has('child2')).toBe(true)+ expect(listTreeMap.parent!.descendants.has('child2')).toBe(true)+ expect(listTreeMap.parent!.children.has('child1')).toBe(true)})})diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/__tests__/index.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/__tests__/index.spec.tsxindex 7c1941afd9c..6eed119ede2 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/__tests__/index.spec.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/__tests__/index.spec.tsx@@ -259,8 +259,8 @@ describe('OnlineDrive', () => {render(<OnlineDrive {...props} />)- expect(screen.getByTestId('header')).toBeInTheDocument()- expect(screen.getByTestId('file-list')).toBeInTheDocument()+ expect(screen.getByTestId('header'))!.toBeInTheDocument()+ expect(screen.getByTestId('file-list'))!.toBeInTheDocument()})it('should render Header with correct props', () => {@@ -271,9 +271,9 @@ describe('OnlineDrive', () => {render(<OnlineDrive {...props} />)- expect(screen.getByTestId('header-doc-title')).toHaveTextContent('Docs')- expect(screen.getByTestId('header-plugin-name')).toHaveTextContent('My Online Drive')- expect(screen.getByTestId('header-credential-id')).toHaveTextContent('cred-123')+ expect(screen.getByTestId('header-doc-title'))!.toHaveTextContent('Docs')+ expect(screen.getByTestId('header-plugin-name'))!.toHaveTextContent('My Online Drive')+ expect(screen.getByTestId('header-credential-id'))!.toHaveTextContent('cred-123')})it('should render FileList with correct props', () => {@@ -290,11 +290,11 @@ describe('OnlineDrive', () => {render(<OnlineDrive {...props} />)- expect(screen.getByTestId('file-list')).toBeInTheDocument()- expect(screen.getByTestId('file-list-keywords')).toHaveTextContent('search-term')- expect(screen.getByTestId('file-list-breadcrumbs')).toHaveTextContent('folder1/folder2')- expect(screen.getByTestId('file-list-bucket')).toHaveTextContent('my-bucket')- expect(screen.getByTestId('file-list-selected-count')).toHaveTextContent('2')+ expect(screen.getByTestId('file-list'))!.toBeInTheDocument()+ expect(screen.getByTestId('file-list-keywords'))!.toHaveTextContent('search-term')+ expect(screen.getByTestId('file-list-breadcrumbs'))!.toHaveTextContent('folder1/folder2')+ expect(screen.getByTestId('file-list-bucket'))!.toHaveTextContent('my-bucket')+ expect(screen.getByTestId('file-list-selected-count'))!.toHaveTextContent('2')})it('should pass docLink with correct path to Header', () => {@@ -371,7 +371,7 @@ describe('OnlineDrive', () => {render(<OnlineDrive {...props} />)- expect(screen.getByTestId('header-plugin-name')).toHaveTextContent('Custom Online Drive')+ expect(screen.getByTestId('header-plugin-name'))!.toHaveTextContent('Custom Online Drive')})})@@ -411,7 +411,7 @@ describe('OnlineDrive', () => {render(<OnlineDrive {...props} />)- expect(screen.getByTestId('file-list-is-in-pipeline')).toHaveTextContent('true')+ expect(screen.getByTestId('file-list-is-in-pipeline'))!.toHaveTextContent('true')})})@@ -421,7 +421,7 @@ describe('OnlineDrive', () => {render(<OnlineDrive {...props} />)- expect(screen.getByTestId('file-list-support-batch')).toHaveTextContent('true')+ expect(screen.getByTestId('file-list-support-batch'))!.toHaveTextContent('true')})it('should pass supportBatchUpload false to FileList when supportBatchUpload is false', () => {@@ -429,7 +429,7 @@ describe('OnlineDrive', () => {render(<OnlineDrive {...props} />)- expect(screen.getByTestId('file-list-support-batch')).toHaveTextContent('false')+ expect(screen.getByTestId('file-list-support-batch'))!.toHaveTextContent('false')})it.each([@@ -441,7 +441,7 @@ describe('OnlineDrive', () => {render(<OnlineDrive {...props} />)- expect(screen.getByTestId('file-list-support-batch')).toHaveTextContent(expected)+ expect(screen.getByTestId('file-list-support-batch'))!.toHaveTextContent(expected)})})@@ -504,7 +504,7 @@ describe('OnlineDrive', () => {render(<OnlineDrive {...props} />)await waitFor(() => {- expect(screen.getByTestId('file-list-loading')).toHaveTextContent('true')+ expect(screen.getByTestId('file-list-loading'))!.toHaveTextContent('true')})})@@ -566,7 +566,8 @@ describe('OnlineDrive', () => {render(<OnlineDrive {...props} />)// Assert - filteredOnlineDriveFileList should have 2 items matching 'test'- expect(screen.getByTestId('file-list-count')).toHaveTextContent('2')+ // Assert - filteredOnlineDriveFileList should have 2 items matching 'test'+ expect(screen.getByTestId('file-list-count'))!.toHaveTextContent('2')})it('should return all files when keywords is empty', () => {@@ -580,7 +581,7 @@ describe('OnlineDrive', () => {render(<OnlineDrive {...props} />)- expect(screen.getByTestId('file-list-count')).toHaveTextContent('3')+ expect(screen.getByTestId('file-list-count'))!.toHaveTextContent('3')})it('should filter files case-insensitively', () => {@@ -594,7 +595,7 @@ describe('OnlineDrive', () => {render(<OnlineDrive {...props} />)- expect(screen.getByTestId('file-list-count')).toHaveTextContent('2')+ expect(screen.getByTestId('file-list-count'))!.toHaveTextContent('2')})})@@ -932,7 +933,7 @@ describe('OnlineDrive', () => {render(<OnlineDrive {...props} />)- expect(screen.getByTestId('header-credentials-count')).toHaveTextContent('0')+ expect(screen.getByTestId('header-credentials-count'))!.toHaveTextContent('0')})it('should handle undefined credentials data', () => {@@ -943,7 +944,7 @@ describe('OnlineDrive', () => {render(<OnlineDrive {...props} />)- expect(screen.getByTestId('header-credentials-count')).toHaveTextContent('0')+ expect(screen.getByTestId('header-credentials-count'))!.toHaveTextContent('0')})it('should handle undefined pipelineId', async () => {@@ -969,7 +970,7 @@ describe('OnlineDrive', () => {render(<OnlineDrive {...props} />)- expect(screen.getByTestId('file-list-count')).toHaveTextContent('0')+ expect(screen.getByTestId('file-list-count'))!.toHaveTextContent('0')})it('should handle empty breadcrumbs', () => {@@ -978,7 +979,7 @@ describe('OnlineDrive', () => {render(<OnlineDrive {...props} />)- expect(screen.getByTestId('file-list-breadcrumbs')).toHaveTextContent('')+ expect(screen.getByTestId('file-list-breadcrumbs'))!.toHaveTextContent('')})it('should handle empty bucket', () => {@@ -987,7 +988,7 @@ describe('OnlineDrive', () => {render(<OnlineDrive {...props} />)- expect(screen.getByTestId('file-list-bucket')).toHaveTextContent('')+ expect(screen.getByTestId('file-list-bucket'))!.toHaveTextContent('')})it('should handle special characters in keywords', () => {@@ -1001,7 +1002,8 @@ describe('OnlineDrive', () => {render(<OnlineDrive {...props} />)// Assert - Should find file with special characters- expect(screen.getByTestId('file-list-count')).toHaveTextContent('1')+ // Assert - Should find file with special characters+ expect(screen.getByTestId('file-list-count'))!.toHaveTextContent('1')})it('should handle very long file names', () => {@@ -1013,7 +1015,7 @@ describe('OnlineDrive', () => {render(<OnlineDrive {...props} />)- expect(screen.getByTestId('file-list-count')).toHaveTextContent('1')+ expect(screen.getByTestId('file-list-count'))!.toHaveTextContent('1')})it('should handle bucket list initiation response', async () => {@@ -1051,10 +1053,10 @@ describe('OnlineDrive', () => {render(<OnlineDrive {...props} />)- expect(screen.getByTestId('header')).toBeInTheDocument()- expect(screen.getByTestId('file-list')).toBeInTheDocument()- expect(screen.getByTestId('file-list-is-in-pipeline')).toHaveTextContent(String(propVariation.isInPipeline))- expect(screen.getByTestId('file-list-support-batch')).toHaveTextContent(String(propVariation.supportBatchUpload))+ expect(screen.getByTestId('header'))!.toBeInTheDocument()+ expect(screen.getByTestId('file-list'))!.toBeInTheDocument()+ expect(screen.getByTestId('file-list-is-in-pipeline'))!.toHaveTextContent(String(propVariation.isInPipeline))+ expect(screen.getByTestId('file-list-support-batch'))!.toHaveTextContent(String(propVariation.supportBatchUpload))})it.each([@@ -1117,7 +1119,7 @@ describe('Header', () => {render(<Header {...props} />)- expect(screen.getByText('Documentation')).toBeInTheDocument()+ expect(screen.getByText('Documentation'))!.toBeInTheDocument()})it('should render doc link with correct href', () => {@@ -1129,9 +1131,9 @@ describe('Header', () => {render(<Header {...props} />)const link = screen.getByRole('link')- expect(link).toHaveAttribute('href', 'https://custom-docs.com/path')- expect(link).toHaveAttribute('target', '_blank')- expect(link).toHaveAttribute('rel', 'noopener noreferrer')+ expect(link)!.toHaveAttribute('href', 'https://custom-docs.com/path')+ expect(link)!.toHaveAttribute('target', '_blank')+ expect(link)!.toHaveAttribute('rel', 'noopener noreferrer')})it('should render doc title text', () => {@@ -1139,7 +1141,7 @@ describe('Header', () => {render(<Header {...props} />)- expect(screen.getByText('My Documentation Title')).toBeInTheDocument()+ expect(screen.getByText('My Documentation Title'))!.toBeInTheDocument()})it('should render configuration button', () => {@@ -1147,7 +1149,7 @@ describe('Header', () => {render(<Header {...props} />)- expect(screen.getByRole('button')).toBeInTheDocument()+ expect(screen.getByRole('button'))!.toBeInTheDocument()})})@@ -1164,7 +1166,7 @@ describe('Header', () => {render(<Header {...props} />)if (docTitle)- expect(screen.getByText(docTitle)).toBeInTheDocument()+ expect(screen.getByText(docTitle))!.toBeInTheDocument()})})@@ -1178,7 +1180,7 @@ describe('Header', () => {render(<Header {...props} />)- expect(screen.getByRole('link')).toHaveAttribute('href', docLink)+ expect(screen.getByRole('link'))!.toHaveAttribute('href', docLink)})})@@ -1209,7 +1211,7 @@ describe('Header', () => {render(<Header {...props} />)const titleSpan = screen.getByTitle('Accessible Title')- expect(titleSpan).toBeInTheDocument()+ expect(titleSpan)!.toBeInTheDocument()})})})@@ -1437,10 +1439,10 @@ describe('utils', () => {const result = convertOnlineDriveData(data, [], 'my-bucket')expect(result.fileList).toHaveLength(4)- expect(result.fileList[0].type).toBe(OnlineDriveFileType.folder)- expect(result.fileList[1].type).toBe(OnlineDriveFileType.file)- expect(result.fileList[2].type).toBe(OnlineDriveFileType.folder)- expect(result.fileList[3].type).toBe(OnlineDriveFileType.file)+ expect(result.fileList[0]!.type).toBe(OnlineDriveFileType.folder)+ expect(result.fileList[1]!.type).toBe(OnlineDriveFileType.file)+ expect(result.fileList[2]!.type).toBe(OnlineDriveFileType.folder)+ expect(result.fileList[3]!.type).toBe(OnlineDriveFileType.file)})})@@ -1539,7 +1541,7 @@ describe('utils', () => {const result = convertOnlineDriveData(data, [], 'my-bucket')- expect(result.fileList[0].size).toBe(0)+ expect(result.fileList[0]!.size).toBe(0)})it('should handle files with very large size', () => {@@ -1555,7 +1557,7 @@ describe('utils', () => {const result = convertOnlineDriveData(data, [], 'my-bucket')- expect(result.fileList[0].size).toBe(largeSize)+ expect(result.fileList[0]!.size).toBe(largeSize)})it('should handle files with special characters in name', () => {@@ -1574,9 +1576,9 @@ describe('utils', () => {const result = convertOnlineDriveData(data, [], 'my-bucket')- expect(result.fileList[0].name).toBe('file[1] (copy).txt')- expect(result.fileList[1].name).toBe('doc-with-dash_and_underscore.pdf')- expect(result.fileList[2].name).toBe('file with spaces.txt')+ expect(result.fileList[0]!.name).toBe('file[1] (copy).txt')+ expect(result.fileList[1]!.name).toBe('doc-with-dash_and_underscore.pdf')+ expect(result.fileList[2]!.name).toBe('file with spaces.txt')})it('should handle complex next_page_parameters', () => {diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/__tests__/utils.spec.ts b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/__tests__/utils.spec.tsindex 7c5761be8a2..9ac2ef9f890 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/__tests__/utils.spec.ts+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/__tests__/utils.spec.ts@@ -93,10 +93,10 @@ describe('online-drive utils', () => {const result = convertOnlineDriveData(data, [], 'bucket-1')expect(result.fileList).toHaveLength(2)- expect(result.fileList[0].type).toBe(OnlineDriveFileType.file)- expect(result.fileList[0].size).toBe(100)- expect(result.fileList[1].type).toBe(OnlineDriveFileType.folder)- expect(result.fileList[1].size).toBeUndefined()+ expect(result.fileList[0]!.type).toBe(OnlineDriveFileType.file)+ expect(result.fileList[0]!.size).toBe(100)+ expect(result.fileList[1]!.type).toBe(OnlineDriveFileType.folder)+ expect(result.fileList[1]!.size).toBeUndefined()expect(result.isTruncated).toBe(true)expect(result.nextPageParameters).toEqual({ token: 'next' })expect(result.hasBucket).toBe(true)diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/__tests__/index.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/__tests__/index.spec.tsxindex 07308361ad4..dcb1922fe92 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/__tests__/index.spec.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/__tests__/index.spec.tsx@@ -60,7 +60,8 @@ describe('Header', () => {render(<Header {...props} />)// Assert - search input should be visible- expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')).toBeInTheDocument()+ // Assert - search input should be visible+ expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder'))!.toBeInTheDocument()})it('should render with correct container styles', () => {@@ -70,12 +71,12 @@ describe('Header', () => {// Assert - container should have correct class namesconst wrapper = container.firstChild as HTMLElement- expect(wrapper).toHaveClass('flex')- expect(wrapper).toHaveClass('items-center')- expect(wrapper).toHaveClass('gap-x-2')- expect(wrapper).toHaveClass('bg-components-panel-bg')- expect(wrapper).toHaveClass('p-1')- expect(wrapper).toHaveClass('pl-3')+ expect(wrapper)!.toHaveClass('flex')+ expect(wrapper)!.toHaveClass('items-center')+ expect(wrapper)!.toHaveClass('gap-x-2')+ expect(wrapper)!.toHaveClass('bg-components-panel-bg')+ expect(wrapper)!.toHaveClass('p-1')+ expect(wrapper)!.toHaveClass('pl-3')})it('should render Input component with correct props', () => {@@ -84,8 +85,8 @@ describe('Header', () => {render(<Header {...props} />)const input = screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')- expect(input).toBeInTheDocument()- expect(input).toHaveValue('test-value')+ expect(input)!.toBeInTheDocument()+ expect(input)!.toHaveValue('test-value')})it('should render Input with search icon', () => {@@ -95,7 +96,7 @@ describe('Header', () => {// Assert - Input should have search icon classconst searchIcon = container.querySelector('.i-ri-search-line.h-4.w-4')- expect(searchIcon).toBeInTheDocument()+ expect(searchIcon)!.toBeInTheDocument()})it('should render Input with correct wrapper width', () => {@@ -105,7 +106,7 @@ describe('Header', () => {// Assert - Input wrapper should have w-[200px] classconst inputWrapper = container.querySelector('.w-\\[200px\\]')- expect(inputWrapper).toBeInTheDocument()+ expect(inputWrapper)!.toBeInTheDocument()})})@@ -117,7 +118,7 @@ describe('Header', () => {render(<Header {...props} />)const input = screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')- expect(input).toHaveValue('')+ expect(input)!.toHaveValue('')})it('should display input value correctly', () => {@@ -126,7 +127,7 @@ describe('Header', () => {render(<Header {...props} />)const input = screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')- expect(input).toHaveValue('search-query')+ expect(input)!.toHaveValue('search-query')})it('should handle special characters in inputValue', () => {@@ -136,7 +137,7 @@ describe('Header', () => {render(<Header {...props} />)const input = screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')- expect(input).toHaveValue(specialChars)+ expect(input)!.toHaveValue(specialChars)})it('should handle unicode characters in inputValue', () => {@@ -146,7 +147,7 @@ describe('Header', () => {render(<Header {...props} />)const input = screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')- expect(input).toHaveValue(unicodeValue)+ expect(input)!.toHaveValue(unicodeValue)})})@@ -157,7 +158,8 @@ describe('Header', () => {render(<Header {...props} />)// Assert - Component should render without errors- expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')).toBeInTheDocument()+ // Assert - Component should render without errors+ expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder'))!.toBeInTheDocument()})it('should render with single breadcrumb', () => {@@ -165,7 +167,7 @@ describe('Header', () => {render(<Header {...props} />)- expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder'))!.toBeInTheDocument()})it('should render with multiple breadcrumbs', () => {@@ -173,7 +175,7 @@ describe('Header', () => {render(<Header {...props} />)- expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder'))!.toBeInTheDocument()})})@@ -184,7 +186,8 @@ describe('Header', () => {render(<Header {...props} />)// Assert - keywords are passed through, component renders- expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')).toBeInTheDocument()+ // Assert - keywords are passed through, component renders+ expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder'))!.toBeInTheDocument()})})@@ -194,7 +197,7 @@ describe('Header', () => {render(<Header {...props} />)- expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder'))!.toBeInTheDocument()})it('should render with bucket value', () => {@@ -202,7 +205,7 @@ describe('Header', () => {render(<Header {...props} />)- expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder'))!.toBeInTheDocument()})})@@ -212,7 +215,7 @@ describe('Header', () => {render(<Header {...props} />)- expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder'))!.toBeInTheDocument()})it('should handle positive search results', () => {@@ -221,7 +224,8 @@ describe('Header', () => {render(<Header {...props} />)// Assert - Breadcrumbs will show search results text when keywords exist and results > 0- expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')).toBeInTheDocument()+ // Assert - Breadcrumbs will show search results text when keywords exist and results > 0+ expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder'))!.toBeInTheDocument()})it('should handle large search results count', () => {@@ -229,7 +233,7 @@ describe('Header', () => {render(<Header {...props} />)- expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder'))!.toBeInTheDocument()})})@@ -239,7 +243,7 @@ describe('Header', () => {render(<Header {...props} />)- expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder'))!.toBeInTheDocument()})it('should render correctly when isInPipeline is true', () => {@@ -247,7 +251,7 @@ describe('Header', () => {render(<Header {...props} />)- expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder'))!.toBeInTheDocument()})})})@@ -265,7 +269,7 @@ describe('Header', () => {expect(mockHandleInputChange).toHaveBeenCalledTimes(1)// Verify that onChange event was triggered (React's synthetic event structure)- expect(mockHandleInputChange.mock.calls[0][0]).toHaveProperty('type', 'change')+ expect(mockHandleInputChange.mock.calls[0]![0]).toHaveProperty('type', 'change')})it('should call handleInputChange on each keystroke', () => {@@ -290,7 +294,7 @@ describe('Header', () => {fireEvent.change(input, { target: { value: '' } })expect(mockHandleInputChange).toHaveBeenCalledTimes(1)- expect(mockHandleInputChange.mock.calls[0][0]).toHaveProperty('type', 'change')+ expect(mockHandleInputChange.mock.calls[0]![0]).toHaveProperty('type', 'change')})it('should handle whitespace-only input', () => {@@ -302,7 +306,7 @@ describe('Header', () => {fireEvent.change(input, { target: { value: ' ' } })expect(mockHandleInputChange).toHaveBeenCalledTimes(1)- expect(mockHandleInputChange.mock.calls[0][0]).toHaveProperty('type', 'change')+ expect(mockHandleInputChange.mock.calls[0]![0]).toHaveProperty('type', 'change')})})@@ -317,7 +321,7 @@ describe('Header', () => {// Act - Find and click the clear icon containerconst clearButton = screen.getByTestId('input-clear')- expect(clearButton).toBeInTheDocument()+ expect(clearButton)!.toBeInTheDocument()fireEvent.click(clearButton!)expect(mockHandleResetKeywords).toHaveBeenCalledTimes(1)@@ -338,7 +342,7 @@ describe('Header', () => {// Act & Assert - Clear icon should be visibleconst clearIcon = screen.getByTestId('input-clear')- expect(clearIcon).toBeInTheDocument()+ expect(clearIcon)!.toBeInTheDocument()})})})@@ -365,21 +369,23 @@ describe('Header', () => {rerender(<Header {...props} />)// Assert - Component renders without errors- expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')).toBeInTheDocument()+ // Assert - Component renders without errors+ expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder'))!.toBeInTheDocument()})it('should re-render when inputValue changes', () => {const props = createDefaultProps({ inputValue: 'initial' })const { rerender } = render(<Header {...props} />)const input = screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')- expect(input).toHaveValue('initial')+ expect(input)!.toHaveValue('initial')// Act - Rerender with different inputValueconst newProps = createDefaultProps({ inputValue: 'changed' })rerender(<Header {...newProps} />)// Assert - Input value should be updated- expect(input).toHaveValue('changed')+ // Assert - Input value should be updated+ expect(input)!.toHaveValue('changed')})it('should re-render when breadcrumbs change', () => {@@ -391,7 +397,8 @@ describe('Header', () => {rerender(<Header {...newProps} />)// Assert - Component renders without errors- expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')).toBeInTheDocument()+ // Assert - Component renders without errors+ expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder'))!.toBeInTheDocument()})it('should re-render when keywords change', () => {@@ -403,7 +410,8 @@ describe('Header', () => {rerender(<Header {...newProps} />)// Assert - Component renders without errors- expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')).toBeInTheDocument()+ // Assert - Component renders without errors+ expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder'))!.toBeInTheDocument()})})@@ -415,7 +423,7 @@ describe('Header', () => {render(<Header {...props} />)const input = screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')- expect(input).toHaveValue(longValue)+ expect(input)!.toHaveValue(longValue)})it('should handle very long breadcrumb paths', () => {@@ -424,7 +432,7 @@ describe('Header', () => {render(<Header {...props} />)- expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder'))!.toBeInTheDocument()})it('should handle breadcrumbs with special characters', () => {@@ -433,7 +441,7 @@ describe('Header', () => {render(<Header {...props} />)- expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder'))!.toBeInTheDocument()})it('should handle breadcrumbs with unicode names', () => {@@ -442,7 +450,7 @@ describe('Header', () => {render(<Header {...props} />)- expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder'))!.toBeInTheDocument()})it('should handle bucket with special characters', () => {@@ -450,7 +458,7 @@ describe('Header', () => {render(<Header {...props} />)- expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder'))!.toBeInTheDocument()})it('should pass the event object to handleInputChange callback', () => {@@ -463,7 +471,7 @@ describe('Header', () => {// Assert - Verify the event object is passed correctlyexpect(mockHandleInputChange).toHaveBeenCalledTimes(1)- const eventArg = mockHandleInputChange.mock.calls[0][0]+ const eventArg = mockHandleInputChange.mock.calls[0]![0]expect(eventArg).toHaveProperty('type', 'change')expect(eventArg).toHaveProperty('target')})@@ -480,7 +488,7 @@ describe('Header', () => {render(<Header {...props} />)- expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder'))!.toBeInTheDocument()})it.each([@@ -493,7 +501,7 @@ describe('Header', () => {render(<Header {...props} />)- expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder'))!.toBeInTheDocument()})it.each([@@ -507,7 +515,7 @@ describe('Header', () => {render(<Header {...props} />)const input = screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')- expect(input).toHaveValue(inputValue)+ expect(input)!.toHaveValue(inputValue)})})@@ -525,7 +533,8 @@ describe('Header', () => {render(<Header {...props} />)// Assert - Component should render successfully, meaning props are passed correctly- expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')).toBeInTheDocument()+ // Assert - Component should render successfully, meaning props are passed correctly+ expect(screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder'))!.toBeInTheDocument()})it('should pass correct props to Input component', () => {@@ -540,7 +549,7 @@ describe('Header', () => {render(<Header {...props} />)const input = screen.getByPlaceholderText('datasetPipeline.onlineDrive.breadcrumbs.searchPlaceholder')- expect(input).toHaveValue('test-input')+ expect(input)!.toHaveValue('test-input')// Test onChange handlerfireEvent.change(input, { target: { value: 'new-value' } })diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/__tests__/bucket.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/__tests__/bucket.spec.tsxindex c407be51acd..83e17e6e04e 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/__tests__/bucket.spec.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/__tests__/bucket.spec.tsx@@ -22,18 +22,18 @@ describe('Bucket', () => {it('should render bucket name', () => {render(<Bucket {...defaultProps} />)- expect(screen.getByText('my-bucket')).toBeInTheDocument()+ expect(screen.getByText('my-bucket'))!.toBeInTheDocument()})it('should render bucket icon', () => {render(<Bucket {...defaultProps} />)- expect(screen.getByTestId('buckets-gray')).toBeInTheDocument()+ expect(screen.getByTestId('buckets-gray'))!.toBeInTheDocument()})it('should call handleBackToBucketList on icon button click', () => {render(<Bucket {...defaultProps} />)const buttons = screen.getAllByRole('button')- fireEvent.click(buttons[0])+ fireEvent.click(buttons[0]!)expect(defaultProps.handleBackToBucketList).toHaveBeenCalledOnce()})diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/__tests__/index.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/__tests__/index.spec.tsxindex a6aaf3a50b4..24a241ff93f 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/__tests__/index.spec.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/__tests__/index.spec.tsx@@ -58,7 +58,7 @@ describe('Breadcrumbs', () => {// Assert - Container should be in the documentconst container = document.querySelector('.flex.grow')- expect(container).toBeInTheDocument()+ expect(container)!.toBeInTheDocument()})it('should render with correct container styles', () => {@@ -67,10 +67,10 @@ describe('Breadcrumbs', () => {const { container } = render(<Breadcrumbs {...props} />)const wrapper = container.firstChild as HTMLElement- expect(wrapper).toHaveClass('flex')- expect(wrapper).toHaveClass('grow')- expect(wrapper).toHaveClass('items-center')- expect(wrapper).toHaveClass('overflow-hidden')+ expect(wrapper)!.toHaveClass('flex')+ expect(wrapper)!.toHaveClass('grow')+ expect(wrapper)!.toHaveClass('items-center')+ expect(wrapper)!.toHaveClass('overflow-hidden')})describe('Search Results Display', () => {@@ -84,7 +84,8 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)// Assert - Search result text should be displayed- expect(screen.getByText(/datasetPipeline\.onlineDrive\.breadcrumbs\.searchResult/)).toBeInTheDocument()+ // Assert - Search result text should be displayed+ expect(screen.getByText(/datasetPipeline\.onlineDrive\.breadcrumbs\.searchResult/))!.toBeInTheDocument()})it('should not show search results when keywords is empty', () => {@@ -121,7 +122,8 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)// Assert - Should use bucket name in search result- expect(screen.getByText(/searchResult.*my-bucket/i)).toBeInTheDocument()+ // Assert - Should use bucket name in search result+ expect(screen.getByText(/searchResult.*my-bucket/i))!.toBeInTheDocument()})it('should use last breadcrumb as folderName when breadcrumbs exist', () => {@@ -135,7 +137,8 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)// Assert - Should use last breadcrumb in search result- expect(screen.getByText(/searchResult.*folder2/i)).toBeInTheDocument()+ // Assert - Should use last breadcrumb in search result+ expect(screen.getByText(/searchResult.*folder2/i))!.toBeInTheDocument()})})@@ -150,7 +153,7 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)- expect(screen.getByText('datasetPipeline.onlineDrive.breadcrumbs.allBuckets')).toBeInTheDocument()+ expect(screen.getByText('datasetPipeline.onlineDrive.breadcrumbs.allBuckets'))!.toBeInTheDocument()})it('should not show all buckets title when breadcrumbs exist', () => {@@ -174,6 +177,37 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead+ // Assert - Should show bucket name instead// Assert - Should show bucket name insteadexpect(screen.queryByText('datasetPipeline.onlineDrive.breadcrumbs.allBuckets')).not.toBeInTheDocument()})@@ -190,7 +224,8 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)// Assert - Bucket name should be displayed- expect(screen.getByText('test-bucket')).toBeInTheDocument()+ // Assert - Bucket name should be displayed+ expect(screen.getByText('test-bucket'))!.toBeInTheDocument()})it('should not render Bucket when hasBucket is false', () => {@@ -202,6 +237,37 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead+ // Assert - Bucket should not be displayed, Drive should be shown instead// Assert - Bucket should not be displayed, Drive should be shown insteadexpect(screen.queryByText('test-bucket')).not.toBeInTheDocument()})@@ -217,7 +283,8 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)// Assert - "All Files" should be displayed- expect(screen.getByText('datasetPipeline.onlineDrive.breadcrumbs.allFiles')).toBeInTheDocument()+ // Assert - "All Files" should be displayed+ expect(screen.getByText('datasetPipeline.onlineDrive.breadcrumbs.allFiles'))!.toBeInTheDocument()})it('should not render Drive component when hasBucket is true', () => {@@ -243,8 +310,8 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)- expect(screen.getByText('folder1')).toBeInTheDocument()- expect(screen.getByText('folder2')).toBeInTheDocument()+ expect(screen.getByText('folder1'))!.toBeInTheDocument()+ expect(screen.getByText('folder2'))!.toBeInTheDocument()})it('should render last breadcrumb as active', () => {@@ -257,8 +324,8 @@ describe('Breadcrumbs', () => {// Assert - Last breadcrumb should have active stylesconst lastBreadcrumb = screen.getByText('folder2')- expect(lastBreadcrumb).toHaveClass('system-sm-medium')- expect(lastBreadcrumb).toHaveClass('text-text-secondary')+ expect(lastBreadcrumb)!.toHaveClass('system-sm-medium')+ expect(lastBreadcrumb)!.toHaveClass('text-text-secondary')})it('should render non-last breadcrumbs with tertiary styles', () => {@@ -271,8 +338,8 @@ describe('Breadcrumbs', () => {// Assert - First breadcrumb should have tertiary stylesconst firstBreadcrumb = screen.getByText('folder1')- expect(firstBreadcrumb).toHaveClass('system-sm-regular')- expect(firstBreadcrumb).toHaveClass('text-text-tertiary')+ expect(firstBreadcrumb)!.toHaveClass('system-sm-regular')+ expect(firstBreadcrumb)!.toHaveClass('text-text-tertiary')})})@@ -287,7 +354,8 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)// Assert - Dropdown trigger (more button) should be present- expect(screen.getByRole('button', { name: '' })).toBeInTheDocument()+ // Assert - Dropdown trigger (more button) should be present+ expect(screen.getByRole('button', { name: '' }))!.toBeInTheDocument()})it('should not show dropdown when breadcrumbs do not exceed displayBreadcrumbNum', () => {@@ -301,8 +369,10 @@ describe('Breadcrumbs', () => {// Assert - Should not have dropdown, just regular breadcrumbs// All breadcrumbs should be directly visible- expect(screen.getByText('folder1')).toBeInTheDocument()- expect(screen.getByText('folder2')).toBeInTheDocument()+ // Assert - Should not have dropdown, just regular breadcrumbs+ // All breadcrumbs should be directly visible+ expect(screen.getByText('folder1'))!.toBeInTheDocument()+ expect(screen.getByText('folder2'))!.toBeInTheDocument()// Count buttons - should be 3 (allFiles + folder1 + folder2)const buttons = container.querySelectorAll('button')expect(buttons.length).toBe(3)@@ -318,9 +388,41 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)// Assert - First breadcrumb and last breadcrumb should be visible- expect(screen.getByText('folder1')).toBeInTheDocument()- expect(screen.getByText('folder2')).toBeInTheDocument()- expect(screen.getByText('folder5')).toBeInTheDocument()+ // Assert - First breadcrumb and last breadcrumb should be visible+ expect(screen.getByText('folder1'))!.toBeInTheDocument()+ expect(screen.getByText('folder2'))!.toBeInTheDocument()+ expect(screen.getByText('folder5'))!.toBeInTheDocument()+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown+ // Middle breadcrumbs should be in dropdown// Middle breadcrumbs should be in dropdownexpect(screen.queryByText('folder3')).not.toBeInTheDocument()expect(screen.queryByText('folder4')).not.toBeInTheDocument()@@ -341,8 +443,8 @@ describe('Breadcrumbs', () => {// Assert - Collapsed breadcrumbs should be visibleawait waitFor(() => {- expect(screen.getByText('folder3')).toBeInTheDocument()- expect(screen.getByText('folder4')).toBeInTheDocument()+ expect(screen.getByText('folder3'))!.toBeInTheDocument()+ expect(screen.getByText('folder4'))!.toBeInTheDocument()})})})@@ -357,7 +459,8 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)// Assert - Only Drive should be visible- expect(screen.getByText('datasetPipeline.onlineDrive.breadcrumbs.allFiles')).toBeInTheDocument()+ // Assert - Only Drive should be visible+ expect(screen.getByText('datasetPipeline.onlineDrive.breadcrumbs.allFiles'))!.toBeInTheDocument()})it('should handle single breadcrumb', () => {@@ -366,7 +469,7 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)- expect(screen.getByText('single-folder')).toBeInTheDocument()+ expect(screen.getByText('single-folder'))!.toBeInTheDocument()})it('should handle breadcrumbs with special characters', () => {@@ -377,8 +480,8 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)- expect(screen.getByText('folder [1]')).toBeInTheDocument()- expect(screen.getByText('folder (copy)')).toBeInTheDocument()+ expect(screen.getByText('folder [1]'))!.toBeInTheDocument()+ expect(screen.getByText('folder (copy)'))!.toBeInTheDocument()})it('should handle breadcrumbs with unicode characters', () => {@@ -389,8 +492,8 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)- expect(screen.getByText('文件夹')).toBeInTheDocument()- expect(screen.getByText('フォルダ')).toBeInTheDocument()+ expect(screen.getByText('文件夹'))!.toBeInTheDocument()+ expect(screen.getByText('フォルダ'))!.toBeInTheDocument()})})@@ -403,7 +506,7 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)- expect(screen.getByText(/searchResult/)).toBeInTheDocument()+ expect(screen.getByText(/searchResult/))!.toBeInTheDocument()})it('should handle whitespace keywords', () => {@@ -415,7 +518,8 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)// Assert - Whitespace is truthy, so should show search results- expect(screen.getByText(/searchResult/)).toBeInTheDocument()+ // Assert - Whitespace is truthy, so should show search results+ expect(screen.getByText(/searchResult/))!.toBeInTheDocument()})})@@ -428,7 +532,7 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)- expect(screen.getByText('production-bucket')).toBeInTheDocument()+ expect(screen.getByText('production-bucket'))!.toBeInTheDocument()})it('should handle bucket with special characters', () => {@@ -439,7 +543,7 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)- expect(screen.getByText('bucket-v2.0_backup')).toBeInTheDocument()+ expect(screen.getByText('bucket-v2.0_backup'))!.toBeInTheDocument()})})@@ -452,6 +556,37 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results+ // Assert - Should not show search results// Assert - Should not show search resultsexpect(screen.queryByText(/searchResult/)).not.toBeInTheDocument()})@@ -464,7 +599,7 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)- expect(screen.getByText(/searchResult.*10000/)).toBeInTheDocument()+ expect(screen.getByText(/searchResult.*10000/))!.toBeInTheDocument()})})@@ -495,9 +630,10 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)// Assert - Should NOT collapse because 3 <= 3- expect(screen.getByText('folder1')).toBeInTheDocument()- expect(screen.getByText('folder2')).toBeInTheDocument()- expect(screen.getByText('folder3')).toBeInTheDocument()+ // Assert - Should NOT collapse because 3 <= 3+ expect(screen.getByText('folder1'))!.toBeInTheDocument()+ expect(screen.getByText('folder2'))!.toBeInTheDocument()+ expect(screen.getByText('folder3'))!.toBeInTheDocument()})it('should reduce displayBreadcrumbNum by 1 when bucket is set', () => {@@ -533,9 +669,11 @@ describe('Breadcrumbs', () => {// Assert - displayBreadcrumbNum = 3, so 4 breadcrumbs should collapse// First 2 visible, dropdown, last 1 visible- expect(screen.getByText('a')).toBeInTheDocument()- expect(screen.getByText('b')).toBeInTheDocument()- expect(screen.getByText('d')).toBeInTheDocument()+ // Assert - displayBreadcrumbNum = 3, so 4 breadcrumbs should collapse+ // First 2 visible, dropdown, last 1 visible+ expect(screen.getByText('a'))!.toBeInTheDocument()+ expect(screen.getByText('b'))!.toBeInTheDocument()+ expect(screen.getByText('d'))!.toBeInTheDocument()expect(screen.queryByText('c')).not.toBeInTheDocument()})@@ -550,8 +688,9 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)// Assert - displayBreadcrumbNum = 2, so 3 breadcrumbs should collapse- expect(screen.getByText('a')).toBeInTheDocument()- expect(screen.getByText('c')).toBeInTheDocument()+ // Assert - displayBreadcrumbNum = 2, so 3 breadcrumbs should collapse+ expect(screen.getByText('a'))!.toBeInTheDocument()+ expect(screen.getByText('c'))!.toBeInTheDocument()expect(screen.queryByText('b')).not.toBeInTheDocument()})@@ -566,8 +705,9 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)// Assert - displayBreadcrumbNum = 3 - 1 = 2, so 3 breadcrumbs should collapse- expect(screen.getByText('a')).toBeInTheDocument()- expect(screen.getByText('c')).toBeInTheDocument()+ // Assert - displayBreadcrumbNum = 3 - 1 = 2, so 3 breadcrumbs should collapse+ expect(screen.getByText('a'))!.toBeInTheDocument()+ expect(screen.getByText('c'))!.toBeInTheDocument()expect(screen.queryByText('b')).not.toBeInTheDocument()})})@@ -589,12 +729,15 @@ describe('Breadcrumbs', () => {// prefixBreadcrumbs = ['f1', 'f2']// collapsedBreadcrumbs = ['f3', 'f4']// lastBreadcrumb = 'f5'- expect(screen.getByText('f1')).toBeInTheDocument()- expect(screen.getByText('f2')).toBeInTheDocument()- expect(screen.getByText('f5')).toBeInTheDocument()+ // prefixBreadcrumbs = ['f1', 'f2']+ // collapsedBreadcrumbs = ['f3', 'f4']+ // lastBreadcrumb = 'f5'+ expect(screen.getByText('f1'))!.toBeInTheDocument()+ expect(screen.getByText('f2'))!.toBeInTheDocument()+ expect(screen.getByText('f5'))!.toBeInTheDocument()await waitFor(() => {- expect(screen.getByText('f3')).toBeInTheDocument()- expect(screen.getByText('f4')).toBeInTheDocument()+ expect(screen.getByText('f3'))!.toBeInTheDocument()+ expect(screen.getByText('f4'))!.toBeInTheDocument()})})@@ -608,8 +751,9 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)// Assert - All breadcrumbs should be visible- expect(screen.getByText('f1')).toBeInTheDocument()- expect(screen.getByText('f2')).toBeInTheDocument()+ // Assert - All breadcrumbs should be visible+ expect(screen.getByText('f1'))!.toBeInTheDocument()+ expect(screen.getByText('f2'))!.toBeInTheDocument()})})})@@ -627,7 +771,7 @@ describe('Breadcrumbs', () => {// Act - Click bucket icon button (first button in Bucket component)const buttons = screen.getAllByRole('button')- fireEvent.click(buttons[0]) // Bucket icon button+ fireEvent.click(buttons[0]!) // Bucket icon buttonexpect(mockStoreState.setOnlineDriveFileList).toHaveBeenCalledWith([])expect(mockStoreState.setSelectedFileIds).toHaveBeenCalledWith([])@@ -744,7 +888,7 @@ describe('Breadcrumbs', () => {fireEvent.click(dropdownTrigger)await waitFor(() => {- expect(screen.getByText('f3')).toBeInTheDocument()+ expect(screen.getByText('f3'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('f3'))@@ -771,19 +915,19 @@ describe('Breadcrumbs', () => {// Assert - Component should render without errorsconst container = document.querySelector('.flex.grow')- expect(container).toBeInTheDocument()+ expect(container)!.toBeInTheDocument()})it('should re-render when breadcrumbs change', () => {mockStoreState.hasBucket = falseconst props = createDefaultProps({ breadcrumbs: ['folder1'] })const { rerender } = render(<Breadcrumbs {...props} />)- expect(screen.getByText('folder1')).toBeInTheDocument()+ expect(screen.getByText('folder1'))!.toBeInTheDocument()// Act - Rerender with different breadcrumbsrerender(<Breadcrumbs {...createDefaultProps({ breadcrumbs: ['folder2'] })} />)- expect(screen.getByText('folder2')).toBeInTheDocument()+ expect(screen.getByText('folder2'))!.toBeInTheDocument()})})@@ -798,7 +942,7 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)- expect(screen.getByText(longName)).toBeInTheDocument()+ expect(screen.getByText(longName))!.toBeInTheDocument()})it('should handle many breadcrumbs', async () => {@@ -815,11 +959,12 @@ describe('Breadcrumbs', () => {fireEvent.click(dropdownTrigger)// Assert - First, last, and collapsed should be accessible- expect(screen.getByText('folder-0')).toBeInTheDocument()- expect(screen.getByText('folder-1')).toBeInTheDocument()- expect(screen.getByText('folder-19')).toBeInTheDocument()+ // Assert - First, last, and collapsed should be accessible+ expect(screen.getByText('folder-0'))!.toBeInTheDocument()+ expect(screen.getByText('folder-1'))!.toBeInTheDocument()+ expect(screen.getByText('folder-19'))!.toBeInTheDocument()await waitFor(() => {- expect(screen.getByText('folder-2')).toBeInTheDocument()+ expect(screen.getByText('folder-2'))!.toBeInTheDocument()})})@@ -833,7 +978,8 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)// Assert - Should show all buckets title- expect(screen.getByText('datasetPipeline.onlineDrive.breadcrumbs.allBuckets')).toBeInTheDocument()+ // Assert - Should show all buckets title+ expect(screen.getByText('datasetPipeline.onlineDrive.breadcrumbs.allBuckets'))!.toBeInTheDocument()})it('should handle breadcrumb with only whitespace', () => {@@ -845,7 +991,8 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)// Assert - Both should be rendered- expect(screen.getByText('normal-folder')).toBeInTheDocument()+ // Assert - Both should be rendered+ expect(screen.getByText('normal-folder'))!.toBeInTheDocument()})})@@ -863,7 +1010,7 @@ describe('Breadcrumbs', () => {// Assert - Component should render without errorsconst container = document.querySelector('.flex.grow')- expect(container).toBeInTheDocument()+ expect(container)!.toBeInTheDocument()})it.each([@@ -916,7 +1063,8 @@ describe('Breadcrumbs', () => {render(<Breadcrumbs {...props} />)// Assert - Search result should be shown, navigation elements should be hidden- expect(screen.getByText(/searchResult/)).toBeInTheDocument()+ // Assert - Search result should be shown, navigation elements should be hidden+ expect(screen.getByText(/searchResult/))!.toBeInTheDocument()expect(screen.queryByText('my-bucket')).not.toBeInTheDocument()})})diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/dropdown/__tests__/index.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/dropdown/__tests__/index.spec.tsxindex 0157d3cf799..f7112c243b0 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/dropdown/__tests__/index.spec.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/dropdown/__tests__/index.spec.tsx@@ -23,7 +23,8 @@ describe('Dropdown', () => {render(<Dropdown {...props} />)// Assert - Trigger button should be visible- expect(screen.getByRole('button')).toBeInTheDocument()+ // Assert - Trigger button should be visible+ expect(screen.getByRole('button'))!.toBeInTheDocument()})it('should render trigger button with more icon', () => {@@ -33,8 +34,8 @@ describe('Dropdown', () => {// Assert - Button should have RiMoreFill icon (rendered as svg)const button = screen.getByRole('button')- expect(button).toBeInTheDocument()- expect(container.querySelector('svg')).toBeInTheDocument()+ expect(button)!.toBeInTheDocument()+ expect(container.querySelector('svg'))!.toBeInTheDocument()})it('should render separator after dropdown', () => {@@ -43,7 +44,8 @@ describe('Dropdown', () => {render(<Dropdown {...props} />)// Assert - Separator "/" should be visible- expect(screen.getByText('/')).toBeInTheDocument()+ // Assert - Separator "/" should be visible+ expect(screen.getByText('/'))!.toBeInTheDocument()})it('should render trigger button with correct default styles', () => {@@ -52,11 +54,11 @@ describe('Dropdown', () => {render(<Dropdown {...props} />)const button = screen.getByRole('button')- expect(button).toHaveClass('flex')- expect(button).toHaveClass('size-6')- expect(button).toHaveClass('items-center')- expect(button).toHaveClass('justify-center')- expect(button).toHaveClass('rounded-md')+ expect(button)!.toHaveClass('flex')+ expect(button)!.toHaveClass('size-6')+ expect(button)!.toHaveClass('items-center')+ expect(button)!.toHaveClass('justify-center')+ expect(button)!.toHaveClass('rounded-md')})it('should not render menu content when closed', () => {@@ -64,6 +66,37 @@ describe('Dropdown', () => {render(<Dropdown {...props} />)+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed+ // Assert - Menu content should not be visible when dropdown is closed// Assert - Menu content should not be visible when dropdown is closedexpect(screen.queryByText('visible-folder')).not.toBeInTheDocument()})@@ -77,8 +110,8 @@ describe('Dropdown', () => {// Assert - Menu items should be visibleawait waitFor(() => {- expect(screen.getByText('test-folder1')).toBeInTheDocument()- expect(screen.getByText('test-folder2')).toBeInTheDocument()+ expect(screen.getByText('test-folder1'))!.toBeInTheDocument()+ expect(screen.getByText('test-folder2'))!.toBeInTheDocument()})})})@@ -98,7 +131,7 @@ describe('Dropdown', () => {fireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText('folder1')).toBeInTheDocument()+ expect(screen.getByText('folder1'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('folder1'))@@ -120,7 +153,7 @@ describe('Dropdown', () => {fireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText('folder2')).toBeInTheDocument()+ expect(screen.getByText('folder2'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('folder2'))@@ -140,9 +173,9 @@ describe('Dropdown', () => {fireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText('folder-a')).toBeInTheDocument()- expect(screen.getByText('folder-b')).toBeInTheDocument()- expect(screen.getByText('folder-c')).toBeInTheDocument()+ expect(screen.getByText('folder-a'))!.toBeInTheDocument()+ expect(screen.getByText('folder-b'))!.toBeInTheDocument()+ expect(screen.getByText('folder-c'))!.toBeInTheDocument()})})@@ -155,7 +188,7 @@ describe('Dropdown', () => {fireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText('single-folder')).toBeInTheDocument()+ expect(screen.getByText('single-folder'))!.toBeInTheDocument()})})@@ -170,7 +203,8 @@ describe('Dropdown', () => {// Assert - Menu should be rendered but with no itemsawait waitFor(() => {// The menu container should exist but be empty- expect(screen.getByRole('button')).toBeInTheDocument()+ // The menu container should exist but be empty+ expect(screen.getByRole('button'))!.toBeInTheDocument()})})@@ -183,9 +217,9 @@ describe('Dropdown', () => {fireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText('folder [1]')).toBeInTheDocument()- expect(screen.getByText('folder (copy)')).toBeInTheDocument()- expect(screen.getByText('folder-v2.0')).toBeInTheDocument()+ expect(screen.getByText('folder [1]'))!.toBeInTheDocument()+ expect(screen.getByText('folder (copy)'))!.toBeInTheDocument()+ expect(screen.getByText('folder-v2.0'))!.toBeInTheDocument()})})@@ -198,9 +232,9 @@ describe('Dropdown', () => {fireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText('文件夹')).toBeInTheDocument()- expect(screen.getByText('フォルダ')).toBeInTheDocument()- expect(screen.getByText('Папка')).toBeInTheDocument()+ expect(screen.getByText('文件夹'))!.toBeInTheDocument()+ expect(screen.getByText('フォルダ'))!.toBeInTheDocument()+ expect(screen.getByText('Папка'))!.toBeInTheDocument()})})})@@ -218,7 +252,7 @@ describe('Dropdown', () => {fireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText('folder1')).toBeInTheDocument()+ expect(screen.getByText('folder1'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('folder1'))@@ -236,6 +270,37 @@ describe('Dropdown', () => {render(<Dropdown {...props} />)+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible+ // Assert - Menu content should not be visible// Assert - Menu content should not be visibleexpect(screen.queryByText('test-folder')).not.toBeInTheDocument()})@@ -247,7 +312,7 @@ describe('Dropdown', () => {fireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText('test-folder')).toBeInTheDocument()+ expect(screen.getByText('test-folder'))!.toBeInTheDocument()})})@@ -258,7 +323,7 @@ describe('Dropdown', () => {// Act - Open and then closefireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText('test-folder')).toBeInTheDocument()+ expect(screen.getByText('test-folder'))!.toBeInTheDocument()})fireEvent.click(screen.getByRole('button'))@@ -280,7 +345,7 @@ describe('Dropdown', () => {fireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText('test-folder')).toBeInTheDocument()+ expect(screen.getByText('test-folder'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('test-folder'))@@ -297,14 +362,15 @@ describe('Dropdown', () => {const button = screen.getByRole('button')// Assert - Initial state (closed): should have hover:bg-state-base-hover- expect(button).toHaveClass('hover:bg-state-base-hover')+ // Assert - Initial state (closed): should have hover:bg-state-base-hover+ expect(button)!.toHaveClass('hover:bg-state-base-hover')// Act - Open dropdownfireEvent.click(button)// Assert - Open state: should have bg-state-base-hoverawait waitFor(() => {- expect(button).toHaveClass('bg-state-base-hover')+ expect(button)!.toHaveClass('bg-state-base-hover')})})})@@ -317,6 +383,37 @@ describe('Dropdown', () => {const props = createDefaultProps({ breadcrumbs: ['folder'] })render(<Dropdown {...props} />)+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed+ // Act & Assert - Initially closed// Act & Assert - Initially closedexpect(screen.queryByText('folder')).not.toBeInTheDocument()@@ -325,7 +422,7 @@ describe('Dropdown', () => {// Assert - Now openawait waitFor(() => {- expect(screen.getByText('folder')).toBeInTheDocument()+ expect(screen.getByText('folder'))!.toBeInTheDocument()})})@@ -338,7 +435,7 @@ describe('Dropdown', () => {// 1st click - openfireEvent.click(button)await waitFor(() => {- expect(screen.getByText('folder')).toBeInTheDocument()+ expect(screen.getByText('folder'))!.toBeInTheDocument()})// 2nd click - close@@ -350,7 +447,7 @@ describe('Dropdown', () => {// 3rd click - open againfireEvent.click(button)await waitFor(() => {- expect(screen.getByText('folder')).toBeInTheDocument()+ expect(screen.getByText('folder'))!.toBeInTheDocument()})})})@@ -368,7 +465,7 @@ describe('Dropdown', () => {fireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText('folder1')).toBeInTheDocument()+ expect(screen.getByText('folder1'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('folder1'))@@ -394,7 +491,7 @@ describe('Dropdown', () => {fireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText('folder1')).toBeInTheDocument()+ expect(screen.getByText('folder1'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('folder1'))@@ -423,7 +520,7 @@ describe('Dropdown', () => {// Act - Open and clickfireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText('folder')).toBeInTheDocument()+ expect(screen.getByText('folder'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('folder'))@@ -431,7 +528,7 @@ describe('Dropdown', () => {rerender(<Dropdown {...props} />)fireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText('folder')).toBeInTheDocument()+ expect(screen.getByText('folder'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('folder'))@@ -450,7 +547,7 @@ describe('Dropdown', () => {// Act - Open and click with first callbackfireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText('folder')).toBeInTheDocument()+ expect(screen.getByText('folder'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('folder'))@@ -466,7 +563,7 @@ describe('Dropdown', () => {// Open and click with second callbackfireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText('folder')).toBeInTheDocument()+ expect(screen.getByText('folder'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('folder'))@@ -482,7 +579,8 @@ describe('Dropdown', () => {rerender(<Dropdown {...props} />)// Assert - Component should render without errors- expect(screen.getByRole('button')).toBeInTheDocument()+ // Assert - Component should render without errors+ expect(screen.getByRole('button'))!.toBeInTheDocument()})})@@ -499,7 +597,7 @@ describe('Dropdown', () => {// Assert - Should handle gracefully (open after odd number of clicks)await waitFor(() => {- expect(screen.getByText('folder')).toBeInTheDocument()+ expect(screen.getByText('folder'))!.toBeInTheDocument()})})@@ -513,7 +611,7 @@ describe('Dropdown', () => {fireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText(longName)).toBeInTheDocument()+ expect(screen.getByText(longName))!.toBeInTheDocument()})})@@ -528,8 +626,8 @@ describe('Dropdown', () => {// Assert - First and last items should be visibleawait waitFor(() => {- expect(screen.getByText('folder-0')).toBeInTheDocument()- expect(screen.getByText('folder-19')).toBeInTheDocument()+ expect(screen.getByText('folder-0'))!.toBeInTheDocument()+ expect(screen.getByText('folder-19'))!.toBeInTheDocument()})})@@ -544,7 +642,7 @@ describe('Dropdown', () => {fireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText('folder')).toBeInTheDocument()+ expect(screen.getByText('folder'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('folder'))@@ -562,7 +660,7 @@ describe('Dropdown', () => {fireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText('folder')).toBeInTheDocument()+ expect(screen.getByText('folder'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('folder'))@@ -578,7 +676,7 @@ describe('Dropdown', () => {fireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText('normal-folder')).toBeInTheDocument()+ expect(screen.getByText('normal-folder'))!.toBeInTheDocument()})})@@ -591,7 +689,7 @@ describe('Dropdown', () => {fireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText('folder')).toBeInTheDocument()+ expect(screen.getByText('folder'))!.toBeInTheDocument()})})})@@ -613,9 +711,9 @@ describe('Dropdown', () => {fireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText(breadcrumbs[0])).toBeInTheDocument()+ expect(screen.getByText(breadcrumbs[0]!))!.toBeInTheDocument()})- fireEvent.click(screen.getByText(breadcrumbs[0]))+ fireEvent.click(screen.getByText(breadcrumbs[0]!))expect(mockOnBreadcrumbClick).toHaveBeenCalledWith(expectedIndex)})@@ -634,7 +732,7 @@ describe('Dropdown', () => {// Assert - Should render without errorsawait waitFor(() => {if (breadcrumbs.length > 0)- expect(screen.getByText(breadcrumbs[0])).toBeInTheDocument()+ expect(screen.getByText(breadcrumbs[0]!))!.toBeInTheDocument()})})})@@ -650,9 +748,9 @@ describe('Dropdown', () => {fireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText('Documents')).toBeInTheDocument()- expect(screen.getByText('Projects')).toBeInTheDocument()- expect(screen.getByText('Archive')).toBeInTheDocument()+ expect(screen.getByText('Documents'))!.toBeInTheDocument()+ expect(screen.getByText('Projects'))!.toBeInTheDocument()+ expect(screen.getByText('Archive'))!.toBeInTheDocument()})})@@ -668,7 +766,7 @@ describe('Dropdown', () => {// Act - Open and click on second itemfireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText('second')).toBeInTheDocument()+ expect(screen.getByText('second'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('second'))@@ -687,7 +785,7 @@ describe('Dropdown', () => {// Act - Open and click on middle itemfireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText('item2')).toBeInTheDocument()+ expect(screen.getByText('item2'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('item2'))@@ -714,7 +812,7 @@ describe('Dropdown', () => {fireEvent.click(screen.getByRole('button'))await waitFor(() => {- expect(screen.getByText(`folder-${String.fromCharCode(97 + i)}`)).toBeInTheDocument()+ expect(screen.getByText(`folder-${String.fromCharCode(97 + i)}`))!.toBeInTheDocument()})fireEvent.click(screen.getByText(`folder-${String.fromCharCode(97 + i)}`))@@ -731,7 +829,7 @@ describe('Dropdown', () => {render(<Dropdown {...props} />)const button = screen.getByRole('button')- expect(button).toBeInTheDocument()+ expect(button)!.toBeInTheDocument()expect(button.tagName).toBe('BUTTON')})@@ -741,7 +839,7 @@ describe('Dropdown', () => {render(<Dropdown {...props} />)const button = screen.getByRole('button')- expect(button).toHaveAttribute('type', 'button')+ expect(button)!.toHaveAttribute('type', 'button')})})})diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/index.tsxindex 714b393d039..91d3acc1d14 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/index.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/header/breadcrumbs/index.tsx@@ -152,7 +152,7 @@ const Breadcrumbs = ({<BreadcrumbItemindex={breadcrumbs.length - 1}handleClick={handleClickBreadcrumb}- name={breadcrumbsConfig.lastBreadcrumb}+ name={breadcrumbsConfig.lastBreadcrumb!}isActive={true}disabled={true}showSeparator={false}diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/index.tsxindex f0245cc9a47..00386ec135a 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/index.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/index.tsx@@ -39,7 +39,7 @@ const List = ({if (anchorRef.current) {observerRef.current = new IntersectionObserver((entries) => {const { setNextPageParameters, currentNextPageParametersRef, isTruncated } = dataSourceStore.getState()- if (entries[0].isIntersecting && isTruncated.current && !isLoading)+ if (entries[0]!.isIntersecting && isTruncated.current && !isLoading)setNextPageParameters(currentNextPageParametersRef.current)}, {rootMargin: '100px',diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/utils.ts b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/utils.tsindex 6b367ebe3c4..07b23a56ff8 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/utils.ts+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/file-list/list/utils.ts@@ -8,7 +8,7 @@ export const getFileExtension = (fileName: string): string => {if (parts.length <= 1 || (parts[0] === '' && parts.length === 2))return ''- return parts[parts.length - 1].toLowerCase()+ return parts[parts.length - 1]!.toLowerCase()}export const getFileType = (fileName: string) => {@@ -17,13 +17,13 @@ export const getFileType = (fileName: string) => {if (extension === 'gif')return FileAppearanceTypeEnum.gif- if (FILE_EXTS.image.includes(extension.toUpperCase()))+ if (FILE_EXTS.image!.includes(extension.toUpperCase()))return FileAppearanceTypeEnum.image- if (FILE_EXTS.video.includes(extension.toUpperCase()))+ if (FILE_EXTS.video!.includes(extension.toUpperCase()))return FileAppearanceTypeEnum.video- if (FILE_EXTS.audio.includes(extension.toUpperCase()))+ if (FILE_EXTS.audio!.includes(extension.toUpperCase()))return FileAppearanceTypeEnum.audioif (extension === 'html' || extension === 'htm' || extension === 'xml' || extension === 'json')@@ -44,7 +44,7 @@ export const getFileType = (fileName: string) => {if (extension === 'pptx' || extension === 'ppt')return FileAppearanceTypeEnum.ppt- if (FILE_EXTS.document.includes(extension.toUpperCase()))+ if (FILE_EXTS.document!.includes(extension.toUpperCase()))return FileAppearanceTypeEnum.documentreturn FileAppearanceTypeEnum.customdiff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/utils.ts b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/utils.tsindex 89b84069fe5..8f0ff13ac57 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/utils.ts+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/utils.ts@@ -10,7 +10,7 @@ export const isBucketListInitiation = (data: OnlineDriveData[], prefix: string[]if (bucket || prefix.length > 0)return falseconst hasBucket = data.every(item => !!item.bucket)- return hasBucket && (data.length > 1 || (data.length === 1 && !!data[0].bucket && data[0].files.length === 0))+ return hasBucket && (data.length > 1 || (data.length === 1 && !!data[0]!.bucket && data[0]!.files.length === 0))}export const convertOnlineDriveData = (data: OnlineDriveData[], prefix: string[], bucket: string): {@@ -38,7 +38,7 @@ export const convertOnlineDriveData = (data: OnlineDriveData[], prefix: string[]hasBucket = true}else {- data[0].files.forEach((file) => {+ data[0]!.files.forEach((file) => {const { id, name, size, type } = fileconst isFileType = isFile(type)fileList.push({@@ -48,9 +48,9 @@ export const convertOnlineDriveData = (data: OnlineDriveData[], prefix: string[]type: isFileType ? OnlineDriveFileType.file : OnlineDriveFileType.folder,})})- isTruncated = data[0].is_truncated ?? false- nextPageParameters = data[0].next_page_parameters ?? {}- hasBucket = !!data[0].bucket+ isTruncated = data[0]!.is_truncated ?? false+ nextPageParameters = data[0]!.next_page_parameters ?? {}+ hasBucket = !!data[0]!.bucket}return { fileList, isTruncated, nextPageParameters, hasBucket }}diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/__tests__/crawled-result.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/__tests__/crawled-result.spec.tsxindex 9c71f91d8d6..6c476e6dd6d 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/__tests__/crawled-result.spec.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/__tests__/crawled-result.spec.tsx@@ -49,9 +49,9 @@ const createItem = (url: string): CrawlResultItem => ({})const defaultList: CrawlResultItem[] = [- createItem('https://example.com/a'),- createItem('https://example.com/b'),- createItem('https://example.com/c'),+ createItem('https://example.com/a')!,+ createItem('https://example.com/b')!,+ createItem('https://example.com/c')!,]describe('CrawledResult', () => {@@ -70,19 +70,18 @@ describe('CrawledResult', () => {it('should render scrap time info with correct total and time', () => {render(<CrawledResult {...defaultProps} />)- expect(- screen.getByText(/scrapTimeInfo/),- ).toBeInTheDocument()+ expect(screen.getByText(/scrapTimeInfo/))!.toBeInTheDocument()// The global i18n mock serialises params, so verify total and time appear- expect(screen.getByText(/"total":3/)).toBeInTheDocument()- expect(screen.getByText(/"time":"12.3"/)).toBeInTheDocument()+ // The global i18n mock serialises params, so verify total and time appear+ expect(screen.getByText(/"total":3/))!.toBeInTheDocument()+ expect(screen.getByText(/"time":"12.3"/))!.toBeInTheDocument()})it('should render all items from list', () => {render(<CrawledResult {...defaultProps} />)for (const item of defaultList) {- expect(screen.getByTestId(`crawled-item-${item.source_url}`)).toBeInTheDocument()+ expect(screen.getByTestId(`crawled-item-${item.source_url}`))!.toBeInTheDocument()}})@@ -91,7 +90,7 @@ describe('CrawledResult', () => {<CrawledResult {...defaultProps} className="my-custom-class" />,)- expect(container.firstChild).toHaveClass('my-custom-class')+ expect(container.firstChild)!.toHaveClass('my-custom-class')})})@@ -100,7 +99,7 @@ describe('CrawledResult', () => {it('should show check-all checkbox in multiple choice mode', () => {render(<CrawledResult {...defaultProps} isMultipleChoice={true} />)- expect(screen.getByTestId('check-all-checkbox')).toBeInTheDocument()+ expect(screen.getByTestId('check-all-checkbox'))!.toBeInTheDocument()})it('should hide check-all checkbox in single choice mode', () => {@@ -117,7 +116,7 @@ describe('CrawledResult', () => {render(<CrawledResult{...defaultProps}- checkedList={[defaultList[0]]}+ checkedList={[defaultList[0]!]}onSelectedChange={onSelectedChange}/>,)@@ -150,13 +149,13 @@ describe('CrawledResult', () => {render(<CrawledResult{...defaultProps}- checkedList={[defaultList[0]]}+ checkedList={[defaultList[0]!]}onSelectedChange={onSelectedChange}isMultipleChoice={true}/>,)- fireEvent.click(screen.getByTestId(`check-${defaultList[1].source_url}`))+ fireEvent.click(screen.getByTestId(`check-${defaultList[1]!.source_url}`))expect(onSelectedChange).toHaveBeenCalledWith([defaultList[0], defaultList[1]])})@@ -166,13 +165,13 @@ describe('CrawledResult', () => {render(<CrawledResult{...defaultProps}- checkedList={[defaultList[0]]}+ checkedList={[defaultList[0]!]}onSelectedChange={onSelectedChange}isMultipleChoice={false}/>,)- fireEvent.click(screen.getByTestId(`check-${defaultList[1].source_url}`))+ fireEvent.click(screen.getByTestId(`check-${defaultList[1]!.source_url}`))expect(onSelectedChange).toHaveBeenCalledWith([defaultList[1]])})@@ -182,13 +181,13 @@ describe('CrawledResult', () => {render(<CrawledResult{...defaultProps}- checkedList={[defaultList[0], defaultList[1]]}+ checkedList={[defaultList[0]!, defaultList[1]!]}onSelectedChange={onSelectedChange}isMultipleChoice={true}/>,)- fireEvent.click(screen.getByTestId(`check-${defaultList[0].source_url}`))+ fireEvent.click(screen.getByTestId(`check-${defaultList[0]!.source_url}`))expect(onSelectedChange).toHaveBeenCalledWith([defaultList[1]])})@@ -206,7 +205,7 @@ describe('CrawledResult', () => {/>,)- fireEvent.click(screen.getByTestId(`preview-${defaultList[1].source_url}`))+ fireEvent.click(screen.getByTestId(`preview-${defaultList[1]!.source_url}`))expect(onPreview).toHaveBeenCalledWith(defaultList[1], 1)})diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/__tests__/index.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/__tests__/index.spec.tsxindex 99002e687c5..fa5633e2df7 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/__tests__/index.spec.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/__tests__/index.spec.tsx@@ -39,7 +39,7 @@ describe('CheckboxWithLabel', () => {it('should render without crashing', () => {render(<CheckboxWithLabel {...defaultProps} />)- expect(screen.getByText('Test Label')).toBeInTheDocument()+ expect(screen.getByText('Test Label'))!.toBeInTheDocument()})it('should render checkbox in unchecked state', () => {@@ -47,7 +47,7 @@ describe('CheckboxWithLabel', () => {// Assert - Custom checkbox component uses div with data-testidconst checkbox = container.querySelector('[data-testid^="checkbox"]')- expect(checkbox).toBeInTheDocument()+ expect(checkbox)!.toBeInTheDocument()expect(checkbox).not.toHaveClass('bg-components-checkbox-bg')})@@ -56,7 +56,7 @@ describe('CheckboxWithLabel', () => {// Assert - Checked state has check iconconst checkIcon = container.querySelector('[data-testid^="check-icon"]')- expect(checkIcon).toBeInTheDocument()+ expect(checkIcon)!.toBeInTheDocument()})it('should render tooltip when provided', () => {@@ -64,7 +64,7 @@ describe('CheckboxWithLabel', () => {// Assert - Tooltip trigger should be presentconst tooltipTrigger = document.querySelector('[class*="ml-0.5"]')- expect(tooltipTrigger).toBeInTheDocument()+ expect(tooltipTrigger)!.toBeInTheDocument()})it('should not render tooltip when not provided', () => {@@ -82,14 +82,14 @@ describe('CheckboxWithLabel', () => {)const label = container.querySelector('label')- expect(label).toHaveClass('custom-class')+ expect(label)!.toHaveClass('custom-class')})it('should apply custom labelClassName', () => {render(<CheckboxWithLabel {...defaultProps} labelClassName="custom-label-class" />)const labelText = screen.getByText('Test Label')- expect(labelText).toHaveClass('custom-label-class')+ expect(labelText)!.toHaveClass('custom-label-class')})})@@ -147,8 +147,8 @@ describe('CrawledResultItem', () => {it('should render without crashing', () => {render(<CrawledResultItem {...defaultProps} />)- expect(screen.getByText('Test Page Title')).toBeInTheDocument()- expect(screen.getByText('https://example.com/page1')).toBeInTheDocument()+ expect(screen.getByText('Test Page Title'))!.toBeInTheDocument()+ expect(screen.getByText('https://example.com/page1'))!.toBeInTheDocument()})it('should render checkbox when isMultipleChoice is true', () => {@@ -156,7 +156,7 @@ describe('CrawledResultItem', () => {// Assert - Custom checkbox uses data-testidconst checkbox = container.querySelector('[data-testid^="checkbox"]')- expect(checkbox).toBeInTheDocument()+ expect(checkbox)!.toBeInTheDocument()})it('should render radio when isMultipleChoice is false', () => {@@ -164,7 +164,7 @@ describe('CrawledResultItem', () => {// Assert - Radio component has size-4 rounded-full classesconst radio = container.querySelector('.size-4.rounded-full')- expect(radio).toBeInTheDocument()+ expect(radio)!.toBeInTheDocument()})it('should render checkbox as checked when isChecked is true', () => {@@ -172,13 +172,13 @@ describe('CrawledResultItem', () => {// Assert - Checked state shows check iconconst checkIcon = container.querySelector('[data-testid^="check-icon"]')- expect(checkIcon).toBeInTheDocument()+ expect(checkIcon)!.toBeInTheDocument()})it('should render preview button when showPreview is true', () => {render(<CrawledResultItem {...defaultProps} showPreview={true} />)- expect(screen.getByRole('button')).toBeInTheDocument()+ expect(screen.getByRole('button'))!.toBeInTheDocument()})it('should not render preview button when showPreview is false', () => {@@ -191,15 +191,15 @@ describe('CrawledResultItem', () => {const { container } = render(<CrawledResultItem {...defaultProps} isPreview={true} />)const item = container.firstChild- expect(item).toHaveClass('bg-state-base-active')+ expect(item)!.toHaveClass('bg-state-base-active')})it('should apply hover styles when isPreview is false', () => {const { container } = render(<CrawledResultItem {...defaultProps} isPreview={false} />)const item = container.firstChild- expect(item).toHaveClass('group')- expect(item).toHaveClass('hover:bg-state-base-hover')+ expect(item)!.toHaveClass('group')+ expect(item)!.toHaveClass('hover:bg-state-base-hover')})})@@ -209,7 +209,7 @@ describe('CrawledResultItem', () => {render(<CrawledResultItem {...defaultProps} payload={payload} />)- expect(screen.getByText('Custom Title')).toBeInTheDocument()+ expect(screen.getByText('Custom Title'))!.toBeInTheDocument()})it('should display payload source_url', () => {@@ -217,7 +217,7 @@ describe('CrawledResultItem', () => {render(<CrawledResultItem {...defaultProps} payload={payload} />)- expect(screen.getByText('https://custom.url/path')).toBeInTheDocument()+ expect(screen.getByText('https://custom.url/path'))!.toBeInTheDocument()})it('should set title attribute for truncation tooltip', () => {@@ -226,7 +226,7 @@ describe('CrawledResultItem', () => {render(<CrawledResultItem {...defaultProps} payload={payload} />)const titleElement = screen.getByText('Very Long Title')- expect(titleElement).toHaveAttribute('title', 'Very Long Title')+ expect(titleElement)!.toHaveAttribute('title', 'Very Long Title')})})@@ -310,22 +310,24 @@ describe('CrawledResult', () => {render(<CrawledResult {...defaultProps} />)// Assert - Check for time info which contains total count- expect(screen.getByText(/1.5/)).toBeInTheDocument()+ // Assert - Check for time info which contains total count+ expect(screen.getByText(/1.5/))!.toBeInTheDocument()})it('should render all list items', () => {render(<CrawledResult {...defaultProps} />)- expect(screen.getByText('Page 1')).toBeInTheDocument()- expect(screen.getByText('Page 2')).toBeInTheDocument()- expect(screen.getByText('Page 3')).toBeInTheDocument()+ expect(screen.getByText('Page 1'))!.toBeInTheDocument()+ expect(screen.getByText('Page 2'))!.toBeInTheDocument()+ expect(screen.getByText('Page 3'))!.toBeInTheDocument()})it('should display scrape time info', () => {render(<CrawledResult {...defaultProps} usedTime={2.5} />)// Assert - Check for the time display- expect(screen.getByText(/2.5/)).toBeInTheDocument()+ // Assert - Check for the time display+ expect(screen.getByText(/2.5/))!.toBeInTheDocument()})it('should render select all checkbox when isMultipleChoice is true', () => {@@ -350,7 +352,7 @@ describe('CrawledResult', () => {it('should show "Select All" when not all items are checked', () => {render(<CrawledResult {...defaultProps} checkedList={[]} />)- expect(screen.getByText(/selectAll|Select All/i)).toBeInTheDocument()+ expect(screen.getByText(/selectAll|Select All/i))!.toBeInTheDocument()})it('should show "Reset All" when all items are checked', () => {@@ -358,7 +360,7 @@ describe('CrawledResult', () => {render(<CrawledResult {...defaultProps} checkedList={allChecked} />)- expect(screen.getByText(/resetAll|Reset All/i)).toBeInTheDocument()+ expect(screen.getByText(/resetAll|Reset All/i))!.toBeInTheDocument()})})@@ -368,7 +370,7 @@ describe('CrawledResult', () => {<CrawledResult {...defaultProps} className="custom-class" />,)- expect(container.firstChild).toHaveClass('custom-class')+ expect(container.firstChild)!.toHaveClass('custom-class')})it('should highlight item at previewIndex', () => {@@ -378,7 +380,7 @@ describe('CrawledResult', () => {// Assert - Second item should have active stateconst items = container.querySelectorAll('[class*="rounded-lg"][class*="cursor-pointer"]')- expect(items[1]).toHaveClass('bg-state-base-active')+ expect(items[1])!.toHaveClass('bg-state-base-active')})it('should pass showPreview to items', () => {@@ -411,7 +413,7 @@ describe('CrawledResult', () => {// Act - Click select all checkbox (first checkbox)const checkboxes = container.querySelectorAll('[data-testid^="checkbox"]')- fireEvent.click(checkboxes[0])+ fireEvent.click(checkboxes[0]!)expect(mockOnSelectedChange).toHaveBeenCalledWith(list)})@@ -429,7 +431,7 @@ describe('CrawledResult', () => {)const checkboxes = container.querySelectorAll('[data-testid^="checkbox"]')- fireEvent.click(checkboxes[0])+ fireEvent.click(checkboxes[0]!)expect(mockOnSelectedChange).toHaveBeenCalledWith([])})@@ -441,14 +443,14 @@ describe('CrawledResult', () => {<CrawledResult{...defaultProps}list={list}- checkedList={[list[0]]}+ checkedList={[list[0]!]}onSelectedChange={mockOnSelectedChange}/>,)// Act - Click second item checkbox (index 2, accounting for select all)const checkboxes = container.querySelectorAll('[data-testid^="checkbox"]')- fireEvent.click(checkboxes[2])+ fireEvent.click(checkboxes[2]!)expect(mockOnSelectedChange).toHaveBeenCalledWith([list[0], list[1]])})@@ -460,14 +462,14 @@ describe('CrawledResult', () => {<CrawledResult{...defaultProps}list={list}- checkedList={[list[0], list[1]]}+ checkedList={[list[0]!, list[1]!]}onSelectedChange={mockOnSelectedChange}/>,)// Act - Uncheck first item (index 1, after select all)const checkboxes = container.querySelectorAll('[data-testid^="checkbox"]')- fireEvent.click(checkboxes[1])+ fireEvent.click(checkboxes[1]!)expect(mockOnSelectedChange).toHaveBeenCalledWith([list[1]])})@@ -479,7 +481,7 @@ describe('CrawledResult', () => {<CrawledResult{...defaultProps}list={list}- checkedList={[list[0]]}+ checkedList={[list[0]!]}onSelectedChange={mockOnSelectedChange}isMultipleChoice={false}/>,@@ -487,7 +489,7 @@ describe('CrawledResult', () => {// Act - Click second item radio (Radio uses size-4 rounded-full classes)const radios = container.querySelectorAll('.size-4.rounded-full')- fireEvent.click(radios[1])+ fireEvent.click(radios[1]!)// Assert - Should only select the clicked itemexpect(mockOnSelectedChange).toHaveBeenCalledWith([list[1]])@@ -506,7 +508,7 @@ describe('CrawledResult', () => {)const buttons = screen.getAllByRole('button')- fireEvent.click(buttons[1]) // Second item's preview button+ fireEvent.click(buttons[1]!) // Second item's preview buttonexpect(mockOnPreview).toHaveBeenCalledWith(list[1], 1)})@@ -525,10 +527,11 @@ describe('CrawledResult', () => {// Act - Click preview button should trigger early return in handlePreviewconst buttons = screen.getAllByRole('button')- fireEvent.click(buttons[0])+ fireEvent.click(buttons[0]!)// Assert - Should not throw error, component still renders- expect(screen.getByText('Page 1')).toBeInTheDocument()+ // Assert - Should not throw error, component still renders+ expect(screen.getByText('Page 1'))!.toBeInTheDocument()})})@@ -537,7 +540,8 @@ describe('CrawledResult', () => {render(<CrawledResult {...defaultProps} list={[]} usedTime={0.5} />)// Assert - Should show time info with 0 count- expect(screen.getByText(/0.5/)).toBeInTheDocument()+ // Assert - Should show time info with 0 count+ expect(screen.getByText(/0.5/))!.toBeInTheDocument()})it('should handle single item list', () => {@@ -545,13 +549,13 @@ describe('CrawledResult', () => {render(<CrawledResult {...defaultProps} list={singleItem} />)- expect(screen.getByText('Test Page Title')).toBeInTheDocument()+ expect(screen.getByText('Test Page Title'))!.toBeInTheDocument()})it('should format usedTime to one decimal place', () => {render(<CrawledResult {...defaultProps} usedTime={1.567} />)- expect(screen.getByText(/1.6/)).toBeInTheDocument()+ expect(screen.getByText(/1.6/))!.toBeInTheDocument()})})})@@ -571,13 +575,13 @@ describe('Crawling', () => {it('should render without crashing', () => {render(<Crawling {...defaultProps} />)- expect(screen.getByText(/5\/10/)).toBeInTheDocument()+ expect(screen.getByText(/5\/10/))!.toBeInTheDocument()})it('should display crawled count and total', () => {render(<Crawling crawledNum={3} totalNum={15} />)- expect(screen.getByText(/3\/15/)).toBeInTheDocument()+ expect(screen.getByText(/3\/15/))!.toBeInTheDocument()})it('should render skeleton items', () => {@@ -602,19 +606,19 @@ describe('Crawling', () => {<Crawling {...defaultProps} className="custom-crawling-class" />,)- expect(container.firstChild).toHaveClass('custom-crawling-class')+ expect(container.firstChild)!.toHaveClass('custom-crawling-class')})it('should handle zero values', () => {render(<Crawling crawledNum={0} totalNum={0} />)- expect(screen.getByText(/0\/0/)).toBeInTheDocument()+ expect(screen.getByText(/0\/0/))!.toBeInTheDocument()})it('should handle large numbers', () => {render(<Crawling crawledNum={999} totalNum={1000} />)- expect(screen.getByText(/999\/1000/)).toBeInTheDocument()+ expect(screen.getByText(/999\/1000/))!.toBeInTheDocument()})})@@ -623,9 +627,10 @@ describe('Crawling', () => {const { container } = render(<Crawling {...defaultProps} />)// Assert - Check for various width classes- expect(container.querySelector('.w-\\[35\\%\\]')).toBeInTheDocument()- expect(container.querySelector('.w-\\[50\\%\\]')).toBeInTheDocument()- expect(container.querySelector('.w-\\[40\\%\\]')).toBeInTheDocument()+ // Assert - Check for various width classes+ expect(container.querySelector('.w-\\[35\\%\\]'))!.toBeInTheDocument()+ expect(container.querySelector('.w-\\[50\\%\\]'))!.toBeInTheDocument()+ expect(container.querySelector('.w-\\[40\\%\\]'))!.toBeInTheDocument()})})})@@ -644,27 +649,27 @@ describe('ErrorMessage', () => {it('should render without crashing', () => {render(<ErrorMessage {...defaultProps} />)- expect(screen.getByText('Error Title')).toBeInTheDocument()+ expect(screen.getByText('Error Title'))!.toBeInTheDocument()})it('should render error icon', () => {const { container } = render(<ErrorMessage {...defaultProps} />)const icon = container.querySelector('svg')- expect(icon).toBeInTheDocument()- expect(icon).toHaveClass('text-text-destructive')+ expect(icon)!.toBeInTheDocument()+ expect(icon)!.toHaveClass('text-text-destructive')})it('should render title', () => {render(<ErrorMessage title="Custom Error Title" />)- expect(screen.getByText('Custom Error Title')).toBeInTheDocument()+ expect(screen.getByText('Custom Error Title'))!.toBeInTheDocument()})it('should render error message when provided', () => {render(<ErrorMessage {...defaultProps} errorMsg="Detailed error description" />)- expect(screen.getByText('Detailed error description')).toBeInTheDocument()+ expect(screen.getByText('Detailed error description'))!.toBeInTheDocument()})it('should not render error message when not provided', () => {@@ -682,14 +687,15 @@ describe('ErrorMessage', () => {<ErrorMessage {...defaultProps} className="custom-error-class" />,)- expect(container.firstChild).toHaveClass('custom-error-class')+ expect(container.firstChild)!.toHaveClass('custom-error-class')})it('should render with empty errorMsg', () => {render(<ErrorMessage {...defaultProps} errorMsg="" />)// Assert - Empty string should not render message div- expect(screen.getByText('Error Title')).toBeInTheDocument()+ // Assert - Empty string should not render message div+ expect(screen.getByText('Error Title'))!.toBeInTheDocument()})it('should handle long title text', () => {@@ -697,7 +703,7 @@ describe('ErrorMessage', () => {render(<ErrorMessage title={longTitle} />)- expect(screen.getByText(longTitle)).toBeInTheDocument()+ expect(screen.getByText(longTitle))!.toBeInTheDocument()})it('should handle long error message', () => {@@ -705,7 +711,7 @@ describe('ErrorMessage', () => {render(<ErrorMessage {...defaultProps} errorMsg={longErrorMsg} />)- expect(screen.getByText(longErrorMsg)).toBeInTheDocument()+ expect(screen.getByText(longErrorMsg))!.toBeInTheDocument()})})@@ -713,19 +719,19 @@ describe('ErrorMessage', () => {it('should have error background styling', () => {const { container } = render(<ErrorMessage {...defaultProps} />)- expect(container.firstChild).toHaveClass('bg-toast-error-bg')+ expect(container.firstChild)!.toHaveClass('bg-toast-error-bg')})it('should have border styling', () => {const { container } = render(<ErrorMessage {...defaultProps} />)- expect(container.firstChild).toHaveClass('border-components-panel-border')+ expect(container.firstChild)!.toHaveClass('border-components-panel-border')})it('should have rounded-sm corners', () => {const { container } = render(<ErrorMessage {...defaultProps} />)- expect(container.firstChild).toHaveClass('rounded-xl')+ expect(container.firstChild)!.toHaveClass('rounded-xl')})})})@@ -744,8 +750,9 @@ describe('Base Components Integration', () => {)// Assert - Both items should render- expect(screen.getByText('Page 1')).toBeInTheDocument()- expect(screen.getByText('Page 2')).toBeInTheDocument()+ // Assert - Both items should render+ expect(screen.getByText('Page 1'))!.toBeInTheDocument()+ expect(screen.getByText('Page 2'))!.toBeInTheDocument()})it('should render CrawledResult with CheckboxWithLabel for select all', () => {@@ -784,13 +791,13 @@ describe('Base Components Integration', () => {// Act - Select first item (index 1, after select all)const checkboxes = container.querySelectorAll('[data-testid^="checkbox"]')- fireEvent.click(checkboxes[1])+ fireEvent.click(checkboxes[1]!)expect(mockOnSelectedChange).toHaveBeenCalledWith([list[0]])// Act - Preview second itemconst previewButtons = screen.getAllByRole('button')- fireEvent.click(previewButtons[1])+ fireEvent.click(previewButtons[1]!)expect(mockOnPreview).toHaveBeenCalledWith(list[1], 1)})diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/crawled-result.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/crawled-result.tsxindex 8cd9a46054c..b91c5bd6bc4 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/crawled-result.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/crawled-result.tsx@@ -59,7 +59,7 @@ const CrawledResult = ({const handlePreview = useCallback((index: number) => {if (!onPreview)return- onPreview(list[index], index)+ onPreview(list[index]!, index)}, [list, onPreview])return (diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/index.tsxindex 899c70e216b..c8a06ea8072 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/index.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/website-crawl/base/options/index.tsx@@ -43,7 +43,7 @@ const Options = ({if (!result.success) {const issues = result.error.issuesconst firstIssue = issues[0]- const errorMessage = `"${firstIssue.path.join('.')}" ${firstIssue.message}`+ const errorMessage = `"${firstIssue!.path.join('.')}" ${firstIssue!.message}`toast.error(errorMessage)return errorMessage}diff --git a/web/app/components/datasets/documents/create-from-pipeline/hooks/__tests__/use-datasource-store.spec.ts b/web/app/components/datasets/documents/create-from-pipeline/hooks/__tests__/use-datasource-store.spec.tsindex 155b41541b5..70d95000d73 100644--- a/web/app/components/datasets/documents/create-from-pipeline/hooks/__tests__/use-datasource-store.spec.ts+++ b/web/app/components/datasets/documents/create-from-pipeline/hooks/__tests__/use-datasource-store.spec.ts@@ -85,7 +85,7 @@ describe('useOnlineDocument', () => {const { result } = renderHook(() => useOnlineDocument(), { wrapper: createWrapper(store) })expect(result.current.PagesMapAndSelectedPagesId).toHaveProperty('p1')- expect(result.current.PagesMapAndSelectedPagesId.p1.workspace_id).toBe('w1')+ expect(result.current.PagesMapAndSelectedPagesId.p1!.workspace_id).toBe('w1')})it('should hide preview online document', () => {diff --git a/web/app/components/datasets/documents/create-from-pipeline/hooks/use-datasource-actions.ts b/web/app/components/datasets/documents/create-from-pipeline/hooks/use-datasource-actions.tsindex 66bd325c33a..bad3b779fa7 100644--- a/web/app/components/datasets/documents/create-from-pipeline/hooks/use-datasource-actions.ts+++ b/web/app/components/datasets/documents/create-from-pipeline/hooks/use-datasource-actions.ts@@ -251,7 +251,7 @@ export const useDatasourceActions = ({if (datasourceType === DatasourceType.onlineDocument) {const allIds = currentWorkspacePages?.map(page => page.page_id) || []if (onlineDocuments.length < allIds.length) {- const selectedPages = Array.from(allIds).map(pageId => PagesMapAndSelectedPagesId[pageId])+ const selectedPages = Array.from(allIds).map(pageId => PagesMapAndSelectedPagesId[pageId]!)setOnlineDocuments(selectedPages)setSelectedPagesId(new Set(allIds))}diff --git a/web/app/components/datasets/documents/create-from-pipeline/hooks/use-datasource-ui-state.ts b/web/app/components/datasets/documents/create-from-pipeline/hooks/use-datasource-ui-state.tsindex e398f90a48b..f4c222f6524 100644--- a/web/app/components/datasets/documents/create-from-pipeline/hooks/use-datasource-ui-state.ts+++ b/web/app/components/datasets/documents/create-from-pipeline/hooks/use-datasource-ui-state.ts@@ -122,7 +122,7 @@ export const useDatasourceUIState = ({return {datasourceType,- isShowVectorSpaceFull,+ isShowVectorSpaceFull: isShowVectorSpaceFull!,nextBtnDisabled,showSelect,totalOptions,diff --git a/web/app/components/datasets/documents/create-from-pipeline/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/index.tsxindex 62c1b919fe8..8b8fad58851 100644--- a/web/app/components/datasets/documents/create-from-pipeline/index.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/index.tsx@@ -133,7 +133,7 @@ const CreateFormPipeline = () => {[DatasourceType.onlineDrive]: selectedFileIds.length,}const count = datasourceType ? multipleCheckMap[datasourceType] : 0- if (count > 1) {+ if (count! > 1) {showPlanUpgradeModal()return}diff --git a/web/app/components/datasets/documents/create-from-pipeline/preview/__tests__/file-preview.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/preview/__tests__/file-preview.spec.tsxindex 715d1650dfd..82011102b65 100644--- a/web/app/components/datasets/documents/create-from-pipeline/preview/__tests__/file-preview.spec.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/preview/__tests__/file-preview.spec.tsx@@ -39,30 +39,30 @@ describe('FilePreview', () => {it('should render preview label', () => {render(<FilePreview {...defaultProps} />)- expect(screen.getByText('datasetPipeline.addDocuments.stepOne.preview')).toBeInTheDocument()+ expect(screen.getByText('datasetPipeline.addDocuments.stepOne.preview'))!.toBeInTheDocument()})it('should render file name', () => {render(<FilePreview {...defaultProps} />)- expect(screen.getByText('document.pdf')).toBeInTheDocument()+ expect(screen.getByText('document.pdf'))!.toBeInTheDocument()})it('should render file content when loaded', () => {render(<FilePreview {...defaultProps} />)- expect(screen.getByText('file content here with some text')).toBeInTheDocument()+ expect(screen.getByText('file content here with some text'))!.toBeInTheDocument()})it('should render loading state', () => {mockIsFetching = truerender(<FilePreview {...defaultProps} />)- expect(screen.getByTestId('loading')).toBeInTheDocument()+ expect(screen.getByTestId('loading'))!.toBeInTheDocument()})it('should call hidePreview when close button clicked', () => {render(<FilePreview {...defaultProps} />)const buttons = screen.getAllByRole('button')const closeBtn = buttons[buttons.length - 1]- fireEvent.click(closeBtn)+ fireEvent.click(closeBtn!)expect(defaultProps.hidePreview).toHaveBeenCalled()})})diff --git a/web/app/components/datasets/documents/create-from-pipeline/preview/__tests__/web-preview.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/preview/__tests__/web-preview.spec.tsxindex 1f59e11035a..7bef4d0716c 100644--- a/web/app/components/datasets/documents/create-from-pipeline/preview/__tests__/web-preview.spec.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/preview/__tests__/web-preview.spec.tsx@@ -20,29 +20,29 @@ describe('WebPreview', () => {it('should render preview label', () => {render(<WebPreview {...defaultProps} />)- expect(screen.getByText('datasetPipeline.addDocuments.stepOne.preview')).toBeInTheDocument()+ expect(screen.getByText('datasetPipeline.addDocuments.stepOne.preview'))!.toBeInTheDocument()})it('should render page title', () => {render(<WebPreview {...defaultProps} />)- expect(screen.getByText('Test Page')).toBeInTheDocument()+ expect(screen.getByText('Test Page'))!.toBeInTheDocument()})it('should render source URL', () => {render(<WebPreview {...defaultProps} />)- expect(screen.getByText('https://example.com')).toBeInTheDocument()+ expect(screen.getByText('https://example.com'))!.toBeInTheDocument()})it('should render markdown content', () => {render(<WebPreview {...defaultProps} />)- expect(screen.getByText('Hello **markdown** content')).toBeInTheDocument()+ expect(screen.getByText('Hello **markdown** content'))!.toBeInTheDocument()})it('should call hidePreview when close button clicked', () => {render(<WebPreview {...defaultProps} />)const buttons = screen.getAllByRole('button')const closeBtn = buttons[buttons.length - 1]- fireEvent.click(closeBtn)+ fireEvent.click(closeBtn!)expect(defaultProps.hidePreview).toHaveBeenCalled()})})diff --git a/web/app/components/datasets/documents/create-from-pipeline/preview/chunk-preview.tsx b/web/app/components/datasets/documents/create-from-pipeline/preview/chunk-preview.tsxindex a56e5bd6dcd..2d729ee0793 100644--- a/web/app/components/datasets/documents/create-from-pipeline/preview/chunk-preview.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/preview/chunk-preview.tsx@@ -55,9 +55,9 @@ const ChunkPreview = ({const currentDocForm = useDatasetDetailContextWithSelector(s => s.dataset?.doc_form)const [previewFile, setPreviewFile] = useState<DocumentItem>(localFiles[0] as DocumentItem)- const [previewOnlineDocument, setPreviewOnlineDocument] = useState<NotionPage>(onlineDocuments[0])- const [previewWebsitePage, setPreviewWebsitePage] = useState<CrawlResultItem>(websitePages[0])- const [previewOnlineDriveFile, setPreviewOnlineDriveFile] = useState<OnlineDriveFile>(onlineDriveFiles[0])+ const [previewOnlineDocument, setPreviewOnlineDocument] = useState<NotionPage>(onlineDocuments[0]!)+ const [previewWebsitePage, setPreviewWebsitePage] = useState<CrawlResultItem>(websitePages[0]!)+ const [previewOnlineDriveFile, setPreviewOnlineDriveFile] = useState<OnlineDriveFile>(onlineDriveFiles[0]!)return (<PreviewContainerdiff --git a/web/app/components/datasets/documents/create-from-pipeline/process-documents/form.tsx b/web/app/components/datasets/documents/create-from-pipeline/process-documents/form.tsxindex 33703d56b2a..7fde02adcdd 100644--- a/web/app/components/datasets/documents/create-from-pipeline/process-documents/form.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/process-documents/form.tsx@@ -33,7 +33,7 @@ const Form = ({if (!result.success) {const issues = result.error.issuesconst firstIssue = issues[0]- const errorMessage = `"${firstIssue.path.join('.')}" ${firstIssue.message}`+ const errorMessage = `"${firstIssue!.path.join('.')}" ${firstIssue!.message}`toast.error(errorMessage)return errorMessage}diff --git a/web/app/components/datasets/documents/create-from-pipeline/processing/embedding-process/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/processing/embedding-process/index.tsxindex c03fc8aba2f..09d6eb09609 100644--- a/web/app/components/datasets/documents/create-from-pipeline/processing/embedding-process/index.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/processing/embedding-process/index.tsx@@ -81,7 +81,7 @@ const EmbeddingProcess = ({// get ruleconst firstDocument = documents[0]- const { data: ruleDetail } = useProcessRule(firstDocument.id)+ const { data: ruleDetail } = useProcessRule(firstDocument!.id)const invalidDocumentList = useInvalidDocumentList()const navToDocumentList = () => {diff --git a/web/app/components/datasets/documents/create-from-pipeline/steps/__tests__/step-three-content.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/steps/__tests__/step-three-content.spec.tsxindex e217248d2b7..8e80ab2878f 100644--- a/web/app/components/datasets/documents/create-from-pipeline/steps/__tests__/step-three-content.spec.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/steps/__tests__/step-three-content.spec.tsx@@ -56,42 +56,42 @@ describe('StepThreeContent', () => {describe('Rendering', () => {it('should render without crashing', () => {render(<StepThreeContent {...defaultProps} />)- expect(screen.getByTestId('embedding-process')).toBeInTheDocument()+ expect(screen.getByTestId('embedding-process'))!.toBeInTheDocument()})it('should render Processing component', () => {render(<StepThreeContent {...defaultProps} />)- expect(screen.getByTestId('embedding-process')).toBeInTheDocument()+ expect(screen.getByTestId('embedding-process'))!.toBeInTheDocument()})})describe('Props', () => {it('should pass batchId to Processing component', () => {render(<StepThreeContent {...defaultProps} />)- expect(screen.getByTestId('batch-id')).toHaveTextContent('test-batch-id')+ expect(screen.getByTestId('batch-id'))!.toHaveTextContent('test-batch-id')})it('should pass documents to Processing component', () => {render(<StepThreeContent {...defaultProps} />)- expect(screen.getByTestId('documents-count')).toHaveTextContent('2')+ expect(screen.getByTestId('documents-count'))!.toHaveTextContent('2')})it('should handle empty documents array', () => {render(<StepThreeContent batchId="test-batch-id" documents={[]} />)- expect(screen.getByTestId('documents-count')).toHaveTextContent('0')+ expect(screen.getByTestId('documents-count'))!.toHaveTextContent('0')})})describe('Edge Cases', () => {it('should render with different batchId', () => {render(<StepThreeContent batchId="another-batch-id" documents={mockDocuments} />)- expect(screen.getByTestId('batch-id')).toHaveTextContent('another-batch-id')+ expect(screen.getByTestId('batch-id'))!.toHaveTextContent('another-batch-id')})it('should render with single document', () => {- const singleDocument = [mockDocuments[0]]+ const singleDocument = [mockDocuments[0]!]render(<StepThreeContent batchId="test-batch-id" documents={singleDocument} />)- expect(screen.getByTestId('documents-count')).toHaveTextContent('1')+ expect(screen.getByTestId('documents-count'))!.toHaveTextContent('1')})})})diff --git a/web/app/components/datasets/documents/detail/__tests__/new-segment.spec.tsx b/web/app/components/datasets/documents/detail/__tests__/new-segment.spec.tsxindex f243f85f29e..a46b659f11a 100644--- a/web/app/components/datasets/documents/detail/__tests__/new-segment.spec.tsx+++ b/web/app/components/datasets/documents/detail/__tests__/new-segment.spec.tsx@@ -145,37 +145,37 @@ describe('NewSegmentModal', () => {it('should render without crashing', () => {const { container } = render(<NewSegmentModal {...defaultProps} />)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})it('should render title text', () => {render(<NewSegmentModal {...defaultProps} />)- expect(screen.getByText(/segment\.addChunk/i)).toBeInTheDocument()+ expect(screen.getByText(/segment\.addChunk/i))!.toBeInTheDocument()})it('should render chunk content component', () => {render(<NewSegmentModal {...defaultProps} />)- expect(screen.getByTestId('chunk-content')).toBeInTheDocument()+ expect(screen.getByTestId('chunk-content'))!.toBeInTheDocument()})it('should render image uploader', () => {render(<NewSegmentModal {...defaultProps} />)- expect(screen.getByTestId('image-uploader')).toBeInTheDocument()+ expect(screen.getByTestId('image-uploader'))!.toBeInTheDocument()})it('should render segment index tag', () => {render(<NewSegmentModal {...defaultProps} />)- expect(screen.getByTestId('segment-index-tag')).toBeInTheDocument()+ expect(screen.getByTestId('segment-index-tag'))!.toBeInTheDocument()})it('should render dot separator', () => {render(<NewSegmentModal {...defaultProps} />)- expect(screen.getByTestId('dot')).toBeInTheDocument()+ expect(screen.getByTestId('dot'))!.toBeInTheDocument()})})@@ -186,7 +186,7 @@ describe('NewSegmentModal', () => {render(<NewSegmentModal {...defaultProps} />)- expect(screen.getByTestId('keywords')).toBeInTheDocument()+ expect(screen.getByTestId('keywords'))!.toBeInTheDocument()})it('should not show keywords when indexing is QUALIFIED', () => {@@ -207,7 +207,7 @@ describe('NewSegmentModal', () => {const closeButtons = container.querySelectorAll('.cursor-pointer')// The close button is the second cursor-pointer elementif (closeButtons.length > 1)- fireEvent.click(closeButtons[1])+ fireEvent.click(closeButtons[1]!)expect(mockOnCancel).toHaveBeenCalled()})@@ -218,7 +218,7 @@ describe('NewSegmentModal', () => {fireEvent.change(questionInput, { target: { value: 'New question content' } })- expect(questionInput).toHaveValue('New question content')+ expect(questionInput)!.toHaveValue('New question content')})it('should update answer when docForm is QA and typing', () => {@@ -227,7 +227,7 @@ describe('NewSegmentModal', () => {fireEvent.change(answerInput, { target: { value: 'New answer content' } })- expect(answerInput).toHaveValue('New answer content')+ expect(answerInput)!.toHaveValue('New answer content')})it('should toggle add another checkbox', () => {@@ -237,7 +237,8 @@ describe('NewSegmentModal', () => {fireEvent.click(checkbox)// Assert - checkbox state should toggle- expect(checkbox).toBeInTheDocument()+ // Assert - checkbox state should toggle+ expect(checkbox)!.toBeInTheDocument()})})@@ -329,7 +330,7 @@ describe('NewSegmentModal', () => {const { container } = render(<NewSegmentModal {...defaultProps} />)const header = container.querySelector('.border-divider-subtle')- expect(header).toBeInTheDocument()+ expect(header)!.toBeInTheDocument()})it('should show action buttons in header when fullScreen', () => {@@ -337,7 +338,7 @@ describe('NewSegmentModal', () => {render(<NewSegmentModal {...defaultProps} />)- expect(screen.getByTestId('action-buttons')).toBeInTheDocument()+ expect(screen.getByTestId('action-buttons'))!.toBeInTheDocument()})it('should show add another in header when fullScreen', () => {@@ -345,7 +346,7 @@ describe('NewSegmentModal', () => {render(<NewSegmentModal {...defaultProps} />)- expect(screen.getByTestId('add-another')).toBeInTheDocument()+ expect(screen.getByTestId('add-another'))!.toBeInTheDocument()})it('should call toggleFullScreen when expand button is clicked', () => {@@ -354,7 +355,7 @@ describe('NewSegmentModal', () => {// Act - click the expand button (first cursor-pointer)const expandButtons = container.querySelectorAll('.cursor-pointer')if (expandButtons.length > 0)- fireEvent.click(expandButtons[0])+ fireEvent.click(expandButtons[0]!)expect(mockToggleFullScreen).toHaveBeenCalled()})@@ -365,13 +366,13 @@ describe('NewSegmentModal', () => {it('should pass actionType add to ActionButtons', () => {render(<NewSegmentModal {...defaultProps} />)- expect(screen.getByTestId('action-type')).toHaveTextContent('add')+ expect(screen.getByTestId('action-type'))!.toHaveTextContent('add')})it('should pass isEditMode true to ChunkContent', () => {render(<NewSegmentModal {...defaultProps} />)- expect(screen.getByTestId('edit-mode')).toHaveTextContent('editing')+ expect(screen.getByTestId('edit-mode'))!.toHaveTextContent('editing')})})@@ -384,7 +385,7 @@ describe('NewSegmentModal', () => {target: { value: 'keyword1,keyword2' },})- expect(screen.getByTestId('keywords-input')).toHaveValue('keyword1,keyword2')+ expect(screen.getByTestId('keywords-input'))!.toHaveValue('keyword1,keyword2')})it('should handle image upload', () => {@@ -393,7 +394,8 @@ describe('NewSegmentModal', () => {fireEvent.click(screen.getByTestId('upload-image-btn'))// Assert - image uploader should be rendered- expect(screen.getByTestId('image-uploader')).toBeInTheDocument()+ // Assert - image uploader should be rendered+ expect(screen.getByTestId('image-uploader'))!.toBeInTheDocument()})it('should maintain structure when rerendered with different docForm', () => {@@ -401,7 +403,7 @@ describe('NewSegmentModal', () => {rerender(<NewSegmentModal {...defaultProps} docForm={ChunkingMode.qa} />)- expect(screen.getByTestId('answer-input')).toBeInTheDocument()+ expect(screen.getByTestId('answer-input'))!.toBeInTheDocument()})})@@ -591,7 +593,9 @@ describe('NewSegmentModal', () => {// Assert - should show count of 5 (3 + 2)// The component uses formatNumber and shows "X characters"- expect(screen.getByText(/5/)).toBeInTheDocument()+ // Assert - should show count of 5 (3 + 2)+ // The component uses formatNumber and shows "X characters"+ expect(screen.getByText(/5/))!.toBeInTheDocument()})})@@ -602,8 +606,9 @@ describe('NewSegmentModal', () => {render(<NewSegmentModal {...defaultProps} />)// Assert - footer should have both AddAnother and ActionButtons- expect(screen.getByTestId('add-another')).toBeInTheDocument()- expect(screen.getByTestId('action-buttons')).toBeInTheDocument()+ // Assert - footer should have both AddAnother and ActionButtons+ expect(screen.getByTestId('add-another'))!.toBeInTheDocument()+ expect(screen.getByTestId('action-buttons'))!.toBeInTheDocument()})})})diff --git a/web/app/components/datasets/documents/detail/completed/__tests__/child-segment-detail.spec.tsx b/web/app/components/datasets/documents/detail/completed/__tests__/child-segment-detail.spec.tsxindex 4e3c7acd2bf..b3bec1b0b8c 100644--- a/web/app/components/datasets/documents/detail/completed/__tests__/child-segment-detail.spec.tsx+++ b/web/app/components/datasets/documents/detail/completed/__tests__/child-segment-detail.spec.tsx@@ -92,37 +92,37 @@ describe('ChildSegmentDetail', () => {it('should render without crashing', () => {const { container } = render(<ChildSegmentDetail {...defaultProps} />)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})it('should render edit child chunk title', () => {render(<ChildSegmentDetail {...defaultProps} />)- expect(screen.getByText(/segment\.editChildChunk/i)).toBeInTheDocument()+ expect(screen.getByText(/segment\.editChildChunk/i))!.toBeInTheDocument()})it('should render chunk content component', () => {render(<ChildSegmentDetail {...defaultProps} />)- expect(screen.getByTestId('chunk-content')).toBeInTheDocument()+ expect(screen.getByTestId('chunk-content'))!.toBeInTheDocument()})it('should render segment index tag', () => {render(<ChildSegmentDetail {...defaultProps} />)- expect(screen.getByTestId('segment-index-tag')).toBeInTheDocument()+ expect(screen.getByTestId('segment-index-tag'))!.toBeInTheDocument()})it('should render word count', () => {render(<ChildSegmentDetail {...defaultProps} />)- expect(screen.getByText(/segment\.characters/i)).toBeInTheDocument()+ expect(screen.getByText(/segment\.characters/i))!.toBeInTheDocument()})it('should render edit time', () => {render(<ChildSegmentDetail {...defaultProps} />)- expect(screen.getByText(/segment\.editedAt/i)).toBeInTheDocument()+ expect(screen.getByText(/segment\.editedAt/i))!.toBeInTheDocument()})})@@ -135,7 +135,7 @@ describe('ChildSegmentDetail', () => {const closeButtons = container.querySelectorAll('.cursor-pointer')if (closeButtons.length > 1)- fireEvent.click(closeButtons[1])+ fireEvent.click(closeButtons[1]!)expect(mockOnCancel).toHaveBeenCalled()})@@ -145,7 +145,7 @@ describe('ChildSegmentDetail', () => {const expandButtons = container.querySelectorAll('.cursor-pointer')if (expandButtons.length > 0)- fireEvent.click(expandButtons[0])+ fireEvent.click(expandButtons[0]!)expect(mockToggleFullScreen).toHaveBeenCalled()})@@ -170,7 +170,7 @@ describe('ChildSegmentDetail', () => {target: { value: 'Updated content' },})- expect(screen.getByTestId('content-input')).toHaveValue('Updated content')+ expect(screen.getByTestId('content-input'))!.toHaveValue('Updated content')})})@@ -181,7 +181,7 @@ describe('ChildSegmentDetail', () => {render(<ChildSegmentDetail {...defaultProps} />)- expect(screen.getByTestId('action-buttons')).toBeInTheDocument()+ expect(screen.getByTestId('action-buttons'))!.toBeInTheDocument()})it('should not show footer action buttons when fullScreen is true', () => {@@ -200,7 +200,7 @@ describe('ChildSegmentDetail', () => {render(<ChildSegmentDetail {...defaultProps} />)- expect(screen.getByTestId('action-buttons')).toBeInTheDocument()+ expect(screen.getByTestId('action-buttons'))!.toBeInTheDocument()})})@@ -209,13 +209,13 @@ describe('ChildSegmentDetail', () => {it('should pass isChildChunk true to ActionButtons', () => {render(<ChildSegmentDetail {...defaultProps} />)- expect(screen.getByTestId('is-child-chunk')).toHaveTextContent('true')+ expect(screen.getByTestId('is-child-chunk'))!.toHaveTextContent('true')})it('should pass isEditMode true to ChunkContent', () => {render(<ChildSegmentDetail {...defaultProps} />)- expect(screen.getByTestId('edit-mode')).toHaveTextContent('editing')+ expect(screen.getByTestId('edit-mode'))!.toHaveTextContent('editing')})})@@ -225,7 +225,7 @@ describe('ChildSegmentDetail', () => {<ChildSegmentDetail {...defaultProps} childChunkInfo={undefined} />,)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})it('should handle empty content', () => {@@ -233,7 +233,7 @@ describe('ChildSegmentDetail', () => {render(<ChildSegmentDetail {...defaultProps} childChunkInfo={emptyChildChunkInfo} />)- expect(screen.getByTestId('content-input')).toHaveValue('')+ expect(screen.getByTestId('content-input'))!.toHaveValue('')})it('should maintain structure when rerendered', () => {@@ -242,7 +242,7 @@ describe('ChildSegmentDetail', () => {const updatedInfo = { ...defaultChildChunkInfo, content: 'New content' }rerender(<ChildSegmentDetail {...defaultProps} childChunkInfo={updatedInfo} />)- expect(screen.getByTestId('content-input')).toBeInTheDocument()+ expect(screen.getByTestId('content-input'))!.toBeInTheDocument()})})@@ -258,6 +258,37 @@ describe('ChildSegmentDetail', () => {it('should have save button enabled by default', () => {render(<ChildSegmentDetail {...defaultProps} />)+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially+ // Assert - save button should be enabled initially// Assert - save button should be enabled initiallyexpect(screen.getByTestId('save-btn')).not.toBeDisabled()})diff --git a/web/app/components/datasets/documents/detail/completed/__tests__/index.spec.tsx b/web/app/components/datasets/documents/detail/completed/__tests__/index.spec.tsxindex aae0b226dbb..b7344d7a0f5 100644--- a/web/app/components/datasets/documents/detail/completed/__tests__/index.spec.tsx+++ b/web/app/components/datasets/documents/detail/completed/__tests__/index.spec.tsx@@ -287,10 +287,10 @@ describe('SegmentListContext', () => {render(<TestComponent />)- expect(screen.getByTestId('isCollapsed')).toHaveTextContent('true')- expect(screen.getByTestId('fullScreen')).toHaveTextContent('false')- expect(screen.getByTestId('currSegmentShowModal')).toHaveTextContent('false')- expect(screen.getByTestId('currChildChunkShowModal')).toHaveTextContent('false')+ expect(screen.getByTestId('isCollapsed'))!.toHaveTextContent('true')+ expect(screen.getByTestId('fullScreen'))!.toHaveTextContent('false')+ expect(screen.getByTestId('currSegmentShowModal'))!.toHaveTextContent('false')+ expect(screen.getByTestId('currChildChunkShowModal'))!.toHaveTextContent('false')})})@@ -324,9 +324,9 @@ describe('SegmentListContext', () => {</SegmentListContext.Provider>,)- expect(screen.getByTestId('isCollapsed')).toHaveTextContent('false')- expect(screen.getByTestId('fullScreen')).toHaveTextContent('true')- expect(screen.getByTestId('currSegmentShowModal')).toHaveTextContent('true')+ expect(screen.getByTestId('isCollapsed'))!.toHaveTextContent('false')+ expect(screen.getByTestId('fullScreen'))!.toHaveTextContent('true')+ expect(screen.getByTestId('currSegmentShowModal'))!.toHaveTextContent('true')})})@@ -356,8 +356,8 @@ describe('SegmentListContext', () => {</SegmentListContext.Provider>,)- expect(screen.getByTestId('isCollapsed')).toHaveTextContent('true')- expect(screen.getByTestId('fullScreen')).toHaveTextContent('false')+ expect(screen.getByTestId('isCollapsed'))!.toHaveTextContent('true')+ expect(screen.getByTestId('fullScreen'))!.toHaveTextContent('false')// Rerender with changed valuesrerender(@@ -373,8 +373,8 @@ describe('SegmentListContext', () => {</SegmentListContext.Provider>,)- expect(screen.getByTestId('isCollapsed')).toHaveTextContent('false')- expect(screen.getByTestId('fullScreen')).toHaveTextContent('true')+ expect(screen.getByTestId('isCollapsed'))!.toHaveTextContent('false')+ expect(screen.getByTestId('fullScreen'))!.toHaveTextContent('true')})})})@@ -400,7 +400,7 @@ describe('Completed Component', () => {it('should render MenuBar when not in full-doc mode', () => {render(<Completed {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByTestId('menu-bar')).toBeInTheDocument()+ expect(screen.getByTestId('menu-bar'))!.toBeInTheDocument()})it('should not render MenuBar when in full-doc mode', () => {@@ -415,7 +415,7 @@ describe('Completed Component', () => {it('should render GeneralModeContent when not in full-doc mode', () => {render(<Completed {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByTestId('general-mode-content')).toBeInTheDocument()+ expect(screen.getByTestId('general-mode-content'))!.toBeInTheDocument()})it('should render FullDocModeContent when in full-doc mode', () => {@@ -424,25 +424,25 @@ describe('Completed Component', () => {render(<Completed {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByTestId('full-doc-mode-content')).toBeInTheDocument()+ expect(screen.getByTestId('full-doc-mode-content'))!.toBeInTheDocument()})it('should render Pagination component', () => {render(<Completed {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByTestId('pagination')).toBeInTheDocument()+ expect(screen.getByTestId('pagination'))!.toBeInTheDocument()})it('should render Divider component', () => {render(<Completed {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByTestId('divider')).toBeInTheDocument()+ expect(screen.getByTestId('divider'))!.toBeInTheDocument()})it('should render DrawerGroup when docForm is available', () => {render(<Completed {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByTestId('drawer-group')).toBeInTheDocument()+ expect(screen.getByTestId('drawer-group'))!.toBeInTheDocument()})it('should not render DrawerGroup when docForm is undefined', () => {@@ -458,7 +458,7 @@ describe('Completed Component', () => {it('should start with page 0 (current - 1)', () => {render(<Completed {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByTestId('current-page')).toHaveTextContent('0')+ expect(screen.getByTestId('current-page'))!.toHaveTextContent('0')})it('should update page when pagination changes', async () => {@@ -468,7 +468,7 @@ describe('Completed Component', () => {fireEvent.click(nextPageButton)await waitFor(() => {- expect(screen.getByTestId('current-page')).toHaveTextContent('1')+ expect(screen.getByTestId('current-page'))!.toHaveTextContent('1')})})@@ -479,7 +479,8 @@ describe('Completed Component', () => {fireEvent.click(changeLimitButton)// Limit change is handled internally- expect(changeLimitButton).toBeInTheDocument()+ // Limit change is handled internally+ expect(changeLimitButton)!.toBeInTheDocument()})})@@ -495,19 +496,19 @@ describe('Completed Component', () => {it('should handle archived prop', () => {render(<Completed {...defaultProps} archived={true} />, { wrapper: createWrapper() })- expect(screen.getByTestId('general-mode-content')).toBeInTheDocument()+ expect(screen.getByTestId('general-mode-content'))!.toBeInTheDocument()})it('should handle embeddingAvailable prop', () => {render(<Completed {...defaultProps} embeddingAvailable={false} />, { wrapper: createWrapper() })- expect(screen.getByTestId('general-mode-content')).toBeInTheDocument()+ expect(screen.getByTestId('general-mode-content'))!.toBeInTheDocument()})it('should handle showNewSegmentModal prop', () => {render(<Completed {...defaultProps} showNewSegmentModal={true} />, { wrapper: createWrapper() })- expect(screen.getByTestId('drawer-group')).toBeInTheDocument()+ expect(screen.getByTestId('drawer-group'))!.toBeInTheDocument()})})@@ -517,7 +518,8 @@ describe('Completed Component', () => {render(<Completed {...defaultProps} />, { wrapper: createWrapper() })// Context is provided, components should render without errors- expect(screen.getByTestId('general-mode-content')).toBeInTheDocument()+ // Context is provided, components should render without errors+ expect(screen.getByTestId('general-mode-content'))!.toBeInTheDocument()})})})@@ -544,7 +546,7 @@ describe('Edge Cases', () => {render(<Completed {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByTestId('general-mode-content')).toBeInTheDocument()+ expect(screen.getByTestId('general-mode-content'))!.toBeInTheDocument()})it('should handle empty documentId', () => {@@ -552,19 +554,19 @@ describe('Edge Cases', () => {render(<Completed {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByTestId('general-mode-content')).toBeInTheDocument()+ expect(screen.getByTestId('general-mode-content'))!.toBeInTheDocument()})it('should handle undefined importStatus', () => {render(<Completed {...defaultProps} importStatus={undefined} />, { wrapper: createWrapper() })- expect(screen.getByTestId('general-mode-content')).toBeInTheDocument()+ expect(screen.getByTestId('general-mode-content'))!.toBeInTheDocument()})it('should handle ProcessStatus.COMPLETED importStatus', () => {render(<Completed {...defaultProps} importStatus="completed" />, { wrapper: createWrapper() })- expect(screen.getByTestId('general-mode-content')).toBeInTheDocument()+ expect(screen.getByTestId('general-mode-content'))!.toBeInTheDocument()})it('should handle all ChunkingMode values', () => {@@ -575,7 +577,7 @@ describe('Edge Cases', () => {const { unmount } = render(<Completed {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByTestId('pagination')).toBeInTheDocument()+ expect(screen.getByTestId('pagination'))!.toBeInTheDocument()unmount()})@@ -591,7 +593,7 @@ describe('Edge Cases', () => {const { unmount } = render(<Completed {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByTestId('pagination')).toBeInTheDocument()+ expect(screen.getByTestId('pagination'))!.toBeInTheDocument()unmount()})@@ -617,33 +619,34 @@ describe('Integration Tests', () => {render(<Completed {...defaultProps} />, { wrapper: createWrapper() })// All components should render without errors- expect(screen.getByTestId('menu-bar')).toBeInTheDocument()- expect(screen.getByTestId('general-mode-content')).toBeInTheDocument()- expect(screen.getByTestId('pagination')).toBeInTheDocument()- expect(screen.getByTestId('drawer-group')).toBeInTheDocument()+ // All components should render without errors+ expect(screen.getByTestId('menu-bar'))!.toBeInTheDocument()+ expect(screen.getByTestId('general-mode-content'))!.toBeInTheDocument()+ expect(screen.getByTestId('pagination'))!.toBeInTheDocument()+ expect(screen.getByTestId('drawer-group'))!.toBeInTheDocument()})it('should update UI when mode changes', () => {const { rerender } = render(<Completed {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByTestId('general-mode-content')).toBeInTheDocument()+ expect(screen.getByTestId('general-mode-content'))!.toBeInTheDocument()mockDocForm.current = ChunkingModeEnum.parentChildmockParentMode.current = 'full-doc'rerender(<Completed {...defaultProps} />)- expect(screen.getByTestId('full-doc-mode-content')).toBeInTheDocument()+ expect(screen.getByTestId('full-doc-mode-content'))!.toBeInTheDocument()})it('should handle prop updates correctly', () => {const { rerender } = render(<Completed {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByTestId('drawer-group')).toBeInTheDocument()+ expect(screen.getByTestId('drawer-group'))!.toBeInTheDocument()rerender(<Completed {...defaultProps} showNewSegmentModal={true} />)- expect(screen.getByTestId('drawer-group')).toBeInTheDocument()+ expect(screen.getByTestId('drawer-group'))!.toBeInTheDocument()})})@@ -696,6 +699,37 @@ describe('Batch Action Callbacks', () => {it('should not render batch actions when no segments are selected initially', async () => {render(<Completed {...defaultProps} />, { wrapper: createWrapper() })+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible+ // Initially no segments are selected, so batch action should not be visible// Initially no segments are selected, so batch action should not be visibleexpect(screen.queryByTestId('batch-action')).not.toBeInTheDocument()})@@ -708,7 +742,7 @@ describe('Batch Action Callbacks', () => {// Now batch actions should be visibleawait waitFor(() => {- expect(screen.getByTestId('batch-action')).toBeInTheDocument()+ expect(screen.getByTestId('batch-action'))!.toBeInTheDocument()})})@@ -721,7 +755,7 @@ describe('Batch Action Callbacks', () => {// Wait for batch actions to appearawait waitFor(() => {- expect(screen.getByTestId('batch-action')).toBeInTheDocument()+ expect(screen.getByTestId('batch-action'))!.toBeInTheDocument()})const enableButton = screen.getByTestId('batch-enable')@@ -739,7 +773,7 @@ describe('Batch Action Callbacks', () => {// Wait for batch actions to appearawait waitFor(() => {- expect(screen.getByTestId('batch-action')).toBeInTheDocument()+ expect(screen.getByTestId('batch-action'))!.toBeInTheDocument()})const disableButton = screen.getByTestId('batch-disable')@@ -757,7 +791,7 @@ describe('Batch Action Callbacks', () => {// Wait for batch actions to appearawait waitFor(() => {- expect(screen.getByTestId('batch-action')).toBeInTheDocument()+ expect(screen.getByTestId('batch-action'))!.toBeInTheDocument()})const deleteButton = screen.getByTestId('batch-delete')@@ -887,14 +921,15 @@ describe('refreshChunkListDataWithDetailChanged branch coverage', () => {// Create a refreshMap similar to the componentconst refreshMap: Record<string, () => void> = {- true: () => {+ true: (() => {mockInvalidAll()mockInvalidDisabled()- },+ })!,}// Execute the 'true' branch- refreshMap.true()+ // Execute the 'true' branch+ refreshMap.true!()expect(mockInvalidAll).toHaveBeenCalled()expect(mockInvalidDisabled).toHaveBeenCalled()@@ -907,14 +942,15 @@ describe('refreshChunkListDataWithDetailChanged branch coverage', () => {// Create a refreshMap similar to the componentconst refreshMap: Record<string, () => void> = {- false: () => {+ false: (() => {mockInvalidAll()mockInvalidEnabled()- },+ })!,}// Execute the 'false' branch- refreshMap.false()+ // Execute the 'false' branch+ refreshMap.false!()expect(mockInvalidAll).toHaveBeenCalled()expect(mockInvalidEnabled).toHaveBeenCalled()@@ -989,13 +1025,13 @@ describe('Inline callback and hook initialization coverage', () => {fireEvent.click(screen.getByTestId('next-page'))await waitFor(() => {- expect(screen.getByTestId('current-page')).toHaveTextContent('1')+ expect(screen.getByTestId('current-page'))!.toHaveTextContent('1')})fireEvent.click(screen.getByTestId('status-enabled'))await waitFor(() => {- expect(screen.getByTestId('current-page')).toHaveTextContent('0')+ expect(screen.getByTestId('current-page'))!.toHaveTextContent('0')})})@@ -1006,7 +1042,7 @@ describe('Inline callback and hook initialization coverage', () => {<Completed {...defaultProps} onNewSegmentModalChange={mockOnChange} />,{ wrapper: createWrapper() },)- expect(screen.getByTestId('drawer-group')).toBeInTheDocument()+ expect(screen.getByTestId('drawer-group'))!.toBeInTheDocument()})// Covers lines 74-90: refreshChunkListDataWithDetailChanged with status true@@ -1056,7 +1092,7 @@ describe('Inline callback and hook initialization coverage', () => {fireEvent.click(screen.getByTestId('select-all-button'))await waitFor(() => {- expect(screen.getByTestId('batch-action')).toBeInTheDocument()+ expect(screen.getByTestId('batch-action'))!.toBeInTheDocument()})fireEvent.click(screen.getByTestId('cancel-batch'))@@ -1072,7 +1108,7 @@ describe('Inline callback and hook initialization coverage', () => {fireEvent.click(screen.getByTestId('select-all-button'))await waitFor(() => {- expect(screen.getByTestId('batch-action')).toBeInTheDocument()+ expect(screen.getByTestId('batch-action'))!.toBeInTheDocument()})fireEvent.click(screen.getByTestId('batch-enable'))@@ -1086,7 +1122,7 @@ describe('Inline callback and hook initialization coverage', () => {fireEvent.click(screen.getByTestId('select-all-button'))await waitFor(() => {- expect(screen.getByTestId('batch-action')).toBeInTheDocument()+ expect(screen.getByTestId('batch-action'))!.toBeInTheDocument()})fireEvent.click(screen.getByTestId('batch-disable'))@@ -1100,7 +1136,7 @@ describe('Inline callback and hook initialization coverage', () => {fireEvent.click(screen.getByTestId('select-all-button'))await waitFor(() => {- expect(screen.getByTestId('batch-action')).toBeInTheDocument()+ expect(screen.getByTestId('batch-action'))!.toBeInTheDocument()})fireEvent.click(screen.getByTestId('batch-delete'))@@ -1115,12 +1151,12 @@ describe('Inline callback and hook initialization coverage', () => {fireEvent.click(screen.getByTestId('next-page'))await waitFor(() => {- expect(screen.getByTestId('current-page')).toHaveTextContent('1')+ expect(screen.getByTestId('current-page'))!.toHaveTextContent('1')})fireEvent.click(screen.getByTestId('next-page'))await waitFor(() => {- expect(screen.getByTestId('current-page')).toHaveTextContent('2')+ expect(screen.getByTestId('current-page'))!.toHaveTextContent('2')})})@@ -1132,7 +1168,7 @@ describe('Inline callback and hook initialization coverage', () => {render(<Completed {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByTestId('total-items')).toHaveTextContent('42')+ expect(screen.getByTestId('total-items'))!.toHaveTextContent('42')})// Covers search input change@@ -1142,6 +1178,6 @@ describe('Inline callback and hook initialization coverage', () => {const searchInput = screen.getByTestId('search-input')fireEvent.change(searchInput, { target: { value: 'test query' } })- expect(searchInput).toHaveValue('test query')+ expect(searchInput)!.toHaveValue('test query')})})diff --git a/web/app/components/datasets/documents/detail/completed/__tests__/new-child-segment.spec.tsx b/web/app/components/datasets/documents/detail/completed/__tests__/new-child-segment.spec.tsxindex 150d399a5de..ff9fb4c5243 100644--- a/web/app/components/datasets/documents/detail/completed/__tests__/new-child-segment.spec.tsx+++ b/web/app/components/datasets/documents/detail/completed/__tests__/new-child-segment.spec.tsx@@ -110,31 +110,31 @@ describe('NewChildSegmentModal', () => {it('should render without crashing', () => {const { container } = render(<NewChildSegmentModal {...defaultProps} />)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})it('should render add child chunk title', () => {render(<NewChildSegmentModal {...defaultProps} />)- expect(screen.getByText(/segment\.addChildChunk/i)).toBeInTheDocument()+ expect(screen.getByText(/segment\.addChildChunk/i))!.toBeInTheDocument()})it('should render chunk content component', () => {render(<NewChildSegmentModal {...defaultProps} />)- expect(screen.getByTestId('chunk-content')).toBeInTheDocument()+ expect(screen.getByTestId('chunk-content'))!.toBeInTheDocument()})it('should render segment index tag with new child chunk label', () => {render(<NewChildSegmentModal {...defaultProps} />)- expect(screen.getByTestId('segment-index-tag')).toBeInTheDocument()+ expect(screen.getByTestId('segment-index-tag'))!.toBeInTheDocument()})it('should render add another checkbox', () => {render(<NewChildSegmentModal {...defaultProps} />)- expect(screen.getByTestId('add-another')).toBeInTheDocument()+ expect(screen.getByTestId('add-another'))!.toBeInTheDocument()})})@@ -147,7 +147,7 @@ describe('NewChildSegmentModal', () => {const closeButtons = container.querySelectorAll('.cursor-pointer')if (closeButtons.length > 1)- fireEvent.click(closeButtons[1])+ fireEvent.click(closeButtons[1]!)expect(mockOnCancel).toHaveBeenCalled()})@@ -157,7 +157,7 @@ describe('NewChildSegmentModal', () => {const expandButtons = container.querySelectorAll('.cursor-pointer')if (expandButtons.length > 0)- fireEvent.click(expandButtons[0])+ fireEvent.click(expandButtons[0]!)expect(mockToggleFullScreen).toHaveBeenCalled()})@@ -169,7 +169,7 @@ describe('NewChildSegmentModal', () => {target: { value: 'New content' },})- expect(screen.getByTestId('content-input')).toHaveValue('New content')+ expect(screen.getByTestId('content-input'))!.toHaveValue('New content')})it('should toggle add another checkbox', () => {@@ -178,7 +178,7 @@ describe('NewChildSegmentModal', () => {fireEvent.click(checkbox)- expect(checkbox).toBeInTheDocument()+ expect(checkbox)!.toBeInTheDocument()})})@@ -253,7 +253,7 @@ describe('NewChildSegmentModal', () => {render(<NewChildSegmentModal {...defaultProps} />)- expect(screen.getByTestId('action-buttons')).toBeInTheDocument()+ expect(screen.getByTestId('action-buttons'))!.toBeInTheDocument()})it('should show add another in header when fullScreen', () => {@@ -261,7 +261,7 @@ describe('NewChildSegmentModal', () => {render(<NewChildSegmentModal {...defaultProps} />)- expect(screen.getByTestId('add-another')).toBeInTheDocument()+ expect(screen.getByTestId('add-another'))!.toBeInTheDocument()})})@@ -270,19 +270,19 @@ describe('NewChildSegmentModal', () => {it('should pass actionType add to ActionButtons', () => {render(<NewChildSegmentModal {...defaultProps} />)- expect(screen.getByTestId('action-type')).toHaveTextContent('add')+ expect(screen.getByTestId('action-type'))!.toHaveTextContent('add')})it('should pass isChildChunk true to ActionButtons', () => {render(<NewChildSegmentModal {...defaultProps} />)- expect(screen.getByTestId('is-child-chunk')).toHaveTextContent('true')+ expect(screen.getByTestId('is-child-chunk'))!.toHaveTextContent('true')})it('should pass isEditMode true to ChunkContent', () => {render(<NewChildSegmentModal {...defaultProps} />)- expect(screen.getByTestId('edit-mode')).toHaveTextContent('editing')+ expect(screen.getByTestId('edit-mode'))!.toHaveTextContent('editing')})})@@ -292,7 +292,7 @@ describe('NewChildSegmentModal', () => {const { container } = render(<NewChildSegmentModal {...props} />)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})it('should maintain structure when rerendered', () => {@@ -300,7 +300,7 @@ describe('NewChildSegmentModal', () => {rerender(<NewChildSegmentModal {...defaultProps} chunkId="chunk-2" />)- expect(screen.getByTestId('chunk-content')).toBeInTheDocument()+ expect(screen.getByTestId('chunk-content'))!.toBeInTheDocument()})})@@ -351,7 +351,7 @@ describe('NewChildSegmentModal', () => {// Assert - modal should not close, only content clearedawait waitFor(() => {- expect(screen.getByTestId('content-input')).toHaveValue('')+ expect(screen.getByTestId('content-input'))!.toHaveValue('')})})})diff --git a/web/app/components/datasets/documents/detail/completed/__tests__/segment-detail.spec.tsx b/web/app/components/datasets/documents/detail/completed/__tests__/segment-detail.spec.tsxindex dbce9b7f22b..4e17cd39b3c 100644--- a/web/app/components/datasets/documents/detail/completed/__tests__/segment-detail.spec.tsx+++ b/web/app/components/datasets/documents/detail/completed/__tests__/segment-detail.spec.tsx@@ -174,37 +174,37 @@ describe('SegmentDetail', () => {it('should render without crashing', () => {const { container } = render(<SegmentDetail {...defaultProps} />)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})it('should render title for view mode', () => {render(<SegmentDetail {...defaultProps} isEditMode={false} />)- expect(screen.getByText(/segment\.chunkDetail/i)).toBeInTheDocument()+ expect(screen.getByText(/segment\.chunkDetail/i))!.toBeInTheDocument()})it('should render title for edit mode', () => {render(<SegmentDetail {...defaultProps} isEditMode={true} />)- expect(screen.getByText(/segment\.editChunk/i)).toBeInTheDocument()+ expect(screen.getByText(/segment\.editChunk/i))!.toBeInTheDocument()})it('should render chunk content component', () => {render(<SegmentDetail {...defaultProps} />)- expect(screen.getByTestId('chunk-content')).toBeInTheDocument()+ expect(screen.getByTestId('chunk-content'))!.toBeInTheDocument()})it('should render image uploader', () => {render(<SegmentDetail {...defaultProps} />)- expect(screen.getByTestId('image-uploader')).toBeInTheDocument()+ expect(screen.getByTestId('image-uploader'))!.toBeInTheDocument()})it('should render segment index tag', () => {render(<SegmentDetail {...defaultProps} />)- expect(screen.getByTestId('segment-index-tag')).toBeInTheDocument()+ expect(screen.getByTestId('segment-index-tag'))!.toBeInTheDocument()})})@@ -213,25 +213,25 @@ describe('SegmentDetail', () => {it('should pass isEditMode to ChunkContent', () => {render(<SegmentDetail {...defaultProps} isEditMode={true} />)- expect(screen.getByTestId('edit-mode')).toHaveTextContent('editing')+ expect(screen.getByTestId('edit-mode'))!.toHaveTextContent('editing')})it('should disable image uploader in view mode', () => {render(<SegmentDetail {...defaultProps} isEditMode={false} />)- expect(screen.getByTestId('uploader-disabled')).toHaveTextContent('disabled')+ expect(screen.getByTestId('uploader-disabled'))!.toHaveTextContent('disabled')})it('should enable image uploader in edit mode', () => {render(<SegmentDetail {...defaultProps} isEditMode={true} />)- expect(screen.getByTestId('uploader-disabled')).toHaveTextContent('enabled')+ expect(screen.getByTestId('uploader-disabled'))!.toHaveTextContent('enabled')})it('should show action buttons in edit mode', () => {render(<SegmentDetail {...defaultProps} isEditMode={true} />)- expect(screen.getByTestId('action-buttons')).toBeInTheDocument()+ expect(screen.getByTestId('action-buttons'))!.toBeInTheDocument()})it('should not show action buttons in view mode (non-fullscreen)', () => {@@ -248,7 +248,7 @@ describe('SegmentDetail', () => {render(<SegmentDetail {...defaultProps} />)- expect(screen.getByTestId('keywords')).toBeInTheDocument()+ expect(screen.getByTestId('keywords'))!.toBeInTheDocument()})it('should not show keywords when indexing is QUALIFIED', () => {@@ -264,7 +264,7 @@ describe('SegmentDetail', () => {render(<SegmentDetail {...defaultProps} isEditMode={false} />)- expect(screen.getByTestId('keywords-action')).toHaveTextContent('view')+ expect(screen.getByTestId('keywords-action'))!.toHaveTextContent('view')})it('should pass edit action type when in edit mode', () => {@@ -272,7 +272,7 @@ describe('SegmentDetail', () => {render(<SegmentDetail {...defaultProps} isEditMode={true} />)- expect(screen.getByTestId('keywords-action')).toHaveTextContent('edit')+ expect(screen.getByTestId('keywords-action'))!.toHaveTextContent('edit')})})@@ -283,7 +283,7 @@ describe('SegmentDetail', () => {const closeButtons = container.querySelectorAll('.cursor-pointer')if (closeButtons.length > 1)- fireEvent.click(closeButtons[1])+ fireEvent.click(closeButtons[1]!)expect(mockOnCancel).toHaveBeenCalled()})@@ -293,7 +293,7 @@ describe('SegmentDetail', () => {const expandButtons = container.querySelectorAll('.cursor-pointer')if (expandButtons.length > 0)- fireEvent.click(expandButtons[0])+ fireEvent.click(expandButtons[0]!)expect(mockToggleFullScreen).toHaveBeenCalled()})@@ -322,7 +322,7 @@ describe('SegmentDetail', () => {target: { value: 'Updated content' },})- expect(screen.getByTestId('question-input')).toHaveValue('Updated content')+ expect(screen.getByTestId('question-input'))!.toHaveValue('Updated content')})})@@ -333,7 +333,7 @@ describe('SegmentDetail', () => {render(<SegmentDetail {...defaultProps} isEditMode={true} />)- expect(screen.getByTestId('regenerate-btn')).toBeInTheDocument()+ expect(screen.getByTestId('regenerate-btn'))!.toBeInTheDocument()})it('should not show regeneration button when runtimeMode is not general', () => {@@ -349,7 +349,7 @@ describe('SegmentDetail', () => {fireEvent.click(screen.getByTestId('regenerate-btn'))- expect(screen.getByTestId('regeneration-modal')).toBeInTheDocument()+ expect(screen.getByTestId('regeneration-modal'))!.toBeInTheDocument()})it('should call onModalStateChange when regeneration modal opens', () => {@@ -392,7 +392,7 @@ describe('SegmentDetail', () => {render(<SegmentDetail {...defaultProps} isEditMode={true} />)- expect(screen.getByTestId('action-buttons')).toBeInTheDocument()+ expect(screen.getByTestId('action-buttons'))!.toBeInTheDocument()})it('should apply full screen styling when fullScreen is true', () => {@@ -401,7 +401,7 @@ describe('SegmentDetail', () => {const { container } = render(<SegmentDetail {...defaultProps} />)const header = container.querySelector('.border-divider-subtle')- expect(header).toBeInTheDocument()+ expect(header)!.toBeInTheDocument()})})@@ -415,7 +415,7 @@ describe('SegmentDetail', () => {const { container } = render(<SegmentDetail {...defaultProps} segInfo={minimalSegInfo} />)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})it('should handle empty keywords array', () => {@@ -424,7 +424,7 @@ describe('SegmentDetail', () => {render(<SegmentDetail {...defaultProps} segInfo={segInfo} />)- expect(screen.getByTestId('keywords-input')).toHaveValue('')+ expect(screen.getByTestId('keywords-input'))!.toHaveValue('')})it('should maintain structure when rerendered', () => {@@ -432,7 +432,7 @@ describe('SegmentDetail', () => {rerender(<SegmentDetail {...defaultProps} isEditMode={true} />)- expect(screen.getByTestId('action-buttons')).toBeInTheDocument()+ expect(screen.getByTestId('action-buttons'))!.toBeInTheDocument()})})@@ -443,7 +443,7 @@ describe('SegmentDetail', () => {fireEvent.click(screen.getByTestId('add-attachment-btn'))- expect(screen.getByTestId('attachments-count')).toHaveTextContent('1')+ expect(screen.getByTestId('attachments-count'))!.toHaveTextContent('1')})it('should pass attachments to onUpdate when save is clicked', () => {@@ -476,7 +476,7 @@ describe('SegmentDetail', () => {render(<SegmentDetail {...defaultProps} segInfo={segInfoWithAttachments} isEditMode={true} />)- expect(screen.getByTestId('attachments-count')).toHaveTextContent('1')+ expect(screen.getByTestId('attachments-count'))!.toHaveTextContent('1')})})@@ -529,7 +529,7 @@ describe('SegmentDetail', () => {it('should render answer input in QA mode', () => {render(<SegmentDetail {...defaultProps} docForm={ChunkingMode.qa} isEditMode={true} />)- expect(screen.getByTestId('answer-input')).toBeInTheDocument()+ expect(screen.getByTestId('answer-input'))!.toBeInTheDocument()})it('should update answer when input changes', () => {@@ -539,14 +539,15 @@ describe('SegmentDetail', () => {target: { value: 'Updated answer' },})- expect(screen.getByTestId('answer-input')).toHaveValue('Updated answer')+ expect(screen.getByTestId('answer-input'))!.toHaveValue('Updated answer')})it('should calculate word count correctly in QA mode', () => {render(<SegmentDetail {...defaultProps} docForm={ChunkingMode.qa} isEditMode={true} />)// Assert - should show combined length of question and answer- expect(screen.getByText(/segment\.characters/i)).toBeInTheDocument()+ // Assert - should show combined length of question and answer+ expect(screen.getByText(/segment\.characters/i))!.toBeInTheDocument()})})@@ -557,7 +558,7 @@ describe('SegmentDetail', () => {render(<SegmentDetail {...defaultProps} docForm={ChunkingMode.parentChild} />)- expect(screen.getByTestId('segment-index-tag')).toBeInTheDocument()+ expect(screen.getByTestId('segment-index-tag'))!.toBeInTheDocument()})})@@ -571,7 +572,7 @@ describe('SegmentDetail', () => {target: { value: 'new,keywords' },})- expect(screen.getByTestId('keywords-input')).toHaveValue('new,keywords')+ expect(screen.getByTestId('keywords-input'))!.toHaveValue('new,keywords')})})})diff --git a/web/app/components/datasets/documents/detail/completed/common/__tests__/action-buttons.spec.tsx b/web/app/components/datasets/documents/detail/completed/common/__tests__/action-buttons.spec.tsxindex edf4b309224..c8500e37694 100644--- a/web/app/components/datasets/documents/detail/completed/common/__tests__/action-buttons.spec.tsx+++ b/web/app/components/datasets/documents/detail/completed/common/__tests__/action-buttons.spec.tsx@@ -63,7 +63,7 @@ describe('ActionButtons', () => {{ wrapper: createWrapper({}) },)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})it('should render cancel button', () => {@@ -76,7 +76,7 @@ describe('ActionButtons', () => {{ wrapper: createWrapper({}) },)- expect(screen.getByText(/operation\.cancel/i)).toBeInTheDocument()+ expect(screen.getByText(/operation\.cancel/i))!.toBeInTheDocument()})it('should render save button', () => {@@ -89,7 +89,7 @@ describe('ActionButtons', () => {{ wrapper: createWrapper({}) },)- expect(screen.getByText(/operation\.save/i)).toBeInTheDocument()+ expect(screen.getByText(/operation\.save/i))!.toBeInTheDocument()})it('should render ESC keyboard hint on cancel button', () => {@@ -102,7 +102,7 @@ describe('ActionButtons', () => {{ wrapper: createWrapper({}) },)- expect(screen.getByText('ESC')).toBeInTheDocument()+ expect(screen.getByText('ESC'))!.toBeInTheDocument()})it('should render S keyboard hint on save button', () => {@@ -115,7 +115,7 @@ describe('ActionButtons', () => {{ wrapper: createWrapper({}) },)- expect(screen.getByText('S')).toBeInTheDocument()+ expect(screen.getByText('S'))!.toBeInTheDocument()})})@@ -132,7 +132,7 @@ describe('ActionButtons', () => {)const cancelButton = screen.getAllByRole('button')[0]- fireEvent.click(cancelButton)+ fireEvent.click(cancelButton!)expect(mockHandleCancel).toHaveBeenCalledTimes(1)})@@ -150,7 +150,7 @@ describe('ActionButtons', () => {const buttons = screen.getAllByRole('button')const saveButton = buttons[buttons.length - 1] // Save button is last- fireEvent.click(saveButton)+ fireEvent.click(saveButton!)expect(mockHandleSave).toHaveBeenCalledTimes(1)})@@ -167,7 +167,7 @@ describe('ActionButtons', () => {const buttons = screen.getAllByRole('button')const saveButton = buttons[buttons.length - 1]- expect(saveButton).toBeDisabled()+ expect(saveButton)!.toBeDisabled()})})@@ -187,7 +187,7 @@ describe('ActionButtons', () => {{ wrapper: createWrapper({ docForm: ChunkingMode.parentChild, parentMode: 'paragraph' }) },)- expect(screen.getByText(/operation\.saveAndRegenerate/i)).toBeInTheDocument()+ expect(screen.getByText(/operation\.saveAndRegenerate/i))!.toBeInTheDocument()})it('should not show regeneration button when isChildChunk is true', () => {@@ -278,7 +278,7 @@ describe('ActionButtons', () => {)const regenerationButton = screen.getByText(/operation\.saveAndRegenerate/i).closest('button')- expect(regenerationButton).toBeDisabled()+ expect(regenerationButton)!.toBeDisabled()})})@@ -298,7 +298,8 @@ describe('ActionButtons', () => {)// Assert - regeneration button should show with default actionType='edit'- expect(screen.getByText(/operation\.saveAndRegenerate/i)).toBeInTheDocument()+ // Assert - regeneration button should show with default actionType='edit'+ expect(screen.getByText(/operation\.saveAndRegenerate/i))!.toBeInTheDocument()})it('should use default isChildChunk of false', () => {@@ -316,7 +317,8 @@ describe('ActionButtons', () => {)// Assert - regeneration button should show with default isChildChunk=false- expect(screen.getByText(/operation\.saveAndRegenerate/i)).toBeInTheDocument()+ // Assert - regeneration button should show with default isChildChunk=false+ expect(screen.getByText(/operation\.saveAndRegenerate/i))!.toBeInTheDocument()})it('should use default showRegenerationButton of true', () => {@@ -334,7 +336,8 @@ describe('ActionButtons', () => {)// Assert - regeneration button should show with default showRegenerationButton=true- expect(screen.getByText(/operation\.saveAndRegenerate/i)).toBeInTheDocument()+ // Assert - regeneration button should show with default showRegenerationButton=true+ expect(screen.getByText(/operation\.saveAndRegenerate/i))!.toBeInTheDocument()})})@@ -373,8 +376,8 @@ describe('ActionButtons', () => {</DocumentContext.Provider>,)- expect(screen.getByText(/operation\.cancel/i)).toBeInTheDocument()- expect(screen.getByText(/operation\.save/i)).toBeInTheDocument()+ expect(screen.getByText(/operation\.cancel/i))!.toBeInTheDocument()+ expect(screen.getByText(/operation\.save/i))!.toBeInTheDocument()})})diff --git a/web/app/components/datasets/documents/detail/completed/common/__tests__/chunk-content.spec.tsx b/web/app/components/datasets/documents/detail/completed/common/__tests__/chunk-content.spec.tsxindex 115db9ad611..a92cc9d3502 100644--- a/web/app/components/datasets/documents/detail/completed/common/__tests__/chunk-content.spec.tsx+++ b/web/app/components/datasets/documents/detail/completed/common/__tests__/chunk-content.spec.tsx@@ -34,19 +34,50 @@ describe('ChunkContent', () => {it('should render without crashing', () => {const { container } = render(<ChunkContent {...defaultProps} />)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})it('should render textarea in edit mode with text docForm', () => {render(<ChunkContent {...defaultProps} isEditMode={true} />)const textarea = screen.getByRole('textbox')- expect(textarea).toBeInTheDocument()+ expect(textarea)!.toBeInTheDocument()})it('should render Markdown content in view mode with text docForm', () => {const { container } = render(<ChunkContent {...defaultProps} isEditMode={false} />)+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead+ // Assert - In view mode, textarea should not be present, Markdown renders instead// Assert - In view mode, textarea should not be present, Markdown renders insteadexpect(container.querySelector('textarea')).not.toBeInTheDocument()})@@ -66,8 +97,9 @@ describe('ChunkContent', () => {)// Assert - QA mode has QUESTION and ANSWER labels- expect(screen.getByText('QUESTION')).toBeInTheDocument()- expect(screen.getByText('ANSWER')).toBeInTheDocument()+ // Assert - QA mode has QUESTION and ANSWER labels+ expect(screen.getByText('QUESTION'))!.toBeInTheDocument()+ expect(screen.getByText('ANSWER'))!.toBeInTheDocument()})it('should display question value in QA mode', () => {@@ -83,7 +115,7 @@ describe('ChunkContent', () => {)const textareas = screen.getAllByRole('textbox')- expect(textareas[0]).toHaveValue('My question')+ expect(textareas[0])!.toHaveValue('My question')})it('should display answer value in QA mode', () => {@@ -99,7 +131,7 @@ describe('ChunkContent', () => {)const textareas = screen.getAllByRole('textbox')- expect(textareas[1]).toHaveValue('My answer')+ expect(textareas[1])!.toHaveValue('My answer')})})@@ -133,7 +165,7 @@ describe('ChunkContent', () => {)const textareas = screen.getAllByRole('textbox')- fireEvent.change(textareas[0], { target: { value: 'New question' } })+ fireEvent.change(textareas[0]!, { target: { value: 'New question' } })expect(mockOnQuestionChange).toHaveBeenCalledWith('New question')})@@ -151,7 +183,7 @@ describe('ChunkContent', () => {)const textareas = screen.getAllByRole('textbox')- fireEvent.change(textareas[1], { target: { value: 'New answer' } })+ fireEvent.change(textareas[1]!, { target: { value: 'New answer' } })expect(mockOnAnswerChange).toHaveBeenCalledWith('New answer')})@@ -161,6 +193,37 @@ describe('ChunkContent', () => {<ChunkContent {...defaultProps} isEditMode={false} />,)+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea+ // Assert - In view mode, Markdown is rendered instead of textarea// Assert - In view mode, Markdown is rendered instead of textareaexpect(container.querySelector('textarea')).not.toBeInTheDocument()})@@ -178,7 +241,7 @@ describe('ChunkContent', () => {const textareas = screen.getAllByRole('textbox')textareas.forEach((textarea) => {- expect(textarea).toBeDisabled()+ expect(textarea)!.toBeDisabled()})})})@@ -188,7 +251,7 @@ describe('ChunkContent', () => {it('should handle ChunkingMode.text', () => {render(<ChunkContent {...defaultProps} docForm={ChunkingMode.text} isEditMode={true} />)- expect(screen.getByRole('textbox')).toBeInTheDocument()+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})it('should handle ChunkingMode.qa', () => {@@ -203,8 +266,9 @@ describe('ChunkContent', () => {)// Assert - QA mode should show both question and answer- expect(screen.getByText('QUESTION')).toBeInTheDocument()- expect(screen.getByText('ANSWER')).toBeInTheDocument()+ // Assert - QA mode should show both question and answer+ expect(screen.getByText('QUESTION'))!.toBeInTheDocument()+ expect(screen.getByText('ANSWER'))!.toBeInTheDocument()})it('should handle ChunkingMode.parentChild similar to text mode', () => {@@ -217,7 +281,8 @@ describe('ChunkContent', () => {)// Assert - parentChild should render like text mode- expect(screen.getByRole('textbox')).toBeInTheDocument()+ // Assert - parentChild should render like text mode+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})})@@ -232,7 +297,7 @@ describe('ChunkContent', () => {)const textarea = screen.getByRole('textbox')- expect(textarea).toHaveValue('')+ expect(textarea)!.toHaveValue('')})it('should handle empty answer in QA mode', () => {@@ -248,7 +313,7 @@ describe('ChunkContent', () => {)const textareas = screen.getAllByRole('textbox')- expect(textareas[1]).toHaveValue('')+ expect(textareas[1])!.toHaveValue('')})it('should handle undefined answer in QA mode', () => {@@ -261,7 +326,8 @@ describe('ChunkContent', () => {)// Assert - should render without crashing- expect(screen.getByText('QUESTION')).toBeInTheDocument()+ // Assert - should render without crashing+ expect(screen.getByText('QUESTION'))!.toBeInTheDocument()})it('should maintain structure when rerendered', () => {@@ -274,7 +340,7 @@ describe('ChunkContent', () => {)const textarea = screen.getByRole('textbox')- expect(textarea).toHaveValue('Updated')+ expect(textarea)!.toHaveValue('Updated')})})})diff --git a/web/app/components/datasets/documents/detail/completed/components/segment-list-content.tsx b/web/app/components/datasets/documents/detail/completed/components/segment-list-content.tsxindex 116ba38856c..d6757638436 100644--- a/web/app/components/datasets/documents/detail/completed/components/segment-list-content.tsx+++ b/web/app/components/datasets/documents/detail/completed/components/segment-list-content.tsx@@ -49,7 +49,7 @@ export const FullDocModeContent: FC<FullDocModeContentProps> = ({><SegmentCarddetail={firstSegment}- onClick={() => onClickCard(firstSegment)}+ onClick={() => onClickCard(firstSegment!)}loading={isLoadingSegmentList}focused={{segmentIndex: currSegmentId === firstSegment?.id,@@ -57,7 +57,7 @@ export const FullDocModeContent: FC<FullDocModeContentProps> = ({}}/><ChildSegmentList- parentChunkId={firstSegment?.id}+ parentChunkId={firstSegment?.id!}onDelete={onDeleteChildChunk}childChunks={childSegments}handleInputChange={handleInputChange}diff --git a/web/app/components/datasets/documents/detail/completed/hooks/__tests__/use-child-segment-data.spec.ts b/web/app/components/datasets/documents/detail/completed/hooks/__tests__/use-child-segment-data.spec.tsindex 2dd99abcb9f..7817a3b2aa3 100644--- a/web/app/components/datasets/documents/detail/completed/hooks/__tests__/use-child-segment-data.spec.ts+++ b/web/app/components/datasets/documents/detail/completed/hooks/__tests__/use-child-segment-data.spec.ts@@ -452,7 +452,7 @@ describe('useChildSegmentData', () => {expect(updateSegmentInCache).toHaveBeenCalledWith('seg-1', expect.any(Function))// Verify the updater function filters correctly- const updaterFn = updateSegmentInCache.mock.calls[0][1]+ const updaterFn = updateSegmentInCache.mock.calls[0]![1]const testSegment = createMockSegment({child_chunks: [createMockChildChunk({ id: 'child-1' }),@@ -499,7 +499,7 @@ describe('useChildSegmentData', () => {expect(updateSegmentInCache).toHaveBeenCalledWith('seg-1', expect.any(Function))// Verify the updater function maps correctly- const updaterFn = updateSegmentInCache.mock.calls[0][1]+ const updaterFn = updateSegmentInCache.mock.calls[0]![1]const testSegment = createMockSegment({child_chunks: [createMockChildChunk({ id: 'child-1', content: 'old content' }),@@ -564,8 +564,8 @@ describe('useChildSegmentData', () => {total: 2,total_pages: 1,}) as ChildSegmentsResponse- expect(resultWithData.data[0].content).toBe('new content')- expect(resultWithData.data[1].content).toBe('other')+ expect(resultWithData.data[0]!.content).toBe('new content')+ expect(resultWithData.data[1]!.content).toBe('other')}})diff --git a/web/app/components/datasets/documents/detail/completed/segment-list.tsx b/web/app/components/datasets/documents/detail/completed/segment-list.tsxindex 9e5f0ab2fee..3a554fc0b6a 100644--- a/web/app/components/datasets/documents/detail/completed/segment-list.tsx+++ b/web/app/components/datasets/documents/detail/completed/segment-list.tsx@@ -71,7 +71,7 @@ const SegmentList = (<div ref={ref} className="flex grow flex-col overflow-y-auto">{items.map((segItem) => {- const isLast = items[items.length - 1].id === segItem.id+ const isLast = items[items.length - 1]!.id === segItem.idconst segmentIndexFocused= currSegment?.segInfo?.id === segItem.id|| (!currSegment && currChildChunk?.childChunkInfo?.segment_id === segItem.id)diff --git a/web/app/components/datasets/documents/detail/embedding/hooks/__tests__/use-embedding-status.spec.tsx b/web/app/components/datasets/documents/detail/embedding/hooks/__tests__/use-embedding-status.spec.tsxindex 893484afeb6..149d0a60ea3 100644--- a/web/app/components/datasets/documents/detail/embedding/hooks/__tests__/use-embedding-status.spec.tsx+++ b/web/app/components/datasets/documents/detail/embedding/hooks/__tests__/use-embedding-status.spec.tsx@@ -342,7 +342,7 @@ describe('use-embedding-status', () => {await waitFor(() => {expect(onError).toHaveBeenCalled()- expect(onError.mock.calls[0][0]).toEqual(error)+ expect(onError.mock.calls[0]![0]).toEqual(error)})})})diff --git a/web/app/components/datasets/documents/detail/metadata/__tests__/index.spec.tsx b/web/app/components/datasets/documents/detail/metadata/__tests__/index.spec.tsxindex 2d60e5f322b..5b268e554cd 100644--- a/web/app/components/datasets/documents/detail/metadata/__tests__/index.spec.tsx+++ b/web/app/components/datasets/documents/detail/metadata/__tests__/index.spec.tsx@@ -181,24 +181,55 @@ describe('Metadata', () => {it('should render without crashing', () => {const { container } = render(<Metadata {...defaultProps} />)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})it('should render metadata title', () => {render(<Metadata {...defaultProps} />)- expect(screen.getByText(/metadata\.title/i)).toBeInTheDocument()+ expect(screen.getByText(/metadata\.title/i))!.toBeInTheDocument()})it('should render edit button', () => {render(<Metadata {...defaultProps} />)- expect(screen.getByText(/operation\.edit/i)).toBeInTheDocument()+ expect(screen.getByText(/operation\.edit/i))!.toBeInTheDocument()})it('should show loading state', () => {render(<Metadata {...defaultProps} loading={true} />)+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not+ // Assert - Loading component should be rendered, title should not// Assert - Loading component should be rendered, title should notexpect(screen.queryByText(/metadata\.title/i)).not.toBeInTheDocument()})@@ -206,7 +237,7 @@ describe('Metadata', () => {it('should display document type icon and text', () => {render(<Metadata {...defaultProps} />)- expect(screen.getByText('Book')).toBeInTheDocument()+ expect(screen.getByText('Book'))!.toBeInTheDocument()})})@@ -217,8 +248,8 @@ describe('Metadata', () => {fireEvent.click(screen.getByText(/operation\.edit/i))- expect(screen.getByText(/operation\.cancel/i)).toBeInTheDocument()- expect(screen.getByText(/operation\.save/i)).toBeInTheDocument()+ expect(screen.getByText(/operation\.cancel/i))!.toBeInTheDocument()+ expect(screen.getByText(/operation\.save/i))!.toBeInTheDocument()})it('should show change link in edit mode', () => {@@ -226,7 +257,7 @@ describe('Metadata', () => {fireEvent.click(screen.getByText(/operation\.edit/i))- expect(screen.getByText(/operation\.change/i)).toBeInTheDocument()+ expect(screen.getByText(/operation\.change/i))!.toBeInTheDocument()})it('should cancel edit and restore values when cancel is clicked', () => {@@ -238,7 +269,8 @@ describe('Metadata', () => {fireEvent.click(screen.getByText(/operation\.cancel/i))// Assert - should be back to view mode- expect(screen.getByText(/operation\.edit/i)).toBeInTheDocument()+ // Assert - should be back to view mode+ expect(screen.getByText(/operation\.edit/i))!.toBeInTheDocument()})it('should save metadata when save button is clicked', async () => {@@ -299,7 +331,7 @@ describe('Metadata', () => {render(<Metadata {...defaultProps} docDetail={docDetail} />)- expect(screen.getByText(/metadata\.docTypeSelectTitle/i)).toBeInTheDocument()+ expect(screen.getByText(/metadata\.docTypeSelectTitle/i))!.toBeInTheDocument()})it('should show description when no doc_type exists', () => {@@ -307,7 +339,7 @@ describe('Metadata', () => {render(<Metadata {...defaultProps} docDetail={docDetail} />)- expect(screen.getByText(/metadata\.desc/i)).toBeInTheDocument()+ expect(screen.getByText(/metadata\.desc/i))!.toBeInTheDocument()})it('should show change link in edit mode when doc_type exists', () => {@@ -316,7 +348,7 @@ describe('Metadata', () => {// Enter edit modefireEvent.click(screen.getByText(/operation\.edit/i))- expect(screen.getByText(/operation\.change/i)).toBeInTheDocument()+ expect(screen.getByText(/operation\.change/i))!.toBeInTheDocument()})it('should show doc type change title after clicking change', () => {@@ -327,7 +359,7 @@ describe('Metadata', () => {fireEvent.click(screen.getByText(/operation\.change/i))- expect(screen.getByText(/metadata\.docTypeChangeTitle/i)).toBeInTheDocument()+ expect(screen.getByText(/metadata\.docTypeChangeTitle/i))!.toBeInTheDocument()})})@@ -337,14 +369,15 @@ describe('Metadata', () => {render(<Metadata {...defaultProps} />)// Assert- expect(screen.getByText('Data Source Type')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('Data Source Type'))!.toBeInTheDocument()})it('should render technical parameters fields', () => {render(<Metadata {...defaultProps} />)- expect(screen.getByText('Segment Count')).toBeInTheDocument()- expect(screen.getByText('Hit Count')).toBeInTheDocument()+ expect(screen.getByText('Segment Count'))!.toBeInTheDocument()+ expect(screen.getByText('Hit Count'))!.toBeInTheDocument()})})@@ -355,27 +388,30 @@ describe('Metadata', () => {const { container } = render(<Metadata {...defaultProps} docDetail={docDetail} />)// Assert- expect(container.firstChild).toBeInTheDocument()+ // Assert+ expect(container.firstChild)!.toBeInTheDocument()})it('should handle undefined docDetail gracefully', () => {const { container } = render(<Metadata {...defaultProps} docDetail={undefined} loading={false} />)// Assert- expect(container.firstChild).toBeInTheDocument()+ // Assert+ expect(container.firstChild)!.toBeInTheDocument()})it('should update document type display when docDetail changes', () => {const { rerender } = render(<Metadata {...defaultProps} />)// Act - verify initial state shows Book- expect(screen.getByText('Book')).toBeInTheDocument()+ // Act - verify initial state shows Book+ expect(screen.getByText('Book'))!.toBeInTheDocument()// Update with new doc typeconst updatedDocDetail = createMockDocDetail({ doc_type: 'paper' })rerender(<Metadata {...defaultProps} docDetail={updatedDocDetail} />)- expect(screen.getByText('Paper')).toBeInTheDocument()+ expect(screen.getByText('Paper'))!.toBeInTheDocument()})})@@ -386,7 +422,7 @@ describe('Metadata', () => {render(<Metadata {...defaultProps} docDetail={docDetail} />)- expect(screen.getByText(/metadata\.firstMetaAction/i)).toBeInTheDocument()+ expect(screen.getByText(/metadata\.firstMetaAction/i))!.toBeInTheDocument()})})})@@ -407,19 +443,19 @@ describe('FieldInfo', () => {it('should render without crashing', () => {const { container } = render(<FieldInfo {...defaultFieldInfoProps} />)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})it('should render label', () => {render(<FieldInfo {...defaultFieldInfoProps} />)- expect(screen.getByText('Test Label')).toBeInTheDocument()+ expect(screen.getByText('Test Label'))!.toBeInTheDocument()})it('should render displayed value in view mode', () => {render(<FieldInfo {...defaultFieldInfoProps} showEdit={false} />)- expect(screen.getByText('Test Display Value')).toBeInTheDocument()+ expect(screen.getByText('Test Display Value'))!.toBeInTheDocument()})})@@ -428,7 +464,7 @@ describe('FieldInfo', () => {it('should render input when showEdit is true and inputType is input', () => {render(<FieldInfo {...defaultFieldInfoProps} showEdit={true} inputType="input" onUpdate={vi.fn()} />)- expect(screen.getByRole('textbox')).toBeInTheDocument()+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})it('should render select when showEdit is true and inputType is select', () => {@@ -443,13 +479,14 @@ describe('FieldInfo', () => {)// Assert - SimpleSelect should be rendered- expect(screen.getByRole('button')).toBeInTheDocument()+ // Assert - SimpleSelect should be rendered+ expect(screen.getByRole('button'))!.toBeInTheDocument()})it('should render textarea when showEdit is true and inputType is textarea', () => {render(<FieldInfo {...defaultFieldInfoProps} showEdit={true} inputType="textarea" onUpdate={vi.fn()} />)- expect(screen.getByRole('textbox')).toBeInTheDocument()+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})it('should call onUpdate when input value changes', () => {@@ -476,14 +513,14 @@ describe('FieldInfo', () => {it('should render value icon when provided', () => {render(<FieldInfo {...defaultFieldInfoProps} valueIcon={<span data-testid="value-icon">Icon</span>} />)- expect(screen.getByTestId('value-icon')).toBeInTheDocument()+ expect(screen.getByTestId('value-icon'))!.toBeInTheDocument()})it('should use defaultValue when provided', () => {render(<FieldInfo {...defaultFieldInfoProps} showEdit={true} inputType="input" defaultValue="Default" onUpdate={vi.fn()} />)const input = screen.getByRole('textbox')- expect(input).toHaveAttribute('placeholder')+ expect(input)!.toHaveAttribute('placeholder')})})})@@ -510,13 +547,15 @@ describe('useMetadataState coverage', () => {fireEvent.click(screen.getByText(/operation\.change/i))// Now in doc type selector mode — should show cancel button- expect(screen.getByText(/operation\.cancel/i)).toBeInTheDocument()+ // Now in doc type selector mode — should show cancel button+ expect(screen.getByText(/operation\.cancel/i))!.toBeInTheDocument()// Act — cancel the doc type changefireEvent.click(screen.getByText(/operation\.cancel/i))// Assert — should be back to edit mode (cancel + save buttons visible)- expect(screen.getByText(/operation\.save/i)).toBeInTheDocument()+ // Assert — should be back to edit mode (cancel + save buttons visible)+ expect(screen.getByText(/operation\.save/i))!.toBeInTheDocument()})})@@ -530,14 +569,16 @@ describe('useMetadataState coverage', () => {fireEvent.click(screen.getByText(/operation\.change/i))// DocTypeSelector shows save/cancel buttons- expect(screen.getByText(/metadata\.docTypeChangeTitle/i)).toBeInTheDocument()+ // DocTypeSelector shows save/cancel buttons+ expect(screen.getByText(/metadata\.docTypeChangeTitle/i))!.toBeInTheDocument()// Act — click save to confirm same doc type (tempDocType='book')fireEvent.click(screen.getByText(/operation\.save/i))// Assert — should return to edit mode with metadata fields visible- expect(screen.getByText(/operation\.cancel/i)).toBeInTheDocument()- expect(screen.getByText(/operation\.save/i)).toBeInTheDocument()+ // Assert — should return to edit mode with metadata fields visible+ expect(screen.getByText(/operation\.cancel/i))!.toBeInTheDocument()+ expect(screen.getByText(/operation\.save/i))!.toBeInTheDocument()})})@@ -551,17 +592,20 @@ describe('useMetadataState coverage', () => {// 'others' is normalized to '' → useEffect fires (doc_type truthy) → view mode// The rendered type uses default 'book' fallback for display- expect(screen.getByText(/operation\.edit/i)).toBeInTheDocument()+ // 'others' is normalized to '' → useEffect fires (doc_type truthy) → view mode+ // The rendered type uses default 'book' fallback for display+ expect(screen.getByText(/operation\.edit/i))!.toBeInTheDocument()// Enter edit modefireEvent.click(screen.getByText(/operation\.edit/i))- expect(screen.getByText(/operation\.cancel/i)).toBeInTheDocument()+ expect(screen.getByText(/operation\.cancel/i))!.toBeInTheDocument()// Act — cancel edit; internally docType is '' so cancelEdit goes to showDocTypesfireEvent.click(screen.getByText(/operation\.cancel/i))// Assert — should show doc type selection since normalized docType was ''- expect(screen.getByText(/metadata\.docTypeSelectTitle/i)).toBeInTheDocument()+ // Assert — should show doc type selection since normalized docType was ''+ expect(screen.getByText(/metadata\.docTypeSelectTitle/i))!.toBeInTheDocument()})})@@ -576,10 +620,11 @@ describe('useMetadataState coverage', () => {// Act — find an input and change its value (Title field)const inputs = screen.getAllByRole('textbox')expect(inputs.length).toBeGreaterThan(0)- fireEvent.change(inputs[0], { target: { value: 'Updated Title' } })+ fireEvent.change(inputs[0]!, { target: { value: 'Updated Title' } })// Assert — the input should have the new value- expect(inputs[0]).toHaveValue('Updated Title')+ // Assert — the input should have the new value+ expect(inputs[0])!.toHaveValue('Updated Title')})})@@ -629,7 +674,8 @@ describe('useMetadataState coverage', () => {)// Assert — should render without crashing, showing Paper type- expect(screen.getByText('Paper')).toBeInTheDocument()+ // Assert — should render without crashing, showing Paper type+ expect(screen.getByText('Paper'))!.toBeInTheDocument()})})})diff --git a/web/app/components/datasets/documents/detail/metadata/components/__tests__/metadata-field-list.spec.tsx b/web/app/components/datasets/documents/detail/metadata/components/__tests__/metadata-field-list.spec.tsxindex cc5b16fc3ed..9f07c06d770 100644--- a/web/app/components/datasets/documents/detail/metadata/components/__tests__/metadata-field-list.spec.tsx+++ b/web/app/components/datasets/documents/detail/metadata/components/__tests__/metadata-field-list.spec.tsx@@ -42,9 +42,9 @@ describe('MetadataFieldList', () => {/>,)- expect(screen.getByText('Title')).toBeInTheDocument()- expect(screen.getByText('Language')).toBeInTheDocument()- expect(screen.getByText('Author')).toBeInTheDocument()+ expect(screen.getByText('Title'))!.toBeInTheDocument()+ expect(screen.getByText('Language'))!.toBeInTheDocument()+ expect(screen.getByText('Author'))!.toBeInTheDocument()})it('should return null when mainField is empty', () => {@@ -76,7 +76,7 @@ describe('MetadataFieldList', () => {/>,)- expect(screen.getByText('English')).toBeInTheDocument()+ expect(screen.getByText('English'))!.toBeInTheDocument()})})@@ -109,7 +109,7 @@ describe('MetadataFieldList', () => {// Find the first textbox and type in itconst inputs = screen.getAllByRole('textbox')- fireEvent.change(inputs[0], { target: { value: 'New Title' } })+ fireEvent.change(inputs[0]!, { target: { value: 'New Title' } })expect(onUpdate).toHaveBeenCalled()})@@ -128,8 +128,8 @@ describe('MetadataFieldList', () => {/>,)- expect(screen.getByText('Source')).toBeInTheDocument()- expect(screen.getByText('Web')).toBeInTheDocument()+ expect(screen.getByText('Source'))!.toBeInTheDocument()+ expect(screen.getByText('Web'))!.toBeInTheDocument()})it('should render custom render function output for fields with render', () => {@@ -143,7 +143,7 @@ describe('MetadataFieldList', () => {/>,)- expect(screen.getByText('15 / 5')).toBeInTheDocument()+ expect(screen.getByText('15 / 5'))!.toBeInTheDocument()})})})diff --git a/web/app/components/datasets/documents/detail/metadata/components/metadata-field-list.tsx b/web/app/components/datasets/documents/detail/metadata/components/metadata-field-list.tsxindex 9f452279ed2..03af49359d9 100644--- a/web/app/components/datasets/documents/detail/metadata/components/metadata-field-list.tsx+++ b/web/app/components/datasets/documents/detail/metadata/components/metadata-field-list.tsx@@ -7,7 +7,7 @@ import { useBookCategories, useBusinessDocCategories, useLanguages, useMetadataMimport FieldInfo from './field-info'const map2Options = (map: Record<string, string>) => {- return Object.keys(map).map(key => ({ value: key, name: map[key] }))+ return Object.keys(map).map(key => ({ value: key, name: map[key]! }))}function useCategoryMapResolver(mainField: metadataType | '') {@@ -72,7 +72,7 @@ const MetadataFieldList: FC<MetadataFieldListProps> = ({{Object.keys(fieldMap).map(field => (<FieldInfokey={fieldMap[field]?.label}- label={fieldMap[field]?.label}+ label={fieldMap[field]?.label!}displayedValue={getDisplayValue(field)}value={get(sourceData, field, '')}inputType={fieldMap[field]?.inputType || 'input'}diff --git a/web/app/components/datasets/documents/hooks/__tests__/use-document-list-query-state.spec.tsx b/web/app/components/datasets/documents/hooks/__tests__/use-document-list-query-state.spec.tsxindex 5879e72782a..dda78bd068e 100644--- a/web/app/components/datasets/documents/hooks/__tests__/use-document-list-query-state.spec.tsx+++ b/web/app/components/datasets/documents/hooks/__tests__/use-document-list-query-state.spec.tsx@@ -164,7 +164,7 @@ describe('useDocumentListQueryState', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.get('page')).toBe('2')expect(update.options.history).toBe('push')})@@ -177,7 +177,7 @@ describe('useDocumentListQueryState', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.get('status')).toBe('error')})@@ -189,7 +189,7 @@ describe('useDocumentListQueryState', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.has('status')).toBe(false)})@@ -201,7 +201,7 @@ describe('useDocumentListQueryState', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.get('sort')).toBe('hit_count')})@@ -213,7 +213,7 @@ describe('useDocumentListQueryState', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.has('sort')).toBe(false)})@@ -225,7 +225,7 @@ describe('useDocumentListQueryState', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.get('keyword')).toBe('test query')expect(update.options.history).toBe('replace')})@@ -238,7 +238,7 @@ describe('useDocumentListQueryState', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.get('keyword')).toBe('hello')expect(update.searchParams.has('page')).toBe(false)expect(update.options.history).toBe('replace')@@ -252,7 +252,7 @@ describe('useDocumentListQueryState', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.has('keyword')).toBe(false)expect(update.options.history).toBe('replace')})@@ -265,7 +265,7 @@ describe('useDocumentListQueryState', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.has('keyword')).toBe(false)expect(result.current.query.keyword).toBe('')})@@ -278,7 +278,7 @@ describe('useDocumentListQueryState', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.get('keyword')).toBe('%2F')expect(result.current.query.keyword).toBe('%2F')})@@ -302,7 +302,7 @@ describe('useDocumentListQueryState', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.has('status')).toBe(false)})@@ -314,7 +314,7 @@ describe('useDocumentListQueryState', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.has('sort')).toBe(false)})@@ -326,7 +326,7 @@ describe('useDocumentListQueryState', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.has('page')).toBe(false)})@@ -338,7 +338,7 @@ describe('useDocumentListQueryState', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.get('page')).toBe('2')})@@ -350,7 +350,7 @@ describe('useDocumentListQueryState', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.get('limit')).toBe('25')})@@ -362,7 +362,7 @@ describe('useDocumentListQueryState', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.has('page')).toBe(false)expect(result.current.query.page).toBe(1)})@@ -375,7 +375,7 @@ describe('useDocumentListQueryState', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.has('limit')).toBe(false)expect(result.current.query.limit).toBe(10)})@@ -406,7 +406,7 @@ describe('useDocumentListQueryState', () => {})await waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.has('page')).toBe(false)expect(update.searchParams.has('status')).toBe(false)})diff --git a/web/app/components/datasets/external-api/external-api-modal/__tests__/index.spec.tsx b/web/app/components/datasets/external-api/external-api-modal/__tests__/index.spec.tsxindex 73579db413b..e24712887af 100644--- a/web/app/components/datasets/external-api/external-api-modal/__tests__/index.spec.tsx+++ b/web/app/components/datasets/external-api/external-api-modal/__tests__/index.spec.tsx@@ -46,42 +46,42 @@ describe('AddExternalAPIModal', () => {describe('Rendering', () => {it('should render without crashing', () => {render(<AddExternalAPIModal {...defaultProps} />)- expect(screen.getByText('dataset.createExternalAPI')).toBeInTheDocument()+ expect(screen.getByText('dataset.createExternalAPI'))!.toBeInTheDocument()})it('should render create title when not in edit mode', () => {render(<AddExternalAPIModal {...defaultProps} isEditMode={false} />)- expect(screen.getByText('dataset.createExternalAPI')).toBeInTheDocument()+ expect(screen.getByText('dataset.createExternalAPI'))!.toBeInTheDocument()})it('should render edit title when in edit mode', () => {render(<AddExternalAPIModal {...defaultProps} isEditMode={true} data={initialData} />)- expect(screen.getByText('dataset.editExternalAPIFormTitle')).toBeInTheDocument()+ expect(screen.getByText('dataset.editExternalAPIFormTitle'))!.toBeInTheDocument()})it('should render form fields', () => {render(<AddExternalAPIModal {...defaultProps} />)- expect(screen.getByLabelText(/name/i)).toBeInTheDocument()- expect(screen.getByLabelText(/api endpoint/i)).toBeInTheDocument()- expect(screen.getByLabelText(/api key/i)).toBeInTheDocument()+ expect(screen.getByLabelText(/name/i))!.toBeInTheDocument()+ expect(screen.getByLabelText(/api endpoint/i))!.toBeInTheDocument()+ expect(screen.getByLabelText(/api key/i))!.toBeInTheDocument()})it('should render cancel and save buttons', () => {render(<AddExternalAPIModal {...defaultProps} />)- expect(screen.getByText('dataset.externalAPIForm.cancel')).toBeInTheDocument()- expect(screen.getByText('dataset.externalAPIForm.save')).toBeInTheDocument()+ expect(screen.getByText('dataset.externalAPIForm.cancel'))!.toBeInTheDocument()+ expect(screen.getByText('dataset.externalAPIForm.save'))!.toBeInTheDocument()})it('should render encryption notice', () => {render(<AddExternalAPIModal {...defaultProps} />)- expect(screen.getByText('PKCS1_OAEP')).toBeInTheDocument()+ expect(screen.getByText('PKCS1_OAEP'))!.toBeInTheDocument()})it('should render close button', () => {render(<AddExternalAPIModal {...defaultProps} />)// Close button is rendered in a portalconst closeButton = document.body.querySelector('.action-btn')- expect(closeButton).toBeInTheDocument()+ expect(closeButton)!.toBeInTheDocument()})})@@ -99,7 +99,7 @@ describe('AddExternalAPIModal', () => {datasetBindings={datasetBindings}/>,)- expect(screen.getByText('dataset.editExternalAPIFormWarning.front')).toBeInTheDocument()+ expect(screen.getByText('dataset.editExternalAPIFormWarning.front'))!.toBeInTheDocument()// Verify the count is displayed in the warning sectionconst warningElement = screen.getByText('dataset.editExternalAPIFormWarning.front').parentElementexpect(warningElement?.textContent).toContain('2')@@ -124,22 +124,22 @@ describe('AddExternalAPIModal', () => {const nameInput = screen.getByLabelText(/name/i)fireEvent.change(nameInput, { target: { value: 'New API Name' } })- expect(nameInput).toHaveValue('New API Name')+ expect(nameInput)!.toHaveValue('New API Name')})it('should initialize form with data in edit mode', () => {render(<AddExternalAPIModal {...defaultProps} isEditMode={true} data={initialData} />)- expect(screen.getByLabelText(/name/i)).toHaveValue('Test API')- expect(screen.getByLabelText(/api endpoint/i)).toHaveValue('https://api.example.com')- expect(screen.getByLabelText(/api key/i)).toHaveValue('test-key-12345')+ expect(screen.getByLabelText(/name/i))!.toHaveValue('Test API')+ expect(screen.getByLabelText(/api endpoint/i))!.toHaveValue('https://api.example.com')+ expect(screen.getByLabelText(/api key/i))!.toHaveValue('test-key-12345')})it('should disable save button when form has empty inputs', () => {render(<AddExternalAPIModal {...defaultProps} />)const saveButton = screen.getByText('dataset.externalAPIForm.save').closest('button')- expect(saveButton).toBeDisabled()+ expect(saveButton)!.toBeDisabled()})it('should enable save button when all fields are filled', () => {@@ -302,7 +302,7 @@ describe('AddExternalAPIModal', () => {fireEvent.click(saveButton)await waitFor(() => {- expect(screen.getByRole('button', { name: /confirm/i })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: /confirm/i }))!.toBeInTheDocument()})})@@ -334,7 +334,7 @@ describe('AddExternalAPIModal', () => {fireEvent.click(saveButton)await waitFor(() => {- expect(screen.getByRole('button', { name: /confirm/i })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: /confirm/i }))!.toBeInTheDocument()})const confirmButton = screen.getByRole('button', { name: /confirm/i })@@ -363,13 +363,13 @@ describe('AddExternalAPIModal', () => {fireEvent.click(saveButton)await waitFor(() => {- expect(screen.getByRole('button', { name: /confirm/i })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: /confirm/i }))!.toBeInTheDocument()})// There are multiple cancel buttons, find the one in the confirm dialogconst cancelButtons = screen.getAllByRole('button', { name: /cancel/i })const confirmDialogCancelButton = cancelButtons[cancelButtons.length - 1]- fireEvent.click(confirmDialogCancelButton)+ fireEvent.click(confirmDialogCancelButton!)await waitFor(() => {// Confirm button should be gone after canceling@@ -404,7 +404,7 @@ describe('AddExternalAPIModal', () => {describe('Edge Cases', () => {it('should handle undefined data in edit mode', () => {render(<AddExternalAPIModal {...defaultProps} isEditMode={true} data={undefined} />)- expect(screen.getByLabelText(/name/i)).toHaveValue('')+ expect(screen.getByLabelText(/name/i))!.toHaveValue('')})it('should handle null datasetBindings', () => {@@ -422,8 +422,8 @@ describe('AddExternalAPIModal', () => {it('should render documentation link in encryption notice', () => {render(<AddExternalAPIModal {...defaultProps} />)const link = screen.getByRole('link', { name: 'PKCS1_OAEP' })- expect(link).toHaveAttribute('href', 'https://pycryptodome.readthedocs.io/en/latest/src/cipher/oaep.html')- expect(link).toHaveAttribute('target', '_blank')+ expect(link)!.toHaveAttribute('href', 'https://pycryptodome.readthedocs.io/en/latest/src/cipher/oaep.html')+ expect(link)!.toHaveAttribute('target', '_blank')})})})diff --git a/web/app/components/datasets/external-api/external-api-panel/__tests__/index.spec.tsx b/web/app/components/datasets/external-api/external-api-panel/__tests__/index.spec.tsxindex eb7c0558aca..964b8fe3443 100644--- a/web/app/components/datasets/external-api/external-api-panel/__tests__/index.spec.tsx+++ b/web/app/components/datasets/external-api/external-api-panel/__tests__/index.spec.tsx@@ -50,31 +50,31 @@ describe('ExternalAPIPanel', () => {describe('Rendering', () => {it('should render without crashing', () => {render(<ExternalAPIPanel {...defaultProps} />)- expect(screen.getByText('dataset.externalAPIPanelTitle')).toBeInTheDocument()+ expect(screen.getByText('dataset.externalAPIPanelTitle'))!.toBeInTheDocument()})it('should render panel title and description', () => {render(<ExternalAPIPanel {...defaultProps} />)- expect(screen.getByText('dataset.externalAPIPanelTitle')).toBeInTheDocument()- expect(screen.getByText('dataset.externalAPIPanelDescription')).toBeInTheDocument()+ expect(screen.getByText('dataset.externalAPIPanelTitle'))!.toBeInTheDocument()+ expect(screen.getByText('dataset.externalAPIPanelDescription'))!.toBeInTheDocument()})it('should render documentation link', () => {render(<ExternalAPIPanel {...defaultProps} />)const docLink = screen.getByText('dataset.externalAPIPanelDocumentation')- expect(docLink).toBeInTheDocument()- expect(docLink.closest('a')).toHaveAttribute('href', 'https://docs.example.com/use-dify/knowledge/external-knowledge-api')+ expect(docLink)!.toBeInTheDocument()+ expect(docLink.closest('a'))!.toHaveAttribute('href', 'https://docs.example.com/use-dify/knowledge/external-knowledge-api')})it('should render create button', () => {render(<ExternalAPIPanel {...defaultProps} />)- expect(screen.getByText('dataset.createExternalAPI')).toBeInTheDocument()+ expect(screen.getByText('dataset.createExternalAPI'))!.toBeInTheDocument()})it('should render close button', () => {const { container } = render(<ExternalAPIPanel {...defaultProps} />)const closeButton = container.querySelector('[class*="action-button"]') || screen.getAllByRole('button')[0]- expect(closeButton).toBeInTheDocument()+ expect(closeButton)!.toBeInTheDocument()})})@@ -121,10 +121,10 @@ describe('ExternalAPIPanel', () => {},]render(<ExternalAPIPanel {...defaultProps} />)- expect(screen.getByTestId('api-card-api-1')).toBeInTheDocument()- expect(screen.getByTestId('api-card-api-2')).toBeInTheDocument()- expect(screen.getByText('Test API 1')).toBeInTheDocument()- expect(screen.getByText('Test API 2')).toBeInTheDocument()+ expect(screen.getByTestId('api-card-api-1'))!.toBeInTheDocument()+ expect(screen.getByTestId('api-card-api-2'))!.toBeInTheDocument()+ expect(screen.getByText('Test API 1'))!.toBeInTheDocument()+ expect(screen.getByText('Test API 2'))!.toBeInTheDocument()})})@@ -136,7 +136,7 @@ describe('ExternalAPIPanel', () => {const buttons = screen.getAllByRole('button')const closeButton = buttons.find(btn => btn.querySelector('svg[class*="ri-close"]'))|| buttons[0]- fireEvent.click(closeButton)+ fireEvent.click(closeButton!)expect(onClose).toHaveBeenCalledTimes(1)})@@ -162,7 +162,7 @@ describe('ExternalAPIPanel', () => {const createButton = screen.getByText('dataset.createExternalAPI').closest('button')!fireEvent.click(createButton)- const callArgs = mockSetShowExternalKnowledgeAPIModal.mock.calls[0][0]+ const callArgs = mockSetShowExternalKnowledgeAPIModal.mock.calls[0]![0]callArgs.onSaveCallback()expect(mockMutateExternalKnowledgeApis).toHaveBeenCalled()@@ -173,7 +173,7 @@ describe('ExternalAPIPanel', () => {const createButton = screen.getByText('dataset.createExternalAPI').closest('button')!fireEvent.click(createButton)- const callArgs = mockSetShowExternalKnowledgeAPIModal.mock.calls[0][0]+ const callArgs = mockSetShowExternalKnowledgeAPIModal.mock.calls[0]![0]callArgs.onCancelCallback()expect(mockMutateExternalKnowledgeApis).toHaveBeenCalled()@@ -195,13 +195,13 @@ describe('ExternalAPIPanel', () => {},]render(<ExternalAPIPanel {...defaultProps} />)- expect(screen.getByTestId('api-card-single-api')).toBeInTheDocument()+ expect(screen.getByTestId('api-card-single-api'))!.toBeInTheDocument()})it('should render documentation link with correct target', () => {render(<ExternalAPIPanel {...defaultProps} />)const docLink = screen.getByText('dataset.externalAPIPanelDocumentation').closest('a')- expect(docLink).toHaveAttribute('target', '_blank')+ expect(docLink)!.toHaveAttribute('target', '_blank')})})})diff --git a/web/app/components/datasets/external-api/external-knowledge-api-card/__tests__/index.spec.tsx b/web/app/components/datasets/external-api/external-knowledge-api-card/__tests__/index.spec.tsxindex bc1c923876a..6dfd8ff13d1 100644--- a/web/app/components/datasets/external-api/external-knowledge-api-card/__tests__/index.spec.tsx+++ b/web/app/components/datasets/external-api/external-knowledge-api-card/__tests__/index.spec.tsx@@ -56,17 +56,17 @@ describe('ExternalKnowledgeAPICard', () => {describe('Rendering', () => {it('should render without crashing', () => {render(<ExternalKnowledgeAPICard {...defaultProps} />)- expect(screen.getByText('Test External API')).toBeInTheDocument()+ expect(screen.getByText('Test External API'))!.toBeInTheDocument()})it('should render API name', () => {render(<ExternalKnowledgeAPICard {...defaultProps} />)- expect(screen.getByText('Test External API')).toBeInTheDocument()+ expect(screen.getByText('Test External API'))!.toBeInTheDocument()})it('should render API endpoint', () => {render(<ExternalKnowledgeAPICard {...defaultProps} />)- expect(screen.getByText('https://api.example.com/knowledge')).toBeInTheDocument()+ expect(screen.getByText('https://api.example.com/knowledge'))!.toBeInTheDocument()})it('should render edit and delete buttons', () => {@@ -78,7 +78,7 @@ describe('ExternalKnowledgeAPICard', () => {it('should render API connection icon', () => {const { container } = render(<ExternalKnowledgeAPICard {...defaultProps} />)const icon = container.querySelector('svg')- expect(icon).toBeInTheDocument()+ expect(icon)!.toBeInTheDocument()})})@@ -103,7 +103,7 @@ describe('ExternalKnowledgeAPICard', () => {const buttons = container.querySelectorAll('button')const editButton = buttons[0]- fireEvent.click(editButton)+ fireEvent.click(editButton!)await waitFor(() => {expect(fetchExternalAPI).toHaveBeenCalledWith({ apiTemplateId: 'api-123' })@@ -131,7 +131,7 @@ describe('ExternalKnowledgeAPICard', () => {const buttons = container.querySelectorAll('button')const editButton = buttons[0]- fireEvent.click(editButton)+ fireEvent.click(editButton!)await waitFor(() => {expect(consoleSpy).toHaveBeenCalledWith(@@ -162,14 +162,14 @@ describe('ExternalKnowledgeAPICard', () => {const { container } = render(<ExternalKnowledgeAPICard {...defaultProps} />)const editButton = container.querySelectorAll('button')[0]- fireEvent.click(editButton)+ fireEvent.click(editButton!)await waitFor(() => {expect(mockSetShowExternalKnowledgeAPIModal).toHaveBeenCalled()})// Simulate save callback- const modalCall = mockSetShowExternalKnowledgeAPIModal.mock.calls[0][0]+ const modalCall = mockSetShowExternalKnowledgeAPIModal.mock.calls[0]![0]modalCall.onSaveCallback()expect(mockMutateExternalKnowledgeApis).toHaveBeenCalled()@@ -194,14 +194,14 @@ describe('ExternalKnowledgeAPICard', () => {const { container } = render(<ExternalKnowledgeAPICard {...defaultProps} />)const editButton = container.querySelectorAll('button')[0]- fireEvent.click(editButton)+ fireEvent.click(editButton!)await waitFor(() => {expect(mockSetShowExternalKnowledgeAPIModal).toHaveBeenCalled()})// Simulate cancel callback- const modalCall = mockSetShowExternalKnowledgeAPIModal.mock.calls[0][0]+ const modalCall = mockSetShowExternalKnowledgeAPIModal.mock.calls[0]![0]modalCall.onCancelCallback()expect(mockMutateExternalKnowledgeApis).toHaveBeenCalled()@@ -216,7 +216,7 @@ describe('ExternalKnowledgeAPICard', () => {const buttons = container.querySelectorAll('button')const deleteButton = buttons[1]- fireEvent.click(deleteButton)+ fireEvent.click(deleteButton!)await waitFor(() => {expect(checkUsageExternalAPI).toHaveBeenCalledWith({ apiTemplateId: 'api-123' })@@ -224,7 +224,7 @@ describe('ExternalKnowledgeAPICard', () => {// Confirm dialog should be shownawait waitFor(() => {- expect(screen.getByRole('button', { name: /cancel/i })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: /cancel/i }))!.toBeInTheDocument()})})@@ -234,10 +234,10 @@ describe('ExternalKnowledgeAPICard', () => {const { container } = render(<ExternalKnowledgeAPICard {...defaultProps} />)const deleteButton = container.querySelectorAll('button')[1]- fireEvent.click(deleteButton)+ fireEvent.click(deleteButton!)await waitFor(() => {- expect(screen.getByText(/3/)).toBeInTheDocument()+ expect(screen.getByText(/3/))!.toBeInTheDocument()})})@@ -248,10 +248,10 @@ describe('ExternalKnowledgeAPICard', () => {const { container } = render(<ExternalKnowledgeAPICard {...defaultProps} />)const deleteButton = container.querySelectorAll('button')[1]- fireEvent.click(deleteButton)+ fireEvent.click(deleteButton!)await waitFor(() => {- expect(screen.getByRole('button', { name: /confirm/i })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: /confirm/i }))!.toBeInTheDocument()})const confirmButton = screen.getByRole('button', { name: /confirm/i })@@ -269,10 +269,10 @@ describe('ExternalKnowledgeAPICard', () => {const { container } = render(<ExternalKnowledgeAPICard {...defaultProps} />)const deleteButton = container.querySelectorAll('button')[1]- fireEvent.click(deleteButton)+ fireEvent.click(deleteButton!)await waitFor(() => {- expect(screen.getByRole('button', { name: /cancel/i })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: /cancel/i }))!.toBeInTheDocument()})const cancelButton = screen.getByRole('button', { name: /cancel/i })@@ -291,10 +291,10 @@ describe('ExternalKnowledgeAPICard', () => {const { container } = render(<ExternalKnowledgeAPICard {...defaultProps} />)const deleteButton = container.querySelectorAll('button')[1]- fireEvent.click(deleteButton)+ fireEvent.click(deleteButton!)await waitFor(() => {- expect(screen.getByRole('button', { name: /confirm/i })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: /confirm/i }))!.toBeInTheDocument()})const confirmButton = screen.getByRole('button', { name: /confirm/i })@@ -317,7 +317,7 @@ describe('ExternalKnowledgeAPICard', () => {const { container } = render(<ExternalKnowledgeAPICard {...defaultProps} />)const deleteButton = container.querySelectorAll('button')[1]- fireEvent.click(deleteButton)+ fireEvent.click(deleteButton!)await waitFor(() => {expect(consoleSpy).toHaveBeenCalledWith(@@ -336,11 +336,11 @@ describe('ExternalKnowledgeAPICard', () => {const deleteButton = container.querySelectorAll('button')[1]const cardContainer = container.querySelector('[class*="shadows-shadow"]')- fireEvent.mouseEnter(deleteButton)- expect(cardContainer).toHaveClass('border-state-destructive-border')- expect(cardContainer).toHaveClass('bg-state-destructive-hover')+ fireEvent.mouseEnter(deleteButton!)+ expect(cardContainer)!.toHaveClass('border-state-destructive-border')+ expect(cardContainer)!.toHaveClass('bg-state-destructive-hover')- fireEvent.mouseLeave(deleteButton)+ fireEvent.mouseLeave(deleteButton!)expect(cardContainer).not.toHaveClass('border-state-destructive-border')})})@@ -352,7 +352,7 @@ describe('ExternalKnowledgeAPICard', () => {settings: { endpoint: '', api_key: 'key' },}render(<ExternalKnowledgeAPICard api={apiWithEmptyEndpoint} />)- expect(screen.getByText('Test External API')).toBeInTheDocument()+ expect(screen.getByText('Test External API'))!.toBeInTheDocument()})it('should handle delete response with unsuccessful result', async () => {@@ -363,10 +363,10 @@ describe('ExternalKnowledgeAPICard', () => {const { container } = render(<ExternalKnowledgeAPICard {...defaultProps} />)const deleteButton = container.querySelectorAll('button')[1]- fireEvent.click(deleteButton)+ fireEvent.click(deleteButton!)await waitFor(() => {- expect(screen.getByRole('button', { name: /confirm/i })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: /confirm/i }))!.toBeInTheDocument()})const confirmButton = screen.getByRole('button', { name: /confirm/i })diff --git a/web/app/components/datasets/external-knowledge-base/create/ExternalApiSelection.tsx b/web/app/components/datasets/external-knowledge-base/create/ExternalApiSelection.tsxindex 387bf9843c0..fea71a7e788 100644--- a/web/app/components/datasets/external-knowledge-base/create/ExternalApiSelection.tsx+++ b/web/app/components/datasets/external-knowledge-base/create/ExternalApiSelection.tsx@@ -33,7 +33,7 @@ const ExternalApiSelection: React.FC<ExternalApiSelectionProps> = ({ external_knuseEffect(() => {if (apiItems.length > 0) {- const newSelectedId = external_knowledge_api_id || apiItems[0].value+ const newSelectedId = external_knowledge_api_id || apiItems[0]!.valuesetSelectedApiId(newSelectedId)if (newSelectedId !== external_knowledge_api_id)onChange({ external_knowledge_api_id: newSelectedId, external_knowledge_id })@@ -56,7 +56,7 @@ const ExternalApiSelection: React.FC<ExternalApiSelectionProps> = ({ external_knuseEffect(() => {if (!external_knowledge_api_id && apiItems.length > 0)- onChange({ external_knowledge_api_id: apiItems[0].value, external_knowledge_id })+ onChange({ external_knowledge_api_id: apiItems[0]!.value, external_knowledge_id })}, [])return (diff --git a/web/app/components/datasets/external-knowledge-base/create/__tests__/index.spec.tsx b/web/app/components/datasets/external-knowledge-base/create/__tests__/index.spec.tsxindex a3282e441c8..f132def6023 100644--- a/web/app/components/datasets/external-knowledge-base/create/__tests__/index.spec.tsx+++ b/web/app/components/datasets/external-knowledge-base/create/__tests__/index.spec.tsx@@ -90,64 +90,68 @@ describe('ExternalKnowledgeBaseCreate', () => {it('should render without crashing', () => {renderComponent()- expect(screen.getByText('dataset.connectDataset')).toBeInTheDocument()+ expect(screen.getByText('dataset.connectDataset'))!.toBeInTheDocument()})it('should render KnowledgeBaseInfo component with correct labels', () => {renderComponent()// KnowledgeBaseInfo renders these labels- expect(screen.getByText('dataset.externalKnowledgeName')).toBeInTheDocument()- expect(screen.getByText('dataset.externalKnowledgeDescription')).toBeInTheDocument()+ // KnowledgeBaseInfo renders these labels+ expect(screen.getByText('dataset.externalKnowledgeName'))!.toBeInTheDocument()+ expect(screen.getByText('dataset.externalKnowledgeDescription'))!.toBeInTheDocument()})it('should render ExternalApiSelection component', () => {renderComponent()// ExternalApiSelection renders this label- expect(screen.getByText('dataset.externalAPIPanelTitle')).toBeInTheDocument()- expect(screen.getByText('dataset.externalKnowledgeId')).toBeInTheDocument()+ // ExternalApiSelection renders this label+ expect(screen.getByText('dataset.externalAPIPanelTitle'))!.toBeInTheDocument()+ expect(screen.getByText('dataset.externalKnowledgeId'))!.toBeInTheDocument()})it('should render RetrievalSettings component', () => {renderComponent()// RetrievalSettings renders this label- expect(screen.getByText('dataset.retrievalSettings')).toBeInTheDocument()+ // RetrievalSettings renders this label+ expect(screen.getByText('dataset.retrievalSettings'))!.toBeInTheDocument()})it('should render InfoPanel component', () => {renderComponent()// InfoPanel renders these texts- expect(screen.getByText('dataset.connectDatasetIntro.title')).toBeInTheDocument()- expect(screen.getByText('dataset.connectDatasetIntro.learnMore')).toBeInTheDocument()+ // InfoPanel renders these texts+ expect(screen.getByText('dataset.connectDatasetIntro.title'))!.toBeInTheDocument()+ expect(screen.getByText('dataset.connectDatasetIntro.learnMore'))!.toBeInTheDocument()})it('should render helper text with translation keys', () => {renderComponent()- expect(screen.getByText('dataset.connectHelper.helper1')).toBeInTheDocument()- expect(screen.getByText('dataset.connectHelper.helper2')).toBeInTheDocument()- expect(screen.getByText('dataset.connectHelper.helper3')).toBeInTheDocument()- expect(screen.getByText('dataset.connectHelper.helper4')).toBeInTheDocument()- expect(screen.getByText('dataset.connectHelper.helper5')).toBeInTheDocument()+ expect(screen.getByText('dataset.connectHelper.helper1'))!.toBeInTheDocument()+ expect(screen.getByText('dataset.connectHelper.helper2'))!.toBeInTheDocument()+ expect(screen.getByText('dataset.connectHelper.helper3'))!.toBeInTheDocument()+ expect(screen.getByText('dataset.connectHelper.helper4'))!.toBeInTheDocument()+ expect(screen.getByText('dataset.connectHelper.helper5'))!.toBeInTheDocument()})it('should render cancel and connect buttons', () => {renderComponent()- expect(screen.getByText('dataset.externalKnowledgeForm.cancel')).toBeInTheDocument()- expect(screen.getByText('dataset.externalKnowledgeForm.connect')).toBeInTheDocument()+ expect(screen.getByText('dataset.externalKnowledgeForm.cancel'))!.toBeInTheDocument()+ expect(screen.getByText('dataset.externalKnowledgeForm.connect'))!.toBeInTheDocument()})it('should render documentation link with correct href', () => {renderComponent()const docLink = screen.getByText('dataset.connectHelper.helper4')- expect(docLink).toHaveAttribute('href', 'https://docs.dify.ai/en/use-dify/knowledge/connect-external-knowledge-base')- expect(docLink).toHaveAttribute('target', '_blank')- expect(docLink).toHaveAttribute('rel', 'noopener noreferrer')+ expect(docLink)!.toHaveAttribute('href', 'https://docs.dify.ai/en/use-dify/knowledge/connect-external-knowledge-base')+ expect(docLink)!.toHaveAttribute('target', '_blank')+ expect(docLink)!.toHaveAttribute('rel', 'noopener noreferrer')})})@@ -157,7 +161,7 @@ describe('ExternalKnowledgeBaseCreate', () => {renderComponent({ loading: true })const connectButton = screen.getByText('dataset.externalKnowledgeForm.connect').closest('button')- expect(connectButton).toBeInTheDocument()+ expect(connectButton)!.toBeInTheDocument()})it('should call onConnect with form data when connect button is clicked', async () => {@@ -198,7 +202,7 @@ describe('ExternalKnowledgeBaseCreate', () => {renderComponent({ onConnect })const connectButton = screen.getByText('dataset.externalKnowledgeForm.connect').closest('button')- expect(connectButton).toBeDisabled()+ expect(connectButton)!.toBeDisabled()await user.click(connectButton!)expect(onConnect).not.toHaveBeenCalled()@@ -280,7 +284,7 @@ describe('ExternalKnowledgeBaseCreate', () => {fireEvent.change(knowledgeIdInput, { target: { value: 'knowledge-456' } })const connectButton = screen.getByText('dataset.externalKnowledgeForm.connect').closest('button')- expect(connectButton).toBeDisabled()+ expect(connectButton)!.toBeDisabled()})it('should disable connect button when name is only whitespace', async () => {@@ -293,7 +297,7 @@ describe('ExternalKnowledgeBaseCreate', () => {fireEvent.change(knowledgeIdInput, { target: { value: 'knowledge-456' } })const connectButton = screen.getByText('dataset.externalKnowledgeForm.connect').closest('button')- expect(connectButton).toBeDisabled()+ expect(connectButton)!.toBeDisabled()})it('should disable connect button when external_knowledge_id is empty', () => {@@ -303,7 +307,7 @@ describe('ExternalKnowledgeBaseCreate', () => {fireEvent.change(nameInput, { target: { value: 'Test Name' } })const connectButton = screen.getByText('dataset.externalKnowledgeForm.connect').closest('button')- expect(connectButton).toBeDisabled()+ expect(connectButton)!.toBeDisabled()})it('should enable connect button when all required fields are filled', async () => {@@ -429,7 +433,8 @@ describe('ExternalKnowledgeBaseCreate', () => {renderComponent()// The ExternalApiSelect should show the first selected API name- expect(screen.getByText('Test API 1')).toBeInTheDocument()+ // The ExternalApiSelect should show the first selected API name+ expect(screen.getByText('Test API 1'))!.toBeInTheDocument()})it('should allow selecting different API from dropdown', async () => {@@ -473,7 +478,8 @@ describe('ExternalKnowledgeBaseCreate', () => {renderComponent()// Should show "no external knowledge" button- expect(screen.getByText('dataset.noExternalKnowledge')).toBeInTheDocument()+ // Should show "no external knowledge" button+ expect(screen.getByText('dataset.noExternalKnowledge'))!.toBeInTheDocument()})it('should open add API modal when add button is clicked', async () => {@@ -504,7 +510,7 @@ describe('ExternalKnowledgeBaseCreate', () => {await user.click(addButton!)// Get the callback and invoke it- const modalCall = mockSetShowExternalKnowledgeAPIModal.mock.calls[0][0]+ const modalCall = mockSetShowExternalKnowledgeAPIModal.mock.calls[0]![0]await modalCall.onSaveCallback()expect(mockMutateExternalKnowledgeApis).toHaveBeenCalled()@@ -521,7 +527,7 @@ describe('ExternalKnowledgeBaseCreate', () => {await user.click(addButton!)// Get the callback and invoke it- const modalCall = mockSetShowExternalKnowledgeAPIModal.mock.calls[0][0]+ const modalCall = mockSetShowExternalKnowledgeAPIModal.mock.calls[0]![0]modalCall.onCancelCallback()expect(mockMutateExternalKnowledgeApis).toHaveBeenCalled()@@ -535,8 +541,9 @@ describe('ExternalKnowledgeBaseCreate', () => {await user.click(apiSelector)// Should show API URLs- expect(screen.getByText('https://api1.example.com')).toBeInTheDocument()- expect(screen.getByText('https://api2.example.com')).toBeInTheDocument()+ // Should show API URLs+ expect(screen.getByText('https://api1.example.com'))!.toBeInTheDocument()+ expect(screen.getByText('https://api2.example.com'))!.toBeInTheDocument()})it('should show create new API option in dropdown', async () => {@@ -547,7 +554,8 @@ describe('ExternalKnowledgeBaseCreate', () => {await user.click(apiSelector)// Should show create new API option- expect(screen.getByText('dataset.createNewExternalAPI')).toBeInTheDocument()+ // Should show create new API option+ expect(screen.getByText('dataset.createNewExternalAPI'))!.toBeInTheDocument()})it('should open add API modal when clicking create new API in dropdown', async () => {@@ -580,7 +588,7 @@ describe('ExternalKnowledgeBaseCreate', () => {await user.click(createNewApiOption)// Get the callback from the modal call and invoke it- const modalCall = mockSetShowExternalKnowledgeAPIModal.mock.calls[0][0]+ const modalCall = mockSetShowExternalKnowledgeAPIModal.mock.calls[0]![0]await modalCall.onSaveCallback()expect(mockMutateExternalKnowledgeApis).toHaveBeenCalled()@@ -598,7 +606,7 @@ describe('ExternalKnowledgeBaseCreate', () => {await user.click(createNewApiOption)// Get the callback from the modal call and invoke it- const modalCall = mockSetShowExternalKnowledgeAPIModal.mock.calls[0][0]+ const modalCall = mockSetShowExternalKnowledgeAPIModal.mock.calls[0]![0]modalCall.onCancelCallback()expect(mockMutateExternalKnowledgeApis).toHaveBeenCalled()@@ -612,12 +620,44 @@ describe('ExternalKnowledgeBaseCreate', () => {await user.click(apiSelector)// Dropdown should be open - API URLs visible- expect(screen.getByText('https://api1.example.com')).toBeInTheDocument()+ // Dropdown should be open - API URLs visible+ expect(screen.getByText('https://api1.example.com'))!.toBeInTheDocument()// Select the second APIconst secondApi = screen.getByText('Test API 2')await user.click(secondApi)+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible+ // Dropdown should be closed - API URLs not visible// Dropdown should be closed - API URLs not visibleexpect(screen.queryByText('https://api1.example.com')).not.toBeInTheDocument()})@@ -628,7 +668,7 @@ describe('ExternalKnowledgeBaseCreate', () => {const apiSelector = screen.getByText('Test API 1')await user.click(apiSelector)- expect(screen.getByText('https://api1.example.com')).toBeInTheDocument()+ expect(screen.getByText('https://api1.example.com'))!.toBeInTheDocument()await user.click(apiSelector)expect(screen.queryByText('https://api1.example.com')).not.toBeInTheDocument()@@ -783,14 +823,14 @@ describe('ExternalKnowledgeBaseCreate', () => {renderComponent({ loading: true })const connectButton = screen.getByText('dataset.externalKnowledgeForm.connect').closest('button')- expect(connectButton).toBeInTheDocument()+ expect(connectButton)!.toBeInTheDocument()})it('should render correctly when not loading', () => {renderComponent({ loading: false })const connectButton = screen.getByText('dataset.externalKnowledgeForm.connect').closest('button')- expect(connectButton).toBeInTheDocument()+ expect(connectButton)!.toBeInTheDocument()})})@@ -804,7 +844,7 @@ describe('ExternalKnowledgeBaseCreate', () => {// Find and click the switch for score thresholdconst switches = screen.getAllByRole('switch')const scoreThresholdSwitch = switches[0] // The score threshold switch- await user.click(scoreThresholdSwitch)+ await user.click(scoreThresholdSwitch!)// Fill required fieldsconst nameInput = screen.getByPlaceholderText('dataset.externalKnowledgeNamePlaceholder')@@ -834,10 +874,12 @@ describe('ExternalKnowledgeBaseCreate', () => {renderComponent()// Should show the retrieval settings section title- expect(screen.getByText('dataset.retrievalSettings')).toBeInTheDocument()+ // Should show the retrieval settings section title+ expect(screen.getByText('dataset.retrievalSettings'))!.toBeInTheDocument()+ // Should show Top K and Score Threshold labels// Should show Top K and Score Threshold labels- expect(screen.getByText('appDebug.datasetConfig.top_k')).toBeInTheDocument()- expect(screen.getByText('appDebug.datasetConfig.score_threshold')).toBeInTheDocument()+ expect(screen.getByText('appDebug.datasetConfig.top_k'))!.toBeInTheDocument()+ expect(screen.getByText('appDebug.datasetConfig.score_threshold'))!.toBeInTheDocument()})})@@ -855,6 +897,37 @@ describe('ExternalKnowledgeBaseCreate', () => {/>,)+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown+ // In hit testing mode, the title should not be shown// In hit testing mode, the title should not be shownexpect(screen.queryByText('dataset.retrievalSettings')).not.toBeInTheDocument()})@@ -871,6 +944,37 @@ describe('ExternalKnowledgeBaseCreate', () => {/>,)+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown+ // In retrieval setting mode, the title should not be shown// In retrieval setting mode, the title should not be shownexpect(screen.queryByText('dataset.retrievalSettings')).not.toBeInTheDocument()})@@ -889,7 +993,7 @@ describe('ExternalKnowledgeBaseCreate', () => {// Find and click the switchconst switches = screen.getAllByRole('switch')- await user.click(switches[0])+ await user.click(switches[0]!)expect(onChange).toHaveBeenCalledWith({ score_threshold_enabled: true })})@@ -908,7 +1012,7 @@ describe('ExternalKnowledgeBaseCreate', () => {// The TopKItem renders the visible number-field input as a textbox.const inputs = screen.getAllByRole('textbox')const topKInput = inputs[0]- fireEvent.change(topKInput, { target: { value: '8' } })+ fireEvent.change(topKInput!, { target: { value: '8' } })expect(onChange).toHaveBeenCalledWith({ top_k: 8 })})@@ -927,7 +1031,7 @@ describe('ExternalKnowledgeBaseCreate', () => {// The ScoreThresholdItem renders the visible number-field input as a textbox.const inputs = screen.getAllByRole('textbox')const scoreThresholdInput = inputs[1]- fireEvent.change(scoreThresholdInput, { target: { value: '0.8' } })+ fireEvent.change(scoreThresholdInput!, { target: { value: '0.8' } })expect(onChange).toHaveBeenCalledWith({ score_threshold: 0.8 })})@@ -976,7 +1080,7 @@ describe('ExternalKnowledgeBaseCreate', () => {// Toggle score threshold switchconst switches = screen.getAllByRole('switch')const scoreThresholdSwitch = switches[0]- await user.click(scoreThresholdSwitch)+ await user.click(scoreThresholdSwitch!)// Fill required fieldsconst nameInput = screen.getByPlaceholderText('dataset.externalKnowledgeNamePlaceholder')@@ -1018,17 +1122,18 @@ describe('ExternalKnowledgeBaseCreate', () => {const externalLink = screen.getByText('dataset.connectHelper.helper4')expect(externalLink.tagName).toBe('A')- expect(externalLink).toHaveAttribute('target', '_blank')- expect(externalLink).toHaveAttribute('rel', 'noopener noreferrer')+ expect(externalLink)!.toHaveAttribute('target', '_blank')+ expect(externalLink)!.toHaveAttribute('rel', 'noopener noreferrer')})it('should have labels for form inputs', () => {renderComponent()// Check labels exist- expect(screen.getByText('dataset.externalKnowledgeName')).toBeInTheDocument()- expect(screen.getByText('dataset.externalKnowledgeDescription')).toBeInTheDocument()- expect(screen.getByText('dataset.externalKnowledgeId')).toBeInTheDocument()+ // Check labels exist+ expect(screen.getByText('dataset.externalKnowledgeName'))!.toBeInTheDocument()+ expect(screen.getByText('dataset.externalKnowledgeDescription'))!.toBeInTheDocument()+ expect(screen.getByText('dataset.externalKnowledgeId'))!.toBeInTheDocument()})})})diff --git a/web/app/components/datasets/hit-testing/__tests__/index.spec.tsx b/web/app/components/datasets/hit-testing/__tests__/index.spec.tsxindex 2dda6ecaae1..df0e39554a8 100644--- a/web/app/components/datasets/hit-testing/__tests__/index.spec.tsx+++ b/web/app/components/datasets/hit-testing/__tests__/index.spec.tsx@@ -309,25 +309,26 @@ describe('HitTestingPage', () => {describe('Rendering', () => {it('should render without crashing', () => {const { container } = renderWithProviders(<HitTestingPage datasetId="dataset-1" />)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})it('should render page title', () => {renderWithProviders(<HitTestingPage datasetId="dataset-1" />)// Look for heading elementconst heading = screen.getByRole('heading', { level: 1 })- expect(heading).toBeInTheDocument()+ expect(heading)!.toBeInTheDocument()})it('should render records section', () => {const { container } = renderWithProviders(<HitTestingPage datasetId="dataset-1" />)// The records section should be present- expect(container.querySelector('.flex-col')).toBeInTheDocument()+ // The records section should be present+ expect(container.querySelector('.flex-col'))!.toBeInTheDocument()})it('should render query input', () => {renderWithProviders(<HitTestingPage datasetId="dataset-1" />)- expect(screen.getByRole('textbox')).toBeInTheDocument()+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})})@@ -343,7 +344,7 @@ describe('HitTestingPage', () => {const { container } = renderWithProviders(<HitTestingPage datasetId="dataset-1" />)// Loading component should be visible - look for the loading animationconst loadingElement = container.querySelector('[class*="animate"]') || container.querySelector('.flex-1')- expect(loadingElement).toBeInTheDocument()+ expect(loadingElement)!.toBeInTheDocument()})})@@ -353,7 +354,7 @@ describe('HitTestingPage', () => {// EmptyRecords component should be rendered - check that the component is mounted// The EmptyRecords has a specific structure with bg-workflow-process-bg classconst mainContainer = container.querySelector('.flex.h-full')- expect(mainContainer).toBeInTheDocument()+ expect(mainContainer)!.toBeInTheDocument()})})@@ -373,7 +374,7 @@ describe('HitTestingPage', () => {} as unknown as ReturnType<typeof useDatasetTestingRecords>)renderWithProviders(<HitTestingPage datasetId="dataset-1" />)- expect(screen.getByText('Test query')).toBeInTheDocument()+ expect(screen.getByText('Test query'))!.toBeInTheDocument()})})@@ -404,7 +405,7 @@ describe('HitTestingPage', () => {const { container } = renderWithProviders(<HitTestingPage datasetId="dataset-1" />)// The right panel should be present (on non-mobile)const rightPanel = container.querySelector('.rounded-tl-2xl')- expect(rightPanel).toBeInTheDocument()+ expect(rightPanel)!.toBeInTheDocument()})})@@ -423,7 +424,8 @@ describe('HitTestingPage', () => {fireEvent.click(methodSelector)// The component should still be functional after the click- expect(container.firstChild).toBeInTheDocument()+ // The component should still be functional after the click+ expect(container.firstChild)!.toBeInTheDocument()})})@@ -445,7 +447,8 @@ describe('HitTestingPage', () => {const { container } = renderWithProviders(<HitTestingPage datasetId="dataset-1" />)// The right panel should show empty state initially- expect(container.querySelector('.rounded-tl-2xl')).toBeInTheDocument()+ // The right panel should show empty state initially+ expect(container.querySelector('.rounded-tl-2xl'))!.toBeInTheDocument()})it('should render loading skeleton when retrieval is in progress', async () => {@@ -458,7 +461,8 @@ describe('HitTestingPage', () => {const { container } = renderWithProviders(<HitTestingPage datasetId="dataset-1" />)// Component should render without crashing- expect(container.firstChild).toBeInTheDocument()+ // Component should render without crashing+ expect(container.firstChild)!.toBeInTheDocument()})it('should render results when hit testing returns data', async () => {@@ -479,7 +483,8 @@ describe('HitTestingPage', () => {const { container } = renderWithProviders(<HitTestingPage datasetId="dataset-1" />)// The component should render the result display area- expect(container.querySelector('.bg-background-body')).toBeInTheDocument()+ // The component should render the result display area+ expect(container.querySelector('.bg-background-body'))!.toBeInTheDocument()})})@@ -513,7 +518,8 @@ describe('HitTestingPage', () => {fireEvent.click(row)// The query input should be updated - this causes re-render with new key- expect(screen.getByRole('textbox')).toBeInTheDocument()+ // The query input should be updated - this causes re-render with new key+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})})@@ -536,7 +542,8 @@ describe('HitTestingPage', () => {const { container } = renderWithProviders(<HitTestingPage datasetId="dataset-1" />)// Component should render- expect(container.firstChild).toBeInTheDocument()+ // Component should render+ expect(container.firstChild)!.toBeInTheDocument()})})@@ -549,7 +556,8 @@ describe('HitTestingPage', () => {const { container } = renderWithProviders(<HitTestingPage datasetId="dataset-1" />)// Component should still render- expect(container.firstChild).toBeInTheDocument()+ // Component should still render+ expect(container.firstChild)!.toBeInTheDocument()})})@@ -562,7 +570,7 @@ describe('HitTestingPage', () => {const { rerender, container } = renderWithProviders(<HitTestingPage datasetId="dataset-1" />)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()// Re-render with mobilevi.mocked(useBreakpoints.default).mockReturnValue('mobile' as unknown as ReturnType<typeof useBreakpoints.default>)@@ -573,7 +581,7 @@ describe('HitTestingPage', () => {</QueryClientProvider>,)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})})})@@ -638,7 +646,8 @@ describe('Integration: Hit Testing Flow', () => {fireEvent.change(textarea, { target: { value: 'Test query' } })// Component should still be functional - check for the main container- expect(container.firstChild).toBeInTheDocument()+ // Component should still be functional - check for the main container+ expect(container.firstChild)!.toBeInTheDocument()})it('should render hit results after successful submission', async () => {@@ -762,7 +771,8 @@ describe('Integration: Hit Testing Flow', () => {const { container } = renderWithProviders(<HitTestingPage datasetId="dataset-1" />)// Component should render- expect(container.firstChild).toBeInTheDocument()+ // Component should render+ expect(container.firstChild)!.toBeInTheDocument()// Wait for textbox with timeout for CIconst textarea = await waitFor(@@ -781,7 +791,7 @@ describe('Integration: Hit Testing Flow', () => {// Verify component is still functional after submissionawait waitFor(() => {- expect(screen.getByRole('textbox')).toBeInTheDocument()+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()},{ timeout: 3000 },)@@ -819,12 +829,14 @@ describe('Drawer and Modal Interactions', () => {await waitFor(() => {// The drawer should open - verify container is still there- expect(container.firstChild).toBeInTheDocument()+ // The drawer should open - verify container is still there+ expect(container.firstChild)!.toBeInTheDocument()})}// Component should still be functional - verify main container- expect(container.querySelector('.overflow-y-auto')).toBeInTheDocument()+ // Component should still be functional - verify main container+ expect(container.querySelector('.overflow-y-auto'))!.toBeInTheDocument()})it('should close retrieval modal when onHide is called', async () => {@@ -841,7 +853,8 @@ describe('Drawer and Modal Interactions', () => {}// Component should still be functional- expect(container.firstChild).toBeInTheDocument()+ // Component should still be functional+ expect(container.firstChild)!.toBeInTheDocument()})})@@ -901,7 +914,7 @@ describe('renderHitResults Coverage', () => {// Verify component is functionalawait waitFor(() => {- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})})@@ -928,7 +941,7 @@ describe('renderHitResults Coverage', () => {fireEvent.click(submitButton)await waitFor(() => {- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})})})@@ -954,12 +967,13 @@ describe('ModifyRetrievalModal onSave Coverage', () => {// Wait for drawer to openawait waitFor(() => {- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})}// Verify component renders correctly- expect(container.querySelector('.overflow-y-auto')).toBeInTheDocument()+ // Verify component renders correctly+ expect(container.querySelector('.overflow-y-auto'))!.toBeInTheDocument()})it('should close modal after saving', async () => {@@ -975,7 +989,8 @@ describe('ModifyRetrievalModal onSave Coverage', () => {fireEvent.click(methodSelector)// Component should still be rendered- expect(container.firstChild).toBeInTheDocument()+ // Component should still be rendered+ expect(container.firstChild)!.toBeInTheDocument()})})@@ -1038,7 +1053,7 @@ describe('HitTestingPage Internal Functions Coverage', () => {// Wait for state updatesawait waitFor(() => {- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()}, { timeout: 3000 })// Verify mutation was called@@ -1059,18 +1074,19 @@ describe('HitTestingPage Internal Functions Coverage', () => {// Wait for drawer contentawait waitFor(() => {- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})// Try to find save button in the drawerconst saveButtons = screen.queryAllByText(/save/i)if (saveButtons.length > 0) {- fireEvent.click(saveButtons[0])+ fireEvent.click(saveButtons[0]!)}}// Component should still work- expect(container.firstChild).toBeInTheDocument()+ // Component should still work+ expect(container.firstChild)!.toBeInTheDocument()})it('should show hit count in results panel after successful query', async () => {@@ -1101,7 +1117,7 @@ describe('HitTestingPage Internal Functions Coverage', () => {// Verify the component rendersawait waitFor(() => {- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()}, { timeout: 3000 })})})diff --git a/web/app/components/datasets/hit-testing/components/query-input/__tests__/index.spec.tsx b/web/app/components/datasets/hit-testing/components/query-input/__tests__/index.spec.tsxindex 25b7abe7ea7..d9427f5117a 100644--- a/web/app/components/datasets/hit-testing/components/query-input/__tests__/index.spec.tsx+++ b/web/app/components/datasets/hit-testing/components/query-input/__tests__/index.spec.tsx@@ -79,17 +79,17 @@ describe('QueryInput', () => {it('should render title', () => {render(<QueryInput {...defaultProps} />)- expect(screen.getByText('datasetHitTesting.input.title')).toBeInTheDocument()+ expect(screen.getByText('datasetHitTesting.input.title'))!.toBeInTheDocument()})it('should render textarea with query text', () => {render(<QueryInput {...defaultProps} />)- expect(screen.getByTestId('textarea')).toBeInTheDocument()+ expect(screen.getByTestId('textarea'))!.toBeInTheDocument()})it('should render submit button', () => {render(<QueryInput {...defaultProps} />)- expect(screen.getByRole('button', { name: /input\.testing/ })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: /input\.testing/ }))!.toBeInTheDocument()})it('should disable submit button when text is empty', () => {@@ -98,17 +98,17 @@ describe('QueryInput', () => {queries: [{ content: '', content_type: 'text_query', file_info: null }] satisfies Query[],}render(<QueryInput {...props} />)- expect(screen.getByRole('button', { name: /input\.testing/ })).toBeDisabled()+ expect(screen.getByRole('button', { name: /input\.testing/ }))!.toBeDisabled()})it('should render retrieval method for non-external mode', () => {render(<QueryInput {...defaultProps} />)- expect(screen.getByText('dataset.retrieval.semantic_search.title')).toBeInTheDocument()+ expect(screen.getByText('dataset.retrieval.semantic_search.title'))!.toBeInTheDocument()})it('should render settings button for external mode', () => {render(<QueryInput {...defaultProps} isExternal={true} />)- expect(screen.getByText('datasetHitTesting.settingTitle')).toBeInTheDocument()+ expect(screen.getByText('datasetHitTesting.settingTitle'))!.toBeInTheDocument()})it('should disable submit button when text exceeds 200 characters', () => {@@ -117,15 +117,15 @@ describe('QueryInput', () => {queries: [{ content: 'a'.repeat(201), content_type: 'text_query', file_info: null }] satisfies Query[],}render(<QueryInput {...props} />)- expect(screen.getByRole('button', { name: /input\.testing/ })).toBeDisabled()+ expect(screen.getByRole('button', { name: /input\.testing/ }))!.toBeDisabled()})it('should show loading state on submit button when loading', () => {render(<QueryInput {...defaultProps} loading={true} />)const submitButton = screen.getByRole('button', { name: /input\.testing/ })- expect(submitButton).toBeDisabled()- expect(submitButton).toHaveAttribute('aria-busy', 'true')- expect(submitButton.querySelector('.animate-spin')).toBeInTheDocument()+ expect(submitButton)!.toBeDisabled()+ expect(submitButton)!.toHaveAttribute('aria-busy', 'true')+ expect(submitButton.querySelector('.animate-spin'))!.toBeInTheDocument()})// Cover line 83: images useMemo with image_query data@@ -141,6 +141,37 @@ describe('QueryInput', () => {]render(<QueryInput {...defaultProps} queries={queries} />)+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image+ // Submit should be enabled since we have text + uploaded image// Submit should be enabled since we have text + uploaded imageexpect(screen.getByRole('button', { name: /input\.testing/ })).not.toBeDisabled()})@@ -153,7 +184,7 @@ describe('QueryInput', () => {// Click settings button to open modalfireEvent.click(screen.getByRole('button', { name: /settingTitle/ }))- expect(screen.getByTestId('external-retrieval-modal')).toBeInTheDocument()+ expect(screen.getByTestId('external-retrieval-modal'))!.toBeInTheDocument()// Close modalfireEvent.click(screen.getByTestId('modal-close'))@@ -165,7 +196,7 @@ describe('QueryInput', () => {// Open modalfireEvent.click(screen.getByRole('button', { name: /settingTitle/ }))- expect(screen.getByTestId('external-retrieval-modal')).toBeInTheDocument()+ expect(screen.getByTestId('external-retrieval-modal'))!.toBeInTheDocument()// Save settingsfireEvent.click(screen.getByTestId('modal-save'))@@ -274,7 +305,7 @@ describe('QueryInput', () => {]),)// Should not contain image_query- const calledWith = defaultProps.setQueries.mock.calls[0][0] as Query[]+ const calledWith = defaultProps.setQueries.mock.calls[0]![0] as Query[]expect(calledWith.filter(q => q.content_type === 'image_query')).toHaveLength(0)})})@@ -412,7 +443,7 @@ describe('QueryInput', () => {it('should show keyword_search when isEconomy is true', () => {render(<QueryInput {...defaultProps} isEconomy={true} />)- expect(screen.getByText('dataset.retrieval.keyword_search.title')).toBeInTheDocument()+ expect(screen.getByText('dataset.retrieval.keyword_search.title'))!.toBeInTheDocument()})})})diff --git a/web/app/components/datasets/list/datasets.tsx b/web/app/components/datasets/list/datasets.tsxindex 817b927e6b1..8d7006a08a2 100644--- a/web/app/components/datasets/list/datasets.tsx+++ b/web/app/components/datasets/list/datasets.tsx@@ -45,7 +45,7 @@ const Datasets = ({useEffect(() => {if (anchorRef.current) {observerRef.current = new IntersectionObserver((entries) => {- if (entries[0].isIntersecting && hasNextPage && !isFetching)+ if (entries[0]!.isIntersecting && hasNextPage && !isFetching)fetchNextPage()}, {rootMargin: '100px',diff --git a/web/app/components/datasets/metadata/edit-metadata-batch/__tests__/modal.spec.tsx b/web/app/components/datasets/metadata/edit-metadata-batch/__tests__/modal.spec.tsxindex d9b88e20bb4..40c925222c2 100644--- a/web/app/components/datasets/metadata/edit-metadata-batch/__tests__/modal.spec.tsx+++ b/web/app/components/datasets/metadata/edit-metadata-batch/__tests__/modal.spec.tsx@@ -120,14 +120,14 @@ describe('EditMetadataBatchModal', () => {it('should render without crashing', async () => {render(<EditMetadataBatchModal {...defaultProps} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})})it('should render document count', async () => {render(<EditMetadataBatchModal {...defaultProps} />)await waitFor(() => {- expect(screen.getByText(/5/)).toBeInTheDocument()+ expect(screen.getByText(/5/))!.toBeInTheDocument()})})@@ -142,8 +142,8 @@ describe('EditMetadataBatchModal', () => {it('should render field names for existing items', async () => {render(<EditMetadataBatchModal {...defaultProps} />)await waitFor(() => {- expect(screen.getByText('field_one')).toBeInTheDocument()- expect(screen.getByText('field_two')).toBeInTheDocument()+ expect(screen.getByText('field_one'))!.toBeInTheDocument()+ expect(screen.getByText('field_two'))!.toBeInTheDocument()})})@@ -158,7 +158,7 @@ describe('EditMetadataBatchModal', () => {it('should render select metadata modal', async () => {render(<EditMetadataBatchModal {...defaultProps} />)await waitFor(() => {- expect(screen.getByTestId('select-modal')).toBeInTheDocument()+ expect(screen.getByTestId('select-modal'))!.toBeInTheDocument()})})})@@ -169,7 +169,7 @@ describe('EditMetadataBatchModal', () => {render(<EditMetadataBatchModal {...defaultProps} onHide={onHide} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})const cancelButton = screen.getByText(/cancel/i)@@ -183,7 +183,7 @@ describe('EditMetadataBatchModal', () => {render(<EditMetadataBatchModal {...defaultProps} onSave={onSave} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})// Find the primary save button (not the one in SelectMetadataModal)@@ -196,17 +196,17 @@ describe('EditMetadataBatchModal', () => {render(<EditMetadataBatchModal {...defaultProps} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})const checkboxContainer = document.querySelector('[data-testid*="checkbox"]')- expect(checkboxContainer).toBeInTheDocument()+ expect(checkboxContainer)!.toBeInTheDocument()if (checkboxContainer) {fireEvent.click(checkboxContainer)await waitFor(() => {const checkIcon = screen.getByTestId('check-icon-apply-to-all')- expect(checkIcon).toBeInTheDocument()+ expect(checkIcon)!.toBeInTheDocument()})}})@@ -216,7 +216,7 @@ describe('EditMetadataBatchModal', () => {render(<EditMetadataBatchModal {...defaultProps} onHide={onHide} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})})})@@ -226,7 +226,7 @@ describe('EditMetadataBatchModal', () => {render(<EditMetadataBatchModal {...defaultProps} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})fireEvent.click(screen.getByTestId('change-1'))@@ -239,7 +239,7 @@ describe('EditMetadataBatchModal', () => {render(<EditMetadataBatchModal {...defaultProps} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})fireEvent.click(screen.getByTestId('remove-1'))@@ -252,7 +252,7 @@ describe('EditMetadataBatchModal', () => {render(<EditMetadataBatchModal {...defaultProps} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})// First change the item@@ -269,14 +269,14 @@ describe('EditMetadataBatchModal', () => {render(<EditMetadataBatchModal {...defaultProps} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})fireEvent.click(screen.getByTestId('select-metadata'))// Should now have add-row for the new itemawait waitFor(() => {- expect(screen.getByTestId('add-row')).toBeInTheDocument()+ expect(screen.getByTestId('add-row'))!.toBeInTheDocument()})})@@ -284,14 +284,14 @@ describe('EditMetadataBatchModal', () => {render(<EditMetadataBatchModal {...defaultProps} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})// First add an itemfireEvent.click(screen.getByTestId('select-metadata'))await waitFor(() => {- expect(screen.getByTestId('add-row')).toBeInTheDocument()+ expect(screen.getByTestId('add-row'))!.toBeInTheDocument()})// Then remove it@@ -306,20 +306,20 @@ describe('EditMetadataBatchModal', () => {render(<EditMetadataBatchModal {...defaultProps} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})// First add an itemfireEvent.click(screen.getByTestId('select-metadata'))await waitFor(() => {- expect(screen.getByTestId('add-row')).toBeInTheDocument()+ expect(screen.getByTestId('add-row'))!.toBeInTheDocument()})// Then change itfireEvent.click(screen.getByTestId('add-change-new-1'))- expect(screen.getByTestId('add-row')).toBeInTheDocument()+ expect(screen.getByTestId('add-row'))!.toBeInTheDocument()})it('should call doAddMetaData when saving new metadata with valid name', async () => {@@ -328,7 +328,7 @@ describe('EditMetadataBatchModal', () => {render(<EditMetadataBatchModal {...defaultProps} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})fireEvent.click(screen.getByTestId('save-metadata'))@@ -344,7 +344,7 @@ describe('EditMetadataBatchModal', () => {render(<EditMetadataBatchModal {...defaultProps} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})fireEvent.click(screen.getByTestId('save-metadata'))@@ -368,7 +368,7 @@ describe('EditMetadataBatchModal', () => {render(<EditMetadataBatchModal {...defaultProps} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})fireEvent.click(screen.getByTestId('save-metadata'))@@ -388,7 +388,7 @@ describe('EditMetadataBatchModal', () => {render(<EditMetadataBatchModal {...defaultProps} onShowManage={onShowManage} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})fireEvent.click(screen.getByTestId('manage-metadata'))@@ -401,14 +401,14 @@ describe('EditMetadataBatchModal', () => {it('should pass correct datasetId', async () => {render(<EditMetadataBatchModal {...defaultProps} datasetId="custom-ds" />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})})it('should display correct document number', async () => {render(<EditMetadataBatchModal {...defaultProps} documentNum={10} />)await waitFor(() => {- expect(screen.getByText(/10/)).toBeInTheDocument()+ expect(screen.getByText(/10/))!.toBeInTheDocument()})})@@ -427,7 +427,7 @@ describe('EditMetadataBatchModal', () => {]render(<EditMetadataBatchModal {...defaultProps} list={multipleValueList} />)await waitFor(() => {- expect(screen.getByTestId('edit-row')).toBeInTheDocument()+ expect(screen.getByTestId('edit-row'))!.toBeInTheDocument()})})@@ -436,7 +436,7 @@ describe('EditMetadataBatchModal', () => {render(<EditMetadataBatchModal {...defaultProps} onSave={onSave} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})// Find the primary save button@@ -453,7 +453,7 @@ describe('EditMetadataBatchModal', () => {render(<EditMetadataBatchModal {...defaultProps} onSave={onSave} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})fireEvent.click(screen.getByRole('button', { name: 'common.operation.save' }))@@ -470,7 +470,7 @@ describe('EditMetadataBatchModal', () => {render(<EditMetadataBatchModal {...defaultProps} onSave={onSave} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})const checkboxContainer = document.querySelector('[data-testid*="checkbox"]')@@ -493,7 +493,7 @@ describe('EditMetadataBatchModal', () => {render(<EditMetadataBatchModal {...defaultProps} onSave={onSave} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})// Remove an item@@ -503,7 +503,7 @@ describe('EditMetadataBatchModal', () => {expect(onSave).toHaveBeenCalled()// The first argument should not contain the deleted item (id '1')- const savedList = onSave.mock.calls[0][0] as MetadataItemInBatchEdit[]+ const savedList = onSave.mock.calls[0]![0] as MetadataItemInBatchEdit[]const hasDeletedItem = savedList.some(item => item.id === '1')expect(hasDeletedItem).toBe(false)})@@ -512,13 +512,13 @@ describe('EditMetadataBatchModal', () => {render(<EditMetadataBatchModal {...defaultProps} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})// Add first itemfireEvent.click(screen.getByTestId('select-metadata'))await waitFor(() => {- expect(screen.getByTestId('add-row')).toBeInTheDocument()+ expect(screen.getByTestId('add-row'))!.toBeInTheDocument()})// Remove it@@ -531,7 +531,7 @@ describe('EditMetadataBatchModal', () => {// Add againfireEvent.click(screen.getByTestId('select-metadata'))await waitFor(() => {- expect(screen.getByTestId('add-row')).toBeInTheDocument()+ expect(screen.getByTestId('add-row'))!.toBeInTheDocument()})})})diff --git a/web/app/components/datasets/metadata/edit-metadata-batch/modal.tsx b/web/app/components/datasets/metadata/edit-metadata-batch/modal.tsxindex 2dfff611edd..974ce977e73 100644--- a/web/app/components/datasets/metadata/edit-metadata-batch/modal.tsx+++ b/web/app/components/datasets/metadata/edit-metadata-batch/modal.tsx@@ -47,8 +47,8 @@ const EditMetadataBatchModal: FC<Props> = ({ datasetId, documentNum, list, onSavconst newTempleList = produce(templeList, (draft) => {const index = draft.findIndex(i => i.id === id)if (index !== -1) {- draft[index].isUpdated = true- draft[index].updateType = UpdateType.delete+ draft[index]!.isUpdated = true+ draft[index]!.updateType = UpdateType.delete}})setTempleList(newTempleList)@@ -57,9 +57,9 @@ const EditMetadataBatchModal: FC<Props> = ({ datasetId, documentNum, list, onSavconst newTempleList = produce(templeList, (draft) => {const index = draft.findIndex(i => i.id === id)if (index !== -1) {- draft[index] = { ...list[index] }- draft[index].isUpdated = false- delete draft[index].updateType+ draft[index] = { ...list[index]! }+ draft[index]!.isUpdated = false+ delete draft[index]!.updateType}})setTempleList(newTempleList)diff --git a/web/app/components/datasets/metadata/hooks/__tests__/use-batch-edit-document-metadata.spec.ts b/web/app/components/datasets/metadata/hooks/__tests__/use-batch-edit-document-metadata.spec.tsindex 05088cabeca..a4650bac43c 100644--- a/web/app/components/datasets/metadata/hooks/__tests__/use-batch-edit-document-metadata.spec.ts+++ b/web/app/components/datasets/metadata/hooks/__tests__/use-batch-edit-document-metadata.spec.ts@@ -239,7 +239,7 @@ describe('useBatchEditDocumentMetadata', () => {// Should only have one item for field '1', marked as multipleconst fieldItems = result.current.originalList.filter(item => item.id === '1')expect(fieldItems.length).toBe(1)- expect(fieldItems[0].isMultipleValue).toBe(true)+ expect(fieldItems[0]!.isMultipleValue).toBe(true)})})@@ -458,7 +458,7 @@ describe('useBatchEditDocumentMetadata', () => {// Both documents should have the field after applying to allexpect(mockMutateAsync).toHaveBeenCalled()- const callArgs = mockMutateAsync.mock.calls[0][0]+ const callArgs = mockMutateAsync.mock.calls[0]![0]expect(callArgs.metadata_list.length).toBe(2)})@@ -651,7 +651,7 @@ describe('useBatchEditDocumentMetadata', () => {await result.current.handleSave(editedList, [], false)})- const callArgs = mockMutateAsync.mock.calls[0][0]+ const callArgs = mockMutateAsync.mock.calls[0]![0]const sentItem = callArgs.metadata_list[0].metadata_list[0]// Only id, name, type, value should be present@@ -693,7 +693,7 @@ describe('useBatchEditDocumentMetadata', () => {await result.current.handleSave(editedList, [], false)})- const callArgs = mockMutateAsync.mock.calls[0][0]+ const callArgs = mockMutateAsync.mock.calls[0]![0]const sentItem = callArgs.metadata_list[0].metadata_list[0]// value should be null, not undefineddiff --git a/web/app/components/datasets/metadata/hooks/__tests__/use-metadata-document.spec.ts b/web/app/components/datasets/metadata/hooks/__tests__/use-metadata-document.spec.tsindex 67c8ffe3b30..9d8b73aaaa3 100644--- a/web/app/components/datasets/metadata/hooks/__tests__/use-metadata-document.spec.ts+++ b/web/app/components/datasets/metadata/hooks/__tests__/use-metadata-document.spec.ts@@ -262,7 +262,7 @@ describe('useMetadataDocument', () => {// Try to add existing itemif (result.current.tempList.length > 0) {act(() => {- result.current.handleSelectMetaData(result.current.tempList[0])+ result.current.handleSelectMetaData(result.current.tempList[0]!)})expect(result.current.tempList.length).toBe(initialLength)diff --git a/web/app/components/datasets/metadata/hooks/use-batch-edit-document-metadata.ts b/web/app/components/datasets/metadata/hooks/use-batch-edit-document-metadata.tsindex b0feea8c564..16252909a2f 100644--- a/web/app/components/datasets/metadata/hooks/use-batch-edit-document-metadata.ts+++ b/web/app/components/datasets/metadata/hooks/use-batch-edit-document-metadata.ts@@ -45,7 +45,7 @@ const useBatchEditDocumentMetadata = ({ datasetId, docList, selectedDocumentIds,}}if (itemInRes && itemInRes.value !== item.value) {- idNameValue[item.id].isMultipleValue = true+ idNameValue[item.id]!.isMultipleValue = trueitemInRes.isMultipleValue = trueitemInRes.value = nullreturn@@ -82,7 +82,7 @@ const useBatchEditDocumentMetadata = ({ datasetId, docList, selectedDocumentIds,// Find the document in docList to get its metadataconst docIndex = docList.findIndex(doc => doc.id === documentId)const oldMetadataList = docIndex >= 0 ? metaDataList[docIndex] : []- let newMetadataList: MetadataItemWithValue[] = [...oldMetadataList, ...addedList]+ let newMetadataList: MetadataItemWithValue[] = [...(oldMetadataList ?? []), ...addedList].filter((item) => {return !removedList.find(removedItem => removedItem.id === item.id)})diff --git a/web/app/components/datasets/metadata/hooks/use-metadata-document.ts b/web/app/components/datasets/metadata/hooks/use-metadata-document.tsindex 2e9edbfa757..d70870690af 100644--- a/web/app/components/datasets/metadata/hooks/use-metadata-document.ts+++ b/web/app/components/datasets/metadata/hooks/use-metadata-document.ts@@ -95,9 +95,9 @@ const useMetadataDocument = ({ datasetId, documentId, docDetail }: Props) => {const fieldList = Object.keys(fieldMap).map((key) => {const field = fieldMap[key]return {- id: field?.label,+ id: field?.label!,type: DataType.string,- name: field?.label,+ name: field?.label!,value: getTargetValue(key),}})@@ -120,8 +120,8 @@ const useMetadataDocument = ({ datasetId, documentId, docDetail }: Props) => {startToEdit,handleSave,handleCancel,- originInfo,- technicalParameters,+ originInfo: originInfo!,+ technicalParameters: technicalParameters!,}}export default useMetadataDocumentdiff --git a/web/app/components/datasets/metadata/metadata-dataset/__tests__/dataset-metadata-drawer.spec.tsx b/web/app/components/datasets/metadata/metadata-dataset/__tests__/dataset-metadata-drawer.spec.tsxindex 353a39450e5..95e9c130edc 100644--- a/web/app/components/datasets/metadata/metadata-dataset/__tests__/dataset-metadata-drawer.spec.tsx+++ b/web/app/components/datasets/metadata/metadata-dataset/__tests__/dataset-metadata-drawer.spec.tsx@@ -90,23 +90,23 @@ describe('DatasetMetadataDrawer', () => {it('should render without crashing', async () => {render(<DatasetMetadataDrawer {...defaultProps} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})})it('should render user metadata items', async () => {render(<DatasetMetadataDrawer {...defaultProps} />)await waitFor(() => {- expect(screen.getByText('field_one')).toBeInTheDocument()- expect(screen.getByText('field_two')).toBeInTheDocument()+ expect(screen.getByText('field_one'))!.toBeInTheDocument()+ expect(screen.getByText('field_two'))!.toBeInTheDocument()})})it('should render built-in metadata items', async () => {render(<DatasetMetadataDrawer {...defaultProps} />)await waitFor(() => {- expect(screen.getByText('created_at')).toBeInTheDocument()- expect(screen.getByText('modified_at')).toBeInTheDocument()+ expect(screen.getByText('created_at'))!.toBeInTheDocument()+ expect(screen.getByText('modified_at'))!.toBeInTheDocument()})})@@ -121,7 +121,7 @@ describe('DatasetMetadataDrawer', () => {it('should render add metadata button', async () => {render(<DatasetMetadataDrawer {...defaultProps} />)await waitFor(() => {- expect(screen.getByTestId('create-trigger')).toBeInTheDocument()+ expect(screen.getByTestId('create-trigger'))!.toBeInTheDocument()})})@@ -129,7 +129,7 @@ describe('DatasetMetadataDrawer', () => {render(<DatasetMetadataDrawer {...defaultProps} />)await waitFor(() => {const switchBtn = screen.getByRole('switch')- expect(switchBtn).toBeInTheDocument()+ expect(switchBtn)!.toBeInTheDocument()})})})@@ -145,7 +145,7 @@ describe('DatasetMetadataDrawer', () => {)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})const switchBtn = screen.getByRole('switch')@@ -160,14 +160,14 @@ describe('DatasetMetadataDrawer', () => {render(<DatasetMetadataDrawer {...defaultProps} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})const trigger = screen.getByTestId('create-trigger')fireEvent.click(trigger)await waitFor(() => {- expect(screen.getByTestId('create-modal')).toBeInTheDocument()+ expect(screen.getByTestId('create-modal'))!.toBeInTheDocument()})})@@ -176,7 +176,7 @@ describe('DatasetMetadataDrawer', () => {render(<DatasetMetadataDrawer {...defaultProps} onAdd={onAdd} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})// Open create modal@@ -184,7 +184,7 @@ describe('DatasetMetadataDrawer', () => {fireEvent.click(trigger)await waitFor(() => {- expect(screen.getByTestId('create-modal')).toBeInTheDocument()+ expect(screen.getByTestId('create-modal'))!.toBeInTheDocument()})// Save new metadata@@ -208,14 +208,14 @@ describe('DatasetMetadataDrawer', () => {render(<DatasetMetadataDrawer {...defaultProps} onAdd={onAdd} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})// Open create modalfireEvent.click(screen.getByTestId('create-trigger'))await waitFor(() => {- expect(screen.getByTestId('create-modal')).toBeInTheDocument()+ expect(screen.getByTestId('create-modal'))!.toBeInTheDocument()})fireEvent.click(screen.getByTestId('create-save'))@@ -231,7 +231,7 @@ describe('DatasetMetadataDrawer', () => {render(<DatasetMetadataDrawer {...defaultProps} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})// Find user metadata items with group/item class (these have edit/delete icons)@@ -240,14 +240,14 @@ describe('DatasetMetadataDrawer', () => {expect(items.length).toBe(2) // 2 user metadata items// Find the hidden container with edit/delete icons- const actionsContainer = items[0].querySelector('.hidden.items-center')+ const actionsContainer = items[0]!.querySelector('.hidden.items-center')expect(actionsContainer).toBeTruthy()// Find and click the first SVG (edit icon)if (actionsContainer) {const svgs = actionsContainer.querySelectorAll('svg')expect(svgs.length).toBeGreaterThan(0)- fireEvent.click(svgs[0])+ fireEvent.click(svgs[0]!)}// Wait for rename modal (contains input)@@ -262,16 +262,16 @@ describe('DatasetMetadataDrawer', () => {render(<DatasetMetadataDrawer {...defaultProps} onRename={onRename} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})// Find and click edit iconconst dialog = screen.getByRole('dialog')const items = dialog.querySelectorAll('.group\\/item')- const actionsContainer = items[0].querySelector('.hidden.items-center')+ const actionsContainer = items[0]!.querySelector('.hidden.items-center')if (actionsContainer) {const svgs = actionsContainer.querySelectorAll('svg')- fireEvent.click(svgs[0])+ fireEvent.click(svgs[0]!)}// Change name and save@@ -281,7 +281,7 @@ describe('DatasetMetadataDrawer', () => {})const inputs = document.querySelectorAll('input')- fireEvent.change(inputs[0], { target: { value: 'renamed_field' } })+ fireEvent.change(inputs[0]!, { target: { value: 'renamed_field' } })// Find and click save buttonfireEvent.click(screen.getByRole('button', { name: 'common.operation.save' }))@@ -303,16 +303,16 @@ describe('DatasetMetadataDrawer', () => {render(<DatasetMetadataDrawer {...defaultProps} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})// Find and click edit iconconst dialog = screen.getByRole('dialog')const items = dialog.querySelectorAll('.group\\/item')- const actionsContainer = items[0].querySelector('.hidden.items-center')+ const actionsContainer = items[0]!.querySelector('.hidden.items-center')if (actionsContainer) {const svgs = actionsContainer.querySelectorAll('svg')- fireEvent.click(svgs[0])+ fireEvent.click(svgs[0]!)}// Wait for modal and click cancel@@ -323,7 +323,7 @@ describe('DatasetMetadataDrawer', () => {// Change name firstconst inputs = document.querySelectorAll('input')- fireEvent.change(inputs[0], { target: { value: 'changed_name' } })+ fireEvent.change(inputs[0]!, { target: { value: 'changed_name' } })// Find and click cancel buttonfireEvent.click(screen.getByRole('button', { name: 'common.operation.cancel' }))@@ -339,16 +339,16 @@ describe('DatasetMetadataDrawer', () => {render(<DatasetMetadataDrawer {...defaultProps} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})// Find and click edit iconconst dialog = screen.getByRole('dialog')const items = dialog.querySelectorAll('.group\\/item')- const actionsContainer = items[0].querySelector('.hidden.items-center')+ const actionsContainer = items[0]!.querySelector('.hidden.items-center')if (actionsContainer) {const svgs = actionsContainer.querySelectorAll('svg')- fireEvent.click(svgs[0])+ fireEvent.click(svgs[0]!)}// Wait for rename modal@@ -382,7 +382,7 @@ describe('DatasetMetadataDrawer', () => {render(<DatasetMetadataDrawer {...defaultProps} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})// Find user metadata items@@ -390,7 +390,7 @@ describe('DatasetMetadataDrawer', () => {const items = dialog.querySelectorAll('.group\\/item')// Find the delete container- const deleteContainer = items[0].querySelector('.hover\\:text-text-destructive')+ const deleteContainer = items[0]!.querySelector('.hover\\:text-text-destructive')expect(deleteContainer).toBeTruthy()if (deleteContainer) {@@ -414,13 +414,13 @@ describe('DatasetMetadataDrawer', () => {render(<DatasetMetadataDrawer {...defaultProps} onRemove={onRemove} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})// Find and click delete iconconst dialog = screen.getByRole('dialog')const items = dialog.querySelectorAll('.group\\/item')- const deleteContainer = items[0].querySelector('.hover\\:text-text-destructive')+ const deleteContainer = items[0]!.querySelector('.hover\\:text-text-destructive')if (deleteContainer) {const deleteIcon = deleteContainer.querySelector('svg')if (deleteIcon)@@ -460,13 +460,13 @@ describe('DatasetMetadataDrawer', () => {render(<DatasetMetadataDrawer {...defaultProps} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})// Find and click delete iconconst dialog = screen.getByRole('dialog')const items = dialog.querySelectorAll('.group\\/item')- const deleteContainer = items[0].querySelector('.hover\\:text-text-destructive')+ const deleteContainer = items[0]!.querySelector('.hover\\:text-text-destructive')if (deleteContainer) {const deleteIcon = deleteContainer.querySelector('svg')if (deleteIcon)@@ -495,14 +495,14 @@ describe('DatasetMetadataDrawer', () => {it('should handle empty userMetadata', async () => {render(<DatasetMetadataDrawer {...defaultProps} userMetadata={[]} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})})it('should handle empty builtInMetadata', async () => {render(<DatasetMetadataDrawer {...defaultProps} builtInMetadata={[]} />)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})})})@@ -514,7 +514,7 @@ describe('DatasetMetadataDrawer', () => {)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})const dialog = screen.getByRole('dialog')@@ -528,7 +528,7 @@ describe('DatasetMetadataDrawer', () => {)await waitFor(() => {- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})})})@@ -540,7 +540,7 @@ describe('DatasetMetadataDrawer', () => {]render(<DatasetMetadataDrawer {...defaultProps} userMetadata={specialMetadata} />)await waitFor(() => {- expect(screen.getByText('field_with_underscore')).toBeInTheDocument()+ expect(screen.getByText('field_with_underscore'))!.toBeInTheDocument()})})@@ -550,7 +550,7 @@ describe('DatasetMetadataDrawer', () => {]render(<DatasetMetadataDrawer {...defaultProps} userMetadata={singleMetadata} />)await waitFor(() => {- expect(screen.getByText('only_field')).toBeInTheDocument()+ expect(screen.getByText('only_field'))!.toBeInTheDocument()})})@@ -560,7 +560,7 @@ describe('DatasetMetadataDrawer', () => {]render(<DatasetMetadataDrawer {...defaultProps} builtInMetadata={singleBuiltIn} />)await waitFor(() => {- expect(screen.getByText('created_at')).toBeInTheDocument()+ expect(screen.getByText('created_at'))!.toBeInTheDocument()})})@@ -570,7 +570,7 @@ describe('DatasetMetadataDrawer', () => {]render(<DatasetMetadataDrawer {...defaultProps} userMetadata={zeroCountMetadata} />)await waitFor(() => {- expect(screen.getByText('empty_field')).toBeInTheDocument()+ expect(screen.getByText('empty_field'))!.toBeInTheDocument()})})})diff --git a/web/app/components/datasets/metadata/metadata-document/__tests__/index.spec.tsx b/web/app/components/datasets/metadata/metadata-document/__tests__/index.spec.tsxindex ddd624a0767..71f23324f60 100644--- a/web/app/components/datasets/metadata/metadata-document/__tests__/index.spec.tsx+++ b/web/app/components/datasets/metadata/metadata-document/__tests__/index.spec.tsx@@ -99,7 +99,7 @@ describe('MetadataDocument', () => {docDetail={mockDocDetail as Parameters<typeof MetadataDocument>[0]['docDetail']}/>,)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})it('should render metadata fields when hasData is true', () => {@@ -110,8 +110,8 @@ describe('MetadataDocument', () => {docDetail={mockDocDetail as Parameters<typeof MetadataDocument>[0]['docDetail']}/>,)- expect(screen.getByText('field_one')).toBeInTheDocument()- expect(screen.getByText('field_two')).toBeInTheDocument()+ expect(screen.getByText('field_one'))!.toBeInTheDocument()+ expect(screen.getByText('field_two'))!.toBeInTheDocument()})it('should render no-data state when hasData is false and not in edit mode', () => {@@ -147,8 +147,8 @@ describe('MetadataDocument', () => {/>,)- expect(screen.getByText(/save/i)).toBeInTheDocument()- expect(screen.getByText(/cancel/i)).toBeInTheDocument()+ expect(screen.getByText(/save/i))!.toBeInTheDocument()+ expect(screen.getByText(/cancel/i))!.toBeInTheDocument()})it('should render built-in section when builtInEnabled is true', () => {@@ -166,7 +166,7 @@ describe('MetadataDocument', () => {/>,)- expect(screen.getByText('created_at')).toBeInTheDocument()+ expect(screen.getByText('created_at'))!.toBeInTheDocument()})it('should render divider when builtInEnabled is true', () => {@@ -185,7 +185,7 @@ describe('MetadataDocument', () => {)const divider = container.querySelector('.bg-linear-to-r')- expect(divider).toBeInTheDocument()+ expect(divider)!.toBeInTheDocument()})it('should render origin info section', () => {@@ -202,7 +202,7 @@ describe('MetadataDocument', () => {/>,)- expect(screen.getByText('source')).toBeInTheDocument()+ expect(screen.getByText('source'))!.toBeInTheDocument()})it('should render technical parameters section', () => {@@ -219,7 +219,7 @@ describe('MetadataDocument', () => {/>,)- expect(screen.getByText('word_count')).toBeInTheDocument()+ expect(screen.getByText('word_count'))!.toBeInTheDocument()})it('should render all sections together', () => {@@ -239,10 +239,10 @@ describe('MetadataDocument', () => {/>,)- expect(screen.getByText('field_one')).toBeInTheDocument()- expect(screen.getByText('created_at')).toBeInTheDocument()- expect(screen.getByText('source')).toBeInTheDocument()- expect(screen.getByText('word_count')).toBeInTheDocument()+ expect(screen.getByText('field_one'))!.toBeInTheDocument()+ expect(screen.getByText('created_at'))!.toBeInTheDocument()+ expect(screen.getByText('source'))!.toBeInTheDocument()+ expect(screen.getByText('word_count'))!.toBeInTheDocument()})})@@ -255,7 +255,7 @@ describe('MetadataDocument', () => {docDetail={mockDocDetail as Parameters<typeof MetadataDocument>[0]['docDetail']}/>,)- expect(screen.getByText(/edit/i)).toBeInTheDocument()+ expect(screen.getByText(/edit/i))!.toBeInTheDocument()})it('should call startToEdit when edit button is clicked', () => {@@ -362,8 +362,9 @@ describe('MetadataDocument', () => {)// Should show save/cancel buttons- expect(screen.getByText(/save/i)).toBeInTheDocument()- expect(screen.getByText(/cancel/i)).toBeInTheDocument()+ // Should show save/cancel buttons+ expect(screen.getByText(/save/i))!.toBeInTheDocument()+ expect(screen.getByText(/cancel/i))!.toBeInTheDocument()})})@@ -386,7 +387,7 @@ describe('MetadataDocument', () => {const inputs = container.querySelectorAll('input')if (inputs.length > 0) {- fireEvent.change(inputs[0], { target: { value: 'new value' } })+ fireEvent.change(inputs[0]!, { target: { value: 'new value' } })await waitFor(() => {expect(setTempList).toHaveBeenCalled()@@ -454,7 +455,7 @@ describe('MetadataDocument', () => {const inputs = container.querySelectorAll('input')if (inputs.length > 0) {- fireEvent.change(inputs[0], { target: { value: 'updated' } })+ fireEvent.change(inputs[0]!, { target: { value: 'updated' } })await waitFor(() => {expect(setTempList).toHaveBeenCalled()})@@ -483,7 +484,7 @@ describe('MetadataDocument', () => {expect(deleteContainers.length).toBeGreaterThan(0)if (deleteContainers.length > 0) {- const deleteIcon = deleteContainers[0].querySelector('svg')+ const deleteIcon = deleteContainers[0]!.querySelector('svg')if (deleteIcon)fireEvent.click(deleteIcon)@@ -504,7 +505,7 @@ describe('MetadataDocument', () => {className="custom-class"/>,)- expect(container.firstChild).toHaveClass('custom-class')+ expect(container.firstChild)!.toHaveClass('custom-class')})it('should use tempList when in edit mode', () => {@@ -524,7 +525,7 @@ describe('MetadataDocument', () => {/>,)- expect(screen.getByText('temp_field')).toBeInTheDocument()+ expect(screen.getByText('temp_field'))!.toBeInTheDocument()})it('should use list when not in edit mode', () => {@@ -536,8 +537,8 @@ describe('MetadataDocument', () => {/>,)- expect(screen.getByText('field_one')).toBeInTheDocument()- expect(screen.getByText('field_two')).toBeInTheDocument()+ expect(screen.getByText('field_one'))!.toBeInTheDocument()+ expect(screen.getByText('field_two'))!.toBeInTheDocument()})it('should pass datasetId to child components', () => {@@ -549,7 +550,8 @@ describe('MetadataDocument', () => {/>,)// Component should render without errors- expect(screen.getByText('field_one')).toBeInTheDocument()+ // Component should render without errors+ expect(screen.getByText('field_one'))!.toBeInTheDocument()})})@@ -588,6 +590,37 @@ describe('MetadataDocument', () => {/>,)+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered+ // NoData component should not be rendered// NoData component should not be renderedexpect(screen.queryByText(/start/i)).not.toBeInTheDocument()})@@ -607,6 +640,37 @@ describe('MetadataDocument', () => {/>,)+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined+ // headerRight should be null/undefined// headerRight should be null/undefinedexpect(screen.queryByText(/^edit$/i)).not.toBeInTheDocument()})@@ -628,7 +692,7 @@ describe('MetadataDocument', () => {docDetail={mockDocDetail as Parameters<typeof MetadataDocument>[0]['docDetail']}/>,)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})it('should render correctly with minimal props', () => {@@ -639,7 +703,7 @@ describe('MetadataDocument', () => {docDetail={mockDocDetail as Parameters<typeof MetadataDocument>[0]['docDetail']}/>,)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})it('should handle switching between view and edit mode', () => {@@ -651,7 +715,7 @@ describe('MetadataDocument', () => {/>,)- expect(screen.getByText(/edit/i)).toBeInTheDocument()+ expect(screen.getByText(/edit/i))!.toBeInTheDocument()unmount()@@ -668,8 +732,8 @@ describe('MetadataDocument', () => {/>,)- expect(screen.getByText(/save/i)).toBeInTheDocument()- expect(screen.getByText(/cancel/i)).toBeInTheDocument()+ expect(screen.getByText(/save/i))!.toBeInTheDocument()+ expect(screen.getByText(/cancel/i))!.toBeInTheDocument()})it('should handle multiple items in all sections', () => {@@ -702,11 +766,11 @@ describe('MetadataDocument', () => {/>,)- expect(screen.getByText('user_field_1')).toBeInTheDocument()- expect(screen.getByText('user_field_2')).toBeInTheDocument()- expect(screen.getByText('created_at')).toBeInTheDocument()- expect(screen.getByText('source')).toBeInTheDocument()- expect(screen.getByText('word_count')).toBeInTheDocument()+ expect(screen.getByText('user_field_1'))!.toBeInTheDocument()+ expect(screen.getByText('user_field_2'))!.toBeInTheDocument()+ expect(screen.getByText('created_at'))!.toBeInTheDocument()+ expect(screen.getByText('source'))!.toBeInTheDocument()+ expect(screen.getByText('word_count'))!.toBeInTheDocument()})it('should handle null values in metadata', () => {@@ -725,7 +789,7 @@ describe('MetadataDocument', () => {/>,)- expect(screen.getByText('null_field')).toBeInTheDocument()+ expect(screen.getByText('null_field'))!.toBeInTheDocument()})it('should handle undefined values in metadata', () => {@@ -744,7 +808,7 @@ describe('MetadataDocument', () => {/>,)- expect(screen.getByText('undefined_field')).toBeInTheDocument()+ expect(screen.getByText('undefined_field'))!.toBeInTheDocument()})})})diff --git a/web/app/components/datasets/metadata/metadata-document/__tests__/info-group.spec.tsx b/web/app/components/datasets/metadata/metadata-document/__tests__/info-group.spec.tsxindex d783b882a86..c176979a5a4 100644--- a/web/app/components/datasets/metadata/metadata-document/__tests__/info-group.spec.tsx+++ b/web/app/components/datasets/metadata/metadata-document/__tests__/info-group.spec.tsx@@ -90,14 +90,14 @@ describe('InfoGroup', () => {const { container } = render(<InfoGroup dataSetId="ds-1" list={mockList} />,)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})it('should render title when provided', () => {render(<InfoGroup dataSetId="ds-1" list={mockList} title="Test Title" />,)- expect(screen.getByText('Test Title')).toBeInTheDocument()+ expect(screen.getByText('Test Title'))!.toBeInTheDocument()})it('should not render header when noHeader is true', () => {@@ -126,7 +126,7 @@ describe('InfoGroup', () => {)// Tooltip icon should be presentconst tooltipIcon = screen.getByText('Test').closest('.flex')?.querySelector('svg')- expect(tooltipIcon).toBeInTheDocument()+ expect(tooltipIcon)!.toBeInTheDocument()})it('should render headerRight content', () => {@@ -138,7 +138,7 @@ describe('InfoGroup', () => {headerRight={<button data-testid="header-right-btn">Action</button>}/>,)- expect(screen.getByTestId('header-right-btn')).toBeInTheDocument()+ expect(screen.getByTestId('header-right-btn'))!.toBeInTheDocument()})})@@ -147,7 +147,7 @@ describe('InfoGroup', () => {render(<InfoGroup dataSetId="ds-1" list={mockList} isEdit />,)- expect(screen.getByTestId('add-metadata-btn')).toBeInTheDocument()+ expect(screen.getByTestId('add-metadata-btn'))!.toBeInTheDocument()})it('should not render add metadata button when isEdit is false', () => {@@ -182,7 +182,7 @@ describe('InfoGroup', () => {)const inputs = screen.getAllByTestId('input-combined')- fireEvent.change(inputs[0], { target: { value: 'New Value' } })+ fireEvent.change(inputs[0]!, { target: { value: 'New Value' } })expect(handleChange).toHaveBeenCalled()})@@ -196,7 +196,7 @@ describe('InfoGroup', () => {// Find delete icons (RiDeleteBinLine SVGs inside cursor-pointer divs)const deleteButtons = container.querySelectorAll('svg.size-4')if (deleteButtons.length > 0)- fireEvent.click(deleteButtons[0])+ fireEvent.click(deleteButtons[0]!)expect(handleDelete).toHaveBeenCalled()})@@ -239,7 +239,8 @@ describe('InfoGroup', () => {fireEvent.click(screen.getByTestId('manage-action'))// The onManage callback triggers the navigation- expect(screen.getByTestId('manage-action')).toBeInTheDocument()+ // The onManage callback triggers the navigation+ expect(screen.getByTestId('manage-action'))!.toBeInTheDocument()})})@@ -248,7 +249,7 @@ describe('InfoGroup', () => {const { container } = render(<InfoGroup dataSetId="ds-1" list={mockList} className="custom-class" />,)- expect(container.firstChild).toHaveClass('custom-class')+ expect(container.firstChild)!.toHaveClass('custom-class')})it('should apply contentClassName', () => {@@ -256,7 +257,7 @@ describe('InfoGroup', () => {<InfoGroup dataSetId="ds-1" list={mockList} contentClassName="content-custom" />,)const contentDiv = container.querySelector('.content-custom')- expect(contentDiv).toBeInTheDocument()+ expect(contentDiv)!.toBeInTheDocument()})it('should use uppercase title by default', () => {@@ -264,7 +265,7 @@ describe('InfoGroup', () => {<InfoGroup dataSetId="ds-1" list={mockList} title="Test Title" />,)const titleElement = screen.getByText('Test Title')- expect(titleElement).toHaveClass('system-xs-semibold-uppercase')+ expect(titleElement)!.toHaveClass('system-xs-semibold-uppercase')})it('should not use uppercase when uppercaseTitle is false', () => {@@ -272,7 +273,7 @@ describe('InfoGroup', () => {<InfoGroup dataSetId="ds-1" list={mockList} title="Test Title" uppercaseTitle={false} />,)const titleElement = screen.getByText('Test Title')- expect(titleElement).toHaveClass('system-md-semibold')+ expect(titleElement)!.toHaveClass('system-md-semibold')})})@@ -284,7 +285,7 @@ describe('InfoGroup', () => {render(<InfoGroup dataSetId="ds-1" list={stringList} />,)- expect(screen.getByText('Test Value')).toBeInTheDocument()+ expect(screen.getByText('Test Value'))!.toBeInTheDocument()})it('should display number value', () => {@@ -294,7 +295,7 @@ describe('InfoGroup', () => {render(<InfoGroup dataSetId="ds-1" list={numberList} />,)- expect(screen.getByText('123')).toBeInTheDocument()+ expect(screen.getByText('123'))!.toBeInTheDocument()})it('should format time value', () => {@@ -305,7 +306,8 @@ describe('InfoGroup', () => {<InfoGroup dataSetId="ds-1" list={timeList} />,)// The mock formatTime returns formatted date- expect(screen.getByTestId('field-content')).toBeInTheDocument()+ // The mock formatTime returns formatted date+ expect(screen.getByTestId('field-content'))!.toBeInTheDocument()})})@@ -314,7 +316,7 @@ describe('InfoGroup', () => {const { container } = render(<InfoGroup dataSetId="ds-1" list={[]} />,)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})it('should handle null value in list', () => {@@ -324,7 +326,7 @@ describe('InfoGroup', () => {render(<InfoGroup dataSetId="ds-1" list={nullList} />,)- expect(screen.getByTestId('field')).toBeInTheDocument()+ expect(screen.getByTestId('field'))!.toBeInTheDocument()})it('should handle items with built-in id', () => {@@ -334,7 +336,7 @@ describe('InfoGroup', () => {render(<InfoGroup dataSetId="ds-1" list={builtInList} />,)- expect(screen.getByTestId('field')).toBeInTheDocument()+ expect(screen.getByTestId('field'))!.toBeInTheDocument()})})})diff --git a/web/app/components/datasets/preview/__tests__/container.spec.tsx b/web/app/components/datasets/preview/__tests__/container.spec.tsxindex 86f6e3f85bf..473d91f8574 100644--- a/web/app/components/datasets/preview/__tests__/container.spec.tsx+++ b/web/app/components/datasets/preview/__tests__/container.spec.tsx@@ -12,16 +12,16 @@ describe('PreviewContainer', () => {it('should render header content in a header element', () => {render(<PreviewContainer header={<span>Header Title</span>}>Body</PreviewContainer>)- expect(screen.getByText('Header Title')).toBeInTheDocument()+ expect(screen.getByText('Header Title'))!.toBeInTheDocument()const headerEl = screen.getByText('Header Title').closest('header')- expect(headerEl).toBeInTheDocument()+ expect(headerEl)!.toBeInTheDocument()})it('should render children in a main element', () => {render(<PreviewContainer header="Header">Main content</PreviewContainer>)const mainEl = screen.getByRole('main')- expect(mainEl).toHaveTextContent('Main content')+ expect(mainEl)!.toHaveTextContent('Main content')})it('should render both header and children simultaneously', () => {@@ -31,14 +31,14 @@ describe('PreviewContainer', () => {</PreviewContainer>,)- expect(screen.getByText('My Header')).toBeInTheDocument()- expect(screen.getByText('Body paragraph')).toBeInTheDocument()+ expect(screen.getByText('My Header'))!.toBeInTheDocument()+ expect(screen.getByText('Body paragraph'))!.toBeInTheDocument()})it('should render without children', () => {render(<PreviewContainer header="Header" />)- expect(screen.getByRole('main')).toBeInTheDocument()+ expect(screen.getByRole('main'))!.toBeInTheDocument()expect(screen.getByRole('main').childElementCount).toBe(0)})})@@ -49,7 +49,7 @@ describe('PreviewContainer', () => {<PreviewContainer header="Header" className="outer-class">Content</PreviewContainer>,)- expect(container.firstElementChild).toHaveClass('outer-class')+ expect(container.firstElementChild)!.toHaveClass('outer-class')})it('should apply mainClassName to the main element', () => {@@ -58,9 +58,10 @@ describe('PreviewContainer', () => {)const mainEl = screen.getByRole('main')- expect(mainEl).toHaveClass('custom-main')+ expect(mainEl)!.toHaveClass('custom-main')// Default classes should still be present- expect(mainEl).toHaveClass('w-full', 'grow', 'overflow-y-auto', 'px-6', 'py-5')+ // Default classes should still be present+ expect(mainEl)!.toHaveClass('w-full', 'grow', 'overflow-y-auto', 'px-6', 'py-5')})it('should forward ref to the inner container div', () => {@@ -70,7 +71,7 @@ describe('PreviewContainer', () => {)expect(ref).toHaveBeenCalled()- const refArg = ref.mock.calls[0][0]+ const refArg = ref.mock.calls[0]![0]expect(refArg).toBeInstanceOf(HTMLDivElement)})@@ -82,7 +83,7 @@ describe('PreviewContainer', () => {)const inner = screen.getByTestId('inner-container')- expect(inner).toHaveAttribute('id', 'container-1')+ expect(inner)!.toHaveAttribute('id', 'container-1')})it('should render ReactNode as header', () => {@@ -92,8 +93,8 @@ describe('PreviewContainer', () => {</PreviewContainer>,)- expect(screen.getByTestId('complex-header')).toBeInTheDocument()- expect(screen.getByText('Complex')).toBeInTheDocument()+ expect(screen.getByTestId('complex-header'))!.toBeInTheDocument()+ expect(screen.getByText('Complex'))!.toBeInTheDocument()})})@@ -103,7 +104,7 @@ describe('PreviewContainer', () => {render(<PreviewContainer header="Header">Content</PreviewContainer>)const headerEl = screen.getByText('Header').closest('header')- expect(headerEl).toHaveClass('border-b', 'border-divider-subtle')+ expect(headerEl)!.toHaveClass('border-b', 'border-divider-subtle')})it('should have inner div with flex column layout', () => {@@ -112,13 +113,13 @@ describe('PreviewContainer', () => {)const inner = screen.getByTestId('inner')- expect(inner).toHaveClass('flex', 'h-full', 'w-full', 'flex-col')+ expect(inner)!.toHaveClass('flex', 'h-full', 'w-full', 'flex-col')})it('should have main with overflow-y-auto for scrolling', () => {render(<PreviewContainer header="Header">Content</PreviewContainer>)- expect(screen.getByRole('main')).toHaveClass('overflow-y-auto')+ expect(screen.getByRole('main'))!.toHaveClass('overflow-y-auto')})})@@ -134,13 +135,13 @@ describe('PreviewContainer', () => {render(<PreviewContainer header="">Content</PreviewContainer>)const headerEl = screen.getByRole('banner')- expect(headerEl).toBeInTheDocument()+ expect(headerEl)!.toBeInTheDocument()})it('should render with null children', () => {render(<PreviewContainer header="Header">{null}</PreviewContainer>)- expect(screen.getByRole('main')).toBeInTheDocument()+ expect(screen.getByRole('main'))!.toBeInTheDocument()})it('should render with multiple children', () => {@@ -152,9 +153,9 @@ describe('PreviewContainer', () => {</PreviewContainer>,)- expect(screen.getByText('Child 1')).toBeInTheDocument()- expect(screen.getByText('Child 2')).toBeInTheDocument()- expect(screen.getByText('Child 3')).toBeInTheDocument()+ expect(screen.getByText('Child 1'))!.toBeInTheDocument()+ expect(screen.getByText('Child 2'))!.toBeInTheDocument()+ expect(screen.getByText('Child 3'))!.toBeInTheDocument()})it('should not crash on re-render with different props', () => {@@ -166,8 +167,8 @@ describe('PreviewContainer', () => {<PreviewContainer header="Second" className="b" mainClassName="new-main">Content B</PreviewContainer>,)- expect(screen.getByText('Second')).toBeInTheDocument()- expect(screen.getByText('Content B')).toBeInTheDocument()+ expect(screen.getByText('Second'))!.toBeInTheDocument()+ expect(screen.getByText('Content B'))!.toBeInTheDocument()})})})diff --git a/web/app/components/datasets/rename-modal/__tests__/index.spec.tsx b/web/app/components/datasets/rename-modal/__tests__/index.spec.tsxindex dbae959d8d3..600e6c3434e 100644--- a/web/app/components/datasets/rename-modal/__tests__/index.spec.tsx+++ b/web/app/components/datasets/rename-modal/__tests__/index.spec.tsx@@ -138,43 +138,46 @@ describe('RenameDatasetModal', () => {it('should render without crashing', () => {render(<RenameDatasetModal {...defaultProps} />)// Check title is rendered (translation mock returns 'datasetSettings.title')- expect(screen.getByText('datasetSettings.title')).toBeInTheDocument()+ // Check title is rendered (translation mock returns 'datasetSettings.title')+ expect(screen.getByText('datasetSettings.title'))!.toBeInTheDocument()})it('should render modal when show is true', () => {render(<RenameDatasetModal {...defaultProps} show={true} />)- expect(screen.getByText('datasetSettings.title')).toBeInTheDocument()+ expect(screen.getByText('datasetSettings.title'))!.toBeInTheDocument()})it('should render name input with dataset name', () => {render(<RenameDatasetModal {...defaultProps} />)const nameInput = screen.getByDisplayValue('Test Dataset')- expect(nameInput).toBeInTheDocument()+ expect(nameInput)!.toBeInTheDocument()})it('should render description textarea with dataset description', () => {render(<RenameDatasetModal {...defaultProps} />)const descriptionTextarea = screen.getByDisplayValue('Test description')- expect(descriptionTextarea).toBeInTheDocument()+ expect(descriptionTextarea)!.toBeInTheDocument()})it('should render cancel and save buttons', () => {render(<RenameDatasetModal {...defaultProps} />)- expect(screen.getByText('common.operation.cancel')).toBeInTheDocument()- expect(screen.getByText('common.operation.save')).toBeInTheDocument()+ expect(screen.getByText('common.operation.cancel'))!.toBeInTheDocument()+ expect(screen.getByText('common.operation.save'))!.toBeInTheDocument()})it('should render close icon button', () => {render(<RenameDatasetModal {...defaultProps} />)// The modal renders with title and other elements// The close functionality is tested in user interactions- expect(screen.getByText('datasetSettings.title')).toBeInTheDocument()+ // The modal renders with title and other elements+ // The close functionality is tested in user interactions+ expect(screen.getByText('datasetSettings.title'))!.toBeInTheDocument()})it('should render form labels', () => {render(<RenameDatasetModal {...defaultProps} />)- expect(screen.getByText('datasetSettings.form.name')).toBeInTheDocument()- expect(screen.getByText('datasetSettings.form.desc')).toBeInTheDocument()+ expect(screen.getByText('datasetSettings.form.name'))!.toBeInTheDocument()+ expect(screen.getByText('datasetSettings.form.desc'))!.toBeInTheDocument()})})@@ -182,13 +185,13 @@ describe('RenameDatasetModal', () => {it('should render with emoji icon dataset', () => {const dataset = createMockDataset()render(<RenameDatasetModal {...defaultProps} dataset={dataset} />)- expect(screen.getByDisplayValue('Test Dataset')).toBeInTheDocument()+ expect(screen.getByDisplayValue('Test Dataset'))!.toBeInTheDocument()})it('should render with image icon dataset', () => {const dataset = createMockDatasetWithImageIcon()render(<RenameDatasetModal {...defaultProps} dataset={dataset} />)- expect(screen.getByDisplayValue('Test Dataset')).toBeInTheDocument()+ expect(screen.getByDisplayValue('Test Dataset'))!.toBeInTheDocument()})it('should render with empty description', () => {@@ -196,30 +199,30 @@ describe('RenameDatasetModal', () => {render(<RenameDatasetModal {...defaultProps} dataset={dataset} />)// Find the textarea by its placeholderconst descriptionTextarea = screen.getByPlaceholderText('datasetSettings.form.descPlaceholder')- expect(descriptionTextarea).toHaveValue('')+ expect(descriptionTextarea)!.toHaveValue('')})it('should render with external knowledge dataset', () => {const dataset = createMockExternalDataset()render(<RenameDatasetModal {...defaultProps} dataset={dataset} />)- expect(screen.getByDisplayValue('Test Dataset')).toBeInTheDocument()+ expect(screen.getByDisplayValue('Test Dataset'))!.toBeInTheDocument()})it('should handle undefined onSuccess callback', () => {render(<RenameDatasetModal {...defaultProps} onSuccess={undefined} />)- expect(screen.getByDisplayValue('Test Dataset')).toBeInTheDocument()+ expect(screen.getByDisplayValue('Test Dataset'))!.toBeInTheDocument()})})describe('State Management', () => {it('should initialize name state with dataset name', () => {render(<RenameDatasetModal {...defaultProps} />)- expect(screen.getByDisplayValue('Test Dataset')).toBeInTheDocument()+ expect(screen.getByDisplayValue('Test Dataset'))!.toBeInTheDocument()})it('should initialize description state with dataset description', () => {render(<RenameDatasetModal {...defaultProps} />)- expect(screen.getByDisplayValue('Test description')).toBeInTheDocument()+ expect(screen.getByDisplayValue('Test description'))!.toBeInTheDocument()})it('should update name state when input changes', () => {@@ -228,7 +231,7 @@ describe('RenameDatasetModal', () => {fireEvent.change(nameInput, { target: { value: 'New Dataset Name' } })- expect(screen.getByDisplayValue('New Dataset Name')).toBeInTheDocument()+ expect(screen.getByDisplayValue('New Dataset Name'))!.toBeInTheDocument()})it('should update description state when textarea changes', () => {@@ -237,7 +240,7 @@ describe('RenameDatasetModal', () => {fireEvent.change(descriptionTextarea, { target: { value: 'New description' } })- expect(screen.getByDisplayValue('New description')).toBeInTheDocument()+ expect(screen.getByDisplayValue('New description'))!.toBeInTheDocument()})it('should clear name when input is cleared', () => {@@ -246,7 +249,7 @@ describe('RenameDatasetModal', () => {fireEvent.change(nameInput, { target: { value: '' } })- expect(nameInput).toHaveValue('')+ expect(nameInput)!.toHaveValue('')})it('should handle special characters in name', () => {@@ -255,7 +258,7 @@ describe('RenameDatasetModal', () => {fireEvent.change(nameInput, { target: { value: 'Dataset <script>alert("xss")</script>' } })- expect(screen.getByDisplayValue('Dataset <script>alert("xss")</script>')).toBeInTheDocument()+ expect(screen.getByDisplayValue('Dataset <script>alert("xss")</script>'))!.toBeInTheDocument()})it('should handle very long name input', () => {@@ -265,7 +268,7 @@ describe('RenameDatasetModal', () => {fireEvent.change(nameInput, { target: { value: longName } })- expect(screen.getByDisplayValue(longName)).toBeInTheDocument()+ expect(screen.getByDisplayValue(longName))!.toBeInTheDocument()})it('should handle multiline description', () => {@@ -276,7 +279,8 @@ describe('RenameDatasetModal', () => {fireEvent.change(descriptionTextarea, { target: { value: multilineDesc } })// Verify the textarea contains the multiline value- expect(descriptionTextarea).toHaveValue(multilineDesc)+ // Verify the textarea contains the multiline value+ expect(descriptionTextarea)!.toHaveValue(multilineDesc)})})@@ -338,7 +342,7 @@ describe('RenameDatasetModal', () => {})await waitFor(() => {- expect(saveButton).toBeDisabled()+ expect(saveButton)!.toBeDisabled()})// Resolve the promise to clean up@@ -354,6 +358,37 @@ describe('RenameDatasetModal', () => {// Verify the input can receive focusnameInput.focus()+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)+ // Just verify the element is focusable (don't check activeElement as it may differ in test environment)// Just verify the element is focusable (don't check activeElement as it may differ in test environment)expect(nameInput).not.toBeDisabled()})@@ -365,6 +400,37 @@ describe('RenameDatasetModal', () => {// Verify the textarea can receive focusdescriptionTextarea.focus()+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable+ // Just verify the element is focusable// Just verify the element is focusableexpect(descriptionTextarea).not.toBeDisabled()})@@ -429,7 +495,7 @@ describe('RenameDatasetModal', () => {await waitFor(() => {expect(mockUpdateDatasetSetting).toHaveBeenCalled()- const callArgs = mockUpdateDatasetSetting.mock.calls[0][0]+ const callArgs = mockUpdateDatasetSetting.mock.calls[0]![0]expect(callArgs.body.external_knowledge_id).toBeUndefined()expect(callArgs.body.external_knowledge_api_id).toBeUndefined()})@@ -604,6 +670,37 @@ describe('RenameDatasetModal', () => {expect(mockToast.error).toHaveBeenCalled()})+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again+ // Save button should be enabled again// Save button should be enabled againexpect(saveButton).not.toBeDisabled()})@@ -660,8 +757,10 @@ describe('RenameDatasetModal', () => {render(<RenameDatasetModal {...defaultProps} />)// The modal should render with name label and input// AppIcon is rendered alongside the name input- expect(screen.getByText('datasetSettings.form.name')).toBeInTheDocument()- expect(screen.getByDisplayValue('Test Dataset')).toBeInTheDocument()+ // The modal should render with name label and input+ // AppIcon is rendered alongside the name input+ expect(screen.getByText('datasetSettings.form.name'))!.toBeInTheDocument()+ expect(screen.getByDisplayValue('Test Dataset'))!.toBeInTheDocument()})it('should initialize icon state from dataset', () => {@@ -669,14 +768,16 @@ describe('RenameDatasetModal', () => {render(<RenameDatasetModal {...defaultProps} />)// The component initializes with the dataset's icon_info// This is verified by checking the form renders correctly- expect(screen.getByDisplayValue('Test Dataset')).toBeInTheDocument()+ // The component initializes with the dataset's icon_info+ // This is verified by checking the form renders correctly+ expect(screen.getByDisplayValue('Test Dataset'))!.toBeInTheDocument()})it('should initialize icon state from image icon dataset', () => {// Test with image icon - this triggers the icon_type === 'image' branchconst imageDataset = createMockDatasetWithImageIcon()render(<RenameDatasetModal {...defaultProps} dataset={imageDataset} />)- expect(screen.getByDisplayValue('Test Dataset')).toBeInTheDocument()+ expect(screen.getByDisplayValue('Test Dataset'))!.toBeInTheDocument()// The component should render successfully with image icon dataset})@@ -734,6 +835,37 @@ describe('RenameDatasetModal', () => {it('should open icon picker when app icon is clicked (handleOpenAppIconPicker)', async () => {render(<RenameDatasetModal {...defaultProps} />)+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible+ // Initially picker should not be visible// Initially picker should not be visibleexpect(screen.queryByTestId('app-icon-picker')).not.toBeInTheDocument()@@ -743,7 +875,8 @@ describe('RenameDatasetModal', () => {})// Picker should now be visible- expect(screen.getByTestId('app-icon-picker')).toBeInTheDocument()+ // Picker should now be visible+ expect(screen.getByTestId('app-icon-picker'))!.toBeInTheDocument()})it('should select emoji icon and close picker (handleSelectAppIcon)', async () => {@@ -761,6 +894,37 @@ describe('RenameDatasetModal', () => {fireEvent.click(selectEmojiBtn)})+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection// Picker should close after selectionexpect(screen.queryByTestId('app-icon-picker')).not.toBeInTheDocument()@@ -800,6 +964,37 @@ describe('RenameDatasetModal', () => {fireEvent.click(selectImageBtn)})+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection+ // Picker should close after selection// Picker should close after selectionexpect(screen.queryByTestId('app-icon-picker')).not.toBeInTheDocument()@@ -839,6 +1034,37 @@ describe('RenameDatasetModal', () => {fireEvent.click(closeBtn)})+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close+ // Picker should close// Picker should closeexpect(screen.queryByTestId('app-icon-picker')).not.toBeInTheDocument()@@ -876,7 +1102,7 @@ describe('RenameDatasetModal', () => {})render(<RenameDatasetModal {...defaultProps} dataset={dataset} />)- expect(screen.getByDisplayValue('Test Dataset')).toBeInTheDocument()+ expect(screen.getByDisplayValue('Test Dataset'))!.toBeInTheDocument()})it('should handle image icon with empty icon_url', async () => {@@ -891,7 +1117,7 @@ describe('RenameDatasetModal', () => {})render(<RenameDatasetModal {...defaultProps} dataset={dataset} />)- expect(screen.getByDisplayValue('Test Dataset')).toBeInTheDocument()+ expect(screen.getByDisplayValue('Test Dataset'))!.toBeInTheDocument()// Save and verify the icon_url is handled correctlyconst saveButton = screen.getByText('common.operation.save')@@ -925,7 +1151,7 @@ describe('RenameDatasetModal', () => {})render(<RenameDatasetModal {...defaultProps} dataset={dataset} />)- expect(screen.getByDisplayValue('Test Dataset')).toBeInTheDocument()+ expect(screen.getByDisplayValue('Test Dataset'))!.toBeInTheDocument()// Save and verify the icon is handled correctlyconst saveButton = screen.getByText('common.operation.save')@@ -958,7 +1184,7 @@ describe('RenameDatasetModal', () => {})render(<RenameDatasetModal {...defaultProps} dataset={dataset} />)- expect(screen.getByDisplayValue('Test Dataset')).toBeInTheDocument()+ expect(screen.getByDisplayValue('Test Dataset'))!.toBeInTheDocument()})it('should handle rapid input changes', async () => {@@ -975,7 +1201,7 @@ describe('RenameDatasetModal', () => {fireEvent.change(nameInput, { target: { value: 'New Nam' } })fireEvent.change(nameInput, { target: { value: 'New Name' } })- expect(screen.getByDisplayValue('New Name')).toBeInTheDocument()+ expect(screen.getByDisplayValue('New Name'))!.toBeInTheDocument()})it('should handle double click on save button', async () => {@@ -995,7 +1221,8 @@ describe('RenameDatasetModal', () => {})// Button should be disabled now- expect(saveButton).toBeDisabled()+ // Button should be disabled now+ expect(saveButton)!.toBeDisabled()// Second click should not trigger another API call because button is disabledawait act(async () => {@@ -1017,7 +1244,7 @@ describe('RenameDatasetModal', () => {fireEvent.change(nameInput, { target: { value: '数据集 🎉 Dataset' } })- expect(screen.getByDisplayValue('数据集 🎉 Dataset')).toBeInTheDocument()+ expect(screen.getByDisplayValue('数据集 🎉 Dataset'))!.toBeInTheDocument()})it('should handle unicode characters in description', () => {@@ -1026,7 +1253,7 @@ describe('RenameDatasetModal', () => {fireEvent.change(descriptionTextarea, { target: { value: '这是一个测试描述 🚀' } })- expect(screen.getByDisplayValue('这是一个测试描述 🚀')).toBeInTheDocument()+ expect(screen.getByDisplayValue('这是一个测试描述 🚀'))!.toBeInTheDocument()})it('should preserve whitespace in description', () => {@@ -1036,7 +1263,7 @@ describe('RenameDatasetModal', () => {const testValue = 'Leading spaces with content'fireEvent.change(descriptionTextarea, { target: { value: testValue } })- expect(descriptionTextarea).toHaveValue(testValue)+ expect(descriptionTextarea)!.toHaveValue(testValue)})})@@ -1044,20 +1271,22 @@ describe('RenameDatasetModal', () => {it('should update when dataset prop changes', () => {const { rerender } = render(<RenameDatasetModal {...defaultProps} />)- expect(screen.getByDisplayValue('Test Dataset')).toBeInTheDocument()+ expect(screen.getByDisplayValue('Test Dataset'))!.toBeInTheDocument()const newDataset = createMockDataset({ name: 'Different Dataset', description: 'Different description' })rerender(<RenameDatasetModal {...defaultProps} dataset={newDataset} />)// Note: The component uses useState with initial value, so it won't update// This tests that the initial render works correctly with different props- expect(screen.getByDisplayValue('Test Dataset')).toBeInTheDocument()+ // Note: The component uses useState with initial value, so it won't update+ // This tests that the initial render works correctly with different props+ expect(screen.getByDisplayValue('Test Dataset'))!.toBeInTheDocument()})it('should handle show prop toggle', () => {const { rerender } = render(<RenameDatasetModal {...defaultProps} show={true} />)- expect(screen.getByText('datasetSettings.title')).toBeInTheDocument()+ expect(screen.getByText('datasetSettings.title'))!.toBeInTheDocument()rerender(<RenameDatasetModal {...defaultProps} show={false} />)@@ -1084,8 +1313,8 @@ describe('RenameDatasetModal', () => {const cancelButton = screen.getByText('common.operation.cancel')const saveButton = screen.getByText('common.operation.save')- expect(cancelButton).toBeEnabled()- expect(saveButton).toBeEnabled()+ expect(cancelButton)!.toBeEnabled()+ expect(saveButton)!.toBeEnabled()})})@@ -1105,7 +1334,7 @@ describe('RenameDatasetModal', () => {// Button should be disabled during loadingawait waitFor(() => {- expect(saveButton).toBeDisabled()+ expect(saveButton)!.toBeDisabled()})// Resolve promise to complete the test@@ -1148,6 +1377,37 @@ describe('RenameDatasetModal', () => {expect(mockToast.error).toHaveBeenCalledWith('common.actionMsg.modifiedUnsuccessfully')})+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error+ // Button should be re-enabled after error// Button should be re-enabled after errorexpect(saveButton).not.toBeDisabled()})diff --git a/web/app/components/datasets/settings/chunk-structure/__tests__/hooks.spec.tsx b/web/app/components/datasets/settings/chunk-structure/__tests__/hooks.spec.tsxindex 8d44d19d09f..518c74d0e11 100644--- a/web/app/components/datasets/settings/chunk-structure/__tests__/hooks.spec.tsx+++ b/web/app/components/datasets/settings/chunk-structure/__tests__/hooks.spec.tsx@@ -23,49 +23,49 @@ describe('useChunkStructure', () => {const { result } = renderHook(() => useChunkStructure())const generalOption = result.current.options[0]- expect(generalOption.id).toBe('text_model')+ expect(generalOption!.id).toBe('text_model')})it('should have icon for General option', () => {const { result } = renderHook(() => useChunkStructure())const generalOption = result.current.options[0]- expect(generalOption.icon).toBeDefined()+ expect(generalOption!.icon).toBeDefined()})it('should have correct iconActiveColor for General option', () => {const { result } = renderHook(() => useChunkStructure())const generalOption = result.current.options[0]- expect(generalOption.iconActiveColor).toBe('text-util-colors-indigo-indigo-600')+ expect(generalOption!.iconActiveColor).toBe('text-util-colors-indigo-indigo-600')})it('should have title for General option', () => {const { result } = renderHook(() => useChunkStructure())const generalOption = result.current.options[0]- expect(generalOption.title).toBe('General')+ expect(generalOption!.title).toBe('General')})it('should have description for General option', () => {const { result } = renderHook(() => useChunkStructure())const generalOption = result.current.options[0]- expect(generalOption.description).toBeDefined()+ expect(generalOption!.description).toBeDefined()})it('should have indigo effectColor for General option', () => {const { result } = renderHook(() => useChunkStructure())const generalOption = result.current.options[0]- expect(generalOption.effectColor).toBe(EffectColor.indigo)+ expect(generalOption!.effectColor).toBe(EffectColor.indigo)})it('should have showEffectColor true for General option', () => {const { result } = renderHook(() => useChunkStructure())const generalOption = result.current.options[0]- expect(generalOption.showEffectColor).toBe(true)+ expect(generalOption!.showEffectColor).toBe(true)})})@@ -74,49 +74,49 @@ describe('useChunkStructure', () => {const { result } = renderHook(() => useChunkStructure())const parentChildOption = result.current.options[1]- expect(parentChildOption.id).toBe('hierarchical_model')+ expect(parentChildOption!.id).toBe('hierarchical_model')})it('should have icon for Parent-Child option', () => {const { result } = renderHook(() => useChunkStructure())const parentChildOption = result.current.options[1]- expect(parentChildOption.icon).toBeDefined()+ expect(parentChildOption!.icon).toBeDefined()})it('should have correct iconActiveColor for Parent-Child option', () => {const { result } = renderHook(() => useChunkStructure())const parentChildOption = result.current.options[1]- expect(parentChildOption.iconActiveColor).toBe('text-util-colors-blue-light-blue-light-500')+ expect(parentChildOption!.iconActiveColor).toBe('text-util-colors-blue-light-blue-light-500')})it('should have title for Parent-Child option', () => {const { result } = renderHook(() => useChunkStructure())const parentChildOption = result.current.options[1]- expect(parentChildOption.title).toBe('Parent-Child')+ expect(parentChildOption!.title).toBe('Parent-Child')})it('should have description for Parent-Child option', () => {const { result } = renderHook(() => useChunkStructure())const parentChildOption = result.current.options[1]- expect(parentChildOption.description).toBeDefined()+ expect(parentChildOption!.description).toBeDefined()})it('should have blueLight effectColor for Parent-Child option', () => {const { result } = renderHook(() => useChunkStructure())const parentChildOption = result.current.options[1]- expect(parentChildOption.effectColor).toBe(EffectColor.blueLight)+ expect(parentChildOption!.effectColor).toBe(EffectColor.blueLight)})it('should have showEffectColor true for Parent-Child option', () => {const { result } = renderHook(() => useChunkStructure())const parentChildOption = result.current.options[1]- expect(parentChildOption.showEffectColor).toBe(true)+ expect(parentChildOption!.showEffectColor).toBe(true)})})@@ -125,49 +125,49 @@ describe('useChunkStructure', () => {const { result } = renderHook(() => useChunkStructure())const qaOption = result.current.options[2]- expect(qaOption.id).toBe('qa_model')+ expect(qaOption!.id).toBe('qa_model')})it('should have icon for Q&A option', () => {const { result } = renderHook(() => useChunkStructure())const qaOption = result.current.options[2]- expect(qaOption.icon).toBeDefined()+ expect(qaOption!.icon).toBeDefined()})it('should have title for Q&A option', () => {const { result } = renderHook(() => useChunkStructure())const qaOption = result.current.options[2]- expect(qaOption.title).toBe('Q&A')+ expect(qaOption!.title).toBe('Q&A')})it('should have description for Q&A option', () => {const { result } = renderHook(() => useChunkStructure())const qaOption = result.current.options[2]- expect(qaOption.description).toBeDefined()+ expect(qaOption!.description).toBeDefined()})it('should not have effectColor for Q&A option', () => {const { result } = renderHook(() => useChunkStructure())const qaOption = result.current.options[2]- expect(qaOption.effectColor).toBeUndefined()+ expect(qaOption!.effectColor).toBeUndefined()})it('should not have showEffectColor for Q&A option', () => {const { result } = renderHook(() => useChunkStructure())const qaOption = result.current.options[2]- expect(qaOption.showEffectColor).toBeUndefined()+ expect(qaOption!.showEffectColor).toBeUndefined()})it('should not have iconActiveColor for Q&A option', () => {const { result } = renderHook(() => useChunkStructure())const qaOption = result.current.options[2]- expect(qaOption.iconActiveColor).toBeUndefined()+ expect(qaOption!.iconActiveColor).toBeUndefined()})})diff --git a/web/app/components/datasets/settings/form/components/__tests__/basic-info-section.spec.tsx b/web/app/components/datasets/settings/form/components/__tests__/basic-info-section.spec.tsxindex 618a28d498f..f34269f0589 100644--- a/web/app/components/datasets/settings/form/components/__tests__/basic-info-section.spec.tsx+++ b/web/app/components/datasets/settings/form/components/__tests__/basic-info-section.spec.tsx@@ -142,42 +142,43 @@ describe('BasicInfoSection', () => {describe('Rendering', () => {it('should render without crashing', () => {render(<BasicInfoSection {...defaultProps} />)- expect(screen.getByText(/form\.nameAndIcon/i)).toBeInTheDocument()+ expect(screen.getByText(/form\.nameAndIcon/i))!.toBeInTheDocument()})it('should render name and icon section', () => {render(<BasicInfoSection {...defaultProps} />)- expect(screen.getByText(/form\.nameAndIcon/i)).toBeInTheDocument()+ expect(screen.getByText(/form\.nameAndIcon/i))!.toBeInTheDocument()})it('should render description section', () => {render(<BasicInfoSection {...defaultProps} />)- expect(screen.getByText(/form\.desc/i)).toBeInTheDocument()+ expect(screen.getByText(/form\.desc/i))!.toBeInTheDocument()})it('should render permissions section', () => {render(<BasicInfoSection {...defaultProps} />)// Use exact match to avoid matching "permissionsOnlyMe"- expect(screen.getByText('datasetSettings.form.permissions')).toBeInTheDocument()+ // Use exact match to avoid matching "permissionsOnlyMe"+ expect(screen.getByText('datasetSettings.form.permissions'))!.toBeInTheDocument()})it('should render name input with correct value', () => {render(<BasicInfoSection {...defaultProps} />)const nameInput = screen.getByDisplayValue('Test Dataset')- expect(nameInput).toBeInTheDocument()+ expect(nameInput)!.toBeInTheDocument()})it('should render description textarea with correct value', () => {render(<BasicInfoSection {...defaultProps} />)const descriptionTextarea = screen.getByDisplayValue('Test description')- expect(descriptionTextarea).toBeInTheDocument()+ expect(descriptionTextarea)!.toBeInTheDocument()})it('should render app icon with emoji', () => {const { container } = render(<BasicInfoSection {...defaultProps} />)// The icon section should be rendered (emoji may be in a span or SVG)const iconSection = container.querySelector('[class*="cursor-pointer"]')- expect(iconSection).toBeInTheDocument()+ expect(iconSection)!.toBeInTheDocument()})})@@ -197,7 +198,7 @@ describe('BasicInfoSection', () => {render(<BasicInfoSection {...defaultProps} currentDataset={datasetWithoutEmbedding} />)const nameInput = screen.getByDisplayValue('Test Dataset')- expect(nameInput).toBeDisabled()+ expect(nameInput)!.toBeDisabled()})it('should enable name input when embedding is available', () => {@@ -212,7 +213,7 @@ describe('BasicInfoSection', () => {// Find the name input by its structure - may be type=text or just inputconst nameInput = container.querySelector('input')- expect(nameInput).toHaveValue('')+ expect(nameInput)!.toHaveValue('')})})@@ -232,14 +233,14 @@ describe('BasicInfoSection', () => {render(<BasicInfoSection {...defaultProps} currentDataset={datasetWithoutEmbedding} />)const descriptionTextarea = screen.getByDisplayValue('Test description')- expect(descriptionTextarea).toBeDisabled()+ expect(descriptionTextarea)!.toBeDisabled()})it('should render placeholder', () => {render(<BasicInfoSection {...defaultProps} description="" />)const descriptionTextarea = screen.getByPlaceholderText(/form\.descPlaceholder/i)- expect(descriptionTextarea).toBeInTheDocument()+ expect(descriptionTextarea)!.toBeInTheDocument()})})@@ -261,12 +262,45 @@ describe('BasicInfoSection', () => {// AppIconPicker renders a modal with emoji tabs and options via portal// We just verify the component renders without crashing when picker is shown- expect(baseElement).toBeInTheDocument()+ // AppIconPicker renders a modal with emoji tabs and options via portal+ // We just verify the component renders without crashing when picker is shown+ expect(baseElement)!.toBeInTheDocument()})it('should not render AppIconPicker when showAppIconPicker is false', () => {const { container } = render(<BasicInfoSection {...defaultProps} showAppIconPicker={false} />)+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered+ // Check that AppIconPicker is not rendered// Check that AppIconPicker is not renderedexpect(container.querySelector('[data-testid="app-icon-picker"]')).not.toBeInTheDocument()})@@ -283,7 +317,7 @@ describe('BasicInfoSection', () => {// For image type, it renders an img elementconst img = screen.queryByRole('img')if (img) {- expect(img).toHaveAttribute('src', expect.stringContaining('icon.png'))+ expect(img)!.toHaveAttribute('src', expect.stringContaining('icon.png'))}})})@@ -292,13 +326,13 @@ describe('BasicInfoSection', () => {it('should render with correct permission value', () => {render(<BasicInfoSection {...defaultProps} permission={DatasetPermission.onlyMe} />)- expect(screen.getByText(/form\.permissionsOnlyMe/i)).toBeInTheDocument()+ expect(screen.getByText(/form\.permissionsOnlyMe/i))!.toBeInTheDocument()})it('should render all team members permission', () => {render(<BasicInfoSection {...defaultProps} permission={DatasetPermission.allTeamMembers} />)- expect(screen.getByText(/form\.permissionsAllMember/i)).toBeInTheDocument()+ expect(screen.getByText(/form\.permissionsAllMember/i))!.toBeInTheDocument()})it('should be disabled when embedding is not available', () => {@@ -309,7 +343,7 @@ describe('BasicInfoSection', () => {// Check for disabled state via cursor-not-allowed classconst disabledElement = container.querySelector('[class*="cursor-not-allowed"]')- expect(disabledElement).toBeInTheDocument()+ expect(disabledElement)!.toBeInTheDocument()})it('should be disabled when user is dataset operator', () => {@@ -318,7 +352,7 @@ describe('BasicInfoSection', () => {)const disabledElement = container.querySelector('[class*="cursor-not-allowed"]')- expect(disabledElement).toBeInTheDocument()+ expect(disabledElement)!.toBeInTheDocument()})it('should call setPermission when permission changes', async () => {@@ -330,7 +364,7 @@ describe('BasicInfoSection', () => {await waitFor(() => {const allMemberOptions = screen.getAllByText(/form\.permissionsAllMember/i)- fireEvent.click(allMemberOptions[0])+ fireEvent.click(allMemberOptions[0]!)})expect(setPermission).toHaveBeenCalledWith(DatasetPermission.allTeamMembers)@@ -349,7 +383,10 @@ describe('BasicInfoSection', () => {// For partial members permission, the member selector should be visible// The exact interaction depends on the MemberSelector component// We verify the component renders without crashing- expect(container).toBeInTheDocument()+ // For partial members permission, the member selector should be visible+ // The exact interaction depends on the MemberSelector component+ // We verify the component renders without crashing+ expect(container)!.toBeInTheDocument()})})@@ -358,7 +395,8 @@ describe('BasicInfoSection', () => {render(<BasicInfoSection {...defaultProps} currentDataset={undefined} />)// Should still render but inputs might behave differently- expect(screen.getByText(/form\.nameAndIcon/i)).toBeInTheDocument()+ // Should still render but inputs might behave differently+ expect(screen.getByText(/form\.nameAndIcon/i))!.toBeInTheDocument()})})@@ -366,31 +404,31 @@ describe('BasicInfoSection', () => {it('should update when name prop changes', () => {const { rerender } = render(<BasicInfoSection {...defaultProps} name="Initial Name" />)- expect(screen.getByDisplayValue('Initial Name')).toBeInTheDocument()+ expect(screen.getByDisplayValue('Initial Name'))!.toBeInTheDocument()rerender(<BasicInfoSection {...defaultProps} name="Updated Name" />)- expect(screen.getByDisplayValue('Updated Name')).toBeInTheDocument()+ expect(screen.getByDisplayValue('Updated Name'))!.toBeInTheDocument()})it('should update when description prop changes', () => {const { rerender } = render(<BasicInfoSection {...defaultProps} description="Initial Description" />)- expect(screen.getByDisplayValue('Initial Description')).toBeInTheDocument()+ expect(screen.getByDisplayValue('Initial Description'))!.toBeInTheDocument()rerender(<BasicInfoSection {...defaultProps} description="Updated Description" />)- expect(screen.getByDisplayValue('Updated Description')).toBeInTheDocument()+ expect(screen.getByDisplayValue('Updated Description'))!.toBeInTheDocument()})it('should update when permission prop changes', () => {const { rerender } = render(<BasicInfoSection {...defaultProps} permission={DatasetPermission.onlyMe} />)- expect(screen.getByText(/form\.permissionsOnlyMe/i)).toBeInTheDocument()+ expect(screen.getByText(/form\.permissionsOnlyMe/i))!.toBeInTheDocument()rerender(<BasicInfoSection {...defaultProps} permission={DatasetPermission.allTeamMembers} />)- expect(screen.getByText(/form\.permissionsAllMember/i)).toBeInTheDocument()+ expect(screen.getByText(/form\.permissionsAllMember/i))!.toBeInTheDocument()})})@@ -406,7 +444,9 @@ describe('BasicInfoSection', () => {// For partial members, a member selector component should be rendered// We verify it renders without crashing- expect(container).toBeInTheDocument()+ // For partial members, a member selector component should be rendered+ // We verify it renders without crashing+ expect(container)!.toBeInTheDocument()})it('should handle empty member list', () => {@@ -417,7 +457,7 @@ describe('BasicInfoSection', () => {/>,)- expect(screen.getByText(/form\.permissionsOnlyMe/i)).toBeInTheDocument()+ expect(screen.getByText(/form\.permissionsOnlyMe/i))!.toBeInTheDocument()})})diff --git a/web/app/components/datasets/settings/form/hooks/__tests__/use-form-state.spec.ts b/web/app/components/datasets/settings/form/hooks/__tests__/use-form-state.spec.tsindex 00462619aac..ece275c4336 100644--- a/web/app/components/datasets/settings/form/hooks/__tests__/use-form-state.spec.ts+++ b/web/app/components/datasets/settings/form/hooks/__tests__/use-form-state.spec.ts@@ -174,7 +174,7 @@ describe('useFormState', () => {const { result } = renderHook(() => useFormState())expect(result.current.memberList).toHaveLength(2)- expect(result.current.memberList[0].name).toBe('User 1')+ expect(result.current.memberList[0]!.name).toBe('User 1')})it('should return currentDataset from context', () => {diff --git a/web/app/components/datasets/settings/index-method/__tests__/index.spec.tsx b/web/app/components/datasets/settings/index-method/__tests__/index.spec.tsxindex 74412741559..5e81611fc4f 100644--- a/web/app/components/datasets/settings/index-method/__tests__/index.spec.tsx+++ b/web/app/components/datasets/settings/index-method/__tests__/index.spec.tsx@@ -19,12 +19,12 @@ describe('IndexMethod', () => {describe('Rendering', () => {it('should render without crashing', () => {render(<IndexMethod {...defaultProps} />)- expect(screen.getByText(/stepTwo\.qualified/)).toBeInTheDocument()+ expect(screen.getByText(/stepTwo\.qualified/))!.toBeInTheDocument()})it('should render High Quality option', () => {render(<IndexMethod {...defaultProps} />)- expect(screen.getByText(/stepTwo\.qualified/)).toBeInTheDocument()+ expect(screen.getByText(/stepTwo\.qualified/))!.toBeInTheDocument()})it('should render Economy option', () => {@@ -34,17 +34,17 @@ describe('IndexMethod', () => {it('should render High Quality description', () => {render(<IndexMethod {...defaultProps} />)- expect(screen.getByText(/form\.indexMethodHighQualityTip/)).toBeInTheDocument()+ expect(screen.getByText(/form\.indexMethodHighQualityTip/))!.toBeInTheDocument()})it('should render Economy description', () => {render(<IndexMethod {...defaultProps} />)- expect(screen.getByText(/form\.indexMethodEconomyTip/)).toBeInTheDocument()+ expect(screen.getByText(/form\.indexMethodEconomyTip/))!.toBeInTheDocument()})it('should render recommended badge on High Quality', () => {render(<IndexMethod {...defaultProps} />)- expect(screen.getByText(/stepTwo\.recommend/)).toBeInTheDocument()+ expect(screen.getByText(/stepTwo\.recommend/))!.toBeInTheDocument()})})@@ -82,7 +82,7 @@ describe('IndexMethod', () => {// Find and click Economy option - use getAllByText and get the first one (title)const economyTitles = screen.getAllByText(/form\.indexMethodEconomy/)const economyTitle = economyTitles[0]- const card = economyTitle.closest('div')?.parentElement?.parentElement?.parentElement+ const card = economyTitle!.closest('div')?.parentElement?.parentElement?.parentElementfireEvent.click(card!)expect(handleChange).toHaveBeenCalledWith(IndexingType.ECONOMICAL)@@ -114,7 +114,7 @@ describe('IndexMethod', () => {// Try to click Economy option - use getAllByText and get the first one (title)const economyTitles = screen.getAllByText(/form\.indexMethodEconomy/)const economyTitle = economyTitles[0]- const card = economyTitle.closest('div')?.parentElement?.parentElement?.parentElement+ const card = economyTitle!.closest('div')?.parentElement?.parentElement?.parentElementfireEvent.click(card!)// Should not call onChange because Economy is disabled when current is QUALIFIED@@ -125,13 +125,13 @@ describe('IndexMethod', () => {describe('KeywordNumber', () => {it('should render KeywordNumber component inside Economy option', () => {render(<IndexMethod {...defaultProps} />)- expect(getKeywordSlider()).toBeInTheDocument()+ expect(getKeywordSlider())!.toBeInTheDocument()})it('should pass keywordNumber to KeywordNumber component', () => {render(<IndexMethod {...defaultProps} keywordNumber={25} />)const input = screen.getByRole('textbox')- expect(input).toHaveValue('25')+ expect(input)!.toHaveValue('25')})it('should call onKeywordNumberChange when KeywordNumber changes', () => {@@ -160,13 +160,13 @@ describe('IndexMethod', () => {it('should show orange effect color for High Quality option', () => {const { container } = render(<IndexMethod {...defaultProps} />)const orangeEffect = container.querySelector('.bg-util-colors-orange-orange-500')- expect(orangeEffect).toBeInTheDocument()+ expect(orangeEffect)!.toBeInTheDocument()})it('should show indigo effect color for Economy option', () => {const { container } = render(<IndexMethod {...defaultProps} />)const indigoEffect = container.querySelector('.bg-util-colors-indigo-indigo-600')- expect(indigoEffect).toBeInTheDocument()+ expect(indigoEffect)!.toBeInTheDocument()})})@@ -188,19 +188,20 @@ describe('IndexMethod', () => {it('should handle undefined currentValue', () => {render(<IndexMethod {...defaultProps} currentValue={undefined} />)// Should render without error- expect(screen.getByText(/stepTwo\.qualified/)).toBeInTheDocument()+ // Should render without error+ expect(screen.getByText(/stepTwo\.qualified/))!.toBeInTheDocument()})it('should handle minimum keywordNumber', () => {render(<IndexMethod {...defaultProps} keywordNumber={0} />)const input = screen.getByRole('textbox')- expect(input).toHaveValue('0')+ expect(input)!.toHaveValue('0')})it('should handle max keywordNumber', () => {render(<IndexMethod {...defaultProps} keywordNumber={50} />)const input = screen.getByRole('textbox')- expect(input).toHaveValue('50')+ expect(input)!.toHaveValue('50')})})})diff --git a/web/app/components/datasets/settings/permission-selector/__tests__/index.spec.tsx b/web/app/components/datasets/settings/permission-selector/__tests__/index.spec.tsxindex b17b1c9b112..355946402b7 100644--- a/web/app/components/datasets/settings/permission-selector/__tests__/index.spec.tsx+++ b/web/app/components/datasets/settings/permission-selector/__tests__/index.spec.tsx@@ -16,15 +16,15 @@ vi.mock('@/context/app-context', () => ({describe('PermissionSelector', () => {const mockMemberList: Member[] = [- { id: 'user-1', name: 'Current User', email: '[email protected]', avatar: '', avatar_url: '', role: 'owner', last_login_at: '', created_at: '', status: 'active' },- { id: 'user-2', name: 'John Doe', email: '[email protected]', avatar: '', avatar_url: '', role: 'admin', last_login_at: '', created_at: '', status: 'active' },- { id: 'user-3', name: 'Jane Smith', email: '[email protected]', avatar: '', avatar_url: '', role: 'editor', last_login_at: '', created_at: '', status: 'active' },- { id: 'user-4', name: 'Dataset Operator', email: '[email protected]', avatar: '', avatar_url: '', role: 'dataset_operator', last_login_at: '', created_at: '', status: 'active' },+ { id: 'user-1', name: 'Current User', email: '[email protected]', avatar: '', avatar_url: '', role: 'owner', last_login_at: '', created_at: '', status: 'active' }!,+ { id: 'user-2', name: 'John Doe', email: '[email protected]', avatar: '', avatar_url: '', role: 'admin', last_login_at: '', created_at: '', status: 'active' }!,+ { id: 'user-3', name: 'Jane Smith', email: '[email protected]', avatar: '', avatar_url: '', role: 'editor', last_login_at: '', created_at: '', status: 'active' }!,+ { id: 'user-4', name: 'Dataset Operator', email: '[email protected]', avatar: '', avatar_url: '', role: 'dataset_operator', last_login_at: '', created_at: '', status: 'active' }!,]const defaultProps = {permission: DatasetPermission.onlyMe,- value: ['user-1'],+ value: ['user-1'!],memberList: mockMemberList,onChange: vi.fn(),onMemberSelect: vi.fn(),@@ -37,17 +37,17 @@ describe('PermissionSelector', () => {describe('Rendering', () => {it('should render without crashing', () => {render(<PermissionSelector {...defaultProps} />)- expect(screen.getByText(/form\.permissionsOnlyMe/)).toBeInTheDocument()+ expect(screen.getByText(/form\.permissionsOnlyMe/))!.toBeInTheDocument()})it('should render Only Me option when permission is onlyMe', () => {render(<PermissionSelector {...defaultProps} permission={DatasetPermission.onlyMe} />)- expect(screen.getByText(/form\.permissionsOnlyMe/)).toBeInTheDocument()+ expect(screen.getByText(/form\.permissionsOnlyMe/))!.toBeInTheDocument()})it('should render All Team Members option when permission is allTeamMembers', () => {render(<PermissionSelector {...defaultProps} permission={DatasetPermission.allTeamMembers} />)- expect(screen.getByText(/form\.permissionsAllMember/)).toBeInTheDocument()+ expect(screen.getByText(/form\.permissionsAllMember/))!.toBeInTheDocument()})it('should render selected member names when permission is partialMembers', () => {@@ -59,7 +59,8 @@ describe('PermissionSelector', () => {/>,)// Should show member names- expect(screen.getByTitle(/Current User/)).toBeInTheDocument()+ // Should show member names+ expect(screen.getByTitle(/Current User/))!.toBeInTheDocument()})})@@ -97,7 +98,7 @@ describe('PermissionSelector', () => {await waitFor(() => {const onlyMeOptions = screen.getAllByText(/form\.permissionsOnlyMe/)- fireEvent.click(onlyMeOptions[0])+ fireEvent.click(onlyMeOptions[0]!)})expect(handleChange).toHaveBeenCalledWith(DatasetPermission.onlyMe)@@ -112,7 +113,7 @@ describe('PermissionSelector', () => {await waitFor(() => {const allMemberOptions = screen.getAllByText(/form\.permissionsAllMember/)- fireEvent.click(allMemberOptions[0])+ fireEvent.click(allMemberOptions[0]!)})expect(handleChange).toHaveBeenCalledWith(DatasetPermission.allTeamMembers)@@ -134,7 +135,7 @@ describe('PermissionSelector', () => {await waitFor(() => {const invitedOptions = screen.getAllByText(/form\.permissionsInvitedMembers/)- fireEvent.click(invitedOptions[0])+ fireEvent.click(invitedOptions[0]!)})expect(handleChange).toHaveBeenCalledWith(DatasetPermission.partialMembers)@@ -156,8 +157,9 @@ describe('PermissionSelector', () => {await waitFor(() => {// Should show member list- expect(screen.getByText('John Doe')).toBeInTheDocument()- expect(screen.getByText('Jane Smith')).toBeInTheDocument()+ // Should show member list+ expect(screen.getByText('John Doe'))!.toBeInTheDocument()+ expect(screen.getByText('Jane Smith'))!.toBeInTheDocument()})})@@ -222,7 +224,7 @@ describe('PermissionSelector', () => {// Type in searchfireEvent.change(searchInput, { target: { value: 'John' } })- expect(searchInput).toHaveValue('John')+ expect(searchInput)!.toHaveValue('John')})it('should render search input in partial members mode', async () => {@@ -238,7 +240,7 @@ describe('PermissionSelector', () => {// Wait for dropdown to open and search input to be availableconst searchInput = await screen.findByRole('textbox')- expect(searchInput).toBeInTheDocument()+ expect(searchInput)!.toBeInTheDocument()})it('should filter members after debounce completes', async () => {@@ -261,7 +263,7 @@ describe('PermissionSelector', () => {// Wait for debounce (500ms) + bufferawait waitFor(() => {- expect(screen.getByText('John Doe')).toBeInTheDocument()+ expect(screen.getByText('John Doe'))!.toBeInTheDocument()},{ timeout: 1000 },)@@ -283,14 +285,14 @@ describe('PermissionSelector', () => {// Type in searchfireEvent.change(searchInput, { target: { value: 'test' } })- expect(searchInput).toHaveValue('test')+ expect(searchInput)!.toHaveValue('test')const clearButton = screen.getByTestId('input-clear')fireEvent.click(clearButton)// After clicking clear, input should be emptyawait waitFor(() => {- expect(searchInput).toHaveValue('')+ expect(searchInput)!.toHaveValue('')})})@@ -314,7 +316,7 @@ describe('PermissionSelector', () => {// Wait for debounceawait waitFor(() => {- expect(screen.getByText('John Doe')).toBeInTheDocument()+ expect(screen.getByText('John Doe'))!.toBeInTheDocument()},{ timeout: 1000 },)@@ -340,7 +342,7 @@ describe('PermissionSelector', () => {// Wait for debounce and no results messageawait waitFor(() => {- expect(screen.getByText(/form\.onSearchResults/)).toBeInTheDocument()+ expect(screen.getByText(/form\.onSearchResults/))!.toBeInTheDocument()},{ timeout: 1000 },)@@ -365,7 +367,9 @@ describe('PermissionSelector', () => {// Current user (showMe) should remain visible based on name match// The component uses useMemo to check if userProfile.name.includes(searchKeywords)- expect(searchInput).toHaveValue('Current')+ // Current user (showMe) should remain visible based on name match+ // The component uses useMemo to check if userProfile.name.includes(searchKeywords)+ expect(searchInput)!.toHaveValue('Current')// Current User label appears multiple times (trigger + member list)expect(screen.getAllByText('Current User').length).toBeGreaterThanOrEqual(1)})@@ -388,7 +392,8 @@ describe('PermissionSelector', () => {fireEvent.change(searchInput, { target: { value: 'current@' } })// The component checks userProfile.email.includes(searchKeywords)- expect(searchInput).toHaveValue('current@')+ // The component checks userProfile.email.includes(searchKeywords)+ expect(searchInput)!.toHaveValue('current@')// Current User should remain visible based on email matchexpect(screen.getAllByText('Current User').length).toBeGreaterThanOrEqual(1)})@@ -399,7 +404,7 @@ describe('PermissionSelector', () => {const { container } = render(<PermissionSelector {...defaultProps} disabled={true} />)// When disabled, the component has cursor-not-allowed! class (escaped in Tailwind)const triggerElement = container.querySelector('[class*="cursor-not-allowed"]')- expect(triggerElement).toBeInTheDocument()+ expect(triggerElement)!.toBeInTheDocument()})})@@ -414,7 +419,8 @@ describe('PermissionSelector', () => {)// Should display single avatar- expect(screen.getByTitle(/Current User/)).toBeInTheDocument()+ // Should display single avatar+ expect(screen.getByTitle(/Current User/))!.toBeInTheDocument()})it('should display two avatars when two or more members selected', () => {@@ -427,7 +433,8 @@ describe('PermissionSelector', () => {)// Should display member names- expect(screen.getByTitle(/Current User, John Doe/)).toBeInTheDocument()+ // Should display member names+ expect(screen.getByTitle(/Current User, John Doe/))!.toBeInTheDocument()})})@@ -440,18 +447,18 @@ describe('PermissionSelector', () => {/>,)- expect(screen.getByText(/form\.permissionsOnlyMe/)).toBeInTheDocument()+ expect(screen.getByText(/form\.permissionsOnlyMe/))!.toBeInTheDocument()})it('should handle member list with only current user', () => {render(<PermissionSelector{...defaultProps}- memberList={[mockMemberList[0]]}+ memberList={[mockMemberList[0]!]}/>,)- expect(screen.getByText(/form\.permissionsOnlyMe/)).toBeInTheDocument()+ expect(screen.getByText(/form\.permissionsOnlyMe/))!.toBeInTheDocument()})it('should only show members with allowed roles', () => {@@ -472,7 +479,8 @@ describe('PermissionSelector', () => {)// The component renders - the filtering logic is internal- expect(screen.getByTitle(/Current User/)).toBeInTheDocument()+ // The component renders - the filtering logic is internal+ expect(screen.getByTitle(/Current User/))!.toBeInTheDocument()})})@@ -480,11 +488,11 @@ describe('PermissionSelector', () => {it('should update when permission prop changes', () => {const { rerender } = render(<PermissionSelector {...defaultProps} permission={DatasetPermission.onlyMe} />)- expect(screen.getByText(/form\.permissionsOnlyMe/)).toBeInTheDocument()+ expect(screen.getByText(/form\.permissionsOnlyMe/))!.toBeInTheDocument()rerender(<PermissionSelector {...defaultProps} permission={DatasetPermission.allTeamMembers} />)- expect(screen.getByText(/form\.permissionsAllMember/)).toBeInTheDocument()+ expect(screen.getByText(/form\.permissionsAllMember/))!.toBeInTheDocument()})})})diff --git a/web/app/components/datasets/settings/permission-selector/index.tsx b/web/app/components/datasets/settings/permission-selector/index.tsxindex a7182d8f797..8c31799adde 100644--- a/web/app/components/datasets/settings/permission-selector/index.tsx+++ b/web/app/components/datasets/settings/permission-selector/index.tsx@@ -133,8 +133,8 @@ const PermissionSelector = ({{selectedMembers.length === 1 && (<Avatar- avatar={selectedMembers[0].avatar_url}- name={selectedMembers[0].name}+ avatar={selectedMembers[0]!.avatar_url}+ name={selectedMembers[0]!.name}size="xs"/>)@@ -143,14 +143,14 @@ const PermissionSelector = ({selectedMembers.length >= 2 && (<><Avatar- avatar={selectedMembers[0].avatar_url}- name={selectedMembers[0].name}+ avatar={selectedMembers[0]!.avatar_url}+ name={selectedMembers[0]!.name}className="absolute top-0 left-0 z-0"size="xxs"/><Avatar- avatar={selectedMembers[1].avatar_url}- name={selectedMembers[1].name}+ avatar={selectedMembers[1]!.avatar_url}+ name={selectedMembers[1]!.name}className="absolute right-0 bottom-0 z-10"size="xxs"/>diff --git a/web/app/components/develop/code.tsx b/web/app/components/develop/code.tsxindex 59d6c94e5da..86d57c806d8 100644--- a/web/app/components/develop/code.tsx+++ b/web/app/components/develop/code.tsx@@ -226,7 +226,7 @@ function useTabGroupProps(availableLanguages: string[]) {const activeLanguage = [...(availableLanguages || [])].sort((a, z) => preferredLanguages.indexOf(z) - preferredLanguages.indexOf(a),)[0]- const languageIndex = availableLanguages?.indexOf(activeLanguage) || 0+ const languageIndex = availableLanguages?.indexOf(activeLanguage!) || 0const newSelectedIndex = languageIndex === -1 ? selectedIndex : languageIndexif (newSelectedIndex !== selectedIndex)setSelectedIndex(newSelectedIndex)diff --git a/web/app/components/develop/hooks/use-doc-toc.ts b/web/app/components/develop/hooks/use-doc-toc.tsindex d42cb68b008..1eba8ca8e3c 100644--- a/web/app/components/develop/hooks/use-doc-toc.ts+++ b/web/app/components/develop/hooks/use-doc-toc.ts@@ -57,7 +57,7 @@ export const useDocToc = ({ appDetail, locale }: UseDocTocOptions) => {const tocItems = extractTocFromArticle()setToc(tocItems)if (tocItems.length > 0)- setActiveSection(getTargetId(tocItems[0].href))+ setActiveSection(getTargetId(tocItems[0]!.href))}, 0)return () => clearTimeout(timer)}, [appDetail, locale])diff --git a/web/app/components/develop/secret-key/__tests__/secret-key-button.spec.tsx b/web/app/components/develop/secret-key/__tests__/secret-key-button.spec.tsxindex e5134b995db..b4f5c139e00 100644--- a/web/app/components/develop/secret-key/__tests__/secret-key-button.spec.tsx+++ b/web/app/components/develop/secret-key/__tests__/secret-key-button.spec.tsx@@ -19,18 +19,18 @@ describe('SecretKeyButton', () => {describe('rendering', () => {it('should render the button', () => {render(<SecretKeyButton />)- expect(screen.getByRole('button')).toBeInTheDocument()+ expect(screen.getByRole('button'))!.toBeInTheDocument()})it('should render the API key text', () => {render(<SecretKeyButton />)- expect(screen.getByText('appApi.apiKey')).toBeInTheDocument()+ expect(screen.getByText('appApi.apiKey'))!.toBeInTheDocument()})it('should render the key icon', () => {const { container } = render(<SecretKeyButton />)const svg = container.querySelector('svg')- expect(svg).toBeInTheDocument()+ expect(svg)!.toBeInTheDocument()})it('should not show modal initially', () => {@@ -49,7 +49,7 @@ describe('SecretKeyButton', () => {await user.click(button)})- expect(screen.getByTestId('secret-key-modal')).toBeInTheDocument()+ expect(screen.getByTestId('secret-key-modal'))!.toBeInTheDocument()})it('should close modal when onClose is called', async () => {@@ -61,7 +61,7 @@ describe('SecretKeyButton', () => {await user.click(button)})- expect(screen.getByTestId('secret-key-modal')).toBeInTheDocument()+ expect(screen.getByTestId('secret-key-modal'))!.toBeInTheDocument()const closeButton = screen.getByTestId('close-modal')await act(async () => {@@ -80,7 +80,7 @@ describe('SecretKeyButton', () => {await act(async () => {await user.click(button)})- expect(screen.getByTestId('secret-key-modal')).toBeInTheDocument()+ expect(screen.getByTestId('secret-key-modal'))!.toBeInTheDocument()const closeButton = screen.getByTestId('close-modal')await act(async () => {@@ -91,7 +91,7 @@ describe('SecretKeyButton', () => {await act(async () => {await user.click(button)})- expect(screen.getByTestId('secret-key-modal')).toBeInTheDocument()+ expect(screen.getByTestId('secret-key-modal'))!.toBeInTheDocument()})})@@ -111,7 +111,7 @@ describe('SecretKeyButton', () => {await user.click(button)})- expect(screen.getByText('Modal for app-123')).toBeInTheDocument()+ expect(screen.getByText('Modal for app-123'))!.toBeInTheDocument()})it('should handle undefined appId', async () => {@@ -123,7 +123,7 @@ describe('SecretKeyButton', () => {await user.click(button)})- expect(screen.getByText('Modal for no-app')).toBeInTheDocument()+ expect(screen.getByText('Modal for no-app'))!.toBeInTheDocument()})it('should apply custom textCls', () => {@@ -145,19 +145,19 @@ describe('SecretKeyButton', () => {it('should have icon container with flex layout', () => {const { container } = render(<SecretKeyButton />)const iconContainer = container.querySelector('.flex.items-center.justify-center')- expect(iconContainer).toBeInTheDocument()+ expect(iconContainer)!.toBeInTheDocument()})it('should have correct icon dimensions', () => {const { container } = render(<SecretKeyButton />)const iconContainer = container.querySelector('.h-3\\.5.w-3\\.5')- expect(iconContainer).toBeInTheDocument()+ expect(iconContainer)!.toBeInTheDocument()})it('should have tertiary text color on icon', () => {const { container } = render(<SecretKeyButton />)const icon = container.querySelector('.text-text-tertiary')- expect(icon).toBeInTheDocument()+ expect(icon)!.toBeInTheDocument()})})@@ -193,7 +193,7 @@ describe('SecretKeyButton', () => {await user.click(button)})- expect(screen.getByTestId('secret-key-modal')).toBeInTheDocument()+ expect(screen.getByTestId('secret-key-modal'))!.toBeInTheDocument()})it('should pass onClose callback to modal', async () => {@@ -218,7 +218,7 @@ describe('SecretKeyButton', () => {it('should have accessible button', () => {render(<SecretKeyButton />)const button = screen.getByRole('button')- expect(button).toBeInTheDocument()+ expect(button)!.toBeInTheDocument()})it('should be keyboard accessible', async () => {@@ -233,7 +233,7 @@ describe('SecretKeyButton', () => {await user.keyboard('{Enter}')})- expect(screen.getByTestId('secret-key-modal')).toBeInTheDocument()+ expect(screen.getByTestId('secret-key-modal'))!.toBeInTheDocument()})})@@ -251,10 +251,10 @@ describe('SecretKeyButton', () => {expect(buttons).toHaveLength(2)await act(async () => {- await user.click(buttons[0])+ await user.click(buttons[0]!)})- expect(screen.getByText('Modal for app-1')).toBeInTheDocument()+ expect(screen.getByText('Modal for app-1'))!.toBeInTheDocument()const closeButton = screen.getByTestId('close-modal')await act(async () => {@@ -262,10 +262,10 @@ describe('SecretKeyButton', () => {})await act(async () => {- await user.click(buttons[1])+ await user.click(buttons[1]!)})- expect(screen.getByText('Modal for app-2')).toBeInTheDocument()+ expect(screen.getByText('Modal for app-2'))!.toBeInTheDocument()})})})diff --git a/web/app/components/develop/tag.tsx b/web/app/components/develop/tag.tsxindex 3178046338d..082d63a798b 100644--- a/web/app/components/develop/tag.tsx+++ b/web/app/components/develop/tag.tsx@@ -53,7 +53,7 @@ export function Tag({}: ITagProps) {return (<span- className={cn('font-mono text-[0.625rem] leading-6 font-semibold', variantStyles[variant], colorStyles[color][variant])}+ className={cn('font-mono text-[0.625rem] leading-6 font-semibold', variantStyles[variant], colorStyles[color]![variant])}>{children}</span>diff --git a/web/app/components/explore/create-app-modal/__tests__/index.spec.tsx b/web/app/components/explore/create-app-modal/__tests__/index.spec.tsxindex fd6877d4213..5a14807478c 100644--- a/web/app/components/explore/create-app-modal/__tests__/index.spec.tsx+++ b/web/app/components/explore/create-app-modal/__tests__/index.spec.tsx@@ -106,24 +106,24 @@ describe('CreateAppModal', () => {it('should render create title and actions when creating', async () => {await setup({ appName: 'My App', isEditModal: false })- expect(screen.getByText('explore.appCustomize.title:{"name":"My App"}')).toBeInTheDocument()- expect(screen.getByRole('button', { name: /common\.operation\.create/ })).toBeInTheDocument()- expect(screen.getByRole('button', { name: 'common.operation.cancel' })).toBeInTheDocument()+ expect(screen.getByText('explore.appCustomize.title:{"name":"My App"}'))!.toBeInTheDocument()+ expect(screen.getByRole('button', { name: /common\.operation\.create/ }))!.toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'common.operation.cancel' }))!.toBeInTheDocument()})it('should render edit-only fields when editing a chat app', async () => {await setup({ isEditModal: true, appMode: AppModeEnum.CHAT, max_active_requests: 5 })- expect(screen.getByText('app.editAppTitle')).toBeInTheDocument()- expect(screen.getByRole('button', { name: /common\.operation\.save/ })).toBeInTheDocument()- expect(screen.getByRole('switch')).toBeInTheDocument()+ expect(screen.getByText('app.editAppTitle'))!.toBeInTheDocument()+ expect(screen.getByRole('button', { name: /common\.operation\.save/ }))!.toBeInTheDocument()+ expect(screen.getByRole('switch'))!.toBeInTheDocument()expect((screen.getByRole('spinbutton') as HTMLInputElement).value).toBe('5')})it.each([AppModeEnum.ADVANCED_CHAT, AppModeEnum.AGENT_CHAT])('should render answer icon switch when editing %s app', async (mode) => {await setup({ isEditModal: true, appMode: mode })- expect(screen.getByRole('switch')).toBeInTheDocument()+ expect(screen.getByRole('switch'))!.toBeInTheDocument()})it('should not render answer icon switch when editing a non-chat app', async () => {@@ -143,13 +143,13 @@ describe('CreateAppModal', () => {it('should disable confirm action when confirmDisabled is true', async () => {await setup({ confirmDisabled: true })- expect(screen.getByRole('button', { name: /common\.operation\.create/ })).toBeDisabled()+ expect(screen.getByRole('button', { name: /common\.operation\.create/ }))!.toBeDisabled()})it('should disable confirm action when appName is empty', async () => {await setup({ appName: ' ' })- expect(screen.getByRole('button', { name: /common\.operation\.create/ })).toBeDisabled()+ expect(screen.getByRole('button', { name: /common\.operation\.create/ }))!.toBeDisabled()})})@@ -204,8 +204,8 @@ describe('CreateAppModal', () => {await setup({ isEditModal: false })- expect(screen.getByText('billing.apps.fullTip2')).toBeInTheDocument()- expect(screen.getByRole('button', { name: /common\.operation\.create/ })).toBeDisabled()+ expect(screen.getByText('billing.apps.fullTip2'))!.toBeInTheDocument()+ expect(screen.getByRole('button', { name: /common\.operation\.create/ }))!.toBeDisabled()})it('should allow saving when apps quota is reached in edit mode', async () => {@@ -217,7 +217,7 @@ describe('CreateAppModal', () => {await setup({ isEditModal: true })expect(screen.queryByText('billing.apps.fullTip2')).not.toBeInTheDocument()- expect(screen.getByRole('button', { name: /common\.operation\.save/ })).toBeEnabled()+ expect(screen.getByRole('button', { name: /common\.operation\.save/ }))!.toBeEnabled()})})@@ -314,7 +314,7 @@ describe('CreateAppModal', () => {fireEvent.click(getAppIconTrigger())- expect(screen.getByRole('button', { name: 'app.iconPicker.cancel' })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'app.iconPicker.cancel' }))!.toBeInTheDocument()fireEvent.click(screen.getByRole('button', { name: 'app.iconPicker.cancel' }))@@ -347,7 +347,7 @@ describe('CreateAppModal', () => {})expect(onConfirm).toHaveBeenCalledTimes(1)- const payload = onConfirm.mock.calls[0][0]+ const payload = onConfirm.mock.calls[0]![0]expect(payload).toMatchObject({icon_type: 'emoji',icon: '😀',@@ -392,7 +392,7 @@ describe('CreateAppModal', () => {})expect(onConfirm).toHaveBeenCalledTimes(1)- const payload = onConfirm.mock.calls[0][0]+ const payload = onConfirm.mock.calls[0]![0]expect(payload).toMatchObject({icon_type: 'emoji',icon: '🤖',@@ -431,7 +431,7 @@ describe('CreateAppModal', () => {expect(onConfirm).toHaveBeenCalledTimes(1)expect(onHide).toHaveBeenCalledTimes(1)- const payload = onConfirm.mock.calls[0][0]+ const payload = onConfirm.mock.calls[0]![0]expect(payload).toMatchObject({name: 'My App',icon_type: 'emoji',@@ -453,7 +453,7 @@ describe('CreateAppModal', () => {})expect(onConfirm).toHaveBeenCalledTimes(1)- expect(onConfirm.mock.calls[0][0]).toMatchObject({ description: 'Updated description' })+ expect(onConfirm.mock.calls[0]![0]).toMatchObject({ description: 'Updated description' })})it('should omit icon_background when submitting with image icon', async () => {@@ -469,7 +469,7 @@ describe('CreateAppModal', () => {vi.advanceTimersByTime(300)})- const payload = onConfirm.mock.calls[0][0]+ const payload = onConfirm.mock.calls[0]![0]expect(payload).toMatchObject({icon_type: 'image',icon: 'file-123',@@ -493,7 +493,7 @@ describe('CreateAppModal', () => {vi.advanceTimersByTime(300)})- const payload = onConfirm.mock.calls[0][0]+ const payload = onConfirm.mock.calls[0]![0]expect(payload).toMatchObject({use_icon_as_answer_icon: true,max_active_requests: 12,@@ -508,7 +508,7 @@ describe('CreateAppModal', () => {vi.advanceTimersByTime(300)})- const payload = onConfirm.mock.calls[0][0]+ const payload = onConfirm.mock.calls[0]![0]expect(payload.max_active_requests).toBeUndefined()})@@ -521,7 +521,7 @@ describe('CreateAppModal', () => {vi.advanceTimersByTime(300)})- const payload = onConfirm.mock.calls[0][0]+ const payload = onConfirm.mock.calls[0]![0]expect(payload.max_active_requests).toBeUndefined()})diff --git a/web/app/components/explore/try-app/app-info/__tests__/use-get-requirements.spec.ts b/web/app/components/explore/try-app/app-info/__tests__/use-get-requirements.spec.tsindex c6c3353a570..076278b3edf 100644--- a/web/app/components/explore/try-app/app-info/__tests__/use-get-requirements.spec.ts+++ b/web/app/components/explore/try-app/app-info/__tests__/use-get-requirements.spec.ts@@ -59,8 +59,8 @@ describe('useGetRequirements', () => {)expect(result.current.requirements).toHaveLength(1)- expect(result.current.requirements[0].name).toBe('openai')- expect(result.current.requirements[0].iconUrl).toBe('https://marketplace.api/plugins/langgenius/openai/icon')+ expect(result.current.requirements[0]!.name).toBe('openai')+ expect(result.current.requirements[0]!.iconUrl).toBe('https://marketplace.api/plugins/langgenius/openai/icon')})it('returns model provider for completion mode', () => {@@ -84,7 +84,7 @@ describe('useGetRequirements', () => {)expect(result.current.requirements).toHaveLength(1)- expect(result.current.requirements[0].name).toBe('claude')+ expect(result.current.requirements[0]!.name).toBe('claude')})it('returns model provider and tools for agent-chat mode', () => {@@ -166,7 +166,7 @@ describe('useGetRequirements', () => {)expect(result.current.requirements).toHaveLength(1)- expect(result.current.requirements[0].name).toBe('openai')+ expect(result.current.requirements[0]!.name).toBe('openai')})})@@ -232,7 +232,7 @@ describe('useGetRequirements', () => {)expect(result.current.requirements).toHaveLength(1)- expect(result.current.requirements[0].name).toBe('claude-3-opus')+ expect(result.current.requirements[0]!.name).toBe('claude-3-opus')})it('returns empty requirements when flow data has no nodes', () => {@@ -373,7 +373,7 @@ describe('useGetRequirements', () => {)expect(result.current.requirements).toHaveLength(1)- expect(result.current.requirements[0].name).toBe('gpt-4')+ expect(result.current.requirements[0]!.name).toBe('gpt-4')})})@@ -398,7 +398,7 @@ describe('useGetRequirements', () => {useGetRequirements({ appDetail, appId: 'test-app-id' }),)- expect(result.current.requirements[0].iconUrl).toBe('https://marketplace.api/plugins/org/plugin/icon')+ expect(result.current.requirements[0]!.iconUrl).toBe('https://marketplace.api/plugins/org/plugin/icon')})it('maps google model provider to gemini plugin icon URL', () => {@@ -421,7 +421,7 @@ describe('useGetRequirements', () => {useGetRequirements({ appDetail, appId: 'test-app-id' }),)- expect(result.current.requirements[0].iconUrl).toBe('https://marketplace.api/plugins/langgenius/gemini/icon')+ expect(result.current.requirements[0]!.iconUrl).toBe('https://marketplace.api/plugins/langgenius/gemini/icon')})it('maps special builtin tool providers to *_tool plugin icon URL', () => {diff --git a/web/app/components/explore/try-app/app-info/use-get-requirements.ts b/web/app/components/explore/try-app/app-info/use-get-requirements.tsindex 6458c76037b..3ad89eee7e7 100644--- a/web/app/components/explore/try-app/app-info/use-get-requirements.ts+++ b/web/app/components/explore/try-app/app-info/use-get-requirements.ts@@ -44,13 +44,13 @@ const parseProviderId = (providerId: string): ProviderInfo | null => {if (segments.length === 1) {return {organization: 'langgenius',- providerName: segments[0],+ providerName: segments[0]!,}}return {- organization: segments[0],- providerName: segments[1],+ organization: segments[0]!,+ providerName: segments[1]!,}}diff --git a/web/app/components/explore/try-app/preview/basic-app-preview.tsx b/web/app/components/explore/try-app/preview/basic-app-preview.tsxindex 6954546b2eb..43fb00600fe 100644--- a/web/app/components/explore/try-app/preview/basic-app-preview.tsx+++ b/web/app/components/explore/try-app/preview/basic-app-preview.tsx@@ -238,7 +238,7 @@ const BasicAppPreview: FC<Props> = ({},enabled: !!(modelConfig.file_upload?.enabled || modelConfig.file_upload?.image?.enabled),allowed_file_types: modelConfig.file_upload?.allowed_file_types || [],- allowed_file_extensions: modelConfig.file_upload?.allowed_file_extensions || [...FILE_EXTS[SupportUploadFileTypes.image], ...FILE_EXTS[SupportUploadFileTypes.video]].map(ext => `.${ext}`),+ allowed_file_extensions: modelConfig.file_upload?.allowed_file_extensions || [...(FILE_EXTS[SupportUploadFileTypes.image] ?? []), ...(FILE_EXTS[SupportUploadFileTypes.video] ?? [])].map(ext => `.${ext}`),allowed_file_upload_methods: modelConfig.file_upload?.allowed_file_upload_methods || modelConfig.file_upload?.image?.transfer_methods || ['local_file', 'remote_url'],number_limits: modelConfig.file_upload?.number_limits || modelConfig.file_upload?.image?.number_limits || 3,fileUploadConfig: {},diff --git a/web/app/components/goto-anything/actions/__tests__/index.spec.ts b/web/app/components/goto-anything/actions/__tests__/index.spec.tsindex 12bdb192f2e..ff7ab1e5751 100644--- a/web/app/components/goto-anything/actions/__tests__/index.spec.ts+++ b/web/app/components/goto-anything/actions/__tests__/index.spec.ts@@ -81,20 +81,20 @@ describe('createActions', () => {const actions = createActions(true, false) as Record<string, ActionItem>expect(actions).toHaveProperty('node')- expect(actions.node.title).toBe('Workflow Nodes')+ expect(actions.node!.title).toBe('Workflow Nodes')})it('includes rag-pipeline nodes action on rag-pipeline pages', () => {const actions = createActions(false, true) as Record<string, ActionItem>expect(actions).toHaveProperty('node')- expect(actions.node.title).toBe('RAG Pipeline Nodes')+ expect(actions.node!.title).toBe('RAG Pipeline Nodes')})it('rag-pipeline page takes priority over workflow page', () => {const actions = createActions(true, true) as Record<string, ActionItem>- expect(actions.node.title).toBe('RAG Pipeline Nodes')+ expect(actions.node!.title).toBe('RAG Pipeline Nodes')})})@@ -180,7 +180,7 @@ describe('searchAnything', () => {const results = await searchAnything('en', 'my query', undefined, dynamicActions)- expect(dynamicActions.slash.search).not.toHaveBeenCalled()+ expect(dynamicActions.slash!.search).not.toHaveBeenCalled()expect(results).toHaveLength(2)expect(results).toEqual(expect.arrayContaining([expect.objectContaining({ id: 'a1' }),@@ -206,7 +206,7 @@ describe('searchAnything', () => {const results = await searchAnything('en', 'query', undefined, dynamicActions)expect(results).toHaveLength(1)- expect(results[0].id).toBe('k1')+ expect(results[0]!.id).toBe('k1')expect(warnSpy).toHaveBeenCalled()warnSpy.mockRestore()})diff --git a/web/app/components/goto-anything/actions/__tests__/knowledge.spec.ts b/web/app/components/goto-anything/actions/__tests__/knowledge.spec.tsindex 55592cd487a..2124eccd816 100644--- a/web/app/components/goto-anything/actions/__tests__/knowledge.spec.ts+++ b/web/app/components/goto-anything/actions/__tests__/knowledge.spec.ts@@ -59,7 +59,7 @@ describe('knowledgeAction', () => {const results = await knowledgeAction.search('@knowledge', '', 'en')- expect(results[0].path).toBe('/datasets/ds-ext/hitTesting')+ expect(results[0]!.path).toBe('/datasets/ds-ext/hitTesting')})it('generates correct path for non-external provider', async () => {@@ -76,7 +76,7 @@ describe('knowledgeAction', () => {const results = await knowledgeAction.search('@knowledge', '', 'en')- expect(results[0].path).toBe('/datasets/ds-2/documents')+ expect(results[0]!.path).toBe('/datasets/ds-2/documents')})it('returns empty array on API failure', async () => {diff --git a/web/app/components/goto-anything/actions/__tests__/recent-store.spec.ts b/web/app/components/goto-anything/actions/__tests__/recent-store.spec.tsindex d2fb3462861..da1dc861244 100644--- a/web/app/components/goto-anything/actions/__tests__/recent-store.spec.ts+++ b/web/app/components/goto-anything/actions/__tests__/recent-store.spec.ts@@ -51,7 +51,7 @@ describe('recent-store', () => {const stored = getRecentItems()expect(stored.map(i => i.id)).toEqual(['a', 'b'])- expect(stored[0].title).toBe('A updated')+ expect(stored[0]!.title).toBe('A updated')})it('caps the list at 8 items, evicting the oldest', () => {@@ -60,8 +60,8 @@ describe('recent-store', () => {const stored = getRecentItems()expect(stored).toHaveLength(8)- expect(stored[0].id).toBe('item-9')- expect(stored[7].id).toBe('item-2')+ expect(stored[0]!.id).toBe('item-9')+ expect(stored[7]!.id).toBe('item-2')})it('silently swallows storage errors', () => {diff --git a/web/app/components/goto-anything/actions/commands/__tests__/direct-commands.spec.ts b/web/app/components/goto-anything/actions/commands/__tests__/direct-commands.spec.tsindex 88bd8b1045b..f14098e970f 100644--- a/web/app/components/goto-anything/actions/commands/__tests__/direct-commands.spec.ts+++ b/web/app/components/goto-anything/actions/commands/__tests__/direct-commands.spec.ts@@ -70,7 +70,7 @@ describe('docsCommand', () => {const results = await docsCommand.search('', 'en')- expect(results[0].description).toBe('Open help documentation')+ expect(results[0]!.description).toBe('Open help documentation')mockT.mockImplementation((key: string) => key)})@@ -82,8 +82,8 @@ describe('docsCommand', () => {it('registered handler opens doc URL with correct locale', async () => {docsCommand.register?.({} as Record<string, never>)const openSpy = vi.spyOn(window, 'open').mockImplementation(() => null)- const handlers = vi.mocked(registerCommands).mock.calls[0][0]- await handlers['navigation.doc']()+ const handlers = vi.mocked(registerCommands).mock.calls[0]![0]+ await handlers['navigation.doc']!()expect(openSpy).toHaveBeenCalledWith('https://docs.dify.ai/en', '_blank', 'noopener,noreferrer')openSpy.mockRestore()@@ -183,7 +183,7 @@ describe('communityCommand', () => {const results = await communityCommand.search('', 'en')- expect(results[0].description).toBe('Open Discord community')+ expect(results[0]!.description).toBe('Open Discord community')mockT.mockImplementation((key: string) => key)})@@ -195,8 +195,8 @@ describe('communityCommand', () => {it('registered handler opens URL from args', async () => {communityCommand.register?.({} as Record<string, never>)const openSpy = vi.spyOn(window, 'open').mockImplementation(() => null)- const handlers = vi.mocked(registerCommands).mock.calls[0][0]- await handlers['navigation.community']({ url: 'https://custom-url.com' })+ const handlers = vi.mocked(registerCommands).mock.calls[0]![0]+ await handlers['navigation.community']!({ url: 'https://custom-url.com' })expect(openSpy).toHaveBeenCalledWith('https://custom-url.com', '_blank', 'noopener,noreferrer')openSpy.mockRestore()@@ -205,8 +205,8 @@ describe('communityCommand', () => {it('registered handler falls back to default URL when no args', async () => {communityCommand.register?.({} as Record<string, never>)const openSpy = vi.spyOn(window, 'open').mockImplementation(() => null)- const handlers = vi.mocked(registerCommands).mock.calls[0][0]- await handlers['navigation.community']()+ const handlers = vi.mocked(registerCommands).mock.calls[0]![0]+ await handlers['navigation.community']!()expect(openSpy).toHaveBeenCalledWith('https://discord.gg/5AEfbxcd9k', '_blank', 'noopener,noreferrer')openSpy.mockRestore()@@ -260,7 +260,7 @@ describe('forumCommand', () => {const results = await forumCommand.search('', 'en')- expect(results[0].description).toBe('Open community feedback discussions')+ expect(results[0]!.description).toBe('Open community feedback discussions')mockT.mockImplementation((key: string) => key)})@@ -272,8 +272,8 @@ describe('forumCommand', () => {it('registered handler opens URL from args', async () => {forumCommand.register?.({} as Record<string, never>)const openSpy = vi.spyOn(window, 'open').mockImplementation(() => null)- const handlers = vi.mocked(registerCommands).mock.calls[0][0]- await handlers['navigation.forum']({ url: 'https://custom-forum.com' })+ const handlers = vi.mocked(registerCommands).mock.calls[0]![0]+ await handlers['navigation.forum']!({ url: 'https://custom-forum.com' })expect(openSpy).toHaveBeenCalledWith('https://custom-forum.com', '_blank', 'noopener,noreferrer')openSpy.mockRestore()@@ -282,8 +282,8 @@ describe('forumCommand', () => {it('registered handler falls back to default URL when no args', async () => {forumCommand.register?.({} as Record<string, never>)const openSpy = vi.spyOn(window, 'open').mockImplementation(() => null)- const handlers = vi.mocked(registerCommands).mock.calls[0][0]- await handlers['navigation.forum']()+ const handlers = vi.mocked(registerCommands).mock.calls[0]![0]+ await handlers['navigation.forum']!()expect(openSpy).toHaveBeenCalledWith('https://forum.dify.ai', '_blank', 'noopener,noreferrer')openSpy.mockRestore()diff --git a/web/app/components/goto-anything/actions/commands/__tests__/go.spec.tsx b/web/app/components/goto-anything/actions/commands/__tests__/go.spec.tsxindex 719eddf77b6..82cdfa330c6 100644--- a/web/app/components/goto-anything/actions/commands/__tests__/go.spec.tsx+++ b/web/app/components/goto-anything/actions/commands/__tests__/go.spec.tsx@@ -40,15 +40,15 @@ describe('goCommand', () => {const results = await goCommand.search('plugins', 'en')expect(results).toHaveLength(1)- expect(results[0].id).toBe('go-plugins')+ expect(results[0]!.id).toBe('go-plugins')})it('filters by label match (case-insensitive)', async () => {const results = await goCommand.search('Knowledge', 'en')expect(results).toHaveLength(1)- expect(results[0].id).toBe('go-datasets')- expect(results[0].title).toBe('Knowledge')+ expect(results[0]!.id).toBe('go-datasets')+ expect(results[0]!.title).toBe('Knowledge')})it('returns command results with navigation.go data', async () => {@@ -85,9 +85,9 @@ describe('goCommand', () => {it('registered handler navigates to the provided path', async () => {Object.defineProperty(window, 'location', { value: { href: '' }, writable: true })goCommand.register?.({} as Record<string, never>)- const handlers = vi.mocked(registerCommands).mock.calls[0][0]+ const handlers = vi.mocked(registerCommands).mock.calls[0]![0]- await handlers['navigation.go']({ path: '/datasets' })+ await handlers['navigation.go']!({ path: '/datasets' })expect(window.location.href).toBe('/datasets')})@@ -95,10 +95,10 @@ describe('goCommand', () => {it('registered handler does nothing when path is missing', async () => {Object.defineProperty(window, 'location', { value: { href: '/current' }, writable: true })goCommand.register?.({} as Record<string, never>)- const handlers = vi.mocked(registerCommands).mock.calls[0][0]+ const handlers = vi.mocked(registerCommands).mock.calls[0]![0]- await handlers['navigation.go']()- await handlers['navigation.go']({})+ await handlers['navigation.go']!()+ await handlers['navigation.go']!({})expect(window.location.href).toBe('/current')})diff --git a/web/app/components/goto-anything/actions/commands/__tests__/language.spec.ts b/web/app/components/goto-anything/actions/commands/__tests__/language.spec.tsindex 54aa28d24a2..da6ede6a3ad 100644--- a/web/app/components/goto-anything/actions/commands/__tests__/language.spec.ts+++ b/web/app/components/goto-anything/actions/commands/__tests__/language.spec.ts@@ -42,14 +42,14 @@ describe('languageCommand', () => {const results = await languageCommand.search('english', 'en')expect(results).toHaveLength(1)- expect(results[0].id).toBe('lang-en-US')+ expect(results[0]!.id).toBe('lang-en-US')})it('filters languages by value query', async () => {const results = await languageCommand.search('zh', 'en')expect(results).toHaveLength(1)- expect(results[0].id).toBe('lang-zh-Hans')+ expect(results[0]!.id).toBe('lang-zh-Hans')})it('returns command data with i18n.set command', async () => {diff --git a/web/app/components/goto-anything/actions/commands/__tests__/registry.spec.ts b/web/app/components/goto-anything/actions/commands/__tests__/registry.spec.tsindex 2a13ffd1ea1..d2623be4348 100644--- a/web/app/components/goto-anything/actions/commands/__tests__/registry.spec.ts+++ b/web/app/components/goto-anything/actions/commands/__tests__/registry.spec.ts@@ -202,7 +202,7 @@ describe('SlashCommandRegistry', () => {const results = await registry.search('/hem')expect(results).toHaveLength(1)- expect(results[0].title).toBe('/theme')+ expect(results[0]!.title).toBe('/theme')})it('fuzzy search also matches aliases', async () => {@@ -236,7 +236,7 @@ describe('SlashCommandRegistry', () => {const results = await registry.search('/')expect(results).toHaveLength(1)- expect(results[0].title).toBe('/docs')+ expect(results[0]!.title).toBe('/docs')})it('skips unavailable handler in exact match', async () => {diff --git a/web/app/components/goto-anything/actions/commands/__tests__/theme.spec.ts b/web/app/components/goto-anything/actions/commands/__tests__/theme.spec.tsindex 3dd45aad110..4a79da5518f 100644--- a/web/app/components/goto-anything/actions/commands/__tests__/theme.spec.ts+++ b/web/app/components/goto-anything/actions/commands/__tests__/theme.spec.ts@@ -41,7 +41,7 @@ describe('themeCommand', () => {const results = await themeCommand.search('dark', 'en')expect(results).toHaveLength(1)- expect(results[0].id).toBe('dark')+ expect(results[0]!.id).toBe('dark')})})diff --git a/web/app/components/goto-anything/command-selector.tsx b/web/app/components/goto-anything/command-selector.tsxindex 96385abd0a9..93430eafc4f 100644--- a/web/app/components/goto-anything/command-selector.tsx+++ b/web/app/components/goto-anything/command-selector.tsx@@ -64,7 +64,7 @@ const CommandSelector: FC<Props> = ({ actions, onCommandSelect, searchFilter, coif (allItems.length > 0 && onCommandValueChange) {const currentValueExists = allItems.some(item => item.shortcut === commandValue)if (!currentValueExists)- onCommandValueChange(allItems[0].shortcut)+ onCommandValueChange(allItems[0]!.shortcut)}}, [searchFilter, allItems.length])diff --git a/web/app/components/goto-anything/hooks/__tests__/use-goto-anything-results.spec.ts b/web/app/components/goto-anything/hooks/__tests__/use-goto-anything-results.spec.tsindex b1b543d35a2..e5393a05a97 100644--- a/web/app/components/goto-anything/hooks/__tests__/use-goto-anything-results.spec.ts+++ b/web/app/components/goto-anything/hooks/__tests__/use-goto-anything-results.spec.ts@@ -111,8 +111,8 @@ describe('useGotoAnythingResults', () => {const { result } = renderHook(() => useGotoAnythingResults(createMockOptions()))expect(result.current.dedupedResults).toHaveLength(2)- expect(result.current.dedupedResults[0].id).toBe('1')- expect(result.current.dedupedResults[1].id).toBe('2')+ expect(result.current.dedupedResults[0]!.id).toBe('1')+ expect(result.current.dedupedResults[1]!.id).toBe('2')})it('should keep first occurrence when duplicates exist', () => {@@ -129,7 +129,7 @@ describe('useGotoAnythingResults', () => {const { result } = renderHook(() => useGotoAnythingResults(createMockOptions()))expect(result.current.dedupedResults).toHaveLength(1)- expect(result.current.dedupedResults[0].title).toBe('First')+ expect(result.current.dedupedResults[0]!.title).toBe('First')})it('should handle different types with same id', () => {diff --git a/web/app/components/goto-anything/hooks/use-goto-anything-results.ts b/web/app/components/goto-anything/hooks/use-goto-anything-results.tsindex 36e8397b6f7..2f9174fc538 100644--- a/web/app/components/goto-anything/hooks/use-goto-anything-results.ts+++ b/web/app/components/goto-anything/hooks/use-goto-anything-results.ts@@ -110,7 +110,7 @@ export const useGotoAnythingResults = (if (!acc[result.type])acc[result.type] = []- acc[result.type].push(result)+ acc[result.type]!.push(result)return acc}, {} as Record<string, SearchResult[]>), [dedupedResults])@@ -125,7 +125,7 @@ export const useGotoAnythingResults = (const currentValueExists = dedupedResults.some(result => `${result.type}-${result.id}` === cmdVal)if (!currentValueExists)- setCmdVal(`${dedupedResults[0].type}-${dedupedResults[0].id}`)+ setCmdVal(`${dedupedResults[0]!.type}-${dedupedResults[0]!.id}`)}, [isCommandsMode, dedupedResults, cmdVal, setCmdVal])return {diff --git a/web/app/components/goto-anything/index.tsx b/web/app/components/goto-anything/index.tsxindex 829a95f7e7b..f3bf40f62a2 100644--- a/web/app/components/goto-anything/index.tsx+++ b/web/app/components/goto-anything/index.tsx@@ -111,7 +111,7 @@ const GotoAnything: FC<Props> = ({// Check if it's a complete slash commandif (query.startsWith('/')) {const commandName = query.substring(1).split(' ')[0]- const handler = slashCommandRegistry.findCommand(commandName)+ const handler = slashCommandRegistry.findCommand(commandName!)// If it's a direct mode command, execute immediatelyconst isAvailable = handler?.isAvailable?.() ?? truediff --git a/web/app/components/header/account-dropdown/__tests__/compliance.spec.tsx b/web/app/components/header/account-dropdown/__tests__/compliance.spec.tsxindex 8165434b3a0..15439b157fa 100644--- a/web/app/components/header/account-dropdown/__tests__/compliance.spec.tsx+++ b/web/app/components/header/account-dropdown/__tests__/compliance.spec.tsx@@ -99,7 +99,8 @@ describe('Compliance', () => {renderCompliance()// Assert- expect(screen.getByText('common.userProfile.compliance')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('common.userProfile.compliance'))!.toBeInTheDocument()})it('should show SOC2, ISO, GDPR items when opened', () => {@@ -107,10 +108,11 @@ describe('Compliance', () => {openMenuAndRender()// Assert- expect(screen.getByText('common.compliance.soc2Type1')).toBeInTheDocument()- expect(screen.getByText('common.compliance.soc2Type2')).toBeInTheDocument()- expect(screen.getByText('common.compliance.iso27001')).toBeInTheDocument()- expect(screen.getByText('common.compliance.gdpr')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('common.compliance.soc2Type1'))!.toBeInTheDocument()+ expect(screen.getByText('common.compliance.soc2Type2'))!.toBeInTheDocument()+ expect(screen.getByText('common.compliance.iso27001'))!.toBeInTheDocument()+ expect(screen.getByText('common.compliance.gdpr'))!.toBeInTheDocument()})})@@ -158,7 +160,7 @@ describe('Compliance', () => {// ActopenMenuAndRender()const downloadButtons = screen.getAllByText('common.operation.download')- fireEvent.click(downloadButtons[0])+ fireEvent.click(downloadButtons[0]!)// Assertawait waitFor(() => {@@ -183,7 +185,7 @@ describe('Compliance', () => {// ActopenMenuAndRender()const downloadButtons = screen.getAllByText('common.operation.download')- fireEvent.click(downloadButtons[0])+ fireEvent.click(downloadButtons[0]!)// Assertawait waitFor(() => {@@ -198,7 +200,7 @@ describe('Compliance', () => {// ActopenMenuAndRender()const upgradeBadges = screen.getAllByText('billing.upgradeBtn.encourageShort')- fireEvent.click(upgradeBadges[0])+ fireEvent.click(upgradeBadges[0]!)// Assertexpect(mockSetShowPricingModal).toHaveBeenCalled()@@ -218,7 +220,7 @@ describe('Compliance', () => {openMenuAndRender()// SOC2 Type II is restricted for professionalconst upgradeBadges = screen.getAllByText('billing.upgradeBtn.encourageShort')- fireEvent.click(upgradeBadges[0])+ fireEvent.click(upgradeBadges[0]!)// Assertexpect(mockSetShowAccountSettingModal).toHaveBeenCalledWith({@@ -251,7 +253,7 @@ describe('Compliance', () => {await waitFor(() => {const busyButton = menuItem!.querySelector('button[aria-busy="true"]')expect(busyButton).not.toBeNull()- expect(busyButton).toBeDisabled()+ expect(busyButton)!.toBeDisabled()expect(busyButton!.querySelector('.animate-spin')).not.toBeNull()}, { timeout: 10000 })@@ -286,7 +288,7 @@ describe('Compliance', () => {await waitFor(() => {const busyButton = menuItem!.querySelector('button[aria-busy="true"]')expect(busyButton).not.toBeNull()- expect(busyButton).toBeDisabled()+ expect(busyButton)!.toBeDisabled()expect(getDocDownloadUrl).toHaveBeenCalledTimes(1)}, { timeout: 10000 })diff --git a/web/app/components/header/account-dropdown/workplace-selector/__tests__/index.spec.tsx b/web/app/components/header/account-dropdown/workplace-selector/__tests__/index.spec.tsxindex 338096a9e1e..e1d52165558 100644--- a/web/app/components/header/account-dropdown/workplace-selector/__tests__/index.spec.tsx+++ b/web/app/components/header/account-dropdown/workplace-selector/__tests__/index.spec.tsx@@ -115,11 +115,11 @@ describe('WorkplaceSelector', () => {it('should render current workspace and available workspace options', () => {renderComponent()- expect(screen.getByTestId('workplace-selector-trigger')).toHaveTextContent('Workspace 1')- expect(screen.getByTestId('workspace-option-1')).toBeInTheDocument()- expect(screen.getByTestId('workspace-option-2')).toBeInTheDocument()- expect(screen.getByTestId('workspace-option-1')).toHaveTextContent('Workspace 1')- expect(screen.getByTestId('workspace-option-2')).toHaveTextContent('Workspace 2')+ expect(screen.getByTestId('workplace-selector-trigger'))!.toHaveTextContent('Workspace 1')+ expect(screen.getByTestId('workspace-option-1'))!.toBeInTheDocument()+ expect(screen.getByTestId('workspace-option-2'))!.toBeInTheDocument()+ expect(screen.getByTestId('workspace-option-1'))!.toHaveTextContent('Workspace 1')+ expect(screen.getByTestId('workspace-option-2'))!.toHaveTextContent('Workspace 2')})})@@ -127,7 +127,7 @@ describe('WorkplaceSelector', () => {it('should switch workspace successfully', async () => {vi.mocked(switchWorkspace).mockResolvedValue({result: 'success',- new_tenant: mockWorkspaces[1],+ new_tenant: mockWorkspaces[1]!,})renderComponent()diff --git a/web/app/components/header/account-setting/__tests__/index.spec.tsx b/web/app/components/header/account-setting/__tests__/index.spec.tsxindex d4e093bd306..d37b0bbcf25 100644--- a/web/app/components/header/account-setting/__tests__/index.spec.tsx+++ b/web/app/components/header/account-setting/__tests__/index.spec.tsx@@ -200,13 +200,14 @@ describe('AccountSetting', () => {renderAccountSetting()// Assert- expect(screen.getByText('common.userProfile.settings')).toBeInTheDocument()- expect(screen.getByText('common.settings.provider')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('common.userProfile.settings'))!.toBeInTheDocument()+ expect(screen.getByText('common.settings.provider'))!.toBeInTheDocument()expect(screen.getAllByText('common.settings.members').length).toBeGreaterThan(0)- expect(screen.getByText('common.settings.billing')).toBeInTheDocument()- expect(screen.getByText('common.settings.dataSource')).toBeInTheDocument()- expect(screen.getByText('common.settings.apiBasedExtension')).toBeInTheDocument()- expect(screen.getByText('custom.custom')).toBeInTheDocument()+ expect(screen.getByText('common.settings.billing'))!.toBeInTheDocument()+ expect(screen.getByText('common.settings.dataSource'))!.toBeInTheDocument()+ expect(screen.getByText('common.settings.apiBasedExtension'))!.toBeInTheDocument()+ expect(screen.getByText('custom.custom'))!.toBeInTheDocument()expect(screen.getAllByText('common.settings.language').length).toBeGreaterThan(0)})@@ -228,6 +229,68 @@ describe('AccountSetting', () => {// ActrenderAccountSetting()+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation+ // Assert+ // On mobile, the labels should not be rendered as per the implementation// Assert// On mobile, the labels should not be rendered as per the implementationexpect(screen.queryByText('common.settings.provider')).not.toBeInTheDocument()@@ -243,10 +306,41 @@ describe('AccountSetting', () => {// ActrenderAccountSetting()+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert// Assertexpect(screen.queryByText('common.settings.provider')).not.toBeInTheDocument()expect(screen.queryByText('common.settings.members')).not.toBeInTheDocument()- expect(screen.getByText('common.settings.language')).toBeInTheDocument()+ expect(screen.getByText('common.settings.language'))!.toBeInTheDocument()})it('should hide billing and custom tabs when disabled', () => {@@ -260,6 +354,37 @@ describe('AccountSetting', () => {// ActrenderAccountSetting()+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert// Assertexpect(screen.queryByText('common.settings.billing')).not.toBeInTheDocument()expect(screen.queryByText('custom.custom')).not.toBeInTheDocument()@@ -277,7 +402,8 @@ describe('AccountSetting', () => {// Assertexpect(mockOnTabChange).toHaveBeenCalledWith(ACCOUNT_SETTING_TAB.PROVIDER)// Check for content from ModelProviderPage- expect(screen.getByText('common.modelProvider.models')).toBeInTheDocument()+ // Check for content from ModelProviderPage+ expect(screen.getByText('common.modelProvider.models'))!.toBeInTheDocument()})it('should navigate through various tabs and show correct details', () => {@@ -304,11 +430,11 @@ describe('AccountSetting', () => {expect(screen.getAllByText('custom.custom').length).toBeGreaterThan(1)// Language- fireEvent.click(screen.getAllByText('common.settings.language')[0])+ fireEvent.click(screen.getAllByText('common.settings.language')[0]!)expect(screen.getAllByText('common.settings.language').length).toBeGreaterThan(1)// Members- fireEvent.click(screen.getAllByText('common.settings.members')[0])+ fireEvent.click(screen.getAllByText('common.settings.members')[0]!)expect(screen.getAllByText('common.settings.members').length).toBeGreaterThan(1)})})@@ -344,8 +470,9 @@ describe('AccountSetting', () => {fireEvent.change(input, { target: { value: 'test-search' } })// Assert- expect(input).toHaveValue('test-search')- expect(screen.getByText('common.modelProvider.models')).toBeInTheDocument()+ // Assert+ expect(input)!.toHaveValue('test-search')+ expect(screen.getByText('common.modelProvider.models'))!.toBeInTheDocument()})it('should handle scroll event in panel', () => {@@ -354,11 +481,12 @@ describe('AccountSetting', () => {const scrollContainer = screen.getByRole('dialog').querySelector('.overscroll-contain')// Assert- expect(scrollContainer).toBeInTheDocument()+ // Assert+ expect(scrollContainer)!.toBeInTheDocument()if (scrollContainer) {// Scroll downfireEvent.scroll(scrollContainer, { target: { scrollTop: 100 } })- expect(scrollContainer).toHaveClass('overscroll-contain')+ expect(scrollContainer)!.toHaveClass('overscroll-contain')// Scroll back upfireEvent.scroll(scrollContainer, { target: { scrollTop: 0 } })diff --git a/web/app/components/header/account-setting/api-based-extension-page/__tests__/index.spec.tsx b/web/app/components/header/account-setting/api-based-extension-page/__tests__/index.spec.tsxindex 58b694e44ec..adac0f7c6cd 100644--- a/web/app/components/header/account-setting/api-based-extension-page/__tests__/index.spec.tsx+++ b/web/app/components/header/account-setting/api-based-extension-page/__tests__/index.spec.tsx@@ -38,7 +38,8 @@ describe('ApiBasedExtensionPage', () => {render(<ApiBasedExtensionPage />)// Assert- expect(screen.getByText('common.apiBasedExtension.title')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('common.apiBasedExtension.title'))!.toBeInTheDocument()})it('should render list of extensions when data exists', () => {@@ -58,10 +59,11 @@ describe('ApiBasedExtensionPage', () => {render(<ApiBasedExtensionPage />)// Assert- expect(screen.getByText('Extension 1')).toBeInTheDocument()- expect(screen.getByText('url1')).toBeInTheDocument()- expect(screen.getByText('Extension 2')).toBeInTheDocument()- expect(screen.getByText('url2')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('Extension 1'))!.toBeInTheDocument()+ expect(screen.getByText('url1'))!.toBeInTheDocument()+ expect(screen.getByText('Extension 2'))!.toBeInTheDocument()+ expect(screen.getByText('url2'))!.toBeInTheDocument()})it('should handle loading state', () => {@@ -75,9 +77,40 @@ describe('ApiBasedExtensionPage', () => {// Actrender(<ApiBasedExtensionPage />)+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert// Assertexpect(screen.queryByText('common.apiBasedExtension.title')).not.toBeInTheDocument()- expect(screen.getByText('common.apiBasedExtension.add')).toBeInTheDocument()+ expect(screen.getByText('common.apiBasedExtension.add'))!.toBeInTheDocument()})})@@ -113,7 +146,7 @@ describe('ApiBasedExtensionPage', () => {fireEvent.click(screen.getByText('common.apiBasedExtension.add'))// Trigger callback manually from the mock call- const callArgs = mockSetShowApiBasedExtensionModal.mock.calls[0][0]+ const callArgs = mockSetShowApiBasedExtensionModal.mock.calls[0]![0]if (typeof callArgs === 'object' && callArgs !== null && 'onSaveCallback' in callArgs) {if (callArgs.onSaveCallback) {callArgs.onSaveCallback()@@ -138,7 +171,7 @@ describe('ApiBasedExtensionPage', () => {fireEvent.click(screen.getByText('common.operation.edit'))// Retrieve the onSaveCallback from the modal call and execute it- const callArgs = mockSetShowApiBasedExtensionModal.mock.calls[0][0]+ const callArgs = mockSetShowApiBasedExtensionModal.mock.calls[0]![0]if (typeof callArgs === 'object' && callArgs !== null && 'onSaveCallback' in callArgs) {if (callArgs.onSaveCallback)callArgs.onSaveCallback()diff --git a/web/app/components/header/account-setting/api-based-extension-page/__tests__/item.spec.tsx b/web/app/components/header/account-setting/api-based-extension-page/__tests__/item.spec.tsxindex cf5c46a5094..38dcf9dec5f 100644--- a/web/app/components/header/account-setting/api-based-extension-page/__tests__/item.spec.tsx+++ b/web/app/components/header/account-setting/api-based-extension-page/__tests__/item.spec.tsx@@ -39,8 +39,9 @@ describe('Item Component', () => {render(<Item data={mockData} onUpdate={mockOnUpdate} />)// Assert- expect(screen.getByText('Test Extension')).toBeInTheDocument()- expect(screen.getByText('https://api.example.com')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('Test Extension'))!.toBeInTheDocument()+ expect(screen.getByText('https://api.example.com'))!.toBeInTheDocument()})it('should render with minimal extension data', () => {@@ -51,8 +52,9 @@ describe('Item Component', () => {render(<Item data={minimalData} onUpdate={mockOnUpdate} />)// Assert- expect(screen.getByText('common.operation.edit')).toBeInTheDocument()- expect(screen.getByText('common.operation.delete')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('common.operation.edit'))!.toBeInTheDocument()+ expect(screen.getByText('common.operation.delete'))!.toBeInTheDocument()})})@@ -66,7 +68,7 @@ describe('Item Component', () => {expect(mockSetShowApiBasedExtensionModal).toHaveBeenCalledWith(expect.objectContaining({payload: mockData,}))- const lastCall = mockSetShowApiBasedExtensionModal.mock.calls[0][0]+ const lastCall = mockSetShowApiBasedExtensionModal.mock.calls[0]![0]if (typeof lastCall === 'object' && lastCall !== null && 'onSaveCallback' in lastCall)expect(lastCall.onSaveCallback).toBeInstanceOf(Function)})@@ -77,7 +79,7 @@ describe('Item Component', () => {fireEvent.click(screen.getByText('common.operation.edit'))// Assert- const modalCallArg = mockSetShowApiBasedExtensionModal.mock.calls[0][0]+ const modalCallArg = mockSetShowApiBasedExtensionModal.mock.calls[0]![0]if (typeof modalCallArg === 'object' && modalCallArg !== null && 'onSaveCallback' in modalCallArg) {const onSaveCallback = modalCallArg.onSaveCallbackif (onSaveCallback) {@@ -95,7 +97,8 @@ describe('Item Component', () => {fireEvent.click(screen.getByText('common.operation.delete'))// Assert- expect(screen.getByText(/common\.operation\.delete.*Test Extension.*\?/i)).toBeInTheDocument()+ // Assert+ expect(screen.getByText(/common\.operation\.delete.*Test Extension.*\?/i))!.toBeInTheDocument()})it('should call delete API and triggers onUpdate when confirming deletion', async () => {@@ -188,7 +191,8 @@ describe('Item Component', () => {fireEvent.click(deleteBtn)// Assert- expect(screen.getByText(/.*Test Extension.*\?/i)).toBeInTheDocument()+ // Assert+ expect(screen.getByText(/.*Test Extension.*\?/i))!.toBeInTheDocument()useTranslationSpy.mockRestore()})diff --git a/web/app/components/header/account-setting/api-based-extension-page/__tests__/selector.spec.tsx b/web/app/components/header/account-setting/api-based-extension-page/__tests__/selector.spec.tsxindex 3e16528ff08..82acd22d971 100644--- a/web/app/components/header/account-setting/api-based-extension-page/__tests__/selector.spec.tsx+++ b/web/app/components/header/account-setting/api-based-extension-page/__tests__/selector.spec.tsx@@ -46,7 +46,8 @@ describe('ApiBasedExtensionSelector', () => {render(<ApiBasedExtensionSelector value="" onChange={mockOnChange} />)// Assert- expect(screen.getByText('common.apiBasedExtension.selector.placeholder')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('common.apiBasedExtension.selector.placeholder'))!.toBeInTheDocument()})it('should render selected item name', async () => {@@ -54,7 +55,8 @@ describe('ApiBasedExtensionSelector', () => {render(<ApiBasedExtensionSelector value="1" onChange={mockOnChange} />)// Assert- expect(screen.getByText('Extension 1')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('Extension 1'))!.toBeInTheDocument()})})@@ -66,7 +68,8 @@ describe('ApiBasedExtensionSelector', () => {fireEvent.click(trigger)// Assert- expect(await screen.findByText('common.apiBasedExtension.selector.title')).toBeInTheDocument()+ // Assert+ expect(await screen.findByText('common.apiBasedExtension.selector.title'))!.toBeInTheDocument()})it('should call onChange and closes dropdown when an extension is selected', async () => {@@ -111,7 +114,7 @@ describe('ApiBasedExtensionSelector', () => {}))// Trigger callback- const lastCall = mockSetShowApiBasedExtensionModal.mock.calls[0][0]+ const lastCall = mockSetShowApiBasedExtensionModal.mock.calls[0]![0]if (typeof lastCall === 'object' && lastCall !== null && 'onSaveCallback' in lastCall) {if (lastCall.onSaveCallback) {lastCall.onSaveCallback()diff --git a/web/app/components/header/account-setting/data-source-page-new/__tests__/card.spec.tsx b/web/app/components/header/account-setting/data-source-page-new/__tests__/card.spec.tsxindex 12e37553fcc..fedb7d8a4ee 100644--- a/web/app/components/header/account-setting/data-source-page-new/__tests__/card.spec.tsx+++ b/web/app/components/header/account-setting/data-source-page-new/__tests__/card.spec.tsx@@ -110,7 +110,7 @@ describe('Card Component', () => {type: CredentialTypeEnum.API_KEY,is_default: true,avatar_url: 'avatar1',- },+ }!,],}@@ -144,11 +144,12 @@ describe('Card Component', () => {render(<Card item={mockItem} />)// Assert- expect(screen.getByText('Test Label')).toBeInTheDocument()- expect(screen.getByText(/Test Author/)).toBeInTheDocument()- expect(screen.getByText(/test-name/)).toBeInTheDocument()- expect(screen.getByRole('img')).toHaveAttribute('src', 'test-icon-url')- expect(screen.getByText('Credential 1')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('Test Label'))!.toBeInTheDocument()+ expect(screen.getByText(/Test Author/))!.toBeInTheDocument()+ expect(screen.getByText(/test-name/))!.toBeInTheDocument()+ expect(screen.getByRole('img'))!.toHaveAttribute('src', 'test-icon-url')+ expect(screen.getByText('Credential 1'))!.toBeInTheDocument()expect(usePluginAuthAction).toHaveBeenCalledWith(expect.objectContaining({@@ -168,7 +169,8 @@ describe('Card Component', () => {render(<Card item={emptyItem} />)// Assert- expect(screen.getByText(/plugin.auth.emptyAuth/)).toBeInTheDocument()+ // Assert+ expect(screen.getByText(/plugin.auth.emptyAuth/))!.toBeInTheDocument()})})@@ -218,7 +220,7 @@ describe('Card Component', () => {const oAuthItem = {...mockItem,credentials_list: [{- ...mockItem.credentials_list[0],+ ...mockItem.credentials_list[0]!,type: CredentialTypeEnum.OAUTH2,}],}@@ -245,7 +247,7 @@ describe('Card Component', () => {const oAuthItem = {...mockItem,credentials_list: [{- ...mockItem.credentials_list[0],+ ...mockItem.credentials_list[0]!,type: CredentialTypeEnum.OAUTH2,}],}@@ -268,7 +270,7 @@ describe('Card Component', () => {const oAuthItem = {...mockItem,credentials_list: [{- ...mockItem.credentials_list[0],+ ...mockItem.credentials_list[0]!,type: CredentialTypeEnum.OAUTH2,}],}@@ -297,9 +299,10 @@ describe('Card Component', () => {render(<Card item={mockItem} />)// Assert- expect(screen.getByText(/list.delete.title/)).toBeInTheDocument()+ // Assert+ expect(screen.getByText(/list.delete.title/))!.toBeInTheDocument()const confirmButton = screen.getByText(/operation.confirm/).closest('button')- expect(confirmButton).toBeEnabled()+ expect(confirmButton)!.toBeEnabled()// Act - CancelfireEvent.click(screen.getByText(/operation.cancel/))@@ -317,8 +320,9 @@ describe('Card Component', () => {render(<Card item={mockItem} disabled={false} />)// Assert- expect(screen.getByTestId('mock-api-key-modal')).toBeInTheDocument()- expect(screen.getByTestId('mock-api-key-modal')).toHaveAttribute('data-disabled', 'false')+ // Assert+ expect(screen.getByTestId('mock-api-key-modal'))!.toBeInTheDocument()+ expect(screen.getByTestId('mock-api-key-modal'))!.toHaveAttribute('data-disabled', 'false')// ActfireEvent.click(screen.getByTestId('modal-close'))@@ -337,7 +341,8 @@ describe('Card Component', () => {render(<Card item={mockItem} disabled={false} />)// Assert- expect(screen.getByTestId('mock-api-key-modal')).toHaveAttribute('data-disabled', 'true')+ // Assert+ expect(screen.getByTestId('mock-api-key-modal'))!.toHaveAttribute('data-disabled', 'true')})})diff --git a/web/app/components/header/account-setting/data-source-page-new/hooks/use-marketplace-all-plugins.ts b/web/app/components/header/account-setting/data-source-page-new/hooks/use-marketplace-all-plugins.tsindex 90ef6e78a4b..7e2dc572fc6 100644--- a/web/app/components/header/account-setting/data-source-page-new/hooks/use-marketplace-all-plugins.ts+++ b/web/app/components/header/account-setting/data-source-page-new/hooks/use-marketplace-all-plugins.ts@@ -54,8 +54,8 @@ export const useMarketplaceAllPlugins = (providers: any[], searchText: string) =for (let i = 0; i < plugins.length; i++) {const plugin = plugins[i]- if (plugin.type !== 'bundle' && !allPlugins.find(p => p.plugin_id === plugin.plugin_id))- allPlugins.push(plugin)+ if (plugin!.type !== 'bundle' && !allPlugins.find(p => p.plugin_id === plugin!.plugin_id))+ allPlugins.push(plugin!)}}diff --git a/web/app/components/header/account-setting/index.tsx b/web/app/components/header/account-setting/index.tsxindex 64dff27cf61..3ec6dea3151 100644--- a/web/app/components/header/account-setting/index.tsx+++ b/web/app/components/header/account-setting/index.tsx@@ -130,7 +130,7 @@ export default function AccountSetting({],},]- const activeItem = [...menuItems[0].items, ...menuItems[1].items].find(item => item.key === activeMenu)+ const activeItem = [...menuItems[0]!.items, ...menuItems[1]!.items].find(item => item.key === activeMenu)const [searchValue, setSearchValue] = useState<string>('')diff --git a/web/app/components/header/account-setting/members-page/__tests__/index.spec.tsx b/web/app/components/header/account-setting/members-page/__tests__/index.spec.tsxindex 9513eeee027..b50073b1f26 100644--- a/web/app/components/header/account-setting/members-page/__tests__/index.spec.tsx+++ b/web/app/components/header/account-setting/members-page/__tests__/index.spec.tsx@@ -129,9 +129,9 @@ describe('MembersPage', () => {it('should render workspace and member information', () => {render(<MembersPage />)- expect(screen.getByText('Test Workspace')).toBeInTheDocument()- expect(screen.getByText('Owner User')).toBeInTheDocument()- expect(screen.getByText('Admin User')).toBeInTheDocument()+ expect(screen.getByText('Test Workspace'))!.toBeInTheDocument()+ expect(screen.getByText('Owner User'))!.toBeInTheDocument()+ expect(screen.getByText('Admin User'))!.toBeInTheDocument()})it('should open and close invite modal', async () => {@@ -140,7 +140,7 @@ describe('MembersPage', () => {render(<MembersPage />)await user.click(screen.getByRole('button', { name: /invite/i }))- expect(screen.getByText('Invite Modal')).toBeInTheDocument()+ expect(screen.getByText('Invite Modal'))!.toBeInTheDocument()await user.click(screen.getByRole('button', { name: 'Close Invite Modal' }))expect(screen.queryByText('Invite Modal')).not.toBeInTheDocument()@@ -154,7 +154,7 @@ describe('MembersPage', () => {await user.click(screen.getByRole('button', { name: /invite/i }))await user.click(screen.getByRole('button', { name: 'Send Invite Results' }))- expect(screen.getByText('Invited Modal')).toBeInTheDocument()+ expect(screen.getByText('Invited Modal'))!.toBeInTheDocument()expect(mockRefetch).toHaveBeenCalled()await user.click(screen.getByRole('button', { name: 'Close Invited Modal' }))@@ -167,7 +167,7 @@ describe('MembersPage', () => {render(<MembersPage />)await user.click(screen.getByRole('button', { name: /transfer ownership/i }))- expect(screen.getByText('Transfer Ownership Modal')).toBeInTheDocument()+ expect(screen.getByText('Transfer Ownership Modal'))!.toBeInTheDocument()})it('should show non-interactive owner role when transfer ownership is not allowed', () => {@@ -178,7 +178,7 @@ describe('MembersPage', () => {render(<MembersPage />)- expect(screen.getByText('common.members.owner')).toBeInTheDocument()+ expect(screen.getByText('common.members.owner'))!.toBeInTheDocument()expect(screen.queryByRole('button', { name: /transfer ownership/i })).not.toBeInTheDocument()})@@ -202,7 +202,7 @@ describe('MembersPage', () => {render(<MembersPage />)await user.click(screen.getByTestId('edit-workspace-pencil'))- expect(screen.getByText('Edit Workspace Modal')).toBeInTheDocument()+ expect(screen.getByText('Edit Workspace Modal'))!.toBeInTheDocument()await user.click(screen.getByRole('button', { name: 'Close Edit Workspace' }))expect(screen.queryByText('Edit Workspace Modal')).not.toBeInTheDocument()@@ -214,7 +214,7 @@ describe('MembersPage', () => {render(<MembersPage />)await user.click(screen.getByRole('button', { name: /transfer ownership/i }))- expect(screen.getByText('Transfer Ownership Modal')).toBeInTheDocument()+ expect(screen.getByText('Transfer Ownership Modal'))!.toBeInTheDocument()await user.click(screen.getByRole('button', { name: 'Close Transfer Modal' }))expect(screen.queryByText('Transfer Ownership Modal')).not.toBeInTheDocument()@@ -222,7 +222,7 @@ describe('MembersPage', () => {it('should show pending status and you indicator', () => {const pendingAccount: Member = {- ...mockAccounts[1],+ ...mockAccounts[1]!,status: 'pending',}vi.mocked(useMembers).mockReturnValue({@@ -232,8 +232,8 @@ describe('MembersPage', () => {render(<MembersPage />)- expect(screen.getByText(/members\.pending/i)).toBeInTheDocument()- expect(screen.getByText(/members\.you/i)).toBeInTheDocument() // Current user is [email protected]+ expect(screen.getByText(/members\.pending/i))!.toBeInTheDocument()+ expect(screen.getByText(/members\.you/i))!.toBeInTheDocument() // Current user is [email protected]})it('should show billing information for limited plan', () => {@@ -247,10 +247,10 @@ describe('MembersPage', () => {render(<MembersPage />)- expect(screen.getByText(/plansCommon\.member/i)).toBeInTheDocument()- expect(screen.getByText('2')).toBeInTheDocument() // accounts.length- expect(screen.getByText('/')).toBeInTheDocument()- expect(screen.getByText('5')).toBeInTheDocument() // plan.total.teamMembers+ expect(screen.getByText(/plansCommon\.member/i))!.toBeInTheDocument()+ expect(screen.getByText('2'))!.toBeInTheDocument() // accounts.length+ expect(screen.getByText('/'))!.toBeInTheDocument()+ expect(screen.getByText('5'))!.toBeInTheDocument() // plan.total.teamMembers})it('should show unlimited billing information', () => {@@ -264,7 +264,7 @@ describe('MembersPage', () => {render(<MembersPage />)- expect(screen.getByText(/plansCommon\.unlimited/i)).toBeInTheDocument()+ expect(screen.getByText(/plansCommon\.unlimited/i))!.toBeInTheDocument()})it('should show non-billing member format for team plan even when billing is enabled', () => {@@ -279,7 +279,8 @@ describe('MembersPage', () => {render(<MembersPage />)// Plan.team is an unlimited member plan → isNotUnlimitedMemberPlan=false → non-billing layout- expect(screen.getByText(/plansCommon\.memberAfter/i)).toBeInTheDocument()+ // Plan.team is an unlimited member plan → isNotUnlimitedMemberPlan=false → non-billing layout+ expect(screen.getByText(/plansCommon\.memberAfter/i))!.toBeInTheDocument()})it('should show invite button when user is manager but not owner', () => {@@ -292,13 +293,13 @@ describe('MembersPage', () => {render(<MembersPage />)- expect(screen.getByRole('button', { name: /invite/i })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: /invite/i }))!.toBeInTheDocument()expect(screen.queryByRole('button', { name: /transfer ownership/i })).not.toBeInTheDocument()})it('should use created_at as fallback when last_active_at is empty', () => {const memberNoLastActive: Member = {- ...mockAccounts[1],+ ...mockAccounts[1]!,last_active_at: '',created_at: '1700000000',}@@ -327,8 +328,8 @@ describe('MembersPage', () => {render(<MembersPage />)- expect(screen.getByText(/plansCommon\.member/i)).toBeInTheDocument()- expect(screen.getByText('1')).toBeInTheDocument()+ expect(screen.getByText(/plansCommon\.member/i))!.toBeInTheDocument()+ expect(screen.getByText('1'))!.toBeInTheDocument()})it('should not show plural s when only one account in non-billing layout', () => {@@ -339,8 +340,8 @@ describe('MembersPage', () => {render(<MembersPage />)- expect(screen.getByText(/plansCommon\.memberAfter/i)).toBeInTheDocument()- expect(screen.getByText('1')).toBeInTheDocument()+ expect(screen.getByText(/plansCommon\.memberAfter/i))!.toBeInTheDocument()+ expect(screen.getByText('1'))!.toBeInTheDocument()})it('should show normal role as fallback for unknown role', () => {@@ -357,7 +358,7 @@ describe('MembersPage', () => {render(<MembersPage />)- expect(screen.getByText('common.members.normal')).toBeInTheDocument()+ expect(screen.getByText('common.members.normal'))!.toBeInTheDocument()})it('should show upgrade button when member limit is full', () => {@@ -371,6 +372,6 @@ describe('MembersPage', () => {render(<MembersPage />)- expect(screen.getByText('Upgrade Button')).toBeInTheDocument()+ expect(screen.getByText('Upgrade Button'))!.toBeInTheDocument()})})diff --git a/web/app/components/header/account-setting/model-provider-page/__tests__/hooks.spec.ts b/web/app/components/header/account-setting/model-provider-page/__tests__/hooks.spec.tsindex 1d50ee43b03..9b592e9fffd 100644--- a/web/app/components/header/account-setting/model-provider-page/__tests__/hooks.spec.ts+++ b/web/app/components/header/account-setting/model-provider-page/__tests__/hooks.spec.ts@@ -758,7 +758,7 @@ describe('hooks', () => {expect(result.current.textGenerationModelList).toEqual(modelList)expect(result.current.activeTextGenerationModelList).toHaveLength(1)- expect(result.current.activeTextGenerationModelList[0].provider).toBe('openai')+ expect(result.current.activeTextGenerationModelList[0]!.provider).toBe('openai')})it('should filter active models correctly', () => {@@ -770,7 +770,7 @@ describe('hooks', () => {const { result } = renderHook(() => useTextGenerationCurrentProviderAndModelAndModelList())expect(result.current.activeTextGenerationModelList).toHaveLength(1)- expect(result.current.activeTextGenerationModelList[0].status).toBe(ModelStatusEnum.active)+ expect(result.current.activeTextGenerationModelList[0]!.status).toBe(ModelStatusEnum.active)})it('should find current provider and model', () => {@@ -1145,7 +1145,7 @@ describe('hooks', () => {const { result } = renderHook(() => useMarketplaceAllPlugins(providers, ''))expect(result.current.plugins!).toHaveLength(1)- expect(result.current.plugins![0].plugin_id).toBe('other')+ expect(result.current.plugins![0]!.plugin_id).toBe('other')})it('should use search when searchText is provided', () => {@@ -1186,7 +1186,7 @@ describe('hooks', () => {const { result } = renderHook(() => useMarketplaceAllPlugins([], ''))expect(result.current.plugins!).toHaveLength(1)- expect(result.current.plugins![0].plugin_id).toBe('plugin1')+ expect(result.current.plugins![0]!.plugin_id).toBe('plugin1')})it('should deduplicate plugins that exist in both collections and regular plugins', () => {@@ -1613,7 +1613,7 @@ describe('hooks', () => {)})- const callArgs = setShowModelModal.mock.calls[0][0]+ const callArgs = setShowModelModal.mock.calls[0]![0]const newPayload = { test: 'data' }const formValues = { field: 'value' }@@ -1636,7 +1636,7 @@ describe('hooks', () => {result.current(provider, ConfigurationMethodEnum.predefinedModel)})- const callArgs = setShowModelModal.mock.calls[0][0]+ const callArgs = setShowModelModal.mock.calls[0]![0]// Should not throw when onUpdate is not providedexpect(() => {diff --git a/web/app/components/header/account-setting/model-provider-page/__tests__/utils.spec.ts b/web/app/components/header/account-setting/model-provider-page/__tests__/utils.spec.tsindex d49343e0c61..e2a2aea22c5 100644--- a/web/app/components/header/account-setting/model-provider-page/__tests__/utils.spec.ts+++ b/web/app/components/header/account-setting/model-provider-page/__tests__/utils.spec.ts@@ -277,7 +277,7 @@ describe('utils', () => {const schema = genModelTypeFormSchema([ModelTypeEnum.textGeneration])expect(schema.type).toBe(FormTypeEnum.select)expect(schema.variable).toBe('__model_type')- expect(schema.options[0].value).toBe(ModelTypeEnum.textGeneration)+ expect(schema.options[0]!.value).toBe(ModelTypeEnum.textGeneration)})})diff --git a/web/app/components/header/account-setting/model-provider-page/hooks.ts b/web/app/components/header/account-setting/model-provider-page/hooks.tsindex 791a42deb5b..27b84f81bb0 100644--- a/web/app/components/header/account-setting/model-provider-page/hooks.ts+++ b/web/app/components/header/account-setting/model-provider-page/hooks.ts@@ -313,8 +313,8 @@ export const useMarketplaceAllPlugins = (providers: ModelProvider[], searchText:for (let i = 0; i < plugins.length; i++) {const plugin = plugins[i]- if (plugin.type !== 'bundle' && !allPlugins.find(p => p.plugin_id === plugin.plugin_id))- allPlugins.push(plugin)+ if (plugin!.type !== 'bundle' && !allPlugins.find(p => p.plugin_id === plugin!.plugin_id))+ allPlugins.push(plugin!)}}diff --git a/web/app/components/header/account-setting/model-provider-page/model-auth/__tests__/add-credential-in-load-balancing.spec.tsx b/web/app/components/header/account-setting/model-provider-page/model-auth/__tests__/add-credential-in-load-balancing.spec.tsxindex bf26880a8ba..c72264dd7ae 100644--- a/web/app/components/header/account-setting/model-provider-page/model-auth/__tests__/add-credential-in-load-balancing.spec.tsx+++ b/web/app/components/header/account-setting/model-provider-page/model-auth/__tests__/add-credential-in-load-balancing.spec.tsx@@ -18,7 +18,7 @@ vi.mock('@/app/components/header/account-setting/model-provider-page/model-auth'<div>{renderTrigger(false)}<button onClick={() => authParams?.onUpdate?.({ provider: 'x' }, { key: 'value' })}>Run update</button>- <button onClick={() => onItemClick?.(items[0].credentials[0])}>Select first</button>+ <button onClick={() => onItemClick?.(items[0]!.credentials[0]!)}>Select first</button></div>),}))@@ -57,7 +57,7 @@ describe('AddCredentialInLoadBalancing', () => {/>,)- expect(screen.getByText(/modelProvider.auth.addCredential/i)).toBeInTheDocument()+ expect(screen.getByText(/modelProvider.auth.addCredential/i))!.toBeInTheDocument()})it('should forward update payload when update action happens', () => {@@ -127,7 +127,7 @@ describe('AddCredentialInLoadBalancing', () => {// The trigger div rendered by renderTrigger(true) should have bg-state-base-hover// (the static class applied when open=true via cn())const triggerDiv = container.querySelector('[data-testid="open-trigger"] > div')- expect(triggerDiv).toBeInTheDocument()+ expect(triggerDiv)!.toBeInTheDocument()expect(triggerDiv!.className).toContain('bg-state-base-hover')}finally {@@ -148,7 +148,7 @@ describe('AddCredentialInLoadBalancing', () => {/>,)- expect(screen.getByText(/modelProvider.auth.addCredential/i)).toBeInTheDocument()+ expect(screen.getByText(/modelProvider.auth.addCredential/i))!.toBeInTheDocument()})it('should handle undefined available_credentials gracefully using nullish coalescing', () => {@@ -169,7 +169,8 @@ describe('AddCredentialInLoadBalancing', () => {)// Component should render without error - the ?? [] fallback is used- expect(screen.getByText(/modelProvider.auth.addCredential/i)).toBeInTheDocument()+ // Component should render without error - the ?? [] fallback is used+ expect(screen.getByText(/modelProvider.auth.addCredential/i))!.toBeInTheDocument()})it('should not throw when update action fires without onUpdate prop', () => {diff --git a/web/app/components/header/account-setting/model-provider-page/model-auth/__tests__/switch-credential-in-load-balancing.spec.tsx b/web/app/components/header/account-setting/model-provider-page/model-auth/__tests__/switch-credential-in-load-balancing.spec.tsxindex 9b58984af9c..0232adcf4ae 100644--- a/web/app/components/header/account-setting/model-provider-page/model-auth/__tests__/switch-credential-in-load-balancing.spec.tsx+++ b/web/app/components/header/account-setting/model-provider-page/model-auth/__tests__/switch-credential-in-load-balancing.spec.tsx@@ -7,7 +7,7 @@ import SwitchCredentialInLoadBalancing from '../switch-credential-in-load-balancvi.mock('../authorized', () => ({default: ({ renderTrigger, onItemClick, items }: { renderTrigger: () => React.ReactNode, onItemClick: (c: unknown) => void, items: { credentials: unknown[] }[] }) => (<div data-testid="authorized-mock">- <div data-testid="trigger-container" onClick={() => onItemClick(items[0].credentials[0])}>+ <div data-testid="trigger-container" onClick={() => onItemClick(items[0]!.credentials[0])}>{renderTrigger()}</div></div>@@ -55,8 +55,8 @@ describe('SwitchCredentialInLoadBalancing', () => {/>,)- expect(screen.getByText('Key 1')).toBeInTheDocument()- expect(screen.getByTestId('indicator-green')).toBeInTheDocument()+ expect(screen.getByText('Key 1'))!.toBeInTheDocument()+ expect(screen.getByTestId('indicator-green'))!.toBeInTheDocument()})it('should render auth removed status when selected credential is not in list', () => {@@ -70,8 +70,8 @@ describe('SwitchCredentialInLoadBalancing', () => {/>,)- expect(screen.getByText(/modelProvider.auth.authRemoved/)).toBeInTheDocument()- expect(screen.getByTestId('indicator-red')).toBeInTheDocument()+ expect(screen.getByText(/modelProvider.auth.authRemoved/))!.toBeInTheDocument()+ expect(screen.getByTestId('indicator-red'))!.toBeInTheDocument()})it('should render unavailable status when credentials list is empty', () => {@@ -85,7 +85,7 @@ describe('SwitchCredentialInLoadBalancing', () => {/>,)- expect(screen.getByText(/auth.credentialUnavailableInButton/)).toBeInTheDocument()+ expect(screen.getByText(/auth.credentialUnavailableInButton/))!.toBeInTheDocument()expect(screen.queryByTestId(/indicator-/)).not.toBeInTheDocument()})@@ -117,7 +117,7 @@ describe('SwitchCredentialInLoadBalancing', () => {)fireEvent.mouseEnter(screen.getByText(/auth.credentialUnavailableInButton/))- expect(screen.getByText('plugin.auth.credentialUnavailable')).toBeInTheDocument()+ expect(screen.getByText('plugin.auth.credentialUnavailable'))!.toBeInTheDocument()})// Empty credentials with allowed custom: no tooltip but still shows unavailable text@@ -134,7 +134,8 @@ describe('SwitchCredentialInLoadBalancing', () => {)// Assert- expect(screen.getByText(/auth.credentialUnavailableInButton/)).toBeInTheDocument()+ // Assert+ expect(screen.getByText(/auth.credentialUnavailableInButton/))!.toBeInTheDocument()expect(screen.queryByText('plugin.auth.credentialUnavailable')).not.toBeInTheDocument()})@@ -152,8 +153,8 @@ describe('SwitchCredentialInLoadBalancing', () => {/>,)- expect(screen.getByTestId('indicator-red')).toBeInTheDocument()- expect(screen.getByText(/auth.credentialUnavailableInButton/)).toBeInTheDocument()+ expect(screen.getByTestId('indicator-red'))!.toBeInTheDocument()+ expect(screen.getByText(/auth.credentialUnavailableInButton/))!.toBeInTheDocument()})// from_enterprise=true on the selected credential: Enterprise badge appears in the trigger@@ -170,7 +171,7 @@ describe('SwitchCredentialInLoadBalancing', () => {/>,)- expect(screen.getByText('Enterprise')).toBeInTheDocument()+ expect(screen.getByText('Enterprise'))!.toBeInTheDocument()})// non-empty credentials with allow_custom_token=false: no tooltip (tooltip only for empty+notAllowCustom)@@ -189,7 +190,7 @@ describe('SwitchCredentialInLoadBalancing', () => {fireEvent.mouseEnter(screen.getByText('Key 1'))expect(screen.queryByText('plugin.auth.credentialUnavailable')).not.toBeInTheDocument()- expect(screen.getByText('Key 1')).toBeInTheDocument()+ expect(screen.getByText('Key 1'))!.toBeInTheDocument()})it('should pass undefined currentCustomConfigurationModelFixedFields when model is undefined', () => {@@ -205,8 +206,9 @@ describe('SwitchCredentialInLoadBalancing', () => {)// Component still renders (Authorized receives undefined currentCustomConfigurationModelFixedFields)- expect(screen.getByTestId('authorized-mock')).toBeInTheDocument()- expect(screen.getByText('Key 1')).toBeInTheDocument()+ // Component still renders (Authorized receives undefined currentCustomConfigurationModelFixedFields)+ expect(screen.getByTestId('authorized-mock'))!.toBeInTheDocument()+ expect(screen.getByText('Key 1'))!.toBeInTheDocument()})it('should treat undefined credentials as empty list', () => {@@ -221,7 +223,8 @@ describe('SwitchCredentialInLoadBalancing', () => {)// credentials is undefined → empty=true → unavailable text shown- expect(screen.getByText(/auth.credentialUnavailableInButton/)).toBeInTheDocument()+ // credentials is undefined → empty=true → unavailable text shown+ expect(screen.getByText(/auth.credentialUnavailableInButton/))!.toBeInTheDocument()expect(screen.queryByTestId(/indicator-/)).not.toBeInTheDocument()})@@ -239,7 +242,39 @@ describe('SwitchCredentialInLoadBalancing', () => {)// indicator-green shown (not authRemoved, not unavailable, not empty)- expect(screen.getByTestId('indicator-green')).toBeInTheDocument()+ // indicator-green shown (not authRemoved, not unavailable, not empty)+ expect(screen.getByTestId('indicator-green'))!.toBeInTheDocument()+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name+ // credential_name is empty so nothing printed for name// credential_name is empty so nothing printed for nameexpect(screen.queryByText('Key 1')).not.toBeInTheDocument()})diff --git a/web/app/components/header/account-setting/model-provider-page/model-auth/authorized/__tests__/authorized-item.spec.tsx b/web/app/components/header/account-setting/model-provider-page/model-auth/authorized/__tests__/authorized-item.spec.tsxindex 57e80fa9899..c0ce70a5d00 100644--- a/web/app/components/header/account-setting/model-provider-page/model-auth/authorized/__tests__/authorized-item.spec.tsx+++ b/web/app/components/header/account-setting/model-provider-page/model-auth/authorized/__tests__/authorized-item.spec.tsx@@ -51,10 +51,10 @@ describe('AuthorizedItem', () => {/>,)- expect(screen.getByTestId('credential-item-cred-1')).toBeInTheDocument()- expect(screen.getByTestId('credential-item-cred-2')).toBeInTheDocument()- expect(screen.getByText('API Key 1')).toBeInTheDocument()- expect(screen.getByText('API Key 2')).toBeInTheDocument()+ expect(screen.getByTestId('credential-item-cred-1'))!.toBeInTheDocument()+ expect(screen.getByTestId('credential-item-cred-2'))!.toBeInTheDocument()+ expect(screen.getByText('API Key 1'))!.toBeInTheDocument()+ expect(screen.getByText('API Key 2'))!.toBeInTheDocument()})it('should render model title when showModelTitle is true', () => {@@ -67,7 +67,7 @@ describe('AuthorizedItem', () => {/>,)- expect(screen.getByTestId('model-icon')).toBeInTheDocument()+ expect(screen.getByTestId('model-icon'))!.toBeInTheDocument()expect(screen.getAllByText('gpt-4')).toHaveLength(2)})@@ -94,7 +94,7 @@ describe('AuthorizedItem', () => {/>,)- expect(screen.getByText('Custom Title')).toBeInTheDocument()+ expect(screen.getByText('Custom Title'))!.toBeInTheDocument()})it('should handle empty credentials array', () => {@@ -122,7 +122,7 @@ describe('AuthorizedItem', () => {/>,)- screen.getAllByText('Edit')[0].click()+ screen.getAllByText('Edit')[0]!.click()expect(onEdit).toHaveBeenCalledWith(mockCredentials[0], mockModel)})@@ -139,7 +139,7 @@ describe('AuthorizedItem', () => {/>,)- screen.getAllByText('Delete')[0].click()+ screen.getAllByText('Delete')[0]!.click()expect(onDelete).toHaveBeenCalledWith(mockCredentials[0], mockModel)})@@ -156,7 +156,7 @@ describe('AuthorizedItem', () => {/>,)- screen.getAllByText('Click')[0].click()+ screen.getAllByText('Click')[0]!.click()expect(onItemClick).toHaveBeenCalledWith(mockCredentials[0], mockModel)})diff --git a/web/app/components/header/account-setting/model-provider-page/model-auth/authorized/__tests__/index.spec.tsx b/web/app/components/header/account-setting/model-provider-page/model-auth/authorized/__tests__/index.spec.tsxindex e1d9a611f92..a3311816190 100644--- a/web/app/components/header/account-setting/model-provider-page/model-auth/authorized/__tests__/index.spec.tsx+++ b/web/app/components/header/account-setting/model-provider-page/model-auth/authorized/__tests__/index.spec.tsx@@ -90,8 +90,8 @@ describe('Authorized', () => {)fireEvent.click(screen.getByRole('button', { name: /trigger\s*closed/i }))- expect(screen.getByTestId('authorized-item')).toBeInTheDocument()- expect(screen.getByRole('button', { name: /addApiKey/i })).toBeInTheDocument()+ expect(screen.getByTestId('authorized-item'))!.toBeInTheDocument()+ expect(screen.getByRole('button', { name: /addApiKey/i }))!.toBeInTheDocument()})it('should call handleOpenModal when triggerOnlyOpenModal is true', () => {@@ -123,9 +123,9 @@ describe('Authorized', () => {)fireEvent.click(screen.getByRole('button', { name: /trigger\s*closed/i }))- fireEvent.click(screen.getAllByRole('button', { name: 'Select' })[0])+ fireEvent.click(screen.getAllByRole('button', { name: 'Select' })[0]!)- expect(onItemClick).toHaveBeenCalledWith(mockCredentials[0], mockItems[0].model)+ expect(onItemClick).toHaveBeenCalledWith(mockCredentials[0], mockItems[0]!.model)})it('should call handleActiveCredential when onItemClick is not provided', () => {@@ -139,9 +139,9 @@ describe('Authorized', () => {)fireEvent.click(screen.getByRole('button', { name: /trigger\s*closed/i }))- fireEvent.click(screen.getAllByRole('button', { name: 'Select' })[0])+ fireEvent.click(screen.getAllByRole('button', { name: 'Select' })[0]!)- expect(mockHandleActiveCredential).toHaveBeenCalledWith(mockCredentials[0], mockItems[0].model)+ expect(mockHandleActiveCredential).toHaveBeenCalledWith(mockCredentials[0], mockItems[0]!.model)})it('should call handleOpenModal with fixed model fields when adding model credential', () => {@@ -231,6 +231,6 @@ describe('Authorized', () => {)const dialog = screen.getByRole('alertdialog')- expect(within(dialog).getByRole('button', { name: /common.operation.confirm/i })).toBeDisabled()+ expect(within(dialog).getByRole('button', { name: /common.operation.confirm/i }))!.toBeDisabled()})})diff --git a/web/app/components/header/account-setting/model-provider-page/model-auth/hooks/__tests__/use-auth-service.spec.tsx b/web/app/components/header/account-setting/model-provider-page/model-auth/hooks/__tests__/use-auth-service.spec.tsxindex bd4f857047e..7cc14450414 100644--- a/web/app/components/header/account-setting/model-provider-page/model-auth/hooks/__tests__/use-auth-service.spec.tsx+++ b/web/app/components/header/account-setting/model-provider-page/model-auth/hooks/__tests__/use-auth-service.spec.tsx@@ -80,15 +80,15 @@ describe('useAuthService hooks', () => {const { result } = renderHook(() => useAuthService('openai'), { wrapper })// Provider services- expect(result.current.getAddCredentialService(false)).toBe(vi.mocked(useAddProviderCredential).mock.results[0].value.mutateAsync)- expect(result.current.getEditCredentialService(false)).toBe(vi.mocked(useEditProviderCredential).mock.results[0].value.mutateAsync)- expect(result.current.getDeleteCredentialService(false)).toBe(vi.mocked(useDeleteProviderCredential).mock.results[0].value.mutateAsync)- expect(result.current.getActiveCredentialService(false)).toBe(vi.mocked(useActiveProviderCredential).mock.results[0].value.mutateAsync)+ expect(result.current.getAddCredentialService(false)).toBe(vi.mocked(useAddProviderCredential).mock.results[0]!.value.mutateAsync)+ expect(result.current.getEditCredentialService(false)).toBe(vi.mocked(useEditProviderCredential).mock.results[0]!.value.mutateAsync)+ expect(result.current.getDeleteCredentialService(false)).toBe(vi.mocked(useDeleteProviderCredential).mock.results[0]!.value.mutateAsync)+ expect(result.current.getActiveCredentialService(false)).toBe(vi.mocked(useActiveProviderCredential).mock.results[0]!.value.mutateAsync)// Model services- expect(result.current.getAddCredentialService(true)).toBe(vi.mocked(useAddModelCredential).mock.results[0].value.mutateAsync)- expect(result.current.getEditCredentialService(true)).toBe(vi.mocked(useEditModelCredential).mock.results[0].value.mutateAsync)- expect(result.current.getDeleteCredentialService(true)).toBe(vi.mocked(useDeleteModelCredential).mock.results[0].value.mutateAsync)- expect(result.current.getActiveCredentialService(true)).toBe(vi.mocked(useActiveModelCredential).mock.results[0].value.mutateAsync)+ expect(result.current.getAddCredentialService(true)).toBe(vi.mocked(useAddModelCredential).mock.results[0]!.value.mutateAsync)+ expect(result.current.getEditCredentialService(true)).toBe(vi.mocked(useEditModelCredential).mock.results[0]!.value.mutateAsync)+ expect(result.current.getDeleteCredentialService(true)).toBe(vi.mocked(useDeleteModelCredential).mock.results[0]!.value.mutateAsync)+ expect(result.current.getActiveCredentialService(true)).toBe(vi.mocked(useActiveModelCredential).mock.results[0]!.value.mutateAsync)})})diff --git a/web/app/components/header/account-setting/model-provider-page/model-auth/hooks/__tests__/use-custom-models.spec.tsx b/web/app/components/header/account-setting/model-provider-page/model-auth/hooks/__tests__/use-custom-models.spec.tsxindex 2b5804c3f11..c98ead095f6 100644--- a/web/app/components/header/account-setting/model-provider-page/model-auth/hooks/__tests__/use-custom-models.spec.tsx+++ b/web/app/components/header/account-setting/model-provider-page/model-auth/hooks/__tests__/use-custom-models.spec.tsx@@ -15,7 +15,7 @@ describe('useCustomModels and useCanAddedModels', () => {const { result } = renderHook(() => useCustomModels(mockProvider))expect(result.current).toHaveLength(2)- expect(result.current[0].model).toBe('gpt-4')+ expect(result.current[0]!.model).toBe('gpt-4')const { result: emptyRes } = renderHook(() => useCustomModels({ custom_configuration: {} } as unknown as ModelProvider))expect(emptyRes.current).toEqual([])@@ -30,7 +30,7 @@ describe('useCustomModels and useCanAddedModels', () => {const { result } = renderHook(() => useCanAddedModels(mockProvider))expect(result.current).toHaveLength(1)- expect(result.current[0].model).toBe('gpt-4-turbo')+ expect(result.current[0]!.model).toBe('gpt-4-turbo')const { result: emptyRes } = renderHook(() => useCanAddedModels({ custom_configuration: {} } as unknown as ModelProvider))expect(emptyRes.current).toEqual([])diff --git a/web/app/components/header/account-setting/model-provider-page/model-auth/hooks/__tests__/use-model-form-schemas.spec.tsx b/web/app/components/header/account-setting/model-provider-page/model-auth/hooks/__tests__/use-model-form-schemas.spec.tsxindex 237d99c7e7f..dbe513163b8 100644--- a/web/app/components/header/account-setting/model-provider-page/model-auth/hooks/__tests__/use-model-form-schemas.spec.tsx+++ b/web/app/components/header/account-setting/model-provider-page/model-auth/hooks/__tests__/use-model-form-schemas.spec.tsx@@ -69,7 +69,7 @@ describe('useModelFormSchemas', () => {const { result: custom } = renderHook(() => useModelFormSchemas(mockProvider, false))expect(custom.current.modelNameAndTypeFormSchemas).toHaveLength(2)- expect(custom.current.modelNameAndTypeFormSchemas[0].variable).toBe('__model_name')+ expect(custom.current.modelNameAndTypeFormSchemas[0]!.variable).toBe('__model_name')const mockModel = { model: 'custom', model_type: 'text' } as unknown as CustomModelCredentialconst { result: customWithVal } = renderHook(() => useModelFormSchemas(mockProvider, false, undefined, undefined, mockModel))diff --git a/web/app/components/header/account-setting/model-provider-page/model-modal/__tests__/Form.spec.tsx b/web/app/components/header/account-setting/model-provider-page/model-modal/__tests__/Form.spec.tsxindex 14120ec08c9..bf1623fbef3 100644--- a/web/app/components/header/account-setting/model-provider-page/model-modal/__tests__/Form.spec.tsx+++ b/web/app/components/header/account-setting/model-provider-page/model-modal/__tests__/Form.spec.tsx@@ -192,9 +192,9 @@ describe('Form', () => {/>,)- expect(screen.getByPlaceholderText('API Key')).toHaveValue('default-key')- expect(screen.getByPlaceholderText('Secret')).toHaveValue('top-secret')- expect(screen.getByPlaceholderText('Limit')).toHaveValue(5)+ expect(screen.getByPlaceholderText('API Key'))!.toHaveValue('default-key')+ expect(screen.getByPlaceholderText('Secret'))!.toHaveValue('top-secret')+ expect(screen.getByPlaceholderText('Limit'))!.toHaveValue(5)expect(screen.queryByText('Hidden')).not.toBeInTheDocument()expect(screen.getAllByText('*')).toHaveLength(1)})@@ -234,7 +234,7 @@ describe('Form', () => {await waitFor(() => {expect(onChange).toHaveBeenCalledWith({ api_key: 'new-key', dependent: 'reset' })- expect(screen.getByText('Validating...')).toBeInTheDocument()+ expect(screen.getByText('Validating...'))!.toBeInTheDocument()})})@@ -279,7 +279,7 @@ describe('Form', () => {/>,)- expect(screen.getByText('EU')).toBeInTheDocument()+ expect(screen.getByText('EU'))!.toBeInTheDocument()expect(screen.queryByText('Hidden Region')).not.toBeInTheDocument()fireEvent.click(screen.getByText('EU'))fireEvent.click(screen.getByText('Locked A'))@@ -338,7 +338,7 @@ describe('Form', () => {/>,)- expect(screen.getByText('Select A')).toBeInTheDocument()+ expect(screen.getByText('Select A'))!.toBeInTheDocument()fireEvent.click(screen.getByText('Select A'))fireEvent.click(screen.getByText('Select B'))@@ -459,12 +459,12 @@ describe('Form', () => {/>,)- expect(screen.getByText('Override Field')).toBeInTheDocument()- expect(screen.getByText(/Custom Render:.*custom_field/)).toBeInTheDocument()+ expect(screen.getByText('Override Field'))!.toBeInTheDocument()+ expect(screen.getByText(/Custom Render:.*custom_field/))!.toBeInTheDocument()expect(screen.getAllByText('allowed')).toHaveLength(3)expect(screen.getAllByText('blocked')).toHaveLength(1)- fireEvent.click(screen.getAllByText('Pick Variable')[0])+ fireEvent.click(screen.getAllByText('Pick Variable')[0]!)expect(onChange).toHaveBeenCalledWith({ override: '', any_var: [{ name: 'var-1' }], any_without_scope: [], custom_field: '' })expect(screen.getAllByText('Extra Info')).toHaveLength(2)@@ -497,7 +497,8 @@ describe('Form', () => {)// Assert- expect(screen.getByPlaceholderText('API Key')).toBeDisabled()+ // Assert+ expect(screen.getByPlaceholderText('API Key'))!.toBeDisabled()})// Override returns null: falls through to default renderer@@ -528,7 +529,8 @@ describe('Form', () => {)// Assert - should fall through to default textInput renderer- expect(screen.getByPlaceholderText('Field 1')).toBeInTheDocument()+ // Assert - should fall through to default textInput renderer+ expect(screen.getByPlaceholderText('Field 1'))!.toBeInTheDocument()})// isShowDefaultValue=true, value is null → default shown@@ -559,7 +561,8 @@ describe('Form', () => {)// Assert- expect(screen.getByPlaceholderText('Nullable')).toHaveValue('default-val')+ // Assert+ expect(screen.getByPlaceholderText('Nullable'))!.toHaveValue('default-val')})// isShowDefaultValue=true, value is undefined → default shown@@ -590,7 +593,8 @@ describe('Form', () => {)// Assert- expect(screen.getByPlaceholderText('Undef')).toHaveValue('default-undef')+ // Assert+ expect(screen.getByPlaceholderText('Undef'))!.toHaveValue('default-undef')})// isEditMode=true, variable=__model_type → textInput disabled@@ -619,7 +623,8 @@ describe('Form', () => {)// Assert- expect(screen.getByPlaceholderText('Model Type')).toBeDisabled()+ // Assert+ expect(screen.getByPlaceholderText('Model Type'))!.toBeDisabled()})// Label with missing language key → en_US fallback used@@ -649,7 +654,8 @@ describe('Form', () => {)// Assert- expect(screen.getByText('English Label')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('English Label'))!.toBeInTheDocument()})// Select field with isShowDefaultValue=true@@ -680,7 +686,8 @@ describe('Form', () => {)// Assert - Select B should be the rendered default- expect(screen.getByText('Select B')).toBeInTheDocument()+ // Assert - Select B should be the rendered default+ expect(screen.getByText('Select B'))!.toBeInTheDocument()})// Radio option with show_on condition not met → option filtered out@@ -712,7 +719,8 @@ describe('Form', () => {)// Assert- expect(screen.getByText('Always Visible')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('Always Visible'))!.toBeInTheDocument()expect(screen.queryByText('Conditional')).not.toBeInTheDocument()})@@ -804,8 +812,9 @@ describe('Form', () => {)// Both rendered successfully- expect(screen.getByPlaceholderText('Secret')).toBeInTheDocument()- expect(screen.getByPlaceholderText('Number')).toBeInTheDocument()+ // Both rendered successfully+ expect(screen.getByPlaceholderText('Secret'))!.toBeInTheDocument()+ expect(screen.getByPlaceholderText('Number'))!.toBeInTheDocument()})// Placeholder fallback: null placeholder@@ -830,7 +839,7 @@ describe('Form', () => {/>,)- expect(screen.getByText('No Placeholder')).toBeInTheDocument()+ expect(screen.getByText('No Placeholder'))!.toBeInTheDocument()})// validating=true + changeKey matches variable: ValidatingTip shown@@ -866,7 +875,8 @@ describe('Form', () => {fireEvent.change(screen.getByPlaceholderText('API Key'), { target: { value: 'new' } })// ValidatingTip should appear for api_key- expect(screen.getByText('Validating...')).toBeInTheDocument()+ // ValidatingTip should appear for api_key+ expect(screen.getByText('Validating...'))!.toBeInTheDocument()})// Select with show_on not met: hidden@@ -923,7 +933,7 @@ describe('Form', () => {/>,)- expect(screen.getByText('Always')).toBeInTheDocument()+ expect(screen.getByText('Always'))!.toBeInTheDocument()expect(screen.queryByText('Conditional')).not.toBeInTheDocument()})@@ -1009,7 +1019,7 @@ describe('Form', () => {/>,)- expect(screen.getByPlaceholderText('Field')).toHaveValue('')+ expect(screen.getByPlaceholderText('Field'))!.toHaveValue('')})// Radio with disabled=true in edit mode for __model_type@@ -1066,7 +1076,7 @@ describe('Form', () => {/>,)- expect(screen.getByText('Select Tools')).toBeInTheDocument()+ expect(screen.getByText('Select Tools'))!.toBeInTheDocument()})// Override with non-matching type: falls through to default@@ -1095,7 +1105,7 @@ describe('Form', () => {)expect(screen.queryByText('Override Hit')).not.toBeInTheDocument()- expect(screen.getByPlaceholderText('Secret Field')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('Secret Field'))!.toBeInTheDocument()})// Select with isShowDefaultValue: null value shows default@@ -1123,7 +1133,7 @@ describe('Form', () => {/>,)- expect(screen.getByText('Select B')).toBeInTheDocument()+ expect(screen.getByText('Select B'))!.toBeInTheDocument()})// Select with isShowDefaultValue: undefined value shows default@@ -1151,7 +1161,7 @@ describe('Form', () => {/>,)- expect(screen.getByText('Select A')).toBeInTheDocument()+ expect(screen.getByText('Select A'))!.toBeInTheDocument()})// No fieldMoreInfo: should not crash@@ -1177,7 +1187,7 @@ describe('Form', () => {/>,)- expect(screen.getByPlaceholderText('Field 1')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('Field 1'))!.toBeInTheDocument()})it('should render tooltip when schema has tooltip property', () => {@@ -1220,10 +1230,10 @@ describe('Form', () => {/>,)- expect(screen.getByText('API Key')).toBeInTheDocument()- expect(screen.getByText('Region')).toBeInTheDocument()- expect(screen.getByText('Model')).toBeInTheDocument()- expect(screen.getByText('Agree')).toBeInTheDocument()+ expect(screen.getByText('API Key'))!.toBeInTheDocument()+ expect(screen.getByText('Region'))!.toBeInTheDocument()+ expect(screen.getByText('Model'))!.toBeInTheDocument()+ expect(screen.getByText('Agree'))!.toBeInTheDocument()})it('should render required asterisk for radio, select, checkbox, and other field types', () => {@@ -1319,7 +1329,7 @@ describe('Form', () => {)fireEvent.click(screen.getByText('Option B'))- expect(screen.getByText('Validating...')).toBeInTheDocument()+ expect(screen.getByText('Validating...'))!.toBeInTheDocument()})it('should render textInput with show_on condition met', () => {@@ -1345,7 +1355,7 @@ describe('Form', () => {/>,)- expect(screen.getByPlaceholderText('Conditional')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('Conditional'))!.toBeInTheDocument()})it('should render radio with show_on condition met', () => {@@ -1370,7 +1380,7 @@ describe('Form', () => {/>,)- expect(screen.getByText('Cond Radio')).toBeInTheDocument()+ expect(screen.getByText('Cond Radio'))!.toBeInTheDocument()})it('should proceed with onChange when isEditMode is true but key is not locked', () => {@@ -1424,6 +1434,37 @@ describe('Form', () => {/>,)+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render+ // Should not crash - the field simply doesn't render// Should not crash - the field simply doesn't renderexpect(screen.queryByText('Unknown')).not.toBeInTheDocument()})@@ -1452,7 +1493,7 @@ describe('Form', () => {/>,)- expect(screen.getByText('Check Extra')).toBeInTheDocument()+ expect(screen.getByText('Check Extra'))!.toBeInTheDocument()})})@@ -1497,10 +1538,10 @@ describe('Form', () => {/>,)- expect(screen.getByText('API Key Fallback')).toBeInTheDocument()- expect(screen.getByText('Region Fallback')).toBeInTheDocument()- expect(screen.getByText('Model Fallback')).toBeInTheDocument()- expect(screen.getByText('Agree Fallback')).toBeInTheDocument()+ expect(screen.getByText('API Key Fallback'))!.toBeInTheDocument()+ expect(screen.getByText('Region Fallback'))!.toBeInTheDocument()+ expect(screen.getByText('Model Fallback'))!.toBeInTheDocument()+ expect(screen.getByText('Agree Fallback'))!.toBeInTheDocument()})it('should fallback to en_US for modelSelector, toolSelector, and appSelector labels', () => {@@ -1542,10 +1583,10 @@ describe('Form', () => {/>,)- expect(screen.getByText('ModelSel Fallback')).toBeInTheDocument()- expect(screen.getByText('ToolSel Fallback')).toBeInTheDocument()- expect(screen.getByText('AppSel Fallback')).toBeInTheDocument()- expect(screen.getByText('Any Fallback')).toBeInTheDocument()+ expect(screen.getByText('ModelSel Fallback'))!.toBeInTheDocument()+ expect(screen.getByText('ToolSel Fallback'))!.toBeInTheDocument()+ expect(screen.getByText('AppSel Fallback'))!.toBeInTheDocument()+ expect(screen.getByText('Any Fallback'))!.toBeInTheDocument()})it('should not change value when __model_type is edited in edit mode', () => {@@ -1602,7 +1643,7 @@ describe('Form', () => {/>,)- expect(screen.getByDisplayValue('actual-value')).toBeInTheDocument()+ expect(screen.getByDisplayValue('actual-value'))!.toBeInTheDocument()})it('should pass nodeOutputVars and availableNodes to toolSelector', () => {@@ -1632,7 +1673,7 @@ describe('Form', () => {/>,)- expect(screen.getByText('Select Tool')).toBeInTheDocument()+ expect(screen.getByText('Select Tool'))!.toBeInTheDocument()expect(toolSelectorPropsSpy).toHaveBeenCalledWith(expect.objectContaining({nodeOutputVars,availableNodes,@@ -1663,7 +1704,7 @@ describe('Form', () => {/>,)- expect(screen.getByText('Select Model')).toBeInTheDocument()+ expect(screen.getByText('Select Model'))!.toBeInTheDocument()expect(modelSelectorPropsSpy).toHaveBeenCalledWith(expect.objectContaining({isAgentStrategy: true,}))@@ -1695,7 +1736,8 @@ describe('Form', () => {)// Assert - should render without crash (value[variable] || [] path taken)- expect(screen.getByText('Select Tools')).toBeInTheDocument()+ // Assert - should render without crash (value[variable] || [] path taken)+ expect(screen.getByText('Select Tools'))!.toBeInTheDocument()})it('should show ValidatingTip for multiToolSelector field being validated', () => {@@ -1726,7 +1768,8 @@ describe('Form', () => {fireEvent.click(screen.getByText('Select Tools'))// Assert- expect(screen.getByText('Validating...')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('Validating...'))!.toBeInTheDocument()})it('should show ValidatingTip for appSelector field being validated', () => {@@ -1757,7 +1800,8 @@ describe('Form', () => {fireEvent.click(screen.getByText('Select App'))// Assert- expect(screen.getByText('Validating...')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('Validating...'))!.toBeInTheDocument()})it('should show ValidatingTip for any-type field being validated', () => {@@ -1789,7 +1833,8 @@ describe('Form', () => {fireEvent.click(screen.getByText('Pick Variable'))// Assert- expect(screen.getByText('Validating...')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('Validating...'))!.toBeInTheDocument()})it('should use empty string fallback for nodeId in any-type when nodeId is not provided', () => {@@ -1818,7 +1863,8 @@ describe('Form', () => {)// Assert - should render without crash- expect(screen.getByText('Any Field')).toBeInTheDocument()+ // Assert - should render without crash+ expect(screen.getByText('Any Field'))!.toBeInTheDocument()})it('should use en_US label fallback for multiToolSelector when language key is missing', () => {@@ -1849,7 +1895,8 @@ describe('Form', () => {)// Assert - MultipleToolSelector mock renders with the label prop- expect(screen.getByText('Select Tools')).toBeInTheDocument()+ // Assert - MultipleToolSelector mock renders with the label prop+ expect(screen.getByText('Select Tools'))!.toBeInTheDocument()})it('should show ValidatingTip for select field being validated', () => {@@ -1882,7 +1929,8 @@ describe('Form', () => {fireEvent.click(screen.getByText('Select B'))// Assert: ValidatingTip shows for the select field- expect(screen.getByText('Validating...')).toBeInTheDocument()+ // Assert: ValidatingTip shows for the select field+ expect(screen.getByText('Validating...'))!.toBeInTheDocument()})it('should show ValidatingTip for toolSelector field being validated', () => {@@ -1914,7 +1962,8 @@ describe('Form', () => {fireEvent.click(screen.getByText('Select Tool'))// Assert- expect(screen.getByText('Validating...')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('Validating...'))!.toBeInTheDocument()})it('should not render customRenderField for a FormTypeEnum value that is unhandled by Form', () => {diff --git a/web/app/components/header/account-setting/model-provider-page/model-modal/__tests__/index.spec.tsx b/web/app/components/header/account-setting/model-provider-page/model-modal/__tests__/index.spec.tsxindex a47b5eb1702..a7e85bd9ebf 100644--- a/web/app/components/header/account-setting/model-provider-page/model-modal/__tests__/index.spec.tsx+++ b/web/app/components/header/account-setting/model-provider-page/model-modal/__tests__/index.spec.tsx@@ -196,10 +196,10 @@ describe('ModelModal', () => {const predefined = renderModal()- expect(screen.getByText('common.modelProvider.auth.apiKeyModal.title')).toBeInTheDocument()- expect(screen.getByText('common.modelProvider.auth.apiKeyModal.desc')).toBeInTheDocument()- expect(screen.getByRole('status')).toBeInTheDocument()- expect(screen.getByRole('button', { name: 'common.operation.save' })).toBeDisabled()+ expect(screen.getByText('common.modelProvider.auth.apiKeyModal.title'))!.toBeInTheDocument()+ expect(screen.getByText('common.modelProvider.auth.apiKeyModal.desc'))!.toBeInTheDocument()+ expect(screen.getByRole('status'))!.toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'common.operation.save' }))!.toBeDisabled()predefined.unmount()const customizable = renderModal({ configurateMethod: ConfigurationMethodEnum.customizableModel })@@ -208,7 +208,7 @@ describe('ModelModal', () => {mockState.credentialData = { credentials: {}, available_credentials: [] }renderModal({ mode: ModelModalModeEnum.configModelCredential, model: { model: 'gpt-4', model_type: ModelTypeEnum.textGeneration } })- expect(screen.getByText('common.modelProvider.auth.addModelCredential')).toBeInTheDocument()+ expect(screen.getByText('common.modelProvider.auth.addModelCredential'))!.toBeInTheDocument()})it('should reveal the credential label when adding a new credential', () => {@@ -218,7 +218,7 @@ describe('ModelModal', () => {fireEvent.click(screen.getByText('Add New'))- expect(screen.getByText('common.modelProvider.auth.modelCredential')).toBeInTheDocument()+ expect(screen.getByText('common.modelProvider.auth.modelCredential'))!.toBeInTheDocument()})it('should call onCancel when the cancel button is clicked', () => {@@ -245,7 +245,7 @@ describe('ModelModal', () => {const { onCancel } = renderModal({ credential })const alertDialog = screen.getByRole('alertdialog', { hidden: true })- expect(alertDialog).toHaveTextContent('common.modelProvider.confirmDelete')+ expect(alertDialog)!.toHaveTextContent('common.modelProvider.confirmDelete')fireEvent.click(within(alertDialog).getByRole('button', { hidden: true, name: 'common.operation.confirm' }))@@ -261,7 +261,7 @@ describe('ModelModal', () => {{ isCheckValidated: true, values: { __authorization_name__: 'Auth Name', api_key: 'secret' } },]const configCustomModel = renderModal({ mode: ModelModalModeEnum.configCustomModel })- fireEvent.click(screen.getAllByText('Model Name Change')[0])+ fireEvent.click(screen.getAllByText('Model Name Change')[0]!)fireEvent.click(screen.getByRole('button', { name: 'common.operation.add' }))expect(mockFormState.setFieldValue).toHaveBeenCalledWith('__model_name', 'updated-model')diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/__tests__/parameter-item.spec.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/__tests__/parameter-item.spec.tsxindex 8a923d065cc..2e928c36cc9 100644--- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/__tests__/parameter-item.spec.tsx+++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/__tests__/parameter-item.spec.tsx@@ -68,7 +68,7 @@ describe('ParameterItem', () => {const input = screen.getByRole('spinbutton')fireEvent.change(input, { target: { value: '1.4' } })expect(onChange).toHaveBeenCalledWith(1)- expect(screen.getByTestId('slider-btn')).toBeInTheDocument()+ expect(screen.getByTestId('slider-btn'))!.toBeInTheDocument()})it('should clamp float numeric input to min', () => {@@ -91,19 +91,19 @@ describe('ParameterItem', () => {it('should adjust step based on max for int type', () => {const { rerender } = render(<ParameterItem parameterRule={createRule({ type: 'int', min: 0, max: 50 })} value={5} />)- expect(screen.getByRole('spinbutton')).toHaveAttribute('step', '1')+ expect(screen.getByRole('spinbutton'))!.toHaveAttribute('step', '1')rerender(<ParameterItem parameterRule={createRule({ type: 'int', min: 0, max: 500 })} value={50} />)- expect(screen.getByRole('spinbutton')).toHaveAttribute('step', '10')+ expect(screen.getByRole('spinbutton'))!.toHaveAttribute('step', '10')rerender(<ParameterItem parameterRule={createRule({ type: 'int', min: 0, max: 2000 })} value={50} />)- expect(screen.getByRole('spinbutton')).toHaveAttribute('step', '100')+ expect(screen.getByRole('spinbutton'))!.toHaveAttribute('step', '100')})it('should render int input without slider if min or max is missing', () => {render(<ParameterItem parameterRule={createRule({ type: 'int', min: 0 })} value={5} />)expect(screen.queryByRole('slider')).not.toBeInTheDocument()- expect(screen.getByRole('spinbutton')).toHaveAttribute('step', '0')+ expect(screen.getByRole('spinbutton'))!.toHaveAttribute('step', '0')})it('should handle slide change and clamp values', () => {@@ -125,20 +125,20 @@ describe('ParameterItem', () => {const onChange = vi.fn()const { container } = render(<ParameterItem parameterRule={createRule({ type: 'text' })} value="long text" onChange={onChange} />)const textarea = container.querySelector('textarea')!- expect(textarea).toBeInTheDocument()+ expect(textarea)!.toBeInTheDocument()fireEvent.change(textarea, { target: { value: 'new long text' } })expect(onChange).toHaveBeenCalledWith('new long text')})it('should render select for string with options', () => {render(<ParameterItem parameterRule={createRule({ type: 'string', options: ['a', 'b'] })} value="a" />)- expect(screen.getByText('a')).toBeInTheDocument()+ expect(screen.getByText('a'))!.toBeInTheDocument()})it('should render tag input for tag type', () => {const onChange = vi.fn()render(<ParameterItem parameterRule={createRule({ type: 'tag', tagPlaceholder: { en_US: 'placeholder', zh_Hans: 'placeholder' } })} value={['a']} onChange={onChange} />)- expect(screen.getByText('placeholder')).toBeInTheDocument()+ expect(screen.getByText('placeholder'))!.toBeInTheDocument()fireEvent.click(screen.getByTestId('tag-input'))expect(onChange).toHaveBeenCalledWith(['tag1', 'tag2'])})@@ -166,17 +166,17 @@ describe('ParameterItem', () => {it('should use default values if value is undefined', () => {const { rerender } = render(<ParameterItem parameterRule={createRule({ type: 'float', default: 0.5 })} />)- expect(screen.getByRole('spinbutton')).toHaveValue(0.5)+ expect(screen.getByRole('spinbutton'))!.toHaveValue(0.5)rerender(<ParameterItem parameterRule={createRule({ type: 'string', default: 'hello' })} />)- expect(screen.getByRole('textbox')).toHaveValue('hello')+ expect(screen.getByRole('textbox'))!.toHaveValue('hello')rerender(<ParameterItem parameterRule={createRule({ type: 'boolean', default: true })} />)- expect(screen.getByText('True')).toBeInTheDocument()- expect(screen.getByText('False')).toBeInTheDocument()+ expect(screen.getByText('True'))!.toBeInTheDocument()+ expect(screen.getByText('False'))!.toBeInTheDocument()rerender(<ParameterItem parameterRule={createRule({ type: 'float' })} />)- expect(screen.getByRole('spinbutton')).toHaveValue(0)+ expect(screen.getByRole('spinbutton'))!.toHaveValue(0)})it('should reset input to actual bound value on blur-sm', () => {@@ -184,7 +184,7 @@ describe('ParameterItem', () => {const input = screen.getByRole('spinbutton')fireEvent.change(input, { target: { value: '5' } })fireEvent.blur(input)- expect(input).toHaveValue(1)+ expect(input)!.toHaveValue(1)})it('should render no input for unsupported parameter type', () => {@@ -216,12 +216,12 @@ describe('ParameterItem', () => {)const editor = screen.getByTestId('prompt-editor')- expect(editor).toBeInTheDocument()- expect(editor).toHaveAttribute('data-has-workflow-vars', 'true')+ expect(editor)!.toBeInTheDocument()+ expect(editor)!.toHaveAttribute('data-has-workflow-vars', 'true')expect(capturedWorkflowNodesMap).toBeDefined()- expect(capturedWorkflowNodesMap!.node1.title).toBe('LLM Node')- expect(capturedWorkflowNodesMap!.sys.title).toBe('workflow.blocks.start')- expect(capturedWorkflowNodesMap!.sys.type).toBe(BlockEnum.Start)+ expect(capturedWorkflowNodesMap!.node1!.title).toBe('LLM Node')+ expect(capturedWorkflowNodesMap!.sys!.title).toBe('workflow.blocks.start')+ expect(capturedWorkflowNodesMap!.sys!.type).toBe(BlockEnum.Start)promptEditorOnChange?.('updated text')expect(onChange).toHaveBeenCalledWith('updated text')@@ -241,8 +241,8 @@ describe('ParameterItem', () => {)const editor = screen.getByTestId('prompt-editor')- expect(editor).toBeInTheDocument()- expect(editor).toHaveAttribute('data-has-workflow-vars', 'true')+ expect(editor)!.toBeInTheDocument()+ expect(editor)!.toHaveAttribute('data-has-workflow-vars', 'true')expect(capturedWorkflowNodesMap).toBeDefined()promptEditorOnChange?.('new long text')@@ -258,7 +258,7 @@ describe('ParameterItem', () => {)expect(screen.queryByTestId('prompt-editor')).not.toBeInTheDocument()- expect(screen.getByRole('textbox')).toBeInTheDocument()+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})it('should return undefined workflowNodesMap when not in workflow mode', () => {diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/__tests__/popup-item.spec.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/__tests__/popup-item.spec.tsxindex 050bb099d81..6728791120d 100644--- a/web/app/components/header/account-setting/model-provider-page/model-selector/__tests__/popup-item.spec.tsx+++ b/web/app/components/header/account-setting/model-provider-page/model-selector/__tests__/popup-item.spec.tsx@@ -185,7 +185,7 @@ describe('PopupItem', () => {expect(mockSetShowModelModal).toHaveBeenCalled()- const call = mockSetShowModelModal.mock.calls[0][0] as { onSaveCallback?: () => void }+ const call = mockSetShowModelModal.mock.calls[0]![0] as { onSaveCallback?: () => void }call.onSaveCallback?.()expect(mockUpdateModelProviders).toHaveBeenCalled()@@ -220,7 +220,7 @@ describe('PopupItem', () => {/>,)- expect(screen.getByText('GPT-4')).toBeInTheDocument()+ expect(screen.getByText('GPT-4'))!.toBeInTheDocument()})it('should fall back to english labels when the current language is unavailable', () => {@@ -237,14 +237,14 @@ describe('PopupItem', () => {/>,)- expect(screen.getByText('OpenAI only')).toBeInTheDocument()- expect(screen.getByText('GPT-4 only')).toBeInTheDocument()+ expect(screen.getByText('OpenAI only'))!.toBeInTheDocument()+ expect(screen.getByText('GPT-4 only'))!.toBeInTheDocument()})it('should toggle collapsed state when clicking provider header', () => {render(<PopupItem model={makeModel()} onSelect={vi.fn()} onHide={vi.fn()} />)- expect(screen.getByText('GPT-4')).toBeInTheDocument()+ expect(screen.getByText('GPT-4'))!.toBeInTheDocument()fireEvent.click(screen.getByText('OpenAI'))@@ -252,13 +252,13 @@ describe('PopupItem', () => {fireEvent.click(screen.getByText('OpenAI'))- expect(screen.getByText('GPT-4')).toBeInTheDocument()+ expect(screen.getByText('GPT-4'))!.toBeInTheDocument()})it('should show credential name when using custom provider', () => {render(<PopupItem model={makeModel()} onSelect={vi.fn()} onHide={vi.fn()} />)- expect(screen.getByText('my-api-key')).toBeInTheDocument()+ expect(screen.getByText('my-api-key'))!.toBeInTheDocument()})it('should render the inactive credential badge when the api key is not active', () => {@@ -275,7 +275,7 @@ describe('PopupItem', () => {render(<PopupItem model={makeModel()} onSelect={vi.fn()} onHide={vi.fn()} />)- expect(screen.getByText('stale-key')).toBeInTheDocument()+ expect(screen.getByText('stale-key'))!.toBeInTheDocument()expect(document.querySelector('.bg-components-badge-status-light-error-bg')).not.toBeNull()})@@ -301,7 +301,7 @@ describe('PopupItem', () => {render(<PopupItem model={makeModel()} onSelect={vi.fn()} onHide={vi.fn()} />)- expect(screen.getByText(/modelProvider\.selector\.configureRequired/)).toBeInTheDocument()+ expect(screen.getByText(/modelProvider\.selector\.configureRequired/))!.toBeInTheDocument()})it('should show credits info when using system provider with remaining credits', () => {@@ -323,7 +323,7 @@ describe('PopupItem', () => {render(<PopupItem model={makeModel()} onSelect={vi.fn()} onHide={vi.fn()} />)- expect(screen.getByText(/modelProvider\.selector\.aiCredits/)).toBeInTheDocument()+ expect(screen.getByText(/modelProvider\.selector\.aiCredits/))!.toBeInTheDocument()})it('should show credits exhausted when system provider has no credits', () => {@@ -348,7 +348,7 @@ describe('PopupItem', () => {render(<PopupItem model={makeModel()} onSelect={vi.fn()} onHide={vi.fn()} />)- expect(screen.getByText(/modelProvider\.selector\.creditsExhausted/)).toBeInTheDocument()+ expect(screen.getByText(/modelProvider\.selector\.creditsExhausted/))!.toBeInTheDocument()})it('should close the dropdown through dropdown content callbacks', () => {diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/__tests__/popup.spec.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/__tests__/popup.spec.tsxindex dee16e394e5..61d6bb4466a 100644--- a/web/app/components/header/account-setting/model-provider-page/model-selector/__tests__/popup.spec.tsx+++ b/web/app/components/header/account-setting/model-provider-page/model-selector/__tests__/popup.spec.tsx@@ -191,14 +191,14 @@ describe('Popup', () => {/>,)- expect(screen.getByText('openai')).toBeInTheDocument()+ expect(screen.getByText('openai'))!.toBeInTheDocument()const input = screen.getByPlaceholderText('datasetSettings.form.searchModel')fireEvent.change(input, { target: { value: 'not-found' } })- expect(screen.getByText('No model found for \u201Cnot-found\u201D')).toBeInTheDocument()+ expect(screen.getByText('No model found for \u201Cnot-found\u201D'))!.toBeInTheDocument()const clearIcon = container.querySelector('.i-custom-vender-solid-general-x-circle')- expect(clearIcon).toBeInTheDocument()+ expect(clearIcon)!.toBeInTheDocument()fireEvent.click(clearIcon!)expect((input as HTMLInputElement).value).toBe('')})@@ -225,9 +225,9 @@ describe('Popup', () => {/>,)- expect(screen.getByTestId('compatible-models-banner')).toBeInTheDocument()- expect(screen.getByText('common.modelProvider.selector.onlyCompatibleModelsShown')).toBeInTheDocument()- expect(container.querySelector('.i-ri-information-2-fill')).toBeInTheDocument()+ expect(screen.getByTestId('compatible-models-banner'))!.toBeInTheDocument()+ expect(screen.getByText('common.modelProvider.selector.onlyCompatibleModelsShown'))!.toBeInTheDocument()+ expect(container.querySelector('.i-ri-information-2-fill'))!.toBeInTheDocument()})it('should filter by scope features including toolCall and non-toolCall checks', () => {@@ -244,7 +244,7 @@ describe('Popup', () => {scopeFeatures={[ModelFeatureEnum.toolCall, ModelFeatureEnum.vision]}/>,)- expect(screen.getByText('No model found for \u201C\u201D')).toBeInTheDocument()+ expect(screen.getByText('No model found for \u201C\u201D'))!.toBeInTheDocument()unmount()mockSupportFunctionCall.mockReturnValue(true)@@ -256,7 +256,7 @@ describe('Popup', () => {scopeFeatures={[ModelFeatureEnum.toolCall, ModelFeatureEnum.vision]}/>,)- expect(screen.getByText('openai')).toBeInTheDocument()+ expect(screen.getByText('openai'))!.toBeInTheDocument()unmount2()const { unmount: unmount3 } = render(@@ -267,7 +267,7 @@ describe('Popup', () => {scopeFeatures={[ModelFeatureEnum.vision]}/>,)- expect(screen.getByText('openai')).toBeInTheDocument()+ expect(screen.getByText('openai'))!.toBeInTheDocument()unmount3()render(@@ -278,7 +278,7 @@ describe('Popup', () => {scopeFeatures={[ModelFeatureEnum.vision]}/>,)- expect(screen.getByText('No model found for \u201C\u201D')).toBeInTheDocument()+ expect(screen.getByText('No model found for \u201C\u201D'))!.toBeInTheDocument()})it('should match model labels from fallback languages when current language key is missing', () => {@@ -305,7 +305,7 @@ describe('Popup', () => {{ target: { value: 'openai' } },)- expect(screen.getByText('openai')).toBeInTheDocument()+ expect(screen.getByText('openai'))!.toBeInTheDocument()})it('should show credits exhausted alert when an exhausted provider supports credits', () => {@@ -331,7 +331,7 @@ describe('Popup', () => {/>,)- expect(screen.getByTestId('credits-exhausted-alert')).toHaveAttribute('data-has-api-key-fallback', 'false')+ expect(screen.getByTestId('credits-exhausted-alert'))!.toHaveAttribute('data-has-api-key-fallback', 'false')})it('should not show credits exhausted alert when only non-trial system providers are exhausted', () => {@@ -419,8 +419,8 @@ describe('Popup', () => {/>,)- expect(screen.getByText(/modelProvider\.selector\.noProviderConfigured(?!Desc)/)).toBeInTheDocument()- expect(screen.getByText(/modelProvider\.selector\.noProviderConfiguredDesc/)).toBeInTheDocument()+ expect(screen.getByText(/modelProvider\.selector\.noProviderConfigured(?!Desc)/))!.toBeInTheDocument()+ expect(screen.getByText(/modelProvider\.selector\.noProviderConfiguredDesc/))!.toBeInTheDocument()fireEvent.click(screen.getByText(/modelProvider\.selector\.configure/))expect(onHide).toHaveBeenCalled()@@ -441,9 +441,9 @@ describe('Popup', () => {)expect(screen.queryByText('TestOpenAI')).not.toBeInTheDocument()- expect(screen.getByText('TestAnthropic')).toBeInTheDocument()- expect(screen.getByText(/modelProvider\.selector\.fromMarketplace/)).toBeInTheDocument()- expect(screen.getByText(/modelProvider\.selector\.discoverMoreInMarketplace/)).toBeInTheDocument()+ expect(screen.getByText('TestAnthropic'))!.toBeInTheDocument()+ expect(screen.getByText(/modelProvider\.selector\.fromMarketplace/))!.toBeInTheDocument()+ expect(screen.getByText(/modelProvider\.selector\.discoverMoreInMarketplace/))!.toBeInTheDocument()})it('should show installed marketplace providers without models when AI credits are available', () => {@@ -462,8 +462,8 @@ describe('Popup', () => {/>,)- expect(screen.getByText('test-anthropic')).toBeInTheDocument()- expect(screen.getByText('TestOpenAI')).toBeInTheDocument()+ expect(screen.getByText('test-anthropic'))!.toBeInTheDocument()+ expect(screen.getByText('TestOpenAI'))!.toBeInTheDocument()})it('should hide installed marketplace providers without models when AI credits are exhausted', () => {@@ -489,7 +489,7 @@ describe('Popup', () => {expect(screen.queryByText('test-anthropic')).not.toBeInTheDocument()expect(screen.queryByText('TestAnthropic')).not.toBeInTheDocument()- expect(screen.getByText('TestOpenAI')).toBeInTheDocument()+ expect(screen.getByText('TestOpenAI'))!.toBeInTheDocument()})it('should toggle marketplace section collapse', () => {@@ -501,7 +501,7 @@ describe('Popup', () => {/>,)- expect(screen.getByText('TestOpenAI')).toBeInTheDocument()+ expect(screen.getByText('TestOpenAI'))!.toBeInTheDocument()fireEvent.click(screen.getByText(/modelProvider\.selector\.fromMarketplace/))@@ -509,7 +509,7 @@ describe('Popup', () => {fireEvent.click(screen.getByText(/modelProvider\.selector\.fromMarketplace/))- expect(screen.getByText('TestOpenAI')).toBeInTheDocument()+ expect(screen.getByText('TestOpenAI'))!.toBeInTheDocument()})it('should install plugin when clicking install button', async () => {@@ -527,7 +527,7 @@ describe('Popup', () => {)const installButtons = screen.getAllByText(/common\.modelProvider\.selector\.install/)- fireEvent.click(installButtons[0])+ fireEvent.click(installButtons[0]!)await waitFor(() => {expect(mockInstallMutateAsync).toHaveBeenCalledWith('langgenius/openai:1.0.0')@@ -550,7 +550,7 @@ describe('Popup', () => {)const installButtons = screen.getAllByText(/common\.modelProvider\.selector\.install/)- fireEvent.click(installButtons[0])+ fireEvent.click(installButtons[0]!)await waitFor(() => {expect(mockInstallMutateAsync).toHaveBeenCalled()@@ -576,7 +576,7 @@ describe('Popup', () => {)const installButtons = screen.getAllByText(/common\.modelProvider\.selector\.install/)- fireEvent.click(installButtons[0])+ fireEvent.click(installButtons[0]!)await waitFor(() => {expect(mockCheck).toHaveBeenCalledWith({@@ -601,7 +601,7 @@ describe('Popup', () => {/>,)- fireEvent.click(screen.getAllByText(/common\.modelProvider\.selector\.install/)[0])+ fireEvent.click(screen.getAllByText(/common\.modelProvider\.selector\.install/)[0]!)await waitFor(() => {expect(mockInstallMutateAsync).not.toHaveBeenCalled()@@ -619,7 +619,7 @@ describe('Popup', () => {/>,)- fireEvent.click(screen.getAllByText(/common\.modelProvider\.selector\.install/)[0])+ fireEvent.click(screen.getAllByText(/common\.modelProvider\.selector\.install/)[0]!)await waitFor(() => {expect(mockInstallMutateAsync).not.toHaveBeenCalled()@@ -640,6 +640,6 @@ describe('Popup', () => {)const providerLabels = screen.getAllByText(/openai|anthropic/)- expect(providerLabels[0]).toHaveTextContent('anthropic')+ expect(providerLabels[0])!.toHaveTextContent('anthropic')})})diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsxindex d1ad017455e..e38cc07ca2e 100644--- a/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx+++ b/web/app/components/header/account-setting/model-provider-page/model-selector/popup-item.tsx@@ -77,7 +77,7 @@ const PopupItem: FC<PopupItemProps> = ({onSaveCallback: () => {updateModelProviders()- const modelType = model.models[0].model_type+ const modelType = model.models[0]!.model_typeif (modelType)updateModelList(modelType)diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/model-list.spec.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/model-list.spec.tsxindex 70a0cb985ab..e435835807f 100644--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/model-list.spec.tsx+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/model-list.spec.tsx@@ -59,8 +59,8 @@ describe('ModelList', () => {/>,)expect(screen.getAllByText(/modelProvider\.modelsNum/).length).toBeGreaterThan(0)- expect(screen.getByRole('button', { name: 'gpt-4' })).toBeInTheDocument()- expect(screen.getByRole('button', { name: 'gpt-3.5' })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'gpt-4' }))!.toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'gpt-3.5' }))!.toBeInTheDocument()})it('should trigger collapse when collapsed label is clicked', () => {@@ -74,7 +74,7 @@ describe('ModelList', () => {)const countElements = screen.getAllByText(/modelProvider\.modelsNum/)- fireEvent.click(countElements[1])+ fireEvent.click(countElements[1]!)expect(mockOnCollapse).toHaveBeenCalled()})@@ -125,6 +125,37 @@ describe('ModelList', () => {/>,)+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert// Assertexpect(screen.queryByTestId('manage-credentials')).not.toBeInTheDocument()expect(screen.queryByTestId('add-custom-model')).not.toBeInTheDocument()@@ -143,7 +174,7 @@ describe('ModelList', () => {fireEvent.click(screen.getByRole('button', { name: 'gpt-4' }))expect(mockSetShowModelLoadBalancingModal).toHaveBeenCalled()- const callArg = mockSetShowModelLoadBalancingModal.mock.calls[0][0]+ const callArg = mockSetShowModelLoadBalancingModal.mock.calls[0]![0]callArg.onSave('test-provider')expect(mockOnChange).toHaveBeenCalledWith('test-provider')@@ -170,6 +201,37 @@ describe('ModelList', () => {/>,)+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert// Assertexpect(screen.queryByTestId('manage-credentials')).not.toBeInTheDocument()expect(screen.queryByTestId('add-custom-model')).not.toBeInTheDocument()@@ -195,8 +257,9 @@ describe('ModelList', () => {)// Assert: custom model actions are shown (isConfigurable=true && isCurrentWorkspaceManager=true)- expect(screen.getByTestId('manage-credentials')).toBeInTheDocument()- expect(screen.getByTestId('add-custom-model')).toBeInTheDocument()+ // Assert: custom model actions are shown (isConfigurable=true && isCurrentWorkspaceManager=true)+ expect(screen.getByTestId('manage-credentials'))!.toBeInTheDocument()+ expect(screen.getByTestId('add-custom-model'))!.toBeInTheDocument()})it('should hide custom model actions when provider is configurable but user is not workspace manager', () => {@@ -218,6 +281,37 @@ describe('ModelList', () => {/>,)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)+ // Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)// Assert: custom model actions are hidden (isCurrentWorkspaceManager=false covers the && short-circuit)expect(screen.queryByTestId('manage-credentials')).not.toBeInTheDocument()expect(screen.queryByTestId('add-custom-model')).not.toBeInTheDocument()diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/model-load-balancing-modal.spec.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/model-load-balancing-modal.spec.tsxindex c7368a2a54e..eedc04115c7 100644--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/model-load-balancing-modal.spec.tsx+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/__tests__/model-load-balancing-modal.spec.tsx@@ -180,7 +180,7 @@ describe('ModelLoadBalancingModal', () => {/>,)- expect(screen.getByRole('status')).toBeInTheDocument()+ expect(screen.getByRole('status'))!.toBeInTheDocument()})it('should render predefined model content', () => {@@ -193,9 +193,9 @@ describe('ModelLoadBalancingModal', () => {/>,)- expect(screen.getByText(/modelProvider\.auth\.configLoadBalancing/)).toBeInTheDocument()- expect(screen.getByText(/modelProvider\.auth\.providerManaged$/)).toBeInTheDocument()- expect(screen.getByText(/operation\.save/)).toBeInTheDocument()+ expect(screen.getByText(/modelProvider\.auth\.configLoadBalancing/))!.toBeInTheDocument()+ expect(screen.getByText(/modelProvider\.auth\.providerManaged$/))!.toBeInTheDocument()+ expect(screen.getByText(/operation\.save/))!.toBeInTheDocument()})it('should render custom model actions and close when update has no credentials', async () => {@@ -211,8 +211,8 @@ describe('ModelLoadBalancingModal', () => {/>,)- expect(screen.getByText(/modelProvider\.auth\.removeModel/)).toBeInTheDocument()- expect(screen.getByRole('button', { name: 'switch credential' })).toBeInTheDocument()+ expect(screen.getByText(/modelProvider\.auth\.removeModel/))!.toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'switch credential' }))!.toBeInTheDocument()await user.click(screen.getByRole('button', { name: 'config add credential' }))await waitFor(() => {expect(onClose).toHaveBeenCalled()@@ -241,8 +241,8 @@ describe('ModelLoadBalancingModal', () => {await waitFor(() => {expect(mockRefetch).toHaveBeenCalled()expect(mockMutateAsync).toHaveBeenCalled()- const payload = mockMutateAsync.mock.calls[0][0] as { load_balancing: { configs: Array<{ credentials: { api_key: string } }> } }- expect(payload.load_balancing.configs[0].credentials.api_key).toBe('[__HIDDEN__]')+ const payload = mockMutateAsync.mock.calls[0]![0] as { load_balancing: { configs: Array<{ credentials: { api_key: string } }> } }+ expect(payload.load_balancing.configs[0]!.credentials.api_key).toBe('[__HIDDEN__]')expect(mockNotify).toHaveBeenCalled()expect(mockHandleRefreshModel).toHaveBeenCalled()expect(onSave).toHaveBeenCalledWith('test-provider')@@ -313,7 +313,7 @@ describe('ModelLoadBalancingModal', () => {/>,)- expect(screen.getByText(/modelProvider\.auth\.configModel/)).toBeInTheDocument()+ expect(screen.getByText(/modelProvider\.auth\.configModel/))!.toBeInTheDocument()})// Modal hidden when open=false@@ -409,7 +409,7 @@ describe('ModelLoadBalancingModal', () => {/>,)- expect(screen.getByRole('button', { name: 'switch credential' })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'switch credential' }))!.toBeInTheDocument()})it('should disable save button when less than 2 configs are enabled', () => {@@ -433,7 +433,7 @@ describe('ModelLoadBalancingModal', () => {/>,)- expect(screen.getByText(/operation\.save/)).toBeDisabled()+ expect(screen.getByText(/operation\.save/))!.toBeDisabled()})it('should encode config entry without id as non-hidden value', async () => {@@ -463,9 +463,9 @@ describe('ModelLoadBalancingModal', () => {await waitFor(() => {expect(mockMutateAsync).toHaveBeenCalled()- const payload = mockMutateAsync.mock.calls[0][0] as { load_balancing: { configs: Array<{ credentials: { api_key: string } }> } }+ const payload = mockMutateAsync.mock.calls[0]![0] as { load_balancing: { configs: Array<{ credentials: { api_key: string } }> } }// Entry without id should NOT be encoded as hidden- expect(payload.load_balancing.configs[0].credentials.api_key).toBe('new-key')+ expect(payload.load_balancing.configs[0]!.credentials.api_key).toBe('new-key')})})@@ -536,7 +536,7 @@ describe('ModelLoadBalancingModal', () => {await waitFor(() => {expect(mockMutateAsync).toHaveBeenCalled()// The payload configs should only have the original 2 entries (no new one added)- const payload = mockMutateAsync.mock.calls[0][0] as { load_balancing: { configs: unknown[] } }+ const payload = mockMutateAsync.mock.calls[0]![0] as { load_balancing: { configs: unknown[] } }expect(payload.load_balancing.configs).toHaveLength(2)})})@@ -552,14 +552,16 @@ describe('ModelLoadBalancingModal', () => {)// draftConfig.enabled=true → title shows configLoadBalancing- expect(screen.getByText(/modelProvider\.auth\.configLoadBalancing/)).toBeInTheDocument()+ // draftConfig.enabled=true → title shows configLoadBalancing+ expect(screen.getByText(/modelProvider\.auth\.configLoadBalancing/))!.toBeInTheDocument()// Clicking the card when enabled=true toggles to disabledconst card = screen.getByText(/modelProvider\.auth\.providerManaged$/).closest('div[class]')!.closest('div[class]')!await user.click(card)// After toggling, title should show configModel (disabled state)- expect(screen.getByText(/modelProvider\.auth\.configModel/)).toBeInTheDocument()+ // After toggling, title should show configModel (disabled state)+ expect(screen.getByText(/modelProvider\.auth\.configModel/))!.toBeInTheDocument()})it('should use customModelCredential credential_id when present in handleSave', async () => {@@ -589,7 +591,7 @@ describe('ModelLoadBalancingModal', () => {await waitFor(() => {expect(mockMutateAsync).toHaveBeenCalled()- const payload = mockMutateAsync.mock.calls[0][0] as { credential_id: string }+ const payload = mockMutateAsync.mock.calls[0]![0] as { credential_id: string }// credential_id should come from customModelCredentialexpect(payload.credential_id).toBe('cred-1')})@@ -665,7 +667,8 @@ describe('ModelLoadBalancingModal', () => {)// Assert: component renders without error (extendedSecretFormSchemas = [])- expect(screen.getByText(/modelProvider\.auth\.configLoadBalancing/)).toBeInTheDocument()+ // Assert: component renders without error (extendedSecretFormSchemas = [])+ expect(screen.getByText(/modelProvider\.auth\.configLoadBalancing/))!.toBeInTheDocument()})it('should use custom model credential schema without fallback when credential_form_schemas is undefined', () => {@@ -727,7 +730,7 @@ describe('ModelLoadBalancingModal', () => {await waitFor(() => {expect(mockMutateAsync).toHaveBeenCalled()- const payload = mockMutateAsync.mock.calls[0][0] as { load_balancing: { configs: unknown[] } }+ const payload = mockMutateAsync.mock.calls[0]![0] as { load_balancing: { configs: unknown[] } }// Config count unchanged (still 2 from original)expect(payload.load_balancing.configs).toHaveLength(2)})diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/__tests__/usage-priority-section.spec.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/__tests__/usage-priority-section.spec.tsxindex 20ef9cf066c..c400d05f22f 100644--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/__tests__/usage-priority-section.spec.tsx+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/__tests__/usage-priority-section.spec.tsx@@ -14,7 +14,7 @@ describe('UsagePrioritySection', () => {it('should render title and both option buttons', () => {render(<UsagePrioritySection value="credits" onSelect={onSelect} />)- expect(screen.getByText(/usagePriority/)).toBeInTheDocument()+ expect(screen.getByText(/usagePriority/))!.toBeInTheDocument()expect(screen.getAllByRole('button')).toHaveLength(2)})})@@ -25,23 +25,23 @@ describe('UsagePrioritySection', () => {render(<UsagePrioritySection value="credits" onSelect={onSelect} />)const buttons = screen.getAllByRole('button')- expect(buttons[0].className).toContain('border-components-option-card-option-selected-border')- expect(buttons[1].className).not.toContain('border-components-option-card-option-selected-border')+ expect(buttons[0]!.className).toContain('border-components-option-card-option-selected-border')+ expect(buttons[1]!.className).not.toContain('border-components-option-card-option-selected-border')})it('should highlight API key option when value is apiKey', () => {render(<UsagePrioritySection value="apiKey" onSelect={onSelect} />)const buttons = screen.getAllByRole('button')- expect(buttons[0].className).not.toContain('border-components-option-card-option-selected-border')- expect(buttons[1].className).toContain('border-components-option-card-option-selected-border')+ expect(buttons[0]!.className).not.toContain('border-components-option-card-option-selected-border')+ expect(buttons[1]!.className).toContain('border-components-option-card-option-selected-border')})it('should highlight API key option when value is apiKeyOnly', () => {render(<UsagePrioritySection value="apiKeyOnly" onSelect={onSelect} />)const buttons = screen.getAllByRole('button')- expect(buttons[1].className).toContain('border-components-option-card-option-selected-border')+ expect(buttons[1]!.className).toContain('border-components-option-card-option-selected-border')})})@@ -50,7 +50,7 @@ describe('UsagePrioritySection', () => {it('should call onSelect with system when clicking AI credits option', () => {render(<UsagePrioritySection value="apiKey" onSelect={onSelect} />)- fireEvent.click(screen.getAllByRole('button')[0])+ fireEvent.click(screen.getAllByRole('button')[0]!)expect(onSelect).toHaveBeenCalledWith(PreferredProviderTypeEnum.system)})@@ -58,7 +58,7 @@ describe('UsagePrioritySection', () => {it('should call onSelect with custom when clicking API key option', () => {render(<UsagePrioritySection value="credits" onSelect={onSelect} />)- fireEvent.click(screen.getAllByRole('button')[1])+ fireEvent.click(screen.getAllByRole('button')[1]!)expect(onSelect).toHaveBeenCalledWith(PreferredProviderTypeEnum.custom)})diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/__tests__/use-activate-credential.spec.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/__tests__/use-activate-credential.spec.tsxindex c38d783e733..12acf479c07 100644--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/__tests__/use-activate-credential.spec.tsx+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/__tests__/use-activate-credential.spec.tsx@@ -92,7 +92,7 @@ describe('useActivateCredential', () => {}),)- const [, callbacks] = mockMutate.mock.calls[0]+ const [, callbacks] = (mockMutate.mock.calls[0] ?? []) as [unknown, any]act(() => {callbacks.onSuccess()@@ -113,7 +113,7 @@ describe('useActivateCredential', () => {expect(result.current.selectedCredentialId).toBe('cred-2')- const [, callbacks] = mockMutate.mock.calls[0]+ const [, callbacks] = (mockMutate.mock.calls[0] ?? []) as [unknown, any]act(() => {callbacks.onError()diff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-configs.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-configs.tsxindex 7fd1618d646..ea4edace302 100644--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-configs.tsx+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-configs.tsx@@ -64,7 +64,7 @@ const ModelLoadBalancingConfigs = ({if (!prev)return prevconst newConfigs = [...prev.configs]- const modifiedConfig = modifier(newConfigs[index])+ const modifiedConfig = modifier(newConfigs[index]!)if (modifiedConfig)newConfigs[index] = modifiedConfigelsediff --git a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-modal.tsx b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-modal.tsxindex 35567773957..652630be671 100644--- a/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-modal.tsx+++ b/web/app/components/header/account-setting/model-provider-page/provider-added-card/model-load-balancing-modal.tsx@@ -164,7 +164,7 @@ const ModelLoadBalancingModal = ({ provider, configurateMethod, currentCustomConconst prevIndex = newConfigs.findIndex(item => item.credential_id === modelCredential.credential_id && item.name !== '__inherit__')const newIndex = available_credentials.findIndex(c => c.credential_id === modelCredential.credential_id)if (newIndex > -1 && prevIndex > -1)- newConfigs[prevIndex].name = available_credentials[newIndex].credential_name || ''+ newConfigs[prevIndex]!.name = available_credentials[newIndex]!.credential_name || ''return {...prev,configs: newConfigs,diff --git a/web/app/components/header/account-setting/plugin-page/index.tsx b/web/app/components/header/account-setting/plugin-page/index.tsxindex a71c3ee0725..7f8e9a32f7e 100644--- a/web/app/components/header/account-setting/plugin-page/index.tsx+++ b/web/app/components/header/account-setting/plugin-page/index.tsx@@ -16,7 +16,7 @@ const PluginPage = () => {return (<div className="pb-7"><div>- {plugins?.map(plugin => Plugin_MAP[plugin.tool_name](plugin))}+ {plugins?.map(plugin => Plugin_MAP[plugin.tool_name]!(plugin))}</div><div className="fixed bottom-0 flex h-[42px] w-[472px] items-center bg-white text-xs text-gray-500"><LockClosedIcon className="mr-1 h-3 w-3" />diff --git a/web/app/components/header/app-nav/index.tsx b/web/app/components/header/app-nav/index.tsxindex 54ddf757116..2e7a77a891c 100644--- a/web/app/components/header/app-nav/index.tsx+++ b/web/app/components/header/app-nav/index.tsx@@ -93,7 +93,7 @@ const AppNav = () => {const newNavItems = produce(navItems, (draft: NavItem[]) => {navItems.forEach((app, index) => {if (app.id === appDetail.id)- draft[index].name = appDetail.name+ draft[index]!.name = appDetail.name})})setNavItems(newNavItems)diff --git a/web/app/components/header/app-selector/__tests__/index.spec.tsx b/web/app/components/header/app-selector/__tests__/index.spec.tsxindex eddb7e52aa1..2d255c006e2 100644--- a/web/app/components/header/app-selector/__tests__/index.spec.tsx+++ b/web/app/components/header/app-selector/__tests__/index.spec.tsx@@ -32,7 +32,7 @@ describe('AppSelector Component', () => {{ id: '1', name: 'App 1' },{ id: '2', name: 'App 2' },] as unknown as AppDetailResponse[]- const mockCurApp = mockAppItems[0]+ const mockCurApp = mockAppItems[0]!beforeEach(() => {vi.clearAllMocks()@@ -47,7 +47,7 @@ describe('AppSelector Component', () => {describe('Rendering', () => {it('should render current app name', () => {render(<AppSelector appItems={mockAppItems} curApp={mockCurApp} />)- expect(screen.getByText('App 1')).toBeInTheDocument()+ expect(screen.getByText('App 1'))!.toBeInTheDocument()})})@@ -60,7 +60,7 @@ describe('AppSelector Component', () => {fireEvent.click(button)})- expect(screen.getByText('App 2')).toBeInTheDocument()+ expect(screen.getByText('App 2'))!.toBeInTheDocument()})it('should navigate to configuration when an app is clicked and user is editor', async () => {@@ -114,7 +114,7 @@ describe('AppSelector Component', () => {fireEvent.click(newAppBtn)})- expect(screen.getByTestId('create-app-dialog')).toBeInTheDocument()+ expect(screen.getByTestId('create-app-dialog'))!.toBeInTheDocument()})it('should not show "New App" button for non-editor', async () => {@@ -165,7 +165,8 @@ describe('AppSelector Component', () => {expect(screen.queryByText('App 2')).not.toBeInTheDocument()// "New App" should still be there if editor- expect(screen.getByText('common.menus.newApp')).toBeInTheDocument()+ // "New App" should still be there if editor+ expect(screen.getByText('common.menus.newApp'))!.toBeInTheDocument()})})})diff --git a/web/app/components/header/nav/nav-selector/__tests__/index.spec.tsx b/web/app/components/header/nav/nav-selector/__tests__/index.spec.tsxindex 152901b79cf..97443bb759f 100644--- a/web/app/components/header/nav/nav-selector/__tests__/index.spec.tsx+++ b/web/app/components/header/nav/nav-selector/__tests__/index.spec.tsx@@ -105,7 +105,7 @@ describe('NavSelector Component', () => {},]- const { link: _link, ...curNavWithoutLink } = navigationItems[0]+ const { link: _link, ...curNavWithoutLink } = navigationItems[0]!const defaultProps: INavSelectorProps = {curNav: curNavWithoutLink,@@ -131,7 +131,7 @@ describe('NavSelector Component', () => {describe('Rendering', () => {it('should render current nav name', () => {render(<NavSelector {...defaultProps} />)- expect(screen.getByText('Item 1')).toBeInTheDocument()+ expect(screen.getByText('Item 1'))!.toBeInTheDocument()})it('should show loading indicator when isLoadingMore is true', async () => {@@ -140,7 +140,7 @@ describe('NavSelector Component', () => {await act(async () => {fireEvent.click(button)})- expect(screen.getByRole('status')).toBeInTheDocument()+ expect(screen.getByRole('status'))!.toBeInTheDocument()})})@@ -151,7 +151,7 @@ describe('NavSelector Component', () => {await act(async () => {fireEvent.click(button)})- expect(screen.getByText('Item 2')).toBeInTheDocument()+ expect(screen.getByText('Item 2'))!.toBeInTheDocument()})it('should navigate and call setAppDetail when an item is clicked', async () => {diff --git a/web/app/components/plugins/__tests__/hooks.spec.ts b/web/app/components/plugins/__tests__/hooks.spec.tsindex b12121d6266..1e4f18ec5d2 100644--- a/web/app/components/plugins/__tests__/hooks.spec.ts+++ b/web/app/components/plugins/__tests__/hooks.spec.ts@@ -86,15 +86,15 @@ describe('useCategories', () => {it('should use plural labels by default', () => {const { result } = renderHook(() => useCategories())- expect(result.current.categoriesMap.tool.label).toBe('plugin.category.tools')- expect(result.current.categoriesMap['agent-strategy'].label).toBe('plugin.category.agents')+ expect(result.current.categoriesMap.tool!.label).toBe('plugin.category.tools')+ expect(result.current.categoriesMap['agent-strategy']!.label).toBe('plugin.category.agents')})it('should use singular labels when isSingle is true', () => {const { result } = renderHook(() => useCategories(true))- expect(result.current.categoriesMap.tool.label).toBe('plugin.categorySingle.tool')- expect(result.current.categoriesMap['agent-strategy'].label).toBe('plugin.categorySingle.agent')+ expect(result.current.categoriesMap.tool!.label).toBe('plugin.categorySingle.tool')+ expect(result.current.categoriesMap['agent-strategy']!.label).toBe('plugin.categorySingle.agent')})})diff --git a/web/app/components/plugins/card/index.tsx b/web/app/components/plugins/card/index.tsxindex 9f9b89cbbfd..dd7f92184dc 100644--- a/web/app/components/plugins/card/index.tsx+++ b/web/app/components/plugins/card/index.tsx@@ -77,7 +77,7 @@ const Card = ({return (<div className={wrapClassName}><div className={cn('p-4 pb-3', limitedInstall && 'pb-1')}>- {!hideCornerMark && <CornerMark text={categoriesMap[type === 'bundle' ? type : category]?.label} />}+ {!hideCornerMark && <CornerMark text={categoriesMap[type === 'bundle' ? type : category]?.label!} />}{/* Header */}<div className="flex"><Icon src={iconSrc} installed={installed} installFailed={installFailed} />diff --git a/web/app/components/plugins/install-plugin/hooks.ts b/web/app/components/plugins/install-plugin/hooks.tsindex f86e6ad6727..4759953e30e 100644--- a/web/app/components/plugins/install-plugin/hooks.ts+++ b/web/app/components/plugins/install-plugin/hooks.ts@@ -52,7 +52,7 @@ export const checkForUpdates = (fetchedReleases: GitHubRepoReleaseResponse[], cuconst versions = fetchedReleases.map(release => release.tag_name)const latestVersion = getLatestVersion(versions)try {- needUpdate = compareVersion(latestVersion, currentVersion) === 1+ needUpdate = compareVersion(latestVersion!, currentVersion) === 1if (needUpdate)toastProps.message = `New version available: ${latestVersion}`}diff --git a/web/app/components/plugins/install-plugin/install-bundle/steps/__tests__/install-multi.spec.tsx b/web/app/components/plugins/install-plugin/install-bundle/steps/__tests__/install-multi.spec.tsxindex 4507c1295b6..d45b05bfd16 100644--- a/web/app/components/plugins/install-plugin/install-bundle/steps/__tests__/install-multi.spec.tsx+++ b/web/app/components/plugins/install-plugin/install-bundle/steps/__tests__/install-multi.spec.tsx@@ -260,14 +260,14 @@ describe('InstallMulti Component', () => {it('should render without crashing', () => {render(<InstallMulti {...defaultProps} />)- expect(screen.getByTestId('package-item')).toBeInTheDocument()+ expect(screen.getByTestId('package-item'))!.toBeInTheDocument()})it('should render PackageItem for package type dependency', () => {render(<InstallMulti {...defaultProps} />)- expect(screen.getByTestId('package-item')).toBeInTheDocument()- expect(screen.getByTestId('package-item-name')).toHaveTextContent('Package Plugin 0')+ expect(screen.getByTestId('package-item'))!.toBeInTheDocument()+ expect(screen.getByTestId('package-item-name'))!.toHaveTextContent('Package Plugin 0')})it('should render GithubItem for github type dependency', async () => {@@ -279,9 +279,9 @@ describe('InstallMulti Component', () => {render(<InstallMulti {...githubProps} />)await waitFor(() => {- expect(screen.getByTestId('github-item')).toBeInTheDocument()+ expect(screen.getByTestId('github-item'))!.toBeInTheDocument()})- expect(screen.getByTestId('github-item-repo')).toHaveTextContent('test-org/plugin-0')+ expect(screen.getByTestId('github-item-repo'))!.toHaveTextContent('test-org/plugin-0')})it('should render MarketplaceItem for marketplace type dependency', async () => {@@ -293,7 +293,7 @@ describe('InstallMulti Component', () => {render(<InstallMulti {...marketplaceProps} />)await waitFor(() => {- expect(screen.getByTestId('marketplace-item')).toBeInTheDocument()+ expect(screen.getByTestId('marketplace-item'))!.toBeInTheDocument()})})@@ -309,8 +309,8 @@ describe('InstallMulti Component', () => {render(<InstallMulti {...mixedProps} />)await waitFor(() => {- expect(screen.getByTestId('package-item')).toBeInTheDocument()- expect(screen.getByTestId('github-item')).toBeInTheDocument()+ expect(screen.getByTestId('package-item'))!.toBeInTheDocument()+ expect(screen.getByTestId('github-item'))!.toBeInTheDocument()})})@@ -328,7 +328,7 @@ describe('InstallMulti Component', () => {render(<InstallMulti {...githubProps} />)await waitFor(() => {- expect(screen.queryByTestId('github-item')).toBeInTheDocument()+ expect(screen.queryByTestId('github-item'))!.toBeInTheDocument()})})})@@ -355,13 +355,13 @@ describe('InstallMulti Component', () => {render(<InstallMulti {...propsWithSelected} />)- expect(screen.getByTestId('package-item-checked')).toHaveTextContent('checked')+ expect(screen.getByTestId('package-item-checked'))!.toHaveTextContent('checked')})it('should show unchecked state when plugin is not selected', () => {render(<InstallMulti {...defaultProps} />)- expect(screen.getByTestId('package-item-checked')).toHaveTextContent('unchecked')+ expect(screen.getByTestId('package-item-checked'))!.toHaveTextContent('unchecked')})})@@ -427,7 +427,7 @@ describe('InstallMulti Component', () => {// The getVersionInfo function returns hasInstalled, installedVersion, toInstallVersion// These are passed to child componentsawait waitFor(() => {- expect(screen.getByTestId('package-item')).toBeInTheDocument()+ expect(screen.getByTestId('package-item'))!.toBeInTheDocument()})})})@@ -443,7 +443,7 @@ describe('InstallMulti Component', () => {render(<InstallMulti {...githubProps} />)await waitFor(() => {- expect(screen.getByTestId('github-item')).toBeInTheDocument()+ expect(screen.getByTestId('github-item'))!.toBeInTheDocument()})// The onFetchedPayload callback should have been called by the mock@@ -462,7 +462,7 @@ describe('InstallMulti Component', () => {render(<InstallMulti {...marketplaceProps} />)await waitFor(() => {- expect(screen.getByTestId('marketplace-item')).toBeInTheDocument()+ expect(screen.getByTestId('marketplace-item'))!.toBeInTheDocument()})})})@@ -485,7 +485,7 @@ describe('InstallMulti Component', () => {render(<InstallMulti {...defaultProps} />)await waitFor(() => {- expect(screen.getByTestId('package-item')).toBeInTheDocument()+ expect(screen.getByTestId('package-item'))!.toBeInTheDocument()})})@@ -498,7 +498,7 @@ describe('InstallMulti Component', () => {render(<InstallMulti {...propsWithMarketplace} />)await waitFor(() => {- expect(screen.getByTestId('package-item')).toBeInTheDocument()+ expect(screen.getByTestId('package-item'))!.toBeInTheDocument()})})})@@ -509,7 +509,8 @@ describe('InstallMulti Component', () => {render(<InstallMulti {...defaultProps} />)// Package plugins are initialized immediately- expect(screen.getByTestId('package-item')).toBeInTheDocument()+ // Package plugins are initialized immediately+ expect(screen.getByTestId('package-item'))!.toBeInTheDocument()})it('should update plugins when GitHub plugin is fetched', async () => {@@ -521,7 +522,7 @@ describe('InstallMulti Component', () => {render(<InstallMulti {...githubProps} />)await waitFor(() => {- expect(screen.getByTestId('github-item')).toBeInTheDocument()+ expect(screen.getByTestId('github-item'))!.toBeInTheDocument()})})})@@ -553,7 +554,7 @@ describe('InstallMulti Component', () => {render(<InstallMulti {...defaultProps} />)await waitFor(() => {- expect(screen.getByTestId('package-item')).toBeInTheDocument()+ expect(screen.getByTestId('package-item'))!.toBeInTheDocument()})})@@ -613,11 +614,12 @@ describe('InstallMulti Component', () => {render(<InstallMulti {...marketplaceProps} />)await waitFor(() => {- expect(screen.getByTestId('marketplace-item')).toBeInTheDocument()+ expect(screen.getByTestId('marketplace-item'))!.toBeInTheDocument()})// Version should be displayed- expect(screen.getByTestId('marketplace-item-version')).toBeInTheDocument()+ // Version should be displayed+ expect(screen.getByTestId('marketplace-item-version'))!.toBeInTheDocument()})})@@ -706,7 +708,8 @@ describe('InstallMulti Component', () => {await waitFor(() => {// Component should render- expect(document.body).toBeInTheDocument()+ // Component should render+ expect(document.body)!.toBeInTheDocument()})})})@@ -717,7 +720,7 @@ describe('InstallMulti Component', () => {render(<InstallMulti {...defaultProps} />)await waitFor(() => {- expect(screen.getByTestId('package-item')).toBeInTheDocument()+ expect(screen.getByTestId('package-item'))!.toBeInTheDocument()})// The getVersionInfo callback should return correct structure@@ -738,10 +741,10 @@ describe('InstallMulti Component', () => {render(<InstallMulti {...propsWithSelected} />)await waitFor(() => {- expect(screen.getByTestId('github-item')).toBeInTheDocument()+ expect(screen.getByTestId('github-item'))!.toBeInTheDocument()})- expect(screen.getByTestId('github-item-checked')).toHaveTextContent('checked')+ expect(screen.getByTestId('github-item-checked'))!.toHaveTextContent('checked')})it('should show checked state for marketplace item when selected', async () => {@@ -755,7 +758,7 @@ describe('InstallMulti Component', () => {render(<InstallMulti {...propsWithSelected} />)await waitFor(() => {- expect(screen.getByTestId('marketplace-item')).toBeInTheDocument()+ expect(screen.getByTestId('marketplace-item'))!.toBeInTheDocument()})// The checked prop should be passed to the item@@ -771,10 +774,10 @@ describe('InstallMulti Component', () => {render(<InstallMulti {...propsWithoutSelected} />)await waitFor(() => {- expect(screen.getByTestId('github-item')).toBeInTheDocument()+ expect(screen.getByTestId('github-item'))!.toBeInTheDocument()})- expect(screen.getByTestId('github-item-checked')).toHaveTextContent('unchecked')+ expect(screen.getByTestId('github-item-checked'))!.toHaveTextContent('unchecked')})})@@ -823,7 +826,7 @@ describe('InstallMulti Component', () => {const packageItems = screen.getAllByTestId('package-item')await act(async () => {- fireEvent.click(packageItems[0])+ fireEvent.click(packageItems[0]!)})// onSelect should be called with filtered plugin count@@ -842,11 +845,12 @@ describe('InstallMulti Component', () => {render(<InstallMulti {...marketplaceProps} />)await waitFor(() => {- expect(screen.getByTestId('marketplace-item')).toBeInTheDocument()+ expect(screen.getByTestId('marketplace-item'))!.toBeInTheDocument()})// The version should be displayed (from dependency or plugin)- expect(screen.getByTestId('marketplace-item-version')).toBeInTheDocument()+ // The version should be displayed (from dependency or plugin)+ expect(screen.getByTestId('marketplace-item-version'))!.toBeInTheDocument()})})@@ -856,7 +860,7 @@ describe('InstallMulti Component', () => {render(<InstallMulti {...defaultProps} />)await waitFor(() => {- expect(screen.getByTestId('package-item')).toBeInTheDocument()+ expect(screen.getByTestId('package-item'))!.toBeInTheDocument()})// The component should pass versionInfo to items@@ -868,7 +872,7 @@ describe('InstallMulti Component', () => {render(<InstallMulti {...defaultProps} />)await waitFor(() => {- expect(screen.getByTestId('package-item')).toBeInTheDocument()+ expect(screen.getByTestId('package-item'))!.toBeInTheDocument()expect(defaultProps.onLoadedAllPlugin).toHaveBeenCalled()})})diff --git a/web/app/components/plugins/install-plugin/install-bundle/steps/hooks/use-install-multi-state.ts b/web/app/components/plugins/install-plugin/install-bundle/steps/hooks/use-install-multi-state.tsindex 86dd287c998..ca06f33c160 100644--- a/web/app/components/plugins/install-plugin/install-bundle/steps/hooks/use-install-multi-state.ts+++ b/web/app/components/plugins/install-plugin/install-bundle/steps/hooks/use-install-multi-state.ts@@ -35,7 +35,7 @@ function parseMarketplaceIdentifier(identifier?: string): MarketplacePluginInforeturn nullconst withoutHash = identifier.split('@')[0]- const [organization, nameAndVersionPart] = withoutHash.split('/')+ const [organization, nameAndVersionPart] = withoutHash!.split('/')if (!organization || !nameAndVersionPart)return nulldiff --git a/web/app/components/plugins/install-plugin/install-bundle/steps/install.tsx b/web/app/components/plugins/install-plugin/install-bundle/steps/install.tsxindex 9eb4db7a271..df94331d58e 100644--- a/web/app/components/plugins/install-plugin/install-bundle/steps/install.tsx+++ b/web/app/components/plugins/install-plugin/install-bundle/steps/install.tsx@@ -83,7 +83,7 @@ const Install: FC<Props> = ({onInstalled(selectedPlugins, res.map((r, i) => {return ({success: r.status === TaskStatus.success,- isFromMarketPlace: allPlugins[selectedIndexes[i]].type === 'marketplace',+ isFromMarketPlace: allPlugins[selectedIndexes[i]!]!.type === 'marketplace',})}))const hasInstallSuccess = res.some(r => r.status === TaskStatus.success)@@ -101,7 +101,7 @@ const Install: FC<Props> = ({if (item.status !== TaskStatus.running) {return {success: item.status === TaskStatus.success,- isFromMarketPlace: allPlugins[selectedIndexes[index]].type === 'marketplace',+ isFromMarketPlace: allPlugins[selectedIndexes[index]!]!.type === 'marketplace',}}const { status } = await check({@@ -110,7 +110,7 @@ const Install: FC<Props> = ({})return {success: status === TaskStatus.success,- isFromMarketPlace: allPlugins[selectedIndexes[index]].type === 'marketplace',+ isFromMarketPlace: allPlugins[selectedIndexes[index]!]!.type === 'marketplace',}}))onInstalled(selectedPlugins, installStatus)diff --git a/web/app/components/plugins/install-plugin/install-bundle/steps/installed.tsx b/web/app/components/plugins/install-plugin/install-bundle/steps/installed.tsxindex a7808736e99..1c64e73d62b 100644--- a/web/app/components/plugins/install-plugin/install-bundle/steps/installed.tsx+++ b/web/app/components/plugins/install-plugin/install-bundle/steps/installed.tsx@@ -36,10 +36,10 @@ const Installed: FC<Props> = ({className="w-full"payload={{...plugin,- icon: installStatus[index].isFromMarketPlace ? `${MARKETPLACE_API_PREFIX}/plugins/${plugin.org}/${plugin.name}/icon` : getIconUrl(plugin.icon),+ icon: installStatus[index]!.isFromMarketPlace ? `${MARKETPLACE_API_PREFIX}/plugins/${plugin.org}/${plugin.name}/icon` : getIconUrl(plugin.icon),}}- installed={installStatus[index].success}- installFailed={!installStatus[index].success}+ installed={installStatus[index]!.success}+ installFailed={!installStatus[index]!.success}titleLeft={plugin.version ? <Badge className="mx-1" size="s" state={BadgeState.Default}>{plugin.version}</Badge> : null}/>)diff --git a/web/app/components/plugins/marketplace/__tests__/query.spec.tsx b/web/app/components/plugins/marketplace/__tests__/query.spec.tsxindex 80d8e6a9320..5353cdba91b 100644--- a/web/app/components/plugins/marketplace/__tests__/query.spec.tsx+++ b/web/app/components/plugins/marketplace/__tests__/query.spec.tsx@@ -143,7 +143,7 @@ describe('useMarketplacePlugins', () => {})expect(result.current.data?.pages).toHaveLength(1)- expect(result.current.data?.pages[0].plugins).toHaveLength(1)+ expect(result.current.data?.pages[0]!.plugins).toHaveLength(1)})it('should handle bundle type in query params', async () => {@@ -185,8 +185,8 @@ describe('useMarketplacePlugins', () => {expect(result.current.data).toBeDefined()})- expect(result.current.data?.pages[0].plugins).toEqual([])- expect(result.current.data?.pages[0].total).toBe(0)+ expect(result.current.data?.pages[0]!.plugins).toEqual([])+ expect(result.current.data?.pages[0]!.total).toBe(0)})it('should determine next page correctly via getNextPageParam', async () => {diff --git a/web/app/components/plugins/marketplace/__tests__/utils.spec.ts b/web/app/components/plugins/marketplace/__tests__/utils.spec.tsindex 92bed9be62c..972a9ba9133 100644--- a/web/app/components/plugins/marketplace/__tests__/utils.spec.ts+++ b/web/app/components/plugins/marketplace/__tests__/utils.spec.ts@@ -264,7 +264,7 @@ describe('getMarketplacePluginsByCollectionId', () => {expect(mockCollectionPlugins).toHaveBeenCalled()const call = mockCollectionPlugins.mock.calls[0]- expect(call[1]).toMatchObject({ signal: controller.signal })+ expect(call![1]).toMatchObject({ signal: controller.signal })})})@@ -313,7 +313,7 @@ describe('getMarketplaceCollectionsAndPlugins', () => {expect(mockCollections).toHaveBeenCalled()const call = mockCollections.mock.calls[0]- expect(call[0]).toMatchObject({ query: expect.objectContaining({ condition: 'category=tool', type: 'bundle' }) })+ expect(call![0]).toMatchObject({ query: expect.objectContaining({ condition: 'category=tool', type: 'bundle' }) })})})@@ -393,7 +393,7 @@ describe('getMarketplacePlugins', () => {expect(result.plugins).toHaveLength(1)const call = mockSearchAdvanced.mock.calls[0]- expect(call[0].params.kind).toBe('bundles')+ expect(call![0].params.kind).toBe('bundles')})it('should use empty category when category is all', async () => {@@ -408,7 +408,7 @@ describe('getMarketplacePlugins', () => {}, 1)const call = mockSearchAdvanced.mock.calls[0]- expect(call[0].body.category).toBe('')+ expect(call![0].body.category).toBe('')})it('should handle API error and return empty result', async () => {@@ -437,7 +437,7 @@ describe('getMarketplacePlugins', () => {await getMarketplacePlugins({ query: 'test' }, 1, controller.signal)const call = mockSearchAdvanced.mock.calls[0]- expect(call[1]).toMatchObject({ signal: controller.signal })+ expect(call![1]).toMatchObject({ signal: controller.signal })})it('should default page_size to 40 when not provided', async () => {diff --git a/web/app/components/plugins/marketplace/list/list-with-collection.tsx b/web/app/components/plugins/marketplace/list/list-with-collection.tsxindex 21094f39a53..744885ae09a 100644--- a/web/app/components/plugins/marketplace/list/list-with-collection.tsx+++ b/web/app/components/plugins/marketplace/list/list-with-collection.tsx@@ -60,7 +60,7 @@ const ListWithCollection = ({)}>{- marketplaceCollectionPluginsMap[collection.name].map((plugin) => {+ marketplaceCollectionPluginsMap[collection.name]!.map((plugin) => {if (cardRender)return cardRender(plugin)diff --git a/web/app/components/plugins/marketplace/search-box/__tests__/index.spec.tsx b/web/app/components/plugins/marketplace/search-box/__tests__/index.spec.tsxindex 31cb5d84454..8609ba55398 100644--- a/web/app/components/plugins/marketplace/search-box/__tests__/index.spec.tsx+++ b/web/app/components/plugins/marketplace/search-box/__tests__/index.spec.tsx@@ -124,7 +124,7 @@ describe('SearchBox', () => {it('should render without crashing', () => {render(<SearchBox {...defaultProps} />)- expect(screen.getByRole('textbox')).toBeInTheDocument()+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})it('should render with marketplace mode styling', () => {@@ -133,7 +133,8 @@ describe('SearchBox', () => {)// In marketplace mode, TagsFilter comes before input- expect(container.querySelector('.rounded-xl')).toBeInTheDocument()+ // In marketplace mode, TagsFilter comes before input+ expect(container.querySelector('.rounded-xl'))!.toBeInTheDocument()})it('should render with non-marketplace mode styling', () => {@@ -142,25 +143,26 @@ describe('SearchBox', () => {)// In non-marketplace mode, search icon appears first- expect(container.querySelector('.rounded-lg')).toBeInTheDocument()+ // In non-marketplace mode, search icon appears first+ expect(container.querySelector('.rounded-lg'))!.toBeInTheDocument()})it('should render placeholder correctly', () => {render(<SearchBox {...defaultProps} placeholder="Search here..." />)- expect(screen.getByPlaceholderText('Search here...')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('Search here...'))!.toBeInTheDocument()})it('should render search input with current value', () => {render(<SearchBox {...defaultProps} search="test query" />)- expect(screen.getByDisplayValue('test query')).toBeInTheDocument()+ expect(screen.getByDisplayValue('test query'))!.toBeInTheDocument()})it('should render TagsFilter component', () => {render(<SearchBox {...defaultProps} />)- expect(screen.getByTestId('portal-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-elem'))!.toBeInTheDocument()})})@@ -175,8 +177,9 @@ describe('SearchBox', () => {const input = screen.getByRole('textbox')// Both should be rendered- expect(portalElem).toBeInTheDocument()- expect(input).toBeInTheDocument()+ // Both should be rendered+ expect(portalElem)!.toBeInTheDocument()+ expect(input)!.toBeInTheDocument()})it('should render clear button when search has value in marketplace mode', () => {@@ -207,7 +210,8 @@ describe('SearchBox', () => {)// Search icon should be present- expect(container.querySelector('.text-components-input-text-placeholder')).toBeInTheDocument()+ // Search icon should be present+ expect(container.querySelector('.text-components-input-text-placeholder'))!.toBeInTheDocument()})it('should render clear button when search has value', () => {@@ -223,8 +227,8 @@ describe('SearchBox', () => {const portalElem = screen.getByTestId('portal-elem')const input = screen.getByRole('textbox')- expect(portalElem).toBeInTheDocument()- expect(input).toBeInTheDocument()+ expect(portalElem)!.toBeInTheDocument()+ expect(input)!.toBeInTheDocument()})it('should set autoFocus when prop is true', () => {@@ -232,7 +236,8 @@ describe('SearchBox', () => {const input = screen.getByRole('textbox')// autoFocus is a boolean attribute that React handles specially- expect(input).toBeInTheDocument()+ // autoFocus is a boolean attribute that React handles specially+ expect(input)!.toBeInTheDocument()})})@@ -264,7 +269,7 @@ describe('SearchBox', () => {const buttons = screen.getAllByRole('button')// Find the clear button (the one in the search area)const clearButton = buttons[buttons.length - 1]- fireEvent.click(clearButton)+ fireEvent.click(clearButton!)expect(onSearchChange).toHaveBeenCalledWith('')})@@ -282,7 +287,7 @@ describe('SearchBox', () => {const buttons = screen.getAllByRole('button')// First button should be the clear button in non-marketplace mode- fireEvent.click(buttons[0])+ fireEvent.click(buttons[0]!)expect(onSearchChange).toHaveBeenCalledWith('')})@@ -356,7 +361,7 @@ describe('SearchBox', () => {<SearchBox {...defaultProps} wrapperClassName="custom-wrapper-class" />,)- expect(container.querySelector('.custom-wrapper-class')).toBeInTheDocument()+ expect(container.querySelector('.custom-wrapper-class'))!.toBeInTheDocument()})it('should apply inputClassName correctly', () => {@@ -364,19 +369,19 @@ describe('SearchBox', () => {<SearchBox {...defaultProps} inputClassName="custom-input-class" />,)- expect(container.querySelector('.custom-input-class')).toBeInTheDocument()+ expect(container.querySelector('.custom-input-class'))!.toBeInTheDocument()})it('should handle empty placeholder', () => {render(<SearchBox {...defaultProps} placeholder="" />)- expect(screen.getByRole('textbox')).toHaveAttribute('placeholder', '')+ expect(screen.getByRole('textbox'))!.toHaveAttribute('placeholder', '')})it('should use default placeholder when not provided', () => {render(<SearchBox {...defaultProps} />)- expect(screen.getByRole('textbox')).toHaveAttribute('placeholder', '')+ expect(screen.getByRole('textbox'))!.toHaveAttribute('placeholder', '')})})@@ -387,14 +392,14 @@ describe('SearchBox', () => {it('should handle empty search value', () => {render(<SearchBox {...defaultProps} search="" />)- expect(screen.getByRole('textbox')).toBeInTheDocument()- expect(screen.getByRole('textbox')).toHaveValue('')+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()+ expect(screen.getByRole('textbox'))!.toHaveValue('')})it('should handle empty tags array', () => {render(<SearchBox {...defaultProps} tags={[]} />)- expect(screen.getByTestId('portal-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-elem'))!.toBeInTheDocument()})it('should handle special characters in search', () => {@@ -411,7 +416,7 @@ describe('SearchBox', () => {const longString = 'a'.repeat(1000)render(<SearchBox {...defaultProps} search={longString} />)- expect(screen.getByDisplayValue(longString)).toBeInTheDocument()+ expect(screen.getByDisplayValue(longString))!.toBeInTheDocument()})it('should handle whitespace-only search', () => {@@ -439,20 +444,21 @@ describe('SearchBoxWrapper', () => {it('should render without crashing', () => {render(<SearchBoxWrapper />)- expect(screen.getByRole('textbox')).toBeInTheDocument()+ expect(screen.getByRole('textbox'))!.toBeInTheDocument()})it('should render in marketplace mode', () => {const { container } = render(<SearchBoxWrapper />)- expect(container.querySelector('.rounded-xl')).toBeInTheDocument()+ expect(container.querySelector('.rounded-xl'))!.toBeInTheDocument()})it('should apply correct wrapper classes', () => {const { container } = render(<SearchBoxWrapper />)// Check for z-11 class from wrapper- expect(container.querySelector('.z-11')).toBeInTheDocument()+ // Check for z-11 class from wrapper+ expect(container.querySelector('.z-11'))!.toBeInTheDocument()})})@@ -471,7 +477,7 @@ describe('SearchBoxWrapper', () => {it('should use translation for placeholder', () => {render(<SearchBoxWrapper />)- expect(screen.getByPlaceholderText('Search plugins')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('Search plugins'))!.toBeInTheDocument()})})})@@ -496,13 +502,13 @@ describe('MarketplaceTrigger', () => {it('should render without crashing', () => {render(<MarketplaceTrigger {...defaultProps} />)- expect(screen.getByText('All Tags')).toBeInTheDocument()+ expect(screen.getByText('All Tags'))!.toBeInTheDocument()})it('should show "All Tags" when no tags selected', () => {render(<MarketplaceTrigger {...defaultProps} selectedTagsLength={0} />)- expect(screen.getByText('All Tags')).toBeInTheDocument()+ expect(screen.getByText('All Tags'))!.toBeInTheDocument()})it('should show arrow down icon when no tags selected', () => {@@ -511,7 +517,8 @@ describe('MarketplaceTrigger', () => {)// Arrow down icon should be present- expect(container.querySelector('.size-4')).toBeInTheDocument()+ // Arrow down icon should be present+ expect(container.querySelector('.size-4'))!.toBeInTheDocument()})})@@ -525,7 +532,7 @@ describe('MarketplaceTrigger', () => {/>,)- expect(screen.getByText('Agent')).toBeInTheDocument()+ expect(screen.getByText('Agent'))!.toBeInTheDocument()})it('should show multiple tag labels separated by comma', () => {@@ -537,7 +544,7 @@ describe('MarketplaceTrigger', () => {/>,)- expect(screen.getByText('Agent,RAG')).toBeInTheDocument()+ expect(screen.getByText('Agent,RAG'))!.toBeInTheDocument()})it('should show +N indicator when more than 2 tags selected', () => {@@ -549,7 +556,7 @@ describe('MarketplaceTrigger', () => {/>,)- expect(screen.getByText('+2')).toBeInTheDocument()+ expect(screen.getByText('+2'))!.toBeInTheDocument()})it('should only show first 2 tags in label', () => {@@ -561,7 +568,7 @@ describe('MarketplaceTrigger', () => {/>,)- expect(screen.getByText('Agent,RAG')).toBeInTheDocument()+ expect(screen.getByText('Agent,RAG'))!.toBeInTheDocument()expect(screen.queryByText('Search')).not.toBeInTheDocument()})})@@ -577,7 +584,8 @@ describe('MarketplaceTrigger', () => {)// RiCloseCircleFill icon should be present- expect(container.querySelector('.text-text-quaternary')).toBeInTheDocument()+ // RiCloseCircleFill icon should be present+ expect(container.querySelector('.text-text-quaternary'))!.toBeInTheDocument()})it('should not show clear button when no tags selected', () => {@@ -585,6 +593,37 @@ describe('MarketplaceTrigger', () => {<MarketplaceTrigger {...defaultProps} selectedTagsLength={0} />,)+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present+ // Clear button should not be present// Clear button should not be presentexpect(container.querySelector('.text-text-quaternary')).not.toBeInTheDocument()})@@ -614,7 +653,7 @@ describe('MarketplaceTrigger', () => {<MarketplaceTrigger {...defaultProps} open selectedTagsLength={0} />,)- expect(container.querySelector('.bg-state-base-hover')).toBeInTheDocument()+ expect(container.querySelector('.bg-state-base-hover'))!.toBeInTheDocument()})it('should apply border styling when tags are selected', () => {@@ -626,7 +665,7 @@ describe('MarketplaceTrigger', () => {/>,)- expect(container.querySelector('.border-components-button-secondary-border')).toBeInTheDocument()+ expect(container.querySelector('.border-components-button-secondary-border'))!.toBeInTheDocument()})})@@ -636,7 +675,7 @@ describe('MarketplaceTrigger', () => {<MarketplaceTrigger {...defaultProps} tagsMap={{}} tags={[]} />,)- expect(container).toBeInTheDocument()+ expect(container)!.toBeInTheDocument()})})})@@ -661,13 +700,13 @@ describe('ToolSelectorTrigger', () => {it('should render without crashing', () => {const { container } = render(<ToolSelectorTrigger {...defaultProps} />)- expect(container).toBeInTheDocument()+ expect(container)!.toBeInTheDocument()})it('should render price tag icon', () => {const { container } = render(<ToolSelectorTrigger {...defaultProps} />)- expect(container.querySelector('.size-4')).toBeInTheDocument()+ expect(container.querySelector('.size-4'))!.toBeInTheDocument()})})@@ -681,7 +720,7 @@ describe('ToolSelectorTrigger', () => {/>,)- expect(screen.getByText('Agent')).toBeInTheDocument()+ expect(screen.getByText('Agent'))!.toBeInTheDocument()})it('should show multiple tag labels separated by comma', () => {@@ -693,7 +732,7 @@ describe('ToolSelectorTrigger', () => {/>,)- expect(screen.getByText('Agent,RAG')).toBeInTheDocument()+ expect(screen.getByText('Agent,RAG'))!.toBeInTheDocument()})it('should show +N indicator when more than 2 tags selected', () => {@@ -705,7 +744,7 @@ describe('ToolSelectorTrigger', () => {/>,)- expect(screen.getByText('+2')).toBeInTheDocument()+ expect(screen.getByText('+2'))!.toBeInTheDocument()})it('should not show tag labels when no tags selected', () => {@@ -725,7 +764,7 @@ describe('ToolSelectorTrigger', () => {/>,)- expect(container.querySelector('.text-text-quaternary')).toBeInTheDocument()+ expect(container.querySelector('.text-text-quaternary'))!.toBeInTheDocument()})it('should not show clear button when no tags selected', () => {@@ -785,7 +824,7 @@ describe('ToolSelectorTrigger', () => {<ToolSelectorTrigger {...defaultProps} open selectedTagsLength={0} />,)- expect(container.querySelector('.bg-state-base-hover')).toBeInTheDocument()+ expect(container.querySelector('.bg-state-base-hover'))!.toBeInTheDocument()})it('should apply border styling when tags are selected', () => {@@ -797,7 +836,7 @@ describe('ToolSelectorTrigger', () => {/>,)- expect(container.querySelector('.border-components-button-secondary-border')).toBeInTheDocument()+ expect(container.querySelector('.border-components-button-secondary-border'))!.toBeInTheDocument()})it('should not apply hover styling when open but has tags', () => {@@ -811,7 +850,8 @@ describe('ToolSelectorTrigger', () => {)// Should have border styling, not hover- expect(container.querySelector('.border-components-button-secondary-border')).toBeInTheDocument()+ // Should have border styling, not hover+ expect(container.querySelector('.border-components-button-secondary-border'))!.toBeInTheDocument()})})@@ -826,7 +866,7 @@ describe('ToolSelectorTrigger', () => {/>,)- expect(screen.getByText('Agent')).toBeInTheDocument()+ expect(screen.getByText('Agent'))!.toBeInTheDocument()})})})@@ -854,7 +894,7 @@ describe('TagsFilter', () => {/>,)- expect(screen.getByTestId('portal-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-elem'))!.toBeInTheDocument()})it('should pass usedInMarketplace prop to TagsFilter', () => {@@ -869,7 +909,8 @@ describe('TagsFilter', () => {)// MarketplaceTrigger should show "All Tags"- expect(screen.getByText('All Tags')).toBeInTheDocument()+ // MarketplaceTrigger should show "All Tags"+ expect(screen.getByText('All Tags'))!.toBeInTheDocument()})it('should show selected tags count in TagsFilter trigger', () => {@@ -883,7 +924,7 @@ describe('TagsFilter', () => {/>,)- expect(screen.getByText('+1')).toBeInTheDocument()+ expect(screen.getByText('+1'))!.toBeInTheDocument()})})@@ -902,7 +943,7 @@ describe('TagsFilter', () => {fireEvent.click(trigger)await waitFor(() => {- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()})})@@ -921,7 +962,7 @@ describe('TagsFilter', () => {// OpenfireEvent.click(trigger)await waitFor(() => {- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()})// Close@@ -947,8 +988,8 @@ describe('TagsFilter', () => {fireEvent.click(trigger)await waitFor(() => {- expect(screen.getByText('Agent')).toBeInTheDocument()- expect(screen.getByText('RAG')).toBeInTheDocument()+ expect(screen.getByText('Agent'))!.toBeInTheDocument()+ expect(screen.getByText('RAG'))!.toBeInTheDocument()})})@@ -967,7 +1008,7 @@ describe('TagsFilter', () => {fireEvent.click(trigger)await waitFor(() => {- expect(screen.getByText('Agent')).toBeInTheDocument()+ expect(screen.getByText('Agent'))!.toBeInTheDocument()})const agentOption = screen.getByText('Agent')@@ -1018,7 +1059,7 @@ describe('TagsFilter', () => {fireEvent.click(trigger)await waitFor(() => {- expect(screen.getByText('RAG')).toBeInTheDocument()+ expect(screen.getByText('RAG'))!.toBeInTheDocument()})const ragOption = screen.getByText('RAG')@@ -1061,7 +1102,7 @@ describe('TagsFilter', () => {fireEvent.click(trigger)await waitFor(() => {- expect(screen.getByText('Agent')).toBeInTheDocument()+ expect(screen.getByText('Agent'))!.toBeInTheDocument()})const inputs = screen.getAllByRole('textbox')@@ -1071,7 +1112,7 @@ describe('TagsFilter', () => {if (searchInput) {fireEvent.change(searchInput, { target: { value: 'agent' } })- expect(screen.getByText('Agent')).toBeInTheDocument()+ expect(screen.getByText('Agent'))!.toBeInTheDocument()}})})@@ -1097,7 +1138,8 @@ describe('TagsFilter', () => {})// Verify dropdown content is rendered- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ // Verify dropdown content is rendered+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()})it('should render tag options when dropdown is open', async () => {@@ -1114,13 +1156,14 @@ describe('TagsFilter', () => {fireEvent.click(trigger)await waitFor(() => {- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()})// When no tags selected, these should appear once each in dropdown- expect(screen.getByText('Agent')).toBeInTheDocument()- expect(screen.getByText('RAG')).toBeInTheDocument()- expect(screen.getByText('Search')).toBeInTheDocument()+ // When no tags selected, these should appear once each in dropdown+ expect(screen.getByText('Agent'))!.toBeInTheDocument()+ expect(screen.getByText('RAG'))!.toBeInTheDocument()+ expect(screen.getByText('Search'))!.toBeInTheDocument()})})})@@ -1146,8 +1189,8 @@ describe('Accessibility', () => {)const input = screen.getByRole('textbox')- expect(input).toBeInTheDocument()- expect(input).toHaveAttribute('placeholder', 'Search plugins')+ expect(input)!.toBeInTheDocument()+ expect(input)!.toHaveAttribute('placeholder', 'Search plugins')})it('should have clickable tag options in dropdown', async () => {@@ -1156,7 +1199,7 @@ describe('Accessibility', () => {fireEvent.click(screen.getByTestId('portal-trigger'))await waitFor(() => {- expect(screen.getByText('Agent')).toBeInTheDocument()+ expect(screen.getByText('Agent'))!.toBeInTheDocument()})})})@@ -1192,7 +1235,7 @@ describe('Combined Workflows', () => {fireEvent.click(trigger)await waitFor(() => {- expect(screen.getByText('Agent')).toBeInTheDocument()+ expect(screen.getByText('Agent'))!.toBeInTheDocument()})const agentOption = screen.getByText('Agent')@@ -1217,9 +1260,9 @@ describe('Combined Workflows', () => {/>,)- expect(screen.getByDisplayValue('test')).toBeInTheDocument()- expect(screen.getByText('Agent,RAG')).toBeInTheDocument()- expect(screen.getByTestId('portal-elem')).toBeInTheDocument()+ expect(screen.getByDisplayValue('test'))!.toBeInTheDocument()+ expect(screen.getByText('Agent,RAG'))!.toBeInTheDocument()+ expect(screen.getByTestId('portal-elem'))!.toBeInTheDocument()})it('should handle prop changes correctly', () => {@@ -1234,7 +1277,7 @@ describe('Combined Workflows', () => {/>,)- expect(screen.getByDisplayValue('initial')).toBeInTheDocument()+ expect(screen.getByDisplayValue('initial'))!.toBeInTheDocument()rerender(<SearchBox@@ -1245,6 +1288,6 @@ describe('Combined Workflows', () => {/>,)- expect(screen.getByDisplayValue('updated')).toBeInTheDocument()+ expect(screen.getByDisplayValue('updated'))!.toBeInTheDocument()})})diff --git a/web/app/components/plugins/marketplace/search-box/trigger/marketplace.tsx b/web/app/components/plugins/marketplace/search-box/trigger/marketplace.tsxindex 414216c5324..167d6fcd707 100644--- a/web/app/components/plugins/marketplace/search-box/trigger/marketplace.tsx+++ b/web/app/components/plugins/marketplace/search-box/trigger/marketplace.tsx@@ -39,7 +39,7 @@ const MarketplaceTrigger = ({{!!selectedTagsLength && (<span className="text-text-secondary">- {tags.map(tag => tagsMap[tag].label).slice(0, 2).join(',')}+ {tags.map(tag => tagsMap[tag]!.label).slice(0, 2).join(',')}</span>)}diff --git a/web/app/components/plugins/marketplace/search-box/trigger/tool-selector.tsx b/web/app/components/plugins/marketplace/search-box/trigger/tool-selector.tsxindex 6c733ea5468..d351414ee80 100644--- a/web/app/components/plugins/marketplace/search-box/trigger/tool-selector.tsx+++ b/web/app/components/plugins/marketplace/search-box/trigger/tool-selector.tsx@@ -33,7 +33,7 @@ const ToolSelectorTrigger = ({!!selectedTagsLength && (<div className="flex items-center gap-x-0.5 px-0.5 py-1 system-sm-medium"><span className="text-text-secondary">- {tags.map(tag => tagsMap[tag].label).slice(0, 2).join(',')}+ {tags.map(tag => tagsMap[tag]!.label).slice(0, 2).join(',')}</span>{selectedTagsLength > 2 && (diff --git a/web/app/components/plugins/marketplace/sort-dropdown/index.tsx b/web/app/components/plugins/marketplace/sort-dropdown/index.tsxindex dddfab5402c..d8b6939d1a7 100644--- a/web/app/components/plugins/marketplace/sort-dropdown/index.tsx+++ b/web/app/components/plugins/marketplace/sort-dropdown/index.tsx@@ -56,7 +56,7 @@ const SortDropdown = () => {{t('marketplace.sortBy', { ns: 'plugin' })}</span><span className="system-sm-medium mr-1 text-text-primary">- {selectedOption.text}+ {selectedOption!.text}</span><RiArrowDownSLine className="h-4 w-4 text-text-tertiary" /></div>diff --git a/web/app/components/plugins/plugin-auth/__tests__/authorized-in-node.spec.tsx b/web/app/components/plugins/plugin-auth/__tests__/authorized-in-node.spec.tsxindex f4eb9462fc4..cba8dc96c93 100644--- a/web/app/components/plugins/plugin-auth/__tests__/authorized-in-node.spec.tsx+++ b/web/app/components/plugins/plugin-auth/__tests__/authorized-in-node.spec.tsx@@ -111,7 +111,7 @@ describe('AuthorizedInNode Component', () => {<AuthorizedInNode pluginPayload={pluginPayload} onAuthorizationItemClick={vi.fn()} />,{ wrapper: createWrapper() },)- expect(screen.getByText('plugin.auth.workspaceDefault')).toBeInTheDocument()+ expect(screen.getByText('plugin.auth.workspaceDefault'))!.toBeInTheDocument()})it('should render credential name when credentialId matches', async () => {@@ -127,7 +127,7 @@ describe('AuthorizedInNode Component', () => {<AuthorizedInNode pluginPayload={pluginPayload} onAuthorizationItemClick={vi.fn()} credentialId="selected-id" />,{ wrapper: createWrapper() },)- expect(screen.getByText('My Credential')).toBeInTheDocument()+ expect(screen.getByText('My Credential'))!.toBeInTheDocument()})it('should show auth removed when credentialId not found', async () => {@@ -142,7 +142,7 @@ describe('AuthorizedInNode Component', () => {<AuthorizedInNode pluginPayload={pluginPayload} onAuthorizationItemClick={vi.fn()} credentialId="non-existent" />,{ wrapper: createWrapper() },)- expect(screen.getByText('plugin.auth.authRemoved')).toBeInTheDocument()+ expect(screen.getByText('plugin.auth.authRemoved'))!.toBeInTheDocument()})it('should show unavailable when credential is not allowed', async () => {@@ -195,7 +195,7 @@ describe('AuthorizedInNode Component', () => {{ wrapper: createWrapper() },)const buttons = screen.getAllByRole('button')- fireEvent.click(buttons[0])+ fireEvent.click(buttons[0]!)expect(screen.getAllByRole('button').length).toBeGreaterThan(0)})diff --git a/web/app/components/plugins/plugin-auth/__tests__/plugin-auth-in-agent.spec.tsx b/web/app/components/plugins/plugin-auth/__tests__/plugin-auth-in-agent.spec.tsxindex 4c26712fdc3..6afe1ae334f 100644--- a/web/app/components/plugins/plugin-auth/__tests__/plugin-auth-in-agent.spec.tsx+++ b/web/app/components/plugins/plugin-auth/__tests__/plugin-auth-in-agent.spec.tsx@@ -116,7 +116,7 @@ describe('PluginAuthInAgent Component', () => {<PluginAuthInAgent pluginPayload={pluginPayload} />,{ wrapper: createWrapper() },)- expect(screen.getByRole('button')).toBeInTheDocument()+ expect(screen.getByRole('button'))!.toBeInTheDocument()})it('should render Authorized with workspace default when authorized', async () => {@@ -126,8 +126,8 @@ describe('PluginAuthInAgent Component', () => {<PluginAuthInAgent pluginPayload={pluginPayload} />,{ wrapper: createWrapper() },)- expect(screen.getByRole('button')).toBeInTheDocument()- expect(screen.getByText('plugin.auth.workspaceDefault')).toBeInTheDocument()+ expect(screen.getByRole('button'))!.toBeInTheDocument()+ expect(screen.getByText('plugin.auth.workspaceDefault'))!.toBeInTheDocument()})it('should show credential name when credentialId is provided', async () => {@@ -143,7 +143,7 @@ describe('PluginAuthInAgent Component', () => {<PluginAuthInAgent pluginPayload={pluginPayload} credentialId="selected-id" />,{ wrapper: createWrapper() },)- expect(screen.getByText('Selected Credential')).toBeInTheDocument()+ expect(screen.getByText('Selected Credential'))!.toBeInTheDocument()})it('should show auth removed when credential not found', async () => {@@ -158,7 +158,7 @@ describe('PluginAuthInAgent Component', () => {<PluginAuthInAgent pluginPayload={pluginPayload} credentialId="non-existent-id" />,{ wrapper: createWrapper() },)- expect(screen.getByText('plugin.auth.authRemoved')).toBeInTheDocument()+ expect(screen.getByText('plugin.auth.authRemoved'))!.toBeInTheDocument()})it('should show unavailable when credential is not allowed to use', async () => {@@ -192,7 +192,7 @@ describe('PluginAuthInAgent Component', () => {{ wrapper: createWrapper() },)const buttons = screen.getAllByRole('button')- fireEvent.click(buttons[0])+ fireEvent.click(buttons[0]!)expect(screen.getAllByRole('button').length).toBeGreaterThan(0)})@@ -214,7 +214,7 @@ describe('PluginAuthInAgent Component', () => {fireEvent.click(triggerButton)const workspaceDefaultItems = screen.getAllByText('plugin.auth.workspaceDefault')const popupItem = workspaceDefaultItems.length > 1 ? workspaceDefaultItems[1] : workspaceDefaultItems[0]- fireEvent.click(popupItem)+ fireEvent.click(popupItem!)expect(onAuthorizationItemClick).toHaveBeenCalledWith('')})@@ -240,7 +240,7 @@ describe('PluginAuthInAgent Component', () => {fireEvent.click(triggerButton)const credentialItems = screen.getAllByText('Specific Credential')const popupItem = credentialItems[credentialItems.length - 1]- fireEvent.click(popupItem)+ fireEvent.click(popupItem!)expect(onAuthorizationItemClick).toHaveBeenCalledWith('specific-cred-id')})diff --git a/web/app/components/plugins/plugin-auth/authorized/__tests__/index.spec.tsx b/web/app/components/plugins/plugin-auth/authorized/__tests__/index.spec.tsxindex f911dcd4e08..a1270675269 100644--- a/web/app/components/plugins/plugin-auth/authorized/__tests__/index.spec.tsx+++ b/web/app/components/plugins/plugin-auth/authorized/__tests__/index.spec.tsx@@ -147,7 +147,7 @@ describe('Authorized Component', () => {{ wrapper: createWrapper() },)- expect(screen.getByRole('button')).toBeInTheDocument()+ expect(screen.getByRole('button'))!.toBeInTheDocument()})it('should render with custom trigger when renderTrigger is provided', () => {@@ -163,8 +163,8 @@ describe('Authorized Component', () => {{ wrapper: createWrapper() },)- expect(screen.getByTestId('custom-trigger')).toBeInTheDocument()- expect(screen.getByText('Closed')).toBeInTheDocument()+ expect(screen.getByTestId('custom-trigger'))!.toBeInTheDocument()+ expect(screen.getByText('Closed'))!.toBeInTheDocument()})it('should show singular authorization text for 1 credential', () => {@@ -180,7 +180,8 @@ describe('Authorized Component', () => {)// Text is split by elements, use regex to find partial match- expect(screen.getByText(/plugin\.auth\.authorization/)).toBeInTheDocument()+ // Text is split by elements, use regex to find partial match+ expect(screen.getByText(/plugin\.auth\.authorization/))!.toBeInTheDocument()})it('should show plural authorizations text for multiple credentials', () => {@@ -199,7 +200,8 @@ describe('Authorized Component', () => {)// Text is split by elements, use regex to find partial match- expect(screen.getByText(/plugin\.auth\.authorizations/)).toBeInTheDocument()+ // Text is split by elements, use regex to find partial match+ expect(screen.getByText(/plugin\.auth\.authorizations/))!.toBeInTheDocument()})it('should show unavailable count when there are unavailable credentials', () => {@@ -217,7 +219,7 @@ describe('Authorized Component', () => {{ wrapper: createWrapper() },)- expect(screen.getByText(/plugin\.auth\.unavailable/)).toBeInTheDocument()+ expect(screen.getByText(/plugin\.auth\.unavailable/))!.toBeInTheDocument()})it('should show gray indicator when default credential is unavailable', () => {@@ -235,7 +237,8 @@ describe('Authorized Component', () => {)// The indicator should be rendered- expect(container.querySelector('[data-testid="status-indicator"]')).toBeInTheDocument()+ // The indicator should be rendered+ expect(container.querySelector('[data-testid="status-indicator"]'))!.toBeInTheDocument()})})@@ -257,7 +260,8 @@ describe('Authorized Component', () => {fireEvent.click(trigger)// Popup should be open - check for popup content- expect(screen.getByText('API Keys')).toBeInTheDocument()+ // Popup should be open - check for popup content+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()})it('should use controlled open state when isOpen and onOpenChange are provided', () => {@@ -276,11 +280,12 @@ describe('Authorized Component', () => {)// Popup should be open since isOpen is true- expect(screen.getByText('API Keys')).toBeInTheDocument()+ // Popup should be open since isOpen is true+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()// Click trigger to close - get all buttons and click the first one (trigger)const buttons = screen.getAllByRole('button')- fireEvent.click(buttons[0])+ fireEvent.click(buttons[0]!)expect(onOpenChange).toHaveBeenCalledWith(false)})@@ -301,7 +306,7 @@ describe('Authorized Component', () => {// OpenfireEvent.click(trigger)- expect(screen.getByText('API Keys')).toBeInTheDocument()+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()// ClosefireEvent.click(trigger)@@ -326,8 +331,8 @@ describe('Authorized Component', () => {{ wrapper: createWrapper() },)- expect(screen.getByText('OAuth')).toBeInTheDocument()- expect(screen.getByText('OAuth Cred')).toBeInTheDocument()+ expect(screen.getByText('OAuth'))!.toBeInTheDocument()+ expect(screen.getByText('OAuth Cred'))!.toBeInTheDocument()})it('should render API Key credentials section when apiKeyCredentials exist', () => {@@ -345,8 +350,8 @@ describe('Authorized Component', () => {{ wrapper: createWrapper() },)- expect(screen.getByText('API Keys')).toBeInTheDocument()- expect(screen.getByText('API Key Cred')).toBeInTheDocument()+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()+ expect(screen.getByText('API Key Cred'))!.toBeInTheDocument()})it('should render both OAuth and API Key sections when both exist', () => {@@ -365,8 +370,8 @@ describe('Authorized Component', () => {{ wrapper: createWrapper() },)- expect(screen.getByText('OAuth')).toBeInTheDocument()- expect(screen.getByText('API Keys')).toBeInTheDocument()+ expect(screen.getByText('OAuth'))!.toBeInTheDocument()+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()})it('should render extra authorization items when provided', () => {@@ -386,7 +391,7 @@ describe('Authorized Component', () => {{ wrapper: createWrapper() },)- expect(screen.getByText('Extra Item')).toBeInTheDocument()+ expect(screen.getByText('Extra Item'))!.toBeInTheDocument()})it('should pass showSelectedIcon and selectedCredentialId to items', () => {@@ -405,7 +410,8 @@ describe('Authorized Component', () => {)// Selected icon should be visible- expect(document.querySelector('.text-text-accent')).toBeInTheDocument()+ // Selected icon should be visible+ expect(document.querySelector('.text-text-accent'))!.toBeInTheDocument()})})@@ -431,7 +437,7 @@ describe('Authorized Component', () => {// Confirm dialog should appearawait waitFor(() => {- expect(screen.getByText('datasetDocuments.list.delete.title')).toBeInTheDocument()+ expect(screen.getByText('datasetDocuments.list.delete.title'))!.toBeInTheDocument()})}})@@ -451,7 +457,7 @@ describe('Authorized Component', () => {// Wait for OAuth section to renderawait waitFor(() => {- expect(screen.getByText('OAuth')).toBeInTheDocument()+ expect(screen.getByText('OAuth'))!.toBeInTheDocument()})// Find all SVG icons in the action area and try to find delete button@@ -482,7 +488,8 @@ describe('Authorized Component', () => {}// Component should render correctly regardless of button finding- expect(screen.getByText('OAuth')).toBeInTheDocument()+ // Component should render correctly regardless of button finding+ expect(screen.getByText('OAuth'))!.toBeInTheDocument()})it('should call deletePluginCredential when confirm is clicked', async () => {@@ -506,7 +513,7 @@ describe('Authorized Component', () => {fireEvent.click(deleteButton)await waitFor(() => {- expect(screen.getByText('datasetDocuments.list.delete.title')).toBeInTheDocument()+ expect(screen.getByText('datasetDocuments.list.delete.title'))!.toBeInTheDocument()})// Click confirm button@@ -693,7 +700,8 @@ describe('Authorized Component', () => {}else {// Verify component renders properly- expect(screen.getByText('OAuth')).toBeInTheDocument()+ // Verify component renders properly+ expect(screen.getByText('OAuth'))!.toBeInTheDocument()}})@@ -716,7 +724,8 @@ describe('Authorized Component', () => {)// Verify component renders- expect(screen.getByText('OAuth')).toBeInTheDocument()+ // Verify component renders+ expect(screen.getByText('OAuth'))!.toBeInTheDocument()})it('should execute handleRename function body when saving', async () => {@@ -745,8 +754,9 @@ describe('Authorized Component', () => {)// Wait for component to render- expect(screen.getByText('OAuth')).toBeInTheDocument()- expect(screen.getByText('Execute Rename Test')).toBeInTheDocument()+ // Wait for component to render+ expect(screen.getByText('OAuth'))!.toBeInTheDocument()+ expect(screen.getByText('Execute Rename Test'))!.toBeInTheDocument()// The handleRename is tested through the "should call updatePluginCredential when rename is confirmed" test// This test verifies the component properly renders OAuth credentials@@ -778,7 +788,8 @@ describe('Authorized Component', () => {)// Verify OAuth section renders- expect(screen.getByText('OAuth')).toBeInTheDocument()+ // Verify OAuth section renders+ expect(screen.getByText('OAuth'))!.toBeInTheDocument()// Find all action buttons in the credential item// The rename button should be present for OAuth credentials@@ -857,7 +868,8 @@ describe('Authorized Component', () => {// ApiKeyModal should appear - look for modal contentawait waitFor(() => {// The modal should be rendered- expect(document.querySelector('.fixed')).toBeInTheDocument()+ // The modal should be rendered+ expect(document.querySelector('.fixed'))!.toBeInTheDocument()})}})@@ -887,7 +899,7 @@ describe('Authorized Component', () => {fireEvent.click(editButton)await waitFor(() => {- expect(document.querySelector('.fixed')).toBeInTheDocument()+ expect(document.querySelector('.fixed'))!.toBeInTheDocument()})// Find and click close/cancel button in the modal@@ -907,7 +919,8 @@ describe('Authorized Component', () => {await waitFor(() => {// Verify component state is cleared by checking we can open again- expect(screen.getByText('API Keys')).toBeInTheDocument()+ // Verify component state is cleared by checking we can open again+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()})}}@@ -971,13 +984,14 @@ describe('Authorized Component', () => {// Verify state was reset - we should be able to see the credential list againawait waitFor(() => {- expect(screen.getByText('API Keys')).toBeInTheDocument()+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()})}}else {// Verify component renders- expect(screen.getByText('API Keys')).toBeInTheDocument()+ // Verify component renders+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()}})@@ -1002,12 +1016,13 @@ describe('Authorized Component', () => {)// Wait for component to render- expect(screen.getByText('API Keys')).toBeInTheDocument()+ // Wait for component to render+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()// Find edit button by looking for settings iconconst settingsIcons = document.querySelectorAll('svg.ri-equalizer-2-line')if (settingsIcons.length > 0) {- const editButton = settingsIcons[0].closest('button')+ const editButton = settingsIcons[0]!.closest('button')if (editButton) {// Click to open edit modalawait act(async () => {@@ -1033,7 +1048,7 @@ describe('Authorized Component', () => {// Verify the modal is closed and state is reset// The component should render normally after closeawait waitFor(() => {- expect(screen.getByText('API Keys')).toBeInTheDocument()+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()})break}@@ -1063,12 +1078,13 @@ describe('Authorized Component', () => {)// Wait for component to render- expect(screen.getByText('API Keys')).toBeInTheDocument()+ // Wait for component to render+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()// Find and click edit button to open ApiKeyModalconst settingsIcons = document.querySelectorAll('svg.ri-equalizer-2-line')if (settingsIcons.length > 0) {- const editButton = settingsIcons[0].closest('button')+ const editButton = settingsIcons[0]!.closest('button')if (editButton) {await act(async () => {fireEvent.click(editButton)@@ -1093,7 +1109,7 @@ describe('Authorized Component', () => {await waitFor(() => {const confirmDialog = screen.queryByText('datasetDocuments.list.delete.title')if (confirmDialog) {- expect(confirmDialog).toBeInTheDocument()+ expect(confirmDialog)!.toBeInTheDocument()}}, { timeout: 1000 })}@@ -1122,7 +1138,8 @@ describe('Authorized Component', () => {)// Verify API Keys section is shown- expect(screen.getByText('API Keys')).toBeInTheDocument()+ // Verify API Keys section is shown+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()// Find edit button - look for buttons in the action areaconst actionAreaButtons = Array.from(document.querySelectorAll('.group-hover\\:flex button, .hidden button'))@@ -1149,7 +1166,8 @@ describe('Authorized Component', () => {}// Verify component renders correctly- expect(screen.getByText('API Keys')).toBeInTheDocument()+ // Verify component renders correctly+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()})it('should trigger handleRemove when remove button is clicked in ApiKeyModal', async () => {@@ -1173,7 +1191,8 @@ describe('Authorized Component', () => {)// Verify component renders- expect(screen.getByText('API Keys')).toBeInTheDocument()+ // Verify component renders+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()// Find edit button by looking for action buttons (not in the confirm dialog)// These are grouped in hidden elements that show on hover@@ -1203,7 +1222,8 @@ describe('Authorized Component', () => {}// Verify component still works- expect(screen.getByText('API Keys')).toBeInTheDocument()+ // Verify component still works+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()})it('should show confirm dialog when remove is clicked from edit modal', async () => {@@ -1230,7 +1250,7 @@ describe('Authorized Component', () => {fireEvent.click(editButton)await waitFor(() => {- expect(document.querySelector('.fixed')).toBeInTheDocument()+ expect(document.querySelector('.fixed'))!.toBeInTheDocument()})// Find remove button in modal (usually has delete/remove text)@@ -1242,7 +1262,7 @@ describe('Authorized Component', () => {// Confirm dialog should appearawait waitFor(() => {- expect(screen.getByText('datasetDocuments.list.delete.title')).toBeInTheDocument()+ expect(screen.getByText('datasetDocuments.list.delete.title'))!.toBeInTheDocument()})}}@@ -1284,7 +1304,7 @@ describe('Authorized Component', () => {// Wait for modal to openawait waitFor(() => {const modal = document.querySelector('.fixed')- expect(modal).toBeInTheDocument()+ expect(modal)!.toBeInTheDocument()})// Find the close/cancel button@@ -1304,13 +1324,14 @@ describe('Authorized Component', () => {// Verify component still works after closingawait waitFor(() => {- expect(screen.getByText('API Keys')).toBeInTheDocument()+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()})}}else {// If no edit button found, just verify the component renders- expect(screen.getByText('API Keys')).toBeInTheDocument()+ // If no edit button found, just verify the component renders+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()}})})@@ -1359,7 +1380,8 @@ describe('Authorized Component', () => {)// Should have divider and authorize buttons- expect(document.querySelector('.bg-divider-subtle')).toBeInTheDocument()+ // Should have divider and authorize buttons+ expect(document.querySelector('.bg-divider-subtle'))!.toBeInTheDocument()})it('should not render Authorize component when notAllowCustomCredential is true', () => {@@ -1400,7 +1422,7 @@ describe('Authorized Component', () => {{ wrapper: createWrapper() },)- expect(document.querySelector('.custom-popup-class')).toBeInTheDocument()+ expect(document.querySelector('.custom-popup-class'))!.toBeInTheDocument()})it('should pass placement to PortalToFollowElem', () => {@@ -1419,7 +1441,8 @@ describe('Authorized Component', () => {)// Component should render without error- expect(screen.getByText('API Keys')).toBeInTheDocument()+ // Component should render without error+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()})it('should pass disabled to Item components', () => {@@ -1441,11 +1464,12 @@ describe('Authorized Component', () => {const setDefaultButton = screen.queryByText('plugin.auth.setDefault')if (setDefaultButton) {const button = setDefaultButton.closest('button')- expect(button).toBeDisabled()+ expect(button)!.toBeDisabled()}else {// If no set default button, verify the component rendered- expect(screen.getByText('API Keys')).toBeInTheDocument()+ // If no set default button, verify the component rendered+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()}})@@ -1463,6 +1487,37 @@ describe('Authorized Component', () => {{ wrapper: createWrapper() },)+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible+ // Set default button should not be visible// Set default button should not be visibleexpect(screen.queryByText('plugin.auth.setDefault')).not.toBeInTheDocument()})@@ -1492,7 +1547,7 @@ describe('Authorized Component', () => {fireEvent.click(deleteButton)await waitFor(() => {- expect(screen.getByText('datasetDocuments.list.delete.title')).toBeInTheDocument()+ expect(screen.getByText('datasetDocuments.list.delete.title'))!.toBeInTheDocument()})const confirmButton = screen.getByText('common.operation.confirm')@@ -1623,7 +1678,8 @@ describe('Authorized Component', () => {)// Component should render without error- expect(screen.getByText('API Keys')).toBeInTheDocument()+ // Component should render without error+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()})})@@ -1663,7 +1719,7 @@ describe('Authorized Component', () => {// Wait for component to renderawait waitFor(() => {- expect(screen.getByText('OAuth')).toBeInTheDocument()+ expect(screen.getByText('OAuth'))!.toBeInTheDocument()})// Find all buttons in the credential item's action area@@ -1698,7 +1754,7 @@ describe('Authorized Component', () => {// Verify confirm dialog appearsawait waitFor(() => {- expect(screen.getByText('datasetDocuments.list.delete.title')).toBeInTheDocument()+ expect(screen.getByText('datasetDocuments.list.delete.title'))!.toBeInTheDocument()})// Click confirm - this calls handleConfirm@@ -1730,7 +1786,8 @@ describe('Authorized Component', () => {}else {// Component should still render correctly- expect(screen.getByText('OAuth')).toBeInTheDocument()+ // Component should still render correctly+ expect(screen.getByText('OAuth'))!.toBeInTheDocument()}})@@ -1753,7 +1810,8 @@ describe('Authorized Component', () => {)// Verify component renders- expect(screen.getByText('API Keys')).toBeInTheDocument()+ // Verify component renders+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()})it('should prevent handleConfirm when doingAction is true', async () => {@@ -1812,7 +1870,8 @@ describe('Authorized Component', () => {if (!foundDeleteButton) {// Verify component renders- expect(screen.getByText('OAuth')).toBeInTheDocument()+ // Verify component renders+ expect(screen.getByText('OAuth'))!.toBeInTheDocument()}})@@ -1831,6 +1890,99 @@ describe('Authorized Component', () => {{ wrapper: createWrapper() },)+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic+ // With no credentials, there's no way to trigger openConfirm,+ // so pendingOperationCredentialId stays null+ // This edge case is handled by the component's internal logic// With no credentials, there's no way to trigger openConfirm,// so pendingOperationCredentialId stays null// This edge case is handled by the component's internal logic@@ -1859,7 +2011,7 @@ describe('Authorized Component', () => {// Wait for component to renderawait waitFor(() => {- expect(screen.getByText('OAuth')).toBeInTheDocument()+ expect(screen.getByText('OAuth'))!.toBeInTheDocument()})// Find delete button in action area@@ -1908,7 +2060,7 @@ describe('Authorized Component', () => {)await waitFor(() => {- expect(screen.getByText('OAuth')).toBeInTheDocument()+ expect(screen.getByText('OAuth'))!.toBeInTheDocument()})// Find and trigger delete to open confirm dialog@@ -1921,7 +2073,7 @@ describe('Authorized Component', () => {const confirmTitle = screen.queryByText('datasetDocuments.list.delete.title')if (confirmTitle) {- expect(confirmTitle).toBeInTheDocument()+ expect(confirmTitle)!.toBeInTheDocument()// Now click cancel to execute closeConfirmconst cancelBtn = screen.getByText('common.operation.cancel')@@ -1940,7 +2092,7 @@ describe('Authorized Component', () => {})await waitFor(() => {- expect(screen.getByText('datasetDocuments.list.delete.title')).toBeInTheDocument()+ expect(screen.getByText('datasetDocuments.list.delete.title'))!.toBeInTheDocument()})break}@@ -1966,7 +2118,7 @@ describe('Authorized Component', () => {)await waitFor(() => {- expect(screen.getByText('OAuth')).toBeInTheDocument()+ expect(screen.getByText('OAuth'))!.toBeInTheDocument()})// Find and trigger delete to open confirm dialog@@ -2012,7 +2164,7 @@ describe('Authorized Component', () => {)await waitFor(() => {- expect(screen.getByText('OAuth')).toBeInTheDocument()+ expect(screen.getByText('OAuth'))!.toBeInTheDocument()})// Find and trigger delete to open confirm dialog@@ -2066,7 +2218,7 @@ describe('Authorized Component', () => {// Wait for component to renderawait waitFor(() => {- expect(screen.getByText('API Keys')).toBeInTheDocument()+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()})// Find edit button in action area@@ -2093,7 +2245,7 @@ describe('Authorized Component', () => {await waitFor(() => {const confirmTitle = screen.queryByText('datasetDocuments.list.delete.title')if (confirmTitle) {- expect(confirmTitle).toBeInTheDocument()+ expect(confirmTitle)!.toBeInTheDocument()}}, { timeout: 2000 })}@@ -2103,7 +2255,8 @@ describe('Authorized Component', () => {}// Verify component renders correctly- expect(screen.getByText('API Keys')).toBeInTheDocument()+ // Verify component renders correctly+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()})it('should execute handleRemove to set deleteCredentialId from pendingOperationCredentialId', async () => {@@ -2127,7 +2280,7 @@ describe('Authorized Component', () => {// Wait for component to renderawait waitFor(() => {- expect(screen.getByText('API Keys')).toBeInTheDocument()+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()})// Find and click edit button to open ApiKeyModal@@ -2155,7 +2308,7 @@ describe('Authorized Component', () => {const confirmTitle = screen.queryByText('datasetDocuments.list.delete.title')// If confirm dialog appears, handleRemove was calledif (confirmTitle) {- expect(confirmTitle).toBeInTheDocument()+ expect(confirmTitle)!.toBeInTheDocument()}}, { timeout: 1000 })}@@ -2165,7 +2318,8 @@ describe('Authorized Component', () => {}// Verify component still renders correctly- expect(screen.getByText('API Keys')).toBeInTheDocument()+ // Verify component still renders correctly+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()})})@@ -2195,7 +2349,7 @@ describe('Authorized Component', () => {// Wait for component to renderawait waitFor(() => {- expect(screen.getByText('OAuth')).toBeInTheDocument()+ expect(screen.getByText('OAuth'))!.toBeInTheDocument()})// Find rename button in action area@@ -2259,7 +2413,7 @@ describe('Authorized Component', () => {)await waitFor(() => {- expect(screen.getByText('OAuth')).toBeInTheDocument()+ expect(screen.getByText('OAuth'))!.toBeInTheDocument()})// Find rename button@@ -2324,7 +2478,7 @@ describe('Authorized Component', () => {// Wait for component to renderawait waitFor(() => {- expect(screen.getByText('API Keys')).toBeInTheDocument()+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()})// Find and click edit button to open modal@@ -2346,12 +2500,12 @@ describe('Authorized Component', () => {if (cancelBtns.length > 0) {// Click the first cancel button (modal's cancel)await act(async () => {- fireEvent.click(cancelBtns[0])+ fireEvent.click(cancelBtns[0]!)})// Modal should be closedawait waitFor(() => {- expect(screen.getByText('API Keys')).toBeInTheDocument()+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()})}break@@ -2380,7 +2534,7 @@ describe('Authorized Component', () => {)await waitFor(() => {- expect(screen.getByText('API Keys')).toBeInTheDocument()+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()})// Open edit modal by clicking edit button@@ -2398,12 +2552,12 @@ describe('Authorized Component', () => {const cancelButtons = screen.queryAllByText('common.operation.cancel')if (cancelButtons.length > 0) {await act(async () => {- fireEvent.click(cancelButtons[0])+ fireEvent.click(cancelButtons[0]!)})// After onClose, editValues should be null so modal won't renderawait waitFor(() => {- expect(screen.getByText('API Keys')).toBeInTheDocument()+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()})// Try opening modal again to verify state was properly reset@@ -2413,7 +2567,7 @@ describe('Authorized Component', () => {await waitFor(() => {const newModal = document.querySelector('.fixed')- expect(newModal).toBeInTheDocument()+ expect(newModal)!.toBeInTheDocument()})}break@@ -2451,7 +2605,7 @@ describe('Authorized Component', () => {// Wait for modalawait waitFor(() => {- expect(document.querySelector('.fixed')).toBeInTheDocument()+ expect(document.querySelector('.fixed'))!.toBeInTheDocument()})// Close the modal via cancel@@ -2468,7 +2622,7 @@ describe('Authorized Component', () => {// Verify component can render again normallyawait waitFor(() => {- expect(screen.getByText('API Keys')).toBeInTheDocument()+ expect(screen.getByText('API Keys'))!.toBeInTheDocument()})// Verify we can open the modal again (state was properly reset)@@ -2481,7 +2635,7 @@ describe('Authorized Component', () => {})await waitFor(() => {- expect(document.querySelector('.fixed')).toBeInTheDocument()+ expect(document.querySelector('.fixed'))!.toBeInTheDocument()})}}@@ -2518,7 +2672,7 @@ describe('Authorized Component', () => {// Confirm dialog should appear with the correct credential idawait waitFor(() => {- expect(screen.getByText('datasetDocuments.list.delete.title')).toBeInTheDocument()+ expect(screen.getByText('datasetDocuments.list.delete.title'))!.toBeInTheDocument()})// Now click confirm to verify the correct id is useddiff --git a/web/app/components/plugins/plugin-auth/hooks/__tests__/use-credential.spec.ts b/web/app/components/plugins/plugin-auth/hooks/__tests__/use-credential.spec.tsindex 7777fbff97c..e0e241cbbed 100644--- a/web/app/components/plugins/plugin-auth/hooks/__tests__/use-credential.spec.ts+++ b/web/app/components/plugins/plugin-auth/hooks/__tests__/use-credential.spec.ts@@ -90,7 +90,7 @@ describe('use-credential hooks', () => {result.current()- const invalidFn = mockUseInvalidPluginCredentialInfo.mock.results[0].value+ const invalidFn = mockUseInvalidPluginCredentialInfo.mock.results[0]!.valueexpect(invalidFn).toHaveBeenCalled()expect(mockInvalidToolsByType).toHaveBeenCalled()})diff --git a/web/app/components/plugins/plugin-detail-panel/__tests__/agent-strategy-list.spec.tsx b/web/app/components/plugins/plugin-detail-panel/__tests__/agent-strategy-list.spec.tsxindex 34015c04874..02a2431ead7 100644--- a/web/app/components/plugins/plugin-detail-panel/__tests__/agent-strategy-list.spec.tsx+++ b/web/app/components/plugins/plugin-detail-panel/__tests__/agent-strategy-list.spec.tsx@@ -81,15 +81,15 @@ describe('AgentStrategyList', () => {it('should render strategy items when data is available', () => {render(<AgentStrategyList detail={createPluginDetail()} />)- expect(screen.getByText('plugin.detailPanel.strategyNum:{"num":1,"strategy":"strategy"}')).toBeInTheDocument()- expect(screen.getByTestId('strategy-item')).toBeInTheDocument()+ expect(screen.getByText('plugin.detailPanel.strategyNum:{"num":1,"strategy":"strategy"}'))!.toBeInTheDocument()+ expect(screen.getByTestId('strategy-item'))!.toBeInTheDocument()})it('should return null when no strategy provider detail', () => {mockStrategyProviderDetail = undefinedconst { container } = render(<AgentStrategyList detail={createPluginDetail()} />)- expect(container).toBeEmptyDOMElement()+ expect(container)!.toBeEmptyDOMElement()})it('should render multiple strategies', () => {@@ -98,13 +98,13 @@ describe('AgentStrategyList', () => {identity: { author: 'test', name: 'test' },strategies: [...mockStrategies,- { ...mockStrategies[0], identity: { ...mockStrategies[0].identity, name: 'strategy-2' } },+ { ...mockStrategies[0]!, identity: { ...mockStrategies[0]!.identity, name: 'strategy-2' } },],},}render(<AgentStrategyList detail={createPluginDetail()} />)- expect(screen.getByText('plugin.detailPanel.strategyNum:{"num":2,"strategy":"strategies"}')).toBeInTheDocument()+ expect(screen.getByText('plugin.detailPanel.strategyNum:{"num":2,"strategy":"strategies"}'))!.toBeInTheDocument()expect(screen.getAllByTestId('strategy-item')).toHaveLength(2)})})@@ -115,7 +115,7 @@ describe('AgentStrategyList', () => {detail.tenant_id = 'custom-tenant'render(<AgentStrategyList detail={detail} />)- expect(screen.getByTestId('strategy-item')).toBeInTheDocument()+ expect(screen.getByTestId('strategy-item'))!.toBeInTheDocument()})})})diff --git a/web/app/components/plugins/plugin-detail-panel/__tests__/detail-header.spec.tsx b/web/app/components/plugins/plugin-detail-panel/__tests__/detail-header.spec.tsxindex 74ce8525a98..0eacbf3bd33 100644--- a/web/app/components/plugins/plugin-detail-panel/__tests__/detail-header.spec.tsx+++ b/web/app/components/plugins/plugin-detail-panel/__tests__/detail-header.spec.tsx@@ -297,13 +297,13 @@ describe('DetailHeader', () => {it('should render plugin title', () => {render(<DetailHeader detail={createPluginDetail()} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByTestId('title')).toBeInTheDocument()+ expect(screen.getByTestId('title'))!.toBeInTheDocument()})it('should render plugin icon with correct src', () => {render(<DetailHeader detail={createPluginDetail()} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByTestId('card-icon')).toBeInTheDocument()+ expect(screen.getByTestId('card-icon'))!.toBeInTheDocument()})it('should render icon with http url directly', () => {@@ -315,13 +315,13 @@ describe('DetailHeader', () => {})render(<DetailHeader detail={detail} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByTestId('card-icon')).toHaveAttribute('data-src', 'https://example.com/icon.png')+ expect(screen.getByTestId('card-icon'))!.toHaveAttribute('data-src', 'https://example.com/icon.png')})it('should render description when not in readme view', () => {render(<DetailHeader detail={createPluginDetail()} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByTestId('description')).toBeInTheDocument()+ expect(screen.getByTestId('description'))!.toBeInTheDocument()})it('should not render description in readme view', () => {@@ -333,7 +333,7 @@ describe('DetailHeader', () => {it('should render verified badge when verified', () => {render(<DetailHeader detail={createPluginDetail()} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByTestId('verified-badge')).toBeInTheDocument()+ expect(screen.getByTestId('verified-badge'))!.toBeInTheDocument()})})@@ -346,7 +346,8 @@ describe('DetailHeader', () => {render(<DetailHeader detail={detail} onUpdate={mockOnUpdate} onHide={mockOnHide} />)// Badge component should render with the version- expect(screen.getByText('1.0.0')).toBeInTheDocument()+ // Badge component should render with the version+ expect(screen.getByText('1.0.0'))!.toBeInTheDocument()})it('should not show new version indicator when versions match', () => {@@ -357,7 +358,8 @@ describe('DetailHeader', () => {render(<DetailHeader detail={detail} onUpdate={mockOnUpdate} onHide={mockOnHide} />)// Badge component should render with the version- expect(screen.getByText('1.0.0')).toBeInTheDocument()+ // Badge component should render with the version+ expect(screen.getByText('1.0.0'))!.toBeInTheDocument()})it('should show update button when new version is available', () => {@@ -367,7 +369,7 @@ describe('DetailHeader', () => {})render(<DetailHeader detail={detail} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByText('plugin.detailPanel.operation.update')).toBeInTheDocument()+ expect(screen.getByText('plugin.detailPanel.operation.update'))!.toBeInTheDocument()})it('should show update button for GitHub source', () => {@@ -377,7 +379,7 @@ describe('DetailHeader', () => {})render(<DetailHeader detail={detail} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByText('plugin.detailPanel.operation.update')).toBeInTheDocument()+ expect(screen.getByText('plugin.detailPanel.operation.update'))!.toBeInTheDocument()})})@@ -393,7 +395,7 @@ describe('DetailHeader', () => {render(<DetailHeader detail={createPluginDetail()} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByTestId('title')).toBeInTheDocument()+ expect(screen.getByTestId('title'))!.toBeInTheDocument()})it('should render component when strategy is disabled', () => {@@ -407,7 +409,7 @@ describe('DetailHeader', () => {render(<DetailHeader detail={createPluginDetail()} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByTestId('title')).toBeInTheDocument()+ expect(screen.getByTestId('title'))!.toBeInTheDocument()})it('should enable auto upgrade for update_all mode', () => {@@ -422,7 +424,8 @@ describe('DetailHeader', () => {render(<DetailHeader detail={createPluginDetail()} onUpdate={mockOnUpdate} onHide={mockOnHide} />)// Auto upgrade badge should be rendered- expect(screen.getByTestId('title')).toBeInTheDocument()+ // Auto upgrade badge should be rendered+ expect(screen.getByTestId('title'))!.toBeInTheDocument()})it('should enable auto upgrade for partial mode when plugin is included', () => {@@ -436,7 +439,7 @@ describe('DetailHeader', () => {render(<DetailHeader detail={createPluginDetail()} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByTestId('title')).toBeInTheDocument()+ expect(screen.getByTestId('title'))!.toBeInTheDocument()})it('should not enable auto upgrade for partial mode when plugin is not included', () => {@@ -450,7 +453,7 @@ describe('DetailHeader', () => {render(<DetailHeader detail={createPluginDetail()} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByTestId('title')).toBeInTheDocument()+ expect(screen.getByTestId('title'))!.toBeInTheDocument()})it('should enable auto upgrade for exclude mode when plugin is not excluded', () => {@@ -464,7 +467,7 @@ describe('DetailHeader', () => {render(<DetailHeader detail={createPluginDetail()} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByTestId('title')).toBeInTheDocument()+ expect(screen.getByTestId('title'))!.toBeInTheDocument()})it('should not enable auto upgrade for exclude mode when plugin is excluded', () => {@@ -478,7 +481,7 @@ describe('DetailHeader', () => {render(<DetailHeader detail={createPluginDetail()} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByTestId('title')).toBeInTheDocument()+ expect(screen.getByTestId('title'))!.toBeInTheDocument()})it('should not enable auto upgrade for non-marketplace plugins', () => {@@ -496,7 +499,7 @@ describe('DetailHeader', () => {})render(<DetailHeader detail={detail} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByTestId('title')).toBeInTheDocument()+ expect(screen.getByTestId('title'))!.toBeInTheDocument()})it('should not enable auto upgrade when marketplace feature is disabled', () => {@@ -512,7 +515,8 @@ describe('DetailHeader', () => {render(<DetailHeader detail={createPluginDetail()} onUpdate={mockOnUpdate} onHide={mockOnHide} />)// Component should still render but auto upgrade should be disabled- expect(screen.getByTestId('title')).toBeInTheDocument()+ // Component should still render but auto upgrade should be disabled+ expect(screen.getByTestId('title'))!.toBeInTheDocument()})})@@ -522,7 +526,7 @@ describe('DetailHeader', () => {// Find the close button (ActionButton with action-btn class)const actionButtons = screen.getAllByRole('button').filter(btn => btn.classList.contains('action-btn'))- fireEvent.click(actionButtons[actionButtons.length - 1])+ fireEvent.click(actionButtons[actionButtons.length - 1]!)expect(mockOnHide).toHaveBeenCalled()})@@ -533,7 +537,7 @@ describe('DetailHeader', () => {const infoBtn = screen.getByTestId('info-btn')fireEvent.click(infoBtn)- expect(infoBtn).toBeInTheDocument()+ expect(infoBtn)!.toBeInTheDocument()})it('should have check version button available', () => {@@ -542,7 +546,7 @@ describe('DetailHeader', () => {const checkBtn = screen.getByTestId('check-version-btn')fireEvent.click(checkBtn)- expect(checkBtn).toBeInTheDocument()+ expect(checkBtn)!.toBeInTheDocument()})})@@ -557,7 +561,7 @@ describe('DetailHeader', () => {const updateBtn = screen.getByText('plugin.detailPanel.operation.update')fireEvent.click(updateBtn)- expect(updateBtn).toBeInTheDocument()+ expect(updateBtn)!.toBeInTheDocument()})it('should have version picker select button', () => {@@ -566,7 +570,7 @@ describe('DetailHeader', () => {const selectBtn = screen.getByTestId('select-version-btn')fireEvent.click(selectBtn)- expect(selectBtn).toBeInTheDocument()+ expect(selectBtn)!.toBeInTheDocument()})it('should have downgrade button', () => {@@ -575,7 +579,7 @@ describe('DetailHeader', () => {const downgradeBtn = screen.getByTestId('select-downgrade-btn')fireEvent.click(downgradeBtn)- expect(downgradeBtn).toBeInTheDocument()+ expect(downgradeBtn)!.toBeInTheDocument()})})@@ -651,7 +655,7 @@ describe('DetailHeader', () => {const removeBtn = screen.getByTestId('remove-btn')fireEvent.click(removeBtn)- expect(removeBtn).toBeInTheDocument()+ expect(removeBtn)!.toBeInTheDocument()})it('should have uninstallPlugin mock defined', () => {@@ -671,13 +675,13 @@ describe('DetailHeader', () => {})render(<DetailHeader detail={detail} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByTestId('remove-btn')).toBeInTheDocument()+ expect(screen.getByTestId('remove-btn'))!.toBeInTheDocument()})it('should render correctly for tool plugin delete', () => {render(<DetailHeader detail={createPluginDetail()} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByTestId('remove-btn')).toBeInTheDocument()+ expect(screen.getByTestId('remove-btn'))!.toBeInTheDocument()})})@@ -689,21 +693,21 @@ describe('DetailHeader', () => {})render(<DetailHeader detail={detail} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByTestId('title')).toBeInTheDocument()+ expect(screen.getByTestId('title'))!.toBeInTheDocument()})it('should render local source icon', () => {const detail = createPluginDetail({ source: PluginSource.local })render(<DetailHeader detail={detail} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByTestId('title')).toBeInTheDocument()+ expect(screen.getByTestId('title'))!.toBeInTheDocument()})it('should render debugging source icon', () => {const detail = createPluginDetail({ source: PluginSource.debugging })render(<DetailHeader detail={detail} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByTestId('title')).toBeInTheDocument()+ expect(screen.getByTestId('title'))!.toBeInTheDocument()})it('should not render deprecation notice for non-marketplace source', () => {@@ -722,20 +726,20 @@ describe('DetailHeader', () => {})render(<DetailHeader detail={detail} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByTestId('operation-dropdown')).toBeInTheDocument()+ expect(screen.getByTestId('operation-dropdown'))!.toBeInTheDocument()})it('should render marketplace source correctly', () => {render(<DetailHeader detail={createPluginDetail()} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByTestId('operation-dropdown')).toBeInTheDocument()+ expect(screen.getByTestId('operation-dropdown'))!.toBeInTheDocument()})it('should render local source correctly', () => {const detail = createPluginDetail({ source: PluginSource.local })render(<DetailHeader detail={detail} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByTestId('operation-dropdown')).toBeInTheDocument()+ expect(screen.getByTestId('operation-dropdown'))!.toBeInTheDocument()})})@@ -743,7 +747,7 @@ describe('DetailHeader', () => {it('should render plugin auth for tool category', () => {render(<DetailHeader detail={createPluginDetail()} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByTestId('plugin-auth')).toBeInTheDocument()+ expect(screen.getByTestId('plugin-auth'))!.toBeInTheDocument()})it('should not render plugin auth for non-tool category', () => {@@ -770,7 +774,7 @@ describe('DetailHeader', () => {const detail = createPluginDetail({ version: '' })render(<DetailHeader detail={detail} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByTestId('title')).toBeInTheDocument()+ expect(screen.getByTestId('title'))!.toBeInTheDocument()})it('should handle plugin with name containing slash', () => {@@ -782,7 +786,7 @@ describe('DetailHeader', () => {})render(<DetailHeader detail={detail} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByTestId('org-info')).toBeInTheDocument()+ expect(screen.getByTestId('org-info'))!.toBeInTheDocument()})it('should handle empty icon', () => {@@ -794,7 +798,7 @@ describe('DetailHeader', () => {})render(<DetailHeader detail={detail} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByTestId('card-icon')).toHaveAttribute('data-src', '')+ expect(screen.getByTestId('card-icon'))!.toHaveAttribute('data-src', '')})})@@ -805,7 +809,7 @@ describe('DetailHeader', () => {fireEvent.click(screen.getByTestId('remove-btn'))await waitFor(() => {- expect(screen.getByRole('alertdialog')).toBeInTheDocument()+ expect(screen.getByRole('alertdialog'))!.toBeInTheDocument()})})@@ -814,7 +818,7 @@ describe('DetailHeader', () => {fireEvent.click(screen.getByTestId('remove-btn'))await waitFor(() => {- expect(screen.getByRole('alertdialog')).toBeInTheDocument()+ expect(screen.getByRole('alertdialog'))!.toBeInTheDocument()})fireEvent.click(screen.getByRole('button', { name: 'common.operation.cancel' }))@@ -829,7 +833,7 @@ describe('DetailHeader', () => {fireEvent.click(screen.getByTestId('remove-btn'))await waitFor(() => {- expect(screen.getByRole('alertdialog')).toBeInTheDocument()+ expect(screen.getByRole('alertdialog'))!.toBeInTheDocument()})fireEvent.click(screen.getByRole('button', { name: 'common.operation.confirm' }))@@ -844,7 +848,7 @@ describe('DetailHeader', () => {fireEvent.click(screen.getByTestId('remove-btn'))await waitFor(() => {- expect(screen.getByRole('alertdialog')).toBeInTheDocument()+ expect(screen.getByRole('alertdialog'))!.toBeInTheDocument()})fireEvent.click(screen.getByRole('button', { name: 'common.operation.confirm' }))@@ -865,7 +869,7 @@ describe('DetailHeader', () => {fireEvent.click(screen.getByTestId('remove-btn'))await waitFor(() => {- expect(screen.getByRole('alertdialog')).toBeInTheDocument()+ expect(screen.getByRole('alertdialog'))!.toBeInTheDocument()})fireEvent.click(screen.getByRole('button', { name: 'common.operation.confirm' }))@@ -880,7 +884,7 @@ describe('DetailHeader', () => {fireEvent.click(screen.getByTestId('remove-btn'))await waitFor(() => {- expect(screen.getByRole('alertdialog')).toBeInTheDocument()+ expect(screen.getByRole('alertdialog'))!.toBeInTheDocument()})fireEvent.click(screen.getByRole('button', { name: 'common.operation.confirm' }))@@ -895,7 +899,7 @@ describe('DetailHeader', () => {fireEvent.click(screen.getByTestId('remove-btn'))await waitFor(() => {- expect(screen.getByRole('alertdialog')).toBeInTheDocument()+ expect(screen.getByRole('alertdialog'))!.toBeInTheDocument()})fireEvent.click(screen.getByRole('button', { name: 'common.operation.confirm' }))@@ -917,7 +921,7 @@ describe('DetailHeader', () => {fireEvent.click(screen.getByText('plugin.detailPanel.operation.update'))await waitFor(() => {- expect(screen.getByTestId('update-modal')).toBeInTheDocument()+ expect(screen.getByTestId('update-modal'))!.toBeInTheDocument()})})@@ -930,7 +934,7 @@ describe('DetailHeader', () => {fireEvent.click(screen.getByText('plugin.detailPanel.operation.update'))await waitFor(() => {- expect(screen.getByTestId('update-modal')).toBeInTheDocument()+ expect(screen.getByTestId('update-modal'))!.toBeInTheDocument()})fireEvent.click(screen.getByTestId('update-modal-save'))@@ -949,7 +953,7 @@ describe('DetailHeader', () => {fireEvent.click(screen.getByText('plugin.detailPanel.operation.update'))await waitFor(() => {- expect(screen.getByTestId('update-modal')).toBeInTheDocument()+ expect(screen.getByTestId('update-modal'))!.toBeInTheDocument()})fireEvent.click(screen.getByTestId('update-modal-cancel'))@@ -967,7 +971,7 @@ describe('DetailHeader', () => {fireEvent.click(screen.getByTestId('info-btn'))await waitFor(() => {- expect(screen.getByTestId('plugin-info')).toBeInTheDocument()+ expect(screen.getByTestId('plugin-info'))!.toBeInTheDocument()})})@@ -976,7 +980,7 @@ describe('DetailHeader', () => {fireEvent.click(screen.getByTestId('info-btn'))await waitFor(() => {- expect(screen.getByTestId('plugin-info')).toBeInTheDocument()+ expect(screen.getByTestId('plugin-info'))!.toBeInTheDocument()})fireEvent.click(screen.getByTestId('plugin-info-close'))@@ -993,7 +997,7 @@ describe('DetailHeader', () => {})render(<DetailHeader detail={detail} onUpdate={mockOnUpdate} onHide={mockOnHide} />)- expect(screen.getByTestId('info-btn')).toBeInTheDocument()+ expect(screen.getByTestId('info-btn'))!.toBeInTheDocument()})})})diff --git a/web/app/components/plugins/plugin-detail-panel/__tests__/endpoint-card.spec.tsx b/web/app/components/plugins/plugin-detail-panel/__tests__/endpoint-card.spec.tsxindex 3b87fdccb6f..15c231cb17a 100644--- a/web/app/components/plugins/plugin-detail-panel/__tests__/endpoint-card.spec.tsx+++ b/web/app/components/plugins/plugin-detail-panel/__tests__/endpoint-card.spec.tsx@@ -161,30 +161,30 @@ describe('EndpointCard', () => {it('should render endpoint name', () => {render(<EndpointCard pluginDetail={mockPluginDetail} data={mockEndpointData} handleChange={mockHandleChange} />)- expect(screen.getByText('Test Endpoint')).toBeInTheDocument()+ expect(screen.getByText('Test Endpoint'))!.toBeInTheDocument()})it('should render visible endpoints only', () => {render(<EndpointCard pluginDetail={mockPluginDetail} data={mockEndpointData} handleChange={mockHandleChange} />)- expect(screen.getByText('GET')).toBeInTheDocument()- expect(screen.getByText('https://api.example.com/api/test')).toBeInTheDocument()+ expect(screen.getByText('GET'))!.toBeInTheDocument()+ expect(screen.getByText('https://api.example.com/api/test'))!.toBeInTheDocument()expect(screen.queryByText('POST')).not.toBeInTheDocument()})it('should show active status when enabled', () => {render(<EndpointCard pluginDetail={mockPluginDetail} data={mockEndpointData} handleChange={mockHandleChange} />)- expect(screen.getByText('plugin.detailPanel.serviceOk')).toBeInTheDocument()- expect(screen.getByTestId('indicator')).toHaveAttribute('data-color', 'green')+ expect(screen.getByText('plugin.detailPanel.serviceOk'))!.toBeInTheDocument()+ expect(screen.getByTestId('indicator'))!.toHaveAttribute('data-color', 'green')})it('should show disabled status when not enabled', () => {const disabledData = { ...mockEndpointData, enabled: false }render(<EndpointCard pluginDetail={mockPluginDetail} data={disabledData} handleChange={mockHandleChange} />)- expect(screen.getByText('plugin.detailPanel.disabled')).toBeInTheDocument()- expect(screen.getByTestId('indicator')).toHaveAttribute('data-color', 'gray')+ expect(screen.getByText('plugin.detailPanel.disabled'))!.toBeInTheDocument()+ expect(screen.getByTestId('indicator'))!.toHaveAttribute('data-color', 'gray')})})@@ -194,7 +194,7 @@ describe('EndpointCard', () => {fireEvent.click(screen.getByRole('switch'))- expect(screen.getByText('plugin.detailPanel.endpointDisableTip')).toBeInTheDocument()+ expect(screen.getByText('plugin.detailPanel.endpointDisableTip'))!.toBeInTheDocument()})it('should call disableEndpoint when confirm disable', () => {@@ -211,16 +211,16 @@ describe('EndpointCard', () => {render(<EndpointCard pluginDetail={mockPluginDetail} data={mockEndpointData} handleChange={mockHandleChange} />)const allButtons = screen.getAllByRole('button')- fireEvent.click(allButtons[1])+ fireEvent.click(allButtons[1]!)- expect(screen.getByText('plugin.detailPanel.endpointDeleteTip')).toBeInTheDocument()+ expect(screen.getByText('plugin.detailPanel.endpointDeleteTip'))!.toBeInTheDocument()})it('should call deleteEndpoint when confirm delete', () => {render(<EndpointCard pluginDetail={mockPluginDetail} data={mockEndpointData} handleChange={mockHandleChange} />)const allButtons = screen.getAllByRole('button')- fireEvent.click(allButtons[1])+ fireEvent.click(allButtons[1]!)fireEvent.click(screen.getByRole('button', { name: 'common.operation.confirm' }))expect(mockDeleteEndpoint).toHaveBeenCalledWith('ep-1')@@ -230,16 +230,16 @@ describe('EndpointCard', () => {render(<EndpointCard pluginDetail={mockPluginDetail} data={mockEndpointData} handleChange={mockHandleChange} />)const allButtons = screen.getAllByRole('button')- fireEvent.click(allButtons[0])+ fireEvent.click(allButtons[0]!)- expect(screen.getByTestId('endpoint-modal')).toBeInTheDocument()+ expect(screen.getByTestId('endpoint-modal'))!.toBeInTheDocument()})it('should call updateEndpoint when save in modal', () => {render(<EndpointCard pluginDetail={mockPluginDetail} data={mockEndpointData} handleChange={mockHandleChange} />)const allButtons = screen.getAllByRole('button')- fireEvent.click(allButtons[0])+ fireEvent.click(allButtons[0]!)fireEvent.click(screen.getByTestId('modal-save'))expect(mockUpdateEndpoint).toHaveBeenCalled()@@ -252,13 +252,13 @@ describe('EndpointCard', () => {render(<EndpointCard pluginDetail={mockPluginDetail} data={mockEndpointData} handleChange={mockHandleChange} />)const allButtons = screen.getAllByRole('button')- fireEvent.click(allButtons[2])+ fireEvent.click(allButtons[2]!)act(() => {vi.advanceTimersByTime(2000)})- expect(screen.getByText('Test Endpoint')).toBeInTheDocument()+ expect(screen.getByText('Test Endpoint'))!.toBeInTheDocument()})})@@ -270,7 +270,7 @@ describe('EndpointCard', () => {}render(<EndpointCard pluginDetail={mockPluginDetail} data={dataWithNoEndpoints} handleChange={mockHandleChange} />)- expect(screen.getByText('Test Endpoint')).toBeInTheDocument()+ expect(screen.getByText('Test Endpoint'))!.toBeInTheDocument()})it('should call handleChange after enable', () => {@@ -286,20 +286,20 @@ describe('EndpointCard', () => {render(<EndpointCard pluginDetail={mockPluginDetail} data={mockEndpointData} handleChange={mockHandleChange} />)fireEvent.click(screen.getByRole('switch'))- expect(screen.getByText('plugin.detailPanel.endpointDisableTip')).toBeInTheDocument()+ expect(screen.getByText('plugin.detailPanel.endpointDisableTip'))!.toBeInTheDocument()fireEvent.click(screen.getByRole('button', { name: 'common.operation.cancel' }))await waitForAlertDialogToClose()- expect(screen.getByRole('switch')).toHaveAttribute('aria-checked', 'true')+ expect(screen.getByRole('switch'))!.toHaveAttribute('aria-checked', 'true')})it('should hide delete confirm when cancel clicked', async () => {render(<EndpointCard pluginDetail={mockPluginDetail} data={mockEndpointData} handleChange={mockHandleChange} />)const allButtons = screen.getAllByRole('button')- fireEvent.click(allButtons[1])- expect(screen.getByText('plugin.detailPanel.endpointDeleteTip')).toBeInTheDocument()+ fireEvent.click(allButtons[1]!)+ expect(screen.getByText('plugin.detailPanel.endpointDeleteTip'))!.toBeInTheDocument()fireEvent.click(screen.getByRole('button', { name: 'common.operation.cancel' }))await waitForAlertDialogToClose()@@ -309,8 +309,8 @@ describe('EndpointCard', () => {render(<EndpointCard pluginDetail={mockPluginDetail} data={mockEndpointData} handleChange={mockHandleChange} />)const allButtons = screen.getAllByRole('button')- fireEvent.click(allButtons[0])- expect(screen.getByTestId('endpoint-modal')).toBeInTheDocument()+ fireEvent.click(allButtons[0]!)+ expect(screen.getByTestId('endpoint-modal'))!.toBeInTheDocument()fireEvent.click(screen.getByTestId('modal-cancel'))@@ -344,7 +344,7 @@ describe('EndpointCard', () => {render(<EndpointCard pluginDetail={mockPluginDetail} data={mockEndpointData} handleChange={mockHandleChange} />)const allButtons = screen.getAllByRole('button')- fireEvent.click(allButtons[1])+ fireEvent.click(allButtons[1]!)fireEvent.click(screen.getByRole('button', { name: 'common.operation.confirm' }))expect(mockDeleteEndpoint).toHaveBeenCalled()@@ -354,9 +354,9 @@ describe('EndpointCard', () => {render(<EndpointCard pluginDetail={mockPluginDetail} data={mockEndpointData} handleChange={mockHandleChange} />)const allButtons = screen.getAllByRole('button')- fireEvent.click(allButtons[0])+ fireEvent.click(allButtons[0]!)- expect(screen.getByTestId('endpoint-modal')).toBeInTheDocument()+ expect(screen.getByTestId('endpoint-modal'))!.toBeInTheDocument()failureFlags.update = truefireEvent.click(screen.getByTestId('modal-save'))diff --git a/web/app/components/plugins/plugin-detail-panel/__tests__/endpoint-list.spec.tsx b/web/app/components/plugins/plugin-detail-panel/__tests__/endpoint-list.spec.tsxindex 50d63742ac0..e31afc7cb2d 100644--- a/web/app/components/plugins/plugin-detail-panel/__tests__/endpoint-list.spec.tsx+++ b/web/app/components/plugins/plugin-detail-panel/__tests__/endpoint-list.spec.tsx@@ -85,28 +85,28 @@ describe('EndpointList', () => {it('should render endpoint list', () => {render(<EndpointList detail={createPluginDetail()} />)- expect(screen.getByText('plugin.detailPanel.endpoints')).toBeInTheDocument()+ expect(screen.getByText('plugin.detailPanel.endpoints'))!.toBeInTheDocument()})it('should render endpoint cards', () => {render(<EndpointList detail={createPluginDetail()} />)- expect(screen.getByTestId('endpoint-card')).toBeInTheDocument()- expect(screen.getByText('Endpoint 1')).toBeInTheDocument()+ expect(screen.getByTestId('endpoint-card'))!.toBeInTheDocument()+ expect(screen.getByText('Endpoint 1'))!.toBeInTheDocument()})it('should return null when no data', () => {mockEndpointListData = undefinedconst { container } = render(<EndpointList detail={createPluginDetail()} />)- expect(container).toBeEmptyDOMElement()+ expect(container)!.toBeEmptyDOMElement()})it('should show empty message when no endpoints', () => {mockEndpointListData = { endpoints: [] }render(<EndpointList detail={createPluginDetail()} />)- expect(screen.getByText('plugin.detailPanel.endpointsEmpty')).toBeInTheDocument()+ expect(screen.getByText('plugin.detailPanel.endpointsEmpty'))!.toBeInTheDocument()})it('should render add button', () => {@@ -121,17 +121,17 @@ describe('EndpointList', () => {render(<EndpointList detail={createPluginDetail()} />)const addButton = screen.getAllByRole('button')[0]- fireEvent.click(addButton)+ fireEvent.click(addButton!)- expect(screen.getByTestId('endpoint-modal')).toBeInTheDocument()+ expect(screen.getByTestId('endpoint-modal'))!.toBeInTheDocument()})it('should hide modal when cancel clicked', () => {render(<EndpointList detail={createPluginDetail()} />)const addButton = screen.getAllByRole('button')[0]- fireEvent.click(addButton)- expect(screen.getByTestId('endpoint-modal')).toBeInTheDocument()+ fireEvent.click(addButton!)+ expect(screen.getByTestId('endpoint-modal'))!.toBeInTheDocument()fireEvent.click(screen.getByTestId('modal-cancel'))expect(screen.queryByTestId('endpoint-modal')).not.toBeInTheDocument()@@ -141,7 +141,7 @@ describe('EndpointList', () => {render(<EndpointList detail={createPluginDetail()} />)const addButton = screen.getAllByRole('button')[0]- fireEvent.click(addButton)+ fireEvent.click(addButton!)fireEvent.click(screen.getByTestId('modal-save'))expect(mockCreateEndpoint).toHaveBeenCalled()@@ -154,7 +154,7 @@ describe('EndpointList', () => {detail.declaration.tool = {} as PluginDetail['declaration']['tool']render(<EndpointList detail={detail} />)- expect(screen.getByText('plugin.detailPanel.endpoints')).toBeInTheDocument()+ expect(screen.getByText('plugin.detailPanel.endpoints'))!.toBeInTheDocument()})})@@ -177,7 +177,7 @@ describe('EndpointList', () => {render(<EndpointList detail={createPluginDetail()} />)const addButton = screen.getAllByRole('button')[0]- fireEvent.click(addButton)+ fireEvent.click(addButton!)fireEvent.click(screen.getByTestId('modal-save'))expect(mockInvalidateEndpointList).toHaveBeenCalledWith('test-plugin')@@ -187,7 +187,7 @@ describe('EndpointList', () => {render(<EndpointList detail={createPluginDetail()} />)const addButton = screen.getAllByRole('button')[0]- fireEvent.click(addButton)+ fireEvent.click(addButton!)fireEvent.click(screen.getByTestId('modal-save'))expect(mockCreateEndpoint).toHaveBeenCalledWith({diff --git a/web/app/components/plugins/plugin-detail-panel/__tests__/endpoint-modal.spec.tsx b/web/app/components/plugins/plugin-detail-panel/__tests__/endpoint-modal.spec.tsxindex a467de71421..0be17f07d41 100644--- a/web/app/components/plugins/plugin-detail-panel/__tests__/endpoint-modal.spec.tsx+++ b/web/app/components/plugins/plugin-detail-panel/__tests__/endpoint-modal.spec.tsx@@ -101,7 +101,7 @@ describe('EndpointModal', () => {/>,)- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})it('should render title and description', () => {@@ -114,8 +114,8 @@ describe('EndpointModal', () => {/>,)- expect(screen.getByText('plugin.detailPanel.endpointModalTitle')).toBeInTheDocument()- expect(screen.getByText('plugin.detailPanel.endpointModalDesc')).toBeInTheDocument()+ expect(screen.getByText('plugin.detailPanel.endpointModalTitle'))!.toBeInTheDocument()+ expect(screen.getByText('plugin.detailPanel.endpointModalDesc'))!.toBeInTheDocument()})it('should render form with fieldMoreInfo url link', () => {@@ -128,8 +128,8 @@ describe('EndpointModal', () => {/>,)- expect(screen.getByTestId('field-more-info')).toBeInTheDocument()- expect(screen.getByText('tools.howToGet')).toBeInTheDocument()+ expect(screen.getByTestId('field-more-info'))!.toBeInTheDocument()+ expect(screen.getByText('tools.howToGet'))!.toBeInTheDocument()})it('should render readme entrance', () => {@@ -142,7 +142,7 @@ describe('EndpointModal', () => {/>,)- expect(screen.getByTestId('readme-entrance')).toBeInTheDocument()+ expect(screen.getByTestId('readme-entrance'))!.toBeInTheDocument()})})@@ -173,7 +173,7 @@ describe('EndpointModal', () => {)const allButtons = screen.getAllByRole('button')- fireEvent.click(allButtons[0])+ fireEvent.click(allButtons[0]!)expect(mockOnCancel).toHaveBeenCalledTimes(1)})@@ -191,7 +191,7 @@ describe('EndpointModal', () => {const input = screen.getByTestId('form-input')fireEvent.change(input, { target: { value: 'Test Name' } })- expect(input).toHaveValue('Test Name')+ expect(input)!.toHaveValue('Test Name')})})@@ -207,7 +207,7 @@ describe('EndpointModal', () => {/>,)- expect(screen.getByTestId('form-input')).toHaveValue('Default Name')+ expect(screen.getByTestId('form-input'))!.toHaveValue('Default Name')})it('should extract default values from schemas when no defaultValues', () => {@@ -224,7 +224,7 @@ describe('EndpointModal', () => {/>,)- expect(screen.getByTestId('form-input')).toHaveValue('Schema Default')+ expect(screen.getByTestId('form-input'))!.toHaveValue('Schema Default')})it('should handle schemas without default values', () => {@@ -241,7 +241,7 @@ describe('EndpointModal', () => {/>,)- expect(screen.getByTestId('form')).toBeInTheDocument()+ expect(screen.getByTestId('form'))!.toBeInTheDocument()})})diff --git a/web/app/components/plugins/plugin-detail-panel/__tests__/strategy-detail.spec.tsx b/web/app/components/plugins/plugin-detail-panel/__tests__/strategy-detail.spec.tsxindex 350bf6956b2..b5fbc03b451 100644--- a/web/app/components/plugins/plugin-detail-panel/__tests__/strategy-detail.spec.tsx+++ b/web/app/components/plugins/plugin-detail-panel/__tests__/strategy-detail.spec.tsx@@ -69,40 +69,40 @@ describe('StrategyDetail', () => {it('should render drawer', () => {render(<StrategyDetail provider={mockProvider} detail={mockDetail} onHide={mockOnHide} />)- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})it('should render provider label', () => {render(<StrategyDetail provider={mockProvider} detail={mockDetail} onHide={mockOnHide} />)- expect(screen.getByText('Test Provider')).toBeInTheDocument()+ expect(screen.getByText('Test Provider'))!.toBeInTheDocument()})it('should render strategy label', () => {render(<StrategyDetail provider={mockProvider} detail={mockDetail} onHide={mockOnHide} />)- expect(screen.getByText('Strategy Label')).toBeInTheDocument()+ expect(screen.getByText('Strategy Label'))!.toBeInTheDocument()})it('should render parameters section', () => {render(<StrategyDetail provider={mockProvider} detail={mockDetail} onHide={mockOnHide} />)- expect(screen.getByText('tools.setBuiltInTools.parameters')).toBeInTheDocument()- expect(screen.getByText('Parameter 1')).toBeInTheDocument()+ expect(screen.getByText('tools.setBuiltInTools.parameters'))!.toBeInTheDocument()+ expect(screen.getByText('Parameter 1'))!.toBeInTheDocument()})it('should render output schema section', () => {render(<StrategyDetail provider={mockProvider} detail={mockDetail} onHide={mockOnHide} />)- expect(screen.getByText('OUTPUT')).toBeInTheDocument()- expect(screen.getByText('result')).toBeInTheDocument()- expect(screen.getByText('String')).toBeInTheDocument()+ expect(screen.getByText('OUTPUT'))!.toBeInTheDocument()+ expect(screen.getByText('result'))!.toBeInTheDocument()+ expect(screen.getByText('String'))!.toBeInTheDocument()})it('should render BACK button', () => {render(<StrategyDetail provider={mockProvider} detail={mockDetail} onHide={mockOnHide} />)- expect(screen.getByText('BACK')).toBeInTheDocument()+ expect(screen.getByText('BACK'))!.toBeInTheDocument()})})@@ -131,51 +131,51 @@ describe('StrategyDetail', () => {it('should display correct type for number-input', () => {const detailWithNumber = {...mockDetail,- parameters: [{ ...mockDetail.parameters[0], type: 'number-input' }],+ parameters: [{ ...mockDetail.parameters[0]!, type: 'number-input' }],}render(<StrategyDetail provider={mockProvider} detail={detailWithNumber} onHide={mockOnHide} />)- expect(screen.getByText('tools.setBuiltInTools.number')).toBeInTheDocument()+ expect(screen.getByText('tools.setBuiltInTools.number'))!.toBeInTheDocument()})it('should display correct type for checkbox', () => {const detailWithCheckbox = {...mockDetail,- parameters: [{ ...mockDetail.parameters[0], type: 'checkbox' }],+ parameters: [{ ...mockDetail.parameters[0]!, type: 'checkbox' }],}render(<StrategyDetail provider={mockProvider} detail={detailWithCheckbox} onHide={mockOnHide} />)- expect(screen.getByText('boolean')).toBeInTheDocument()+ expect(screen.getByText('boolean'))!.toBeInTheDocument()})it('should display correct type for file', () => {const detailWithFile = {...mockDetail,- parameters: [{ ...mockDetail.parameters[0], type: 'file' }],+ parameters: [{ ...mockDetail.parameters[0]!, type: 'file' }],}render(<StrategyDetail provider={mockProvider} detail={detailWithFile} onHide={mockOnHide} />)- expect(screen.getByText('tools.setBuiltInTools.file')).toBeInTheDocument()+ expect(screen.getByText('tools.setBuiltInTools.file'))!.toBeInTheDocument()})it('should display correct type for array[tools]', () => {const detailWithArrayTools = {...mockDetail,- parameters: [{ ...mockDetail.parameters[0], type: 'array[tools]' }],+ parameters: [{ ...mockDetail.parameters[0]!, type: 'array[tools]' }],}render(<StrategyDetail provider={mockProvider} detail={detailWithArrayTools} onHide={mockOnHide} />)- expect(screen.getByText('multiple-tool-select')).toBeInTheDocument()+ expect(screen.getByText('multiple-tool-select'))!.toBeInTheDocument()})it('should display original type for unknown types', () => {const detailWithUnknown = {...mockDetail,- parameters: [{ ...mockDetail.parameters[0], type: 'custom-type' }],+ parameters: [{ ...mockDetail.parameters[0]!, type: 'custom-type' }],}render(<StrategyDetail provider={mockProvider} detail={detailWithUnknown} onHide={mockOnHide} />)- expect(screen.getByText('custom-type')).toBeInTheDocument()+ expect(screen.getByText('custom-type'))!.toBeInTheDocument()})})@@ -184,7 +184,7 @@ describe('StrategyDetail', () => {const detailEmpty = { ...mockDetail, parameters: [] }render(<StrategyDetail provider={mockProvider} detail={detailEmpty} onHide={mockOnHide} />)- expect(screen.getByText('tools.setBuiltInTools.parameters')).toBeInTheDocument()+ expect(screen.getByText('tools.setBuiltInTools.parameters'))!.toBeInTheDocument()})it('should handle no output schema', () => {diff --git a/web/app/components/plugins/plugin-detail-panel/app-selector/__tests__/index.spec.tsx b/web/app/components/plugins/plugin-detail-panel/app-selector/__tests__/index.spec.tsxindex 4dd604a03e4..f7dd1921e45 100644--- a/web/app/components/plugins/plugin-detail-panel/app-selector/__tests__/index.spec.tsx+++ b/web/app/components/plugins/plugin-detail-panel/app-selector/__tests__/index.spec.tsx@@ -393,19 +393,20 @@ describe('AppTrigger', () => {it('should render placeholder when no app is selected', () => {render(<AppTrigger open={false} />)// i18n mock returns key with namespace in dot format- expect(screen.getByText('app.appSelector.placeholder')).toBeInTheDocument()+ // i18n mock returns key with namespace in dot format+ expect(screen.getByText('app.appSelector.placeholder'))!.toBeInTheDocument()})it('should render app details when app is selected', () => {const app = createMockApp({ name: 'My Test App' })render(<AppTrigger open={false} appDetail={app} />)- expect(screen.getByText('My Test App')).toBeInTheDocument()+ expect(screen.getByText('My Test App'))!.toBeInTheDocument()})it('should apply open state styling', () => {const { container } = render(<AppTrigger open={true} />)const trigger = container.querySelector('.bg-state-base-hover-alt')- expect(trigger).toBeInTheDocument()+ expect(trigger)!.toBeInTheDocument()})it('should render AppIcon when app is provided', () => {@@ -413,21 +414,21 @@ describe('AppTrigger', () => {const { container } = render(<AppTrigger open={false} appDetail={app} />)// AppIcon renders with a specific class when app is providedconst iconContainer = container.querySelector('.mr-2')- expect(iconContainer).toBeInTheDocument()+ expect(iconContainer)!.toBeInTheDocument()})})describe('Props', () => {it('should handle undefined appDetail gracefully', () => {render(<AppTrigger open={false} appDetail={undefined} />)- expect(screen.getByText('app.appSelector.placeholder')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.placeholder'))!.toBeInTheDocument()})it('should display app name with title attribute', () => {const app = createMockApp({ name: 'Long App Name For Testing' })render(<AppTrigger open={false} appDetail={app} />)const nameElement = screen.getByTitle('Long App Name For Testing')- expect(nameElement).toBeInTheDocument()+ expect(nameElement)!.toBeInTheDocument()})})@@ -435,14 +436,14 @@ describe('AppTrigger', () => {it('should have correct base classes', () => {const { container } = render(<AppTrigger open={false} />)const trigger = container.firstChild as HTMLElement- expect(trigger).toHaveClass('group', 'flex', 'cursor-pointer')+ expect(trigger)!.toHaveClass('group', 'flex', 'cursor-pointer')})it('should apply different padding when app is provided', () => {const app = createMockApp()const { container } = render(<AppTrigger open={false} appDetail={app} />)const trigger = container.firstChild as HTMLElement- expect(trigger).toHaveClass('py-1.5', 'pl-1.5')+ expect(trigger)!.toHaveClass('py-1.5', 'pl-1.5')})})})@@ -479,18 +480,18 @@ describe('AppPicker', () => {describe('Rendering', () => {it('should render trigger element', () => {render(<AppPicker {...defaultProps} />)- expect(screen.getByText('Select App')).toBeInTheDocument()+ expect(screen.getByText('Select App'))!.toBeInTheDocument()})it('should render app list when open', () => {render(<AppPicker {...defaultProps} isShow={true} />)- expect(screen.getByText('App 1')).toBeInTheDocument()- expect(screen.getByText('App 2')).toBeInTheDocument()+ expect(screen.getByText('App 1'))!.toBeInTheDocument()+ expect(screen.getByText('App 2'))!.toBeInTheDocument()})it('should show loading indicator when isLoading is true', () => {render(<AppPicker {...defaultProps} isShow={true} isLoading={true} />)- expect(screen.getByText('common.loading')).toBeInTheDocument()+ expect(screen.getByText('common.loading'))!.toBeInTheDocument()})it('should not render content when isShow is false', () => {@@ -538,31 +539,31 @@ describe('AppPicker', () => {it('should display correct app type for CHAT', () => {const apps = [createMockApp({ id: 'chat-app', name: 'Chat App', mode: AppModeEnum.CHAT })]render(<AppPicker {...defaultProps} isShow={true} apps={apps} />)- expect(screen.getByText('chat')).toBeInTheDocument()+ expect(screen.getByText('chat'))!.toBeInTheDocument()})it('should display correct app type for WORKFLOW', () => {const apps = [createMockApp({ id: 'workflow-app', name: 'Workflow App', mode: AppModeEnum.WORKFLOW })]render(<AppPicker {...defaultProps} isShow={true} apps={apps} />)- expect(screen.getByText('workflow')).toBeInTheDocument()+ expect(screen.getByText('workflow'))!.toBeInTheDocument()})it('should display correct app type for ADVANCED_CHAT', () => {const apps = [createMockApp({ id: 'chatflow-app', name: 'Chatflow App', mode: AppModeEnum.ADVANCED_CHAT })]render(<AppPicker {...defaultProps} isShow={true} apps={apps} />)- expect(screen.getByText('chatflow')).toBeInTheDocument()+ expect(screen.getByText('chatflow'))!.toBeInTheDocument()})it('should display correct app type for AGENT_CHAT', () => {const apps = [createMockApp({ id: 'agent-app', name: 'Agent App', mode: AppModeEnum.AGENT_CHAT })]render(<AppPicker {...defaultProps} isShow={true} apps={apps} />)- expect(screen.getByText('agent')).toBeInTheDocument()+ expect(screen.getByText('agent'))!.toBeInTheDocument()})it('should display correct app type for COMPLETION', () => {const apps = [createMockApp({ id: 'completion-app', name: 'Completion App', mode: AppModeEnum.COMPLETION })]render(<AppPicker {...defaultProps} isShow={true} apps={apps} />)- expect(screen.getByText('completion')).toBeInTheDocument()+ expect(screen.getByText('completion'))!.toBeInTheDocument()})})@@ -575,7 +576,7 @@ describe('AppPicker', () => {it('should handle search text with value', () => {render(<AppPicker {...defaultProps} isShow={true} searchText="test search" />)const input = screen.getByTestId('input')- expect(input).toHaveValue('test search')+ expect(input)!.toHaveValue('test search')})})@@ -641,7 +642,8 @@ describe('AppPicker', () => {render(<AppPicker {...defaultProps} isShow={true} hasMore={true} />)// The component should render without errors- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ // The component should render without errors+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should handle isShow toggle correctly', () => {@@ -654,7 +656,8 @@ describe('AppPicker', () => {rerender(<AppPicker {...defaultProps} isShow={false} />)// Should not crash- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ // Should not crash+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should setup intersection observer when isShow is true', () => {@@ -674,7 +677,8 @@ describe('AppPicker', () => {rerender(<AppPicker {...defaultProps} isShow={false} />)// Component should render without errors- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ // Component should render without errors+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should cleanup observer on component unmount', () => {@@ -691,7 +695,8 @@ describe('AppPicker', () => {triggerMutationObserver()// Component should still work correctly- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ // Component should still work correctly+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should not setup IntersectionObserver when observerTarget is null', () => {@@ -699,7 +704,8 @@ describe('AppPicker', () => {render(<AppPicker {...defaultProps} isShow={false} />)// The guard at line 84 should prevent setup- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ // The guard at line 84 should prevent setup+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should debounce onLoadMore calls using loadingRef', () => {@@ -798,8 +804,8 @@ describe('AppInputsForm', () => {{ type: InputVarType.textInput, label: 'Name', variable: 'name', required: false },]render(<AppInputsForm {...defaultProps} inputsForms={forms} />)- expect(screen.getByText('Name')).toBeInTheDocument()- expect(screen.getByPlaceholderText('Name')).toBeInTheDocument()+ expect(screen.getByText('Name'))!.toBeInTheDocument()+ expect(screen.getByPlaceholderText('Name'))!.toBeInTheDocument()})it('should render number input field', () => {@@ -807,7 +813,7 @@ describe('AppInputsForm', () => {{ type: InputVarType.number, label: 'Count', variable: 'count', required: false },]render(<AppInputsForm {...defaultProps} inputsForms={forms} />)- expect(screen.getByText('Count')).toBeInTheDocument()+ expect(screen.getByText('Count'))!.toBeInTheDocument()})it('should render paragraph (textarea) field', () => {@@ -815,7 +821,7 @@ describe('AppInputsForm', () => {{ type: InputVarType.paragraph, label: 'Description', variable: 'desc', required: false },]render(<AppInputsForm {...defaultProps} inputsForms={forms} />)- expect(screen.getByText('Description')).toBeInTheDocument()+ expect(screen.getByText('Description'))!.toBeInTheDocument()})it('should render select field', () => {@@ -840,8 +846,8 @@ describe('AppInputsForm', () => {},]render(<AppInputsForm {...defaultProps} inputsForms={forms} />)- expect(screen.getByText('Single File Upload')).toBeInTheDocument()- expect(screen.getByTestId('file-uploader')).toBeInTheDocument()+ expect(screen.getByText('Single File Upload'))!.toBeInTheDocument()+ expect(screen.getByTestId('file-uploader'))!.toBeInTheDocument()})it('should render file uploader for single file with existing value', () => {@@ -859,7 +865,8 @@ describe('AppInputsForm', () => {]render(<AppInputsForm {...defaultProps} inputsForms={forms} inputs={{ singleFile: existingFile }} />)// The file uploader should receive the existing file as an array- expect(screen.getByTestId('file-value')).toHaveTextContent(JSON.stringify([existingFile]))+ // The file uploader should receive the existing file as an array+ expect(screen.getByTestId('file-value'))!.toHaveTextContent(JSON.stringify([existingFile]))})it('should render file uploader for multi files', () => {@@ -876,7 +883,7 @@ describe('AppInputsForm', () => {},]render(<AppInputsForm {...defaultProps} inputsForms={forms} />)- expect(screen.getByText('Attachments')).toBeInTheDocument()+ expect(screen.getByText('Attachments'))!.toBeInTheDocument()})it('should show optional label for non-required fields', () => {@@ -884,7 +891,7 @@ describe('AppInputsForm', () => {{ type: InputVarType.textInput, label: 'Name', variable: 'name', required: false },]render(<AppInputsForm {...defaultProps} inputsForms={forms} />)- expect(screen.getByText('workflow.panel.optional')).toBeInTheDocument()+ expect(screen.getByText('workflow.panel.optional'))!.toBeInTheDocument()})it('should not show optional label for required fields', () => {@@ -1026,7 +1033,7 @@ describe('AppInputsForm', () => {render(<AppInputsForm {...defaultProps} inputsForms={forms} inputs={{ name: 'existing' }} />)const input = screen.getByPlaceholderText('Name')- expect(input).toHaveValue('existing')+ expect(input)!.toHaveValue('existing')})it('should handle empty string value', () => {@@ -1036,7 +1043,7 @@ describe('AppInputsForm', () => {render(<AppInputsForm {...defaultProps} inputsForms={forms} inputs={{ name: '' }} />)const input = screen.getByPlaceholderText('Name')- expect(input).toHaveValue('')+ expect(input)!.toHaveValue('')})it('should handle undefined variable value', () => {@@ -1046,7 +1053,7 @@ describe('AppInputsForm', () => {render(<AppInputsForm {...defaultProps} inputsForms={forms} inputs={{}} />)const input = screen.getByPlaceholderText('Name')- expect(input).toHaveValue('')+ expect(input)!.toHaveValue('')})it('should handle multiple form fields', () => {@@ -1057,9 +1064,9 @@ describe('AppInputsForm', () => {]render(<AppInputsForm {...defaultProps} inputsForms={forms} />)- expect(screen.getByText('Name')).toBeInTheDocument()- expect(screen.getByText('Age')).toBeInTheDocument()- expect(screen.getByText('Bio')).toBeInTheDocument()+ expect(screen.getByText('Name'))!.toBeInTheDocument()+ expect(screen.getByText('Age'))!.toBeInTheDocument()+ expect(screen.getByText('Bio'))!.toBeInTheDocument()})it('should handle unknown form type gracefully', () => {@@ -1068,7 +1075,7 @@ describe('AppInputsForm', () => {]// Should not throw error, just not render the fieldrender(<AppInputsForm {...defaultProps} inputsForms={forms} />)- expect(screen.getByText('Unknown')).toBeInTheDocument()+ expect(screen.getByText('Unknown'))!.toBeInTheDocument()})})})@@ -1093,18 +1100,49 @@ describe('AppInputsPanel', () => {describe('Rendering', () => {it('should render without crashing', () => {renderWithQueryClient(<AppInputsPanel {...defaultProps} />)- expect(screen.getByText('app.appSelector.params')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.params'))!.toBeInTheDocument()})it('should show no params message when form schema is empty', () => {renderWithQueryClient(<AppInputsPanel {...defaultProps} />)- expect(screen.getByText('app.appSelector.noParams')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.noParams'))!.toBeInTheDocument()})it('should show loading state when app is loading', () => {mockAppDetailLoading = truerenderWithQueryClient(<AppInputsPanel {...defaultProps} />)// Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be rendered+ // Loading component should be renderedexpect(screen.queryByText('app.appSelector.params')).not.toBeInTheDocument()})@@ -1119,19 +1157,19 @@ describe('AppInputsPanel', () => {describe('Props', () => {it('should handle undefined value', () => {renderWithQueryClient(<AppInputsPanel {...defaultProps} value={undefined} />)- expect(screen.getByText('app.appSelector.params')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.params'))!.toBeInTheDocument()})it('should handle different app modes', () => {const workflowApp = createMockApp({ mode: AppModeEnum.WORKFLOW })renderWithQueryClient(<AppInputsPanel {...defaultProps} appDetail={workflowApp} />)- expect(screen.getByText('app.appSelector.params')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.params'))!.toBeInTheDocument()})it('should handle advanced chat mode', () => {const advancedChatApp = createMockApp({ mode: AppModeEnum.ADVANCED_CHAT })renderWithQueryClient(<AppInputsPanel {...defaultProps} appDetail={advancedChatApp} />)- expect(screen.getByText('app.appSelector.params')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.params'))!.toBeInTheDocument()})})@@ -1147,7 +1185,7 @@ describe('AppInputsPanel', () => {},})renderWithQueryClient(<AppInputsPanel {...defaultProps} />)- expect(screen.getByText('app.appSelector.params')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.params'))!.toBeInTheDocument()})it('should generate schema for number input', () => {@@ -1161,7 +1199,7 @@ describe('AppInputsPanel', () => {},})renderWithQueryClient(<AppInputsPanel {...defaultProps} />)- expect(screen.getByText('app.appSelector.params')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.params'))!.toBeInTheDocument()})it('should generate schema for checkbox input', () => {@@ -1175,7 +1213,7 @@ describe('AppInputsPanel', () => {},})renderWithQueryClient(<AppInputsPanel {...defaultProps} />)- expect(screen.getByText('app.appSelector.params')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.params'))!.toBeInTheDocument()})it('should generate schema for select input', () => {@@ -1189,7 +1227,7 @@ describe('AppInputsPanel', () => {},})renderWithQueryClient(<AppInputsPanel {...defaultProps} />)- expect(screen.getByText('app.appSelector.params')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.params'))!.toBeInTheDocument()})it('should generate schema for file-list input', () => {@@ -1203,7 +1241,7 @@ describe('AppInputsPanel', () => {},})renderWithQueryClient(<AppInputsPanel {...defaultProps} />)- expect(screen.getByText('app.appSelector.params')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.params'))!.toBeInTheDocument()})it('should generate schema for file input', () => {@@ -1217,7 +1255,7 @@ describe('AppInputsPanel', () => {},})renderWithQueryClient(<AppInputsPanel {...defaultProps} />)- expect(screen.getByText('app.appSelector.params')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.params'))!.toBeInTheDocument()})it('should generate schema for json_object input', () => {@@ -1231,7 +1269,7 @@ describe('AppInputsPanel', () => {},})renderWithQueryClient(<AppInputsPanel {...defaultProps} />)- expect(screen.getByText('app.appSelector.params')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.params'))!.toBeInTheDocument()})it('should generate schema for text-input (default)', () => {@@ -1245,7 +1283,7 @@ describe('AppInputsPanel', () => {},})renderWithQueryClient(<AppInputsPanel {...defaultProps} />)- expect(screen.getByText('app.appSelector.params')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.params'))!.toBeInTheDocument()})it('should filter external_data_tool items', () => {@@ -1260,7 +1298,7 @@ describe('AppInputsPanel', () => {},})renderWithQueryClient(<AppInputsPanel {...defaultProps} />)- expect(screen.getByText('app.appSelector.params')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.params'))!.toBeInTheDocument()})})@@ -1283,7 +1321,7 @@ describe('AppInputsPanel', () => {}const workflowApp = createMockApp({ mode: AppModeEnum.WORKFLOW })renderWithQueryClient(<AppInputsPanel {...defaultProps} appDetail={workflowApp} />)- expect(screen.getByText('app.appSelector.params')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.params'))!.toBeInTheDocument()})it('should generate schema for workflow with singleFile variable', () => {@@ -1304,7 +1342,7 @@ describe('AppInputsPanel', () => {}const workflowApp = createMockApp({ mode: AppModeEnum.WORKFLOW })renderWithQueryClient(<AppInputsPanel {...defaultProps} appDetail={workflowApp} />)- expect(screen.getByText('app.appSelector.params')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.params'))!.toBeInTheDocument()})it('should generate schema for workflow with regular variable', () => {@@ -1325,7 +1363,7 @@ describe('AppInputsPanel', () => {}const workflowApp = createMockApp({ mode: AppModeEnum.WORKFLOW })renderWithQueryClient(<AppInputsPanel {...defaultProps} appDetail={workflowApp} />)- expect(screen.getByText('app.appSelector.params')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.params'))!.toBeInTheDocument()})})@@ -1344,7 +1382,7 @@ describe('AppInputsPanel', () => {})const completionApp = createMockApp({ mode: AppModeEnum.COMPLETION })renderWithQueryClient(<AppInputsPanel {...defaultProps} appDetail={completionApp} />)- expect(screen.getByText('app.appSelector.params')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.params'))!.toBeInTheDocument()})it('should add image upload schema for WORKFLOW mode with file upload enabled', () => {@@ -1364,7 +1402,7 @@ describe('AppInputsPanel', () => {}const workflowApp = createMockApp({ mode: AppModeEnum.WORKFLOW })renderWithQueryClient(<AppInputsPanel {...defaultProps} appDetail={workflowApp} />)- expect(screen.getByText('app.appSelector.params')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.params'))!.toBeInTheDocument()})})@@ -1372,7 +1410,7 @@ describe('AppInputsPanel', () => {it('should call onFormChange when form is updated', () => {const onFormChange = vi.fn()renderWithQueryClient(<AppInputsPanel {...defaultProps} onFormChange={onFormChange} />)- expect(screen.getByText('app.appSelector.params')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.params'))!.toBeInTheDocument()})it('should call onFormChange with updated values when text input changes', () => {@@ -1424,7 +1462,7 @@ describe('AppInputsPanel', () => {<AppInputsPanel {...defaultProps} /></QueryClientProvider>,)- expect(screen.getByText('app.appSelector.params')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.params'))!.toBeInTheDocument()})})@@ -1432,7 +1470,7 @@ describe('AppInputsPanel', () => {it('should return empty schema when currentApp is null', () => {mockAppDetailData = nullrenderWithQueryClient(<AppInputsPanel {...defaultProps} />)- expect(screen.getByText('app.appSelector.noParams')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.noParams'))!.toBeInTheDocument()})it('should handle workflow without start node', () => {@@ -1442,7 +1480,7 @@ describe('AppInputsPanel', () => {}const workflowApp = createMockApp({ mode: AppModeEnum.WORKFLOW })renderWithQueryClient(<AppInputsPanel {...defaultProps} appDetail={workflowApp} />)- expect(screen.getByText('app.appSelector.params')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.params'))!.toBeInTheDocument()})})})@@ -1477,12 +1515,12 @@ describe('AppSelector', () => {describe('Rendering', () => {it('should render without crashing', () => {renderWithQueryClient(<AppSelector {...defaultProps} />)- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should render trigger component', () => {renderWithQueryClient(<AppSelector {...defaultProps} />)- expect(screen.getByText('app.appSelector.placeholder')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.placeholder'))!.toBeInTheDocument()})it('should show selected app info when value is provided', () => {@@ -1493,19 +1531,20 @@ describe('AppSelector', () => {/>,)// Should show the app trigger with app info- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ // Should show the app trigger with app info+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})})describe('Props', () => {it('should handle different placement values', () => {renderWithQueryClient(<AppSelector {...defaultProps} placement="top" />)- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should handle different offset values', () => {renderWithQueryClient(<AppSelector {...defaultProps} offset={10} />)- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should handle disabled state', () => {@@ -1513,12 +1552,13 @@ describe('AppSelector', () => {const trigger = screen.getByTestId('portal-trigger')fireEvent.click(trigger)// Portal should remain closed when disabled- expect(screen.getByTestId('portal-to-follow-elem')).toHaveAttribute('data-open', 'false')+ // Portal should remain closed when disabled+ expect(screen.getByTestId('portal-to-follow-elem'))!.toHaveAttribute('data-open', 'false')})it('should handle scope prop', () => {renderWithQueryClient(<AppSelector {...defaultProps} scope="workflow" />)- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should handle value with inputs', () => {@@ -1528,7 +1568,7 @@ describe('AppSelector', () => {value={{ app_id: 'app-1', inputs: { name: 'test' }, files: [] }}/>,)- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should handle value with files', () => {@@ -1538,7 +1578,7 @@ describe('AppSelector', () => {value={{ app_id: 'app-1', inputs: {}, files: [{ id: 'file-1' }] }}/>,)- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})})@@ -1547,10 +1587,11 @@ describe('AppSelector', () => {renderWithQueryClient(<AppSelector {...defaultProps} />)const trigger = screen.getAllByTestId('portal-trigger')[0]- fireEvent.click(trigger)+ fireEvent.click(trigger!)// The portal state should update synchronously - get the first one (outer portal)- expect(screen.getAllByTestId('portal-to-follow-elem')[0]).toHaveAttribute('data-open', 'true')+ // The portal state should update synchronously - get the first one (outer portal)+ expect(screen.getAllByTestId('portal-to-follow-elem')[0])!.toHaveAttribute('data-open', 'true')})it('should not toggle isShow when disabled', () => {@@ -1559,7 +1600,7 @@ describe('AppSelector', () => {const trigger = screen.getByTestId('portal-trigger')fireEvent.click(trigger)- expect(screen.getByTestId('portal-to-follow-elem')).toHaveAttribute('data-open', 'false')+ expect(screen.getByTestId('portal-to-follow-elem'))!.toHaveAttribute('data-open', 'false')})it('should manage search text state', () => {@@ -1569,7 +1610,8 @@ describe('AppSelector', () => {fireEvent.click(trigger)// Portal content should be visible after click- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ // Portal content should be visible after click+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()})it('should render correctly during load more setup', () => {@@ -1579,7 +1621,8 @@ describe('AppSelector', () => {renderWithQueryClient(<AppSelector {...defaultProps} />)// Trigger should be rendered- expect(screen.getByTestId('portal-trigger')).toBeInTheDocument()+ // Trigger should be rendered+ expect(screen.getByTestId('portal-trigger'))!.toBeInTheDocument()})})@@ -1592,7 +1635,7 @@ describe('AppSelector', () => {// Open the portalfireEvent.click(screen.getByTestId('portal-trigger'))- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()})it('should call onSelect with correct value structure', () => {@@ -1606,7 +1649,8 @@ describe('AppSelector', () => {)// The component should maintain the correct value structure- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ // The component should maintain the correct value structure+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should clear inputs when selecting different app', () => {@@ -1620,7 +1664,8 @@ describe('AppSelector', () => {)// Component renders with existing value- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ // Component renders with existing value+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should preserve inputs when selecting same app', () => {@@ -1633,7 +1678,7 @@ describe('AppSelector', () => {/>,)- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})})@@ -1647,7 +1692,7 @@ describe('AppSelector', () => {}renderWithQueryClient(<AppSelector {...defaultProps} />)- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should memoize currentAppInfo correctly', () => {@@ -1662,7 +1707,7 @@ describe('AppSelector', () => {/>,)- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should memoize formattedValue correctly', () => {@@ -1673,7 +1718,7 @@ describe('AppSelector', () => {/>,)- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should be wrapped with React.memo', () => {@@ -1690,7 +1735,7 @@ describe('AppSelector', () => {</QueryClientProvider>,)- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})})@@ -1698,7 +1743,7 @@ describe('AppSelector', () => {it('should handle load more when hasMore is true', async () => {mockHasNextPage = truerenderWithQueryClient(<AppSelector {...defaultProps} />)- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should not trigger load more when already loading', async () => {@@ -1724,7 +1769,7 @@ describe('AppSelector', () => {vi.advanceTimersByTime(500)})- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should render load more area when hasMore is true', () => {@@ -1735,10 +1780,11 @@ describe('AppSelector', () => {renderWithQueryClient(<AppSelector {...defaultProps} />)// Open the portal- fireEvent.click(screen.getAllByTestId('portal-trigger')[0])+ fireEvent.click(screen.getAllByTestId('portal-trigger')[0]!)// Should render without errors- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ // Should render without errors+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()})it('should handle fetchNextPage rejection gracefully in handleLoadMore', async () => {@@ -1748,7 +1794,8 @@ describe('AppSelector', () => {renderWithQueryClient(<AppSelector {...defaultProps} />)// Should not crash even if fetchNextPage rejects- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ // Should not crash even if fetchNextPage rejects+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should call fetchNextPage when intersection observer triggers handleLoadMore', async () => {@@ -1759,11 +1806,11 @@ describe('AppSelector', () => {renderWithQueryClient(<AppSelector {...defaultProps} />)// Open the main portal- fireEvent.click(screen.getAllByTestId('portal-trigger')[0])+ fireEvent.click(screen.getAllByTestId('portal-trigger')[0]!)// Open the inner app picker portalconst triggers = screen.getAllByTestId('portal-trigger')- fireEvent.click(triggers[1])+ fireEvent.click(triggers[1]!)// Simulate intersection to trigger handleLoadMoretriggerIntersection([{ isIntersecting: true } as IntersectionObserverEntry])@@ -1780,9 +1827,9 @@ describe('AppSelector', () => {renderWithQueryClient(<AppSelector {...defaultProps} />)// Open portals- fireEvent.click(screen.getAllByTestId('portal-trigger')[0])+ fireEvent.click(screen.getAllByTestId('portal-trigger')[0]!)const triggers = screen.getAllByTestId('portal-trigger')- fireEvent.click(triggers[1])+ fireEvent.click(triggers[1]!)// Trigger first intersectiontriggerIntersection([{ isIntersecting: true } as IntersectionObserverEntry])@@ -1806,9 +1853,9 @@ describe('AppSelector', () => {renderWithQueryClient(<AppSelector {...defaultProps} />)// Open portals- fireEvent.click(screen.getAllByTestId('portal-trigger')[0])+ fireEvent.click(screen.getAllByTestId('portal-trigger')[0]!)const triggers = screen.getAllByTestId('portal-trigger')- fireEvent.click(triggers[1])+ fireEvent.click(triggers[1]!)// Trigger intersectiontriggerIntersection([{ isIntersecting: true } as IntersectionObserverEntry])@@ -1825,9 +1872,9 @@ describe('AppSelector', () => {renderWithQueryClient(<AppSelector {...defaultProps} />)// Open portals- fireEvent.click(screen.getAllByTestId('portal-trigger')[0])+ fireEvent.click(screen.getAllByTestId('portal-trigger')[0]!)const triggers = screen.getAllByTestId('portal-trigger')- fireEvent.click(triggers[1])+ fireEvent.click(triggers[1]!)// Trigger intersectiontriggerIntersection([{ isIntersecting: true } as IntersectionObserverEntry])@@ -1847,7 +1894,7 @@ describe('AppSelector', () => {/>,)- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should handle form change without image file', () => {@@ -1860,7 +1907,7 @@ describe('AppSelector', () => {/>,)- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should extract #image# from inputs and add to files array', () => {@@ -1874,7 +1921,7 @@ describe('AppSelector', () => {/>,)- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should preserve existing files when no #image# in inputs', () => {@@ -1887,7 +1934,7 @@ describe('AppSelector', () => {/>,)- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})})@@ -1907,9 +1954,9 @@ describe('AppSelector', () => {)// Open the main portal- fireEvent.click(screen.getAllByTestId('portal-trigger')[0])+ fireEvent.click(screen.getAllByTestId('portal-trigger')[0]!)- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()})it('should preserve inputs when selecting the same app', () => {@@ -1926,7 +1973,7 @@ describe('AppSelector', () => {/>,)- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should handle app selection with empty value', () => {@@ -1944,34 +1991,34 @@ describe('AppSelector', () => {)// Open the main portal- fireEvent.click(screen.getAllByTestId('portal-trigger')[0])+ fireEvent.click(screen.getAllByTestId('portal-trigger')[0]!)- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()})})describe('Edge Cases', () => {it('should handle undefined value', () => {renderWithQueryClient(<AppSelector {...defaultProps} value={undefined} />)- expect(screen.getByText('app.appSelector.placeholder')).toBeInTheDocument()+ expect(screen.getByText('app.appSelector.placeholder'))!.toBeInTheDocument()})it('should handle empty pages array', () => {mockAppListData = { pages: [] }renderWithQueryClient(<AppSelector {...defaultProps} />)- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should handle undefined data', () => {mockAppListData = undefinedrenderWithQueryClient(<AppSelector {...defaultProps} />)- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should handle loading state', () => {mockIsLoading = truerenderWithQueryClient(<AppSelector {...defaultProps} />)- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should handle app not found in displayedApps', () => {@@ -1986,7 +2033,7 @@ describe('AppSelector', () => {/>,)- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should handle value with empty inputs and files', () => {@@ -1997,7 +2044,7 @@ describe('AppSelector', () => {/>,)- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})})@@ -2009,7 +2056,8 @@ describe('AppSelector', () => {renderWithQueryClient(<AppSelector {...defaultProps} />)// Should not crash- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ // Should not crash+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})})})@@ -2043,10 +2091,11 @@ describe('AppSelector Integration', () => {renderWithQueryClient(<AppSelector onSelect={onSelect} />)// 1. Click trigger to open picker - get first trigger (outer portal)- fireEvent.click(screen.getAllByTestId('portal-trigger')[0])+ fireEvent.click(screen.getAllByTestId('portal-trigger')[0]!)// Get the first portal element (outer portal)- expect(screen.getAllByTestId('portal-to-follow-elem')[0]).toHaveAttribute('data-open', 'true')+ // Get the first portal element (outer portal)+ expect(screen.getAllByTestId('portal-to-follow-elem')[0])!.toHaveAttribute('data-open', 'true')})it('should handle app change with input preservation logic', () => {@@ -2058,7 +2107,7 @@ describe('AppSelector Integration', () => {/>,)- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})})@@ -2067,7 +2116,8 @@ describe('AppSelector Integration', () => {renderWithQueryClient(<AppSelector onSelect={vi.fn()} />)// AppTrigger should show placeholder when no app selected- expect(screen.getByText('app.appSelector.placeholder')).toBeInTheDocument()+ // AppTrigger should show placeholder when no app selected+ expect(screen.getByText('app.appSelector.placeholder'))!.toBeInTheDocument()})it('should pass correct props to AppPicker', () => {@@ -2075,7 +2125,7 @@ describe('AppSelector Integration', () => {fireEvent.click(screen.getByTestId('portal-trigger'))- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()})})@@ -2088,7 +2138,7 @@ describe('AppSelector Integration', () => {/>,)- expect(screen.getByTestId('portal-to-follow-elem')).toBeInTheDocument()+ expect(screen.getByTestId('portal-to-follow-elem'))!.toBeInTheDocument()})it('should handle search filtering through app list', () => {@@ -2096,7 +2146,7 @@ describe('AppSelector Integration', () => {fireEvent.click(screen.getByTestId('portal-trigger'))- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()})})@@ -2115,13 +2165,13 @@ describe('AppSelector Integration', () => {)// Open the main portal- fireEvent.click(screen.getAllByTestId('portal-trigger')[0])+ fireEvent.click(screen.getAllByTestId('portal-trigger')[0]!)// The inner AppPicker portal is closed by default (isShowChooseApp = false)// We need to click on the inner trigger to open itconst innerTriggers = screen.getAllByTestId('portal-trigger')// The second trigger is the inner AppPicker trigger- fireEvent.click(innerTriggers[1])+ fireEvent.click(innerTriggers[1]!)// Now the inner portal should be open and show the app list// Find and click on app-2@@ -2150,16 +2200,16 @@ describe('AppSelector Integration', () => {)// Open the main portal- fireEvent.click(screen.getAllByTestId('portal-trigger')[0])+ fireEvent.click(screen.getAllByTestId('portal-trigger')[0]!)// Click on the inner trigger to open app pickerconst innerTriggers = screen.getAllByTestId('portal-trigger')- fireEvent.click(innerTriggers[1])+ fireEvent.click(innerTriggers[1]!)// Click on the same app - need to get the one in the app list, not the triggerconst appItems = screen.getAllByText('App 1')// The last one should be in the dropdown list- fireEvent.click(appItems[appItems.length - 1])+ fireEvent.click(appItems[appItems.length - 1]!)// onSelect should be called with preserved inputs since it's the same appexpect(onSelect).toHaveBeenCalledWith({@@ -2183,15 +2233,15 @@ describe('AppSelector Integration', () => {)// Open the main portal- fireEvent.click(screen.getAllByTestId('portal-trigger')[0])+ fireEvent.click(screen.getAllByTestId('portal-trigger')[0]!)// Click on inner trigger to open app pickerconst innerTriggers = screen.getAllByTestId('portal-trigger')- fireEvent.click(innerTriggers[1])+ fireEvent.click(innerTriggers[1]!)// Click on an app from the dropdownconst app1Elements = screen.getAllByText('App 1')- fireEvent.click(app1Elements[app1Elements.length - 1])+ fireEvent.click(app1Elements[app1Elements.length - 1]!)// onSelect should be called with new app and empty inputs/filesexpect(onSelect).toHaveBeenCalledWith({@@ -2211,9 +2261,9 @@ describe('AppSelector Integration', () => {renderWithQueryClient(<AppSelector onSelect={vi.fn()} />)// Open the portal to render the app picker- fireEvent.click(screen.getAllByTestId('portal-trigger')[0])+ fireEvent.click(screen.getAllByTestId('portal-trigger')[0]!)- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()})it('should stay stable after fetchNextPage completes', async () => {@@ -2223,9 +2273,9 @@ describe('AppSelector Integration', () => {renderWithQueryClient(<AppSelector onSelect={vi.fn()} />)- fireEvent.click(screen.getAllByTestId('portal-trigger')[0])+ fireEvent.click(screen.getAllByTestId('portal-trigger')[0]!)- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()})it('should not call fetchNextPage when conditions prevent it', () => {@@ -2234,7 +2284,7 @@ describe('AppSelector Integration', () => {renderWithQueryClient(<AppSelector onSelect={vi.fn()} />)- fireEvent.click(screen.getAllByTestId('portal-trigger')[0])+ fireEvent.click(screen.getAllByTestId('portal-trigger')[0]!)// fetchNextPage should not be calledexpect(mockFetchNextPage).not.toHaveBeenCalled()@@ -2256,7 +2306,7 @@ describe('AppSelector Integration', () => {)// Open portal- fireEvent.click(screen.getAllByTestId('portal-trigger')[0])+ fireEvent.click(screen.getAllByTestId('portal-trigger')[0]!)// formattedValue should include #image# from filesexpect(screen.getAllByTestId('portal-content').length).toBeGreaterThan(0)@@ -2275,7 +2325,7 @@ describe('AppSelector Integration', () => {/>,)- fireEvent.click(screen.getAllByTestId('portal-trigger')[0])+ fireEvent.click(screen.getAllByTestId('portal-trigger')[0]!)expect(screen.getAllByTestId('portal-content').length).toBeGreaterThan(0)})@@ -2293,7 +2343,7 @@ describe('AppSelector Integration', () => {/>,)- fireEvent.click(screen.getAllByTestId('portal-trigger')[0])+ fireEvent.click(screen.getAllByTestId('portal-trigger')[0]!)expect(screen.getAllByTestId('portal-content').length).toBeGreaterThan(0)})@@ -2324,12 +2374,12 @@ describe('AppSelector Integration', () => {)// Open portal to render AppInputsPanel- fireEvent.click(screen.getAllByTestId('portal-trigger')[0])+ fireEvent.click(screen.getAllByTestId('portal-trigger')[0]!)// Find and interact with the form input (may not exist if schema is empty)const formInputs = screen.queryAllByPlaceholderText('FormInputField')if (formInputs.length > 0) {- fireEvent.change(formInputs[0], { target: { value: 'test value' } })+ fireEvent.change(formInputs[0]!, { target: { value: 'test value' } })// handleFormChange in index.tsx should have been calledexpect(onSelect).toHaveBeenCalledWith({@@ -2376,12 +2426,12 @@ describe('AppSelector Integration', () => {/>,)- fireEvent.click(screen.getAllByTestId('portal-trigger')[0])+ fireEvent.click(screen.getAllByTestId('portal-trigger')[0]!)// Find file uploader and trigger upload - the #image# field will be extractedconst uploadBtns = screen.queryAllByTestId('upload-file-btn')if (uploadBtns.length > 0) {- fireEvent.click(uploadBtns[0])+ fireEvent.click(uploadBtns[0]!)// handleFormChange should extract #image# and convert to filesexpect(onSelect).toHaveBeenCalled()}@@ -2414,12 +2464,12 @@ describe('AppSelector Integration', () => {/>,)- fireEvent.click(screen.getAllByTestId('portal-trigger')[0])+ fireEvent.click(screen.getAllByTestId('portal-trigger')[0]!)// Find form input (may not exist if schema is empty)const inputs = screen.queryAllByPlaceholderText('PreserveField')if (inputs.length > 0) {- fireEvent.change(inputs[0], { target: { value: 'updated name' } })+ fireEvent.change(inputs[0]!, { target: { value: 'updated name' } })// onSelect should be called preserving existing files (no #image# in inputs)expect(onSelect).toHaveBeenCalledWith({@@ -2465,7 +2515,7 @@ describe('AppSelector Integration', () => {/>,)- fireEvent.click(screen.getAllByTestId('portal-trigger')[0])+ fireEvent.click(screen.getAllByTestId('portal-trigger')[0]!)// Try to find and click the upload button which triggers #image# form changeconst uploadBtn = screen.queryByTestId('upload-file-btn')@@ -2499,11 +2549,11 @@ describe('AppSelector Integration', () => {/>,)- fireEvent.click(screen.getAllByTestId('portal-trigger')[0])+ fireEvent.click(screen.getAllByTestId('portal-trigger')[0]!)const inputs = screen.queryAllByPlaceholderText('SimpleInput')if (inputs.length > 0) {- fireEvent.change(inputs[0], { target: { value: 'changed' } })+ fireEvent.change(inputs[0]!, { target: { value: 'changed' } })// handleFormChange should preserve existing files when no #image# in inputsexpect(onSelect).toHaveBeenCalledWith({app_id: 'app-1',diff --git a/web/app/components/plugins/plugin-detail-panel/app-selector/app-picker.tsx b/web/app/components/plugins/plugin-detail-panel/app-selector/app-picker.tsxindex c4cb4f4da8c..4c96b69bebc 100644--- a/web/app/components/plugins/plugin-detail-panel/app-selector/app-picker.tsx+++ b/web/app/components/plugins/plugin-detail-panel/app-selector/app-picker.tsx@@ -78,7 +78,7 @@ const AppPicker: FC<Props> = ({const handleIntersection = useCallback((entries: IntersectionObserverEntry[]) => {const target = entries[0]- if (!target.isIntersecting || loadingRef.current || !hasMore || isLoading)+ if (!target!.isIntersecting || loadingRef.current || !hasMore || isLoading)returnloadingRef.current = truediff --git a/web/app/components/plugins/plugin-detail-panel/app-selector/hooks/use-app-inputs-form-schema.ts b/web/app/components/plugins/plugin-detail-panel/app-selector/hooks/use-app-inputs-form-schema.tsindex 51bbcde18dc..8f3d5f0249f 100644--- a/web/app/components/plugins/plugin-detail-panel/app-selector/hooks/use-app-inputs-form-schema.ts+++ b/web/app/components/plugins/plugin-detail-panel/app-selector/hooks/use-app-inputs-form-schema.ts@@ -53,7 +53,7 @@ function buildFileConfig(fileConfig: FileUpload | undefined) {enabled: !!(fileConfig?.enabled || fileConfig?.image?.enabled),allowed_file_types: fileConfig?.allowed_file_types || [SupportUploadFileTypes.image],allowed_file_extensions: fileConfig?.allowed_file_extensions- || [...FILE_EXTS[SupportUploadFileTypes.image]].map(ext => `.${ext}`),+ || [...(FILE_EXTS[SupportUploadFileTypes.image] ?? [])].map(ext => `.${ext}`),allowed_file_upload_methods: fileConfig?.allowed_file_upload_methods|| fileConfig?.image?.transfer_methods|| ['local_file', 'remote_url'],diff --git a/web/app/components/plugins/plugin-detail-panel/model-selector/__tests__/tts-params-panel.spec.tsx b/web/app/components/plugins/plugin-detail-panel/model-selector/__tests__/tts-params-panel.spec.tsxindex c3f7f221b5a..e4233598721 100644--- a/web/app/components/plugins/plugin-detail-panel/model-selector/__tests__/tts-params-panel.spec.tsx+++ b/web/app/components/plugins/plugin-detail-panel/model-selector/__tests__/tts-params-panel.spec.tsx@@ -161,7 +161,8 @@ describe('TTSParamsPanel', () => {const { container } = render(<TTSParamsPanel {...props} />)// Assert- expect(container).toBeInTheDocument()+ // Assert+ expect(container)!.toBeInTheDocument()})it('should render language label', () => {@@ -172,7 +173,8 @@ describe('TTSParamsPanel', () => {render(<TTSParamsPanel {...props} />)// Assert- expect(screen.getByText('appDebug.voice.voiceSettings.language')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('appDebug.voice.voiceSettings.language'))!.toBeInTheDocument()})it('should render voice label', () => {@@ -183,7 +185,8 @@ describe('TTSParamsPanel', () => {render(<TTSParamsPanel {...props} />)// Assert- expect(screen.getByText('appDebug.voice.voiceSettings.voice')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('appDebug.voice.voiceSettings.voice'))!.toBeInTheDocument()})it('should render two Select components', () => {@@ -207,7 +210,7 @@ describe('TTSParamsPanel', () => {// Assertconst values = screen.getAllByTestId('selected-value')- expect(values[0]).toHaveTextContent('zh-Hans')+ expect(values[0])!.toHaveTextContent('zh-Hans')})it('should render voice select with correct value', () => {@@ -219,7 +222,7 @@ describe('TTSParamsPanel', () => {// Assertconst values = screen.getAllByTestId('selected-value')- expect(values[1]).toHaveTextContent('echo')+ expect(values[1])!.toHaveTextContent('echo')})it('should only show supported languages in language select', () => {@@ -230,9 +233,10 @@ describe('TTSParamsPanel', () => {render(<TTSParamsPanel {...props} />)// Assert- expect(screen.getByTestId('select-item-en-US')).toBeInTheDocument()- expect(screen.getByTestId('select-item-zh-Hans')).toBeInTheDocument()- expect(screen.getByTestId('select-item-ja-JP')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('select-item-en-US'))!.toBeInTheDocument()+ expect(screen.getByTestId('select-item-zh-Hans'))!.toBeInTheDocument()+ expect(screen.getByTestId('select-item-ja-JP'))!.toBeInTheDocument()expect(screen.queryByTestId('select-item-unsupported-lang')).not.toBeInTheDocument()})@@ -244,9 +248,10 @@ describe('TTSParamsPanel', () => {render(<TTSParamsPanel {...props} />)// Assert- expect(screen.getByTestId('select-item-alloy')).toBeInTheDocument()- expect(screen.getByTestId('select-item-echo')).toBeInTheDocument()- expect(screen.getByTestId('select-item-fable')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('select-item-alloy'))!.toBeInTheDocument()+ expect(screen.getByTestId('select-item-echo'))!.toBeInTheDocument()+ expect(screen.getByTestId('select-item-fable'))!.toBeInTheDocument()})})@@ -260,8 +265,9 @@ describe('TTSParamsPanel', () => {render(<TTSParamsPanel {...props} />)// Assert- expect(screen.getByTestId('tts-language-select-trigger')).toHaveAttribute('data-class', 'w-full')- expect(screen.getByTestId('tts-voice-select-trigger')).toHaveAttribute('data-class', 'w-full')+ // Assert+ expect(screen.getByTestId('tts-language-select-trigger'))!.toHaveAttribute('data-class', 'w-full')+ expect(screen.getByTestId('tts-voice-select-trigger'))!.toHaveAttribute('data-class', 'w-full')})it('should apply popup className to SelectContent', () => {@@ -273,8 +279,8 @@ describe('TTSParamsPanel', () => {// Assertconst contents = screen.getAllByTestId('select-content')- expect(contents[0]).toHaveAttribute('data-popup-class', 'w-[354px]')- expect(contents[1]).toHaveAttribute('data-popup-class', 'w-[354px]')+ expect(contents[0])!.toHaveAttribute('data-popup-class', 'w-[354px]')+ expect(contents[1])!.toHaveAttribute('data-popup-class', 'w-[354px]')})})@@ -396,6 +402,37 @@ describe('TTSParamsPanel', () => {// Actrender(<TTSParamsPanel {...props} />)+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered+ // Assert - no voice items should be rendered// Assert - no voice items should be renderedexpect(screen.queryByTestId('select-item-alloy')).not.toBeInTheDocument()expect(screen.queryByTestId('select-item-echo')).not.toBeInTheDocument()@@ -413,6 +450,37 @@ describe('TTSParamsPanel', () => {// Actrender(<TTSParamsPanel {...props} />)+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert// Assertexpect(screen.queryByTestId('select-item-alloy')).not.toBeInTheDocument()})@@ -430,8 +498,9 @@ describe('TTSParamsPanel', () => {render(<TTSParamsPanel {...props} />)// Assert- expect(screen.getByTestId('select-item-voice-1')).toBeInTheDocument()- expect(screen.getByTestId('select-item-voice-2')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('select-item-voice-1'))!.toBeInTheDocument()+ expect(screen.getByTestId('select-item-voice-2'))!.toBeInTheDocument()})it('should handle currentModel with empty voices array', () => {@@ -444,7 +513,7 @@ describe('TTSParamsPanel', () => {render(<TTSParamsPanel {...props} />)// Assert - no voice items (except language items)- expect(screen.getAllByTestId('select-content')[1].children).toHaveLength(0)+ expect(screen.getAllByTestId('select-content')[1]!.children).toHaveLength(0)expect(screen.queryByTestId('select-item-alloy')).not.toBeInTheDocument()})@@ -460,7 +529,8 @@ describe('TTSParamsPanel', () => {render(<TTSParamsPanel {...props} />)// Assert- expect(screen.getByTestId('select-item-single-voice')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('select-item-single-voice'))!.toBeInTheDocument()})})@@ -475,7 +545,7 @@ describe('TTSParamsPanel', () => {// Assertconst values = screen.getAllByTestId('selected-value')- expect(values[0]).toHaveTextContent('')+ expect(values[0])!.toHaveTextContent('')})it('should handle empty voice value', () => {@@ -487,7 +557,7 @@ describe('TTSParamsPanel', () => {// Assertconst values = screen.getAllByTestId('selected-value')- expect(values[1]).toHaveTextContent('')+ expect(values[1])!.toHaveTextContent('')})it('should handle many voices', () => {@@ -504,8 +574,9 @@ describe('TTSParamsPanel', () => {render(<TTSParamsPanel {...props} />)// Assert- expect(screen.getByTestId('select-item-voice-0')).toBeInTheDocument()- expect(screen.getByTestId('select-item-voice-19')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('select-item-voice-0'))!.toBeInTheDocument()+ expect(screen.getByTestId('select-item-voice-19'))!.toBeInTheDocument()})it('should handle voice with special characters in mode', () => {@@ -520,7 +591,8 @@ describe('TTSParamsPanel', () => {render(<TTSParamsPanel {...props} />)// Assert- expect(screen.getByTestId('select-item-voice-with_special.chars')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('select-item-voice-with_special.chars'))!.toBeInTheDocument()})it('should handle onChange not being called multiple times', () => {@@ -546,13 +618,13 @@ describe('TTSParamsPanel', () => {// Actconst { rerender } = render(<TTSParamsPanel {...props} />)const values = screen.getAllByTestId('selected-value')- expect(values[0]).toHaveTextContent('en-US')+ expect(values[0])!.toHaveTextContent('en-US')rerender(<TTSParamsPanel {...props} language="zh-Hans" />)// Assertconst updatedValues = screen.getAllByTestId('selected-value')- expect(updatedValues[0]).toHaveTextContent('zh-Hans')+ expect(updatedValues[0])!.toHaveTextContent('zh-Hans')})it('should update when voice prop changes', () => {@@ -562,13 +634,13 @@ describe('TTSParamsPanel', () => {// Actconst { rerender } = render(<TTSParamsPanel {...props} />)const values = screen.getAllByTestId('selected-value')- expect(values[1]).toHaveTextContent('alloy')+ expect(values[1])!.toHaveTextContent('alloy')rerender(<TTSParamsPanel {...props} voice="echo" />)// Assertconst updatedValues = screen.getAllByTestId('selected-value')- expect(updatedValues[1]).toHaveTextContent('echo')+ expect(updatedValues[1])!.toHaveTextContent('echo')})it('should update voice list when currentModel changes', () => {@@ -580,7 +652,7 @@ describe('TTSParamsPanel', () => {// Actconst { rerender } = render(<TTSParamsPanel {...props} />)- expect(screen.getByTestId('select-item-alloy')).toBeInTheDocument()+ expect(screen.getByTestId('select-item-alloy'))!.toBeInTheDocument()expect(screen.queryByTestId('select-item-nova')).not.toBeInTheDocument()const newModel = createCurrentModel([@@ -590,8 +662,9 @@ describe('TTSParamsPanel', () => {rerender(<TTSParamsPanel {...props} currentModel={newModel} />)// Assert- expect(screen.getByTestId('select-item-alloy')).toBeInTheDocument()- expect(screen.getByTestId('select-item-nova')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('select-item-alloy'))!.toBeInTheDocument()+ expect(screen.getByTestId('select-item-nova'))!.toBeInTheDocument()})it('should handle currentModel becoming null', () => {@@ -600,10 +673,41 @@ describe('TTSParamsPanel', () => {// Actconst { rerender } = render(<TTSParamsPanel {...props} />)- expect(screen.getByTestId('select-item-alloy')).toBeInTheDocument()+ expect(screen.getByTestId('select-item-alloy'))!.toBeInTheDocument()rerender(<TTSParamsPanel {...props} currentModel={null} />)+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert// Assertexpect(screen.queryByTestId('select-item-alloy')).not.toBeInTheDocument()})@@ -636,7 +740,7 @@ describe('TTSParamsPanel', () => {// Assertconst languageLabel = screen.getByText('appDebug.voice.voiceSettings.language')- expect(languageLabel).toHaveClass('system-sm-semibold')+ expect(languageLabel)!.toHaveClass('system-sm-semibold')})it('should have proper label structure for voice select', () => {@@ -648,7 +752,7 @@ describe('TTSParamsPanel', () => {// Assertconst voiceLabel = screen.getByText('appDebug.voice.voiceSettings.voice')- expect(voiceLabel).toHaveClass('system-sm-semibold')+ expect(voiceLabel)!.toHaveClass('system-sm-semibold')})})})diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/index.spec.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/index.spec.tsxindex d41dfaa7d0e..19a2d5a9f11 100644--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/index.spec.tsx+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/index.spec.tsx@@ -100,8 +100,8 @@ describe('SubscriptionList', () => {it('should render list view by default', () => {render(<SubscriptionList />)- expect(screen.getByText(/pluginTrigger\.subscription\.listNum/)).toBeInTheDocument()- expect(screen.getByText('Subscription One')).toBeInTheDocument()+ expect(screen.getByText(/pluginTrigger\.subscription\.listNum/))!.toBeInTheDocument()+ expect(screen.getByText('Subscription One'))!.toBeInTheDocument()})it('should render loading state when subscriptions are loading', () => {@@ -112,7 +112,7 @@ describe('SubscriptionList', () => {render(<SubscriptionList />)- expect(screen.getByRole('status')).toBeInTheDocument()+ expect(screen.getByRole('status'))!.toBeInTheDocument()expect(screen.queryByText('Subscription One')).not.toBeInTheDocument()})@@ -121,7 +121,7 @@ describe('SubscriptionList', () => {render(<SubscriptionList pluginDetail={pluginDetail} />)- expect(screen.getByText('Subscription One')).toBeInTheDocument()+ expect(screen.getByText('Subscription One'))!.toBeInTheDocument()})it('should render without list entries when subscriptions are empty', () => {@@ -141,7 +141,7 @@ describe('SubscriptionList', () => {it('should render selector view when mode is selector', () => {render(<SubscriptionList mode={SubscriptionListMode.SELECTOR} />)- expect(screen.getByText('Subscription One')).toBeInTheDocument()+ expect(screen.getByText('Subscription One'))!.toBeInTheDocument()})it('should visually distinguish selected subscription from unselected', () => {@@ -182,7 +182,7 @@ describe('SubscriptionList', () => {fireEvent.click(screen.getByRole('button', { name: 'Subscription One' }))expect(onSelect).toHaveBeenCalledTimes(1)- const [selectedSubscription, callback] = onSelect.mock.calls[0]+ const [selectedSubscription, callback] = (onSelect.mock.calls[0] ?? []) as [any, any]expect(selectedSubscription).toMatchObject({ id: 'sub-1', name: 'Subscription One' })expect(typeof callback).toBe('function')@@ -212,7 +212,7 @@ describe('SubscriptionList', () => {fireEvent.click(deleteButton)expect(onSelect).not.toHaveBeenCalled()- expect(screen.getByText(/pluginTrigger\.subscription\.list\.item\.actions\.deleteConfirm\.title/)).toBeInTheDocument()+ expect(screen.getByText(/pluginTrigger\.subscription\.list\.item\.actions\.deleteConfirm\.title/))!.toBeInTheDocument()})})@@ -222,7 +222,7 @@ describe('SubscriptionList', () => {render(<SubscriptionList />)- expect(await screen.findByText('Something went wrong')).toBeInTheDocument()+ expect(await screen.findByText('Something went wrong'))!.toBeInTheDocument()})})})diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/subscription-card.spec.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/subscription-card.spec.tsxindex 4665c921ca5..19edb65dfbc 100644--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/subscription-card.spec.tsx+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/subscription-card.spec.tsx@@ -62,14 +62,14 @@ describe('SubscriptionCard', () => {it('should render subscription name and endpoint', () => {render(<SubscriptionCard data={createSubscription()} />)- expect(screen.getByText('Subscription One')).toBeInTheDocument()- expect(screen.getByText('https://example.com')).toBeInTheDocument()+ expect(screen.getByText('Subscription One'))!.toBeInTheDocument()+ expect(screen.getByText('https://example.com'))!.toBeInTheDocument()})it('should render used-by text when workflows are present', () => {render(<SubscriptionCard data={createSubscription({ workflows_in_use: 2 })} />)- expect(screen.getByText(/pluginTrigger\.subscription\.list\.item\.usedByNum/)).toBeInTheDocument()+ expect(screen.getByText(/pluginTrigger\.subscription\.list\.item\.usedByNum/))!.toBeInTheDocument()})it('should open delete confirmation when delete action is clicked', () => {@@ -79,15 +79,15 @@ describe('SubscriptionCard', () => {expect(deleteButton).toBeTruthy()fireEvent.click(deleteButton)- expect(screen.getByText(/pluginTrigger\.subscription\.list\.item\.actions\.deleteConfirm\.title/)).toBeInTheDocument()+ expect(screen.getByText(/pluginTrigger\.subscription\.list\.item\.actions\.deleteConfirm\.title/))!.toBeInTheDocument()})it('should open edit modal when edit action is clicked', () => {const { container } = render(<SubscriptionCard data={createSubscription()} />)const editButton = container.querySelectorAll('button')[0]- fireEvent.click(editButton)+ fireEvent.click(editButton!)- expect(screen.getByText(/pluginTrigger\.subscription\.list\.item\.actions\.edit\.title/)).toBeInTheDocument()+ expect(screen.getByText(/pluginTrigger\.subscription\.list\.item\.actions\.edit\.title/))!.toBeInTheDocument()})})diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/__tests__/index.spec.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/__tests__/index.spec.tsxindex a36c108160d..0714fbf5543 100644--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/__tests__/index.spec.tsx+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/__tests__/index.spec.tsx@@ -246,7 +246,8 @@ describe('CreateSubscriptionButton', () => {const { container } = render(<CreateSubscriptionButton {...props} />)// Assert- expect(container).toBeEmptyDOMElement()+ // Assert+ expect(container)!.toBeEmptyDOMElement()})it('should render without crashing when supportedMethods is provided', () => {@@ -260,6 +261,37 @@ describe('CreateSubscriptionButton', () => {// Actconst { container } = render(<CreateSubscriptionButton {...props} />)+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert// Assertexpect(container).not.toBeEmptyDOMElement()})@@ -276,7 +308,8 @@ describe('CreateSubscriptionButton', () => {render(<CreateSubscriptionButton {...props} />)// Assert- expect(screen.getByRole('button')).toBeInTheDocument()+ // Assert+ expect(screen.getByRole('button'))!.toBeInTheDocument()})it('should render icon button when buttonType is ICON_BUTTON', () => {@@ -292,7 +325,7 @@ describe('CreateSubscriptionButton', () => {// Assertconst actionButton = screen.getByTestId('custom-trigger')- expect(actionButton).toBeInTheDocument()+ expect(actionButton)!.toBeInTheDocument()})})@@ -309,7 +342,8 @@ describe('CreateSubscriptionButton', () => {render(<CreateSubscriptionButton {...props} />)// Assert- expect(screen.getByRole('button')).toBeInTheDocument()+ // Assert+ expect(screen.getByRole('button'))!.toBeInTheDocument()})it('should apply shape prop correctly', () => {@@ -324,7 +358,8 @@ describe('CreateSubscriptionButton', () => {render(<CreateSubscriptionButton {...props} />)// Assert- expect(screen.getByTestId('custom-trigger')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('custom-trigger'))!.toBeInTheDocument()})})@@ -348,8 +383,8 @@ describe('CreateSubscriptionButton', () => {// Assertawait waitFor(() => {- expect(screen.getByTestId('common-create-modal')).toBeInTheDocument()- expect(screen.getByTestId('common-create-modal')).toHaveAttribute('data-create-type', SupportedCreationMethods.MANUAL)+ expect(screen.getByTestId('common-create-modal'))!.toBeInTheDocument()+ expect(screen.getByTestId('common-create-modal'))!.toHaveAttribute('data-create-type', SupportedCreationMethods.MANUAL)})})@@ -371,7 +406,7 @@ describe('CreateSubscriptionButton', () => {fireEvent.click(manualOption)await waitFor(() => {- expect(screen.getByTestId('common-create-modal')).toBeInTheDocument()+ expect(screen.getByTestId('common-create-modal'))!.toBeInTheDocument()})// Close modal@@ -403,7 +438,7 @@ describe('CreateSubscriptionButton', () => {// Assertawait waitFor(() => {- expect(screen.getByTestId('oauth-client-modal')).toBeInTheDocument()+ expect(screen.getByTestId('oauth-client-modal'))!.toBeInTheDocument()})})@@ -432,7 +467,7 @@ describe('CreateSubscriptionButton', () => {fireEvent.click(oauthOption)await waitFor(() => {- expect(screen.getByTestId('oauth-client-modal')).toBeInTheDocument()+ expect(screen.getByTestId('oauth-client-modal'))!.toBeInTheDocument()})// Close modal@@ -463,7 +498,7 @@ describe('CreateSubscriptionButton', () => {// Assert - OAuth mode renders with settings button, use getAllByRoleconst buttons = screen.getAllByRole('button')- expect(buttons[0]).toHaveTextContent('pluginTrigger.subscription.createButton.oauth')+ expect(buttons[0])!.toHaveTextContent('pluginTrigger.subscription.createButton.oauth')})it('should display correct button text for APIKEY method', () => {@@ -480,7 +515,8 @@ describe('CreateSubscriptionButton', () => {render(<CreateSubscriptionButton {...props} />)// Assert- expect(screen.getByRole('button')).toHaveTextContent('pluginTrigger.subscription.createButton.apiKey')+ // Assert+ expect(screen.getByRole('button'))!.toHaveTextContent('pluginTrigger.subscription.createButton.apiKey')})it('should display correct button text for MANUAL method', () => {@@ -497,7 +533,8 @@ describe('CreateSubscriptionButton', () => {render(<CreateSubscriptionButton {...props} />)// Assert- expect(screen.getByRole('button')).toHaveTextContent('pluginTrigger.subscription.createButton.manual')+ // Assert+ expect(screen.getByRole('button'))!.toHaveTextContent('pluginTrigger.subscription.createButton.manual')})it('should display default button text when multiple methods are supported', () => {@@ -514,7 +551,8 @@ describe('CreateSubscriptionButton', () => {render(<CreateSubscriptionButton {...props} />)// Assert- expect(screen.getByRole('button')).toHaveTextContent('pluginTrigger.subscription.empty.button')+ // Assert+ expect(screen.getByRole('button'))!.toHaveTextContent('pluginTrigger.subscription.empty.button')})})@@ -535,7 +573,7 @@ describe('CreateSubscriptionButton', () => {// Assertconst customSelect = screen.getByTestId('custom-select')- expect(customSelect).toHaveAttribute('data-options-count', '1')+ expect(customSelect)!.toHaveAttribute('data-options-count', '1')})it('should show all options when all methods are supported', () => {@@ -558,7 +596,7 @@ describe('CreateSubscriptionButton', () => {// Assertconst customSelect = screen.getByTestId('custom-select')- expect(customSelect).toHaveAttribute('data-options-count', '3')+ expect(customSelect)!.toHaveAttribute('data-options-count', '3')})it('should show custom badge when OAuth custom is enabled and configured', () => {@@ -581,7 +619,7 @@ describe('CreateSubscriptionButton', () => {// Assert - Custom badge should appear in the buttonconst buttons = screen.getAllByRole('button')- expect(buttons[0]).toHaveTextContent('plugin.auth.custom')+ expect(buttons[0])!.toHaveTextContent('plugin.auth.custom')})it('should not show custom badge when OAuth custom is not configured', () => {@@ -624,7 +662,7 @@ describe('CreateSubscriptionButton', () => {// Assertconst customSelect = screen.getByTestId('custom-select')- expect(customSelect).toHaveAttribute('data-value', DEFAULT_METHOD)+ expect(customSelect)!.toHaveAttribute('data-value', DEFAULT_METHOD)})it('should set methodType to single method when only one supported', () => {@@ -642,7 +680,7 @@ describe('CreateSubscriptionButton', () => {// Assertconst customSelect = screen.getByTestId('custom-select')- expect(customSelect).toHaveAttribute('data-value', SupportedCreationMethods.MANUAL)+ expect(customSelect)!.toHaveAttribute('data-value', SupportedCreationMethods.MANUAL)})})@@ -669,6 +707,37 @@ describe('CreateSubscriptionButton', () => {const button = screen.getByRole('button')fireEvent.click(button)+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open+ // Assert - modal should not open// Assert - modal should not openexpect(screen.queryByTestId('common-create-modal')).not.toBeInTheDocument()})@@ -689,7 +758,8 @@ describe('CreateSubscriptionButton', () => {fireEvent.click(button)// Assert - modal should open- expect(screen.getByTestId('common-create-modal')).toBeInTheDocument()+ // Assert - modal should open+ expect(screen.getByTestId('common-create-modal'))!.toBeInTheDocument()})it('should not call onChooseCreateType for DEFAULT_METHOD or single OAuth', () => {@@ -707,8 +777,70 @@ describe('CreateSubscriptionButton', () => {render(<CreateSubscriptionButton {...props} />)// For OAuth mode, there are multiple buttons; get the primary button (first one)const buttons = screen.getAllByRole('button')- fireEvent.click(buttons[0])+ fireEvent.click(buttons[0]!)+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open+ // Assert - For single OAuth, should not directly create but wait for dropdown+ // The modal should not immediately open// Assert - For single OAuth, should not directly create but wait for dropdown// The modal should not immediately openexpect(screen.queryByTestId('common-create-modal')).not.toBeInTheDocument()@@ -736,7 +868,7 @@ describe('CreateSubscriptionButton', () => {// Assertawait waitFor(() => {- expect(screen.getByTestId('oauth-client-modal')).toBeInTheDocument()+ expect(screen.getByTestId('oauth-client-modal'))!.toBeInTheDocument()})})@@ -783,8 +915,8 @@ describe('CreateSubscriptionButton', () => {// Assertawait waitFor(() => {- expect(screen.getByTestId('common-create-modal')).toBeInTheDocument()- expect(screen.getByTestId('common-create-modal')).toHaveAttribute('data-create-type', SupportedCreationMethods.APIKEY)+ expect(screen.getByTestId('common-create-modal'))!.toBeInTheDocument()+ expect(screen.getByTestId('common-create-modal'))!.toHaveAttribute('data-create-type', SupportedCreationMethods.APIKEY)})})@@ -807,8 +939,8 @@ describe('CreateSubscriptionButton', () => {// Assertawait waitFor(() => {- expect(screen.getByTestId('common-create-modal')).toBeInTheDocument()- expect(screen.getByTestId('common-create-modal')).toHaveAttribute('data-create-type', SupportedCreationMethods.MANUAL)+ expect(screen.getByTestId('common-create-modal'))!.toBeInTheDocument()+ expect(screen.getByTestId('common-create-modal'))!.toHaveAttribute('data-create-type', SupportedCreationMethods.MANUAL)})})})@@ -831,16 +963,17 @@ describe('CreateSubscriptionButton', () => {// Find the settings div inside the button (p-2 class)const buttons = screen.getAllByRole('button')const primaryButton = buttons[0]- const settingsDiv = primaryButton.querySelector('.p-2')+ const settingsDiv = primaryButton!.querySelector('.p-2')// Assert that settings div exists and click it- expect(settingsDiv).toBeInTheDocument()+ // Assert that settings div exists and click it+ expect(settingsDiv)!.toBeInTheDocument()if (settingsDiv) {fireEvent.click(settingsDiv)// Assertawait waitFor(() => {- expect(screen.getByTestId('oauth-client-modal')).toBeInTheDocument()+ expect(screen.getByTestId('oauth-client-modal'))!.toBeInTheDocument()})}})@@ -860,7 +993,8 @@ describe('CreateSubscriptionButton', () => {render(<CreateSubscriptionButton {...props} />)// Assert - Component renders, which means hook was called- expect(screen.getByTestId('custom-select')).toBeInTheDocument()+ // Assert - Component renders, which means hook was called+ expect(screen.getByTestId('custom-select'))!.toBeInTheDocument()})it('should handle OAuth initiation success', async () => {@@ -908,8 +1042,8 @@ describe('CreateSubscriptionButton', () => {// Assert - modal should open with OAuth type and builderawait waitFor(() => {- expect(screen.getByTestId('common-create-modal')).toBeInTheDocument()- expect(screen.getByTestId('common-create-modal')).toHaveAttribute('data-has-builder', 'true')+ expect(screen.getByTestId('common-create-modal'))!.toBeInTheDocument()+ expect(screen.getByTestId('common-create-modal'))!.toHaveAttribute('data-has-builder', 'true')})})@@ -956,6 +1090,37 @@ describe('CreateSubscriptionButton', () => {// Actconst { container } = render(<CreateSubscriptionButton {...props} />)+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert// Assertexpect(container).not.toBeEmptyDOMElement()})@@ -972,7 +1137,8 @@ describe('CreateSubscriptionButton', () => {render(<CreateSubscriptionButton {...props} />)// Assert - component should still render- expect(screen.getByTestId('custom-select')).toBeInTheDocument()+ // Assert - component should still render+ expect(screen.getByTestId('custom-select'))!.toBeInTheDocument()})it('should handle empty oauthConfig gracefully', () => {@@ -990,7 +1156,8 @@ describe('CreateSubscriptionButton', () => {render(<CreateSubscriptionButton {...props} />)// Assert- expect(screen.getByTestId('custom-select')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('custom-select'))!.toBeInTheDocument()})it('should show max count tooltip when subscriptions reach limit', () => {@@ -1010,7 +1177,8 @@ describe('CreateSubscriptionButton', () => {render(<CreateSubscriptionButton {...props} />)// Assert - ActionButton should be in disabled state- expect(screen.getByTestId('custom-trigger')).toBeInTheDocument()+ // Assert - ActionButton should be in disabled state+ expect(screen.getByTestId('custom-trigger'))!.toBeInTheDocument()})it('should handle showOAuthCreateModal callback from OAuthClientSettingsModal', async () => {@@ -1032,7 +1200,7 @@ describe('CreateSubscriptionButton', () => {fireEvent.click(oauthOption)await waitFor(() => {- expect(screen.getByTestId('oauth-client-modal')).toBeInTheDocument()+ expect(screen.getByTestId('oauth-client-modal'))!.toBeInTheDocument()})// Click show create modal button@@ -1040,9 +1208,9 @@ describe('CreateSubscriptionButton', () => {// Assert - CommonCreateModal should be shown with OAuth type and builderawait waitFor(() => {- expect(screen.getByTestId('common-create-modal')).toBeInTheDocument()- expect(screen.getByTestId('common-create-modal')).toHaveAttribute('data-create-type', SupportedCreationMethods.OAUTH)- expect(screen.getByTestId('common-create-modal')).toHaveAttribute('data-has-builder', 'true')+ expect(screen.getByTestId('common-create-modal'))!.toBeInTheDocument()+ expect(screen.getByTestId('common-create-modal'))!.toHaveAttribute('data-create-type', SupportedCreationMethods.OAUTH)+ expect(screen.getByTestId('common-create-modal'))!.toHaveAttribute('data-has-builder', 'true')})})})@@ -1066,8 +1234,8 @@ describe('CreateSubscriptionButton', () => {// Assert - settings icon should be present in button, OAuth mode has multiple buttonsconst buttons = screen.getAllByRole('button')const primaryButton = buttons[0]- const settingsDiv = primaryButton.querySelector('.p-2')- expect(settingsDiv).toBeInTheDocument()+ const settingsDiv = primaryButton!.querySelector('.p-2')+ expect(settingsDiv)!.toBeInTheDocument()})it('should not render settings icon for non-OAuth methods', () => {@@ -1106,7 +1274,8 @@ describe('CreateSubscriptionButton', () => {render(<CreateSubscriptionButton {...props} />)// Assert - icon button should exist- expect(screen.getByTestId('custom-trigger')).toBeInTheDocument()+ // Assert - icon button should exist+ expect(screen.getByTestId('custom-trigger'))!.toBeInTheDocument()})it('should apply circle shape class when shape is circle', () => {@@ -1123,7 +1292,8 @@ describe('CreateSubscriptionButton', () => {render(<CreateSubscriptionButton {...props} />)// Assert- expect(screen.getByTestId('custom-trigger')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('custom-trigger'))!.toBeInTheDocument()})})@@ -1181,7 +1351,7 @@ describe('CreateSubscriptionButton', () => {// Assert - for single non-OAuth, dropdown should be disabled (open = false)const customSelect = screen.getByTestId('custom-select')- expect(customSelect).toHaveAttribute('data-container-open', 'false')+ expect(customSelect)!.toHaveAttribute('data-container-open', 'false')})})@@ -1202,7 +1372,7 @@ describe('CreateSubscriptionButton', () => {// Assertconst button = screen.getByRole('button')- expect(button).toHaveClass('w-full')+ expect(button)!.toHaveClass('w-full')})it('should render icon button with float-right class', () => {@@ -1219,7 +1389,8 @@ describe('CreateSubscriptionButton', () => {render(<CreateSubscriptionButton {...props} />)// Assert- expect(screen.getByTestId('custom-trigger')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('custom-trigger'))!.toBeInTheDocument()})})@@ -1265,7 +1436,7 @@ describe('CreateSubscriptionButton', () => {// Assertawait waitFor(() => {const modal = screen.getByTestId('common-create-modal')- expect(modal).toHaveAttribute('data-create-type', SupportedCreationMethods.MANUAL)+ expect(modal)!.toHaveAttribute('data-create-type', SupportedCreationMethods.MANUAL)})})@@ -1289,7 +1460,7 @@ describe('CreateSubscriptionButton', () => {// Assertawait waitFor(() => {const modal = screen.getByTestId('common-create-modal')- expect(modal).toHaveAttribute('data-create-type', SupportedCreationMethods.APIKEY)+ expect(modal)!.toHaveAttribute('data-create-type', SupportedCreationMethods.APIKEY)})})@@ -1339,7 +1510,7 @@ describe('CreateSubscriptionButton', () => {// Assertawait waitFor(() => {const modal = screen.getByTestId('common-create-modal')- expect(modal).toHaveAttribute('data-has-builder', 'true')+ expect(modal)!.toHaveAttribute('data-has-builder', 'true')})})})@@ -1368,7 +1539,7 @@ describe('CreateSubscriptionButton', () => {// Assertawait waitFor(() => {const modal = screen.getByTestId('oauth-client-modal')- expect(modal).toHaveAttribute('data-has-config', 'true')+ expect(modal)!.toHaveAttribute('data-has-config', 'true')})})@@ -1397,7 +1568,7 @@ describe('CreateSubscriptionButton', () => {fireEvent.click(oauthOption)await waitFor(() => {- expect(screen.getByTestId('oauth-client-modal')).toBeInTheDocument()+ expect(screen.getByTestId('oauth-client-modal'))!.toBeInTheDocument()})// Close modal@@ -1428,7 +1599,7 @@ describe('CreateSubscriptionButton', () => {fireEvent.click(oauthOption)await waitFor(() => {- expect(screen.getByTestId('oauth-client-modal')).toBeInTheDocument()+ expect(screen.getByTestId('oauth-client-modal'))!.toBeInTheDocument()})// Click showOAuthCreateModal button@@ -1436,9 +1607,9 @@ describe('CreateSubscriptionButton', () => {// Assert - CommonCreateModal should appear with OAuth type and builderawait waitFor(() => {- expect(screen.getByTestId('common-create-modal')).toBeInTheDocument()- expect(screen.getByTestId('common-create-modal')).toHaveAttribute('data-create-type', SupportedCreationMethods.OAUTH)- expect(screen.getByTestId('common-create-modal')).toHaveAttribute('data-has-builder', 'true')+ expect(screen.getByTestId('common-create-modal'))!.toBeInTheDocument()+ expect(screen.getByTestId('common-create-modal'))!.toHaveAttribute('data-create-type', SupportedCreationMethods.OAUTH)+ expect(screen.getByTestId('common-create-modal'))!.toHaveAttribute('data-has-builder', 'true')})})})@@ -1513,7 +1684,9 @@ describe('CreateSubscriptionButton', () => {// The methodType will be DEFAULT_METHOD since multiple methods// This verifies the render doesn't crash with multiple methods- expect(screen.getByTestId('custom-select')).toHaveAttribute('data-value', 'default')+ // The methodType will be DEFAULT_METHOD since multiple methods+ // This verifies the render doesn't crash with multiple methods+ expect(screen.getByTestId('custom-select'))!.toHaveAttribute('data-value', 'default')})})@@ -1534,7 +1707,8 @@ describe('CreateSubscriptionButton', () => {render(<CreateSubscriptionButton {...props} />)// Assert - tooltip should be enabled (disabled prop = false for single method)- expect(screen.getByTestId('custom-trigger')).toBeInTheDocument()+ // Assert - tooltip should be enabled (disabled prop = false for single method)+ expect(screen.getByTestId('custom-trigger'))!.toBeInTheDocument()})it('should disable tooltip when multiple methods and not at max count', () => {@@ -1552,7 +1726,8 @@ describe('CreateSubscriptionButton', () => {render(<CreateSubscriptionButton {...props} />)// Assert - tooltip should be disabled (neither single method nor at max)- expect(screen.getByTestId('custom-trigger')).toBeInTheDocument()+ // Assert - tooltip should be disabled (neither single method nor at max)+ expect(screen.getByTestId('custom-trigger'))!.toBeInTheDocument()})})@@ -1574,7 +1749,8 @@ describe('CreateSubscriptionButton', () => {render(<CreateSubscriptionButton {...props} />)// Assert - component renders with max subscriptions- expect(screen.getByTestId('custom-trigger')).toBeInTheDocument()+ // Assert - component renders with max subscriptions+ expect(screen.getByTestId('custom-trigger'))!.toBeInTheDocument()})it('should show method description when not at max', () => {@@ -1592,7 +1768,8 @@ describe('CreateSubscriptionButton', () => {render(<CreateSubscriptionButton {...props} />)// Assert - component renders without max subscriptions- expect(screen.getByTestId('custom-trigger')).toBeInTheDocument()+ // Assert - component renders without max subscriptions+ expect(screen.getByTestId('custom-trigger'))!.toBeInTheDocument()})})@@ -1613,7 +1790,8 @@ describe('CreateSubscriptionButton', () => {const { container } = render(<CreateSubscriptionButton {...props} />)// Assert - should render null when supported methods fallback to empty- expect(container).toBeEmptyDOMElement()+ // Assert - should render null when supported methods fallback to empty+ expect(container)!.toBeEmptyDOMElement()})it('should handle providerInfo with null supported_creation_methods', () => {@@ -1627,7 +1805,8 @@ describe('CreateSubscriptionButton', () => {const { container } = render(<CreateSubscriptionButton {...props} />)// Assert - should render null- expect(container).toBeEmptyDOMElement()+ // Assert - should render null+ expect(container)!.toBeEmptyDOMElement()})})@@ -1648,7 +1827,7 @@ describe('CreateSubscriptionButton', () => {// Assertconst customSelect = screen.getByTestId('custom-select')- expect(customSelect).toHaveAttribute('data-value', SupportedCreationMethods.APIKEY)+ expect(customSelect)!.toHaveAttribute('data-value', SupportedCreationMethods.APIKEY)})})})diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/__tests__/use-oauth-client-state.spec.ts b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/__tests__/use-oauth-client-state.spec.tsindex 68864b0b805..cebfc947e7c 100644--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/__tests__/use-oauth-client-state.spec.ts+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/__tests__/use-oauth-client-state.spec.ts@@ -194,8 +194,8 @@ describe('useOAuthClientState', () => {}))expect(result.current.oauthClientSchema).toHaveLength(2)- expect(result.current.oauthClientSchema[0].default).toBe('my-client-id')- expect(result.current.oauthClientSchema[1].default).toBe('my-secret')+ expect(result.current.oauthClientSchema[0]!.default).toBe('my-client-id')+ expect(result.current.oauthClientSchema[1]!.default).toBe('my-secret')})it('should return empty array when oauth_client_schema is empty', () => {@@ -239,9 +239,9 @@ describe('useOAuthClientState', () => {}))// client_id should be overridden- expect(result.current.oauthClientSchema[0].default).toBe('only-client-id')+ expect(result.current.oauthClientSchema[0]!.default).toBe('only-client-id')// extra_field should keep original default since key not in params- expect(result.current.oauthClientSchema[1].default).toBe('extra-default')+ expect(result.current.oauthClientSchema[1]!.default).toBe('extra-default')})})diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-common-modal-state.ts b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-common-modal-state.tsindex e55f9525fe5..29613c6f4fe 100644--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-common-modal-state.ts+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/hooks/use-common-modal-state.ts@@ -202,7 +202,7 @@ export const useCommonModalState = ({if (!apiKeyCredentialsSchema.length)returnapiKeyCredentialsFormRef.current?.setFields([{- name: apiKeyCredentialsSchema[0].name,+ name: apiKeyCredentialsSchema[0]!.name,errors: [],}])}, [apiKeyCredentialsSchema])diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/index.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/index.tsxindex 73b28bd60e9..4861f309348 100644--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/index.tsx+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/index.tsx@@ -137,7 +137,7 @@ export const CreateSubscriptionButton = ({ buttonType = CreateButtonType.FULL_BUe.stopPropagation()e.preventDefault()- onChooseCreateType(methodType)+ onChooseCreateType(methodType!)}if (!supportedMethods.length)@@ -172,7 +172,7 @@ export const CreateSubscriptionButton = ({ buttonType = CreateButtonType.FULL_BU><div className="flex flex-1 items-center justify-center"><RiAddLine className="mr-2 size-4" />- {buttonTextMap[methodType]}+ {buttonTextMap[methodType!]}{methodType === SupportedCreationMethods.OAUTH && oauthConfig?.custom_enabled && oauthConfig?.custom_configured && (<BadgeclassName="mr-0.5 ml-1 border-text-primary-on-surface bg-components-badge-bg-dimm text-text-primary-on-surface"@@ -196,7 +196,7 @@ export const CreateSubscriptionButton = ({ buttonType = CreateButtonType.FULL_BU): (<Tooltip- popupContent={subscriptionCount >= MAX_COUNT ? t('subscription.maxCount', { ns: 'pluginTrigger', num: MAX_COUNT }) : t(`subscription.addType.options.${methodType.toLowerCase() as Lowercase<SupportedCreationMethods>}.description`, { ns: 'pluginTrigger' })}+ popupContent={subscriptionCount >= MAX_COUNT ? t('subscription.maxCount', { ns: 'pluginTrigger', num: MAX_COUNT }) : t(`subscription.addType.options.${methodType!.toLowerCase() as Lowercase<SupportedCreationMethods>}.description`, { ns: 'pluginTrigger' })}disabled={!(supportedMethods?.length === 1 || subscriptionCount >= MAX_COUNT)}><ActionButtondiff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/reasoning-config-form.helpers.ts b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/reasoning-config-form.helpers.tsindex 86e42aab6b3..6316441f1c6 100644--- a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/reasoning-config-form.helpers.ts+++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/reasoning-config-form.helpers.ts@@ -112,7 +112,7 @@ export const updateVariableTypeValue = (defaultValue: unknown,) => {return produce(value, (draft) => {- draft[variable].value = {+ draft[variable]!.value = {type: newType,value: newType === VarKindType.variable ? '' : defaultValue,}@@ -126,7 +126,7 @@ export const updateReasoningValue = (newValue: unknown,) => {return produce(value, (draft) => {- draft[variable].value = {+ draft[variable]!.value = {type: getVarKindType(type),value: newValue,}@@ -139,8 +139,8 @@ export const mergeReasoningValue = (newValue: Record<string, unknown>,) => {return produce(value, (draft) => {- const currentValue = draft[variable].value as Record<string, unknown> | undefined- draft[variable].value = {+ const currentValue = draft[variable]!.value as Record<string, unknown> | undefined+ draft[variable]!.value = {...currentValue,...newValue,}@@ -153,7 +153,7 @@ export const updateVariableSelectorValue = (newValue: ValueSelector | string,) => {return produce(value, (draft) => {- draft[variable].value = {+ draft[variable]!.value = {type: VarKindType.variable,value: newValue,}diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/reasoning-config-form.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/reasoning-config-form.tsxindex 8a3642d043d..4e6be7d81ca 100644--- a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/reasoning-config-form.tsx+++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/reasoning-config-form.tsx@@ -137,7 +137,7 @@ const ReasoningConfigForm: React.FC<Props> = ({asChild={false}/>))- const varInput = value[variable].value+ const varInput = value[variable]!.valueconst {isString,isNumber,@@ -179,7 +179,7 @@ const ReasoningConfigForm: React.FC<Props> = ({><divclassName="ml-0.5 cursor-pointer rounded-sm p-px text-text-tertiary hover:bg-state-base-hover hover:text-text-secondary"- onClick={() => showSchema(input_schema as SchemaRoot, fieldTitle)}+ onClick={() => showSchema(input_schema as SchemaRoot, fieldTitle!)}><RiBracesLine className="size-3.5" /></div>diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/hooks/__tests__/use-tool-selector-state.spec.ts b/web/app/components/plugins/plugin-detail-panel/tool-selector/hooks/__tests__/use-tool-selector-state.spec.tsindex 5af624649c7..dff369c9690 100644--- a/web/app/components/plugins/plugin-detail-panel/tool-selector/hooks/__tests__/use-tool-selector-state.spec.ts+++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/hooks/__tests__/use-tool-selector-state.spec.ts@@ -112,11 +112,11 @@ describe('useToolSelectorState', () => {// param2 has form='form' (not 'llm'), so it goes to settingsexpect(result.current.currentToolSettings).toHaveLength(1)- expect(result.current.currentToolSettings[0].name).toBe('param2')+ expect(result.current.currentToolSettings[0]!.name).toBe('param2')// param1 has form='llm', so it goes to paramsexpect(result.current.currentToolParams).toHaveLength(1)- expect(result.current.currentToolParams[0].name).toBe('param1')+ expect(result.current.currentToolParams[0]!.name).toBe('param1')})it('should show tab slider when both settings and params exist', () => {diff --git a/web/app/components/plugins/plugin-detail-panel/trigger/__tests__/event-detail-drawer.spec.tsx b/web/app/components/plugins/plugin-detail-panel/trigger/__tests__/event-detail-drawer.spec.tsxindex a04aba3e570..77b77c0302f 100644--- a/web/app/components/plugins/plugin-detail-panel/trigger/__tests__/event-detail-drawer.spec.tsx+++ b/web/app/components/plugins/plugin-detail-panel/trigger/__tests__/event-detail-drawer.spec.tsx@@ -91,45 +91,45 @@ describe('EventDetailDrawer', () => {it('should render drawer', () => {render(<EventDetailDrawer eventInfo={mockEventInfo} providerInfo={mockProviderInfo} onClose={mockOnClose} />)- expect(screen.getByRole('dialog')).toBeInTheDocument()+ expect(screen.getByRole('dialog'))!.toBeInTheDocument()})it('should render event title', () => {render(<EventDetailDrawer eventInfo={mockEventInfo} providerInfo={mockProviderInfo} onClose={mockOnClose} />)- expect(screen.getByText('Test Event')).toBeInTheDocument()+ expect(screen.getByText('Test Event'))!.toBeInTheDocument()})it('should render event description', () => {render(<EventDetailDrawer eventInfo={mockEventInfo} providerInfo={mockProviderInfo} onClose={mockOnClose} />)- expect(screen.getByTestId('description')).toHaveTextContent('Test event description')+ expect(screen.getByTestId('description'))!.toHaveTextContent('Test event description')})it('should render org info', () => {render(<EventDetailDrawer eventInfo={mockEventInfo} providerInfo={mockProviderInfo} onClose={mockOnClose} />)- expect(screen.getByTestId('org-info')).toBeInTheDocument()+ expect(screen.getByTestId('org-info'))!.toBeInTheDocument()})it('should render parameters section', () => {render(<EventDetailDrawer eventInfo={mockEventInfo} providerInfo={mockProviderInfo} onClose={mockOnClose} />)- expect(screen.getByText('tools.setBuiltInTools.parameters')).toBeInTheDocument()- expect(screen.getByText('Parameter 1')).toBeInTheDocument()+ expect(screen.getByText('tools.setBuiltInTools.parameters'))!.toBeInTheDocument()+ expect(screen.getByText('Parameter 1'))!.toBeInTheDocument()})it('should render output section', () => {render(<EventDetailDrawer eventInfo={mockEventInfo} providerInfo={mockProviderInfo} onClose={mockOnClose} />)- expect(screen.getByText('pluginTrigger.events.output')).toBeInTheDocument()- expect(screen.getByTestId('output-field')).toHaveTextContent('result')+ expect(screen.getByText('pluginTrigger.events.output'))!.toBeInTheDocument()+ expect(screen.getByTestId('output-field'))!.toHaveTextContent('result')})it('should render back button', () => {render(<EventDetailDrawer eventInfo={mockEventInfo} providerInfo={mockProviderInfo} onClose={mockOnClose} />)- expect(screen.getByText('plugin.detailPanel.operation.back')).toBeInTheDocument()+ expect(screen.getByText('plugin.detailPanel.operation.back'))!.toBeInTheDocument()})})@@ -159,14 +159,14 @@ describe('EventDetailDrawer', () => {const eventWithNoParams = { ...mockEventInfo, parameters: [] }render(<EventDetailDrawer eventInfo={eventWithNoParams} providerInfo={mockProviderInfo} onClose={mockOnClose} />)- expect(screen.getByText('pluginTrigger.events.item.noParameters')).toBeInTheDocument()+ expect(screen.getByText('pluginTrigger.events.item.noParameters'))!.toBeInTheDocument()})it('should handle no output schema', () => {const eventWithNoOutput = { ...mockEventInfo, output_schema: {} }render(<EventDetailDrawer eventInfo={eventWithNoOutput} providerInfo={mockProviderInfo} onClose={mockOnClose} />)- expect(screen.getByText('pluginTrigger.events.output')).toBeInTheDocument()+ expect(screen.getByText('pluginTrigger.events.output'))!.toBeInTheDocument()expect(screen.queryByTestId('output-field')).not.toBeInTheDocument()})})@@ -175,41 +175,41 @@ describe('EventDetailDrawer', () => {it('should display correct type for number-input', () => {const eventWithNumber = {...mockEventInfo,- parameters: [{ ...mockEventInfo.parameters[0], type: 'number-input' }],+ parameters: [{ ...mockEventInfo.parameters[0]!, type: 'number-input' }],}render(<EventDetailDrawer eventInfo={eventWithNumber} providerInfo={mockProviderInfo} onClose={mockOnClose} />)- expect(screen.getByText('tools.setBuiltInTools.number')).toBeInTheDocument()+ expect(screen.getByText('tools.setBuiltInTools.number'))!.toBeInTheDocument()})it('should display correct type for checkbox', () => {const eventWithCheckbox = {...mockEventInfo,- parameters: [{ ...mockEventInfo.parameters[0], type: 'checkbox' }],+ parameters: [{ ...mockEventInfo.parameters[0]!, type: 'checkbox' }],}render(<EventDetailDrawer eventInfo={eventWithCheckbox} providerInfo={mockProviderInfo} onClose={mockOnClose} />)- expect(screen.getByText('boolean')).toBeInTheDocument()+ expect(screen.getByText('boolean'))!.toBeInTheDocument()})it('should display correct type for file', () => {const eventWithFile = {...mockEventInfo,- parameters: [{ ...mockEventInfo.parameters[0], type: 'file' }],+ parameters: [{ ...mockEventInfo.parameters[0]!, type: 'file' }],}render(<EventDetailDrawer eventInfo={eventWithFile} providerInfo={mockProviderInfo} onClose={mockOnClose} />)- expect(screen.getByText('tools.setBuiltInTools.file')).toBeInTheDocument()+ expect(screen.getByText('tools.setBuiltInTools.file'))!.toBeInTheDocument()})it('should display original type for unknown types', () => {const eventWithUnknown = {...mockEventInfo,- parameters: [{ ...mockEventInfo.parameters[0], type: 'custom-type' }],+ parameters: [{ ...mockEventInfo.parameters[0]!, type: 'custom-type' }],}render(<EventDetailDrawer eventInfo={eventWithUnknown} providerInfo={mockProviderInfo} onClose={mockOnClose} />)- expect(screen.getByText('custom-type')).toBeInTheDocument()+ expect(screen.getByText('custom-type'))!.toBeInTheDocument()})})@@ -226,7 +226,7 @@ describe('EventDetailDrawer', () => {}render(<EventDetailDrawer eventInfo={eventWithArrayOutput} providerInfo={mockProviderInfo} onClose={mockOnClose} />)- expect(screen.getByText('pluginTrigger.events.output')).toBeInTheDocument()+ expect(screen.getByText('pluginTrigger.events.output'))!.toBeInTheDocument()})it('should handle nested properties in output schema', () => {@@ -245,7 +245,7 @@ describe('EventDetailDrawer', () => {}render(<EventDetailDrawer eventInfo={eventWithNestedOutput} providerInfo={mockProviderInfo} onClose={mockOnClose} />)- expect(screen.getByText('pluginTrigger.events.output')).toBeInTheDocument()+ expect(screen.getByText('pluginTrigger.events.output'))!.toBeInTheDocument()})it('should handle enum in output schema', () => {@@ -260,7 +260,7 @@ describe('EventDetailDrawer', () => {}render(<EventDetailDrawer eventInfo={eventWithEnumOutput} providerInfo={mockProviderInfo} onClose={mockOnClose} />)- expect(screen.getByText('pluginTrigger.events.output')).toBeInTheDocument()+ expect(screen.getByText('pluginTrigger.events.output'))!.toBeInTheDocument()})it('should handle array type schema', () => {@@ -275,7 +275,7 @@ describe('EventDetailDrawer', () => {}render(<EventDetailDrawer eventInfo={eventWithArrayType} providerInfo={mockProviderInfo} onClose={mockOnClose} />)- expect(screen.getByText('pluginTrigger.events.output')).toBeInTheDocument()+ expect(screen.getByText('pluginTrigger.events.output'))!.toBeInTheDocument()})})})diff --git a/web/app/components/plugins/plugin-detail-panel/trigger/event-detail-drawer.tsx b/web/app/components/plugins/plugin-detail-panel/trigger/event-detail-drawer.tsxindex bacb7bbd66f..eb56a0178c2 100644--- a/web/app/components/plugins/plugin-detail-panel/trigger/event-detail-drawer.tsx+++ b/web/app/components/plugins/plugin-detail-panel/trigger/event-detail-drawer.tsx@@ -112,7 +112,7 @@ export const EventDetailDrawer: FC<EventDetailDrawerProps> = (props) => {/></div><div className="mt-1 system-md-semibold text-text-primary">{eventInfo?.identity?.label[language]}</div>- <Description className="mt-3 mb-2 h-auto" text={eventInfo.description[language]} descriptionLineRows={2}></Description>+ <Description className="mt-3 mb-2 h-auto" text={eventInfo.description[language]!} descriptionLineRows={2}></Description></div><div className="flex h-full flex-col gap-2 overflow-y-auto px-4 pt-4 pb-2"><div className="system-sm-semibold-uppercase text-text-secondary">{t('setBuiltInTools.parameters', { ns: 'tools' })}</div>diff --git a/web/app/components/plugins/plugin-item/__tests__/action.spec.tsx b/web/app/components/plugins/plugin-item/__tests__/action.spec.tsxindex 82c4d69d1b6..0b0d9c7fc81 100644--- a/web/app/components/plugins/plugin-item/__tests__/action.spec.tsx+++ b/web/app/components/plugins/plugin-item/__tests__/action.spec.tsx@@ -253,10 +253,11 @@ describe('Action Component', () => {// Actrender(<Action {...props} />)- fireEvent.click(getActionButtons()[0])+ fireEvent.click(getActionButtons()[0]!)// Assert- expect(screen.getByText('plugin.action.delete')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('plugin.action.delete'))!.toBeInTheDocument()})it('should display plugin name in delete confirm content', () => {@@ -270,10 +271,11 @@ describe('Action Component', () => {// Actrender(<Action {...props} />)- fireEvent.click(getActionButtons()[0])+ fireEvent.click(getActionButtons()[0]!)// Assert- expect(screen.getByText('my-awesome-plugin')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('my-awesome-plugin'))!.toBeInTheDocument()})it('should hide confirm modal when cancel is clicked', () => {@@ -286,8 +288,8 @@ describe('Action Component', () => {// Actrender(<Action {...props} />)- fireEvent.click(getActionButtons()[0])- expect(screen.getByText('plugin.action.delete')).toBeInTheDocument()+ fireEvent.click(getActionButtons()[0]!)+ expect(screen.getByText('plugin.action.delete'))!.toBeInTheDocument()fireEvent.click(getDeleteCancelButton())@@ -308,7 +310,7 @@ describe('Action Component', () => {// Actrender(<Action {...props} />)- fireEvent.click(getActionButtons()[0])+ fireEvent.click(getActionButtons()[0]!)fireEvent.click(getDeleteConfirmButton())// Assert@@ -330,7 +332,7 @@ describe('Action Component', () => {// Actrender(<Action {...props} />)- fireEvent.click(getActionButtons()[0])+ fireEvent.click(getActionButtons()[0]!)fireEvent.click(getDeleteConfirmButton())// Assert@@ -352,7 +354,7 @@ describe('Action Component', () => {// Actrender(<Action {...props} />)- fireEvent.click(getActionButtons()[0])+ fireEvent.click(getActionButtons()[0]!)fireEvent.click(getDeleteConfirmButton())// Assert@@ -374,7 +376,7 @@ describe('Action Component', () => {// Actrender(<Action {...props} />)- fireEvent.click(getActionButtons()[0])+ fireEvent.click(getActionButtons()[0]!)fireEvent.click(getDeleteConfirmButton())// Assert@@ -401,12 +403,12 @@ describe('Action Component', () => {// Actrender(<Action {...props} />)- fireEvent.click(getActionButtons()[0])+ fireEvent.click(getActionButtons()[0]!)fireEvent.click(getDeleteConfirmButton())// Assert - Loading stateawait waitFor(() => {- expect(getDeleteConfirmButton()).toBeDisabled()+ expect(getDeleteConfirmButton())!.toBeDisabled()})// Resolve and check modal closes@@ -434,13 +436,14 @@ describe('Action Component', () => {// Actrender(<Action {...props} />)- fireEvent.click(getActionButtons()[0])+ fireEvent.click(getActionButtons()[0]!)// Assert- expect(screen.getByTestId('plugin-info-modal')).toBeInTheDocument()- expect(screen.getByTestId('plugin-info-modal')).toHaveAttribute('data-repo', 'owner/repo-name')- expect(screen.getByTestId('plugin-info-modal')).toHaveAttribute('data-release', '2.0.0')- expect(screen.getByTestId('plugin-info-modal')).toHaveAttribute('data-package', 'my-package.difypkg')+ // Assert+ expect(screen.getByTestId('plugin-info-modal'))!.toBeInTheDocument()+ expect(screen.getByTestId('plugin-info-modal'))!.toHaveAttribute('data-repo', 'owner/repo-name')+ expect(screen.getByTestId('plugin-info-modal'))!.toHaveAttribute('data-release', '2.0.0')+ expect(screen.getByTestId('plugin-info-modal'))!.toHaveAttribute('data-package', 'my-package.difypkg')})it('should hide plugin info modal when close is clicked', () => {@@ -453,11 +456,42 @@ describe('Action Component', () => {// Actrender(<Action {...props} />)- fireEvent.click(getActionButtons()[0])- expect(screen.getByTestId('plugin-info-modal')).toBeInTheDocument()+ fireEvent.click(getActionButtons()[0]!)+ expect(screen.getByTestId('plugin-info-modal'))!.toBeInTheDocument()fireEvent.click(screen.getByTestId('close-plugin-info'))+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert// Assertexpect(screen.queryByTestId('plugin-info-modal')).not.toBeInTheDocument()})@@ -481,7 +515,7 @@ describe('Action Component', () => {// Actrender(<Action {...props} />)- fireEvent.click(getActionButtons()[0])+ fireEvent.click(getActionButtons()[0]!)// Assertawait waitFor(() => {@@ -507,7 +541,7 @@ describe('Action Component', () => {// Actrender(<Action {...props} />)- fireEvent.click(getActionButtons()[0])+ fireEvent.click(getActionButtons()[0]!)// Assertawait waitFor(() => {@@ -526,7 +560,7 @@ describe('Action Component', () => {// Actrender(<Action {...props} />)- fireEvent.click(getActionButtons()[0])+ fireEvent.click(getActionButtons()[0]!)// Assertawait waitFor(() => {@@ -550,7 +584,7 @@ describe('Action Component', () => {// Actrender(<Action {...props} />)- fireEvent.click(getActionButtons()[0])+ fireEvent.click(getActionButtons()[0]!)// Assert - toast is called with the translated payloadawait waitFor(() => {@@ -581,7 +615,7 @@ describe('Action Component', () => {// Actrender(<Action {...props} />)- fireEvent.click(getActionButtons()[0])+ fireEvent.click(getActionButtons()[0]!)// Assertawait waitFor(() => {@@ -621,7 +655,7 @@ describe('Action Component', () => {// Actrender(<Action {...props} />)- fireEvent.click(getActionButtons()[0])+ fireEvent.click(getActionButtons()[0]!)// Wait for modal to be calledawait waitFor(() => {@@ -629,7 +663,7 @@ describe('Action Component', () => {})// Invoke the callback- const call = mockSetShowUpdatePluginModal.mock.calls[0][0]+ const call = mockSetShowUpdatePluginModal.mock.calls[0]![0]call.onSaveCallback()// Assert@@ -653,7 +687,7 @@ describe('Action Component', () => {// Actrender(<Action {...props} />)- fireEvent.click(getActionButtons()[0])+ fireEvent.click(getActionButtons()[0]!)// Assertawait waitFor(() => {@@ -678,7 +712,7 @@ describe('Action Component', () => {// Act - First render and deleteconst { rerender } = render(<Action {...props} />)- fireEvent.click(getActionButtons()[0])+ fireEvent.click(getActionButtons()[0]!)fireEvent.click(getDeleteConfirmButton())await waitFor(() => {@@ -688,7 +722,7 @@ describe('Action Component', () => {// Re-render with same propsmockUninstallPlugin.mockClear()rerender(<Action {...props} />)- fireEvent.click(getActionButtons()[0])+ fireEvent.click(getActionButtons()[0]!)fireEvent.click(getDeleteConfirmButton())await waitFor(() => {@@ -714,7 +748,7 @@ describe('Action Component', () => {// Actconst { rerender } = render(<Action {...props1} />)- fireEvent.click(getActionButtons()[0])+ fireEvent.click(getActionButtons()[0]!)fireEvent.click(getDeleteConfirmButton())await waitFor(() => {@@ -723,7 +757,7 @@ describe('Action Component', () => {mockUninstallPlugin.mockClear()rerender(<Action {...props2} />)- fireEvent.click(getActionButtons()[0])+ fireEvent.click(getActionButtons()[0]!)fireEvent.click(getDeleteConfirmButton())await waitFor(() => {@@ -751,7 +785,7 @@ describe('Action Component', () => {// Actconst { rerender } = render(<Action {...props1} />)- fireEvent.click(getActionButtons()[0])+ fireEvent.click(getActionButtons()[0]!)fireEvent.click(getDeleteConfirmButton())await waitFor(() => {@@ -760,7 +794,7 @@ describe('Action Component', () => {expect(onDelete2).not.toHaveBeenCalled()rerender(<Action {...props2} />)- fireEvent.click(getActionButtons()[0])+ fireEvent.click(getActionButtons()[0]!)fireEvent.click(getDeleteConfirmButton())await waitFor(() => {@@ -802,7 +836,7 @@ describe('Action Component', () => {// Actrender(<Action {...props} />)- fireEvent.click(getActionButtons()[0])+ fireEvent.click(getActionButtons()[0]!)// Assert - Should use author and pluginName as fallbackawait waitFor(() => {@@ -826,11 +860,12 @@ describe('Action Component', () => {// Actrender(<Action {...props} />)- fireEvent.click(getActionButtons()[0])+ fireEvent.click(getActionButtons()[0]!)fireEvent.click(getDeleteConfirmButton())// The confirm button should be disabled during deletion- expect(getDeleteConfirmButton()).toBeDisabled()+ // The confirm button should be disabled during deletion+ expect(getDeleteConfirmButton())!.toBeDisabled()// Resolve the deletionresolveFirst!({ success: true })@@ -851,10 +886,11 @@ describe('Action Component', () => {// Actrender(<Action {...props} />)- fireEvent.click(getActionButtons()[0])+ fireEvent.click(getActionButtons()[0]!)// Assert- expect(screen.getByText('plugin-with-special@chars#123')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('plugin-with-special@chars#123'))!.toBeInTheDocument()})})diff --git a/web/app/components/plugins/plugin-item/index.tsx b/web/app/components/plugins/plugin-item/index.tsxindex ad03c002d84..0f19db81e60 100644--- a/web/app/components/plugins/plugin-item/index.tsx+++ b/web/app/components/plugins/plugin-item/index.tsx@@ -105,7 +105,7 @@ const PluginItem: FC<Props> = ({}}><div className={cn('hover-bg-components-panel-on-panel-item-bg relative z-10 rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-on-panel-item-bg p-4 pb-3 shadow-xs', className)}>- <CornerMark text={categoriesMap[category].label} />+ <CornerMark text={categoriesMap[category]!.label} />{/* Header */}<div className="flex"><div className="flex h-10 w-10 items-center justify-center overflow-hidden rounded-xl border border-components-panel-border-subtle">diff --git a/web/app/components/plugins/plugin-page/filter-management/__tests__/category-filter.spec.tsx b/web/app/components/plugins/plugin-page/filter-management/__tests__/category-filter.spec.tsxindex 051d16792ae..e4b698a5f8a 100644--- a/web/app/components/plugins/plugin-page/filter-management/__tests__/category-filter.spec.tsx+++ b/web/app/components/plugins/plugin-page/filter-management/__tests__/category-filter.spec.tsx@@ -47,7 +47,7 @@ describe('CategoriesFilter', () => {it('should show "allCategories" when no categories selected', () => {render(<CategoriesFilter value={[]} onChange={vi.fn()} />)- expect(screen.getByText('plugin.allCategories')).toBeInTheDocument()+ expect(screen.getByText('plugin.allCategories'))!.toBeInTheDocument()})it('should show selected category labels', () => {@@ -60,7 +60,7 @@ describe('CategoriesFilter', () => {it('should show +N when more than 2 selected', () => {render(<CategoriesFilter value={['tool', 'model', 'extension']} onChange={vi.fn()} />)- expect(screen.getByText('+1')).toBeInTheDocument()+ expect(screen.getByText('+1'))!.toBeInTheDocument()})it('should clear all selections when clear button clicked', () => {@@ -76,9 +76,9 @@ describe('CategoriesFilter', () => {it('should render category options in dropdown', () => {render(<CategoriesFilter value={[]} onChange={vi.fn()} />)- expect(screen.getByText('Tool')).toBeInTheDocument()- expect(screen.getByText('Model')).toBeInTheDocument()- expect(screen.getByText('Extension')).toBeInTheDocument()+ expect(screen.getByText('Tool'))!.toBeInTheDocument()+ expect(screen.getByText('Model'))!.toBeInTheDocument()+ expect(screen.getByText('Extension'))!.toBeInTheDocument()})it('should toggle category on option click', () => {@@ -94,7 +94,7 @@ describe('CategoriesFilter', () => {render(<CategoriesFilter value={['tool']} onChange={mockOnChange} />)const toolElements = screen.getAllByText('Tool')- fireEvent.click(toolElements[toolElements.length - 1])+ fireEvent.click(toolElements[toolElements.length - 1]!)expect(mockOnChange).toHaveBeenCalledWith([])})})diff --git a/web/app/components/plugins/plugin-page/filter-management/__tests__/index.spec.tsx b/web/app/components/plugins/plugin-page/filter-management/__tests__/index.spec.tsxindex 95f0c5c1206..f30b5fb5fab 100644--- a/web/app/components/plugins/plugin-page/filter-management/__tests__/index.spec.tsx+++ b/web/app/components/plugins/plugin-page/filter-management/__tests__/index.spec.tsx@@ -338,7 +338,8 @@ describe('SearchBox Component', () => {render(<SearchBox searchQuery="" onChange={vi.fn()} />)// Assert- expect(screen.getByPlaceholderText('plugin.search')).toBeInTheDocument()+ // Assert+ expect(screen.getByPlaceholderText('plugin.search'))!.toBeInTheDocument()})it('should render with provided searchQuery value', () => {@@ -346,7 +347,8 @@ describe('SearchBox Component', () => {render(<SearchBox searchQuery="test query" onChange={vi.fn()} />)// Assert- expect(screen.getByDisplayValue('test query')).toBeInTheDocument()+ // Assert+ expect(screen.getByDisplayValue('test query'))!.toBeInTheDocument()})it('should render search icon', () => {@@ -355,7 +357,7 @@ describe('SearchBox Component', () => {// Assert - Input should have showLeftIcon which renders search iconconst wrapper = container.querySelector('.w-\\[200px\\]')- expect(wrapper).toBeInTheDocument()+ expect(wrapper)!.toBeInTheDocument()})})@@ -464,7 +466,8 @@ describe('CategoriesFilter Component', () => {render(<CategoriesFilter value={[]} onChange={vi.fn()} />)// Assert- expect(screen.getByText('plugin.allCategories')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('plugin.allCategories'))!.toBeInTheDocument()})it('should render dropdown arrow when no selection', () => {@@ -473,7 +476,7 @@ describe('CategoriesFilter Component', () => {// Assert - Arrow icon should be visibleconst arrowIcon = container.querySelector('svg')- expect(arrowIcon).toBeInTheDocument()+ expect(arrowIcon)!.toBeInTheDocument()})it('should render selected category labels', () => {@@ -481,7 +484,8 @@ describe('CategoriesFilter Component', () => {render(<CategoriesFilter value={['model']} onChange={vi.fn()} />)// Assert- expect(screen.getByText('Models')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('Models'))!.toBeInTheDocument()})it('should show clear button when categories are selected', () => {@@ -490,7 +494,7 @@ describe('CategoriesFilter Component', () => {// Assert - Close icon should be visibleconst closeIcon = container.querySelector('[class*="cursor-pointer"]')- expect(closeIcon).toBeInTheDocument()+ expect(closeIcon)!.toBeInTheDocument()})it('should show count badge for more than 2 selections', () => {@@ -498,7 +502,8 @@ describe('CategoriesFilter Component', () => {render(<CategoriesFilter value={['model', 'tool', 'extension']} onChange={vi.fn()} />)// Assert- expect(screen.getByText('+1')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('+1'))!.toBeInTheDocument()})})@@ -512,7 +517,7 @@ describe('CategoriesFilter Component', () => {// Assertawait waitFor(() => {- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()})})@@ -525,10 +530,10 @@ describe('CategoriesFilter Component', () => {// Assertawait waitFor(() => {- expect(screen.getByText('Models')).toBeInTheDocument()- expect(screen.getByText('Tools')).toBeInTheDocument()- expect(screen.getByText('Extensions')).toBeInTheDocument()- expect(screen.getByText('Agents')).toBeInTheDocument()+ expect(screen.getByText('Models'))!.toBeInTheDocument()+ expect(screen.getByText('Tools'))!.toBeInTheDocument()+ expect(screen.getByText('Extensions'))!.toBeInTheDocument()+ expect(screen.getByText('Agents'))!.toBeInTheDocument()})})@@ -541,7 +546,7 @@ describe('CategoriesFilter Component', () => {// Assertawait waitFor(() => {- expect(screen.getByPlaceholderText('plugin.searchCategories')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('plugin.searchCategories'))!.toBeInTheDocument()})})})@@ -555,7 +560,7 @@ describe('CategoriesFilter Component', () => {// Act - Open dropdown and click categoryfireEvent.click(screen.getByTestId('portal-trigger'))await waitFor(() => {- expect(screen.getByText('Models')).toBeInTheDocument()+ expect(screen.getByText('Models'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('Models'))@@ -592,7 +597,7 @@ describe('CategoriesFilter Component', () => {// ActfireEvent.click(screen.getByTestId('portal-trigger'))await waitFor(() => {- expect(screen.getByText('Tools')).toBeInTheDocument()+ expect(screen.getByText('Tools'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('Tools'))@@ -607,7 +612,7 @@ describe('CategoriesFilter Component', () => {// Act - Find and click the close iconconst closeIcon = container.querySelector('.text-text-quaternary')- expect(closeIcon).toBeInTheDocument()+ expect(closeIcon)!.toBeInTheDocument()fireEvent.click(closeIcon!)// Assert@@ -623,14 +628,15 @@ describe('CategoriesFilter Component', () => {// ActfireEvent.click(screen.getByTestId('portal-trigger'))await waitFor(() => {- expect(screen.getByPlaceholderText('plugin.searchCategories')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('plugin.searchCategories'))!.toBeInTheDocument()})fireEvent.change(screen.getByPlaceholderText('plugin.searchCategories'), {target: { value: 'mod' },})// Assert- expect(screen.getByText('Models')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('Models'))!.toBeInTheDocument()expect(screen.queryByText('Extensions')).not.toBeInTheDocument()})@@ -641,14 +647,15 @@ describe('CategoriesFilter Component', () => {// ActfireEvent.click(screen.getByTestId('portal-trigger'))await waitFor(() => {- expect(screen.getByPlaceholderText('plugin.searchCategories')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('plugin.searchCategories'))!.toBeInTheDocument()})fireEvent.change(screen.getByPlaceholderText('plugin.searchCategories'), {target: { value: 'MOD' },})// Assert- expect(screen.getByText('Models')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('Models'))!.toBeInTheDocument()})})@@ -696,7 +703,8 @@ describe('TagFilter Component', () => {render(<TagFilter value={[]} onChange={vi.fn()} />)// Assert- expect(screen.getByText('pluginTags.allTags')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('pluginTags.allTags'))!.toBeInTheDocument()})it('should render selected tag labels', () => {@@ -704,7 +712,8 @@ describe('TagFilter Component', () => {render(<TagFilter value={['agent']} onChange={vi.fn()} />)// Assert- expect(screen.getByText('Agent')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('Agent'))!.toBeInTheDocument()})it('should show count badge for more than 2 selections', () => {@@ -712,7 +721,8 @@ describe('TagFilter Component', () => {render(<TagFilter value={['agent', 'rag', 'search']} onChange={vi.fn()} />)// Assert- expect(screen.getByText('+1')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('+1'))!.toBeInTheDocument()})it('should show clear button when tags are selected', () => {@@ -721,7 +731,7 @@ describe('TagFilter Component', () => {// Assertconst closeIcon = container.querySelector('.text-text-quaternary')- expect(closeIcon).toBeInTheDocument()+ expect(closeIcon)!.toBeInTheDocument()})})@@ -735,7 +745,7 @@ describe('TagFilter Component', () => {// Assertawait waitFor(() => {- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()})})@@ -748,10 +758,10 @@ describe('TagFilter Component', () => {// Assertawait waitFor(() => {- expect(screen.getByText('Agent')).toBeInTheDocument()- expect(screen.getByText('RAG')).toBeInTheDocument()- expect(screen.getByText('Search')).toBeInTheDocument()- expect(screen.getByText('Image')).toBeInTheDocument()+ expect(screen.getByText('Agent'))!.toBeInTheDocument()+ expect(screen.getByText('RAG'))!.toBeInTheDocument()+ expect(screen.getByText('Search'))!.toBeInTheDocument()+ expect(screen.getByText('Image'))!.toBeInTheDocument()})})})@@ -765,7 +775,7 @@ describe('TagFilter Component', () => {// ActfireEvent.click(screen.getByTestId('portal-trigger'))await waitFor(() => {- expect(screen.getByText('Agent')).toBeInTheDocument()+ expect(screen.getByText('Agent'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('Agent'))@@ -783,7 +793,7 @@ describe('TagFilter Component', () => {await waitFor(() => {// Find the Agent option in dropdownconst agentOptions = screen.getAllByText('Agent')- fireEvent.click(agentOptions[agentOptions.length - 1])+ fireEvent.click(agentOptions[agentOptions.length - 1]!)})// Assert@@ -798,7 +808,7 @@ describe('TagFilter Component', () => {// ActfireEvent.click(screen.getByTestId('portal-trigger'))await waitFor(() => {- expect(screen.getByText('RAG')).toBeInTheDocument()+ expect(screen.getByText('RAG'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('RAG'))@@ -828,14 +838,15 @@ describe('TagFilter Component', () => {// ActfireEvent.click(screen.getByTestId('portal-trigger'))await waitFor(() => {- expect(screen.getByPlaceholderText('pluginTags.searchTags')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('pluginTags.searchTags'))!.toBeInTheDocument()})fireEvent.change(screen.getByPlaceholderText('pluginTags.searchTags'), {target: { value: 'rag' },})// Assert- expect(screen.getByText('RAG')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('RAG'))!.toBeInTheDocument()expect(screen.queryByText('Image')).not.toBeInTheDocument()})})@@ -855,9 +866,10 @@ describe('FilterManagement Component', () => {renderFilterManagement()// Assert - All three filters should be present- expect(screen.getByText('plugin.allCategories')).toBeInTheDocument()- expect(screen.getByText('pluginTags.allTags')).toBeInTheDocument()- expect(screen.getByPlaceholderText('plugin.search')).toBeInTheDocument()+ // Assert - All three filters should be present+ expect(screen.getByText('plugin.allCategories'))!.toBeInTheDocument()+ expect(screen.getByText('pluginTags.allTags'))!.toBeInTheDocument()+ expect(screen.getByPlaceholderText('plugin.search'))!.toBeInTheDocument()})it('should render with correct container classes', () => {@@ -866,7 +878,7 @@ describe('FilterManagement Component', () => {// Assertconst wrapper = container.firstChild as HTMLElement- expect(wrapper).toHaveClass('flex', 'items-center', 'gap-2', 'self-stretch')+ expect(wrapper)!.toHaveClass('flex', 'items-center', 'gap-2', 'self-stretch')})})@@ -879,9 +891,10 @@ describe('FilterManagement Component', () => {renderFilterManagement()// Assert- expect(screen.getByText('plugin.allCategories')).toBeInTheDocument()- expect(screen.getByText('pluginTags.allTags')).toBeInTheDocument()- expect(screen.getByPlaceholderText('plugin.search')).toHaveValue('')+ // Assert+ expect(screen.getByText('plugin.allCategories'))!.toBeInTheDocument()+ expect(screen.getByText('pluginTags.allTags'))!.toBeInTheDocument()+ expect(screen.getByPlaceholderText('plugin.search'))!.toHaveValue('')})it('should initialize with pre-selected categories', () => {@@ -892,7 +905,8 @@ describe('FilterManagement Component', () => {renderFilterManagement()// Assert- expect(screen.getByText('Models')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('Models'))!.toBeInTheDocument()})it('should initialize with pre-selected tags', () => {@@ -903,7 +917,8 @@ describe('FilterManagement Component', () => {renderFilterManagement()// Assert- expect(screen.getByText('Agent')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('Agent'))!.toBeInTheDocument()})it('should initialize with search query', () => {@@ -914,7 +929,8 @@ describe('FilterManagement Component', () => {renderFilterManagement()// Assert- expect(screen.getByDisplayValue('initial search')).toBeInTheDocument()+ // Assert+ expect(screen.getByDisplayValue('initial search'))!.toBeInTheDocument()})})@@ -926,10 +942,10 @@ describe('FilterManagement Component', () => {// Act - Open categories dropdown and selectconst triggers = screen.getAllByTestId('portal-trigger')- fireEvent.click(triggers[0]) // Categories filter trigger+ fireEvent.click(triggers[0]!) // Categories filter triggerawait waitFor(() => {- expect(screen.getByText('Models')).toBeInTheDocument()+ expect(screen.getByText('Models'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('Models'))@@ -948,10 +964,10 @@ describe('FilterManagement Component', () => {// Act - Open tags dropdown and selectconst triggers = screen.getAllByTestId('portal-trigger')- fireEvent.click(triggers[1]) // Tags filter trigger+ fireEvent.click(triggers[1]!) // Tags filter triggerawait waitFor(() => {- expect(screen.getByText('Agent')).toBeInTheDocument()+ expect(screen.getByText('Agent'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('Agent'))@@ -990,9 +1006,9 @@ describe('FilterManagement Component', () => {// Act 1 - Select a categoryconst triggers = screen.getAllByTestId('portal-trigger')- fireEvent.click(triggers[0])+ fireEvent.click(triggers[0]!)await waitFor(() => {- expect(screen.getByText('Models')).toBeInTheDocument()+ expect(screen.getByText('Models'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('Models'))@@ -1003,12 +1019,12 @@ describe('FilterManagement Component', () => {})// Close dropdown by clicking trigger again- fireEvent.click(triggers[0])+ fireEvent.click(triggers[0]!)// Act 2 - Select a tag (state should include previous category)- fireEvent.click(triggers[1])+ fireEvent.click(triggers[1]!)await waitFor(() => {- expect(screen.getByText('Agent')).toBeInTheDocument()+ expect(screen.getByText('Agent'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('Agent'))@@ -1051,20 +1067,20 @@ describe('FilterManagement Component', () => {// Act 1 - Select categoriesconst triggers = screen.getAllByTestId('portal-trigger')- fireEvent.click(triggers[0])+ fireEvent.click(triggers[0]!)await waitFor(() => {- expect(screen.getByText('Models')).toBeInTheDocument()+ expect(screen.getByText('Models'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('Models'))- fireEvent.click(triggers[0]) // Close+ fireEvent.click(triggers[0]!) // Close// Act 2 - Select tags- fireEvent.click(triggers[1])+ fireEvent.click(triggers[1]!)await waitFor(() => {- expect(screen.getByText('RAG')).toBeInTheDocument()+ expect(screen.getByText('RAG'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('RAG'))- fireEvent.click(triggers[1]) // Close+ fireEvent.click(triggers[1]!) // Close// Act 3 - Enter searchfireEvent.change(screen.getByPlaceholderText('plugin.search'), {@@ -1103,7 +1119,7 @@ describe('FilterManagement Component', () => {// Act - Clear categories (click clear button)const closeIcons = container.querySelectorAll('.text-text-quaternary')- fireEvent.click(closeIcons[0]) // First close icon is for categories+ fireEvent.click(closeIcons[0]!) // First close icon is for categories// Assertexpect(onFilterChange).toHaveBeenLastCalledWith({@@ -1124,7 +1140,8 @@ describe('FilterManagement Component', () => {render(<FilterManagement onFilterChange={onFilterChange} />)// Assert - Should render without errors- expect(screen.getByText('plugin.allCategories')).toBeInTheDocument()+ // Assert - Should render without errors+ expect(screen.getByText('plugin.allCategories'))!.toBeInTheDocument()})it('should handle multiple rapid filter changes', () => {diff --git a/web/app/components/plugins/plugin-page/filter-management/category-filter.tsx b/web/app/components/plugins/plugin-page/filter-management/category-filter.tsxindex f6ace774e84..8dbef5395d0 100644--- a/web/app/components/plugins/plugin-page/filter-management/category-filter.tsx+++ b/web/app/components/plugins/plugin-page/filter-management/category-filter.tsx@@ -61,7 +61,7 @@ const CategoriesFilter = ({!selectedTagsLength && t('allCategories', { ns: 'plugin' })}{- !!selectedTagsLength && value.map(val => categoriesMap[val].label).slice(0, 2).join(',')+ !!selectedTagsLength && value.map(val => categoriesMap[val]!.label).slice(0, 2).join(',')}{selectedTagsLength > 2 && (diff --git a/web/app/components/plugins/plugin-page/list/__tests__/index.spec.tsx b/web/app/components/plugins/plugin-page/list/__tests__/index.spec.tsxindex c6326461d48..65372378398 100644--- a/web/app/components/plugins/plugin-page/list/__tests__/index.spec.tsx+++ b/web/app/components/plugins/plugin-page/list/__tests__/index.spec.tsx@@ -113,7 +113,8 @@ describe('PluginList', () => {const { container } = render(<PluginList pluginList={pluginList} />)// Assert- expect(container).toBeInTheDocument()+ // Assert+ expect(container)!.toBeInTheDocument()})it('should render container with correct structure', () => {@@ -125,10 +126,10 @@ describe('PluginList', () => {// Assertconst outerDiv = container.firstChild as HTMLElement- expect(outerDiv).toHaveClass('pb-3')+ expect(outerDiv)!.toHaveClass('pb-3')const gridDiv = outerDiv.firstChild as HTMLElement- expect(gridDiv).toHaveClass('grid', 'grid-cols-2', 'gap-3')+ expect(gridDiv)!.toHaveClass('grid', 'grid-cols-2', 'gap-3')})it('should render single plugin correctly', () => {@@ -141,7 +142,7 @@ describe('PluginList', () => {// Assertconst pluginItems = screen.getAllByTestId('plugin-item')expect(pluginItems).toHaveLength(1)- expect(pluginItems[0]).toHaveAttribute('data-plugin-name', 'single-plugin')+ expect(pluginItems[0])!.toHaveAttribute('data-plugin-name', 'single-plugin')})it('should render multiple plugins correctly', () => {@@ -169,9 +170,9 @@ describe('PluginList', () => {// Assertconst pluginItems = screen.getAllByTestId('plugin-item')- expect(pluginItems[0]).toHaveAttribute('data-plugin-id', 'first')- expect(pluginItems[1]).toHaveAttribute('data-plugin-id', 'second')- expect(pluginItems[2]).toHaveAttribute('data-plugin-id', 'third')+ expect(pluginItems[0])!.toHaveAttribute('data-plugin-id', 'first')+ expect(pluginItems[1])!.toHaveAttribute('data-plugin-id', 'second')+ expect(pluginItems[2])!.toHaveAttribute('data-plugin-id', 'third')})it('should pass plugin prop to each PluginItem', () => {@@ -185,8 +186,9 @@ describe('PluginList', () => {render(<PluginList pluginList={pluginList} />)// Assert- expect(screen.getByText('Plugin A')).toBeInTheDocument()- expect(screen.getByText('Plugin B')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('Plugin A'))!.toBeInTheDocument()+ expect(screen.getByText('Plugin B'))!.toBeInTheDocument()})})@@ -198,7 +200,7 @@ describe('PluginList', () => {// Assertconst gridDiv = container.querySelector('.grid')- expect(gridDiv).toBeEmptyDOMElement()+ expect(gridDiv)!.toBeEmptyDOMElement()})it('should handle pluginList with various categories', () => {@@ -250,6 +252,37 @@ describe('PluginList', () => {// Arrange & Actrender(<PluginList pluginList={[]} />)+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert// Assertexpect(screen.queryByTestId('plugin-item')).not.toBeInTheDocument()})@@ -303,7 +336,8 @@ describe('PluginList', () => {render(<PluginList pluginList={pluginList} />)// Assert- expect(screen.getByTestId('plugin-item')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('plugin-item'))!.toBeInTheDocument()})it('should handle plugin with minimal data', () => {@@ -317,7 +351,8 @@ describe('PluginList', () => {render(<PluginList pluginList={[minimalPlugin]} />)// Assert- expect(screen.getByTestId('plugin-item')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('plugin-item'))!.toBeInTheDocument()})it('should handle plugins with undefined optional fields', () => {@@ -333,7 +368,8 @@ describe('PluginList', () => {render(<PluginList pluginList={pluginList} />)// Assert- expect(screen.getByTestId('plugin-item')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('plugin-item'))!.toBeInTheDocument()})})@@ -348,7 +384,7 @@ describe('PluginList', () => {// Assertconst gridDiv = container.querySelector('.grid')- expect(gridDiv).toHaveClass('grid-cols-2')+ expect(gridDiv)!.toHaveClass('grid-cols-2')})it('should have proper gap between items', () => {@@ -360,7 +396,7 @@ describe('PluginList', () => {// Assertconst gridDiv = container.querySelector('.grid')- expect(gridDiv).toHaveClass('gap-3')+ expect(gridDiv)!.toHaveClass('gap-3')})it('should have bottom padding on container', () => {@@ -372,7 +408,7 @@ describe('PluginList', () => {// Assertconst outerDiv = container.firstChild as HTMLElement- expect(outerDiv).toHaveClass('pb-3')+ expect(outerDiv)!.toHaveClass('pb-3')})})@@ -404,6 +440,37 @@ describe('PluginList', () => {rerender(<PluginList pluginList={emptyList} />)+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert// Assertexpect(screen.queryByTestId('plugin-item')).not.toBeInTheDocument()})@@ -430,12 +497,13 @@ describe('PluginList', () => {// Actconst { rerender } = render(<PluginList pluginList={initialList} />)- expect(screen.getByText('Original Name')).toBeInTheDocument()+ expect(screen.getByText('Original Name'))!.toBeInTheDocument()rerender(<PluginList pluginList={updatedList} />)// Assert- expect(screen.getByText('Updated Name')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('Updated Name'))!.toBeInTheDocument()expect(screen.queryByText('Original Name')).not.toBeInTheDocument()})})@@ -454,15 +522,15 @@ describe('PluginList', () => {const { rerender } = render(<PluginList pluginList={pluginList} />)// Reorder the list- const reorderedList = [pluginList[2], pluginList[0], pluginList[1]]+ const reorderedList = [pluginList[2]!, pluginList[0]!, pluginList[1]!]rerender(<PluginList pluginList={reorderedList} />)// Assert - All items should still be presentconst items = screen.getAllByTestId('plugin-item')expect(items).toHaveLength(3)- expect(items[0]).toHaveAttribute('data-plugin-id', 'stable-key-3')- expect(items[1]).toHaveAttribute('data-plugin-id', 'stable-key-1')- expect(items[2]).toHaveAttribute('data-plugin-id', 'stable-key-2')+ expect(items[0])!.toHaveAttribute('data-plugin-id', 'stable-key-3')+ expect(items[1])!.toHaveAttribute('data-plugin-id', 'stable-key-1')+ expect(items[2])!.toHaveAttribute('data-plugin-id', 'stable-key-2')})})@@ -476,7 +544,8 @@ describe('PluginList', () => {render(<PluginList pluginList={pluginList} />)// Assert- expect(screen.getByTestId('plugin-item')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('plugin-item'))!.toBeInTheDocument()})it('should render deleted/deprecated plugins', () => {@@ -492,7 +561,8 @@ describe('PluginList', () => {render(<PluginList pluginList={pluginList} />)// Assert- expect(screen.getByTestId('plugin-item')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('plugin-item'))!.toBeInTheDocument()})it('should render mixed status plugins', () => {@@ -529,7 +599,8 @@ describe('PluginList', () => {render(<PluginList pluginList={pluginList} />)// Assert- expect(screen.getByTestId('plugin-item')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('plugin-item'))!.toBeInTheDocument()})it('should render plugins with outdated version', () => {@@ -545,7 +616,8 @@ describe('PluginList', () => {render(<PluginList pluginList={pluginList} />)// Assert- expect(screen.getByTestId('plugin-item')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('plugin-item'))!.toBeInTheDocument()})})@@ -607,9 +679,10 @@ describe('PluginList', () => {render(<PluginList pluginList={pluginList} />)// Assert- expect(screen.getByText('Marketplace Plugin')).toBeInTheDocument()- expect(screen.getByText('GitHub Plugin')).toBeInTheDocument()- expect(screen.getByText('Local Plugin')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('Marketplace Plugin'))!.toBeInTheDocument()+ expect(screen.getByText('GitHub Plugin'))!.toBeInTheDocument()+ expect(screen.getByText('Local Plugin'))!.toBeInTheDocument()})it('should render plugins of different categories together', () => {@@ -636,9 +709,10 @@ describe('PluginList', () => {render(<PluginList pluginList={pluginList} />)// Assert- expect(screen.getByText('Tool Plugin')).toBeInTheDocument()- expect(screen.getByText('Model Plugin')).toBeInTheDocument()- expect(screen.getByText('Agent Plugin')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('Tool Plugin'))!.toBeInTheDocument()+ expect(screen.getByText('Model Plugin'))!.toBeInTheDocument()+ expect(screen.getByText('Agent Plugin'))!.toBeInTheDocument()})})diff --git a/web/app/components/plugins/plugin-page/plugin-tasks/__tests__/index.spec.tsx b/web/app/components/plugins/plugin-page/plugin-tasks/__tests__/index.spec.tsxindex 56992b377ff..15b4429de8c 100644--- a/web/app/components/plugins/plugin-page/plugin-tasks/__tests__/index.spec.tsx+++ b/web/app/components/plugins/plugin-page/plugin-tasks/__tests__/index.spec.tsx@@ -83,8 +83,8 @@ describe('usePluginTaskStatus Hook', () => {render(<TestComponent />)- expect(screen.getByTestId('running-count')).toHaveTextContent('1')- expect(screen.getByTestId('running-id')).toHaveTextContent(runningPlugin.plugin_unique_identifier)+ expect(screen.getByTestId('running-count'))!.toHaveTextContent('1')+ expect(screen.getByTestId('running-id'))!.toHaveTextContent(runningPlugin.plugin_unique_identifier)})it('should categorize success plugins correctly', () => {@@ -103,8 +103,8 @@ describe('usePluginTaskStatus Hook', () => {render(<TestComponent />)- expect(screen.getByTestId('success-count')).toHaveTextContent('1')- expect(screen.getByTestId('success-id')).toHaveTextContent(successPlugin.plugin_unique_identifier)+ expect(screen.getByTestId('success-count'))!.toHaveTextContent('1')+ expect(screen.getByTestId('success-id'))!.toHaveTextContent(successPlugin.plugin_unique_identifier)})it('should categorize error plugins correctly', () => {@@ -123,8 +123,8 @@ describe('usePluginTaskStatus Hook', () => {render(<TestComponent />)- expect(screen.getByTestId('error-count')).toHaveTextContent('1')- expect(screen.getByTestId('error-id')).toHaveTextContent(errorPlugin.plugin_unique_identifier)+ expect(screen.getByTestId('error-count'))!.toHaveTextContent('1')+ expect(screen.getByTestId('error-id'))!.toHaveTextContent(errorPlugin.plugin_unique_identifier)})it('should categorize mixed plugins correctly', () => {@@ -149,10 +149,10 @@ describe('usePluginTaskStatus Hook', () => {render(<TestComponent />)- expect(screen.getByTestId('running')).toHaveTextContent('1')- expect(screen.getByTestId('success')).toHaveTextContent('1')- expect(screen.getByTestId('error')).toHaveTextContent('1')- expect(screen.getByTestId('total')).toHaveTextContent('3')+ expect(screen.getByTestId('running'))!.toHaveTextContent('1')+ expect(screen.getByTestId('success'))!.toHaveTextContent('1')+ expect(screen.getByTestId('error'))!.toHaveTextContent('1')+ expect(screen.getByTestId('total'))!.toHaveTextContent('3')})})@@ -175,11 +175,11 @@ describe('usePluginTaskStatus Hook', () => {render(<TestComponent />)- expect(screen.getByTestId('isInstalling')).toHaveTextContent('true')- expect(screen.getByTestId('isInstallingWithSuccess')).toHaveTextContent('false')- expect(screen.getByTestId('isInstallingWithError')).toHaveTextContent('false')- expect(screen.getByTestId('isSuccess')).toHaveTextContent('false')- expect(screen.getByTestId('isFailed')).toHaveTextContent('false')+ expect(screen.getByTestId('isInstalling'))!.toHaveTextContent('true')+ expect(screen.getByTestId('isInstallingWithSuccess'))!.toHaveTextContent('false')+ expect(screen.getByTestId('isInstallingWithError'))!.toHaveTextContent('false')+ expect(screen.getByTestId('isSuccess'))!.toHaveTextContent('false')+ expect(screen.getByTestId('isFailed'))!.toHaveTextContent('false')})it('should set isInstallingWithSuccess when running and success plugins exist', () => {@@ -194,7 +194,7 @@ describe('usePluginTaskStatus Hook', () => {}render(<TestComponent />)- expect(screen.getByTestId('flag')).toHaveTextContent('true')+ expect(screen.getByTestId('flag'))!.toHaveTextContent('true')})it('should set isInstallingWithError when running and error plugins exist', () => {@@ -209,7 +209,7 @@ describe('usePluginTaskStatus Hook', () => {}render(<TestComponent />)- expect(screen.getByTestId('flag')).toHaveTextContent('true')+ expect(screen.getByTestId('flag'))!.toHaveTextContent('true')})it('should set isSuccess when all plugins succeeded', () => {@@ -224,7 +224,7 @@ describe('usePluginTaskStatus Hook', () => {}render(<TestComponent />)- expect(screen.getByTestId('flag')).toHaveTextContent('true')+ expect(screen.getByTestId('flag'))!.toHaveTextContent('true')})it('should set isFailed when no running plugins and some failed', () => {@@ -239,7 +239,7 @@ describe('usePluginTaskStatus Hook', () => {}render(<TestComponent />)- expect(screen.getByTestId('flag')).toHaveTextContent('true')+ expect(screen.getByTestId('flag'))!.toHaveTextContent('true')})})@@ -296,12 +296,12 @@ describe('TaskStatusIndicator Component', () => {describe('Rendering', () => {it('should render without crashing', () => {render(<TaskStatusIndicator {...defaultProps} />)- expect(document.getElementById('plugin-task-trigger')).toBeInTheDocument()+ expect(document.getElementById('plugin-task-trigger'))!.toBeInTheDocument()})it('should render with correct id', () => {render(<TaskStatusIndicator {...defaultProps} />)- expect(document.getElementById('plugin-task-trigger')).toBeInTheDocument()+ expect(document.getElementById('plugin-task-trigger'))!.toBeInTheDocument()})})@@ -309,17 +309,18 @@ describe('TaskStatusIndicator Component', () => {it('should show downloading icon when installing', () => {render(<TaskStatusIndicator {...defaultProps} isInstalling />)// DownloadingIcon is rendered when isInstalling is true- expect(document.getElementById('plugin-task-trigger')).toBeInTheDocument()+ // DownloadingIcon is rendered when isInstalling is true+ expect(document.getElementById('plugin-task-trigger'))!.toBeInTheDocument()})it('should show downloading icon when installing with error', () => {render(<TaskStatusIndicator {...defaultProps} isInstallingWithError />)- expect(document.getElementById('plugin-task-trigger')).toBeInTheDocument()+ expect(document.getElementById('plugin-task-trigger'))!.toBeInTheDocument()})it('should show install icon when not installing', () => {render(<TaskStatusIndicator {...defaultProps} isSuccess />)- expect(document.getElementById('plugin-task-trigger')).toBeInTheDocument()+ expect(document.getElementById('plugin-task-trigger'))!.toBeInTheDocument()})})@@ -333,7 +334,7 @@ describe('TaskStatusIndicator Component', () => {totalPluginsLength={3}/>,)- expect(document.getElementById('plugin-task-trigger')).toBeInTheDocument()+ expect(document.getElementById('plugin-task-trigger'))!.toBeInTheDocument()})it('should show progress circle when installing with success', () => {@@ -345,7 +346,7 @@ describe('TaskStatusIndicator Component', () => {totalPluginsLength={3}/>,)- expect(document.getElementById('plugin-task-trigger')).toBeInTheDocument()+ expect(document.getElementById('plugin-task-trigger'))!.toBeInTheDocument()})it('should show error progress circle when installing with error', () => {@@ -357,7 +358,7 @@ describe('TaskStatusIndicator Component', () => {totalPluginsLength={3}/>,)- expect(document.getElementById('plugin-task-trigger')).toBeInTheDocument()+ expect(document.getElementById('plugin-task-trigger'))!.toBeInTheDocument()})it('should show success icon when all completed successfully', () => {@@ -370,12 +371,12 @@ describe('TaskStatusIndicator Component', () => {totalPluginsLength={3}/>,)- expect(document.getElementById('plugin-task-trigger')).toBeInTheDocument()+ expect(document.getElementById('plugin-task-trigger'))!.toBeInTheDocument()})it('should show error icon when failed', () => {render(<TaskStatusIndicator {...defaultProps} isFailed />)- expect(document.getElementById('plugin-task-trigger')).toBeInTheDocument()+ expect(document.getElementById('plugin-task-trigger'))!.toBeInTheDocument()})})@@ -383,19 +384,19 @@ describe('TaskStatusIndicator Component', () => {it('should apply error styles when installing with error', () => {render(<TaskStatusIndicator {...defaultProps} isInstallingWithError />)const trigger = document.getElementById('plugin-task-trigger')- expect(trigger).toHaveClass('bg-state-destructive-hover')+ expect(trigger)!.toHaveClass('bg-state-destructive-hover')})it('should apply error styles when failed', () => {render(<TaskStatusIndicator {...defaultProps} isFailed />)const trigger = document.getElementById('plugin-task-trigger')- expect(trigger).toHaveClass('bg-state-destructive-hover')+ expect(trigger)!.toHaveClass('bg-state-destructive-hover')})it('should apply cursor-pointer when clickable', () => {render(<TaskStatusIndicator {...defaultProps} isInstalling />)const trigger = document.getElementById('plugin-task-trigger')- expect(trigger).toHaveClass('cursor-pointer')+ expect(trigger)!.toHaveClass('cursor-pointer')})})@@ -429,7 +430,7 @@ describe('PluginTaskList Component', () => {describe('Rendering', () => {it('should render without crashing with empty lists', () => {render(<PluginTaskList {...defaultProps} />)- expect(document.querySelector('.w-\\[360px\\]')).toBeInTheDocument()+ expect(document.querySelector('.w-\\[360px\\]'))!.toBeInTheDocument()})it('should render running plugins section when plugins exist', () => {@@ -439,7 +440,8 @@ describe('PluginTaskList Component', () => {// Translation key is returned as text in tests, multiple matches expected (title + status)expect(screen.getAllByText(/task\.installing/i).length).toBeGreaterThan(0)// Verify section container is rendered- expect(document.querySelector('.max-h-\\[300px\\]')).toBeInTheDocument()+ // Verify section container is rendered+ expect(document.querySelector('.max-h-\\[300px\\]'))!.toBeInTheDocument()})it('should render success plugins section when plugins exist', () => {@@ -454,7 +456,7 @@ describe('PluginTaskList Component', () => {const errorPlugins = [createMockPlugin({ status: TaskStatus.failed, message: 'Error occurred' })]render(<PluginTaskList {...defaultProps} errorPlugins={errorPlugins} />)- expect(screen.getByText('Error occurred')).toBeInTheDocument()+ expect(screen.getByText('Error occurred'))!.toBeInTheDocument()})it('should render all sections when all types exist', () => {@@ -541,7 +543,7 @@ describe('PluginTaskList Component', () => {render(<PluginTaskList {...defaultProps} runningPlugins={[plugin]} />)- expect(screen.getByText('My Test Plugin')).toBeInTheDocument()+ expect(screen.getByText('My Test Plugin'))!.toBeInTheDocument()})it('should display plugin message when available', () => {@@ -552,7 +554,7 @@ describe('PluginTaskList Component', () => {render(<PluginTaskList {...defaultProps} successPlugins={[plugin]} />)- expect(screen.getByText('Successfully installed!')).toBeInTheDocument()+ expect(screen.getByText('Successfully installed!'))!.toBeInTheDocument()})it('should display multiple plugins in each section', () => {@@ -563,8 +565,8 @@ describe('PluginTaskList Component', () => {render(<PluginTaskList {...defaultProps} runningPlugins={runningPlugins} />)- expect(screen.getByText('Plugin A')).toBeInTheDocument()- expect(screen.getByText('Plugin B')).toBeInTheDocument()+ expect(screen.getByText('Plugin A'))!.toBeInTheDocument()+ expect(screen.getByText('Plugin B'))!.toBeInTheDocument()// Count is rendered, verify multiple items are in listexpect(document.querySelectorAll('.hover\\:bg-state-base-hover').length).toBe(2)})@@ -593,7 +595,7 @@ describe('PluginTasks Component', () => {render(<PluginTasks />)- expect(document.getElementById('plugin-task-trigger')).toBeInTheDocument()+ expect(document.getElementById('plugin-task-trigger'))!.toBeInTheDocument()})})@@ -604,7 +606,8 @@ describe('PluginTasks Component', () => {render(<PluginTasks />)// The component renders with a tooltip, we verify it exists- expect(document.getElementById('plugin-task-trigger')).toBeInTheDocument()+ // The component renders with a tooltip, we verify it exists+ expect(document.getElementById('plugin-task-trigger'))!.toBeInTheDocument()})it('should show success tip when all succeeded', () => {@@ -612,7 +615,7 @@ describe('PluginTasks Component', () => {render(<PluginTasks />)- expect(document.getElementById('plugin-task-trigger')).toBeInTheDocument()+ expect(document.getElementById('plugin-task-trigger'))!.toBeInTheDocument()})it('should show error tip when some failed', () => {@@ -623,7 +626,7 @@ describe('PluginTasks Component', () => {render(<PluginTasks />)- expect(document.getElementById('plugin-task-trigger')).toBeInTheDocument()+ expect(document.getElementById('plugin-task-trigger'))!.toBeInTheDocument()})})@@ -637,7 +640,8 @@ describe('PluginTasks Component', () => {fireEvent.click(document.getElementById('plugin-task-trigger')!)// The popover content should be visible (PluginTaskList)- expect(document.querySelector('.w-\\[360px\\]')).toBeInTheDocument()+ // The popover content should be visible (PluginTaskList)+ expect(document.querySelector('.w-\\[360px\\]'))!.toBeInTheDocument()})it('should not toggle when status does not allow', () => {@@ -647,7 +651,8 @@ describe('PluginTasks Component', () => {render(<PluginTasks />)// Component should still render- expect(document.getElementById('plugin-task-trigger')).toBeInTheDocument()+ // Component should still render+ expect(document.getElementById('plugin-task-trigger'))!.toBeInTheDocument()})})@@ -665,7 +670,7 @@ describe('PluginTasks Component', () => {// Wait for popover content to renderawait waitFor(() => {- expect(document.querySelector('.w-\\[360px\\]')).toBeInTheDocument()+ expect(document.querySelector('.w-\\[360px\\]'))!.toBeInTheDocument()})// Find and click clear all button@@ -691,13 +696,13 @@ describe('PluginTasks Component', () => {fireEvent.click(document.getElementById('plugin-task-trigger')!)await waitFor(() => {- expect(document.querySelector('.w-\\[360px\\]')).toBeInTheDocument()+ expect(document.querySelector('.w-\\[360px\\]'))!.toBeInTheDocument()})// Find and click the clear all button in error sectionconst clearButtons = screen.getAllByRole('button')if (clearButtons.length > 0)- fireEvent.click(clearButtons[0])+ fireEvent.click(clearButtons[0]!)await waitFor(() => {expect(mockMutateAsync).toHaveBeenCalled()@@ -719,13 +724,13 @@ describe('PluginTasks Component', () => {fireEvent.click(document.getElementById('plugin-task-trigger')!)await waitFor(() => {- expect(document.querySelector('.w-\\[360px\\]')).toBeInTheDocument()+ expect(document.querySelector('.w-\\[360px\\]'))!.toBeInTheDocument()})// Find and click individual clear button (usually the last one)const clearButtons = screen.getAllByRole('button')const individualClearButton = clearButtons[clearButtons.length - 1]- fireEvent.click(individualClearButton)+ fireEvent.click(individualClearButton!)await waitFor(() => {expect(mockMutateAsync).toHaveBeenCalledWith({@@ -750,7 +755,7 @@ describe('PluginTasks Component', () => {render(<PluginTasks />)- expect(document.getElementById('plugin-task-trigger')).toBeInTheDocument()+ expect(document.getElementById('plugin-task-trigger'))!.toBeInTheDocument()})it('should handle many plugins', () => {@@ -763,7 +768,7 @@ describe('PluginTasks Component', () => {render(<PluginTasks />)- expect(document.getElementById('plugin-task-trigger')).toBeInTheDocument()+ expect(document.getElementById('plugin-task-trigger'))!.toBeInTheDocument()})it('should handle plugins with empty labels', () => {@@ -775,7 +780,7 @@ describe('PluginTasks Component', () => {render(<PluginTasks />)- expect(document.getElementById('plugin-task-trigger')).toBeInTheDocument()+ expect(document.getElementById('plugin-task-trigger'))!.toBeInTheDocument()})it('should handle plugins with long messages', () => {@@ -790,7 +795,7 @@ describe('PluginTasks Component', () => {// Open popoverfireEvent.click(document.getElementById('plugin-task-trigger')!)- expect(document.querySelector('.w-\\[360px\\]')).toBeInTheDocument()+ expect(document.querySelector('.w-\\[360px\\]'))!.toBeInTheDocument()})})})@@ -809,13 +814,13 @@ describe('PluginTasks Integration', () => {const { rerender } = render(<PluginTasks />)- expect(document.getElementById('plugin-task-trigger')).toBeInTheDocument()+ expect(document.getElementById('plugin-task-trigger'))!.toBeInTheDocument()// Simulate completion by re-rendering with successsetupMocks([createMockPlugin({ status: TaskStatus.success })])rerender(<PluginTasks />)- expect(document.getElementById('plugin-task-trigger')).toBeInTheDocument()+ expect(document.getElementById('plugin-task-trigger'))!.toBeInTheDocument()})it('should show correct UI flow from installing to failure', async () => {@@ -824,13 +829,13 @@ describe('PluginTasks Integration', () => {const { rerender } = render(<PluginTasks />)- expect(document.getElementById('plugin-task-trigger')).toBeInTheDocument()+ expect(document.getElementById('plugin-task-trigger'))!.toBeInTheDocument()// Simulate failure by re-rendering with failedsetupMocks([createMockPlugin({ status: TaskStatus.failed, message: 'Network error' })])rerender(<PluginTasks />)- expect(document.getElementById('plugin-task-trigger')).toBeInTheDocument()+ expect(document.getElementById('plugin-task-trigger'))!.toBeInTheDocument()})it('should handle mixed status during installation', () => {diff --git a/web/app/components/plugins/plugin-page/plugin-tasks/components/__tests__/plugin-section.spec.tsx b/web/app/components/plugins/plugin-page/plugin-tasks/components/__tests__/plugin-section.spec.tsxindex fb7429e9be5..0c724000dd5 100644--- a/web/app/components/plugins/plugin-page/plugin-tasks/components/__tests__/plugin-section.spec.tsx+++ b/web/app/components/plugins/plugin-page/plugin-tasks/components/__tests__/plugin-section.spec.tsx@@ -41,15 +41,15 @@ describe('PluginSection', () => {it('should render title and count', () => {render(<PluginSection {...defaultProps} />)- expect(screen.getByText(/installing plugins/i)).toBeInTheDocument()+ expect(screen.getByText(/installing plugins/i))!.toBeInTheDocument()expect(screen.getByText(/installing plugins/i).textContent).toContain('2')})it('should render all plugin items', () => {render(<PluginSection {...defaultProps} />)- expect(screen.getByText('PluginA')).toBeInTheDocument()- expect(screen.getByText('PluginB')).toBeInTheDocument()+ expect(screen.getByText('PluginA'))!.toBeInTheDocument()+ expect(screen.getByText('PluginB'))!.toBeInTheDocument()})it('should render status icons for each plugin', () => {@@ -72,14 +72,14 @@ describe('PluginSection', () => {const plugins = [createPlugin('p1', 'PluginA', 'Custom message')]render(<PluginSection {...defaultProps} plugins={plugins} count={1} />)- expect(screen.getByText('Custom message')).toBeInTheDocument()+ expect(screen.getByText('Custom message'))!.toBeInTheDocument()})it('should use defaultStatusText when plugin has no message', () => {const plugins = [createPlugin('p1', 'PluginA', '')]render(<PluginSection {...defaultProps} plugins={plugins} count={1} />)- expect(screen.getByText('Default status')).toBeInTheDocument()+ expect(screen.getByText('Default status'))!.toBeInTheDocument()})it('should apply statusClassName to items', () => {@@ -104,7 +104,7 @@ describe('PluginSection', () => {/>,)- expect(screen.getByRole('button', { name: /clear all/i })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: /clear all/i }))!.toBeInTheDocument()})it('should not render headerAction when not provided', () => {@@ -123,8 +123,8 @@ describe('PluginSection', () => {/>,)- expect(screen.getByRole('button', { name: /action plugina/i })).toBeInTheDocument()- expect(screen.getByRole('button', { name: /action pluginb/i })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: /action plugina/i }))!.toBeInTheDocument()+ expect(screen.getByRole('button', { name: /action pluginb/i }))!.toBeInTheDocument()})})@@ -140,7 +140,7 @@ describe('PluginSection', () => {// Clear buttons are rendered when onClearSingle is providedconst clearButtons = screen.getAllByRole('button')- fireEvent.click(clearButtons[0])+ fireEvent.click(clearButtons[0]!)expect(onClearSingle).toHaveBeenCalledWith('task-1', 'p1')})@@ -157,8 +157,8 @@ describe('PluginSection', () => {const plugins = [createPlugin('p1', 'Solo')]render(<PluginSection {...defaultProps} plugins={plugins} count={1} />)- expect(screen.getByText('Solo')).toBeInTheDocument()- expect(screen.getByText(/solo/i).closest('.max-h-\\[300px\\]')).toBeInTheDocument()+ expect(screen.getByText('Solo'))!.toBeInTheDocument()+ expect(screen.getByText(/solo/i).closest('.max-h-\\[300px\\]'))!.toBeInTheDocument()})})})diff --git a/web/app/components/plugins/plugin-page/plugin-tasks/components/__tests__/plugin-task-list.spec.tsx b/web/app/components/plugins/plugin-page/plugin-tasks/components/__tests__/plugin-task-list.spec.tsxindex 2d0d3f7fd6f..07a651e2c57 100644--- a/web/app/components/plugins/plugin-page/plugin-tasks/components/__tests__/plugin-task-list.spec.tsx+++ b/web/app/components/plugins/plugin-page/plugin-tasks/components/__tests__/plugin-task-list.spec.tsx@@ -67,7 +67,7 @@ describe('PluginTaskList', () => {it('should render empty container when no plugins', () => {const { container } = render(<PluginTaskList {...defaultProps} />)const wrapper = container.firstElementChild!- expect(wrapper).toBeInTheDocument()+ expect(wrapper)!.toBeInTheDocument()expect(wrapper.children).toHaveLength(0)})@@ -77,9 +77,9 @@ describe('PluginTaskList', () => {// Header contains the title textconst headers = container.querySelectorAll('.system-sm-semibold-uppercase')expect(headers).toHaveLength(1)- expect(headers[0].textContent).toContain('plugin.task.installing')- expect(screen.getByText('OpenAI')).toBeInTheDocument()- expect(screen.getByText('Anthropic')).toBeInTheDocument()+ expect(headers[0]!.textContent).toContain('plugin.task.installing')+ expect(screen.getByText('OpenAI'))!.toBeInTheDocument()+ expect(screen.getByText('Anthropic'))!.toBeInTheDocument()})it('should render success section when success plugins exist', () => {@@ -87,8 +87,8 @@ describe('PluginTaskList', () => {const headers = container.querySelectorAll('.system-sm-semibold-uppercase')expect(headers).toHaveLength(1)- expect(headers[0].textContent).toContain('plugin.task.installed')- expect(screen.getByText('Google')).toBeInTheDocument()+ expect(headers[0]!.textContent).toContain('plugin.task.installed')+ expect(screen.getByText('Google'))!.toBeInTheDocument()})it('should render error section when error plugins exist', () => {@@ -96,8 +96,8 @@ describe('PluginTaskList', () => {const headers = container.querySelectorAll('.system-sm-semibold-uppercase')expect(headers).toHaveLength(1)- expect(headers[0].textContent).toContain('plugin.task.installedError')- expect(screen.getByText('DALLE')).toBeInTheDocument()+ expect(headers[0]!.textContent).toContain('plugin.task.installedError')+ expect(screen.getByText('DALLE'))!.toBeInTheDocument()})it('should render all three sections simultaneously', () => {@@ -110,9 +110,9 @@ describe('PluginTaskList', () => {/>,)- expect(screen.getByText('OpenAI')).toBeInTheDocument()- expect(screen.getByText('Google')).toBeInTheDocument()- expect(screen.getByText('DALLE')).toBeInTheDocument()+ expect(screen.getByText('OpenAI'))!.toBeInTheDocument()+ expect(screen.getByText('Google'))!.toBeInTheDocument()+ expect(screen.getByText('DALLE'))!.toBeInTheDocument()})})@@ -183,6 +183,37 @@ describe('PluginTaskList', () => {it('should not render clear buttons for running plugins', () => {render(<PluginTaskList {...defaultProps} runningPlugins={runningPlugins} />)+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle+ // Running section has no headerAction and no onClearSingle// Running section has no headerAction and no onClearSingleexpect(screen.queryByText(/plugin\.task\.clearAll/)).not.toBeInTheDocument()})@@ -243,9 +274,9 @@ describe('PluginTaskList', () => {render(<PluginTaskList {...defaultProps} errorPlugins={multipleErrors} />)- expect(screen.getByText('PluginA')).toBeInTheDocument()- expect(screen.getByText('PluginB')).toBeInTheDocument()- expect(screen.getByText('PluginC')).toBeInTheDocument()+ expect(screen.getByText('PluginA'))!.toBeInTheDocument()+ expect(screen.getByText('PluginB'))!.toBeInTheDocument()+ expect(screen.getByText('PluginC'))!.toBeInTheDocument()})})})diff --git a/web/app/components/plugins/plugin-page/plugin-tasks/components/error-plugin-item.tsx b/web/app/components/plugins/plugin-page/plugin-tasks/components/error-plugin-item.tsxindex 81f559c9aac..ef857cb6c67 100644--- a/web/app/components/plugins/plugin-page/plugin-tasks/components/error-plugin-item.tsx+++ b/web/app/components/plugins/plugin-page/plugin-tasks/components/error-plugin-item.tsx@@ -30,14 +30,14 @@ const ErrorPluginItem: FC<ErrorPluginItemProps> = ({ plugin, getIconUrl, languagconst [org, name] = partssetIsFetching(true)try {- const response = await fetchPluginInfoFromMarketPlace({ org, name })+ const response = await fetchPluginInfoFromMarketPlace({ org: org!, name: name! })const info = response.data.pluginconst manifest: Plugin = {plugin_id: plugin.plugin_id,type: info.category as Plugin['type'],category: info.category,- name,- org,+ name: name!,+ org: org!,version: info.latest_version,latest_version: info.latest_version,latest_package_identifier: info.latest_package_identifier,diff --git a/web/app/components/plugins/plugin-page/use-uploader.ts b/web/app/components/plugins/plugin-page/use-uploader.tsindex 7df1cb95e3d..17699e7b9d3 100644--- a/web/app/components/plugins/plugin-page/use-uploader.ts+++ b/web/app/components/plugins/plugin-page/use-uploader.ts@@ -38,7 +38,7 @@ export const useUploader = ({ onFileChange, containerRef, enabled = true }: Uploreturnconst files = Array.from(e.dataTransfer.files)if (files.length > 0)- onFileChange(files[0])+ onFileChange(files[0]!)}const fileChangeHandle = enableddiff --git a/web/app/components/plugins/reference-setting-modal/__tests__/index.spec.tsx b/web/app/components/plugins/reference-setting-modal/__tests__/index.spec.tsxindex 26eeb7fe038..f71780e2df0 100644--- a/web/app/components/plugins/reference-setting-modal/__tests__/index.spec.tsx+++ b/web/app/components/plugins/reference-setting-modal/__tests__/index.spec.tsx@@ -148,7 +148,8 @@ describe('reference-setting-modal', () => {render(<ReferenceSettingModal {...defaultProps} />)// Assert- expect(screen.getByText('plugin.privilege.title')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('plugin.privilege.title'))!.toBeInTheDocument()})it('should render install permission section', () => {@@ -156,7 +157,8 @@ describe('reference-setting-modal', () => {render(<ReferenceSettingModal {...defaultProps} />)// Assert- expect(screen.getByText('plugin.privilege.whoCanInstall')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('plugin.privilege.whoCanInstall'))!.toBeInTheDocument()})it('should render debug permission section', () => {@@ -164,7 +166,8 @@ describe('reference-setting-modal', () => {render(<ReferenceSettingModal {...defaultProps} />)// Assert- expect(screen.getByText('plugin.privilege.whoCanDebug')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('plugin.privilege.whoCanDebug'))!.toBeInTheDocument()})it('should render all permission options for install', () => {@@ -180,8 +183,9 @@ describe('reference-setting-modal', () => {render(<ReferenceSettingModal {...defaultProps} />)// Assert- expect(screen.getByText('common.operation.cancel')).toBeInTheDocument()- expect(screen.getByText('common.operation.save')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('common.operation.cancel'))!.toBeInTheDocument()+ expect(screen.getByText('common.operation.save'))!.toBeInTheDocument()})it('should render AutoUpdateSetting when marketplace is enabled', () => {@@ -192,7 +196,8 @@ describe('reference-setting-modal', () => {render(<ReferenceSettingModal {...defaultProps} />)// Assert- expect(screen.getByTestId('auto-update-setting')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('auto-update-setting'))!.toBeInTheDocument()})it('should not render AutoUpdateSetting when marketplace is disabled', () => {@@ -202,6 +207,37 @@ describe('reference-setting-modal', () => {// Actrender(<ReferenceSettingModal {...defaultProps} />)+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert// Assertexpect(screen.queryByTestId('auto-update-setting')).not.toBeInTheDocument()})@@ -211,7 +247,8 @@ describe('reference-setting-modal', () => {render(<ReferenceSettingModal {...defaultProps} />)// Assert- expect(screen.getByTestId('modal-close')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('modal-close'))!.toBeInTheDocument()})})@@ -230,11 +267,11 @@ describe('reference-setting-modal', () => {// Assert - admin option should be selected for install (first one)const adminOptions = screen.getAllByTestId('option-card-plugin.privilege.admins')- expect(adminOptions[0]).toHaveAttribute('aria-pressed', 'true') // Install permission+ expect(adminOptions[0])!.toHaveAttribute('aria-pressed', 'true') // Install permission// Assert - noOne option should be selected for debug (second one)const noOneOptions = screen.getAllByTestId('option-card-plugin.privilege.noone')- expect(noOneOptions[1]).toHaveAttribute('aria-pressed', 'true') // Debug permission+ expect(noOneOptions[1])!.toHaveAttribute('aria-pressed', 'true') // Debug permission})it('should update tempPrivilege when permission option is clicked', () => {@@ -243,10 +280,11 @@ describe('reference-setting-modal', () => {// Act - click on "No One" for install permissionconst noOneOptions = screen.getAllByTestId('option-card-plugin.privilege.noone')- fireEvent.click(noOneOptions[0]) // First one is for install permission+ fireEvent.click(noOneOptions[0]!) // First one is for install permission// Assert - the option should now be selected- expect(noOneOptions[0]).toHaveAttribute('aria-pressed', 'true')+ // Assert - the option should now be selected+ expect(noOneOptions[0])!.toHaveAttribute('aria-pressed', 'true')})it('should initialize with payload auto_upgrade values', () => {@@ -261,7 +299,8 @@ describe('reference-setting-modal', () => {render(<ReferenceSettingModal {...defaultProps} payload={payload} />)// Assert- expect(screen.getByTestId('auto-update-strategy')).toHaveTextContent('latest')+ // Assert+ expect(screen.getByTestId('auto-update-strategy'))!.toHaveTextContent('latest')})it('should use default auto_upgrade when payload.auto_upgrade is undefined', () => {@@ -275,7 +314,8 @@ describe('reference-setting-modal', () => {render(<ReferenceSettingModal {...defaultProps} payload={payload} />)// Assert - should use default value (disabled)- expect(screen.getByTestId('auto-update-strategy')).toHaveTextContent('disabled')+ // Assert - should use default value (disabled)+ expect(screen.getByTestId('auto-update-strategy'))!.toHaveTextContent('disabled')})})@@ -351,10 +391,11 @@ describe('reference-setting-modal', () => {// Click Everyone for install permissionconst everyoneOptions = screen.getAllByTestId('option-card-plugin.privilege.everyone')- fireEvent.click(everyoneOptions[0])+ fireEvent.click(everyoneOptions[0]!)// Assert- expect(everyoneOptions[0]).toHaveAttribute('aria-pressed', 'true')+ // Assert+ expect(everyoneOptions[0])!.toHaveAttribute('aria-pressed', 'true')})it('should update debug permission when Admins Only option is clicked', () => {@@ -371,10 +412,11 @@ describe('reference-setting-modal', () => {// Click Admins Only for debug permission (second set of options)const adminOptions = screen.getAllByTestId('option-card-plugin.privilege.admins')- fireEvent.click(adminOptions[1]) // Second one is for debug permission+ fireEvent.click(adminOptions[1]!) // Second one is for debug permission// Assert- expect(adminOptions[1]).toHaveAttribute('aria-pressed', 'true')+ // Assert+ expect(adminOptions[1])!.toHaveAttribute('aria-pressed', 'true')})it('should update auto_upgrade config when changed in AutoUpdateSetting', async () => {@@ -410,7 +452,8 @@ describe('reference-setting-modal', () => {rerender(<ReferenceSettingModal {...defaultProps} />)// Assert - component should render without issues- expect(screen.getByText('plugin.privilege.title')).toBeInTheDocument()+ // Assert - component should render without issues+ expect(screen.getByText('plugin.privilege.title'))!.toBeInTheDocument()})it('handleSave should be memoized with useCallback', async () => {@@ -434,10 +477,11 @@ describe('reference-setting-modal', () => {// Act - click install permission optionconst everyoneOptions = screen.getAllByTestId('option-card-plugin.privilege.everyone')- fireEvent.click(everyoneOptions[0])+ fireEvent.click(everyoneOptions[0]!)// Assert - install permission should be updated- expect(everyoneOptions[0]).toHaveAttribute('aria-pressed', 'true')+ // Assert - install permission should be updated+ expect(everyoneOptions[0])!.toHaveAttribute('aria-pressed', 'true')})})@@ -456,7 +500,7 @@ describe('reference-setting-modal', () => {// Act & Assert - should not crashrender(<ReferenceSettingModal {...defaultProps} payload={payload} />)- expect(screen.getByText('plugin.privilege.title')).toBeInTheDocument()+ expect(screen.getByText('plugin.privilege.title'))!.toBeInTheDocument()})it('should handle undefined permission values', () => {@@ -471,7 +515,7 @@ describe('reference-setting-modal', () => {// Assert - should use default PermissionType.noOneconst noOneOptions = screen.getAllByTestId('option-card-plugin.privilege.noone')- expect(noOneOptions[0]).toHaveAttribute('aria-pressed', 'true')+ expect(noOneOptions[0])!.toHaveAttribute('aria-pressed', 'true')})it('should handle missing install_permission', () => {@@ -487,7 +531,8 @@ describe('reference-setting-modal', () => {render(<ReferenceSettingModal {...defaultProps} payload={payload} />)// Assert - should fall back to PermissionType.noOne- expect(screen.getByText('plugin.privilege.title')).toBeInTheDocument()+ // Assert - should fall back to PermissionType.noOne+ expect(screen.getByText('plugin.privilege.title'))!.toBeInTheDocument()})it('should handle missing debug_permission', () => {@@ -503,7 +548,8 @@ describe('reference-setting-modal', () => {render(<ReferenceSettingModal {...defaultProps} payload={payload} />)// Assert - should fall back to PermissionType.noOne- expect(screen.getByText('plugin.privilege.title')).toBeInTheDocument()+ // Assert - should fall back to PermissionType.noOne+ expect(screen.getByText('plugin.privilege.title'))!.toBeInTheDocument()})it('should handle slow async onSave gracefully', async () => {@@ -555,7 +601,8 @@ describe('reference-setting-modal', () => {const { unmount } = render(<ReferenceSettingModal {...defaultProps} payload={payload} />)// Assert - should render without crashing- expect(screen.getByText('plugin.privilege.title')).toBeInTheDocument()+ // Assert - should render without crashing+ expect(screen.getByText('plugin.privilege.title'))!.toBeInTheDocument()unmount()})@@ -582,7 +629,8 @@ describe('reference-setting-modal', () => {const { unmount } = render(<ReferenceSettingModal {...defaultProps} payload={payload} />)// Assert- expect(screen.getByTestId('auto-update-strategy')).toHaveTextContent(strategy)+ // Assert+ expect(screen.getByTestId('auto-update-strategy'))!.toHaveTextContent(strategy)unmount()})@@ -608,7 +656,8 @@ describe('reference-setting-modal', () => {const { unmount } = render(<ReferenceSettingModal {...defaultProps} payload={payload} />)// Assert- expect(screen.getByTestId('auto-update-mode')).toHaveTextContent(mode)+ // Assert+ expect(screen.getByTestId('auto-update-mode'))!.toHaveTextContent(mode)unmount()})@@ -631,7 +680,7 @@ describe('reference-setting-modal', () => {// Change install permission to noOneconst noOneOptions = screen.getAllByTestId('option-card-plugin.privilege.noone')- fireEvent.click(noOneOptions[0])+ fireEvent.click(noOneOptions[0]!)// SavefireEvent.click(screen.getByText('common.operation.save'))@@ -662,7 +711,7 @@ describe('reference-setting-modal', () => {// Change debug permission to noOneconst noOneOptions = screen.getAllByTestId('option-card-plugin.privilege.noone')- fireEvent.click(noOneOptions[1]) // Second one is for debug+ fireEvent.click(noOneOptions[1]!) // Second one is for debug// SavefireEvent.click(screen.getByText('common.operation.save'))@@ -691,7 +740,7 @@ describe('reference-setting-modal', () => {// Change install permissionconst everyoneOptions = screen.getAllByTestId('option-card-plugin.privilege.everyone')- fireEvent.click(everyoneOptions[0])+ fireEvent.click(everyoneOptions[0]!)// SavefireEvent.click(screen.getByText('common.operation.save'))@@ -717,7 +766,7 @@ describe('reference-setting-modal', () => {// Assertconst modal = screen.getByTestId('modal')- expect(modal).toHaveClass('w-[620px]', 'max-w-[620px]', 'p-0!')+ expect(modal)!.toHaveClass('w-[620px]', 'max-w-[620px]', 'p-0!')})it('should pass isShow=true to Modal', () => {@@ -725,7 +774,8 @@ describe('reference-setting-modal', () => {render(<ReferenceSettingModal {...defaultProps} />)// Assert - modal should be visible- expect(screen.getByTestId('modal')).toBeInTheDocument()+ // Assert - modal should be visible+ expect(screen.getByTestId('modal'))!.toBeInTheDocument()})})@@ -736,8 +786,8 @@ describe('reference-setting-modal', () => {// Assert - check order by getting all section labelsconst labels = screen.getAllByText(/plugin\.privilege\.whoCan/)- expect(labels[0]).toHaveTextContent('plugin.privilege.whoCanInstall')- expect(labels[1]).toHaveTextContent('plugin.privilege.whoCanDebug')+ expect(labels[0])!.toHaveTextContent('plugin.privilege.whoCanInstall')+ expect(labels[1])!.toHaveTextContent('plugin.privilege.whoCanDebug')})it('should render three options per permission section', () => {@@ -762,8 +812,8 @@ describe('reference-setting-modal', () => {const cancelButton = screen.getByText('common.operation.cancel')const saveButton = screen.getByText('common.operation.save')- expect(cancelButton).toBeInTheDocument()- expect(saveButton).toBeInTheDocument()+ expect(cancelButton)!.toBeInTheDocument()+ expect(saveButton)!.toBeInTheDocument()})})})@@ -797,11 +847,11 @@ describe('reference-setting-modal', () => {// Change install permission to Everyoneconst everyoneOptions = screen.getAllByTestId('option-card-plugin.privilege.everyone')- fireEvent.click(everyoneOptions[0])+ fireEvent.click(everyoneOptions[0]!)// Change debug permission to Admins Onlyconst adminOptions = screen.getAllByTestId('option-card-plugin.privilege.admins')- fireEvent.click(adminOptions[1])+ fireEvent.click(adminOptions[1]!)// Change auto-update strategyfireEvent.click(screen.getByTestId('auto-update-change'))@@ -841,7 +891,7 @@ describe('reference-setting-modal', () => {// Make some changesconst noOneOptions = screen.getAllByTestId('option-card-plugin.privilege.noone')- fireEvent.click(noOneOptions[0])+ fireEvent.click(noOneOptions[0]!)// CancelfireEvent.click(screen.getByText('common.operation.cancel'))@@ -863,8 +913,9 @@ describe('reference-setting-modal', () => {render(<ReferenceSettingModal {...props} />)// Assert - Labels are rendered correctly- expect(screen.getByText('plugin.privilege.whoCanInstall')).toBeInTheDocument()- expect(screen.getByText('plugin.privilege.whoCanDebug')).toBeInTheDocument()+ // Assert - Labels are rendered correctly+ expect(screen.getByText('plugin.privilege.whoCanInstall'))!.toBeInTheDocument()+ expect(screen.getByText('plugin.privilege.whoCanDebug'))!.toBeInTheDocument()})})})diff --git a/web/app/components/plugins/update-plugin/plugin-version-picker.tsx b/web/app/components/plugins/update-plugin/plugin-version-picker.tsxindex 0266c05069b..d590f0c9eb8 100644--- a/web/app/components/plugins/update-plugin/plugin-version-picker.tsx+++ b/web/app/components/plugins/update-plugin/plugin-version-picker.tsx@@ -107,7 +107,7 @@ const PluginVersionPicker: FC<Props> = ({<div className="system-sm-medium text-text-secondary">{version.version}</div>{currentVersion === version.version && <Badge className="ml-1" text="CURRENT" />}</div>- <div className="shrink-0 system-xs-regular text-text-tertiary">{formatDate(version.created_at, format)}</div>+ <div className="shrink-0 system-xs-regular text-text-tertiary">{formatDate(version.created_at, format!)}</div></div>))}</div>diff --git a/web/app/components/rag-pipeline/components/chunk-card-list/__tests__/index.spec.tsx b/web/app/components/rag-pipeline/components/chunk-card-list/__tests__/index.spec.tsxindex 2fab56f0eab..4827481579b 100644--- a/web/app/components/rag-pipeline/components/chunk-card-list/__tests__/index.spec.tsx+++ b/web/app/components/rag-pipeline/components/chunk-card-list/__tests__/index.spec.tsx@@ -61,15 +61,15 @@ describe('QAItem', () => {it('should render question type with Q prefix', () => {render(<QAItem type={QAItemType.Question} text="What is this?" />)- expect(screen.getByText('Q')).toBeInTheDocument()- expect(screen.getByText('What is this?')).toBeInTheDocument()+ expect(screen.getByText('Q'))!.toBeInTheDocument()+ expect(screen.getByText('What is this?'))!.toBeInTheDocument()})it('should render answer type with A prefix', () => {render(<QAItem type={QAItemType.Answer} text="This is the answer." />)- expect(screen.getByText('A')).toBeInTheDocument()- expect(screen.getByText('This is the answer.')).toBeInTheDocument()+ expect(screen.getByText('A'))!.toBeInTheDocument()+ expect(screen.getByText('This is the answer.'))!.toBeInTheDocument()})})@@ -77,7 +77,7 @@ describe('QAItem', () => {it('should render with empty text', () => {render(<QAItem type={QAItemType.Question} text="" />)- expect(screen.getByText('Q')).toBeInTheDocument()+ expect(screen.getByText('Q'))!.toBeInTheDocument()})it('should render with long text content', () => {@@ -85,7 +85,7 @@ describe('QAItem', () => {render(<QAItem type={QAItemType.Answer} text={longText} />)- expect(screen.getByText(longText)).toBeInTheDocument()+ expect(screen.getByText(longText))!.toBeInTheDocument()})it('should render with special characters in text', () => {@@ -93,7 +93,7 @@ describe('QAItem', () => {render(<QAItem type={QAItemType.Question} text={specialText} />)- expect(screen.getByText(specialText)).toBeInTheDocument()+ expect(screen.getByText(specialText))!.toBeInTheDocument()})})@@ -101,11 +101,11 @@ describe('QAItem', () => {it('should be memoized with React.memo', () => {const { rerender } = render(<QAItem type={QAItemType.Question} text="Test" />)- expect(screen.getByText('Q')).toBeInTheDocument()- expect(screen.getByText('Test')).toBeInTheDocument()+ expect(screen.getByText('Q'))!.toBeInTheDocument()+ expect(screen.getByText('Test'))!.toBeInTheDocument()rerender(<QAItem type={QAItemType.Question} text="Test" />)- expect(screen.getByText('Q')).toBeInTheDocument()+ expect(screen.getByText('Q'))!.toBeInTheDocument()})})})@@ -120,14 +120,14 @@ describe('ChunkCard', () => {render(<ChunkCardchunkType={ChunkingMode.text}- content={createGeneralChunks()[0]}+ content={createGeneralChunks()[0]!}wordCount={27}positionId={1}/>,)- expect(screen.getByText('This is the first chunk of text content.')).toBeInTheDocument()- expect(screen.getByText(/Chunk-01/)).toBeInTheDocument()+ expect(screen.getByText('This is the first chunk of text content.'))!.toBeInTheDocument()+ expect(screen.getByText(/Chunk-01/))!.toBeInTheDocument()})it('should render QA chunk type with question and answer', () => {@@ -145,10 +145,10 @@ describe('ChunkCard', () => {/>,)- expect(screen.getByText('Q')).toBeInTheDocument()- expect(screen.getByText('What is React?')).toBeInTheDocument()- expect(screen.getByText('A')).toBeInTheDocument()- expect(screen.getByText('React is a JavaScript library.')).toBeInTheDocument()+ expect(screen.getByText('Q'))!.toBeInTheDocument()+ expect(screen.getByText('What is React?'))!.toBeInTheDocument()+ expect(screen.getByText('A'))!.toBeInTheDocument()+ expect(screen.getByText('React is a JavaScript library.'))!.toBeInTheDocument()})it('should render parent-child chunk type with child contents', () => {@@ -164,10 +164,10 @@ describe('ChunkCard', () => {/>,)- expect(screen.getByText('Child 1 content')).toBeInTheDocument()- expect(screen.getByText('Child 2 content')).toBeInTheDocument()- expect(screen.getByText('C-1')).toBeInTheDocument()- expect(screen.getByText('C-2')).toBeInTheDocument()+ expect(screen.getByText('Child 1 content'))!.toBeInTheDocument()+ expect(screen.getByText('Child 2 content'))!.toBeInTheDocument()+ expect(screen.getByText('C-1'))!.toBeInTheDocument()+ expect(screen.getByText('C-2'))!.toBeInTheDocument()})})@@ -183,7 +183,7 @@ describe('ChunkCard', () => {/>,)- expect(screen.getByText(/Parent-Chunk-01/)).toBeInTheDocument()+ expect(screen.getByText(/Parent-Chunk-01/))!.toBeInTheDocument()})it('should hide segment index tag for full-doc mode', () => {@@ -205,13 +205,13 @@ describe('ChunkCard', () => {render(<ChunkCardchunkType={ChunkingMode.text}- content={createGeneralChunks()[0]}+ content={createGeneralChunks()[0]!}wordCount={12}positionId={5}/>,)- expect(screen.getByText(/Chunk-05/)).toBeInTheDocument()+ expect(screen.getByText(/Chunk-05/))!.toBeInTheDocument()})})@@ -220,26 +220,26 @@ describe('ChunkCard', () => {render(<ChunkCardchunkType={ChunkingMode.text}- content={createGeneralChunks()[0]}+ content={createGeneralChunks()[0]!}wordCount={1234}positionId={1}/>,)- expect(screen.getByText(/1,234/)).toBeInTheDocument()+ expect(screen.getByText(/1,234/))!.toBeInTheDocument()})it('should display word count with character translation key', () => {render(<ChunkCardchunkType={ChunkingMode.text}- content={createGeneralChunks()[0]}+ content={createGeneralChunks()[0]!}wordCount={100}positionId={1}/>,)- expect(screen.getByText(/100\s+(?:\S.*)?characters/)).toBeInTheDocument()+ expect(screen.getByText(/100\s+(?:\S.*)?characters/))!.toBeInTheDocument()})it('should not display word count info for full-doc mode', () => {@@ -262,39 +262,39 @@ describe('ChunkCard', () => {render(<ChunkCardchunkType={ChunkingMode.text}- content={createGeneralChunks()[0]}+ content={createGeneralChunks()[0]!}wordCount={7}positionId={42}/>,)- expect(screen.getByText(/Chunk-42/)).toBeInTheDocument()+ expect(screen.getByText(/Chunk-42/))!.toBeInTheDocument()})it('should handle string position ID', () => {render(<ChunkCardchunkType={ChunkingMode.text}- content={createGeneralChunks()[0]}+ content={createGeneralChunks()[0]!}wordCount={7}positionId="99"/>,)- expect(screen.getByText(/Chunk-99/)).toBeInTheDocument()+ expect(screen.getByText(/Chunk-99/))!.toBeInTheDocument()})it('should pad single digit position ID', () => {render(<ChunkCardchunkType={ChunkingMode.text}- content={createGeneralChunks()[0]}+ content={createGeneralChunks()[0]!}wordCount={7}positionId={3}/>,)- expect(screen.getByText(/Chunk-03/)).toBeInTheDocument()+ expect(screen.getByText(/Chunk-03/))!.toBeInTheDocument()})})@@ -310,7 +310,7 @@ describe('ChunkCard', () => {/>,)- expect(screen.getByText(/Parent-Chunk/)).toBeInTheDocument()+ expect(screen.getByText(/Parent-Chunk/))!.toBeInTheDocument()rerender(<ChunkCard@@ -338,7 +338,7 @@ describe('ChunkCard', () => {/>,)- expect(screen.getByText('Initial content')).toBeInTheDocument()+ expect(screen.getByText('Initial content'))!.toBeInTheDocument()rerender(<ChunkCard@@ -349,7 +349,7 @@ describe('ChunkCard', () => {/>,)- expect(screen.getByText('Updated content')).toBeInTheDocument()+ expect(screen.getByText('Updated content'))!.toBeInTheDocument()expect(screen.queryByText('Initial content')).not.toBeInTheDocument()})@@ -364,7 +364,7 @@ describe('ChunkCard', () => {/>,)- expect(screen.getByText('Text content')).toBeInTheDocument()+ expect(screen.getByText('Text content'))!.toBeInTheDocument()const qaContent: QAChunk = { question: 'Q?', answer: 'A.' }rerender(@@ -376,8 +376,8 @@ describe('ChunkCard', () => {/>,)- expect(screen.getByText('Q')).toBeInTheDocument()- expect(screen.getByText('Q?')).toBeInTheDocument()+ expect(screen.getByText('Q'))!.toBeInTheDocument()+ expect(screen.getByText('Q?'))!.toBeInTheDocument()})})@@ -393,7 +393,7 @@ describe('ChunkCard', () => {/>,)- expect(screen.getByText(/Parent-Chunk-01/)).toBeInTheDocument()+ expect(screen.getByText(/Parent-Chunk-01/))!.toBeInTheDocument()})it('should handle QA chunk with empty strings', () => {@@ -408,8 +408,8 @@ describe('ChunkCard', () => {/>,)- expect(screen.getByText('Q')).toBeInTheDocument()- expect(screen.getByText('A')).toBeInTheDocument()+ expect(screen.getByText('Q'))!.toBeInTheDocument()+ expect(screen.getByText('A'))!.toBeInTheDocument()})it('should handle very long content', () => {@@ -425,20 +425,20 @@ describe('ChunkCard', () => {/>,)- expect(screen.getByText(longContent)).toBeInTheDocument()+ expect(screen.getByText(longContent))!.toBeInTheDocument()})it('should handle zero word count', () => {render(<ChunkCardchunkType={ChunkingMode.text}- content={createGeneralChunks()[0]}+ content={createGeneralChunks()[0]!}wordCount={0}positionId={1}/>,)- expect(screen.getByText(/0\s+(?:\S.*)?characters/)).toBeInTheDocument()+ expect(screen.getByText(/0\s+(?:\S.*)?characters/))!.toBeInTheDocument()})})})@@ -459,9 +459,9 @@ describe('ChunkCardList', () => {/>,)- expect(screen.getByText(chunks[0].content)).toBeInTheDocument()- expect(screen.getByText(chunks[1].content)).toBeInTheDocument()- expect(screen.getByText(chunks[2].content)).toBeInTheDocument()+ expect(screen.getByText(chunks[0]!.content))!.toBeInTheDocument()+ expect(screen.getByText(chunks[1]!.content))!.toBeInTheDocument()+ expect(screen.getByText(chunks[2]!.content))!.toBeInTheDocument()})it('should render parent-child chunks correctly', () => {@@ -475,9 +475,9 @@ describe('ChunkCardList', () => {/>,)- expect(screen.getByText('Child content 1')).toBeInTheDocument()- expect(screen.getByText('Child content 2')).toBeInTheDocument()- expect(screen.getByText('Another child 1')).toBeInTheDocument()+ expect(screen.getByText('Child content 1'))!.toBeInTheDocument()+ expect(screen.getByText('Child content 2'))!.toBeInTheDocument()+ expect(screen.getByText('Another child 1'))!.toBeInTheDocument()})it('should render QA chunks correctly', () => {@@ -490,10 +490,10 @@ describe('ChunkCardList', () => {/>,)- expect(screen.getByText('What is the answer to life?')).toBeInTheDocument()- expect(screen.getByText('The answer is 42.')).toBeInTheDocument()- expect(screen.getByText('How does this work?')).toBeInTheDocument()- expect(screen.getByText('It works by processing data.')).toBeInTheDocument()+ expect(screen.getByText('What is the answer to life?'))!.toBeInTheDocument()+ expect(screen.getByText('The answer is 42.'))!.toBeInTheDocument()+ expect(screen.getByText('How does this work?'))!.toBeInTheDocument()+ expect(screen.getByText('It works by processing data.'))!.toBeInTheDocument()})})@@ -511,8 +511,8 @@ describe('ChunkCardList', () => {/>,)- expect(screen.getByText('Chunk 1')).toBeInTheDocument()- expect(screen.getByText('Chunk 2')).toBeInTheDocument()+ expect(screen.getByText('Chunk 1'))!.toBeInTheDocument()+ expect(screen.getByText('Chunk 2'))!.toBeInTheDocument()})it('should extract parent_child_chunks from ParentChildChunks for parentChild mode', () => {@@ -530,7 +530,7 @@ describe('ChunkCardList', () => {/>,)- expect(screen.getByText('Specific child')).toBeInTheDocument()+ expect(screen.getByText('Specific child'))!.toBeInTheDocument()})it('should extract qa_chunks from QAChunks for qa mode', () => {@@ -547,8 +547,8 @@ describe('ChunkCardList', () => {/>,)- expect(screen.getByText('Specific Q')).toBeInTheDocument()- expect(screen.getByText('Specific A')).toBeInTheDocument()+ expect(screen.getByText('Specific Q'))!.toBeInTheDocument()+ expect(screen.getByText('Specific A'))!.toBeInTheDocument()})it('should update chunkList when chunkInfo changes', () => {@@ -561,7 +561,7 @@ describe('ChunkCardList', () => {/>,)- expect(screen.getByText('Initial chunk')).toBeInTheDocument()+ expect(screen.getByText('Initial chunk'))!.toBeInTheDocument()const updatedChunks = createGeneralChunks([{ content: 'Updated chunk' }])rerender(@@ -571,7 +571,7 @@ describe('ChunkCardList', () => {/>,)- expect(screen.getByText('Updated chunk')).toBeInTheDocument()+ expect(screen.getByText('Updated chunk'))!.toBeInTheDocument()expect(screen.queryByText('Initial chunk')).not.toBeInTheDocument()})})@@ -587,7 +587,7 @@ describe('ChunkCardList', () => {/>,)- expect(screen.getByText(/5\s+(?:\S.*)?characters/)).toBeInTheDocument()+ expect(screen.getByText(/5\s+(?:\S.*)?characters/))!.toBeInTheDocument()})it('should calculate word count for parent-child chunks using parent_content length', () => {@@ -608,7 +608,7 @@ describe('ChunkCardList', () => {/>,)- expect(screen.getByText(/6\s+(?:\S.*)?characters/)).toBeInTheDocument()+ expect(screen.getByText(/6\s+(?:\S.*)?characters/))!.toBeInTheDocument()})it('should calculate word count for QA chunks using question + answer length', () => {@@ -625,7 +625,7 @@ describe('ChunkCardList', () => {/>,)- expect(screen.getByText(/5\s+(?:\S.*)?characters/)).toBeInTheDocument()+ expect(screen.getByText(/5\s+(?:\S.*)?characters/))!.toBeInTheDocument()})})@@ -644,9 +644,9 @@ describe('ChunkCardList', () => {/>,)- expect(screen.getByText(/Chunk-01/)).toBeInTheDocument()- expect(screen.getByText(/Chunk-02/)).toBeInTheDocument()- expect(screen.getByText(/Chunk-03/)).toBeInTheDocument()+ expect(screen.getByText(/Chunk-01/))!.toBeInTheDocument()+ expect(screen.getByText(/Chunk-02/))!.toBeInTheDocument()+ expect(screen.getByText(/Chunk-03/))!.toBeInTheDocument()})})@@ -662,7 +662,7 @@ describe('ChunkCardList', () => {/>,)- expect(container.firstChild).toHaveClass('custom-class')+ expect(container.firstChild)!.toHaveClass('custom-class')})it('should merge custom className with default classes', () => {@@ -676,10 +676,10 @@ describe('ChunkCardList', () => {/>,)- expect(container.firstChild).toHaveClass('flex')- expect(container.firstChild).toHaveClass('w-full')- expect(container.firstChild).toHaveClass('flex-col')- expect(container.firstChild).toHaveClass('my-custom-class')+ expect(container.firstChild)!.toHaveClass('flex')+ expect(container.firstChild)!.toHaveClass('w-full')+ expect(container.firstChild)!.toHaveClass('flex-col')+ expect(container.firstChild)!.toHaveClass('my-custom-class')})it('should render without className prop', () => {@@ -692,8 +692,8 @@ describe('ChunkCardList', () => {/>,)- expect(container.firstChild).toHaveClass('flex')- expect(container.firstChild).toHaveClass('w-full')+ expect(container.firstChild)!.toHaveClass('flex')+ expect(container.firstChild)!.toHaveClass('w-full')})})@@ -738,7 +738,7 @@ describe('ChunkCardList', () => {/>,)- expect(screen.getByText(/Chunk-01/)).toBeInTheDocument()+ expect(screen.getByText(/Chunk-01/))!.toBeInTheDocument()})})@@ -753,7 +753,7 @@ describe('ChunkCardList', () => {/>,)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()expect(container.firstChild?.childNodes.length).toBe(0)})@@ -771,7 +771,7 @@ describe('ChunkCardList', () => {/>,)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()expect(container.firstChild?.childNodes.length).toBe(0)})@@ -787,7 +787,7 @@ describe('ChunkCardList', () => {/>,)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()expect(container.firstChild?.childNodes.length).toBe(0)})@@ -801,8 +801,8 @@ describe('ChunkCardList', () => {/>,)- expect(screen.getByText('Single chunk')).toBeInTheDocument()- expect(screen.getByText(/Chunk-01/)).toBeInTheDocument()+ expect(screen.getByText('Single chunk'))!.toBeInTheDocument()+ expect(screen.getByText(/Chunk-01/))!.toBeInTheDocument()})it('should handle large number of chunks', () => {@@ -815,9 +815,9 @@ describe('ChunkCardList', () => {/>,)- expect(screen.getByText('Chunk number 1')).toBeInTheDocument()- expect(screen.getByText('Chunk number 100')).toBeInTheDocument()- expect(screen.getByText(/Chunk-100/)).toBeInTheDocument()+ expect(screen.getByText('Chunk number 1'))!.toBeInTheDocument()+ expect(screen.getByText('Chunk number 100'))!.toBeInTheDocument()+ expect(screen.getByText(/Chunk-100/))!.toBeInTheDocument()})})@@ -861,15 +861,15 @@ describe('ChunkCardList Integration', () => {/>,)- expect(screen.getByText('First paragraph of the document.')).toBeInTheDocument()- expect(screen.getByText(/Chunk-01/)).toBeInTheDocument()- expect(screen.getByText(/32\s+(?:\S.*)?characters/)).toBeInTheDocument()+ expect(screen.getByText('First paragraph of the document.'))!.toBeInTheDocument()+ expect(screen.getByText(/Chunk-01/))!.toBeInTheDocument()+ expect(screen.getByText(/32\s+(?:\S.*)?characters/))!.toBeInTheDocument()- expect(screen.getByText('Second paragraph with more information.')).toBeInTheDocument()- expect(screen.getByText(/Chunk-02/)).toBeInTheDocument()+ expect(screen.getByText('Second paragraph with more information.'))!.toBeInTheDocument()+ expect(screen.getByText(/Chunk-02/))!.toBeInTheDocument()- expect(screen.getByText('Final paragraph concluding the content.')).toBeInTheDocument()- expect(screen.getByText(/Chunk-03/)).toBeInTheDocument()+ expect(screen.getByText('Final paragraph concluding the content.'))!.toBeInTheDocument()+ expect(screen.getByText(/Chunk-03/))!.toBeInTheDocument()})it('should render complete parent-child chunking workflow', () => {@@ -894,11 +894,11 @@ describe('ChunkCardList Integration', () => {/>,)- expect(screen.getByText('React components are building blocks.')).toBeInTheDocument()- expect(screen.getByText('Lifecycle methods control component behavior.')).toBeInTheDocument()- expect(screen.getByText('C-1')).toBeInTheDocument()- expect(screen.getByText('C-2')).toBeInTheDocument()- expect(screen.getByText(/Parent-Chunk-01/)).toBeInTheDocument()+ expect(screen.getByText('React components are building blocks.'))!.toBeInTheDocument()+ expect(screen.getByText('Lifecycle methods control component behavior.'))!.toBeInTheDocument()+ expect(screen.getByText('C-1'))!.toBeInTheDocument()+ expect(screen.getByText('C-2'))!.toBeInTheDocument()+ expect(screen.getByText(/Parent-Chunk-01/))!.toBeInTheDocument()})it('should render complete QA chunking workflow', () => {@@ -927,10 +927,10 @@ describe('ChunkCardList Integration', () => {expect(qLabels.length).toBe(2)expect(aLabels.length).toBe(2)- expect(screen.getByText('What is Dify?')).toBeInTheDocument()- expect(screen.getByText('Dify is an open-source LLM application development platform.')).toBeInTheDocument()- expect(screen.getByText('How do I get started?')).toBeInTheDocument()- expect(screen.getByText('You can start by installing the platform using Docker.')).toBeInTheDocument()+ expect(screen.getByText('What is Dify?'))!.toBeInTheDocument()+ expect(screen.getByText('Dify is an open-source LLM application development platform.'))!.toBeInTheDocument()+ expect(screen.getByText('How do I get started?'))!.toBeInTheDocument()+ expect(screen.getByText('You can start by installing the platform using Docker.'))!.toBeInTheDocument()})})@@ -946,7 +946,7 @@ describe('ChunkCardList Integration', () => {/>,)- expect(screen.getByText('Text content')).toBeInTheDocument()+ expect(screen.getByText('Text content'))!.toBeInTheDocument()rerender(<ChunkCardList@@ -956,7 +956,7 @@ describe('ChunkCardList Integration', () => {)expect(screen.queryByText('Text content')).not.toBeInTheDocument()- expect(screen.getByText('What is the answer to life?')).toBeInTheDocument()+ expect(screen.getByText('What is the answer to life?'))!.toBeInTheDocument()})it('should handle switching from text to parent-child type', () => {@@ -970,8 +970,8 @@ describe('ChunkCardList Integration', () => {/>,)- expect(screen.getByText('Simple text')).toBeInTheDocument()- expect(screen.getByText(/Chunk-01/)).toBeInTheDocument()+ expect(screen.getByText('Simple text'))!.toBeInTheDocument()+ expect(screen.getByText(/Chunk-01/))!.toBeInTheDocument()rerender(<ChunkCardListdiff --git a/web/app/components/rag-pipeline/components/panel/input-field/__tests__/index.spec.tsx b/web/app/components/rag-pipeline/components/panel/input-field/__tests__/index.spec.tsxindex ab99a1eeefe..3146695caee 100644--- a/web/app/components/rag-pipeline/components/panel/input-field/__tests__/index.spec.tsx+++ b/web/app/components/rag-pipeline/components/panel/input-field/__tests__/index.spec.tsx@@ -195,61 +195,51 @@ describe('InputFieldPanel', () => {it('should render panel without crashing', () => {render(<InputFieldPanel />)- expect(- screen.getByText('datasetPipeline.inputFieldPanel.title'),- ).toBeInTheDocument()+ expect(screen.getByText('datasetPipeline.inputFieldPanel.title'))!.toBeInTheDocument()})it('should render panel title correctly', () => {render(<InputFieldPanel />)- expect(- screen.getByText('datasetPipeline.inputFieldPanel.title'),- ).toBeInTheDocument()+ expect(screen.getByText('datasetPipeline.inputFieldPanel.title'))!.toBeInTheDocument()})it('should render panel description', () => {render(<InputFieldPanel />)- expect(- screen.getByText('datasetPipeline.inputFieldPanel.description'),- ).toBeInTheDocument()+ expect(screen.getByText('datasetPipeline.inputFieldPanel.description'))!.toBeInTheDocument()})it('should render preview button', () => {render(<InputFieldPanel />)- expect(- screen.getByText('datasetPipeline.operations.preview'),- ).toBeInTheDocument()+ expect(screen.getByText('datasetPipeline.operations.preview'))!.toBeInTheDocument()})it('should render close button', () => {render(<InputFieldPanel />)const closeButton = screen.getByRole('button', { name: '' })- expect(closeButton).toBeInTheDocument()+ expect(closeButton)!.toBeInTheDocument()})it('should render footer tip component', () => {render(<InputFieldPanel />)- expect(screen.getByTestId('footer-tip')).toBeInTheDocument()+ expect(screen.getByTestId('footer-tip'))!.toBeInTheDocument()})it('should render unique inputs section title', () => {render(<InputFieldPanel />)- expect(- screen.getByText('datasetPipeline.inputFieldPanel.uniqueInputs.title'),- ).toBeInTheDocument()+ expect(screen.getByText('datasetPipeline.inputFieldPanel.uniqueInputs.title'))!.toBeInTheDocument()})it('should render global inputs field list', () => {render(<InputFieldPanel />)- expect(screen.getByTestId('field-list-shared')).toBeInTheDocument()- expect(screen.getByTestId('global-inputs-label')).toBeInTheDocument()+ expect(screen.getByTestId('field-list-shared'))!.toBeInTheDocument()+ expect(screen.getByTestId('global-inputs-label'))!.toBeInTheDocument()})})@@ -263,8 +253,8 @@ describe('InputFieldPanel', () => {render(<InputFieldPanel />)- expect(screen.getByTestId('field-list-node-1')).toBeInTheDocument()- expect(screen.getByTestId('field-list-node-2')).toBeInTheDocument()+ expect(screen.getByTestId('field-list-node-1'))!.toBeInTheDocument()+ expect(screen.getByTestId('field-list-node-2'))!.toBeInTheDocument()})it('should render datasource label for each node', () => {@@ -273,9 +263,7 @@ describe('InputFieldPanel', () => {render(<InputFieldPanel />)- expect(- screen.getByTestId('datasource-label-My DataSource'),- ).toBeInTheDocument()+ expect(screen.getByTestId('datasource-label-My DataSource'))!.toBeInTheDocument()})it('should not render any datasource field lists when no nodes exist', () => {@@ -284,7 +272,7 @@ describe('InputFieldPanel', () => {render(<InputFieldPanel />)expect(screen.queryByTestId('field-list-node-1')).not.toBeInTheDocument()- expect(screen.getByTestId('field-list-shared')).toBeInTheDocument()+ expect(screen.getByTestId('field-list-shared'))!.toBeInTheDocument()})it('should filter only DataSource type nodes', () => {@@ -303,10 +291,8 @@ describe('InputFieldPanel', () => {render(<InputFieldPanel />)- expect(screen.getByTestId('field-list-ds-node')).toBeInTheDocument()- expect(- screen.queryByTestId('field-list-other-node'),- ).not.toBeInTheDocument()+ expect(screen.getByTestId('field-list-ds-node'))!.toBeInTheDocument()+ expect(screen.queryByTestId('field-list-other-node')).not.toBeInTheDocument()})})@@ -322,8 +308,8 @@ describe('InputFieldPanel', () => {render(<InputFieldPanel />)- expect(screen.getByTestId('field-list-fields-count-node-1')).toHaveTextContent('2')- expect(screen.getByTestId('field-list-fields-count-shared')).toHaveTextContent('1')+ expect(screen.getByTestId('field-list-fields-count-node-1'))!.toHaveTextContent('2')+ expect(screen.getByTestId('field-list-fields-count-shared'))!.toHaveTextContent('1')})it('should show zero fields for nodes without variables', () => {@@ -332,7 +318,7 @@ describe('InputFieldPanel', () => {render(<InputFieldPanel />)- expect(screen.getByTestId('field-list-fields-count-node-1')).toHaveTextContent('0')+ expect(screen.getByTestId('field-list-fields-count-node-1'))!.toHaveTextContent('0')})it('should pass all variable names to field lists', () => {@@ -345,10 +331,10 @@ describe('InputFieldPanel', () => {render(<InputFieldPanel />)- expect(screen.getByTestId('field-list-all-vars-node-1')).toHaveTextContent(+ expect(screen.getByTestId('field-list-all-vars-node-1'))!.toHaveTextContent('var1,var2',)- expect(screen.getByTestId('field-list-all-vars-shared')).toHaveTextContent(+ expect(screen.getByTestId('field-list-all-vars-shared'))!.toHaveTextContent('var1,var2',)})@@ -386,7 +372,7 @@ describe('InputFieldPanel', () => {const previewButton = screen.getByText('datasetPipeline.operations.preview').closest('button')- expect(previewButton).toBeDisabled()+ expect(previewButton)!.toBeDisabled()})it('should not disable preview button when not editing', () => {@@ -410,8 +396,8 @@ describe('InputFieldPanel', () => {const previewButton = screen.getByText('datasetPipeline.operations.preview').closest('button')- expect(previewButton).toHaveClass('bg-state-accent-active')- expect(previewButton).toHaveClass('text-text-accent')+ expect(previewButton)!.toHaveClass('bg-state-accent-active')+ expect(previewButton)!.toHaveClass('text-text-accent')})it('should set readonly to true when previewing', () => {@@ -419,7 +405,7 @@ describe('InputFieldPanel', () => {render(<InputFieldPanel />)- expect(screen.getByTestId('field-list-readonly-shared')).toHaveTextContent(+ expect(screen.getByTestId('field-list-readonly-shared'))!.toHaveTextContent('true',)})@@ -429,7 +415,7 @@ describe('InputFieldPanel', () => {render(<InputFieldPanel />)- expect(screen.getByTestId('field-list-readonly-shared')).toHaveTextContent(+ expect(screen.getByTestId('field-list-readonly-shared'))!.toHaveTextContent('true',)})@@ -439,7 +425,7 @@ describe('InputFieldPanel', () => {render(<InputFieldPanel />)- expect(screen.getByTestId('field-list-readonly-shared')).toHaveTextContent(+ expect(screen.getByTestId('field-list-readonly-shared'))!.toHaveTextContent('false',)})@@ -484,15 +470,15 @@ describe('InputFieldPanel', () => {expect(mockSetRagPipelineVariables).toHaveBeenCalled()})- const setVarsCall = mockSetRagPipelineVariables.mock.calls[0][0] as RAGPipelineVariables+ const setVarsCall = mockSetRagPipelineVariables.mock.calls[0]![0] as RAGPipelineVariablesconst isNotShared = (v: RAGPipelineVariable) => v.belong_to_node_id !== 'shared'const isShared = (v: RAGPipelineVariable) => v.belong_to_node_id === 'shared'const dsFields = setVarsCall.filter(isNotShared)const sharedFields = setVarsCall.filter(isShared)if (dsFields.length > 0 && sharedFields.length > 0) {- const firstDsIndex = setVarsCall.indexOf(dsFields[0])- const firstSharedIndex = setVarsCall.indexOf(sharedFields[0])+ const firstDsIndex = setVarsCall.indexOf(dsFields[0]!)+ const firstSharedIndex = setVarsCall.indexOf(sharedFields[0]!)expect(firstDsIndex).toBeLessThan(firstSharedIndex)}})@@ -523,7 +509,7 @@ describe('InputFieldPanel', () => {expect(mockSetRagPipelineVariables).toHaveBeenCalled()})- const setVarsCall = mockSetRagPipelineVariables.mock.calls[0][0] as RAGPipelineVariables+ const setVarsCall = mockSetRagPipelineVariables.mock.calls[0]![0] as RAGPipelineVariablesconst isSharedField = (v: RAGPipelineVariable) => v.belong_to_node_id === 'shared'const hasSharedField = setVarsCall.some(isSharedField)expect(hasSharedField).toBe(true)@@ -537,15 +523,13 @@ describe('InputFieldPanel', () => {render(<InputFieldPanel />)- expect(- screen.getByTestId('field-list-classname-node-1'),- ).toHaveTextContent('pt-1 pb-1')+ expect(screen.getByTestId('field-list-classname-node-1'))!.toHaveTextContent('pt-1 pb-1')})it('should pass correct className to global inputs field list', () => {render(<InputFieldPanel />)- expect(screen.getByTestId('field-list-classname-shared')).toHaveTextContent(+ expect(screen.getByTestId('field-list-classname-shared'))!.toHaveTextContent('pt-2 pb-1',)})@@ -559,7 +543,7 @@ describe('InputFieldPanel', () => {rerender(<InputFieldPanel />)- expect(screen.getByTestId('field-list-node-1')).toBeInTheDocument()+ expect(screen.getByTestId('field-list-node-1'))!.toBeInTheDocument()})it('should compute allVariableNames correctly', () => {@@ -572,7 +556,7 @@ describe('InputFieldPanel', () => {render(<InputFieldPanel />)- expect(screen.getByTestId('field-list-all-vars-shared')).toHaveTextContent(+ expect(screen.getByTestId('field-list-all-vars-shared'))!.toHaveTextContent('alpha,beta,gamma',)})@@ -621,7 +605,7 @@ describe('InputFieldPanel', () => {render(<InputFieldPanel />)- expect(screen.getByTestId('field-list-all-vars-shared')).toHaveTextContent(+ expect(screen.getByTestId('field-list-all-vars-shared'))!.toHaveTextContent('',)})@@ -632,7 +616,7 @@ describe('InputFieldPanel', () => {render(<InputFieldPanel />)- expect(screen.getByTestId('field-list-shared')).toBeInTheDocument()+ expect(screen.getByTestId('field-list-shared'))!.toBeInTheDocument()})it('should handle null variable names in allVariableNames', () => {@@ -644,7 +628,7 @@ describe('InputFieldPanel', () => {render(<InputFieldPanel />)- expect(screen.getByTestId('field-list-shared')).toBeInTheDocument()+ expect(screen.getByTestId('field-list-shared'))!.toBeInTheDocument()})it('should handle large number of datasource nodes', () => {@@ -655,7 +639,7 @@ describe('InputFieldPanel', () => {render(<InputFieldPanel />)nodes.forEach((_, i) => {- expect(screen.getByTestId(`field-list-node-${i}`)).toBeInTheDocument()+ expect(screen.getByTestId(`field-list-node-${i}`))!.toBeInTheDocument()})})@@ -666,7 +650,7 @@ describe('InputFieldPanel', () => {render(<InputFieldPanel />)- expect(screen.getByTestId('field-list-fields-count-shared')).toHaveTextContent(+ expect(screen.getByTestId('field-list-fields-count-shared'))!.toHaveTextContent('100',)})@@ -680,7 +664,7 @@ describe('InputFieldPanel', () => {render(<InputFieldPanel />)- expect(screen.getByTestId('field-list-all-vars-shared')).toHaveTextContent(+ expect(screen.getByTestId('field-list-all-vars-shared'))!.toHaveTextContent('var_with_underscore,varWithCamelCase',)})@@ -717,8 +701,8 @@ describe('InputFieldPanel', () => {render(<InputFieldPanel />)- expect(screen.getByTestId('field-list-fields-count-node-1')).toHaveTextContent('1')- expect(screen.getByTestId('field-list-fields-count-node-2')).toHaveTextContent('2')+ expect(screen.getByTestId('field-list-fields-count-node-1'))!.toHaveTextContent('1')+ expect(screen.getByTestId('field-list-fields-count-node-2'))!.toHaveTextContent('2')})})@@ -727,25 +711,21 @@ describe('InputFieldPanel', () => {const { container } = render(<InputFieldPanel />)const panel = container.firstChild as HTMLElement- expect(panel).toHaveClass('w-[400px]')+ expect(panel)!.toHaveClass('w-[400px]')})it('should have overflow scroll on content area', () => {const { container } = render(<InputFieldPanel />)const scrollContainer = container.querySelector('.overflow-y-auto')- expect(scrollContainer).toBeInTheDocument()+ expect(scrollContainer)!.toBeInTheDocument()})it('should render header section with proper spacing', () => {render(<InputFieldPanel />)- expect(- screen.getByText('datasetPipeline.inputFieldPanel.title'),- ).toBeInTheDocument()- expect(- screen.getByText('datasetPipeline.inputFieldPanel.description'),- ).toBeInTheDocument()+ expect(screen.getByText('datasetPipeline.inputFieldPanel.title'))!.toBeInTheDocument()+ expect(screen.getByText('datasetPipeline.inputFieldPanel.description'))!.toBeInTheDocument()})})@@ -763,9 +743,9 @@ describe('InputFieldPanel', () => {render(<InputFieldPanel />)- expect(screen.getByTestId('field-list-node-1')).toBeInTheDocument()- expect(screen.getByTestId('field-list-readonly-node-1')).toHaveTextContent('true')- expect(screen.getByTestId('field-list-fields-count-node-1')).toHaveTextContent('1')+ expect(screen.getByTestId('field-list-node-1'))!.toBeInTheDocument()+ expect(screen.getByTestId('field-list-readonly-node-1'))!.toHaveTextContent('true')+ expect(screen.getByTestId('field-list-fields-count-node-1'))!.toHaveTextContent('1')})it('should pass correct props to FieldList for shared node', () => {@@ -776,9 +756,9 @@ describe('InputFieldPanel', () => {render(<InputFieldPanel />)- expect(screen.getByTestId('field-list-shared')).toBeInTheDocument()- expect(screen.getByTestId('field-list-readonly-shared')).toHaveTextContent('true')- expect(screen.getByTestId('field-list-fields-count-shared')).toHaveTextContent('1')+ expect(screen.getByTestId('field-list-shared'))!.toBeInTheDocument()+ expect(screen.getByTestId('field-list-readonly-shared'))!.toHaveTextContent('true')+ expect(screen.getByTestId('field-list-fields-count-shared'))!.toHaveTextContent('1')})})@@ -793,7 +773,7 @@ describe('InputFieldPanel', () => {render(<InputFieldPanel />)- expect(screen.getByTestId('field-list-all-vars-shared')).toHaveTextContent(+ expect(screen.getByTestId('field-list-all-vars-shared'))!.toHaveTextContent('first,second,third',)})@@ -810,7 +790,7 @@ describe('useFloatingRight Hook Integration', () => {it('should render panel correctly with default floating state', () => {render(<InputFieldPanel />)- expect(screen.getByTestId('field-list-shared')).toBeInTheDocument()+ expect(screen.getByTestId('field-list-shared'))!.toBeInTheDocument()})})@@ -823,7 +803,7 @@ describe('FooterTip Integration', () => {it('should render footer tip at the bottom of the panel', () => {render(<InputFieldPanel />)- expect(screen.getByTestId('footer-tip')).toBeInTheDocument()+ expect(screen.getByTestId('footer-tip'))!.toBeInTheDocument()})})@@ -836,7 +816,7 @@ describe('Label Components Integration', () => {it('should render GlobalInputs label for shared field list', () => {render(<InputFieldPanel />)- expect(screen.getByTestId('global-inputs-label')).toBeInTheDocument()+ expect(screen.getByTestId('global-inputs-label'))!.toBeInTheDocument()})it('should render Datasource label for each datasource node', () => {@@ -848,12 +828,8 @@ describe('Label Components Integration', () => {render(<InputFieldPanel />)- expect(- screen.getByTestId('datasource-label-First DataSource'),- ).toBeInTheDocument()- expect(- screen.getByTestId('datasource-label-Second DataSource'),- ).toBeInTheDocument()+ expect(screen.getByTestId('datasource-label-First DataSource'))!.toBeInTheDocument()+ expect(screen.getByTestId('datasource-label-Second DataSource'))!.toBeInTheDocument()})})@@ -868,10 +844,8 @@ describe('Component Memo Behavior', () => {rerender(<InputFieldPanel />)- expect(screen.getByTestId('field-list-shared')).toBeInTheDocument()- expect(- screen.getByText('datasetPipeline.inputFieldPanel.title'),- ).toBeInTheDocument()+ expect(screen.getByTestId('field-list-shared'))!.toBeInTheDocument()+ expect(screen.getByText('datasetPipeline.inputFieldPanel.title'))!.toBeInTheDocument()})it('should handle state updates correctly with memo', async () => {diff --git a/web/app/components/rag-pipeline/components/panel/input-field/editor/form/index.tsx b/web/app/components/rag-pipeline/components/panel/input-field/editor/form/index.tsxindex de003e78ba8..3854b6561af 100644--- a/web/app/components/rag-pipeline/components/panel/input-field/editor/form/index.tsx+++ b/web/app/components/rag-pipeline/components/panel/input-field/editor/form/index.tsx@@ -28,7 +28,7 @@ const InputFieldForm = ({ initialData, supportFile = false, onCancel, onSubmit,if (!result.success) {const issues = result.error.issuesconst firstIssue = issues[0]- const errorMessage = `"${firstIssue.path.join('.')}" ${firstIssue.message}`+ const errorMessage = `"${firstIssue!.path.join('.')}" ${firstIssue!.message}`toast.error(errorMessage)return errorMessage}diff --git a/web/app/components/rag-pipeline/components/panel/input-field/field-list/__tests__/field-item.spec.tsx b/web/app/components/rag-pipeline/components/panel/input-field/field-list/__tests__/field-item.spec.tsxindex 4a738761d05..8f5d9b53868 100644--- a/web/app/components/rag-pipeline/components/panel/input-field/field-list/__tests__/field-item.spec.tsx+++ b/web/app/components/rag-pipeline/components/panel/input-field/field-list/__tests__/field-item.spec.tsx@@ -35,9 +35,9 @@ describe('FieldItem', () => {/>,)- expect(screen.getByText('field_name')).toBeInTheDocument()- expect(screen.getByText('Field Label')).toBeInTheDocument()- expect(screen.getByText('workflow.nodes.start.required')).toBeInTheDocument()+ expect(screen.getByText('field_name'))!.toBeInTheDocument()+ expect(screen.getByText('Field Label'))!.toBeInTheDocument()+ expect(screen.getByText('workflow.nodes.start.required'))!.toBeInTheDocument()})it('should show edit and delete controls on hover and trigger both callbacks', () => {@@ -54,8 +54,8 @@ describe('FieldItem', () => {fireEvent.mouseEnter(container.firstChild!)const buttons = screen.getAllByRole('button')- fireEvent.click(buttons[0])- fireEvent.click(buttons[1])+ fireEvent.click(buttons[0]!)+ fireEvent.click(buttons[1]!)expect(onClickEdit).toHaveBeenCalledWith('custom_field')expect(onRemove).toHaveBeenCalledWith(2)diff --git a/web/app/components/rag-pipeline/components/panel/input-field/field-list/__tests__/hooks.spec.ts b/web/app/components/rag-pipeline/components/panel/input-field/field-list/__tests__/hooks.spec.tsindex c7f5a11ce3e..376751e58f5 100644--- a/web/app/components/rag-pipeline/components/panel/input-field/field-list/__tests__/hooks.spec.ts+++ b/web/app/components/rag-pipeline/components/panel/input-field/field-list/__tests__/hooks.spec.ts@@ -141,7 +141,7 @@ describe('useFieldList', () => {])})- const updatedFields = onInputFieldsChange.mock.calls[0][0]+ const updatedFields = onInputFieldsChange.mock.calls[0]![0]expect(updatedFields[0]).not.toHaveProperty('id')expect(updatedFields[0]).not.toHaveProperty('chosen')expect(updatedFields[0]).not.toHaveProperty('selected')@@ -282,7 +282,7 @@ describe('useFieldList', () => {result.current.handleOpenInputFieldEditor()})- const editorProps = mockToggleInputFieldEditPanel.mock.calls[0][0]+ const editorProps = mockToggleInputFieldEditPanel.mock.calls[0]![0]const newField = createInputVar({ variable: 'new_var', label: 'New' })act(() => {@@ -307,7 +307,7 @@ describe('useFieldList', () => {result.current.handleOpenInputFieldEditor()})- const editorProps = mockToggleInputFieldEditPanel.mock.calls[0][0]+ const editorProps = mockToggleInputFieldEditPanel.mock.calls[0]![0]const duplicateField = createInputVar({ variable: 'existing_var' })act(() => {@@ -336,7 +336,7 @@ describe('useFieldList', () => {result.current.handleOpenInputFieldEditor('old_name')})- const editorProps = mockToggleInputFieldEditPanel.mock.calls[0][0]+ const editorProps = mockToggleInputFieldEditPanel.mock.calls[0]![0]const updatedField = createInputVar({ variable: 'new_name' })act(() => {diff --git a/web/app/components/rag-pipeline/components/panel/input-field/field-list/__tests__/index.spec.tsx b/web/app/components/rag-pipeline/components/panel/input-field/field-list/__tests__/index.spec.tsxindex e44301e2520..b2dbc35601a 100644--- a/web/app/components/rag-pipeline/components/panel/input-field/field-list/__tests__/index.spec.tsx+++ b/web/app/components/rag-pipeline/components/panel/input-field/field-list/__tests__/index.spec.tsx@@ -110,7 +110,7 @@ describe('FieldItem', () => {/>,)- expect(screen.getByText('my_field')).toBeInTheDocument()+ expect(screen.getByText('my_field'))!.toBeInTheDocument()})it('should render field item with label when provided', () => {@@ -125,7 +125,7 @@ describe('FieldItem', () => {/>,)- expect(screen.getByText('Field Label')).toBeInTheDocument()+ expect(screen.getByText('Field Label'))!.toBeInTheDocument()})it('should not render label when empty', () => {@@ -155,7 +155,7 @@ describe('FieldItem', () => {/>,)- expect(screen.getByText(/required/i)).toBeInTheDocument()+ expect(screen.getByText(/required/i))!.toBeInTheDocument()})it('should not render required badge when required is false', () => {@@ -259,7 +259,7 @@ describe('FieldItem', () => {)fireEvent.mouseEnter(container.firstChild!)const buttons = screen.getAllByRole('button')- fireEvent.click(buttons[0]) // Edit button+ fireEvent.click(buttons[0]!) // Edit buttonexpect(onClickEdit).toHaveBeenCalledWith('test_var')})@@ -278,7 +278,7 @@ describe('FieldItem', () => {)fireEvent.mouseEnter(container.firstChild!)const buttons = screen.getAllByRole('button')- fireEvent.click(buttons[1]) // Delete button+ fireEvent.click(buttons[1]!) // Delete buttonexpect(onRemove).toHaveBeenCalledWith(5)})@@ -328,7 +328,7 @@ describe('FieldItem', () => {)fireEvent.mouseEnter(container.querySelector('.handle')!)const buttons = screen.getAllByRole('button')- fireEvent.click(buttons[0])+ fireEvent.click(buttons[0]!)expect(onClickEdit).toHaveBeenCalled()expect(parentClick).not.toHaveBeenCalled()@@ -351,7 +351,7 @@ describe('FieldItem', () => {)fireEvent.mouseEnter(container.querySelector('.handle')!)const buttons = screen.getAllByRole('button')- fireEvent.click(buttons[1])+ fireEvent.click(buttons[1]!)expect(onRemove).toHaveBeenCalled()expect(parentClick).not.toHaveBeenCalled()@@ -373,7 +373,7 @@ describe('FieldItem', () => {)fireEvent.mouseEnter(container.firstChild!)const buttons = screen.getAllByRole('button')- fireEvent.click(buttons[0])+ fireEvent.click(buttons[0]!)rerender(<FieldItem@@ -385,7 +385,7 @@ describe('FieldItem', () => {)fireEvent.mouseEnter(container.firstChild!)const buttonsAfterRerender = screen.getAllByRole('button')- fireEvent.click(buttonsAfterRerender[0])+ fireEvent.click(buttonsAfterRerender[0]!)expect(onClickEdit).toHaveBeenCalledTimes(2)})@@ -406,7 +406,7 @@ describe('FieldItem', () => {)const varElement = screen.getByTitle(longVariable)- expect(varElement).toHaveClass('truncate')+ expect(varElement)!.toHaveClass('truncate')})it('should handle very long label names with truncation', () => {@@ -423,7 +423,7 @@ describe('FieldItem', () => {)const labelElement = screen.getByTitle(longLabel)- expect(labelElement).toHaveClass('truncate')+ expect(labelElement)!.toHaveClass('truncate')})it('should handle special characters in variable and label', () => {@@ -441,8 +441,8 @@ describe('FieldItem', () => {/>,)- expect(screen.getByText('<test>&"var\'')).toBeInTheDocument()- expect(screen.getByText('<label>&"test\'')).toBeInTheDocument()+ expect(screen.getByText('<test>&"var\''))!.toBeInTheDocument()+ expect(screen.getByText('<label>&"test\''))!.toBeInTheDocument()})it('should handle unicode characters', () => {@@ -460,8 +460,8 @@ describe('FieldItem', () => {/>,)- expect(screen.getByText('变量_🎉')).toBeInTheDocument()- expect(screen.getByText('标签_😀')).toBeInTheDocument()+ expect(screen.getByText('变量_🎉'))!.toBeInTheDocument()+ expect(screen.getByText('标签_😀'))!.toBeInTheDocument()})it('should render different input types correctly', () => {@@ -487,7 +487,7 @@ describe('FieldItem', () => {/>,)- expect(screen.getByText('test_variable')).toBeInTheDocument()+ expect(screen.getByText('test_variable'))!.toBeInTheDocument()unmount()})})@@ -517,7 +517,7 @@ describe('FieldItem', () => {/>,)- expect(screen.getByText('test_variable')).toBeInTheDocument()+ expect(screen.getByText('test_variable'))!.toBeInTheDocument()})})@@ -553,7 +553,7 @@ describe('FieldItem', () => {)fireEvent.mouseEnter(container.firstChild!)- expect(screen.getByText(/required/i)).toBeInTheDocument()+ expect(screen.getByText(/required/i))!.toBeInTheDocument()})it('should apply cursor-default class when readonly', () => {@@ -611,8 +611,8 @@ describe('FieldListContainer', () => {/>,)- expect(screen.getByText('var_0')).toBeInTheDocument()- expect(screen.getByText('var_1')).toBeInTheDocument()+ expect(screen.getByText('var_0'))!.toBeInTheDocument()+ expect(screen.getByText('var_1'))!.toBeInTheDocument()})it('should render all field items', () => {@@ -627,9 +627,9 @@ describe('FieldListContainer', () => {/>,)- expect(screen.getByText('var_0')).toBeInTheDocument()- expect(screen.getByText('var_1')).toBeInTheDocument()- expect(screen.getByText('var_2')).toBeInTheDocument()+ expect(screen.getByText('var_0'))!.toBeInTheDocument()+ expect(screen.getByText('var_1'))!.toBeInTheDocument()+ expect(screen.getByText('var_2'))!.toBeInTheDocument()})it('should render empty list without errors', () => {@@ -643,7 +643,8 @@ describe('FieldListContainer', () => {)// ReactSortable renders a wrapper div even for empty lists- expect(container.firstChild).toBeInTheDocument()+ // ReactSortable renders a wrapper div even for empty lists+ expect(container.firstChild)!.toBeInTheDocument()})it('should apply custom className', () => {@@ -698,7 +699,7 @@ describe('FieldListContainer', () => {)fireEvent.mouseEnter(container.querySelector('.handle')!)const buttons = screen.getAllByRole('button')- fireEvent.click(buttons[0]) // Edit button+ fireEvent.click(buttons[0]!) // Edit buttonexpect(onEditField).toHaveBeenCalledWith('var_0')})@@ -717,7 +718,7 @@ describe('FieldListContainer', () => {)fireEvent.mouseEnter(container.querySelector('.handle')!)const buttons = screen.getAllByRole('button')- fireEvent.click(buttons[1]) // Delete button+ fireEvent.click(buttons[1]!) // Delete buttonexpect(onRemoveField).toHaveBeenCalledWith(0)})@@ -735,12 +736,12 @@ describe('FieldListContainer', () => {}))expect(converted).toHaveLength(2)- expect(converted[0].id).toBe('var_0')- expect(converted[0].chosen).toBe(false)- expect(converted[0].selected).toBe(false)- expect(converted[0].variable).toBe('var_0')- expect(converted[0].type).toBe(PipelineInputVarType.textInput)- expect(converted[1].id).toBe('var_1')+ expect(converted[0]!.id).toBe('var_0')+ expect(converted[0]!.chosen).toBe(false)+ expect(converted[0]!.selected).toBe(false)+ expect(converted[0]!.variable).toBe('var_0')+ expect(converted[0]!.type).toBe(PipelineInputVarType.textInput)+ expect(converted[1]!.id).toBe('var_1')})})@@ -767,7 +768,7 @@ describe('FieldListContainer', () => {/>,)- expect(screen.getByText('var_0')).toBeInTheDocument()+ expect(screen.getByText('var_0'))!.toBeInTheDocument()})it('should be memoized with React.memo', () => {@@ -791,7 +792,7 @@ describe('FieldListContainer', () => {/>,)- expect(screen.getByText('var_0')).toBeInTheDocument()+ expect(screen.getByText('var_0'))!.toBeInTheDocument()})})@@ -808,8 +809,8 @@ describe('FieldListContainer', () => {/>,)- expect(screen.getByText('var_0')).toBeInTheDocument()- expect(screen.getByText('var_99')).toBeInTheDocument()+ expect(screen.getByText('var_0'))!.toBeInTheDocument()+ expect(screen.getByText('var_99'))!.toBeInTheDocument()})it('should throw error when inputFields is undefined', () => {@@ -847,8 +848,8 @@ describe('FieldList', () => {/>,)- expect(screen.getByText('Label Content')).toBeInTheDocument()- expect(screen.getByText('var_0')).toBeInTheDocument()+ expect(screen.getByText('Label Content'))!.toBeInTheDocument()+ expect(screen.getByText('var_0'))!.toBeInTheDocument()})it('should render add button', () => {@@ -867,7 +868,7 @@ describe('FieldList', () => {const addButton = screen.getAllByRole('button').find(btn =>btn.querySelector('svg'),)- expect(addButton).toBeInTheDocument()+ expect(addButton)!.toBeInTheDocument()})it('should disable add button when readonly', () => {@@ -887,7 +888,7 @@ describe('FieldList', () => {const addButton = screen.getAllByRole('button').find(btn =>btn.querySelector('svg'),)- expect(addButton).toBeDisabled()+ expect(addButton)!.toBeDisabled()})it('should apply custom labelClassName', () => {@@ -905,7 +906,7 @@ describe('FieldList', () => {)const labelContainer = container.querySelector('.custom-label-class')- expect(labelContainer).toBeInTheDocument()+ expect(labelContainer)!.toBeInTheDocument()})})@@ -974,7 +975,7 @@ describe('FieldList', () => {fireEvent.mouseEnter(container.querySelector('.handle')!)const fieldItemButtons = container.querySelectorAll('.handle button.action-btn')if (fieldItemButtons.length >= 2)- fireEvent.click(fieldItemButtons[1])+ fireEvent.click(fieldItemButtons[1]!)expect(handleInputFieldsChange).toHaveBeenCalledWith('node-1', expect.any(Array))})@@ -998,10 +999,10 @@ describe('FieldList', () => {const fieldItemButtons = container.querySelectorAll('.handle button.action-btn')if (fieldItemButtons.length >= 2)- fireEvent.click(fieldItemButtons[1])+ fireEvent.click(fieldItemButtons[1]!)await waitFor(() => {- expect(screen.getByTestId('remove-var-confirm')).toBeInTheDocument()+ expect(screen.getByTestId('remove-var-confirm'))!.toBeInTheDocument()})})@@ -1022,10 +1023,10 @@ describe('FieldList', () => {const fieldItemButtons = container.querySelectorAll('.handle button.action-btn')if (fieldItemButtons.length >= 2)- fireEvent.click(fieldItemButtons[1])+ fireEvent.click(fieldItemButtons[1]!)await waitFor(() => {- expect(screen.getByTestId('remove-var-confirm')).toBeInTheDocument()+ expect(screen.getByTestId('remove-var-confirm'))!.toBeInTheDocument()})fireEvent.click(screen.getByTestId('confirm-cancel'))@@ -1053,10 +1054,10 @@ describe('FieldList', () => {const fieldItemButtons = container.querySelectorAll('.handle button.action-btn')if (fieldItemButtons.length >= 2)- fireEvent.click(fieldItemButtons[1])+ fireEvent.click(fieldItemButtons[1]!)await waitFor(() => {- expect(screen.getByTestId('remove-var-confirm')).toBeInTheDocument()+ expect(screen.getByTestId('remove-var-confirm'))!.toBeInTheDocument()})fireEvent.click(screen.getByTestId('confirm-ok'))@@ -1085,7 +1086,7 @@ describe('FieldList', () => {const fieldItemButtons = container.querySelectorAll('.handle button.action-btn')if (fieldItemButtons.length >= 2)- fireEvent.click(fieldItemButtons[1])+ fireEvent.click(fieldItemButtons[1]!)expect(screen.queryByTestId('remove-var-confirm')).not.toBeInTheDocument()expect(handleInputFieldsChange).toHaveBeenCalled()@@ -1105,7 +1106,8 @@ describe('FieldList', () => {)// Component renders without errors even with no fields- expect(container.firstChild).toBeInTheDocument()+ // Component renders without errors even with no fields+ expect(container.firstChild)!.toBeInTheDocument()})it('should handle null LabelRightContent', () => {@@ -1119,7 +1121,7 @@ describe('FieldList', () => {/>,)- expect(screen.getByText('var_0')).toBeInTheDocument()+ expect(screen.getByText('var_0'))!.toBeInTheDocument()})it('should handle complex LabelRightContent', () => {@@ -1140,8 +1142,8 @@ describe('FieldList', () => {/>,)- expect(screen.getByTestId('complex-content')).toBeInTheDocument()- expect(screen.getByText('Part 1')).toBeInTheDocument()+ expect(screen.getByTestId('complex-content'))!.toBeInTheDocument()+ expect(screen.getByText('Part 1'))!.toBeInTheDocument()})})@@ -1170,7 +1172,7 @@ describe('FieldList', () => {/>,)- expect(screen.getByText('var_0')).toBeInTheDocument()+ expect(screen.getByText('var_0'))!.toBeInTheDocument()})it('should maintain stable onInputFieldsChange callback', () => {@@ -1203,7 +1205,7 @@ describe('FieldList', () => {fireEvent.mouseEnter(container.querySelector('.handle')!)const fieldItemButtons = container.querySelectorAll('.handle button.action-btn')if (fieldItemButtons.length >= 2)- fireEvent.click(fieldItemButtons[1])+ fireEvent.click(fieldItemButtons[1]!)expect(handleInputFieldsChange).toHaveBeenCalledWith('node-1', expect.any(Array))})@@ -1230,8 +1232,8 @@ describe('useFieldList Hook', () => {/>,)- expect(screen.getByText('var_0')).toBeInTheDocument()- expect(screen.getByText('var_1')).toBeInTheDocument()+ expect(screen.getByText('var_0'))!.toBeInTheDocument()+ expect(screen.getByText('var_1'))!.toBeInTheDocument()})it('should initialize with empty inputFields', () => {@@ -1246,7 +1248,8 @@ describe('useFieldList Hook', () => {)// Component renders without errors even with no fields- expect(container.firstChild).toBeInTheDocument()+ // Component renders without errors even with no fields+ expect(container.firstChild)!.toBeInTheDocument()})})@@ -1264,8 +1267,8 @@ describe('useFieldList Hook', () => {// Simulate sort change by calling handleListSortChange directlyconst reorderedList: SortableItem[] = [- createSortableItem(initialFields[1]),- createSortableItem(initialFields[0]),+ createSortableItem(initialFields[1]!),+ createSortableItem(initialFields[0]!),]act(() => {@@ -1290,14 +1293,14 @@ describe('useFieldList Hook', () => {}))const sortableList: SortableItem[] = [- createSortableItem(initialFields[0], { chosen: true, selected: true }),+ createSortableItem(initialFields[0]!, { chosen: true, selected: true }),]act(() => {result.current.handleListSortChange(sortableList)})- const updatedFields = onInputFieldsChange.mock.calls[0][0]+ const updatedFields = onInputFieldsChange.mock.calls[0]![0]expect(updatedFields[0]).not.toHaveProperty('id')expect(updatedFields[0]).not.toHaveProperty('chosen')expect(updatedFields[0]).not.toHaveProperty('selected')@@ -1323,10 +1326,10 @@ describe('useFieldList Hook', () => {const fieldItemButtons = container.querySelectorAll('.handle button.action-btn')if (fieldItemButtons.length >= 2)- fireEvent.click(fieldItemButtons[1])+ fireEvent.click(fieldItemButtons[1]!)await waitFor(() => {- expect(screen.getByTestId('remove-var-confirm')).toBeInTheDocument()+ expect(screen.getByTestId('remove-var-confirm'))!.toBeInTheDocument()})})@@ -1348,7 +1351,7 @@ describe('useFieldList Hook', () => {const fieldItemButtons = container.querySelectorAll('.handle button.action-btn')if (fieldItemButtons.length >= 2)- fireEvent.click(fieldItemButtons[1])+ fireEvent.click(fieldItemButtons[1]!)expect(screen.queryByTestId('remove-var-confirm')).not.toBeInTheDocument()expect(handleInputFieldsChange).toHaveBeenCalled()@@ -1372,10 +1375,10 @@ describe('useFieldList Hook', () => {const fieldItemButtons = container.querySelectorAll('.handle button.action-btn')if (fieldItemButtons.length >= 2)- fireEvent.click(fieldItemButtons[1])+ fireEvent.click(fieldItemButtons[1]!)await waitFor(() => {- expect(screen.getByTestId('remove-var-confirm')).toBeInTheDocument()+ expect(screen.getByTestId('remove-var-confirm'))!.toBeInTheDocument()})expect(handleInputFieldsChange).not.toHaveBeenCalled()})@@ -1397,7 +1400,7 @@ describe('useFieldList Hook', () => {const fieldItemButtons = container.querySelectorAll('.handle button.action-btn')if (fieldItemButtons.length >= 2)- fireEvent.click(fieldItemButtons[1])+ fireEvent.click(fieldItemButtons[1]!)expect(mockIsVarUsedInNodes).toHaveBeenCalledWith(['rag', 'test-node-123', 'my_test_var'])})@@ -1420,7 +1423,7 @@ describe('useFieldList Hook', () => {const fieldItemButtons = container.querySelectorAll('.handle button.action-btn')if (fieldItemButtons.length >= 2)- fireEvent.click(fieldItemButtons[1])+ fireEvent.click(fieldItemButtons[1]!)expect(mockIsVarUsedInNodes).toHaveBeenCalledWith(['rag', 'node-1', ''])})@@ -1444,10 +1447,10 @@ describe('useFieldList Hook', () => {const allFieldItemButtons = container.querySelectorAll('.handle button.action-btn')if (allFieldItemButtons.length >= 4)- fireEvent.click(allFieldItemButtons[3])+ fireEvent.click(allFieldItemButtons[3]!)await waitFor(() => {- expect(screen.getByTestId('remove-var-confirm')).toBeInTheDocument()+ expect(screen.getByTestId('remove-var-confirm'))!.toBeInTheDocument()})fireEvent.click(screen.getByTestId('confirm-ok'))@@ -1455,7 +1458,7 @@ describe('useFieldList Hook', () => {await waitFor(() => {expect(handleInputFieldsChange).toHaveBeenCalled()})- const calledFields = handleInputFieldsChange.mock.calls[0][1]+ const calledFields = handleInputFieldsChange.mock.calls[0]![1]expect(calledFields.length).toBe(2) // 3 - 1 = 2 items remainingexpect(calledFields.map((f: InputVar) => f.variable)).toEqual(['var_0', 'var_2'])})@@ -1503,7 +1506,7 @@ describe('useFieldList Hook', () => {fireEvent.mouseEnter(container.querySelector('.handle')!)const fieldItemButtons = container.querySelectorAll('.handle button.action-btn')if (fieldItemButtons.length >= 1)- fireEvent.click(fieldItemButtons[0])+ fireEvent.click(fieldItemButtons[0]!)expect(mockToggleInputFieldEditPanel).toHaveBeenCalledWith(expect.objectContaining({@@ -1535,10 +1538,10 @@ describe('useFieldList Hook', () => {const fieldItemButtons = container.querySelectorAll('.handle button.action-btn')if (fieldItemButtons.length >= 2)- fireEvent.click(fieldItemButtons[1])+ fireEvent.click(fieldItemButtons[1]!)await waitFor(() => {- expect(screen.getByTestId('remove-var-confirm')).toBeInTheDocument()+ expect(screen.getByTestId('remove-var-confirm'))!.toBeInTheDocument()})fireEvent.click(screen.getByTestId('confirm-ok'))@@ -1574,7 +1577,7 @@ describe('handleSubmitField', () => {fireEvent.click(screen.getByTestId('field-list-add-btn'))expect(mockToggleInputFieldEditPanel).toHaveBeenCalled()- const editorProps = mockToggleInputFieldEditPanel.mock.calls[0][0]+ const editorProps = mockToggleInputFieldEditPanel.mock.calls[0]![0]expect(editorProps).toHaveProperty('onSubmit')const newFieldData = createInputVar({ variable: 'new_var', label: 'New Label' })@@ -1606,9 +1609,9 @@ describe('handleSubmitField', () => {const fieldItemButtons = container.querySelectorAll('.handle button.action-btn')if (fieldItemButtons.length >= 1)- fireEvent.click(fieldItemButtons[0])+ fireEvent.click(fieldItemButtons[0]!)- const editorProps = mockToggleInputFieldEditPanel.mock.calls[0][0]+ const editorProps = mockToggleInputFieldEditPanel.mock.calls[0]![0]const updatedFieldData = createInputVar({ variable: 'var_0', label: 'Updated Label' })editorProps.onSubmit(updatedFieldData)@@ -1619,7 +1622,7 @@ describe('handleSubmitField', () => {expect.objectContaining({ variable: 'var_0', label: 'Updated Label' }),]),)- const calledFields = handleInputFieldsChange.mock.calls[0][1]+ const calledFields = handleInputFieldsChange.mock.calls[0]![1]expect(calledFields.length).toBe(1) // Should still be 1, not 2})@@ -1640,9 +1643,9 @@ describe('handleSubmitField', () => {const fieldItemButtons = container.querySelectorAll('.handle button.action-btn')if (fieldItemButtons.length >= 1)- fireEvent.click(fieldItemButtons[0])+ fireEvent.click(fieldItemButtons[0]!)- const editorProps = mockToggleInputFieldEditPanel.mock.calls[0][0]+ const editorProps = mockToggleInputFieldEditPanel.mock.calls[0]![0]const updatedFieldData = createInputVar({ variable: 'new_var_name', label: 'Label 0' })editorProps.onSubmit(updatedFieldData, {@@ -1674,9 +1677,9 @@ describe('handleSubmitField', () => {const fieldItemButtons = container.querySelectorAll('.handle button.action-btn')if (fieldItemButtons.length >= 1)- fireEvent.click(fieldItemButtons[0])+ fireEvent.click(fieldItemButtons[0]!)- const editorProps = mockToggleInputFieldEditPanel.mock.calls[0][0]+ const editorProps = mockToggleInputFieldEditPanel.mock.calls[0]![0]const updatedFieldData = createInputVar({ variable: 'var_0', label: 'Updated Label' })editorProps.onSubmit(updatedFieldData)@@ -1702,9 +1705,9 @@ describe('handleSubmitField', () => {const fieldItemButtons = container.querySelectorAll('.handle button.action-btn')if (fieldItemButtons.length >= 1)- fireEvent.click(fieldItemButtons[0])+ fireEvent.click(fieldItemButtons[0]!)- const editorProps = mockToggleInputFieldEditPanel.mock.calls[0][0]+ const editorProps = mockToggleInputFieldEditPanel.mock.calls[0]![0]const updatedFieldData = createInputVar({ variable: 'var_0', label: 'Updated Label' })editorProps.onSubmit(updatedFieldData, { type: 'otherType' as never })@@ -1730,9 +1733,9 @@ describe('handleSubmitField', () => {const fieldItemButtons = container.querySelectorAll('.handle button.action-btn')if (fieldItemButtons.length >= 1)- fireEvent.click(fieldItemButtons[0])+ fireEvent.click(fieldItemButtons[0]!)- const editorProps = mockToggleInputFieldEditPanel.mock.calls[0][0]+ const editorProps = mockToggleInputFieldEditPanel.mock.calls[0]![0]const updatedFieldData = createInputVar({ variable: 'new_var' })editorProps.onSubmit(updatedFieldData, {@@ -1764,9 +1767,9 @@ describe('handleSubmitField', () => {const fieldItemButtons = container.querySelectorAll('.handle button.action-btn')if (fieldItemButtons.length >= 1)- fireEvent.click(fieldItemButtons[0])+ fireEvent.click(fieldItemButtons[0]!)- const editorProps = mockToggleInputFieldEditPanel.mock.calls[0][0]+ const editorProps = mockToggleInputFieldEditPanel.mock.calls[0]![0]const updatedFieldData = createInputVar({ variable: 'new_var' })editorProps.onSubmit(updatedFieldData, {@@ -1797,7 +1800,7 @@ describe('handleSubmitField', () => {fireEvent.click(screen.getByTestId('field-list-add-btn'))- const editorProps = mockToggleInputFieldEditPanel.mock.calls[0][0]+ const editorProps = mockToggleInputFieldEditPanel.mock.calls[0]![0]const newFieldData = createInputVar({ variable: 'new_var' })editorProps.onSubmit(newFieldData)@@ -1821,7 +1824,7 @@ describe('handleSubmitField', () => {fireEvent.click(screen.getByTestId('field-list-add-btn'))- const editorProps = mockToggleInputFieldEditPanel.mock.calls[0][0]+ const editorProps = mockToggleInputFieldEditPanel.mock.calls[0]![0]expect(editorProps).toHaveProperty('onClose')editorProps.onClose()@@ -1852,7 +1855,7 @@ describe('Duplicate Variable Name Handling', () => {fireEvent.click(screen.getByTestId('field-list-add-btn'))- const editorProps = mockToggleInputFieldEditPanel.mock.calls[0][0]+ const editorProps = mockToggleInputFieldEditPanel.mock.calls[0]![0]const duplicateFieldData = createInputVar({ variable: 'existing_var' })editorProps.onSubmit(duplicateFieldData)@@ -1878,9 +1881,9 @@ describe('Duplicate Variable Name Handling', () => {const fieldItemButtons = container.querySelectorAll('.handle button.action-btn')if (fieldItemButtons.length >= 1)- fireEvent.click(fieldItemButtons[0])+ fireEvent.click(fieldItemButtons[0]!)- const editorProps = mockToggleInputFieldEditPanel.mock.calls[0][0]+ const editorProps = mockToggleInputFieldEditPanel.mock.calls[0]![0]const updatedFieldData = createInputVar({ variable: 'var_0', label: 'New Label' })editorProps.onSubmit(updatedFieldData)@@ -1941,12 +1944,12 @@ describe('Integration Tests', () => {const fieldItemButtons = container.querySelectorAll('.handle button.action-btn')if (fieldItemButtons.length >= 1) {- fireEvent.click(fieldItemButtons[0])+ fireEvent.click(fieldItemButtons[0]!)expect(mockToggleInputFieldEditPanel).toHaveBeenCalledTimes(2)}if (fieldItemButtons.length >= 2)- fireEvent.click(fieldItemButtons[1])+ fireEvent.click(fieldItemButtons[1]!)expect(handleInputFieldsChange).toHaveBeenCalled()})@@ -1970,7 +1973,7 @@ describe('Integration Tests', () => {const addButton = screen.getAllByRole('button').find(btn =>btn.querySelector('svg'),)- expect(addButton).toBeDisabled()+ expect(addButton)!.toBeDisabled()})})})diff --git a/web/app/components/rag-pipeline/components/panel/input-field/field-list/hooks.ts b/web/app/components/rag-pipeline/components/panel/input-field/field-list/hooks.tsindex 1fb5ea92188..1301074d51e 100644--- a/web/app/components/rag-pipeline/components/panel/input-field/field-list/hooks.ts+++ b/web/app/components/rag-pipeline/components/panel/input-field/field-list/hooks.ts@@ -46,9 +46,9 @@ export const useFieldList = ({ initialInputFields, onInputFieldsChange, nodeId,const handleRemoveField = useCallback((index: number) => {const itemToRemove = inputFieldsRef.current[index]// Check if the variable is used in other nodes- if (isVarUsedInNodes([VARIABLE_PREFIX, nodeId, itemToRemove.variable || ''])) {+ if (isVarUsedInNodes([VARIABLE_PREFIX, nodeId, itemToRemove!.variable || ''])) {showRemoveVarConfirm()- setRemovedVar([VARIABLE_PREFIX, nodeId, itemToRemove.variable || ''])+ setRemovedVar([VARIABLE_PREFIX, nodeId, itemToRemove!.variable || ''])setRemoveIndex(index as number)return}diff --git a/web/app/components/rag-pipeline/components/panel/input-field/index.tsx b/web/app/components/rag-pipeline/components/panel/input-field/index.tsxindex 3939413c802..2be80510036 100644--- a/web/app/components/rag-pipeline/components/panel/input-field/index.tsx+++ b/web/app/components/rag-pipeline/components/panel/input-field/index.tsx@@ -66,7 +66,7 @@ const InputFieldPanel = () => {const globalInputFields: RAGPipelineVariables = []Object.keys(inputFieldsMap.current).forEach((key) => {const inputFields = inputFieldsMap.current[key]- inputFields.forEach((inputField) => {+ inputFields!.forEach((inputField) => {if (key === 'shared') {globalInputFields.push({...inputField,@@ -149,7 +149,7 @@ const InputFieldPanel = () => {<FieldListkey={key}nodeId={key}- LabelRightContent={<Datasource nodeData={datasourceNodeDataMap[key]} />}+ LabelRightContent={<Datasource nodeData={datasourceNodeDataMap[key]!} />}inputFields={inputFields}readonly={isPreviewing || isEditing}labelClassName="pt-1 pb-1"diff --git a/web/app/components/rag-pipeline/components/panel/test-run/preparation/__tests__/hooks.spec.ts b/web/app/components/rag-pipeline/components/panel/test-run/preparation/__tests__/hooks.spec.tsindex 64279a2d7df..35d42fc269c 100644--- a/web/app/components/rag-pipeline/components/panel/test-run/preparation/__tests__/hooks.spec.ts+++ b/web/app/components/rag-pipeline/components/panel/test-run/preparation/__tests__/hooks.spec.ts@@ -56,8 +56,8 @@ describe('useTestRunSteps', () => {const { result } = renderHook(() => useTestRunSteps())expect(result.current.steps).toHaveLength(2)- expect(result.current.steps[0].value).toBe('dataSource')- expect(result.current.steps[1].value).toBe('documentProcessing')+ expect(result.current.steps[0]!.value).toBe('dataSource')+ expect(result.current.steps[1]!.value).toBe('documentProcessing')})it('should increment step on handleNextStep', () => {@@ -87,8 +87,8 @@ describe('useTestRunSteps', () => {it('should have translated step labels', () => {const { result } = renderHook(() => useTestRunSteps())- expect(result.current.steps[0].label).toBeDefined()- expect(typeof result.current.steps[0].label).toBe('string')+ expect(result.current.steps[0]!.label).toBeDefined()+ expect(typeof result.current.steps[0]!.label).toBe('string')})})@@ -137,7 +137,7 @@ describe('useDatasourceOptions', () => {const { result } = renderHook(() => useDatasourceOptions())expect(result.current).toHaveLength(1)- expect(result.current[0].value).toBe('ds-1')+ expect(result.current[0]!.value).toBe('ds-1')})})diff --git a/web/app/components/rag-pipeline/components/panel/test-run/preparation/__tests__/index.spec.tsx b/web/app/components/rag-pipeline/components/panel/test-run/preparation/__tests__/index.spec.tsxindex a7956927c18..0ec5a4d1667 100644--- a/web/app/components/rag-pipeline/components/panel/test-run/preparation/__tests__/index.spec.tsx+++ b/web/app/components/rag-pipeline/components/panel/test-run/preparation/__tests__/index.spec.tsx@@ -253,9 +253,9 @@ describe('StepIndicator', () => {it('should render without crashing', () => {render(<StepIndicator steps={defaultSteps} currentStep={1} />)- expect(screen.getByText('Step 1')).toBeInTheDocument()- expect(screen.getByText('Step 2')).toBeInTheDocument()- expect(screen.getByText('Step 3')).toBeInTheDocument()+ expect(screen.getByText('Step 1'))!.toBeInTheDocument()+ expect(screen.getByText('Step 2'))!.toBeInTheDocument()+ expect(screen.getByText('Step 3'))!.toBeInTheDocument()})it('should render all step labels', () => {@@ -266,8 +266,8 @@ describe('StepIndicator', () => {render(<StepIndicator steps={steps} currentStep={1} />)- expect(screen.getByText('Data Source')).toBeInTheDocument()- expect(screen.getByText('Processing')).toBeInTheDocument()+ expect(screen.getByText('Data Source'))!.toBeInTheDocument()+ expect(screen.getByText('Processing'))!.toBeInTheDocument()})it('should render container with correct classes', () => {@@ -337,7 +337,7 @@ describe('StepIndicator', () => {it('should handle empty steps array', () => {const { container } = render(<StepIndicator steps={[]} currentStep={1} />)- expect(container.firstChild).toBeInTheDocument()+ expect(container.firstChild)!.toBeInTheDocument()})})@@ -347,7 +347,7 @@ describe('StepIndicator', () => {rerender(<StepIndicator steps={defaultSteps} currentStep={1} />)- expect(screen.getByText('Step 1')).toBeInTheDocument()+ expect(screen.getByText('Step 1'))!.toBeInTheDocument()})it('should update when currentStep changes', () => {@@ -373,8 +373,8 @@ describe('StepIndicator', () => {]rerender(<StepIndicator steps={newSteps} currentStep={1} />)- expect(screen.getByText('New Step 1')).toBeInTheDocument()- expect(screen.getByText('New Step 2')).toBeInTheDocument()+ expect(screen.getByText('New Step 1'))!.toBeInTheDocument()+ expect(screen.getByText('New Step 2'))!.toBeInTheDocument()expect(screen.queryByText('Step 3')).not.toBeInTheDocument()})})@@ -402,7 +402,7 @@ describe('StepIndicator', () => {render(<StepIndicator steps={stepsWithEmpty} currentStep={1} />)- expect(screen.getByText('Valid')).toBeInTheDocument()+ expect(screen.getByText('Valid'))!.toBeInTheDocument()})it('should handle steps with very long labels', () => {@@ -411,7 +411,7 @@ describe('StepIndicator', () => {render(<StepIndicator steps={stepsWithLong} currentStep={1} />)- expect(screen.getByText(longLabel)).toBeInTheDocument()+ expect(screen.getByText(longLabel))!.toBeInTheDocument()})it('should handle special characters in labels', () => {@@ -419,7 +419,7 @@ describe('StepIndicator', () => {render(<StepIndicator steps={specialSteps} currentStep={1} />)- expect(screen.getByText('<Test> & "Label"')).toBeInTheDocument()+ expect(screen.getByText('<Test> & "Label"'))!.toBeInTheDocument()})it('should handle unicode characters in labels', () => {@@ -427,7 +427,7 @@ describe('StepIndicator', () => {render(<StepIndicator steps={unicodeSteps} currentStep={1} />)- expect(screen.getByText('数据源 🎉')).toBeInTheDocument()+ expect(screen.getByText('数据源 🎉'))!.toBeInTheDocument()})it('should handle negative currentStep', () => {@@ -448,7 +448,7 @@ describe('FooterTips', () => {it('should render without crashing', () => {render(<FooterTips />)- expect(screen.getByText('datasetPipeline.testRun.tooltip')).toBeInTheDocument()+ expect(screen.getByText('datasetPipeline.testRun.tooltip'))!.toBeInTheDocument()})it('should render with correct container classes', () => {@@ -472,7 +472,7 @@ describe('FooterTips', () => {rerender(<FooterTips />)- expect(screen.getByText('datasetPipeline.testRun.tooltip')).toBeInTheDocument()+ expect(screen.getByText('datasetPipeline.testRun.tooltip'))!.toBeInTheDocument()})it('should render consistently across multiple rerenders', () => {@@ -481,7 +481,7 @@ describe('FooterTips', () => {for (let i = 0; i < 5; i++)rerender(<FooterTips />)- expect(screen.getByText('datasetPipeline.testRun.tooltip')).toBeInTheDocument()+ expect(screen.getByText('datasetPipeline.testRun.tooltip'))!.toBeInTheDocument()})})@@ -510,15 +510,15 @@ describe('useTestRunSteps', () => {const { result } = renderHook(() => useTestRunSteps())expect(result.current.steps).toHaveLength(2)- expect(result.current.steps[0].value).toBe('dataSource')- expect(result.current.steps[1].value).toBe('documentProcessing')+ expect(result.current.steps[0]!.value).toBe('dataSource')+ expect(result.current.steps[1]!.value).toBe('documentProcessing')})it('should provide translated step labels', () => {const { result } = renderHook(() => useTestRunSteps())- expect(result.current.steps[0].label).toContain('testRun.steps.dataSource')- expect(result.current.steps[1].label).toContain('testRun.steps.documentProcessing')+ expect(result.current.steps[0]!.label).toContain('testRun.steps.dataSource')+ expect(result.current.steps[1]!.label).toContain('testRun.steps.documentProcessing')})})@@ -714,7 +714,7 @@ describe('useDatasourceOptions', () => {const { result } = renderHook(() => useDatasourceOptions())- expect(result.current[0].value).toBe('unique-node-id-123')+ expect(result.current[0]!.value).toBe('unique-node-id-123')})it('should map node title to option label', () => {@@ -730,7 +730,7 @@ describe('useDatasourceOptions', () => {const { result } = renderHook(() => useDatasourceOptions())- expect(result.current[0].label).toBe('Custom Data Source Title')+ expect(result.current[0]!.label).toBe('Custom Data Source Title')})it('should include full node data in option', () => {@@ -752,7 +752,7 @@ describe('useDatasourceOptions', () => {const { result } = renderHook(() => useDatasourceOptions())- expect(result.current[0].data).toEqual(nodeData)+ expect(result.current[0]!.data).toEqual(nodeData)})})@@ -773,7 +773,7 @@ describe('useDatasourceOptions', () => {rerender()expect(result.current).toHaveLength(1)- expect(result.current[0].label).toBe('Test')+ expect(result.current[0]!.label).toBe('Test')})it('should update options when nodes change', () => {@@ -789,7 +789,7 @@ describe('useDatasourceOptions', () => {const { result, rerender } = renderHook(() => useDatasourceOptions())expect(result.current).toHaveLength(1)- expect(result.current[0].label).toBe('First')+ expect(result.current[0]!.label).toBe('First')mockNodes = [{@@ -810,8 +810,8 @@ describe('useDatasourceOptions', () => {rerender()expect(result.current).toHaveLength(2)- expect(result.current[0].label).toBe('Second')- expect(result.current[1].label).toBe('Third')+ expect(result.current[0]!.label).toBe('Second')+ expect(result.current[1]!.label).toBe('Third')})})@@ -829,7 +829,7 @@ describe('useDatasourceOptions', () => {const { result } = renderHook(() => useDatasourceOptions())- expect(result.current[0].label).toBe('')+ expect(result.current[0]!.label).toBe('')})it('should handle multiple DataSource nodes', () => {@@ -1054,32 +1054,32 @@ describe('Preparation', () => {it('should render without crashing', () => {render(<Preparation />)- expect(screen.getByTestId('data-source-options')).toBeInTheDocument()+ expect(screen.getByTestId('data-source-options'))!.toBeInTheDocument()})it('should render StepIndicator', () => {render(<Preparation />)- expect(screen.getByText('datasetPipeline.testRun.steps.dataSource')).toBeInTheDocument()- expect(screen.getByText('datasetPipeline.testRun.steps.documentProcessing')).toBeInTheDocument()+ expect(screen.getByText('datasetPipeline.testRun.steps.dataSource'))!.toBeInTheDocument()+ expect(screen.getByText('datasetPipeline.testRun.steps.documentProcessing'))!.toBeInTheDocument()})it('should render DataSourceOptions on step 1', () => {render(<Preparation />)- expect(screen.getByTestId('data-source-options')).toBeInTheDocument()+ expect(screen.getByTestId('data-source-options'))!.toBeInTheDocument()})it('should render Actions on step 1', () => {render(<Preparation />)- expect(screen.getByText('datasetCreation.stepOne.button')).toBeInTheDocument()+ expect(screen.getByText('datasetCreation.stepOne.button'))!.toBeInTheDocument()})it('should render FooterTips on step 1', () => {render(<Preparation />)- expect(screen.getByText('datasetPipeline.testRun.tooltip')).toBeInTheDocument()+ expect(screen.getByText('datasetPipeline.testRun.tooltip'))!.toBeInTheDocument()})it('should not render DocumentProcessing on step 1', () => {@@ -1095,7 +1095,7 @@ describe('Preparation', () => {fireEvent.click(screen.getByTestId('select-local-file'))- expect(screen.getByTestId('local-file')).toBeInTheDocument()+ expect(screen.getByTestId('local-file'))!.toBeInTheDocument()})it('should render OnlineDocuments component when online document datasource is selected', () => {@@ -1103,7 +1103,7 @@ describe('Preparation', () => {fireEvent.click(screen.getByTestId('select-online-document'))- expect(screen.getByTestId('online-documents')).toBeInTheDocument()+ expect(screen.getByTestId('online-documents'))!.toBeInTheDocument()})it('should render WebsiteCrawl component when website crawl datasource is selected', () => {@@ -1111,7 +1111,7 @@ describe('Preparation', () => {fireEvent.click(screen.getByTestId('select-website-crawl'))- expect(screen.getByTestId('website-crawl')).toBeInTheDocument()+ expect(screen.getByTestId('website-crawl'))!.toBeInTheDocument()})it('should render OnlineDrive component when online drive datasource is selected', () => {@@ -1119,7 +1119,7 @@ describe('Preparation', () => {fireEvent.click(screen.getByTestId('select-online-drive'))- expect(screen.getByTestId('online-drive')).toBeInTheDocument()+ expect(screen.getByTestId('online-drive'))!.toBeInTheDocument()})it('should pass correct props to LocalFile component', () => {@@ -1128,8 +1128,8 @@ describe('Preparation', () => {fireEvent.click(screen.getByTestId('select-local-file'))const localFile = screen.getByTestId('local-file')- expect(localFile).toHaveAttribute('data-extensions', '["txt","pdf"]')- expect(localFile).toHaveAttribute('data-batch', 'false')+ expect(localFile)!.toHaveAttribute('data-extensions', '["txt","pdf"]')+ expect(localFile)!.toHaveAttribute('data-batch', 'false')})it('should pass isInPipeline=true to OnlineDocuments', () => {@@ -1138,7 +1138,7 @@ describe('Preparation', () => {fireEvent.click(screen.getByTestId('select-online-document'))const onlineDocs = screen.getByTestId('online-documents')- expect(onlineDocs).toHaveAttribute('data-in-pipeline', 'true')+ expect(onlineDocs)!.toHaveAttribute('data-in-pipeline', 'true')})it('should pass supportBatchUpload=false to all data source components', () => {@@ -1146,7 +1146,7 @@ describe('Preparation', () => {fireEvent.click(screen.getByTestId('select-online-document'))- expect(screen.getByTestId('online-documents')).toHaveAttribute('data-batch', 'false')+ expect(screen.getByTestId('online-documents'))!.toHaveAttribute('data-batch', 'false')})it('should update dataSourceNodeId when selecting different datasources', () => {@@ -1154,11 +1154,11 @@ describe('Preparation', () => {fireEvent.click(screen.getByTestId('select-local-file'))- expect(screen.getByTestId('data-source-options')).toHaveAttribute('data-selected', 'local-file-node')+ expect(screen.getByTestId('data-source-options'))!.toHaveAttribute('data-selected', 'local-file-node')fireEvent.click(screen.getByTestId('select-online-document'))- expect(screen.getByTestId('data-source-options')).toHaveAttribute('data-selected', 'online-doc-node')+ expect(screen.getByTestId('data-source-options'))!.toHaveAttribute('data-selected', 'online-doc-node')})})@@ -1166,7 +1166,7 @@ describe('Preparation', () => {it('should disable next button when no datasource is selected', () => {render(<Preparation />)- expect(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i })).toBeDisabled()+ expect(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i }))!.toBeDisabled()})it('should disable next button for local file when file list is empty', () => {@@ -1175,7 +1175,7 @@ describe('Preparation', () => {fireEvent.click(screen.getByTestId('select-local-file'))- expect(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i })).toBeDisabled()+ expect(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i }))!.toBeDisabled()})it('should disable next button for local file when file has no id', () => {@@ -1186,7 +1186,7 @@ describe('Preparation', () => {fireEvent.click(screen.getByTestId('select-local-file'))- expect(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i })).toBeDisabled()+ expect(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i }))!.toBeDisabled()})it('should enable next button for local file when file has valid id', () => {@@ -1206,7 +1206,7 @@ describe('Preparation', () => {fireEvent.click(screen.getByTestId('select-online-document'))- expect(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i })).toBeDisabled()+ expect(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i }))!.toBeDisabled()})it('should enable next button for online document when documents exist', () => {@@ -1224,7 +1224,7 @@ describe('Preparation', () => {fireEvent.click(screen.getByTestId('select-website-crawl'))- expect(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i })).toBeDisabled()+ expect(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i }))!.toBeDisabled()})it('should enable next button for website crawl when pages exist', () => {@@ -1242,7 +1242,7 @@ describe('Preparation', () => {fireEvent.click(screen.getByTestId('select-online-drive'))- expect(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i })).toBeDisabled()+ expect(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i }))!.toBeDisabled()})it('should enable next button for online drive when files are selected', () => {@@ -1265,7 +1265,7 @@ describe('Preparation', () => {fireEvent.click(screen.getByTestId('select-local-file'))fireEvent.click(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i }))- expect(screen.getByTestId('document-processing')).toBeInTheDocument()+ expect(screen.getByTestId('document-processing'))!.toBeInTheDocument()expect(screen.queryByTestId('data-source-options')).not.toBeInTheDocument()})@@ -1278,7 +1278,7 @@ describe('Preparation', () => {fireEvent.click(screen.getByTestId('select-local-file'))fireEvent.click(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i }))- expect(screen.getByTestId('document-processing')).toHaveAttribute('data-node-id', 'local-file-node')+ expect(screen.getByTestId('document-processing'))!.toHaveAttribute('data-node-id', 'local-file-node')})it('should navigate back to step 1 when back button is clicked', () => {@@ -1289,11 +1289,11 @@ describe('Preparation', () => {fireEvent.click(screen.getByTestId('select-local-file'))fireEvent.click(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i }))- expect(screen.getByTestId('document-processing')).toBeInTheDocument()+ expect(screen.getByTestId('document-processing'))!.toBeInTheDocument()fireEvent.click(screen.getByTestId('back-btn'))- expect(screen.getByTestId('data-source-options')).toBeInTheDocument()+ expect(screen.getByTestId('data-source-options'))!.toBeInTheDocument()expect(screen.queryByTestId('document-processing')).not.toBeInTheDocument()})})@@ -1479,7 +1479,7 @@ describe('Preparation', () => {const { rerender } = render(<Preparation />)rerender(<Preparation />)- expect(screen.getByTestId('data-source-options')).toBeInTheDocument()+ expect(screen.getByTestId('data-source-options'))!.toBeInTheDocument()})it('should maintain state across rerenders', () => {@@ -1493,7 +1493,7 @@ describe('Preparation', () => {rerender(<Preparation />)- expect(screen.getByTestId('document-processing')).toBeInTheDocument()+ expect(screen.getByTestId('document-processing'))!.toBeInTheDocument()})})@@ -1538,7 +1538,7 @@ describe('Preparation', () => {fireEvent.click(screen.getByTestId('select-online-drive'))fireEvent.click(screen.getByTestId('select-local-file'))- expect(screen.getByTestId('local-file')).toBeInTheDocument()+ expect(screen.getByTestId('local-file'))!.toBeInTheDocument()})it('should handle rapid step navigation', () => {@@ -1553,7 +1553,7 @@ describe('Preparation', () => {fireEvent.click(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i }))fireEvent.click(screen.getByTestId('back-btn'))- expect(screen.getByTestId('data-source-options')).toBeInTheDocument()+ expect(screen.getByTestId('data-source-options'))!.toBeInTheDocument()})})@@ -1565,10 +1565,10 @@ describe('Preparation', () => {render(<Preparation />)fireEvent.click(screen.getByTestId('select-local-file'))- expect(screen.getByTestId('local-file')).toBeInTheDocument()+ expect(screen.getByTestId('local-file'))!.toBeInTheDocument()fireEvent.click(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i }))- expect(screen.getByTestId('document-processing')).toBeInTheDocument()+ expect(screen.getByTestId('document-processing'))!.toBeInTheDocument()fireEvent.click(screen.getByTestId('process-btn'))@@ -1586,15 +1586,15 @@ describe('Preparation', () => {fireEvent.click(screen.getByTestId('select-local-file'))fireEvent.click(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i }))- expect(screen.getByTestId('document-processing')).toBeInTheDocument()+ expect(screen.getByTestId('document-processing'))!.toBeInTheDocument()fireEvent.click(screen.getByTestId('back-btn'))fireEvent.click(screen.getByTestId('select-online-document'))- expect(screen.getByTestId('online-documents')).toBeInTheDocument()+ expect(screen.getByTestId('online-documents'))!.toBeInTheDocument()fireEvent.click(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i }))- expect(screen.getByTestId('document-processing')).toHaveAttribute('data-node-id', 'online-doc-node')+ expect(screen.getByTestId('document-processing'))!.toHaveAttribute('data-node-id', 'online-doc-node')})})})@@ -1610,7 +1610,7 @@ describe('Callback Dependencies', () => {const { rerender } = render(<Preparation />)fireEvent.click(screen.getByTestId('select-local-file'))- expect(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i })).toBeDisabled()+ expect(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i }))!.toBeDisabled()mockDataSourceStoreState.localFileList = [{ file: { id: 'file-123', name: 'test.txt', type: 'text/plain', size: 100, extension: 'txt', mime_type: 'text/plain' } },@@ -1625,7 +1625,7 @@ describe('Callback Dependencies', () => {const { rerender } = render(<Preparation />)fireEvent.click(screen.getByTestId('select-online-document'))- expect(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i })).toBeDisabled()+ expect(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i }))!.toBeDisabled()mockDataSourceStoreState.onlineDocuments = [{ workspace_id: 'ws-1' }]rerender(<Preparation />)@@ -1638,7 +1638,7 @@ describe('Callback Dependencies', () => {const { rerender } = render(<Preparation />)fireEvent.click(screen.getByTestId('select-website-crawl'))- expect(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i })).toBeDisabled()+ expect(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i }))!.toBeDisabled()mockDataSourceStoreState.websitePages = [{ url: 'https://example.com' }]rerender(<Preparation />)@@ -1651,7 +1651,7 @@ describe('Callback Dependencies', () => {const { rerender } = render(<Preparation />)fireEvent.click(screen.getByTestId('select-online-drive'))- expect(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i })).toBeDisabled()+ expect(screen.getByRole('button', { name: /datasetCreation.stepOne.button/i }))!.toBeDisabled()mockDataSourceStoreState.selectedFileIds = ['file-1']rerender(<Preparation />)diff --git a/web/app/components/rag-pipeline/components/panel/test-run/preparation/data-source-options/__tests__/index.spec.tsx b/web/app/components/rag-pipeline/components/panel/test-run/preparation/data-source-options/__tests__/index.spec.tsxindex b159455cb68..66e4d470211 100644--- a/web/app/components/rag-pipeline/components/panel/test-run/preparation/data-source-options/__tests__/index.spec.tsx+++ b/web/app/components/rag-pipeline/components/panel/test-run/preparation/data-source-options/__tests__/index.spec.tsx@@ -62,7 +62,7 @@ describe('OptionCard', () => {/>,)- expect(screen.getByText('Test Label')).toBeInTheDocument()+ expect(screen.getByText('Test Label'))!.toBeInTheDocument()})it('should render label text', () => {@@ -77,7 +77,7 @@ describe('OptionCard', () => {/>,)- expect(screen.getByText('My Data Source')).toBeInTheDocument()+ expect(screen.getByText('My Data Source'))!.toBeInTheDocument()})it('should render BlockIcon component', () => {@@ -92,7 +92,7 @@ describe('OptionCard', () => {/>,)- expect(screen.getByTestId('block-icon')).toBeInTheDocument()+ expect(screen.getByTestId('block-icon'))!.toBeInTheDocument()})it('should pass correct type to BlockIcon', () => {@@ -108,7 +108,7 @@ describe('OptionCard', () => {)const blockIcon = screen.getByTestId('block-icon')- expect(blockIcon).toHaveAttribute('data-type', 'datasource')+ expect(blockIcon)!.toHaveAttribute('data-type', 'datasource')})it('should set title attribute on label element', () => {@@ -123,7 +123,7 @@ describe('OptionCard', () => {/>,)- expect(screen.getByTitle('Long Label Text')).toBeInTheDocument()+ expect(screen.getByTitle('Long Label Text'))!.toBeInTheDocument()})})@@ -225,7 +225,7 @@ describe('OptionCard', () => {/>,)- expect(screen.getByText('Website Crawler')).toBeInTheDocument()+ expect(screen.getByText('Website Crawler'))!.toBeInTheDocument()})})@@ -439,7 +439,7 @@ describe('OptionCard', () => {/>,)- expect(screen.getByText('Test')).toBeInTheDocument()+ expect(screen.getByText('Test'))!.toBeInTheDocument()})it('should re-render when selected prop changes', () => {@@ -484,7 +484,7 @@ describe('OptionCard', () => {/>,)- expect(screen.getByTestId('block-icon')).toBeInTheDocument()+ expect(screen.getByTestId('block-icon'))!.toBeInTheDocument()})it('should handle very long label', () => {@@ -500,8 +500,8 @@ describe('OptionCard', () => {/>,)- expect(screen.getByText(longLabel)).toBeInTheDocument()- expect(screen.getByTitle(longLabel)).toBeInTheDocument()+ expect(screen.getByText(longLabel))!.toBeInTheDocument()+ expect(screen.getByTitle(longLabel))!.toBeInTheDocument()})it('should handle special characters in label', () => {@@ -517,7 +517,7 @@ describe('OptionCard', () => {/>,)- expect(screen.getByText(specialLabel)).toBeInTheDocument()+ expect(screen.getByText(specialLabel))!.toBeInTheDocument()})it('should handle unicode characters in label', () => {@@ -532,7 +532,7 @@ describe('OptionCard', () => {/>,)- expect(screen.getByText('数据源 🎉 データソース')).toBeInTheDocument()+ expect(screen.getByText('数据源 🎉 データソース'))!.toBeInTheDocument()})it('should handle empty value', () => {@@ -584,7 +584,7 @@ describe('OptionCard', () => {/>,)- expect(screen.getByText('Minimal')).toBeInTheDocument()+ expect(screen.getByText('Minimal'))!.toBeInTheDocument()})})@@ -618,7 +618,7 @@ describe('OptionCard', () => {/>,)- expect(screen.getByTitle(label)).toBeInTheDocument()+ expect(screen.getByTitle(label))!.toBeInTheDocument()})})})@@ -640,7 +640,7 @@ describe('DataSourceOptions', () => {/>,)- expect(container.querySelector('.grid')).toBeInTheDocument()+ expect(container.querySelector('.grid'))!.toBeInTheDocument()})it('should render OptionCard for each option', () => {@@ -657,9 +657,9 @@ describe('DataSourceOptions', () => {/>,)- expect(screen.getByText('Option 1')).toBeInTheDocument()- expect(screen.getByText('Option 2')).toBeInTheDocument()- expect(screen.getByText('Option 3')).toBeInTheDocument()+ expect(screen.getByText('Option 1'))!.toBeInTheDocument()+ expect(screen.getByText('Option 2'))!.toBeInTheDocument()+ expect(screen.getByText('Option 3'))!.toBeInTheDocument()})it('should render empty grid when no options', () => {@@ -673,7 +673,7 @@ describe('DataSourceOptions', () => {)const grid = container.querySelector('.grid')- expect(grid).toBeInTheDocument()+ expect(grid)!.toBeInTheDocument()expect(grid?.children.length).toBe(0)})@@ -726,8 +726,8 @@ describe('DataSourceOptions', () => {)const cards = container.querySelectorAll('.flex.cursor-pointer')- expect(cards[0].className).toContain('border-components-option-card-option-selected-border')- expect(cards[1].className).not.toContain('border-components-option-card-option-selected-border')+ expect(cards[0]!.className).toContain('border-components-option-card-option-selected-border')+ expect(cards[1]!.className).not.toContain('border-components-option-card-option-selected-border')})it('should mark second option as selected when matching', () => {@@ -744,8 +744,8 @@ describe('DataSourceOptions', () => {)const cards = container.querySelectorAll('.flex.cursor-pointer')- expect(cards[0].className).not.toContain('border-components-option-card-option-selected-border')- expect(cards[1].className).toContain('border-components-option-card-option-selected-border')+ expect(cards[0]!.className).not.toContain('border-components-option-card-option-selected-border')+ expect(cards[1]!.className).toContain('border-components-option-card-option-selected-border')})it('should mark none as selected when dataSourceNodeId does not match', () => {@@ -777,7 +777,7 @@ describe('DataSourceOptions', () => {/>,)- expect(container.querySelector('.grid')).toBeInTheDocument()+ expect(container.querySelector('.grid'))!.toBeInTheDocument()})})@@ -1101,7 +1101,7 @@ describe('DataSourceOptions', () => {/>,)- expect(screen.getByText('Only Option')).toBeInTheDocument()+ expect(screen.getByText('Only Option'))!.toBeInTheDocument()})it('should handle many options', () => {@@ -1115,8 +1115,8 @@ describe('DataSourceOptions', () => {/>,)- expect(screen.getByText('Option 0')).toBeInTheDocument()- expect(screen.getByText('Option 19')).toBeInTheDocument()+ expect(screen.getByText('Option 0'))!.toBeInTheDocument()+ expect(screen.getByText('Option 19'))!.toBeInTheDocument()})it('should handle options with duplicate labels but different values', () => {@@ -1135,7 +1135,7 @@ describe('DataSourceOptions', () => {/>,)const labels = screen.getAllByText('Same Label')- fireEvent.click(labels[1]) // Click second one+ fireEvent.click(labels[1]!) // Click second oneexpect(onSelect).toHaveBeenLastCalledWith({ nodeId: 'id-2', nodeData: data2 })})@@ -1176,7 +1176,7 @@ describe('DataSourceOptions', () => {/>,)- expect(container.querySelector('.grid')).toBeInTheDocument()+ expect(container.querySelector('.grid'))!.toBeInTheDocument()})it('should handle options with empty string values', () => {@@ -1289,7 +1289,7 @@ describe('DataSourceOptions Integration', () => {)let cards = container.querySelectorAll('.flex.cursor-pointer')- expect(cards[1].className).toContain('border-components-option-card-option-selected-border')+ expect(cards[1]!.className).toContain('border-components-option-card-option-selected-border')rerender(<DataSourceOptions@@ -1299,8 +1299,8 @@ describe('DataSourceOptions Integration', () => {)cards = container.querySelectorAll('.flex.cursor-pointer')- expect(cards[2].className).toContain('border-components-option-card-option-selected-border')- expect(cards[1].className).not.toContain('border-components-option-card-option-selected-border')+ expect(cards[2]!.className).toContain('border-components-option-card-option-selected-border')+ expect(cards[1]!.className).not.toContain('border-components-option-card-option-selected-border')})it('should handle rapid option switching', async () => {@@ -1344,8 +1344,8 @@ describe('DataSourceOptions Integration', () => {/>,)- expect(screen.getByText('Test Label')).toBeInTheDocument()- expect(screen.getByTestId('block-icon')).toBeInTheDocument()+ expect(screen.getByText('Test Label'))!.toBeInTheDocument()+ expect(screen.getByTestId('block-icon'))!.toBeInTheDocument()const card = container.querySelector('.flex.cursor-pointer')expect(card?.className).toContain('border-components-option-card-option-selected-border')})@@ -1397,8 +1397,8 @@ describe('DataSourceOptions Integration', () => {}const cards = container.querySelectorAll('.flex.cursor-pointer')- expect(cards[0].className).toContain('border-components-option-card-option-selected-border')- expect(cards[1].className).not.toContain('border-components-option-card-option-selected-border')+ expect(cards[0]!.className).toContain('border-components-option-card-option-selected-border')+ expect(cards[1]!.className).not.toContain('border-components-option-card-option-selected-border')})it('should handle options array reference change with same content', () => {@@ -1490,7 +1490,7 @@ describe('handleSelect Early Return Coverage', () => {/>,)- expect(container.querySelector('.grid')).toBeInTheDocument()+ expect(container.querySelector('.grid'))!.toBeInTheDocument()expect(onSelect).not.toHaveBeenCalled()})diff --git a/web/app/components/rag-pipeline/components/panel/test-run/preparation/data-source-options/index.tsx b/web/app/components/rag-pipeline/components/panel/test-run/preparation/data-source-options/index.tsxindex 159887a8253..82194e2e8df 100644--- a/web/app/components/rag-pipeline/components/panel/test-run/preparation/data-source-options/index.tsx+++ b/web/app/components/rag-pipeline/components/panel/test-run/preparation/data-source-options/index.tsx@@ -27,7 +27,7 @@ const DataSourceOptions = ({useEffect(() => {if (options.length > 0 && !dataSourceNodeId)- handelSelect(options[0].value)+ handelSelect(options[0]!.value)}, [])return (diff --git a/web/app/components/rag-pipeline/components/panel/test-run/preparation/document-processing/options.tsx b/web/app/components/rag-pipeline/components/panel/test-run/preparation/document-processing/options.tsxindex 49a1b9a2848..0e904dae7a8 100644--- a/web/app/components/rag-pipeline/components/panel/test-run/preparation/document-processing/options.tsx+++ b/web/app/components/rag-pipeline/components/panel/test-run/preparation/document-processing/options.tsx@@ -21,7 +21,7 @@ const Options = ({ initialData, configurations, schema, CustomActions, onSubmitif (!result.success) {const issues = result.error.issuesconst firstIssue = issues[0]- const errorMessage = `Path: ${firstIssue.path.join('.')} Error: ${firstIssue.message}`+ const errorMessage = `Path: ${firstIssue!.path.join('.')} Error: ${firstIssue!.message}`toast.error(errorMessage)return errorMessage}diff --git a/web/app/components/rag-pipeline/components/panel/test-run/preparation/index.tsx b/web/app/components/rag-pipeline/components/panel/test-run/preparation/index.tsxindex bf4f74493bc..a65770f01d5 100644--- a/web/app/components/rag-pipeline/components/panel/test-run/preparation/index.tsx+++ b/web/app/components/rag-pipeline/components/panel/test-run/preparation/index.tsx@@ -76,7 +76,7 @@ const Preparation = () => {const credentialId = dataSourceStore.getState().currentCredentialIdif (datasourceType === DatasourceType.localFile) {const { localFileList } = dataSourceStore.getState()- const { id, name, type, size, extension, mime_type } = localFileList[0].file+ const { id, name, type, size, extension, mime_type } = localFileList[0]!.fileconst documentInfo = {related_id: id,name,@@ -91,7 +91,7 @@ const Preparation = () => {}if (datasourceType === DatasourceType.onlineDocument) {const { onlineDocuments } = dataSourceStore.getState()- const { workspace_id, ...rest } = onlineDocuments[0]+ const { workspace_id, ...rest } = onlineDocuments[0]!const documentInfo = {workspace_id,page: rest,diff --git a/web/app/components/rag-pipeline/components/panel/test-run/result/__tests__/index.spec.tsx b/web/app/components/rag-pipeline/components/panel/test-run/result/__tests__/index.spec.tsxindex 249a13023c2..d08c87fdf04 100644--- a/web/app/components/rag-pipeline/components/panel/test-run/result/__tests__/index.spec.tsx+++ b/web/app/components/rag-pipeline/components/panel/test-run/result/__tests__/index.spec.tsx@@ -188,7 +188,7 @@ describe('Tab', () => {/>,)- expect(screen.getByRole('button')).toHaveTextContent('Test Tab')+ expect(screen.getByRole('button'))!.toHaveTextContent('Test Tab')})it('should apply active styles when isActive is true', () => {@@ -205,8 +205,8 @@ describe('Tab', () => {)const button = screen.getByRole('button')- expect(button).toHaveClass('border-util-colors-blue-brand-blue-brand-600')- expect(button).toHaveClass('text-text-primary')+ expect(button)!.toHaveClass('border-util-colors-blue-brand-blue-brand-600')+ expect(button)!.toHaveClass('text-text-primary')})it('should apply inactive styles when isActive is false', () => {@@ -223,8 +223,8 @@ describe('Tab', () => {)const button = screen.getByRole('button')- expect(button).toHaveClass('border-transparent')- expect(button).toHaveClass('text-text-tertiary')+ expect(button)!.toHaveClass('border-transparent')+ expect(button)!.toHaveClass('text-text-tertiary')})it('should apply disabled styles when workflowRunningData is undefined', () => {@@ -241,8 +241,8 @@ describe('Tab', () => {)const button = screen.getByRole('button')- expect(button).toBeDisabled()- expect(button).toHaveClass('opacity-30')+ expect(button)!.toBeDisabled()+ expect(button)!.toHaveClass('opacity-30')})})@@ -328,12 +328,12 @@ describe('Tab', () => {rerender(<Tab isActive={true} label="Tab" value="tab" workflowRunningData={undefined} onClick={mockOnClick} />,)- expect(screen.getByRole('button')).toBeDisabled()+ expect(screen.getByRole('button'))!.toBeDisabled()rerender(<Tab isActive={false} label="Tab" value="tab" workflowRunningData={undefined} onClick={mockOnClick} />,)- expect(screen.getByRole('button')).toBeDisabled()+ expect(screen.getByRole('button'))!.toBeDisabled()})})})@@ -353,9 +353,9 @@ describe('Tabs', () => {/>,)- expect(screen.getByText('runLog.result')).toBeInTheDocument()- expect(screen.getByText('runLog.detail')).toBeInTheDocument()- expect(screen.getByText('runLog.tracing')).toBeInTheDocument()+ expect(screen.getByText('runLog.result'))!.toBeInTheDocument()+ expect(screen.getByText('runLog.detail'))!.toBeInTheDocument()+ expect(screen.getByText('runLog.tracing'))!.toBeInTheDocument()})it('should render tabs container with correct styling', () => {@@ -368,9 +368,9 @@ describe('Tabs', () => {)const tabsContainer = container.firstChild as HTMLElement- expect(tabsContainer).toHaveClass('flex')- expect(tabsContainer).toHaveClass('shrink-0')- expect(tabsContainer).toHaveClass('border-b-[0.5px]')+ expect(tabsContainer)!.toHaveClass('flex')+ expect(tabsContainer)!.toHaveClass('shrink-0')+ expect(tabsContainer)!.toHaveClass('border-b-[0.5px]')})it('should highlight the current tab', () => {@@ -383,9 +383,9 @@ describe('Tabs', () => {)const buttons = screen.getAllByRole('button')- expect(buttons[0]).toHaveClass('border-transparent')- expect(buttons[1]).toHaveClass('border-util-colors-blue-brand-blue-brand-600')- expect(buttons[2]).toHaveClass('border-transparent')+ expect(buttons[0])!.toHaveClass('border-transparent')+ expect(buttons[1])!.toHaveClass('border-util-colors-blue-brand-blue-brand-600')+ expect(buttons[2])!.toHaveClass('border-transparent')})})@@ -451,10 +451,10 @@ describe('Tabs', () => {const buttons = screen.getAllByRole('button')buttons.forEach((button) => {- expect(button).toBeDisabled()+ expect(button)!.toBeDisabled()})- fireEvent.click(buttons[0])+ fireEvent.click(buttons[0]!)expect(mockSwitchTab).not.toHaveBeenCalled()})})@@ -469,21 +469,21 @@ describe('Tabs', () => {)let buttons = screen.getAllByRole('button')- expect(buttons[0]).toHaveClass('border-util-colors-blue-brand-blue-brand-600')+ expect(buttons[0])!.toHaveClass('border-util-colors-blue-brand-blue-brand-600')rerender(<Tabs currentTab="DETAIL" workflowRunningData={workflowData} switchTab={mockSwitchTab} />,)buttons = screen.getAllByRole('button')- expect(buttons[1]).toHaveClass('border-util-colors-blue-brand-blue-brand-600')+ expect(buttons[1])!.toHaveClass('border-util-colors-blue-brand-blue-brand-600')rerender(<Tabs currentTab="TRACING" workflowRunningData={workflowData} switchTab={mockSwitchTab} />,)buttons = screen.getAllByRole('button')- expect(buttons[2]).toHaveClass('border-util-colors-blue-brand-blue-brand-600')+ expect(buttons[2])!.toHaveClass('border-util-colors-blue-brand-blue-brand-600')})})})@@ -514,9 +514,9 @@ describe('formatPreviewChunks', () => {const result = formatPreviewChunks(outputs) as GeneralChunksexpect(result).toHaveLength(3)- expect((result as GeneralChunks)[0].content).toBe('General chunk content 1')- expect((result as GeneralChunks)[1].content).toBe('General chunk content 2')- expect((result as GeneralChunks)[2].content).toBe('General chunk content 3')+ expect((result as GeneralChunks)[0]!.content).toBe('General chunk content 1')+ expect((result as GeneralChunks)[1]!.content).toBe('General chunk content 2')+ expect((result as GeneralChunks)[2]!.content).toBe('General chunk content 3')})it('should limit chunks to RAG_PIPELINE_PREVIEW_CHUNK_NUM', () => {@@ -544,8 +544,8 @@ describe('formatPreviewChunks', () => {expect(result.parent_mode).toBe('paragraph')expect(result.parent_child_chunks).toHaveLength(3)- expect(result.parent_child_chunks[0].parent_content).toBe('Parent content 1')- expect(result.parent_child_chunks[0].child_contents).toEqual([+ expect(result.parent_child_chunks[0]!.parent_content).toBe('Parent content 1')+ expect(result.parent_child_chunks[0]!.child_contents).toEqual(['Child 1 of parent 1','Child 2 of parent 1',])@@ -582,7 +582,7 @@ describe('formatPreviewChunks', () => {}const result = formatPreviewChunks(outputs) as ParentChildChunks- expect(result.parent_child_chunks[0].child_contents).toHaveLength(+ expect(result.parent_child_chunks[0]!.child_contents).toHaveLength(RAG_PIPELINE_PREVIEW_CHUNK_NUM,)})@@ -605,8 +605,8 @@ describe('formatPreviewChunks', () => {const result = formatPreviewChunks(outputs) as QAChunksexpect(result.qa_chunks).toHaveLength(3)- expect(result.qa_chunks[0].question).toBe('Question 1')- expect(result.qa_chunks[0].answer).toBe('Answer 1')+ expect(result.qa_chunks[0]!.question).toBe('Question 1')+ expect(result.qa_chunks[0]!.answer).toBe('Answer 1')})it('should limit QA chunks to RAG_PIPELINE_PREVIEW_CHUNK_NUM', () => {@@ -644,7 +644,7 @@ describe('ResultPreview', () => {/>,)- expect(screen.getByText('pipeline.result.resultPreview.loading')).toBeInTheDocument()+ expect(screen.getByText('pipeline.result.resultPreview.loading'))!.toBeInTheDocument()})it('should render error state when not running and has error', () => {@@ -657,8 +657,8 @@ describe('ResultPreview', () => {/>,)- expect(screen.getByText('pipeline.result.resultPreview.error')).toBeInTheDocument()- expect(screen.getByText('pipeline.result.resultPreview.viewDetails')).toBeInTheDocument()+ expect(screen.getByText('pipeline.result.resultPreview.error'))!.toBeInTheDocument()+ expect(screen.getByText('pipeline.result.resultPreview.viewDetails'))!.toBeInTheDocument()})it('should render ChunkCardList when outputs are available', () => {@@ -673,7 +673,7 @@ describe('ResultPreview', () => {/>,)- expect(screen.getByTestId('chunk-card-list')).toBeInTheDocument()+ expect(screen.getByTestId('chunk-card-list'))!.toBeInTheDocument()})it('should render footer tip with correct count', () => {@@ -688,9 +688,7 @@ describe('ResultPreview', () => {/>,)- expect(- screen.getByText(`pipeline.result.resultPreview.footerTip:{"count":${RAG_PIPELINE_PREVIEW_CHUNK_NUM}}`),- ).toBeInTheDocument()+ expect(screen.getByText(`pipeline.result.resultPreview.footerTip:{"count":${RAG_PIPELINE_PREVIEW_CHUNK_NUM}}`))!.toBeInTheDocument()})it('should not show loading when isRunning but outputs exist', () => {@@ -706,7 +704,7 @@ describe('ResultPreview', () => {)expect(screen.queryByText('pipeline.result.resultPreview.loading')).not.toBeInTheDocument()- expect(screen.getByTestId('chunk-card-list')).toBeInTheDocument()+ expect(screen.getByTestId('chunk-card-list'))!.toBeInTheDocument()})})@@ -743,7 +741,7 @@ describe('ResultPreview', () => {)const chunkCardList = screen.getByTestId('chunk-card-list')- expect(chunkCardList).toHaveAttribute('data-chunk-type', ChunkingMode.text)+ expect(chunkCardList)!.toHaveAttribute('data-chunk-type', ChunkingMode.text)})it('should render with parent-child chunks output', () => {@@ -759,7 +757,7 @@ describe('ResultPreview', () => {)const chunkCardList = screen.getByTestId('chunk-card-list')- expect(chunkCardList).toHaveAttribute('data-chunk-type', ChunkingMode.parentChild)+ expect(chunkCardList)!.toHaveAttribute('data-chunk-type', ChunkingMode.parentChild)})it('should render with QA chunks output', () => {@@ -775,7 +773,7 @@ describe('ResultPreview', () => {)const chunkCardList = screen.getByTestId('chunk-card-list')- expect(chunkCardList).toHaveAttribute('data-chunk-type', ChunkingMode.qa)+ expect(chunkCardList)!.toHaveAttribute('data-chunk-type', ChunkingMode.qa)})})@@ -833,7 +831,7 @@ describe('ResultPreview', () => {/>,)- expect(screen.getByTestId('chunk-card-list')).toBeInTheDocument()+ expect(screen.getByTestId('chunk-card-list'))!.toBeInTheDocument()})})})@@ -856,9 +854,9 @@ describe('Result', () => {render(<Result />)- expect(screen.getByText('runLog.result')).toBeInTheDocument()- expect(screen.getByText('runLog.detail')).toBeInTheDocument()- expect(screen.getByText('runLog.tracing')).toBeInTheDocument()+ expect(screen.getByText('runLog.result'))!.toBeInTheDocument()+ expect(screen.getByText('runLog.detail'))!.toBeInTheDocument()+ expect(screen.getByText('runLog.tracing'))!.toBeInTheDocument()})it('should render loading state for RESULT tab when running without outputs', () => {@@ -872,7 +870,7 @@ describe('Result', () => {render(<Result />)- expect(screen.getByText('pipeline.result.resultPreview.loading')).toBeInTheDocument()+ expect(screen.getByText('pipeline.result.resultPreview.loading'))!.toBeInTheDocument()})it('should render result preview when result has outputs', () => {@@ -887,7 +885,7 @@ describe('Result', () => {render(<Result />)- expect(screen.getByTestId('chunk-card-list')).toBeInTheDocument()+ expect(screen.getByTestId('chunk-card-list'))!.toBeInTheDocument()})})@@ -900,7 +898,7 @@ describe('Result', () => {fireEvent.click(screen.getByText('runLog.detail'))await waitFor(() => {- expect(screen.getByTestId('result-panel')).toBeInTheDocument()+ expect(screen.getByTestId('result-panel'))!.toBeInTheDocument()})})@@ -912,7 +910,7 @@ describe('Result', () => {fireEvent.click(screen.getByText('runLog.tracing'))await waitFor(() => {- expect(screen.getByTestId('tracing-panel')).toBeInTheDocument()+ expect(screen.getByTestId('tracing-panel'))!.toBeInTheDocument()})})@@ -929,12 +927,12 @@ describe('Result', () => {fireEvent.click(screen.getByText('runLog.detail'))await waitFor(() => {- expect(screen.getByTestId('result-panel')).toBeInTheDocument()+ expect(screen.getByTestId('result-panel'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('runLog.result'))await waitFor(() => {- expect(screen.getByTestId('chunk-card-list')).toBeInTheDocument()+ expect(screen.getByTestId('chunk-card-list'))!.toBeInTheDocument()})})})@@ -963,13 +961,13 @@ describe('Result', () => {await waitFor(() => {const resultPanel = screen.getByTestId('result-panel')- expect(resultPanel).toHaveAttribute('data-inputs', '{"key": "value"}')- expect(resultPanel).toHaveAttribute('data-outputs', '{"result": "success"}')- expect(resultPanel).toHaveAttribute('data-status', WorkflowRunningStatus.Succeeded)- expect(resultPanel).toHaveAttribute('data-elapsed-time', '1500')- expect(resultPanel).toHaveAttribute('data-total-tokens', '200')- expect(resultPanel).toHaveAttribute('data-steps', '10')- expect(resultPanel).toHaveAttribute('data-exception-counts', '2')+ expect(resultPanel)!.toHaveAttribute('data-inputs', '{"key": "value"}')+ expect(resultPanel)!.toHaveAttribute('data-outputs', '{"result": "success"}')+ expect(resultPanel)!.toHaveAttribute('data-status', WorkflowRunningStatus.Succeeded)+ expect(resultPanel)!.toHaveAttribute('data-elapsed-time', '1500')+ expect(resultPanel)!.toHaveAttribute('data-total-tokens', '200')+ expect(resultPanel)!.toHaveAttribute('data-steps', '10')+ expect(resultPanel)!.toHaveAttribute('data-exception-counts', '2')})})@@ -984,7 +982,7 @@ describe('Result', () => {fireEvent.click(screen.getByText('runLog.detail'))await waitFor(() => {- expect(screen.getByTestId('result-panel')).toBeInTheDocument()+ expect(screen.getByTestId('result-panel'))!.toBeInTheDocument()})})})@@ -999,8 +997,8 @@ describe('Result', () => {await waitFor(() => {const tracingPanel = screen.getByTestId('tracing-panel')- expect(tracingPanel).toHaveAttribute('data-list-length', '1')- expect(tracingPanel).toHaveAttribute('data-classname', 'bg-background-section-burn')+ expect(tracingPanel)!.toHaveAttribute('data-list-length', '1')+ expect(tracingPanel)!.toHaveAttribute('data-classname', 'bg-background-section-burn')})})@@ -1014,7 +1012,7 @@ describe('Result', () => {fireEvent.click(screen.getByText('runLog.tracing'))await waitFor(() => {- expect(screen.getByTestId('tracing-panel')).toBeInTheDocument()+ expect(screen.getByTestId('tracing-panel'))!.toBeInTheDocument()})})})@@ -1035,7 +1033,7 @@ describe('Result', () => {fireEvent.click(screen.getByText('pipeline.result.resultPreview.viewDetails'))await waitFor(() => {- expect(screen.getByTestId('result-panel')).toBeInTheDocument()+ expect(screen.getByTestId('result-panel'))!.toBeInTheDocument()})})})@@ -1048,7 +1046,7 @@ describe('Result', () => {const buttons = screen.getAllByRole('button')buttons.forEach((button) => {- expect(button).toBeDisabled()+ expect(button)!.toBeDisabled()})})@@ -1061,7 +1059,7 @@ describe('Result', () => {render(<Result />)- expect(screen.getByText('pipeline.result.resultPreview.loading')).toBeInTheDocument()+ expect(screen.getByText('pipeline.result.resultPreview.loading'))!.toBeInTheDocument()})it('should handle result with Running status', () => {@@ -1075,7 +1073,7 @@ describe('Result', () => {render(<Result />)- expect(screen.getByText('pipeline.result.resultPreview.loading')).toBeInTheDocument()+ expect(screen.getByText('pipeline.result.resultPreview.loading'))!.toBeInTheDocument()})it('should handle result with Stopped status', () => {@@ -1090,7 +1088,7 @@ describe('Result', () => {render(<Result />)- expect(screen.getByText('pipeline.result.resultPreview.error')).toBeInTheDocument()+ expect(screen.getByText('pipeline.result.resultPreview.error'))!.toBeInTheDocument()})})@@ -1103,12 +1101,12 @@ describe('Result', () => {fireEvent.click(screen.getByText('runLog.detail'))await waitFor(() => {- expect(screen.getByTestId('result-panel')).toBeInTheDocument()+ expect(screen.getByTestId('result-panel'))!.toBeInTheDocument()})rerender(<Result />)- expect(screen.getByTestId('result-panel')).toBeInTheDocument()+ expect(screen.getByTestId('result-panel'))!.toBeInTheDocument()})it('should render different states based on workflowRunningData', () => {@@ -1121,7 +1119,7 @@ describe('Result', () => {})const { unmount } = render(<Result />)- expect(screen.getByText('pipeline.result.resultPreview.loading')).toBeInTheDocument()+ expect(screen.getByText('pipeline.result.resultPreview.loading'))!.toBeInTheDocument()unmount()const outputs = createGeneralChunkOutputs(3)@@ -1134,7 +1132,7 @@ describe('Result', () => {})render(<Result />)- expect(screen.getByTestId('chunk-card-list')).toBeInTheDocument()+ expect(screen.getByTestId('chunk-card-list'))!.toBeInTheDocument()})})@@ -1146,7 +1144,7 @@ describe('Result', () => {rerender(<Result />)- expect(screen.getByText('runLog.result')).toBeInTheDocument()+ expect(screen.getByText('runLog.result'))!.toBeInTheDocument()})})})diff --git a/web/app/components/rag-pipeline/components/panel/test-run/result/result-preview/__tests__/index.spec.tsx b/web/app/components/rag-pipeline/components/panel/test-run/result/result-preview/__tests__/index.spec.tsxindex ac7d5254238..3a3c18eb44c 100644--- a/web/app/components/rag-pipeline/components/panel/test-run/result/result-preview/__tests__/index.spec.tsx+++ b/web/app/components/rag-pipeline/components/panel/test-run/result/result-preview/__tests__/index.spec.tsx@@ -119,8 +119,8 @@ describe('formatPreviewChunks', () => {const result = formatPreviewChunks(outputs) as GeneralChunksexpect(result).toHaveLength(20)- expect((result as GeneralChunks)[0].content).toBe('Chunk content 1')- expect((result as GeneralChunks)[19].content).toBe('Chunk content 20')+ expect((result as GeneralChunks)[0]!.content).toBe('Chunk content 1')+ expect((result as GeneralChunks)[19]!.content).toBe('Chunk content 20')})it('should handle empty preview array for general chunks', () => {@@ -167,7 +167,7 @@ describe('formatPreviewChunks', () => {const result = formatPreviewChunks(outputs) as GeneralChunks- expect((result as GeneralChunks)[0].content).toHaveLength(10000)+ expect((result as GeneralChunks)[0]!.content).toHaveLength(10000)})})@@ -210,7 +210,7 @@ describe('formatPreviewChunks', () => {const result = formatPreviewChunks(outputs) as ParentChildChunks- expect(result.parent_child_chunks[0].child_contents).toHaveLength(50)+ expect(result.parent_child_chunks[0]!.child_contents).toHaveLength(50)})it('should handle empty child_chunks in paragraph mode', () => {@@ -220,7 +220,7 @@ describe('formatPreviewChunks', () => {const result = formatPreviewChunks(outputs) as ParentChildChunks- expect(result.parent_child_chunks[0].child_contents).toEqual([])+ expect(result.parent_child_chunks[0]!.child_contents).toEqual([])})})@@ -234,8 +234,8 @@ describe('formatPreviewChunks', () => {expect(result.parent_mode).toBe('full-doc')expect(result.parent_child_chunks).toHaveLength(1)- expect(result.parent_child_chunks[0].parent_content).toBe('Full Doc Parent')- expect(result.parent_child_chunks[0].child_contents).toEqual(['Child 1', 'Child 2', 'Child 3'])+ expect(result.parent_child_chunks[0]!.parent_content).toBe('Full Doc Parent')+ expect(result.parent_child_chunks[0]!.child_contents).toEqual(['Child 1', 'Child 2', 'Child 3'])})it('should NOT limit parent chunks in full-doc mode', () => {@@ -253,9 +253,9 @@ describe('formatPreviewChunks', () => {const result = formatPreviewChunks(outputs) as ParentChildChunks- expect(result.parent_child_chunks[0].child_contents).toHaveLength(20)- expect(result.parent_child_chunks[0].child_contents[0]).toBe('Child 1')- expect(result.parent_child_chunks[0].child_contents[19]).toBe('Child 20')+ expect(result.parent_child_chunks[0]!.child_contents).toHaveLength(20)+ expect(result.parent_child_chunks[0]!.child_contents[0]).toBe('Child 1')+ expect(result.parent_child_chunks[0]!.child_contents[19]).toBe('Child 20')})it('should handle multiple parents with many children in full-doc mode', () => {@@ -266,8 +266,8 @@ describe('formatPreviewChunks', () => {const result = formatPreviewChunks(outputs) as ParentChildChunks- expect(result.parent_child_chunks[0].child_contents).toHaveLength(20)- expect(result.parent_child_chunks[1].child_contents).toHaveLength(20)+ expect(result.parent_child_chunks[0]!.child_contents).toHaveLength(20)+ expect(result.parent_child_chunks[1]!.child_contents).toHaveLength(20)})})@@ -324,10 +324,10 @@ describe('formatPreviewChunks', () => {const result = formatPreviewChunks(outputs) as QAChunks- expect(result.qa_chunks[0].question).toBe('')- expect(result.qa_chunks[0].answer).toBe('Answer without question')- expect(result.qa_chunks[1].question).toBe('Question without answer')- expect(result.qa_chunks[1].answer).toBe('')+ expect(result.qa_chunks[0]!.question).toBe('')+ expect(result.qa_chunks[0]!.answer).toBe('Answer without question')+ expect(result.qa_chunks[1]!.question).toBe('Question without answer')+ expect(result.qa_chunks[1]!.answer).toBe('')})it('should preserve all properties when spreading chunk', () => {@@ -406,27 +406,27 @@ describe('ResultPreview', () => {it('should render without crashing with minimal props', () => {render(<ResultPreview onSwitchToDetail={vi.fn()} />)- expect(document.body).toBeInTheDocument()+ expect(document.body)!.toBeInTheDocument()})it('should render loading state when isRunning and no outputs', () => {render(<ResultPreview {...defaultProps} isRunning={true} outputs={undefined} />)- expect(screen.getByText('pipeline.result.resultPreview.loading')).toBeInTheDocument()+ expect(screen.getByText('pipeline.result.resultPreview.loading'))!.toBeInTheDocument()})it('should render loading spinner icon when loading', () => {const { container } = render(<ResultPreview {...defaultProps} isRunning={true} outputs={undefined} />)const spinner = container.querySelector('.animate-spin')- expect(spinner).toBeInTheDocument()+ expect(spinner)!.toBeInTheDocument()})it('should render error state when not running and error exists', () => {render(<ResultPreview {...defaultProps} isRunning={false} error="Something went wrong" />)- expect(screen.getByText('pipeline.result.resultPreview.error')).toBeInTheDocument()- expect(screen.getByRole('button', { name: /pipeline\.result\.resultPreview\.viewDetails/i })).toBeInTheDocument()+ expect(screen.getByText('pipeline.result.resultPreview.error'))!.toBeInTheDocument()+ expect(screen.getByRole('button', { name: /pipeline\.result\.resultPreview\.viewDetails/i }))!.toBeInTheDocument()})it('should render outputs when available', () => {@@ -434,7 +434,7 @@ describe('ResultPreview', () => {render(<ResultPreview {...defaultProps} outputs={outputs} />)- expect(screen.getByTestId('chunk-card-list')).toBeInTheDocument()+ expect(screen.getByTestId('chunk-card-list'))!.toBeInTheDocument()})it('should render footer tip when outputs available', () => {@@ -442,7 +442,7 @@ describe('ResultPreview', () => {render(<ResultPreview {...defaultProps} outputs={outputs} />)- expect(screen.getByText(/pipeline\.result\.resultPreview\.footerTip/)).toBeInTheDocument()+ expect(screen.getByText(/pipeline\.result\.resultPreview\.footerTip/))!.toBeInTheDocument()})it('should not render loading when outputs exist even if isRunning', () => {@@ -451,13 +451,13 @@ describe('ResultPreview', () => {render(<ResultPreview {...defaultProps} isRunning={true} outputs={outputs} />)expect(screen.queryByText('pipeline.result.resultPreview.loading')).not.toBeInTheDocument()- expect(screen.getByTestId('chunk-card-list')).toBeInTheDocument()+ expect(screen.getByTestId('chunk-card-list'))!.toBeInTheDocument()})it('should not render error when isRunning is true', () => {render(<ResultPreview {...defaultProps} isRunning={true} error="Error message" outputs={undefined} />)- expect(screen.getByText('pipeline.result.resultPreview.loading')).toBeInTheDocument()+ expect(screen.getByText('pipeline.result.resultPreview.loading'))!.toBeInTheDocument()expect(screen.queryByText('pipeline.result.resultPreview.error')).not.toBeInTheDocument()})})@@ -467,7 +467,7 @@ describe('ResultPreview', () => {it('should show loading when isRunning=true and no outputs', () => {render(<ResultPreview {...defaultProps} isRunning={true} />)- expect(screen.getByText('pipeline.result.resultPreview.loading')).toBeInTheDocument()+ expect(screen.getByText('pipeline.result.resultPreview.loading'))!.toBeInTheDocument()})it('should not show loading when isRunning=false', () => {@@ -482,7 +482,7 @@ describe('ResultPreview', () => {render(<ResultPreview {...defaultProps} isRunning={true} outputs={outputs} />)expect(screen.queryByText('pipeline.result.resultPreview.loading')).not.toBeInTheDocument()- expect(screen.getByTestId('chunk-card-list')).toBeInTheDocument()+ expect(screen.getByTestId('chunk-card-list'))!.toBeInTheDocument()})})@@ -493,7 +493,7 @@ describe('ResultPreview', () => {render(<ResultPreview {...defaultProps} outputs={outputs} />)const chunkList = screen.getByTestId('chunk-card-list')- expect(chunkList).toHaveAttribute('data-chunk-type', ChunkingMode.text)+ expect(chunkList)!.toHaveAttribute('data-chunk-type', ChunkingMode.text)})it('should format and pass previewChunks to ChunkCardList', () => {@@ -520,7 +520,7 @@ describe('ResultPreview', () => {render(<ResultPreview {...defaultProps} outputs={outputs} />)const chunkList = screen.getByTestId('chunk-card-list')- expect(chunkList).toHaveAttribute('data-chunk-type', ChunkingMode.parentChild)+ expect(chunkList)!.toHaveAttribute('data-chunk-type', ChunkingMode.parentChild)})it('should handle QA outputs', () => {@@ -531,7 +531,7 @@ describe('ResultPreview', () => {render(<ResultPreview {...defaultProps} outputs={outputs} />)const chunkList = screen.getByTestId('chunk-card-list')- expect(chunkList).toHaveAttribute('data-chunk-type', ChunkingMode.qa)+ expect(chunkList)!.toHaveAttribute('data-chunk-type', ChunkingMode.qa)})})@@ -539,7 +539,7 @@ describe('ResultPreview', () => {it('should show error state when error is a non-empty string', () => {render(<ResultPreview {...defaultProps} error="Network error" />)- expect(screen.getByText('pipeline.result.resultPreview.error')).toBeInTheDocument()+ expect(screen.getByText('pipeline.result.resultPreview.error'))!.toBeInTheDocument()})it('should show error state when error is an empty string', () => {@@ -553,8 +553,8 @@ describe('ResultPreview', () => {render(<ResultPreview {...defaultProps} outputs={outputs} error="Error" />)- expect(screen.getByText('pipeline.result.resultPreview.error')).toBeInTheDocument()- expect(screen.getByTestId('chunk-card-list')).toBeInTheDocument()+ expect(screen.getByText('pipeline.result.resultPreview.error'))!.toBeInTheDocument()+ expect(screen.getByTestId('chunk-card-list'))!.toBeInTheDocument()})})@@ -584,7 +584,7 @@ describe('ResultPreview', () => {const { rerender } = render(<ResultPreview {...defaultProps} />)rerender(<ResultPreview {...defaultProps} />)- expect(document.body).toBeInTheDocument()+ expect(document.body)!.toBeInTheDocument()})it('should update when props change', () => {@@ -592,7 +592,7 @@ describe('ResultPreview', () => {rerender(<ResultPreview {...defaultProps} isRunning={true} />)- expect(screen.getByText('pipeline.result.resultPreview.loading')).toBeInTheDocument()+ expect(screen.getByText('pipeline.result.resultPreview.loading'))!.toBeInTheDocument()})it('should update when outputs change', () => {@@ -744,45 +744,45 @@ describe('ResultPreview', () => {describe('Integration', () => {it('should transition from loading to output state', () => {const { rerender } = render(<ResultPreview {...defaultProps} isRunning={true} />)- expect(screen.getByText('pipeline.result.resultPreview.loading')).toBeInTheDocument()+ expect(screen.getByText('pipeline.result.resultPreview.loading'))!.toBeInTheDocument()const outputs = createGeneralChunkOutputs([{ content: 'Loaded data' }])rerender(<ResultPreview {...defaultProps} isRunning={false} outputs={outputs} />)expect(screen.queryByText('pipeline.result.resultPreview.loading')).not.toBeInTheDocument()- expect(screen.getByTestId('chunk-card-list')).toBeInTheDocument()+ expect(screen.getByTestId('chunk-card-list'))!.toBeInTheDocument()})it('should transition from loading to error state', () => {const { rerender } = render(<ResultPreview {...defaultProps} isRunning={true} />)- expect(screen.getByText('pipeline.result.resultPreview.loading')).toBeInTheDocument()+ expect(screen.getByText('pipeline.result.resultPreview.loading'))!.toBeInTheDocument()rerender(<ResultPreview {...defaultProps} isRunning={false} error="Failed to load" />)expect(screen.queryByText('pipeline.result.resultPreview.loading')).not.toBeInTheDocument()- expect(screen.getByText('pipeline.result.resultPreview.error')).toBeInTheDocument()+ expect(screen.getByText('pipeline.result.resultPreview.error'))!.toBeInTheDocument()})it('should render both error and outputs when both props provided', () => {const { rerender } = render(<ResultPreview {...defaultProps} error="Initial error" />)- expect(screen.getByText('pipeline.result.resultPreview.error')).toBeInTheDocument()+ expect(screen.getByText('pipeline.result.resultPreview.error'))!.toBeInTheDocument()const outputs = createGeneralChunkOutputs([{ content: 'Success data' }])rerender(<ResultPreview {...defaultProps} error="Initial error" outputs={outputs} />)- expect(screen.getByText('pipeline.result.resultPreview.error')).toBeInTheDocument()- expect(screen.getByTestId('chunk-card-list')).toBeInTheDocument()+ expect(screen.getByText('pipeline.result.resultPreview.error'))!.toBeInTheDocument()+ expect(screen.getByTestId('chunk-card-list'))!.toBeInTheDocument()})it('should hide error when error prop is cleared', () => {const { rerender } = render(<ResultPreview {...defaultProps} error="Initial error" />)- expect(screen.getByText('pipeline.result.resultPreview.error')).toBeInTheDocument()+ expect(screen.getByText('pipeline.result.resultPreview.error'))!.toBeInTheDocument()const outputs = createGeneralChunkOutputs([{ content: 'Success data' }])rerender(<ResultPreview {...defaultProps} outputs={outputs} />)expect(screen.queryByText('pipeline.result.resultPreview.error')).not.toBeInTheDocument()- expect(screen.getByTestId('chunk-card-list')).toBeInTheDocument()+ expect(screen.getByTestId('chunk-card-list'))!.toBeInTheDocument()})it('should handle complete flow: empty -> loading -> outputs', () => {@@ -790,12 +790,12 @@ describe('ResultPreview', () => {expect(container.firstChild).toBeNull()rerender(<ResultPreview {...defaultProps} isRunning={true} />)- expect(screen.getByText('pipeline.result.resultPreview.loading')).toBeInTheDocument()+ expect(screen.getByText('pipeline.result.resultPreview.loading'))!.toBeInTheDocument()const outputs = createGeneralChunkOutputs([{ content: 'Final data' }])rerender(<ResultPreview {...defaultProps} isRunning={false} outputs={outputs} />)- expect(screen.getByTestId('chunk-card-list')).toBeInTheDocument()+ expect(screen.getByTestId('chunk-card-list'))!.toBeInTheDocument()})})@@ -804,14 +804,14 @@ describe('ResultPreview', () => {const { container } = render(<ResultPreview {...defaultProps} isRunning={true} />)const loadingContainer = container.querySelector('.flex.grow.flex-col.items-center.justify-center')- expect(loadingContainer).toBeInTheDocument()+ expect(loadingContainer)!.toBeInTheDocument()})it('should have correct container classes for error state', () => {const { container } = render(<ResultPreview {...defaultProps} error="Error" />)const errorContainer = container.querySelector('.flex.grow.flex-col.items-center.justify-center')- expect(errorContainer).toBeInTheDocument()+ expect(errorContainer)!.toBeInTheDocument()})it('should have correct container classes for outputs state', () => {@@ -820,7 +820,7 @@ describe('ResultPreview', () => {const { container } = render(<ResultPreview {...defaultProps} outputs={outputs} />)const outputContainer = container.querySelector('.flex.grow.flex-col.bg-background-body')- expect(outputContainer).toBeInTheDocument()+ expect(outputContainer)!.toBeInTheDocument()})it('should have gradient dividers in footer', () => {@@ -838,7 +838,7 @@ describe('ResultPreview', () => {render(<ResultPreview {...defaultProps} error="Error" />)const button = screen.getByRole('button')- expect(button).toBeInTheDocument()+ expect(button)!.toBeInTheDocument()})it('should have title attribute on footer tip for long text', () => {@@ -847,7 +847,7 @@ describe('ResultPreview', () => {const { container } = render(<ResultPreview {...defaultProps} outputs={outputs} />)const footerTip = container.querySelector('[title]')- expect(footerTip).toBeInTheDocument()+ expect(footerTip)!.toBeInTheDocument()})})})@@ -884,17 +884,17 @@ describe('State Transition Matrix', () => {expect(container.firstChild).toBeNull()breakcase 'loading':- expect(screen.getByText('pipeline.result.resultPreview.loading')).toBeInTheDocument()+ expect(screen.getByText('pipeline.result.resultPreview.loading'))!.toBeInTheDocument()breakcase 'error':- expect(screen.getByText('pipeline.result.resultPreview.error')).toBeInTheDocument()+ expect(screen.getByText('pipeline.result.resultPreview.error'))!.toBeInTheDocument()breakcase 'outputs':- expect(screen.getByTestId('chunk-card-list')).toBeInTheDocument()+ expect(screen.getByTestId('chunk-card-list'))!.toBeInTheDocument()breakcase 'both':- expect(screen.getByText('pipeline.result.resultPreview.error')).toBeInTheDocument()- expect(screen.getByTestId('chunk-card-list')).toBeInTheDocument()+ expect(screen.getByText('pipeline.result.resultPreview.error'))!.toBeInTheDocument()+ expect(screen.getByTestId('chunk-card-list'))!.toBeInTheDocument()break}},diff --git a/web/app/components/rag-pipeline/components/rag-pipeline-header/__tests__/index.spec.tsx b/web/app/components/rag-pipeline/components/rag-pipeline-header/__tests__/index.spec.tsxindex 9ba034ebf88..b9c0de5f50e 100644--- a/web/app/components/rag-pipeline/components/rag-pipeline-header/__tests__/index.spec.tsx+++ b/web/app/components/rag-pipeline/components/rag-pipeline-header/__tests__/index.spec.tsx@@ -246,18 +246,18 @@ describe('RagPipelineHeader', () => {describe('Rendering', () => {it('should render without crashing', () => {render(<RagPipelineHeader />)- expect(screen.getByTestId('workflow-header')).toBeInTheDocument()+ expect(screen.getByTestId('workflow-header'))!.toBeInTheDocument()})it('should render InputFieldButton in left slot', () => {render(<RagPipelineHeader />)- expect(screen.getByTestId('header-left')).toBeInTheDocument()- expect(screen.getByText(/inputField/i)).toBeInTheDocument()+ expect(screen.getByTestId('header-left'))!.toBeInTheDocument()+ expect(screen.getByText(/inputField/i))!.toBeInTheDocument()})it('should render Publisher in middle slot', () => {render(<RagPipelineHeader />)- expect(screen.getByTestId('header-middle')).toBeInTheDocument()+ expect(screen.getByTestId('header-middle'))!.toBeInTheDocument()})it('should pass correct viewHistoryProps with pipelineId', () => {@@ -299,14 +299,14 @@ describe('InputFieldButton', () => {describe('Rendering', () => {it('should render button with correct text', () => {render(<InputFieldButton />)- expect(screen.getByRole('button')).toBeInTheDocument()- expect(screen.getByText(/inputField/i)).toBeInTheDocument()+ expect(screen.getByRole('button'))!.toBeInTheDocument()+ expect(screen.getByText(/inputField/i))!.toBeInTheDocument()})it('should render with secondary variant style', () => {render(<InputFieldButton />)const button = screen.getByRole('button')- expect(button).toHaveClass('flex', 'gap-x-0.5')+ expect(button)!.toHaveClass('flex', 'gap-x-0.5')})})@@ -357,19 +357,19 @@ describe('Publisher', () => {describe('Rendering', () => {it('should render publish button', () => {render(<Publisher />)- expect(screen.getByRole('button')).toBeInTheDocument()- expect(screen.getByText(/workflow.common.publish/i)).toBeInTheDocument()+ expect(screen.getByRole('button'))!.toBeInTheDocument()+ expect(screen.getByText(/workflow.common.publish/i))!.toBeInTheDocument()})it('should render with primary variant', () => {render(<Publisher />)const button = screen.getByRole('button')- expect(button).toHaveClass('px-2')+ expect(button)!.toHaveClass('px-2')})it('should render portal trigger element', () => {render(<Publisher />)- expect(screen.getByTestId('portal-trigger')).toBeInTheDocument()+ expect(screen.getByTestId('portal-trigger'))!.toBeInTheDocument()})})@@ -386,7 +386,7 @@ describe('Publisher', () => {render(<Publisher />)const portal = screen.getByTestId('portal-elem')- expect(portal).toHaveAttribute('data-open', 'false')+ expect(portal)!.toHaveAttribute('data-open', 'false')fireEvent.click(screen.getByTestId('portal-trigger'))@@ -409,7 +409,7 @@ describe('Popup', () => {describe('Rendering', () => {it('should render popup container', () => {render(<Popup />)- expect(screen.getByText(/workflow.common.publishUpdate/i)).toBeInTheDocument()+ expect(screen.getByText(/workflow.common.publishUpdate/i))!.toBeInTheDocument()})it('should show unpublished state when publishedAt is 0', () => {@@ -417,7 +417,7 @@ describe('Popup', () => {render(<Popup />)- expect(screen.getByText(/workflow.common.currentDraftUnpublished/i)).toBeInTheDocument()+ expect(screen.getByText(/workflow.common.currentDraftUnpublished/i))!.toBeInTheDocument()})it('should show published state when publishedAt is set', () => {@@ -425,33 +425,33 @@ describe('Popup', () => {render(<Popup />)- expect(screen.getByText(/workflow.common.latestPublished/i)).toBeInTheDocument()+ expect(screen.getByText(/workflow.common.latestPublished/i))!.toBeInTheDocument()})it('should render keyboard shortcuts', () => {render(<Popup />)- expect(screen.getByText('ctrl')).toBeInTheDocument()- expect(screen.getByText('⇧')).toBeInTheDocument()- expect(screen.getByText('P')).toBeInTheDocument()+ expect(screen.getByText('ctrl'))!.toBeInTheDocument()+ expect(screen.getByText('⇧'))!.toBeInTheDocument()+ expect(screen.getByText('P'))!.toBeInTheDocument()})it('should render goToAddDocuments button', () => {render(<Popup />)- expect(screen.getByText(/pipeline.common.goToAddDocuments/i)).toBeInTheDocument()+ expect(screen.getByText(/pipeline.common.goToAddDocuments/i))!.toBeInTheDocument()})it('should render API reference link', () => {render(<Popup />)- expect(screen.getByText(/workflow.common.accessAPIReference/i)).toBeInTheDocument()+ expect(screen.getByText(/workflow.common.accessAPIReference/i))!.toBeInTheDocument()})it('should render publish as template button', () => {render(<Popup />)- expect(screen.getByText(/pipeline.common.publishAs/i)).toBeInTheDocument()+ expect(screen.getByText(/pipeline.common.publishAs/i))!.toBeInTheDocument()})})@@ -462,7 +462,7 @@ describe('Popup', () => {render(<Popup />)const button = screen.getByText(/pipeline.common.goToAddDocuments/i).closest('button')- expect(button).toBeDisabled()+ expect(button)!.toBeDisabled()})it('should enable goToAddDocuments when published', () => {@@ -480,7 +480,7 @@ describe('Popup', () => {render(<Popup />)const button = screen.getByText(/pipeline.common.publishAs/i).closest('button')- expect(button).toBeDisabled()+ expect(button)!.toBeDisabled()})})@@ -492,7 +492,7 @@ describe('Popup', () => {render(<Popup />)- expect(screen.getByText(/billing.upgradeBtn.encourageShort/i)).toBeInTheDocument()+ expect(screen.getByText(/billing.upgradeBtn.encourageShort/i))!.toBeInTheDocument()})it('should not show premium badge when allowed to publish as template', () => {@@ -551,7 +551,7 @@ describe('Popup', () => {render(<Popup />)- expect(screen.getByText(/workflow.common.autoSaved/i)).toBeInTheDocument()+ expect(screen.getByText(/workflow.common.autoSaved/i))!.toBeInTheDocument()})it('should show published time when published', () => {@@ -559,7 +559,7 @@ describe('Popup', () => {render(<Popup />)- expect(screen.getByText(/workflow.common.publishedAt/i)).toBeInTheDocument()+ expect(screen.getByText(/workflow.common.publishedAt/i))!.toBeInTheDocument()})})})@@ -576,21 +576,21 @@ describe('RunMode', () => {it('should render run button with default text', () => {render(<RunMode />)- expect(screen.getByRole('button')).toBeInTheDocument()- expect(screen.getByText(/pipeline.common.testRun/i)).toBeInTheDocument()+ expect(screen.getByRole('button'))!.toBeInTheDocument()+ expect(screen.getByText(/pipeline.common.testRun/i))!.toBeInTheDocument()})it('should render with custom text prop', () => {render(<RunMode text="Custom Run" />)- expect(screen.getByText('Custom Run')).toBeInTheDocument()+ expect(screen.getByText('Custom Run'))!.toBeInTheDocument()})it('should render keyboard shortcuts when not disabled', () => {render(<RunMode />)- expect(screen.getByText('alt')).toBeInTheDocument()- expect(screen.getByText('R')).toBeInTheDocument()+ expect(screen.getByText('alt'))!.toBeInTheDocument()+ expect(screen.getByText('R'))!.toBeInTheDocument()})})@@ -603,7 +603,7 @@ describe('RunMode', () => {render(<RunMode />)- expect(screen.getByText(/pipeline.common.processing/i)).toBeInTheDocument()+ expect(screen.getByText(/pipeline.common.processing/i))!.toBeInTheDocument()})it('should show stop button when running', () => {@@ -626,7 +626,7 @@ describe('RunMode', () => {render(<RunMode />)- expect(screen.getByText(/pipeline.common.reRun/i)).toBeInTheDocument()+ expect(screen.getByText(/pipeline.common.reRun/i))!.toBeInTheDocument()})it('should show preparing data source state', () => {@@ -634,7 +634,7 @@ describe('RunMode', () => {render(<RunMode />)- expect(screen.getByText(/pipeline.common.preparingDataSource/i)).toBeInTheDocument()+ expect(screen.getByText(/pipeline.common.preparingDataSource/i))!.toBeInTheDocument()})it('should show cancel button when preparing data source', () => {@@ -654,7 +654,7 @@ describe('RunMode', () => {render(<RunMode />)- expect(screen.getByText(/pipeline.common.reRun/i)).toBeInTheDocument()+ expect(screen.getByText(/pipeline.common.reRun/i))!.toBeInTheDocument()})it('should show reRun text when workflow status is Stopped', () => {@@ -665,7 +665,7 @@ describe('RunMode', () => {render(<RunMode />)- expect(screen.getByText(/pipeline.common.reRun/i)).toBeInTheDocument()+ expect(screen.getByText(/pipeline.common.reRun/i))!.toBeInTheDocument()})it('should show reRun text when workflow status is Waiting', () => {@@ -676,7 +676,7 @@ describe('RunMode', () => {render(<RunMode />)- expect(screen.getByText(/pipeline.common.reRun/i)).toBeInTheDocument()+ expect(screen.getByText(/pipeline.common.reRun/i))!.toBeInTheDocument()})it('should not show stop button when status is not Running', () => {@@ -726,7 +726,7 @@ describe('RunMode', () => {render(<RunMode />)const runButton = screen.getAllByRole('button')[0]- expect(runButton).toBeDisabled()+ expect(runButton)!.toBeDisabled()})it('should be disabled when preparing data source', () => {@@ -735,7 +735,7 @@ describe('RunMode', () => {render(<RunMode />)const runButton = screen.getAllByRole('button')[0]- expect(runButton).toBeDisabled()+ expect(runButton)!.toBeDisabled()})it('should not show keyboard shortcuts when disabled', () => {@@ -768,7 +768,7 @@ describe('RunMode', () => {render(<RunMode />)const buttons = screen.getAllByRole('button')- fireEvent.click(buttons[1])+ fireEvent.click(buttons[1]!)expect(mockHandleStopRun).toHaveBeenCalledWith('task-123')})@@ -779,7 +779,7 @@ describe('RunMode', () => {render(<RunMode />)const buttons = screen.getAllByRole('button')- fireEvent.click(buttons[1])+ fireEvent.click(buttons[1]!)expect(mockSetIsPreparingDataSource).toHaveBeenCalledWith(false)expect(mockSetShowDebugAndPreviewPanel).toHaveBeenCalledWith(false)@@ -794,7 +794,7 @@ describe('RunMode', () => {render(<RunMode />)const buttons = screen.getAllByRole('button')- fireEvent.click(buttons[1]) // Click stop button+ fireEvent.click(buttons[1]!) // Click stop buttonexpect(mockHandleStopRun).toHaveBeenCalledWith('')})@@ -808,7 +808,7 @@ describe('RunMode', () => {render(<RunMode />)const runButton = screen.getAllByRole('button')[0]- fireEvent.click(runButton)+ fireEvent.click(runButton!)expect(mockHandleWorkflowStartRunInWorkflow).not.toHaveBeenCalled()})@@ -879,7 +879,7 @@ describe('RunMode', () => {render(<RunMode />)const button = screen.getByRole('button')- expect(button).toHaveClass('rounded-md')+ expect(button)!.toHaveClass('rounded-md')})it('should have rounded-l-md class when disabled', () => {@@ -891,7 +891,7 @@ describe('RunMode', () => {render(<RunMode />)const runButton = screen.getAllByRole('button')[0]- expect(runButton).toHaveClass('rounded-l-md')+ expect(runButton)!.toHaveClass('rounded-l-md')})it('should have cursor-not-allowed when disabled', () => {@@ -900,7 +900,7 @@ describe('RunMode', () => {render(<RunMode />)const runButton = screen.getAllByRole('button')[0]- expect(runButton).toHaveClass('cursor-not-allowed')+ expect(runButton)!.toHaveClass('cursor-not-allowed')})it('should have bg-state-accent-hover when disabled', () => {@@ -909,7 +909,7 @@ describe('RunMode', () => {render(<RunMode />)const runButton = screen.getAllByRole('button')[0]- expect(runButton).toHaveClass('bg-state-accent-hover')+ expect(runButton)!.toHaveClass('bg-state-accent-hover')})it('should have bg-state-accent-active on stop button', () => {@@ -921,7 +921,7 @@ describe('RunMode', () => {render(<RunMode />)const stopButton = screen.getAllByRole('button')[1]- expect(stopButton).toHaveClass('bg-state-accent-active')+ expect(stopButton)!.toHaveClass('bg-state-accent-active')})it('should have rounded-r-md on stop button', () => {@@ -933,7 +933,7 @@ describe('RunMode', () => {render(<RunMode />)const stopButton = screen.getAllByRole('button')[1]- expect(stopButton).toHaveClass('rounded-r-md')+ expect(stopButton)!.toHaveClass('rounded-r-md')})it('should have size-7 on stop button', () => {@@ -945,26 +945,26 @@ describe('RunMode', () => {render(<RunMode />)const stopButton = screen.getAllByRole('button')[1]- expect(stopButton).toHaveClass('size-7')+ expect(stopButton)!.toHaveClass('size-7')})it('should have correct base classes on run button', () => {render(<RunMode />)const runButton = screen.getByRole('button')- expect(runButton).toHaveClass('system-xs-medium')- expect(runButton).toHaveClass('h-7')- expect(runButton).toHaveClass('px-1.5')- expect(runButton).toHaveClass('text-text-accent')+ expect(runButton)!.toHaveClass('system-xs-medium')+ expect(runButton)!.toHaveClass('h-7')+ expect(runButton)!.toHaveClass('px-1.5')+ expect(runButton)!.toHaveClass('text-text-accent')})it('should have gap-x-px on container', () => {const { container } = render(<RunMode />)const wrapper = container.firstChild as HTMLElement- expect(wrapper).toHaveClass('gap-x-px')- expect(wrapper).toHaveClass('flex')- expect(wrapper).toHaveClass('items-center')+ expect(wrapper)!.toHaveClass('gap-x-px')+ expect(wrapper)!.toHaveClass('flex')+ expect(wrapper)!.toHaveClass('items-center')})})@@ -994,9 +994,9 @@ describe('Integration', () => {it('should render all child components in RagPipelineHeader', () => {render(<RagPipelineHeader />)- expect(screen.getByText(/inputField/i)).toBeInTheDocument()+ expect(screen.getByText(/inputField/i))!.toBeInTheDocument()- expect(screen.getByTestId('header-middle')).toBeInTheDocument()+ expect(screen.getByTestId('header-middle'))!.toBeInTheDocument()})it('should pass correct history URL based on pipelineId', () => {@@ -1020,7 +1020,7 @@ describe('Edge Cases', () => {render(<RunMode />)- expect(screen.getByText(/pipeline.common.testRun/i)).toBeInTheDocument()+ expect(screen.getByText(/pipeline.common.testRun/i))!.toBeInTheDocument()})it('should handle empty pipelineId', () => {@@ -1058,7 +1058,7 @@ describe('Edge Cases', () => {render(<RunMode />)const runButton = screen.getAllByRole('button')[0]- expect(runButton).toBeDisabled()+ expect(runButton)!.toBeDisabled()})it('should show testRun text when workflowRunningData is null', () => {@@ -1078,7 +1078,7 @@ describe('Edge Cases', () => {render(<RunMode text="Start Pipeline" />)- expect(screen.getByText('Start Pipeline')).toBeInTheDocument()+ expect(screen.getByText('Start Pipeline'))!.toBeInTheDocument()})it('should show reRun instead of custom text when workflowRunningData exists', () => {@@ -1101,8 +1101,8 @@ describe('Edge Cases', () => {render(<RunMode />)- expect(screen.getByText('alt')).toBeInTheDocument()- expect(screen.getByText('R')).toBeInTheDocument()+ expect(screen.getByText('alt'))!.toBeInTheDocument()+ expect(screen.getByText('R'))!.toBeInTheDocument()})it('should have correct structure with play icon when not disabled', () => {@@ -1112,7 +1112,7 @@ describe('Edge Cases', () => {render(<RunMode />)const button = screen.getByRole('button')- expect(button.querySelector('svg')).toBeInTheDocument()+ expect(button.querySelector('svg'))!.toBeInTheDocument()})it('should have correct structure with loader icon when running', () => {@@ -1124,8 +1124,8 @@ describe('Edge Cases', () => {render(<RunMode />)const runButton = screen.getAllByRole('button')[0]- const spinningIcon = runButton.querySelector('.animate-spin')- expect(spinningIcon).toBeInTheDocument()+ const spinningIcon = runButton!.querySelector('.animate-spin')+ expect(spinningIcon)!.toBeInTheDocument()})it('should have correct structure with database icon when preparing data source', () => {@@ -1134,7 +1134,7 @@ describe('Edge Cases', () => {render(<RunMode />)const runButton = screen.getAllByRole('button')[0]- expect(runButton.querySelector('svg')).toBeInTheDocument()+ expect(runButton!.querySelector('svg'))!.toBeInTheDocument()})})@@ -1145,7 +1145,7 @@ describe('Edge Cases', () => {render(<Popup />)- expect(screen.getByText(/workflow.common.autoSaved/i)).toBeInTheDocument()+ expect(screen.getByText(/workflow.common.autoSaved/i))!.toBeInTheDocument()})it('should handle very old publishedAt timestamp', () => {@@ -1153,7 +1153,7 @@ describe('Edge Cases', () => {render(<Popup />)- expect(screen.getByText(/workflow.common.latestPublished/i)).toBeInTheDocument()+ expect(screen.getByText(/workflow.common.latestPublished/i))!.toBeInTheDocument()})})})diff --git a/web/app/components/rag-pipeline/hooks/__tests__/index.spec.ts b/web/app/components/rag-pipeline/hooks/__tests__/index.spec.tsindex 136f0bfc620..a83c44faf4e 100644--- a/web/app/components/rag-pipeline/hooks/__tests__/index.spec.ts+++ b/web/app/components/rag-pipeline/hooks/__tests__/index.spec.ts@@ -388,12 +388,12 @@ describe('useConfigurations', () => {const { result } = renderHook(() => useConfigurations(variables))expect(result.current.length).toBe(1)- expect(result.current[0].variable).toBe('textVar')- expect(result.current[0].label).toBe('Text Label')- expect(result.current[0].required).toBe(true)- expect(result.current[0].maxLength).toBe(100)- expect(result.current[0].placeholder).toBe('Enter text')- expect(result.current[0].tooltip).toBe('Help text')+ expect(result.current[0]!.variable).toBe('textVar')+ expect(result.current[0]!.label).toBe('Text Label')+ expect(result.current[0]!.required).toBe(true)+ expect(result.current[0]!.maxLength).toBe(100)+ expect(result.current[0]!.placeholder).toBe('Enter text')+ expect(result.current[0]!.tooltip).toBe('Help text')})it('should transform options correctly', () => {@@ -410,7 +410,7 @@ describe('useConfigurations', () => {const { result } = renderHook(() => useConfigurations(variables))- expect(result.current[0].options).toEqual([+ expect(result.current[0]!.options).toEqual([{ label: 'option1', value: 'option1' },{ label: 'option2', value: 'option2' },{ label: 'option3', value: 'option3' },diff --git a/web/app/components/rag-pipeline/hooks/__tests__/use-input-fields.spec.ts b/web/app/components/rag-pipeline/hooks/__tests__/use-input-fields.spec.tsindex ad6f97a2f4d..c81f2302522 100644--- a/web/app/components/rag-pipeline/hooks/__tests__/use-input-fields.spec.ts+++ b/web/app/components/rag-pipeline/hooks/__tests__/use-input-fields.spec.ts@@ -154,7 +154,7 @@ describe('useConfigurations', () => {] as unknown as RAGPipelineVariablesconst { result } = renderHook(() => useConfigurations(variables))- expect(result.current[0].options).toEqual([+ expect(result.current[0]!.options).toEqual([{ label: 'red', value: 'red' },{ label: 'green', value: 'green' },{ label: 'blue', value: 'blue' },@@ -167,7 +167,7 @@ describe('useConfigurations', () => {] as unknown as RAGPipelineVariablesconst { result } = renderHook(() => useConfigurations(variables))- expect(result.current[0].options).toBeUndefined()+ expect(result.current[0]!.options).toBeUndefined()})it('should include file-related fields for file type', () => {@@ -182,9 +182,9 @@ describe('useConfigurations', () => {] as unknown as RAGPipelineVariablesconst { result } = renderHook(() => useConfigurations(variables))- expect(result.current[0].allowedFileTypes).toEqual(['pdf', 'docx'])- expect(result.current[0].allowedFileExtensions).toEqual(['.pdf', '.docx'])- expect(result.current[0].allowedFileUploadMethods).toEqual(['local', 'remote'])+ expect(result.current[0]!.allowedFileTypes).toEqual(['pdf', 'docx'])+ expect(result.current[0]!.allowedFileExtensions).toEqual(['.pdf', '.docx'])+ expect(result.current[0]!.allowedFileUploadMethods).toEqual(['local', 'remote'])})it('should include showConditions as empty array', () => {@@ -193,7 +193,7 @@ describe('useConfigurations', () => {] as unknown as RAGPipelineVariablesconst { result } = renderHook(() => useConfigurations(variables))- expect(result.current[0].showConditions).toEqual([])+ expect(result.current[0]!.showConditions).toEqual([])})it('should handle multiple variables', () => {@@ -205,9 +205,9 @@ describe('useConfigurations', () => {const { result } = renderHook(() => useConfigurations(variables))expect(result.current).toHaveLength(3)- expect(result.current[0].variable).toBe('a')- expect(result.current[1].variable).toBe('b')- expect(result.current[2].variable).toBe('c')+ expect(result.current[0]!.variable).toBe('a')+ expect(result.current[1]!.variable).toBe('b')+ expect(result.current[2]!.variable).toBe('c')})it('should include unit field', () => {@@ -216,6 +216,6 @@ describe('useConfigurations', () => {] as unknown as RAGPipelineVariablesconst { result } = renderHook(() => useConfigurations(variables))- expect(result.current[0].unit).toBe('px')+ expect(result.current[0]!.unit).toBe('px')})})diff --git a/web/app/components/rag-pipeline/hooks/__tests__/use-nodes-sync-draft.spec.ts b/web/app/components/rag-pipeline/hooks/__tests__/use-nodes-sync-draft.spec.tsindex 6d807565d9d..0f68a8ea4f4 100644--- a/web/app/components/rag-pipeline/hooks/__tests__/use-nodes-sync-draft.spec.ts+++ b/web/app/components/rag-pipeline/hooks/__tests__/use-nodes-sync-draft.spec.ts@@ -198,7 +198,7 @@ describe('useNodesSyncDraft', () => {})expect(mockPostWithKeepalive).toHaveBeenCalled()- const sentParams = mockPostWithKeepalive.mock.calls[0][1]+ const sentParams = mockPostWithKeepalive.mock.calls[0]![1]expect(sentParams.graph.nodes[0].data._privateData).toBeUndefined()})})@@ -390,7 +390,7 @@ describe('useNodesSyncDraft', () => {result.current.syncWorkflowDraftWhenPageClose()})- const sentParams = mockPostWithKeepalive.mock.calls[0][1]+ const sentParams = mockPostWithKeepalive.mock.calls[0]![1]expect(sentParams.graph.viewport).toEqual({ x: 100, y: 200, zoom: 1.5 })})@@ -413,7 +413,7 @@ describe('useNodesSyncDraft', () => {result.current.syncWorkflowDraftWhenPageClose()})- const sentParams = mockPostWithKeepalive.mock.calls[0][1]+ const sentParams = mockPostWithKeepalive.mock.calls[0]![1]expect(sentParams.environment_variables).toEqual([{ key: 'API_KEY', value: 'secret' }])})@@ -436,7 +436,7 @@ describe('useNodesSyncDraft', () => {result.current.syncWorkflowDraftWhenPageClose()})- const sentParams = mockPostWithKeepalive.mock.calls[0][1]+ const sentParams = mockPostWithKeepalive.mock.calls[0]![1]expect(sentParams.rag_pipeline_variables).toEqual([{ variable: 'input', type: 'text-input' }])})@@ -451,7 +451,7 @@ describe('useNodesSyncDraft', () => {result.current.syncWorkflowDraftWhenPageClose()})- const sentParams = mockPostWithKeepalive.mock.calls[0][1]+ const sentParams = mockPostWithKeepalive.mock.calls[0]![1]expect(sentParams.source_workflow_id).toBeUndefined()})@@ -471,7 +471,7 @@ describe('useNodesSyncDraft', () => {result.current.syncWorkflowDraftWhenPageClose()})- const sentParams = mockPostWithKeepalive.mock.calls[0][1]+ const sentParams = mockPostWithKeepalive.mock.calls[0]![1]expect(sentParams.graph.edges[0].data._hidden).toBeUndefined()expect(sentParams.graph.edges[0].data.visible).toBe(false)})diff --git a/web/app/components/rag-pipeline/hooks/__tests__/use-pipeline-config.spec.ts b/web/app/components/rag-pipeline/hooks/__tests__/use-pipeline-config.spec.tsindex 0b2c68bf68a..412fd299d16 100644--- a/web/app/components/rag-pipeline/hooks/__tests__/use-pipeline-config.spec.ts+++ b/web/app/components/rag-pipeline/hooks/__tests__/use-pipeline-config.spec.ts@@ -223,7 +223,7 @@ describe('usePipelineConfig', () => {capturedCallback?.(dataSourceList)- expect(dataSourceList[0].declaration.identity.icon).toBe('/base/icon.png')+ expect(dataSourceList[0]!.declaration.identity.icon).toBe('/base/icon.png')})it('should not modify icon if it already includes basePath', () => {@@ -240,7 +240,7 @@ describe('usePipelineConfig', () => {capturedCallback?.(dataSourceList)- expect(dataSourceList[0].declaration.identity.icon).toBe('/base/icon.png')+ expect(dataSourceList[0]!.declaration.identity.icon).toBe('/base/icon.png')})it('should handle non-string icon', () => {@@ -257,7 +257,7 @@ describe('usePipelineConfig', () => {capturedCallback?.(dataSourceList)- expect(dataSourceList[0].declaration.identity.icon).toEqual({ url: '/icon.png' })+ expect(dataSourceList[0]!.declaration.identity.icon).toEqual({ url: '/icon.png' })})})diff --git a/web/app/components/rag-pipeline/hooks/__tests__/use-pipeline-template.spec.ts b/web/app/components/rag-pipeline/hooks/__tests__/use-pipeline-template.spec.tsindex 1214ea84c0d..58ee6425007 100644--- a/web/app/components/rag-pipeline/hooks/__tests__/use-pipeline-template.spec.ts+++ b/web/app/components/rag-pipeline/hooks/__tests__/use-pipeline-template.spec.ts@@ -25,7 +25,7 @@ describe('usePipelineTemplate', () => {const { result } = renderHook(() => usePipelineTemplate())expect(result.current.nodes).toHaveLength(1)- expect(result.current.nodes[0].id).toBe('knowledgeBase')+ expect(result.current.nodes[0]!.id).toBe('knowledgeBase')})it('should return empty edges array', () => {@@ -37,25 +37,25 @@ describe('usePipelineTemplate', () => {it('should set node type from knowledge-base default', () => {const { result } = renderHook(() => usePipelineTemplate())- expect(result.current.nodes[0].data.type).toBe('knowledge-base')+ expect(result.current.nodes[0]!.data.type).toBe('knowledge-base')})it('should set node as selected', () => {const { result } = renderHook(() => usePipelineTemplate())- expect(result.current.nodes[0].data.selected).toBe(true)+ expect(result.current.nodes[0]!.data.selected).toBe(true)})it('should position node offset from START_INITIAL_POSITION', () => {const { result } = renderHook(() => usePipelineTemplate())- expect(result.current.nodes[0].position.x).toBe(600)- expect(result.current.nodes[0].position.y).toBe(200)+ expect(result.current.nodes[0]!.position.x).toBe(600)+ expect(result.current.nodes[0]!.position.y).toBe(200)})it('should translate node title', () => {const { result } = renderHook(() => usePipelineTemplate())- expect(result.current.nodes[0].data.title).toBe('workflow.blocks.knowledge-base')+ expect(result.current.nodes[0]!.data.title).toBe('workflow.blocks.knowledge-base')})})diff --git a/web/app/components/rag-pipeline/hooks/__tests__/use-pipeline.spec.ts b/web/app/components/rag-pipeline/hooks/__tests__/use-pipeline.spec.tsindex bca23fa6020..80a9d5b7c63 100644--- a/web/app/components/rag-pipeline/hooks/__tests__/use-pipeline.spec.ts+++ b/web/app/components/rag-pipeline/hooks/__tests__/use-pipeline.spec.ts@@ -213,7 +213,7 @@ describe('usePipeline', () => {)})- const setNodesArg = mockSetNodes.mock.calls[0][0]+ const setNodesArg = mockSetNodes.mock.calls[0]![0]expect(setNodesArg).toContain(dsNode)expect(setNodesArg).toContain(updatedNode2)expect(setNodesArg).toContain(node3)@@ -277,7 +277,7 @@ describe('usePipeline', () => {const isUsed = result.current.isVarUsedInNodes(['rag', 'ds-1', 'var1'])expect(isUsed).toBe(true)- const nodesArg = mockFindUsedVarNodes.mock.calls[0][1] as Array<{ id: string }>+ const nodesArg = mockFindUsedVarNodes.mock.calls[0]![1] as Array<{ id: string }>const nodeIds = nodesArg.map(n => n.id)expect(nodeIds).toContain('ds-1')expect(nodeIds).toContain('node-2')@@ -312,7 +312,7 @@ describe('usePipeline', () => {result.current.isVarUsedInNodes(['rag', 'ds-1', 'var1'])- const nodesArg = mockFindUsedVarNodes.mock.calls[0][1] as Array<{ id: string }>+ const nodesArg = mockFindUsedVarNodes.mock.calls[0]![1] as Array<{ id: string }>const nodeIds = nodesArg.map(n => n.id)const uniqueIds = [...new Set(nodeIds)]expect(nodeIds.length).toBe(uniqueIds.length)diff --git a/web/app/components/rag-pipeline/hooks/__tests__/use-rag-pipeline-search.spec.tsx b/web/app/components/rag-pipeline/hooks/__tests__/use-rag-pipeline-search.spec.tsxindex a06d1ba334b..b49960c5a4c 100644--- a/web/app/components/rag-pipeline/hooks/__tests__/use-rag-pipeline-search.spec.tsx+++ b/web/app/components/rag-pipeline/hooks/__tests__/use-rag-pipeline-search.spec.tsx@@ -129,7 +129,7 @@ describe('useRagPipelineSearch', () => {const results = searchFn('GPT')expect(results.length).toBeGreaterThan(0)- expect(results[0].title).toBe('GPT Model')+ expect(results[0]!.title).toBe('GPT Model')})it('should find nodes by type', () => {@@ -176,7 +176,7 @@ describe('useRagPipelineSearch', () => {const searchFn = mockRagPipelineNodesAction.searchFn!const results = searchFn('Search')- expect(results[0].title).toBe('Web Search')+ expect(results[0]!.title).toBe('Web Search')})it('should return empty array when no nodes match', () => {@@ -215,7 +215,7 @@ describe('useRagPipelineSearch', () => {const searchFn = mockRagPipelineNodesAction.searchFn!const results = searchFn('Start')- expect(results[0].type).toBe('workflow-node')+ expect(results[0]!.type).toBe('workflow-node')})})})diff --git a/web/app/components/rag-pipeline/hooks/use-pipeline.tsx b/web/app/components/rag-pipeline/hooks/use-pipeline.tsxindex c84bba660d2..8cca8f63eac 100644--- a/web/app/components/rag-pipeline/hooks/use-pipeline.tsx+++ b/web/app/components/rag-pipeline/hooks/use-pipeline.tsx@@ -72,7 +72,7 @@ export const usePipeline = () => {const isVarUsedInNodes = useCallback((varSelector: ValueSelector) => {const nodeId = varSelector[1] // Assuming the first element is always 'VARIABLE_PREFIX'(rag)- const afterNodes = getAllNodesInSameBranch(nodeId)+ const afterNodes = getAllNodesInSameBranch(nodeId!)const effectNodes = findUsedVarNodes(varSelector, afterNodes)return effectNodes.length > 0}, [getAllNodesInSameBranch])@@ -95,7 +95,7 @@ export const usePipeline = () => {const removeUsedVarInNodes = useCallback((varSelector: ValueSelector) => {const nodeId = varSelector[1] // Assuming the first element is always 'VARIABLE_PREFIX'(rag)const { getNodes, setNodes } = store.getState()- const afterNodes = getAllNodesInSameBranch(nodeId)+ const afterNodes = getAllNodesInSameBranch(nodeId!)const effectNodes = findUsedVarNodes(varSelector, afterNodes)if (effectNodes.length > 0) {const newNodes = getNodes().map((node) => {diff --git a/web/app/components/rag-pipeline/store/__tests__/index.spec.ts b/web/app/components/rag-pipeline/store/__tests__/index.spec.tsindex c978332a717..18d1da45974 100644--- a/web/app/components/rag-pipeline/store/__tests__/index.spec.ts+++ b/web/app/components/rag-pipeline/store/__tests__/index.spec.ts@@ -89,7 +89,7 @@ describe('createRagPipelineSliceSlice', () => {expect(mockSet).toHaveBeenCalledWith(expect.any(Function))- const setterFn = mockSet.mock.calls[0][0] as () => Partial<RagPipelineSliceShape>+ const setterFn = mockSet.mock.calls[0]![0] as () => Partial<RagPipelineSliceShape>const result = setterFn()expect(result).toEqual({ showInputFieldPanel: true })})@@ -100,7 +100,7 @@ describe('createRagPipelineSliceSlice', () => {slice.setShowInputFieldPanel(false)- const setterFn = mockSet.mock.calls[0][0] as () => Partial<RagPipelineSliceShape>+ const setterFn = mockSet.mock.calls[0]![0] as () => Partial<RagPipelineSliceShape>const result = setterFn()expect(result).toEqual({ showInputFieldPanel: false })})@@ -113,7 +113,7 @@ describe('createRagPipelineSliceSlice', () => {slice.setShowInputFieldPreviewPanel(true)- const setterFn = mockSet.mock.calls[0][0] as () => Partial<RagPipelineSliceShape>+ const setterFn = mockSet.mock.calls[0]![0] as () => Partial<RagPipelineSliceShape>const result = setterFn()expect(result).toEqual({ showInputFieldPreviewPanel: true })})@@ -124,7 +124,7 @@ describe('createRagPipelineSliceSlice', () => {slice.setShowInputFieldPreviewPanel(false)- const setterFn = mockSet.mock.calls[0][0] as () => Partial<RagPipelineSliceShape>+ const setterFn = mockSet.mock.calls[0]![0] as () => Partial<RagPipelineSliceShape>const result = setterFn()expect(result).toEqual({ showInputFieldPreviewPanel: false })})@@ -138,7 +138,7 @@ describe('createRagPipelineSliceSlice', () => {slice.setInputFieldEditPanelProps(props)- const setterFn = mockSet.mock.calls[0][0] as () => Partial<RagPipelineSliceShape>+ const setterFn = mockSet.mock.calls[0]![0] as () => Partial<RagPipelineSliceShape>const result = setterFn()expect(result).toEqual({ inputFieldEditPanelProps: props })})@@ -149,7 +149,7 @@ describe('createRagPipelineSliceSlice', () => {slice.setInputFieldEditPanelProps(null)- const setterFn = mockSet.mock.calls[0][0] as () => Partial<RagPipelineSliceShape>+ const setterFn = mockSet.mock.calls[0]![0] as () => Partial<RagPipelineSliceShape>const result = setterFn()expect(result).toEqual({ inputFieldEditPanelProps: null })})@@ -163,7 +163,7 @@ describe('createRagPipelineSliceSlice', () => {slice.setNodesDefaultConfigs(configs)- const setterFn = mockSet.mock.calls[0][0] as () => Partial<RagPipelineSliceShape>+ const setterFn = mockSet.mock.calls[0]![0] as () => Partial<RagPipelineSliceShape>const result = setterFn()expect(result).toEqual({ nodesDefaultConfigs: configs })})@@ -174,7 +174,7 @@ describe('createRagPipelineSliceSlice', () => {slice.setNodesDefaultConfigs({})- const setterFn = mockSet.mock.calls[0][0] as () => Partial<RagPipelineSliceShape>+ const setterFn = mockSet.mock.calls[0]![0] as () => Partial<RagPipelineSliceShape>const result = setterFn()expect(result).toEqual({ nodesDefaultConfigs: {} })})@@ -190,7 +190,7 @@ describe('createRagPipelineSliceSlice', () => {slice.setRagPipelineVariables(variables)- const setterFn = mockSet.mock.calls[0][0] as () => Partial<RagPipelineSliceShape>+ const setterFn = mockSet.mock.calls[0]![0] as () => Partial<RagPipelineSliceShape>const result = setterFn()expect(result).toEqual({ ragPipelineVariables: variables })})@@ -201,7 +201,7 @@ describe('createRagPipelineSliceSlice', () => {slice.setRagPipelineVariables([])- const setterFn = mockSet.mock.calls[0][0] as () => Partial<RagPipelineSliceShape>+ const setterFn = mockSet.mock.calls[0]![0] as () => Partial<RagPipelineSliceShape>const result = setterFn()expect(result).toEqual({ ragPipelineVariables: [] })})@@ -218,7 +218,7 @@ describe('createRagPipelineSliceSlice', () => {slice.setDataSourceList(dataSourceList)- const setterFn = mockSet.mock.calls[0][0] as () => Partial<RagPipelineSliceShape>+ const setterFn = mockSet.mock.calls[0]![0] as () => Partial<RagPipelineSliceShape>const result = setterFn()expect(result.dataSourceList).toHaveLength(2)expect(result.dataSourceList![0]).toEqual({ name: 'source1', key: 'key1', transformed: true })@@ -231,7 +231,7 @@ describe('createRagPipelineSliceSlice', () => {slice.setDataSourceList([])- const setterFn = mockSet.mock.calls[0][0] as () => Partial<RagPipelineSliceShape>+ const setterFn = mockSet.mock.calls[0]![0] as () => Partial<RagPipelineSliceShape>const result = setterFn()expect(result.dataSourceList).toEqual([])})@@ -244,7 +244,7 @@ describe('createRagPipelineSliceSlice', () => {slice.setIsPreparingDataSource(true)- const setterFn = mockSet.mock.calls[0][0] as () => Partial<RagPipelineSliceShape>+ const setterFn = mockSet.mock.calls[0]![0] as () => Partial<RagPipelineSliceShape>const result = setterFn()expect(result).toEqual({ isPreparingDataSource: true })})@@ -255,7 +255,7 @@ describe('createRagPipelineSliceSlice', () => {slice.setIsPreparingDataSource(false)- const setterFn = mockSet.mock.calls[0][0] as () => Partial<RagPipelineSliceShape>+ const setterFn = mockSet.mock.calls[0]![0] as () => Partial<RagPipelineSliceShape>const result = setterFn()expect(result).toEqual({ isPreparingDataSource: false })})diff --git a/web/app/components/rag-pipeline/utils/__tests__/index.spec.ts b/web/app/components/rag-pipeline/utils/__tests__/index.spec.tsindex 787cc018b9f..3136c614434 100644--- a/web/app/components/rag-pipeline/utils/__tests__/index.spec.ts+++ b/web/app/components/rag-pipeline/utils/__tests__/index.spec.ts@@ -90,8 +90,8 @@ describe('processNodesWithoutDataSource', () => {const result = processNodesWithoutDataSource(nodes, viewport)expect(result.nodes.length).toBe(3)- expect(result.nodes[0].id).toBe('data-source-empty')- expect(result.nodes[1].id).toBe('note')+ expect(result.nodes[0]!.id).toBe('data-source-empty')+ expect(result.nodes[1]!.id).toBe('note')expect(result.nodes[2]).toBe(nodes[0])})@@ -120,8 +120,8 @@ describe('processNodesWithoutDataSource', () => {const result = processNodesWithoutDataSource(nodes, viewport)- expect(result.nodes[0].position.x).toBe(-200)- expect(result.nodes[0].position.y).toBe(100)+ expect(result.nodes[0]!.position.x).toBe(-200)+ expect(result.nodes[0]!.position.y).toBe(100)})it('should adjust viewport based on new node position', () => {@@ -195,8 +195,8 @@ describe('processNodesWithoutDataSource', () => {const noteNode = result.nodes[1]// Note node should be 100px below data source empty node- expect(noteNode.position.x).toBe(dataSourceEmptyNode.position.x)- expect(noteNode.position.y).toBe(dataSourceEmptyNode.position.y + 100)+ expect(noteNode!.position.x).toBe(dataSourceEmptyNode!.position.x)+ expect(noteNode!.position.y).toBe(dataSourceEmptyNode!.position.y + 100)})it('should set correct data for data source empty node', () => {@@ -211,9 +211,9 @@ describe('processNodesWithoutDataSource', () => {const result = processNodesWithoutDataSource(nodes)- expect(result.nodes[0].data.type).toBe(BlockEnum.DataSourceEmpty)- expect(result.nodes[0].data._isTempNode).toBe(true)- expect(result.nodes[0].data.width).toBe(240)+ expect(result.nodes[0]!.data.type).toBe(BlockEnum.DataSourceEmpty)+ expect(result.nodes[0]!.data._isTempNode).toBe(true)+ expect(result.nodes[0]!.data.width).toBe(240)})it('should set correct data for note node', () => {@@ -229,7 +229,7 @@ describe('processNodesWithoutDataSource', () => {const result = processNodesWithoutDataSource(nodes)const noteNode = result.nodes[1]- const noteData = noteNode.data as Record<string, unknown>+ const noteData = noteNode!.data as Record<string, unknown>expect(noteData._isTempNode).toBe(true)expect(noteData.theme).toBe('blue')expect(noteData.width).toBe(240)@@ -303,8 +303,8 @@ describe('processNodesWithoutDataSource', () => {const result = processNodesWithoutDataSource(nodes)- expect(result.nodes[0].position.x).toBe(-500)- expect(result.nodes[0].position.y).toBe(-50)+ expect(result.nodes[0]!.position.x).toBe(-500)+ expect(result.nodes[0]!.position.y).toBe(-50)})it('should handle undefined viewport gracefully', () => {diff --git a/web/app/components/rag-pipeline/utils/nodes.ts b/web/app/components/rag-pipeline/utils/nodes.tsindex 001c14dd3cc..00c3d831b8b 100644--- a/web/app/components/rag-pipeline/utils/nodes.ts+++ b/web/app/components/rag-pipeline/utils/nodes.ts@@ -17,17 +17,17 @@ export const processNodesWithoutDataSource = (nodes: Node[], viewport?: Viewportfor (let i = 0; i < nodes.length; i++) {const node = nodes[i]- if (node.data.type === BlockEnum.DataSource) {+ if (node!.data.type === BlockEnum.DataSource) {return {nodes,viewport,}}- if (node.type === CUSTOM_NODE && !leftNode)+ if (node!.type === CUSTOM_NODE && !leftNode)leftNode = node- if (node.type === CUSTOM_NODE && leftNode && node.position.x < leftNode.position.x)+ if (node!.type === CUSTOM_NODE && leftNode && node!.position.x < leftNode.position.x)leftNode = node}diff --git a/web/app/components/share/text-generation/__tests__/text-generation-result-panel.spec.tsx b/web/app/components/share/text-generation/__tests__/text-generation-result-panel.spec.tsxindex 60c109feec1..e0d361eefb3 100644--- a/web/app/components/share/text-generation/__tests__/text-generation-result-panel.spec.tsx+++ b/web/app/components/share/text-generation/__tests__/text-generation-result-panel.spec.tsx@@ -50,12 +50,12 @@ const batchTasks = [id: 1,status: TaskStatus.completed,params: { inputs: { name: 'Alpha' } },- },+ }!,{id: 2,status: TaskStatus.failed,params: { inputs: { name: 'Beta' } },- },+ }!,]const baseProps = {@@ -68,7 +68,7 @@ const baseProps = {controlRetry: 88,controlSend: 77,controlStopResponding: 66,- exportRes: [{ 'Name': 'Alpha', 'share.generation.completionResult': 'Done' }],+ exportRes: [{ 'Name': 'Alpha', 'share.generation.completionResult': 'Done' }!],handleCompleted: vi.fn(),handleRetryAllFailedTask: vi.fn(),handleSaveMessage: vi.fn(async () => {}),@@ -99,7 +99,7 @@ describe('TextGenerationResultPanel', () => {it('should render a single result in run-once mode and pass non-batch props', () => {render(<TextGenerationResultPanel {...baseProps} />)- expect(screen.getByTestId('res-single')).toBeInTheDocument()+ expect(screen.getByTestId('res-single'))!.toBeInTheDocument()expect(resPropsSpy).toHaveBeenCalledWith(expect.objectContaining({appId: 'app-123',appSourceType: AppSourceType.webApp,@@ -121,16 +121,16 @@ describe('TextGenerationResultPanel', () => {render(<TextGenerationResultPanel{...baseProps}- allFailedTaskList={[batchTasks[1]]}- allSuccessTaskList={[batchTasks[0]]}+ allFailedTaskList={[batchTasks[1]!]}+ allSuccessTaskList={[batchTasks[0]!]}isCallBatchAPInoPendingTask={false}handleRetryAllFailedTask={handleRetryAllFailedTask}/>,)- expect(screen.getByTestId('res-1')).toBeInTheDocument()- expect(screen.getByTestId('res-2')).toBeInTheDocument()+ expect(screen.getByTestId('res-1'))!.toBeInTheDocument()+ expect(screen.getByTestId('res-2'))!.toBeInTheDocument()expect(resPropsSpy).toHaveBeenNthCalledWith(1, expect.objectContaining({inputs: { name: 'Alpha' },isError: false,@@ -144,15 +144,15 @@ describe('TextGenerationResultPanel', () => {controlRetry: 88,taskId: 2,}))- expect(screen.getByText('share.generation.executions:{"num":2}')).toBeInTheDocument()- expect(screen.getByTestId('res-download-mock')).toBeInTheDocument()+ expect(screen.getByText('share.generation.executions:{"num":2}'))!.toBeInTheDocument()+ expect(screen.getByTestId('res-download-mock'))!.toBeInTheDocument()expect(resDownloadPropsSpy).toHaveBeenCalledWith(expect.objectContaining({isMobile: false,values: baseProps.exportRes,}))- expect(screen.getByText('share.generation.batchFailed.info:{"num":1}')).toBeInTheDocument()- expect(screen.getByText('share.generation.batchFailed.retry')).toBeInTheDocument()- expect(screen.getByRole('status', { name: 'appApi.loading' })).toBeInTheDocument()+ expect(screen.getByText('share.generation.batchFailed.info:{"num":1}'))!.toBeInTheDocument()+ expect(screen.getByText('share.generation.batchFailed.retry'))!.toBeInTheDocument()+ expect(screen.getByRole('status', { name: 'appApi.loading' }))!.toBeInTheDocument()fireEvent.click(screen.getByText('share.generation.batchFailed.retry'))expect(handleRetryAllFailedTask).toHaveBeenCalledTimes(1)diff --git a/web/app/components/share/text-generation/hooks/use-text-generation-batch.ts b/web/app/components/share/text-generation/hooks/use-text-generation-batch.tsindex 65ef4d775ad..a0259f33db9 100644--- a/web/app/components/share/text-generation/hooks/use-text-generation-batch.ts+++ b/web/app/components/share/text-generation/hooks/use-text-generation-batch.ts@@ -61,7 +61,7 @@ export const useTextGenerationBatch = ({if (!isMapVarName)return- if (item.name !== headerData[index])+ if (item.name !== headerData![index])isMapVarName = false})@@ -81,7 +81,7 @@ export const useTextGenerationBatch = ({.map(item => payloadData.indexOf(item))if (emptyLineIndexes.length > 0) {let hasMiddleEmptyLine = false- let startIndex = emptyLineIndexes[0] - 1+ let startIndex = emptyLineIndexes[0]! - 1emptyLineIndexes.forEach((index) => {if (hasMiddleEmptyLine)returndiff --git a/web/app/components/share/text-generation/result/__tests__/workflow-stream-handlers.spec.ts b/web/app/components/share/text-generation/result/__tests__/workflow-stream-handlers.spec.tsindex 45d5ded3026..63c0f43de06 100644--- a/web/app/components/share/text-generation/result/__tests__/workflow-stream-handlers.spec.ts+++ b/web/app/components/share/text-generation/result/__tests__/workflow-stream-handlers.spec.ts@@ -192,8 +192,8 @@ describe('workflow-stream-handlers helpers', () => {markNodesStopped(stoppedWorkflow.tracing)expect(stoppedWorkflow.status).toBe(WorkflowRunningStatus.Stopped)- expect(stoppedWorkflow.tracing[0].status).toBe(NodeRunningStatus.Stopped)- expect(stoppedWorkflow.tracing[0].details?.[0][0].status).toBe(NodeRunningStatus.Stopped)+ expect(stoppedWorkflow.tracing[0]!.status).toBe(NodeRunningStatus.Stopped)+ expect(stoppedWorkflow.tracing[0]!.details?.[0]![0]!.status).toBe(NodeRunningStatus.Stopped)})it('should cover unmatched and replacement helper branches', () => {@@ -291,7 +291,7 @@ describe('workflow-stream-handlers helpers', () => {markNodesStopped(undefined)- expect(parallelMatched.tracing[0].details).toHaveLength(2)+ expect(parallelMatched.tracing[0]!.details).toHaveLength(2)expect(notFinished).toEqual(expect.objectContaining({expand: true,tracing: process.tracing,@@ -311,7 +311,7 @@ describe('workflow-stream-handlers helpers', () => {}))expect(succeededWorkflow.status).toBe(WorkflowRunningStatus.Succeeded)expect(outputlessWorkflow.files).toEqual([])- expect(updatedHumanInput.humanInputFormDataList?.[0].expiration_time).toBe(300)+ expect(updatedHumanInput.humanInputFormDataList?.[0]!.expiration_time).toBe(300)expect(appendedHumanInput.humanInputFormDataList).toHaveLength(2)expect(noListFilled.humanInputFilledFormDataList).toHaveLength(1)expect(appendedFilled.humanInputFilledFormDataList).toHaveLength(2)@@ -319,7 +319,7 @@ describe('workflow-stream-handlers helpers', () => {status: WorkflowRunningStatus.Running,tracing: [],}))- expect(timeoutWithMatch.humanInputFormDataList?.[0].expiration_time).toBe(400)+ expect(timeoutWithMatch.humanInputFormDataList?.[0]!.expiration_time).toBe(400)})})@@ -717,7 +717,7 @@ describe('createWorkflowStreamHandlers', () => {})expect(existingProcess.status).toBe(WorkflowRunningStatus.Stopped)- expect(existingProcess.tracing[0].status).toBe(NodeRunningStatus.Stopped)+ expect(existingProcess.tracing[0]!.status).toBe(NodeRunningStatus.Stopped)expect(setup.onCompleted).toHaveBeenCalledWith('', 5, false)const noOutputSetup = setupHandlers()diff --git a/web/app/components/share/text-generation/result/result-request.ts b/web/app/components/share/text-generation/result/result-request.tsindex 95b2353dff1..aa26b75eee1 100644--- a/web/app/components/share/text-generation/result/result-request.ts+++ b/web/app/components/share/text-generation/result/result-request.ts@@ -132,7 +132,7 @@ export const buildResultRequestData = ({promptConfig?.prompt_variables.forEach((variable) => {const value = processedInputs[variable.key]if (variable.type === 'file' && value && typeof value === 'object' && !Array.isArray(value)) {- processedInputs[variable.key] = getProcessedFiles([value as FileEntity])[0]+ processedInputs[variable.key] = getProcessedFiles([value as FileEntity])[0]!return}diff --git a/web/app/components/share/text-generation/result/workflow-stream-handlers.ts b/web/app/components/share/text-generation/result/workflow-stream-handlers.tsindex 48b132587ee..f7db4c6b248 100644--- a/web/app/components/share/text-generation/result/workflow-stream-handlers.ts+++ b/web/app/components/share/text-generation/result/workflow-stream-handlers.ts@@ -118,8 +118,8 @@ const finishWorkflowNode = (current: WorkflowProcess | undefined, data: NodeTracconst currentIndex = draft.tracing.findIndex(trace => matchParallelTrace(trace, data))if (currentIndex > -1) {draft.tracing[currentIndex] = {- ...(draft.tracing[currentIndex].extras- ? { extras: draft.tracing[currentIndex].extras }+ ...(draft.tracing[currentIndex]!.extras+ ? { extras: draft.tracing[currentIndex]!.extras }: {}),...data,expand: !!data.error,@@ -195,7 +195,7 @@ const updateHumanInputRequired = (const currentIndex = draft.tracing.findIndex(item => item.node_id === data.node_id)if (currentIndex > -1)- draft.tracing[currentIndex].status = NodeRunningStatus.Paused+ draft.tracing[currentIndex]!.status = NodeRunningStatus.Paused})}@@ -227,7 +227,7 @@ const updateHumanInputTimeout = (const currentFormIndex = draft.humanInputFormDataList.findIndex(item => item.node_id === data.node_id)if (currentFormIndex > -1)- draft.humanInputFormDataList[currentFormIndex].expiration_time = data.expiration_time+ draft.humanInputFormDataList[currentFormIndex]!.expiration_time = data.expiration_time})}@@ -354,10 +354,10 @@ export const createWorkflowStreamHandlers = ({setCompletionRes(serializedOutputs)if (data.outputs) {const outputKeys = Object.keys(data.outputs)- const isStringOutput = outputKeys.length === 1 && typeof data.outputs[outputKeys[0]] === 'string'+ const isStringOutput = outputKeys.length === 1 && typeof data.outputs[outputKeys[0]!] === 'string'if (isStringOutput) {setWorkflowProcessData(updateWorkflowProcess(getWorkflowProcessData(), (draft) => {- draft.resultText = data.outputs[outputKeys[0]]+ draft.resultText = data.outputs[outputKeys[0]!]}))}}diff --git a/web/app/components/share/text-generation/run-batch/csv-download/__tests__/index.spec.tsx b/web/app/components/share/text-generation/run-batch/csv-download/__tests__/index.spec.tsxindex 6a9bb217970..c622278bc22 100644--- a/web/app/components/share/text-generation/run-batch/csv-download/__tests__/index.spec.tsx+++ b/web/app/components/share/text-generation/run-batch/csv-download/__tests__/index.spec.tsx@@ -29,10 +29,10 @@ describe('CSVDownload', () => {it('should render table headers and sample row for each variable', () => {render(<CSVDownload vars={vars} />)- expect(screen.getByText('share.generation.csvStructureTitle')).toBeInTheDocument()- expect(screen.getAllByRole('row')[0].children).toHaveLength(2)- expect(screen.getByText('prompt share.generation.field')).toBeInTheDocument()- expect(screen.getByText('context share.generation.field')).toBeInTheDocument()+ expect(screen.getByText('share.generation.csvStructureTitle'))!.toBeInTheDocument()+ expect(screen.getAllByRole('row')[0]!.children).toHaveLength(2)+ expect(screen.getByText('prompt share.generation.field'))!.toBeInTheDocument()+ expect(screen.getByText('context share.generation.field'))!.toBeInTheDocument()})it('should configure CSV downloader with template data', () => {@@ -44,6 +44,6 @@ describe('CSVDownload', () => {expect(capturedProps?.data).toEqual([{ prompt: '', context: '' },])- expect(screen.getByText('share.generation.downloadTemplate')).toBeInTheDocument()+ expect(screen.getByText('share.generation.downloadTemplate'))!.toBeInTheDocument()})})diff --git a/web/app/components/share/text-generation/run-once/__tests__/index.spec.tsx b/web/app/components/share/text-generation/run-once/__tests__/index.spec.tsxindex 65043ce0c20..628bf9bd85c 100644--- a/web/app/components/share/text-generation/run-once/__tests__/index.spec.tsx+++ b/web/app/components/share/text-generation/run-once/__tests__/index.spec.tsx@@ -161,7 +161,7 @@ describe('RunOnce', () => {expect(onVisionFilesChange).toHaveBeenCalledWith([])})- expect(screen.getByText('common.imageUploader.imageUpload')).toBeInTheDocument()+ expect(screen.getByText('common.imageUploader.imageUpload'))!.toBeInTheDocument()})it('should update inputs when user edits fields', async () => {@@ -187,7 +187,7 @@ describe('RunOnce', () => {expect(checkbox).toBeTruthy()fireEvent.click(checkbox as HTMLElement)- const latest = onInputsChange.mock.calls[onInputsChange.mock.calls.length - 1][0]+ const latest = onInputsChange.mock.calls[onInputsChange.mock.calls.length - 1]![0]expect(latest).toEqual({textInput: 'new text',paragraphInput: 'paragraph value',@@ -248,7 +248,7 @@ describe('RunOnce', () => {expect(onInputsChange).toHaveBeenCalled()})const stopButton = screen.getByTestId('stop-button')- expect(stopButton).toBeDisabled()+ expect(stopButton)!.toBeDisabled()})describe('select input type', () => {@@ -271,7 +271,7 @@ describe('RunOnce', () => {selectInput: 'Option A',})})- expect(screen.getByText('Select Input')).toBeInTheDocument()+ expect(screen.getByText('Select Input'))!.toBeInTheDocument()})})@@ -293,7 +293,7 @@ describe('RunOnce', () => {fileInput: undefined,})})- expect(screen.getByText('File Input')).toBeInTheDocument()+ expect(screen.getByText('File Input'))!.toBeInTheDocument()})it('should render file uploader for file-list input', async () => {@@ -313,7 +313,7 @@ describe('RunOnce', () => {fileListInput: [],})})- expect(screen.getByText('File List Input')).toBeInTheDocument()+ expect(screen.getByText('File List Input'))!.toBeInTheDocument()})})@@ -336,8 +336,8 @@ describe('RunOnce', () => {jsonInput: undefined,})})- expect(screen.getByText('JSON Input')).toBeInTheDocument()- expect(screen.getByTestId('code-editor-mock')).toBeInTheDocument()+ expect(screen.getByText('JSON Input'))!.toBeInTheDocument()+ expect(screen.getByTestId('code-editor-mock'))!.toBeInTheDocument()})it('should update json_object input when code editor changes', async () => {@@ -391,7 +391,7 @@ describe('RunOnce', () => {expect(onInputsChange).toHaveBeenCalled()})expect(screen.queryByText('Hidden Input')).not.toBeInTheDocument()- expect(screen.getByText('Visible Input')).toBeInTheDocument()+ expect(screen.getByText('Visible Input'))!.toBeInTheDocument()})it('should show optional label for non-required fields', async () => {@@ -410,7 +410,7 @@ describe('RunOnce', () => {await waitFor(() => {expect(onInputsChange).toHaveBeenCalled()})- expect(screen.getByText('workflow.panel.optional')).toBeInTheDocument()+ expect(screen.getByText('workflow.panel.optional'))!.toBeInTheDocument()})})@@ -489,7 +489,7 @@ describe('RunOnce', () => {expect(onInputsChange).toHaveBeenCalled()})const input = screen.getByPlaceholderText('Text Input')- expect(input).toHaveAttribute('maxLength', '100')+ expect(input)!.toHaveAttribute('maxLength', '100')})})})diff --git a/web/app/components/tools/edit-custom-collection-modal/__tests__/index.spec.tsx b/web/app/components/tools/edit-custom-collection-modal/__tests__/index.spec.tsxindex 7cd1c8cd534..1ab1bc428c7 100644--- a/web/app/components/tools/edit-custom-collection-modal/__tests__/index.spec.tsx+++ b/web/app/components/tools/edit-custom-collection-modal/__tests__/index.spec.tsx@@ -120,7 +120,7 @@ describe('EditCustomCollectionModal', () => {it('should render add mode title when no payload', () => {renderModal()- expect(screen.getByText('tools.createTool.title')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.title'))!.toBeInTheDocument()})it('should show error when provider name is missing', async () => {@@ -232,13 +232,13 @@ describe('EditCustomCollectionModal', () => {it('should render edit mode title when payload is provided', () => {renderModal({ payload: editPayload })- expect(screen.getByText('tools.createTool.editTitle')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.editTitle'))!.toBeInTheDocument()})it('should show delete button in edit mode', () => {renderModal({ payload: editPayload })- expect(screen.getByText('common.operation.delete')).toBeInTheDocument()+ expect(screen.getByText('common.operation.delete'))!.toBeInTheDocument()})it('should call onRemove when delete button is clicked', () => {@@ -272,22 +272,22 @@ describe('EditCustomCollectionModal', () => {renderModal({ payload: editPayload })const providerInput = screen.getByPlaceholderText('tools.createTool.toolNamePlaceHolder')- expect(providerInput).toHaveValue('existing-provider')+ expect(providerInput)!.toHaveValue('existing-provider')})it('should display existing schema', () => {renderModal({ payload: editPayload })const schemaInput = screen.getByPlaceholderText('tools.createTool.schemaPlaceHolder')- expect(schemaInput).toHaveValue('{"openapi": "3.0.0"}')+ expect(schemaInput)!.toHaveValue('{"openapi": "3.0.0"}')})it('should display available tools table', () => {renderModal({ payload: editPayload })- expect(screen.getByText('getUsers')).toBeInTheDocument()- expect(screen.getByText('Get all users')).toBeInTheDocument()- expect(screen.getByText('GET')).toBeInTheDocument()+ expect(screen.getByText('getUsers'))!.toBeInTheDocument()+ expect(screen.getByText('Get all users'))!.toBeInTheDocument()+ expect(screen.getByText('GET'))!.toBeInTheDocument()})it('should strip credential fields when auth_type is none on save', async () => {@@ -314,7 +314,7 @@ describe('EditCustomCollectionModal', () => {},}))// These fields should NOT be present- const callArg = mockOnEdit.mock.calls[0][0]+ const callArg = mockOnEdit.mock.calls[0]![0]expect(callArg.credentials.api_key_header).toBeUndefined()expect(callArg.credentials.api_key_header_prefix).toBeUndefined()expect(callArg.credentials.api_key_value).toBeUndefined()@@ -346,7 +346,7 @@ describe('EditCustomCollectionModal', () => {})await waitFor(() => {- expect(screen.getByText('newOp')).toBeInTheDocument()+ expect(screen.getByText('newOp'))!.toBeInTheDocument()})})@@ -363,7 +363,8 @@ describe('EditCustomCollectionModal', () => {})// The table should still be visible but empty (no tools)- expect(screen.getByText('tools.createTool.availableTools.title')).toBeInTheDocument()+ // The table should still be visible but empty (no tools)+ expect(screen.getByText('tools.createTool.availableTools.title'))!.toBeInTheDocument()})it('should not parse schema when empty', async () => {@@ -388,14 +389,15 @@ describe('EditCustomCollectionModal', () => {// The name input should be presentconst nameInput = screen.getByPlaceholderText('tools.createTool.toolNamePlaceHolder')- expect(nameInput).toBeInTheDocument()+ expect(nameInput)!.toBeInTheDocument()})it('should render name input section', () => {renderModal()// Name label should be present- expect(screen.getByText('tools.createTool.name')).toBeInTheDocument()+ // Name label should be present+ expect(screen.getByText('tools.createTool.name'))!.toBeInTheDocument()})})@@ -404,14 +406,15 @@ describe('EditCustomCollectionModal', () => {it('should show auth method section title', () => {renderModal()- expect(screen.getByText('tools.createTool.authMethod.title')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.authMethod.title'))!.toBeInTheDocument()})it('should display current auth type', () => {renderModal()// The default auth type is 'none'- expect(screen.getByText('tools.createTool.authMethod.types.none')).toBeInTheDocument()+ // The default auth type is 'none'+ expect(screen.getByText('tools.createTool.authMethod.types.none'))!.toBeInTheDocument()})})@@ -437,15 +440,15 @@ describe('EditCustomCollectionModal', () => {// Find the test buttonconst testButton = screen.getByText('tools.createTool.availableTools.test')- expect(testButton).toBeInTheDocument()+ expect(testButton)!.toBeInTheDocument()})it('should display tool information in the table', () => {renderModal({ payload: payloadWithTools })- expect(screen.getByText('testOp')).toBeInTheDocument()- expect(screen.getByText('Test operation')).toBeInTheDocument()- expect(screen.getByText('POST')).toBeInTheDocument()+ expect(screen.getByText('testOp'))!.toBeInTheDocument()+ expect(screen.getByText('Test operation'))!.toBeInTheDocument()+ expect(screen.getByText('POST'))!.toBeInTheDocument()})})@@ -457,7 +460,7 @@ describe('EditCustomCollectionModal', () => {const privacyInput = screen.getByPlaceholderText('tools.createTool.privacyPolicyPlaceholder')fireEvent.change(privacyInput, { target: { value: 'https://example.com/privacy' } })- expect(privacyInput).toHaveValue('https://example.com/privacy')+ expect(privacyInput)!.toHaveValue('https://example.com/privacy')})it('should update custom disclaimer input', () => {@@ -466,7 +469,7 @@ describe('EditCustomCollectionModal', () => {const disclaimerInput = screen.getByPlaceholderText('tools.createTool.customDisclaimerPlaceholder')fireEvent.change(disclaimerInput, { target: { value: 'Custom disclaimer text' } })- expect(disclaimerInput).toHaveValue('Custom disclaimer text')+ expect(disclaimerInput)!.toHaveValue('Custom disclaimer text')})it('should include privacy policy and custom disclaimer in save payload', async () => {@@ -506,13 +509,13 @@ describe('EditCustomCollectionModal', () => {it('should render with positionLeft prop', () => {renderModal({ positionLeft: true })- expect(screen.getByText('tools.createTool.title')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.title'))!.toBeInTheDocument()})it('should render with dialogClassName prop', () => {renderModal({ dialogClassName: 'custom-dialog-class' })- expect(screen.getByText('tools.createTool.title')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.title'))!.toBeInTheDocument()})})@@ -536,34 +539,37 @@ describe('EditCustomCollectionModal', () => {it('should extract path from full URL', () => {renderModal({ payload: payloadWithVariousUrls('https://api.example.com/users/list') })- expect(screen.getByText('/users/list')).toBeInTheDocument()+ expect(screen.getByText('/users/list'))!.toBeInTheDocument()})it('should handle URL with encoded characters', () => {renderModal({ payload: payloadWithVariousUrls('https://api.example.com/users%20list') })- expect(screen.getByText('/users list')).toBeInTheDocument()+ expect(screen.getByText('/users list'))!.toBeInTheDocument()})it('should handle empty URL', () => {renderModal({ payload: payloadWithVariousUrls('') })// Should not crash and show the row- expect(screen.getByText('testOp')).toBeInTheDocument()+ // Should not crash and show the row+ expect(screen.getByText('testOp'))!.toBeInTheDocument()})it('should handle invalid URL by returning the original string', () => {renderModal({ payload: payloadWithVariousUrls('not-a-valid-url') })// Should show the original string- expect(screen.getByText('not-a-valid-url')).toBeInTheDocument()+ // Should show the original string+ expect(screen.getByText('not-a-valid-url'))!.toBeInTheDocument()})it('should handle URL with only domain', () => {renderModal({ payload: payloadWithVariousUrls('https://api.example.com') })// Path would be empty or "/"- expect(screen.getByText('testOp')).toBeInTheDocument()+ // Path would be empty or "/"+ expect(screen.getByText('testOp'))!.toBeInTheDocument()})})@@ -573,8 +579,8 @@ describe('EditCustomCollectionModal', () => {renderModal()const link = screen.getByText('tools.createTool.viewSchemaSpec')- expect(link.closest('a')).toHaveAttribute('href', 'https://swagger.io/specification/')- expect(link.closest('a')).toHaveAttribute('target', '_blank')+ expect(link.closest('a'))!.toHaveAttribute('href', 'https://swagger.io/specification/')+ expect(link.closest('a'))!.toHaveAttribute('target', '_blank')})})})diff --git a/web/app/components/tools/edit-custom-collection-modal/__tests__/test-api.spec.tsx b/web/app/components/tools/edit-custom-collection-modal/__tests__/test-api.spec.tsxindex df35ace68df..4efe7e2dae6 100644--- a/web/app/components/tools/edit-custom-collection-modal/__tests__/test-api.spec.tsx+++ b/web/app/components/tools/edit-custom-collection-modal/__tests__/test-api.spec.tsx@@ -73,7 +73,7 @@ describe('TestApi', () => {renderTestApi()})- expect(screen.getByText('tools.test.testResult')).toBeInTheDocument()+ expect(screen.getByText('tools.test.testResult'))!.toBeInTheDocument()})it('should display tool name in the title', async () => {@@ -81,7 +81,7 @@ describe('TestApi', () => {renderTestApi()})- expect(screen.getByText(/testOp/)).toBeInTheDocument()+ expect(screen.getByText(/testOp/))!.toBeInTheDocument()})it('should render parameters table', async () => {@@ -89,9 +89,9 @@ describe('TestApi', () => {renderTestApi()})- expect(screen.getByText('tools.test.parameters')).toBeInTheDocument()- expect(screen.getByText('tools.test.value')).toBeInTheDocument()- expect(screen.getByText('Limit')).toBeInTheDocument()+ expect(screen.getByText('tools.test.parameters'))!.toBeInTheDocument()+ expect(screen.getByText('tools.test.value'))!.toBeInTheDocument()+ expect(screen.getByText('Limit'))!.toBeInTheDocument()})it('should render test result placeholder', async () => {@@ -99,7 +99,7 @@ describe('TestApi', () => {renderTestApi()})- expect(screen.getByText('tools.test.testResultPlaceholder')).toBeInTheDocument()+ expect(screen.getByText('tools.test.testResultPlaceholder'))!.toBeInTheDocument()})it('should render with positionCenter prop', async () => {@@ -107,7 +107,7 @@ describe('TestApi', () => {renderTestApi({ positionCenter: true })})- expect(screen.getByText('tools.test.testResult')).toBeInTheDocument()+ expect(screen.getByText('tools.test.testResult'))!.toBeInTheDocument()})})@@ -118,7 +118,7 @@ describe('TestApi', () => {renderTestApi()const parameterInput = screen.getAllByRole('textbox')[0]- fireEvent.change(parameterInput, { target: { value: '5' } })+ fireEvent.change(parameterInput!, { target: { value: '5' } })fireEvent.click(screen.getByRole('button', { name: 'tools.test.title' }))await waitFor(() => {@@ -134,7 +134,7 @@ describe('TestApi', () => {limit: '5',},})- expect(screen.getByText('ok')).toBeInTheDocument()+ expect(screen.getByText('ok'))!.toBeInTheDocument()})})@@ -145,7 +145,7 @@ describe('TestApi', () => {fireEvent.click(screen.getByRole('button', { name: 'tools.test.title' }))await waitFor(() => {- expect(screen.getByText('API Error occurred')).toBeInTheDocument()+ expect(screen.getByText('API Error occurred'))!.toBeInTheDocument()})})@@ -164,7 +164,7 @@ describe('TestApi', () => {// API should have been calledawait waitFor(() => {expect(testAPIAvailableMock).toHaveBeenCalledTimes(1)- expect(screen.getByText('test completed')).toBeInTheDocument()+ expect(screen.getByText('test completed'))!.toBeInTheDocument()})})@@ -204,7 +204,8 @@ describe('TestApi', () => {})// Check that the auth method is displayed- expect(screen.getByText('tools.createTool.authMethod.types.none')).toBeInTheDocument()+ // Check that the auth method is displayed+ expect(screen.getByText('tools.createTool.authMethod.types.none'))!.toBeInTheDocument()})it('should display current auth type in the button', async () => {@@ -223,7 +224,8 @@ describe('TestApi', () => {})// Check that the auth method display shows the correct type- expect(screen.getByText('tools.createTool.authMethod.types.api_key_header')).toBeInTheDocument()+ // Check that the auth method display shows the correct type+ expect(screen.getByText('tools.createTool.authMethod.types.api_key_header'))!.toBeInTheDocument()})})@@ -248,8 +250,8 @@ describe('TestApi', () => {renderTestApi({ tool: toolWithMultipleParams })const inputs = screen.getAllByRole('textbox')- fireEvent.change(inputs[0], { target: { value: '10' } })- fireEvent.change(inputs[1], { target: { value: '20' } })+ fireEvent.change(inputs[0]!, { target: { value: '10' } })+ fireEvent.change(inputs[1]!, { target: { value: '20' } })fireEvent.click(screen.getByRole('button', { name: 'tools.test.title' }))diff --git a/web/app/components/tools/mcp/__tests__/mcp-server-modal.spec.tsx b/web/app/components/tools/mcp/__tests__/mcp-server-modal.spec.tsxindex 6f5c548ec3b..9029ee56a24 100644--- a/web/app/components/tools/mcp/__tests__/mcp-server-modal.spec.tsx+++ b/web/app/components/tools/mcp/__tests__/mcp-server-modal.spec.tsx@@ -41,12 +41,12 @@ describe('MCPServerModal', () => {describe('Rendering', () => {it('should render without crashing', () => {render(<MCPServerModal {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByText('tools.mcp.server.modal.addTitle')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.server.modal.addTitle'))!.toBeInTheDocument()})it('should render add title when no data is provided', () => {render(<MCPServerModal {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByText('tools.mcp.server.modal.addTitle')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.server.modal.addTitle'))!.toBeInTheDocument()})it('should render edit title when data is provided', () => {@@ -57,33 +57,33 @@ describe('MCPServerModal', () => {} as unknown as MCPServerDetailrender(<MCPServerModal {...defaultProps} data={mockData} />, { wrapper: createWrapper() })- expect(screen.getByText('tools.mcp.server.modal.editTitle')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.server.modal.editTitle'))!.toBeInTheDocument()})it('should render description label', () => {render(<MCPServerModal {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByText('tools.mcp.server.modal.description')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.server.modal.description'))!.toBeInTheDocument()})it('should render required indicator', () => {render(<MCPServerModal {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByText('*')).toBeInTheDocument()+ expect(screen.getByText('*'))!.toBeInTheDocument()})it('should render description textarea', () => {render(<MCPServerModal {...defaultProps} />, { wrapper: createWrapper() })const textarea = screen.getByPlaceholderText('tools.mcp.server.modal.descriptionPlaceholder')- expect(textarea).toBeInTheDocument()+ expect(textarea)!.toBeInTheDocument()})it('should render cancel button', () => {render(<MCPServerModal {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByText('tools.mcp.modal.cancel')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.cancel'))!.toBeInTheDocument()})it('should render confirm button in add mode', () => {render(<MCPServerModal {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByText('tools.mcp.server.modal.confirm')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.server.modal.confirm'))!.toBeInTheDocument()})it('should render save button in edit mode', () => {@@ -94,13 +94,13 @@ describe('MCPServerModal', () => {} as unknown as MCPServerDetailrender(<MCPServerModal {...defaultProps} data={mockData} />, { wrapper: createWrapper() })- expect(screen.getByText('tools.mcp.modal.save')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.save'))!.toBeInTheDocument()})it('should render close icon', () => {render(<MCPServerModal {...defaultProps} />, { wrapper: createWrapper() })const closeButton = document.querySelector('.cursor-pointer svg')- expect(closeButton).toBeInTheDocument()+ expect(closeButton)!.toBeInTheDocument()})})@@ -115,7 +115,7 @@ describe('MCPServerModal', () => {{ variable: 'param1', label: 'Parameter 1', type: 'string' },]render(<MCPServerModal {...defaultProps} latestParams={latestParams} />, { wrapper: createWrapper() })- expect(screen.getByText('tools.mcp.server.modal.parameters')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.server.modal.parameters'))!.toBeInTheDocument()})it('should render parameters tip', () => {@@ -123,7 +123,7 @@ describe('MCPServerModal', () => {{ variable: 'param1', label: 'Parameter 1', type: 'string' },]render(<MCPServerModal {...defaultProps} latestParams={latestParams} />, { wrapper: createWrapper() })- expect(screen.getByText('tools.mcp.server.modal.parametersTip')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.server.modal.parametersTip'))!.toBeInTheDocument()})it('should render parameter items', () => {@@ -132,8 +132,8 @@ describe('MCPServerModal', () => {{ variable: 'param2', label: 'Parameter 2', type: 'number' },]render(<MCPServerModal {...defaultProps} latestParams={latestParams} />, { wrapper: createWrapper() })- expect(screen.getByText('Parameter 1')).toBeInTheDocument()- expect(screen.getByText('Parameter 2')).toBeInTheDocument()+ expect(screen.getByText('Parameter 1'))!.toBeInTheDocument()+ expect(screen.getByText('Parameter 2'))!.toBeInTheDocument()})})@@ -144,7 +144,7 @@ describe('MCPServerModal', () => {const textarea = screen.getByPlaceholderText('tools.mcp.server.modal.descriptionPlaceholder')fireEvent.change(textarea, { target: { value: 'New description' } })- expect(textarea).toHaveValue('New description')+ expect(textarea)!.toHaveValue('New description')})it('should call onHide when cancel button is clicked', () => {@@ -172,7 +172,7 @@ describe('MCPServerModal', () => {render(<MCPServerModal {...defaultProps} />, { wrapper: createWrapper() })const confirmButton = screen.getByText('tools.mcp.server.modal.confirm')- expect(confirmButton).toBeDisabled()+ expect(confirmButton)!.toBeDisabled()})it('should enable confirm button when description is filled', () => {@@ -197,7 +197,7 @@ describe('MCPServerModal', () => {render(<MCPServerModal {...defaultProps} data={mockData} />, { wrapper: createWrapper() })const textarea = screen.getByPlaceholderText('tools.mcp.server.modal.descriptionPlaceholder')- expect(textarea).toHaveValue('Existing description')+ expect(textarea)!.toHaveValue('Existing description')})it('should populate parameters with existing values', () => {@@ -210,7 +210,7 @@ describe('MCPServerModal', () => {)const paramInput = screen.getByPlaceholderText('tools.mcp.server.modal.parametersPlaceholder')- expect(paramInput).toHaveValue('existing value')+ expect(paramInput)!.toHaveValue('existing value')})})@@ -237,7 +237,7 @@ describe('MCPServerModal', () => {render(<MCPServerModal {...defaultProps} appInfo={appInfo} />, { wrapper: createWrapper() })const textarea = screen.getByPlaceholderText('tools.mcp.server.modal.descriptionPlaceholder')- expect(textarea).toHaveValue('App default description')+ expect(textarea)!.toHaveValue('App default description')})it('should prefer data description over appInfo description', () => {@@ -254,7 +254,7 @@ describe('MCPServerModal', () => {)const textarea = screen.getByPlaceholderText('tools.mcp.server.modal.descriptionPlaceholder')- expect(textarea).toHaveValue('Data description')+ expect(textarea)!.toHaveValue('Data description')})})@@ -313,9 +313,9 @@ describe('MCPServerModal', () => {const paramInputs = screen.getAllByPlaceholderText('tools.mcp.server.modal.parametersPlaceholder')// Change the first parameter value- fireEvent.change(paramInputs[0], { target: { value: 'new param value' } })+ fireEvent.change(paramInputs[0]!, { target: { value: 'new param value' } })- expect(paramInputs[0]).toHaveValue('new param value')+ expect(paramInputs[0])!.toHaveValue('new param value')})it('should submit with parameter values', async () => {@@ -355,7 +355,7 @@ describe('MCPServerModal', () => {// Button should be disabledconst confirmButton = screen.getByText('tools.mcp.server.modal.confirm')- expect(confirmButton).toBeDisabled()+ expect(confirmButton)!.toBeDisabled()})})})diff --git a/web/app/components/tools/mcp/__tests__/modal.spec.tsx b/web/app/components/tools/mcp/__tests__/modal.spec.tsxindex 3eaf66453e8..5b561e7f30c 100644--- a/web/app/components/tools/mcp/__tests__/modal.spec.tsx+++ b/web/app/components/tools/mcp/__tests__/modal.spec.tsx@@ -81,7 +81,7 @@ describe('MCPModal', () => {describe('Rendering', () => {it('should render without crashing', () => {render(<MCPModal {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByText('tools.mcp.modal.title')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.title'))!.toBeInTheDocument()})it('should not render when show is false', () => {@@ -91,7 +91,7 @@ describe('MCPModal', () => {it('should render create title when no data is provided', () => {render(<MCPModal {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByText('tools.mcp.modal.title')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.title'))!.toBeInTheDocument()})it('should render edit title when data is provided', () => {@@ -104,31 +104,31 @@ describe('MCPModal', () => {} as unknown as ToolWithProviderrender(<MCPModal {...defaultProps} data={mockData} />, { wrapper: createWrapper() })- expect(screen.getByText('tools.mcp.modal.editTitle')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.editTitle'))!.toBeInTheDocument()})})describe('Form Fields', () => {it('should render server URL input', () => {render(<MCPModal {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByText('tools.mcp.modal.serverUrl')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.serverUrl'))!.toBeInTheDocument()})it('should render name input', () => {render(<MCPModal {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByText('tools.mcp.modal.name')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.name'))!.toBeInTheDocument()})it('should render server identifier input', () => {render(<MCPModal {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByText('tools.mcp.modal.serverIdentifier')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.serverIdentifier'))!.toBeInTheDocument()})it('should render auth method tabs', () => {render(<MCPModal {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByText('tools.mcp.modal.authentication')).toBeInTheDocument()- expect(screen.getByText('tools.mcp.modal.headers')).toBeInTheDocument()- expect(screen.getByText('tools.mcp.modal.configurations')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.authentication'))!.toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.headers'))!.toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.configurations'))!.toBeInTheDocument()})})@@ -139,7 +139,7 @@ describe('MCPModal', () => {const urlInput = screen.getByPlaceholderText('tools.mcp.modal.serverUrlPlaceholder')fireEvent.change(urlInput, { target: { value: 'https://test.com/mcp' } })- expect(urlInput).toHaveValue('https://test.com/mcp')+ expect(urlInput)!.toHaveValue('https://test.com/mcp')})it('should update name input value', () => {@@ -148,7 +148,7 @@ describe('MCPModal', () => {const nameInput = screen.getByPlaceholderText('tools.mcp.modal.namePlaceholder')fireEvent.change(nameInput, { target: { value: 'My Server' } })- expect(nameInput).toHaveValue('My Server')+ expect(nameInput)!.toHaveValue('My Server')})it('should update server identifier input value', () => {@@ -157,14 +157,14 @@ describe('MCPModal', () => {const identifierInput = screen.getByPlaceholderText('tools.mcp.modal.serverIdentifierPlaceholder')fireEvent.change(identifierInput, { target: { value: 'my-server' } })- expect(identifierInput).toHaveValue('my-server')+ expect(identifierInput)!.toHaveValue('my-server')})})describe('Tab Navigation', () => {it('should show authentication section by default', () => {render(<MCPModal {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByText('tools.mcp.modal.useDynamicClientRegistration')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.useDynamicClientRegistration'))!.toBeInTheDocument()})it('should switch to headers section when clicked', async () => {@@ -174,7 +174,7 @@ describe('MCPModal', () => {fireEvent.click(headersTab)await waitFor(() => {- expect(screen.getByText('tools.mcp.modal.headersTip')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.headersTip'))!.toBeInTheDocument()})})@@ -185,8 +185,8 @@ describe('MCPModal', () => {fireEvent.click(configTab)await waitFor(() => {- expect(screen.getByText('tools.mcp.modal.timeout')).toBeInTheDocument()- expect(screen.getByText('tools.mcp.modal.sseReadTimeout')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.timeout'))!.toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.sseReadTimeout'))!.toBeInTheDocument()})})})@@ -194,7 +194,7 @@ describe('MCPModal', () => {describe('Action Buttons', () => {it('should render confirm button', () => {render(<MCPModal {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByText('tools.mcp.modal.confirm')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.confirm'))!.toBeInTheDocument()})it('should render save button in edit mode', () => {@@ -205,12 +205,12 @@ describe('MCPModal', () => {} as unknown as ToolWithProviderrender(<MCPModal {...defaultProps} data={mockData} />, { wrapper: createWrapper() })- expect(screen.getByText('tools.mcp.modal.save')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.save'))!.toBeInTheDocument()})it('should render cancel button', () => {render(<MCPModal {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByText('tools.mcp.modal.cancel')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.cancel'))!.toBeInTheDocument()})it('should call onHide when cancel is clicked', () => {@@ -243,7 +243,7 @@ describe('MCPModal', () => {render(<MCPModal {...defaultProps} />, { wrapper: createWrapper() })const confirmButton = screen.getByText('tools.mcp.modal.confirm')- expect(confirmButton).toBeDisabled()+ expect(confirmButton)!.toBeDisabled()})it('should enable confirm button when required fields are filled', () => {@@ -360,9 +360,9 @@ describe('MCPModal', () => {it('should populate form with existing data', () => {render(<MCPModal {...defaultProps} data={mockData} />, { wrapper: createWrapper() })- expect(screen.getByDisplayValue('https://existing.com/mcp')).toBeInTheDocument()- expect(screen.getByDisplayValue('Existing Server')).toBeInTheDocument()- expect(screen.getByDisplayValue('existing-server')).toBeInTheDocument()+ expect(screen.getByDisplayValue('https://existing.com/mcp'))!.toBeInTheDocument()+ expect(screen.getByDisplayValue('Existing Server'))!.toBeInTheDocument()+ expect(screen.getByDisplayValue('existing-server'))!.toBeInTheDocument()})it('should show warning when URL is changed', () => {@@ -371,7 +371,7 @@ describe('MCPModal', () => {const urlInput = screen.getByDisplayValue('https://existing.com/mcp')fireEvent.change(urlInput, { target: { value: 'https://new.com/mcp' } })- expect(screen.getByText('tools.mcp.modal.serverUrlWarning')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.serverUrlWarning'))!.toBeInTheDocument()})it('should show warning when server identifier is changed', () => {@@ -380,7 +380,7 @@ describe('MCPModal', () => {const identifierInput = screen.getByDisplayValue('existing-server')fireEvent.change(identifierInput, { target: { value: 'new-server' } })- expect(screen.getByText('tools.mcp.modal.serverIdentifierWarning')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.serverIdentifierWarning'))!.toBeInTheDocument()})})@@ -402,7 +402,8 @@ describe('MCPModal', () => {rerender(<MCPModal {...defaultProps} data={mockData} />)// Should show edit mode data- expect(screen.getByDisplayValue('Edit Server')).toBeInTheDocument()+ // Should show edit mode data+ expect(screen.getByDisplayValue('Edit Server'))!.toBeInTheDocument()})})@@ -415,7 +416,8 @@ describe('MCPModal', () => {fireEvent.blur(urlInput)// The blur handler trims the value- expect(urlInput).toHaveValue(' https://test.com/mcp ')+ // The blur handler trims the value+ expect(urlInput)!.toHaveValue(' https://test.com/mcp ')})it('should handle URL blur-sm with empty value', () => {@@ -425,7 +427,7 @@ describe('MCPModal', () => {fireEvent.change(urlInput, { target: { value: '' } })fireEvent.blur(urlInput)- expect(urlInput).toHaveValue('')+ expect(urlInput)!.toHaveValue('')})})@@ -474,7 +476,7 @@ describe('MCPModal', () => {fireEvent.click(headersTab)await waitFor(() => {- expect(screen.getByText('tools.mcp.modal.headersTip')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.headersTip'))!.toBeInTheDocument()})const confirmButton = screen.getByText('tools.mcp.modal.confirm')@@ -541,7 +543,7 @@ describe('MCPModal', () => {fireEvent.click(headersTab)await waitFor(() => {- expect(screen.getByText('tools.mcp.modal.headersTip')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.headersTip'))!.toBeInTheDocument()})// Submit form@@ -662,7 +664,7 @@ describe('MCPModal', () => {fireEvent.click(configTab)await waitFor(() => {- expect(screen.getByText('tools.mcp.modal.timeout')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.timeout'))!.toBeInTheDocument()})const confirmButton = screen.getByText('tools.mcp.modal.confirm')@@ -683,10 +685,11 @@ describe('MCPModal', () => {expect(switchElements.length).toBeGreaterThan(0)// Click the first switch (dynamic registration)- fireEvent.click(switchElements[0])+ fireEvent.click(switchElements[0]!)// The switch should toggle- expect(switchElements[0]).toBeInTheDocument()+ // The switch should toggle+ expect(switchElements[0])!.toBeInTheDocument()})})@@ -702,7 +705,7 @@ describe('MCPModal', () => {// The mocked AppIconPicker should now be visibleawait waitFor(() => {- expect(screen.getByTestId('app-icon-picker')).toBeInTheDocument()+ expect(screen.getByTestId('app-icon-picker'))!.toBeInTheDocument()})}})@@ -717,7 +720,7 @@ describe('MCPModal', () => {fireEvent.click(appIconContainer)await waitFor(() => {- expect(screen.getByTestId('app-icon-picker')).toBeInTheDocument()+ expect(screen.getByTestId('app-icon-picker'))!.toBeInTheDocument()})// Click the select emoji button@@ -741,7 +744,7 @@ describe('MCPModal', () => {fireEvent.click(appIconContainer)await waitFor(() => {- expect(screen.getByTestId('app-icon-picker')).toBeInTheDocument()+ expect(screen.getByTestId('app-icon-picker'))!.toBeInTheDocument()})// Click the close buttondiff --git a/web/app/components/tools/mcp/detail/__tests__/content.spec.tsx b/web/app/components/tools/mcp/detail/__tests__/content.spec.tsxindex 584c9d211af..5216e9eede6 100644--- a/web/app/components/tools/mcp/detail/__tests__/content.spec.tsx+++ b/web/app/components/tools/mcp/detail/__tests__/content.spec.tsx@@ -199,22 +199,22 @@ describe('MCPDetailContent', () => {describe('Rendering', () => {it('should render without crashing', () => {render(<MCPDetailContent {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByText('Test MCP Server')).toBeInTheDocument()+ expect(screen.getByText('Test MCP Server'))!.toBeInTheDocument()})it('should display MCP name', () => {render(<MCPDetailContent {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByText('Test MCP Server')).toBeInTheDocument()+ expect(screen.getByText('Test MCP Server'))!.toBeInTheDocument()})it('should display server identifier', () => {render(<MCPDetailContent {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByText('test-mcp')).toBeInTheDocument()+ expect(screen.getByText('test-mcp'))!.toBeInTheDocument()})it('should display server URL', () => {render(<MCPDetailContent {...defaultProps} />, { wrapper: createWrapper() })- expect(screen.getByText('https://example.com/mcp')).toBeInTheDocument()+ expect(screen.getByText('https://example.com/mcp'))!.toBeInTheDocument()})it('should render close button', () => {@@ -227,7 +227,8 @@ describe('MCPDetailContent', () => {it('should render operation dropdown', () => {render(<MCPDetailContent {...defaultProps} />, { wrapper: createWrapper() })// Operation dropdown trigger should be present- expect(document.querySelector('button')).toBeInTheDocument()+ // Operation dropdown trigger should be present+ expect(document.querySelector('button'))!.toBeInTheDocument()})})@@ -238,7 +239,7 @@ describe('MCPDetailContent', () => {<MCPDetailContent {...defaultProps} detail={detail} />,{ wrapper: createWrapper() },)- expect(screen.getByText('tools.mcp.authorize')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.authorize'))!.toBeInTheDocument()})it('should show authorized button when authorized', () => {@@ -247,7 +248,7 @@ describe('MCPDetailContent', () => {<MCPDetailContent {...defaultProps} detail={detail} />,{ wrapper: createWrapper() },)- expect(screen.getByText('tools.auth.authorized')).toBeInTheDocument()+ expect(screen.getByText('tools.auth.authorized'))!.toBeInTheDocument()})it('should show authorization required message when not authorized', () => {@@ -256,7 +257,7 @@ describe('MCPDetailContent', () => {<MCPDetailContent {...defaultProps} detail={detail} />,{ wrapper: createWrapper() },)- expect(screen.getByText('tools.mcp.authorizingRequired')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.authorizingRequired'))!.toBeInTheDocument()})it('should show authorization tip', () => {@@ -265,7 +266,7 @@ describe('MCPDetailContent', () => {<MCPDetailContent {...defaultProps} detail={detail} />,{ wrapper: createWrapper() },)- expect(screen.getByText('tools.mcp.authorizeTip')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.authorizeTip'))!.toBeInTheDocument()})})@@ -276,7 +277,7 @@ describe('MCPDetailContent', () => {<MCPDetailContent {...defaultProps} detail={detail} />,{ wrapper: createWrapper() },)- expect(screen.getByText('tools.mcp.toolsEmpty')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.toolsEmpty'))!.toBeInTheDocument()})it('should show get tools button when empty', () => {@@ -285,7 +286,7 @@ describe('MCPDetailContent', () => {<MCPDetailContent {...defaultProps} detail={detail} />,{ wrapper: createWrapper() },)- expect(screen.getByText('tools.mcp.getTools')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.getTools'))!.toBeInTheDocument()})})@@ -294,7 +295,7 @@ describe('MCPDetailContent', () => {render(<MCPDetailContent {...defaultProps} />, { wrapper: createWrapper() })// Icon container should be presentconst iconContainer = document.querySelector('[class*="rounded-xl"][class*="border"]')- expect(iconContainer).toBeInTheDocument()+ expect(iconContainer)!.toBeInTheDocument()})})@@ -305,7 +306,7 @@ describe('MCPDetailContent', () => {<MCPDetailContent {...defaultProps} detail={detail} />,{ wrapper: createWrapper() },)- expect(screen.getByText('Test MCP Server')).toBeInTheDocument()+ expect(screen.getByText('Test MCP Server'))!.toBeInTheDocument()})it('should handle long MCP name', () => {@@ -315,7 +316,7 @@ describe('MCPDetailContent', () => {<MCPDetailContent {...defaultProps} detail={detail} />,{ wrapper: createWrapper() },)- expect(screen.getByText(longName)).toBeInTheDocument()+ expect(screen.getByText(longName))!.toBeInTheDocument()})})@@ -332,8 +333,8 @@ describe('MCPDetailContent', () => {<MCPDetailContent {...defaultProps} detail={detail} />,{ wrapper: createWrapper() },)- expect(screen.getByText('tool1')).toBeInTheDocument()- expect(screen.getByText('tool2')).toBeInTheDocument()+ expect(screen.getByText('tool1'))!.toBeInTheDocument()+ expect(screen.getByText('tool2'))!.toBeInTheDocument()})it('should show single tool label when only one tool', () => {@@ -345,7 +346,7 @@ describe('MCPDetailContent', () => {<MCPDetailContent {...defaultProps} detail={detail} />,{ wrapper: createWrapper() },)- expect(screen.getByText('tools.mcp.onlyTool')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.onlyTool'))!.toBeInTheDocument()})it('should show tools count when multiple tools', () => {@@ -360,7 +361,7 @@ describe('MCPDetailContent', () => {<MCPDetailContent {...defaultProps} detail={detail} />,{ wrapper: createWrapper() },)- expect(screen.getByText(/tools.mcp.toolsNum/)).toBeInTheDocument()+ expect(screen.getByText(/tools.mcp.toolsNum/))!.toBeInTheDocument()})})@@ -375,7 +376,7 @@ describe('MCPDetailContent', () => {<MCPDetailContent {...defaultProps} detail={detail} />,{ wrapper: createWrapper() },)- expect(screen.getByText('tools.mcp.gettingTools')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.gettingTools'))!.toBeInTheDocument()})it('should show updating state when updating tools', () => {@@ -388,7 +389,7 @@ describe('MCPDetailContent', () => {<MCPDetailContent {...defaultProps} detail={detail} />,{ wrapper: createWrapper() },)- expect(screen.getByText('tools.mcp.updateTools')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.updateTools'))!.toBeInTheDocument()})it('should show authorizing button when authorizing', () => {@@ -464,7 +465,7 @@ describe('MCPDetailContent', () => {)const authorizeBtn = screen.getByText('tools.mcp.authorize')- expect(authorizeBtn.closest('button')).toBeDisabled()+ expect(authorizeBtn.closest('button'))!.toBeDisabled()})})@@ -483,7 +484,7 @@ describe('MCPDetailContent', () => {fireEvent.click(updateBtn)await waitFor(() => {- expect(screen.getByText('tools.mcp.toolUpdateConfirmTitle')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.toolUpdateConfirmTitle'))!.toBeInTheDocument()})})@@ -503,7 +504,7 @@ describe('MCPDetailContent', () => {fireEvent.click(updateBtn)await waitFor(() => {- expect(screen.getByText('tools.mcp.toolUpdateConfirmTitle')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.toolUpdateConfirmTitle'))!.toBeInTheDocument()})// Confirm the update@@ -541,7 +542,7 @@ describe('MCPDetailContent', () => {fireEvent.click(editBtn)await waitFor(() => {- expect(screen.getByTestId('mcp-update-modal')).toBeInTheDocument()+ expect(screen.getByTestId('mcp-update-modal'))!.toBeInTheDocument()})})@@ -553,7 +554,7 @@ describe('MCPDetailContent', () => {fireEvent.click(editBtn)await waitFor(() => {- expect(screen.getByTestId('mcp-update-modal')).toBeInTheDocument()+ expect(screen.getByTestId('mcp-update-modal'))!.toBeInTheDocument()})// Close modal@@ -574,7 +575,7 @@ describe('MCPDetailContent', () => {fireEvent.click(editBtn)await waitFor(() => {- expect(screen.getByTestId('mcp-update-modal')).toBeInTheDocument()+ expect(screen.getByTestId('mcp-update-modal'))!.toBeInTheDocument()})// Confirm form@@ -601,7 +602,7 @@ describe('MCPDetailContent', () => {fireEvent.click(editBtn)await waitFor(() => {- expect(screen.getByTestId('mcp-update-modal')).toBeInTheDocument()+ expect(screen.getByTestId('mcp-update-modal'))!.toBeInTheDocument()})// Confirm form@@ -624,7 +625,7 @@ describe('MCPDetailContent', () => {fireEvent.click(removeBtn)await waitFor(() => {- expect(screen.getByText('tools.mcp.delete')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.delete'))!.toBeInTheDocument()})})@@ -636,7 +637,7 @@ describe('MCPDetailContent', () => {fireEvent.click(removeBtn)await waitFor(() => {- expect(screen.getByText('tools.mcp.delete')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.delete'))!.toBeInTheDocument()})// Cancel@@ -656,7 +657,7 @@ describe('MCPDetailContent', () => {fireEvent.click(removeBtn)await waitFor(() => {- expect(screen.getByText('tools.mcp.delete')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.delete'))!.toBeInTheDocument()})// Confirm delete@@ -678,7 +679,7 @@ describe('MCPDetailContent', () => {fireEvent.click(removeBtn)await waitFor(() => {- expect(screen.getByText('tools.mcp.delete')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.delete'))!.toBeInTheDocument()})// Confirm delete@@ -743,7 +744,7 @@ describe('MCPDetailContent', () => {})// Get the callback function and call it- const oauthCallback = mockOpenOAuthPopup.mock.calls[0][1]+ const oauthCallback = mockOpenOAuthPopup.mock.calls[0]![1]oauthCallback()await waitFor(() => {@@ -765,7 +766,7 @@ describe('MCPDetailContent', () => {// Button should be disabledconst authorizeBtn = screen.getByText('tools.mcp.authorize')- expect(authorizeBtn.closest('button')).toBeDisabled()+ expect(authorizeBtn.closest('button'))!.toBeDisabled()})})@@ -776,7 +777,7 @@ describe('MCPDetailContent', () => {<MCPDetailContent {...defaultProps} detail={detail} />,{ wrapper: createWrapper() },)- expect(screen.getByText('tools.auth.authorized')).toBeInTheDocument()+ expect(screen.getByText('tools.auth.authorized'))!.toBeInTheDocument()})it('should call handleAuthorize when authorized button is clicked', async () => {@@ -805,7 +806,7 @@ describe('MCPDetailContent', () => {)const authorizedBtn = screen.getByText('tools.auth.authorized')- expect(authorizedBtn.closest('button')).toBeDisabled()+ expect(authorizedBtn.closest('button'))!.toBeDisabled()})})@@ -825,7 +826,7 @@ describe('MCPDetailContent', () => {fireEvent.click(updateBtn)await waitFor(() => {- expect(screen.getByText('tools.mcp.toolUpdateConfirmTitle')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.toolUpdateConfirmTitle'))!.toBeInTheDocument()})// Cancel the updatediff --git a/web/app/components/tools/mcp/headers-input.tsx b/web/app/components/tools/mcp/headers-input.tsxindex bfaf6bd5d2b..05cc464bfbf 100644--- a/web/app/components/tools/mcp/headers-input.tsx+++ b/web/app/components/tools/mcp/headers-input.tsx@@ -31,7 +31,7 @@ const HeadersInput = ({const handleItemChange = (index: number, field: 'key' | 'value', value: string) => {const newItems = [...headersItems]- newItems[index] = { ...newItems[index], [field]: value }+ newItems[index] = { ...newItems[index]!, [field]: value }onChange(newItems)}diff --git a/web/app/components/tools/mcp/hooks/__tests__/use-mcp-modal-form.spec.ts b/web/app/components/tools/mcp/hooks/__tests__/use-mcp-modal-form.spec.tsindex f44e14d608e..fe3dde2cb6e 100644--- a/web/app/components/tools/mcp/hooks/__tests__/use-mcp-modal-form.spec.ts+++ b/web/app/components/tools/mcp/hooks/__tests__/use-mcp-modal-form.spec.ts@@ -160,10 +160,10 @@ describe('useMCPModalForm', () => {const { result } = renderHook(() => useMCPModalForm(mockData))expect(result.current.state.headers).toHaveLength(2)- expect(result.current.state.headers[0].key).toBe('Authorization')- expect(result.current.state.headers[0].value).toBe('***')- expect(result.current.state.headers[1].key).toBe('X-Custom')- expect(result.current.state.headers[1].value).toBe('value')+ expect(result.current.state.headers[0]!.key).toBe('Authorization')+ expect(result.current.state.headers[0]!.value).toBe('***')+ expect(result.current.state.headers[1]!.key).toBe('X-Custom')+ expect(result.current.state.headers[1]!.value).toBe('value')})it('should initialize emoji icon from data', () => {diff --git a/web/app/components/tools/mcp/hooks/use-mcp-service-card.ts b/web/app/components/tools/mcp/hooks/use-mcp-service-card.tsindex dfb1c75a2ac..8547b7f7ba5 100644--- a/web/app/components/tools/mcp/hooks/use-mcp-service-card.ts+++ b/web/app/components/tools/mcp/hooks/use-mcp-service-card.ts@@ -87,7 +87,7 @@ export const useMCPServiceCardState = (return (basicAppConfig.user_input_form as Array<Record<string, unknown>>).map((item) => {const type = Object.keys(item)[0]return {- ...(item[type] as object),+ ...(item[type!] as object),type: type || 'text-input',}})diff --git a/web/app/components/tools/mcp/sections/__tests__/authentication-section.spec.tsx b/web/app/components/tools/mcp/sections/__tests__/authentication-section.spec.tsxindex f5ed16f21d1..213a58b6f8b 100644--- a/web/app/components/tools/mcp/sections/__tests__/authentication-section.spec.tsx+++ b/web/app/components/tools/mcp/sections/__tests__/authentication-section.spec.tsx@@ -15,29 +15,29 @@ describe('AuthenticationSection', () => {describe('Rendering', () => {it('should render without crashing', () => {render(<AuthenticationSection {...defaultProps} />)- expect(screen.getByText('tools.mcp.modal.useDynamicClientRegistration')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.useDynamicClientRegistration'))!.toBeInTheDocument()})it('should render switch for dynamic registration', () => {render(<AuthenticationSection {...defaultProps} />)- expect(screen.getByRole('switch')).toBeInTheDocument()+ expect(screen.getByRole('switch'))!.toBeInTheDocument()})it('should render client ID input', () => {render(<AuthenticationSection {...defaultProps} clientID="test-client-id" />)- expect(screen.getByDisplayValue('test-client-id')).toBeInTheDocument()+ expect(screen.getByDisplayValue('test-client-id'))!.toBeInTheDocument()})it('should render credentials input', () => {render(<AuthenticationSection {...defaultProps} credentials="test-secret" />)- expect(screen.getByDisplayValue('test-secret')).toBeInTheDocument()+ expect(screen.getByDisplayValue('test-secret'))!.toBeInTheDocument()})it('should render labels for all fields', () => {render(<AuthenticationSection {...defaultProps} />)- expect(screen.getByText('tools.mcp.modal.useDynamicClientRegistration')).toBeInTheDocument()- expect(screen.getByText('tools.mcp.modal.clientID')).toBeInTheDocument()- expect(screen.getByText('tools.mcp.modal.clientSecret')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.useDynamicClientRegistration'))!.toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.clientID'))!.toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.clientSecret'))!.toBeInTheDocument()})})@@ -49,19 +49,19 @@ describe('AuthenticationSection', () => {it('should show warning when isDynamicRegistration is false', () => {render(<AuthenticationSection {...defaultProps} isDynamicRegistration={false} />)- expect(screen.getByText('tools.mcp.modal.redirectUrlWarning')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.redirectUrlWarning'))!.toBeInTheDocument()})it('should show OAuth callback URL in warning', () => {render(<AuthenticationSection {...defaultProps} isDynamicRegistration={false} />)- expect(screen.getByText(/\/mcp\/oauth\/callback/)).toBeInTheDocument()+ expect(screen.getByText(/\/mcp\/oauth\/callback/))!.toBeInTheDocument()})it('should disable inputs when isDynamicRegistration is true', () => {render(<AuthenticationSection {...defaultProps} isDynamicRegistration={true} />)const inputs = screen.getAllByRole('textbox')inputs.forEach((input) => {- expect(input).toBeDisabled()+ expect(input)!.toBeDisabled()})})@@ -102,7 +102,7 @@ describe('AuthenticationSection', () => {const inputs = screen.getAllByRole('textbox')const clientIDInput = inputs[0]- fireEvent.change(clientIDInput, { target: { value: 'new-client-id' } })+ fireEvent.change(clientIDInput!, { target: { value: 'new-client-id' } })expect(onClientIDChange).toHaveBeenCalledWith('new-client-id')})@@ -119,7 +119,7 @@ describe('AuthenticationSection', () => {const inputs = screen.getAllByRole('textbox')const credentialsInput = inputs[1]- fireEvent.change(credentialsInput, { target: { value: 'new-secret' } })+ fireEvent.change(credentialsInput!, { target: { value: 'new-secret' } })expect(onCredentialsChange).toHaveBeenCalledWith('new-secret')})@@ -128,12 +128,12 @@ describe('AuthenticationSection', () => {describe('Props', () => {it('should display provided clientID value', () => {render(<AuthenticationSection {...defaultProps} clientID="my-client-123" />)- expect(screen.getByDisplayValue('my-client-123')).toBeInTheDocument()+ expect(screen.getByDisplayValue('my-client-123'))!.toBeInTheDocument()})it('should display provided credentials value', () => {render(<AuthenticationSection {...defaultProps} credentials="secret-456" />)- expect(screen.getByDisplayValue('secret-456')).toBeInTheDocument()+ expect(screen.getByDisplayValue('secret-456'))!.toBeInTheDocument()})})@@ -143,7 +143,7 @@ describe('AuthenticationSection', () => {const inputs = screen.getAllByRole('textbox')expect(inputs).toHaveLength(2)inputs.forEach((input) => {- expect(input).toHaveValue('')+ expect(input)!.toHaveValue('')})})@@ -155,8 +155,8 @@ describe('AuthenticationSection', () => {credentials="secret&*()_+"/>,)- expect(screen.getByDisplayValue('client@123!#$')).toBeInTheDocument()- expect(screen.getByDisplayValue('secret&*()_+')).toBeInTheDocument()+ expect(screen.getByDisplayValue('client@123!#$'))!.toBeInTheDocument()+ expect(screen.getByDisplayValue('secret&*()_+'))!.toBeInTheDocument()})})})diff --git a/web/app/components/tools/mcp/sections/__tests__/headers-section.spec.tsx b/web/app/components/tools/mcp/sections/__tests__/headers-section.spec.tsxindex b71ba0ca042..aeec35385e6 100644--- a/web/app/components/tools/mcp/sections/__tests__/headers-section.spec.tsx+++ b/web/app/components/tools/mcp/sections/__tests__/headers-section.spec.tsx@@ -12,27 +12,27 @@ describe('HeadersSection', () => {describe('Rendering', () => {it('should render without crashing', () => {render(<HeadersSection {...defaultProps} />)- expect(screen.getByText('tools.mcp.modal.headers')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.headers'))!.toBeInTheDocument()})it('should render headers label', () => {render(<HeadersSection {...defaultProps} />)- expect(screen.getByText('tools.mcp.modal.headers')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.headers'))!.toBeInTheDocument()})it('should render headers tip', () => {render(<HeadersSection {...defaultProps} />)- expect(screen.getByText('tools.mcp.modal.headersTip')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.headersTip'))!.toBeInTheDocument()})it('should render empty state when no headers', () => {render(<HeadersSection {...defaultProps} headers={[]} />)- expect(screen.getByText('tools.mcp.modal.noHeaders')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.noHeaders'))!.toBeInTheDocument()})it('should render add header button when empty', () => {render(<HeadersSection {...defaultProps} headers={[]} />)- expect(screen.getByText('tools.mcp.modal.addHeader')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.addHeader'))!.toBeInTheDocument()})})@@ -44,16 +44,16 @@ describe('HeadersSection', () => {it('should render header items', () => {render(<HeadersSection {...defaultProps} headers={headersWithItems} />)- expect(screen.getByDisplayValue('Authorization')).toBeInTheDocument()- expect(screen.getByDisplayValue('Bearer token123')).toBeInTheDocument()- expect(screen.getByDisplayValue('Content-Type')).toBeInTheDocument()- expect(screen.getByDisplayValue('application/json')).toBeInTheDocument()+ expect(screen.getByDisplayValue('Authorization'))!.toBeInTheDocument()+ expect(screen.getByDisplayValue('Bearer token123'))!.toBeInTheDocument()+ expect(screen.getByDisplayValue('Content-Type'))!.toBeInTheDocument()+ expect(screen.getByDisplayValue('application/json'))!.toBeInTheDocument()})it('should render table headers', () => {render(<HeadersSection {...defaultProps} headers={headersWithItems} />)- expect(screen.getByText('tools.mcp.modal.headerKey')).toBeInTheDocument()- expect(screen.getByText('tools.mcp.modal.headerValue')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.headerKey'))!.toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.headerValue'))!.toBeInTheDocument()})it('should show masked tip when not isCreate and has headers with content', () => {@@ -64,7 +64,7 @@ describe('HeadersSection', () => {headers={headersWithItems}/>,)- expect(screen.getByText('tools.mcp.modal.maskedHeadersTip')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.maskedHeadersTip'))!.toBeInTheDocument()})it('should not show masked tip when isCreate is true', () => {@@ -88,7 +88,7 @@ describe('HeadersSection', () => {fireEvent.click(addButton)expect(onHeadersChange).toHaveBeenCalled()- const calledWithHeaders = onHeadersChange.mock.calls[0][0]+ const calledWithHeaders = onHeadersChange.mock.calls[0]![0]expect(calledWithHeaders).toHaveLength(1)expect(calledWithHeaders[0]).toHaveProperty('id')expect(calledWithHeaders[0]).toHaveProperty('key', '')@@ -108,7 +108,7 @@ describe('HeadersSection', () => {const inputs = screen.getAllByRole('textbox')const keyInput = inputs[0]- fireEvent.change(keyInput, { target: { value: 'X-Custom-Header' } })+ fireEvent.change(keyInput!, { target: { value: 'X-Custom-Header' } })expect(onHeadersChange).toHaveBeenCalled()})@@ -126,7 +126,7 @@ describe('HeadersSection', () => {const inputs = screen.getAllByRole('textbox')const valueInput = inputs[1]- fireEvent.change(valueInput, { target: { value: 'custom-value' } })+ fireEvent.change(valueInput!, { target: { value: 'custom-value' } })expect(onHeadersChange).toHaveBeenCalled()})@@ -160,7 +160,7 @@ describe('HeadersSection', () => {it('should pass isCreate=false correctly (with masking)', () => {const headers = [{ id: '1', key: 'Header', value: 'Value' }]render(<HeadersSection {...defaultProps} isCreate={false} headers={headers} />)- expect(screen.getByText('tools.mcp.modal.maskedHeadersTip')).toBeInTheDocument()+ expect(screen.getByText('tools.mcp.modal.maskedHeadersTip'))!.toBeInTheDocument()})})@@ -169,6 +169,37 @@ describe('HeadersSection', () => {const headers = [{ id: '1', key: '', value: 'Value' }]render(<HeadersSection {...defaultProps} isCreate={false} headers={headers} />)// Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger masking+ // Empty key headers don't trigger maskingexpect(screen.queryByText('tools.mcp.modal.maskedHeadersTip')).not.toBeInTheDocument()})@@ -176,6 +207,37 @@ describe('HeadersSection', () => {const headers = [{ id: '1', key: ' ', value: 'Value' }]render(<HeadersSection {...defaultProps} isCreate={false} headers={headers} />)// Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having content+ // Whitespace-only key doesn't count as having contentexpect(screen.queryByText('tools.mcp.modal.maskedHeadersTip')).not.toBeInTheDocument()})@@ -186,7 +248,8 @@ describe('HeadersSection', () => {]render(<HeadersSection {...defaultProps} isCreate={false} headers={headers} />)// At least one header has a non-empty key, so masking should apply- expect(screen.getByText('tools.mcp.modal.maskedHeadersTip')).toBeInTheDocument()+ // At least one header has a non-empty key, so masking should apply+ expect(screen.getByText('tools.mcp.modal.maskedHeadersTip'))!.toBeInTheDocument()})})})diff --git a/web/app/components/tools/provider/__tests__/detail.spec.tsx b/web/app/components/tools/provider/__tests__/detail.spec.tsxindex 1e3327232cb..870e8adab14 100644--- a/web/app/components/tools/provider/__tests__/detail.spec.tsx+++ b/web/app/components/tools/provider/__tests__/detail.spec.tsx@@ -187,9 +187,9 @@ describe('ProviderDetail', () => {onRefreshData={mockOnRefreshData}/>,)- expect(screen.getByTestId('title')).toHaveTextContent('Test Collection')- expect(screen.getByTestId('org-info')).toHaveTextContent('Test Author')- expect(screen.getByTestId('description')).toHaveTextContent('A test collection')+ expect(screen.getByTestId('title'))!.toHaveTextContent('Test Collection')+ expect(screen.getByTestId('org-info'))!.toHaveTextContent('Test Author')+ expect(screen.getByTestId('description'))!.toHaveTextContent('A test collection')})it('shows loading state initially', () => {@@ -200,7 +200,7 @@ describe('ProviderDetail', () => {onRefreshData={mockOnRefreshData}/>,)- expect(screen.getByRole('status')).toBeInTheDocument()+ expect(screen.getByRole('status'))!.toBeInTheDocument()})it('renders tool list after loading for builtIn type', async () => {@@ -212,8 +212,8 @@ describe('ProviderDetail', () => {/>,)await waitFor(() => {- expect(screen.getByTestId('tool-tool-1')).toBeInTheDocument()- expect(screen.getByTestId('tool-tool-2')).toBeInTheDocument()+ expect(screen.getByTestId('tool-tool-1'))!.toBeInTheDocument()+ expect(screen.getByTestId('tool-tool-2'))!.toBeInTheDocument()})})@@ -239,7 +239,7 @@ describe('ProviderDetail', () => {/>,)await waitFor(() => {- expect(screen.getByText('tools.auth.unauthorized')).toBeInTheDocument()+ expect(screen.getByText('tools.auth.unauthorized'))!.toBeInTheDocument()})})@@ -252,7 +252,7 @@ describe('ProviderDetail', () => {/>,)await waitFor(() => {- expect(screen.getByText('tools.auth.authorized')).toBeInTheDocument()+ expect(screen.getByText('tools.auth.authorized'))!.toBeInTheDocument()})})})@@ -273,7 +273,7 @@ describe('ProviderDetail', () => {expect(mockFetchCustomCollection).toHaveBeenCalledWith('test-collection')})await waitFor(() => {- expect(screen.getByText('tools.createTool.editAction')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.editAction'))!.toBeInTheDocument()})})})@@ -291,8 +291,8 @@ describe('ProviderDetail', () => {expect(mockFetchWorkflowToolDetail).toHaveBeenCalledWith('test-id')})await waitFor(() => {- expect(screen.getByText('tools.openInStudio')).toBeInTheDocument()- expect(screen.getByText('tools.createTool.editAction')).toBeInTheDocument()+ expect(screen.getByText('tools.openInStudio'))!.toBeInTheDocument()+ expect(screen.getByText('tools.createTool.editAction'))!.toBeInTheDocument()})})})@@ -315,7 +315,7 @@ describe('ProviderDetail', () => {/>,)await waitFor(() => {- expect(screen.getByText('tools.auth.unauthorized')).toBeInTheDocument()+ expect(screen.getByText('tools.auth.unauthorized'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('tools.auth.unauthorized'))expect(mockSetShowModelModal).toHaveBeenCalled()@@ -332,7 +332,7 @@ describe('ProviderDetail', () => {/>,)const buttons = screen.getAllByRole('button')- fireEvent.click(buttons[0])+ fireEvent.click(buttons[0]!)expect(mockOnHide).toHaveBeenCalled()})})@@ -388,10 +388,10 @@ describe('ProviderDetail', () => {/>,)await waitFor(() => {- expect(screen.getByText('tools.auth.unauthorized')).toBeInTheDocument()+ expect(screen.getByText('tools.auth.unauthorized'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('tools.auth.unauthorized'))- expect(screen.getByTestId('config-credential')).toBeInTheDocument()+ expect(screen.getByTestId('config-credential'))!.toBeInTheDocument()})it('saves credentials and refreshes data', async () => {@@ -403,7 +403,7 @@ describe('ProviderDetail', () => {/>,)await waitFor(() => {- expect(screen.getByText('tools.auth.unauthorized')).toBeInTheDocument()+ expect(screen.getByText('tools.auth.unauthorized'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('tools.auth.unauthorized'))await act(async () => {@@ -424,7 +424,7 @@ describe('ProviderDetail', () => {/>,)await waitFor(() => {- expect(screen.getByText('tools.auth.unauthorized')).toBeInTheDocument()+ expect(screen.getByText('tools.auth.unauthorized'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('tools.auth.unauthorized'))await act(async () => {@@ -445,10 +445,10 @@ describe('ProviderDetail', () => {/>,)await waitFor(() => {- expect(screen.getByText('tools.auth.authorized')).toBeInTheDocument()+ expect(screen.getByText('tools.auth.authorized'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('tools.auth.authorized'))- expect(screen.getByTestId('config-credential')).toBeInTheDocument()+ expect(screen.getByTestId('config-credential'))!.toBeInTheDocument()})})@@ -467,10 +467,10 @@ describe('ProviderDetail', () => {/>,)await waitFor(() => {- expect(screen.getByText('tools.auth.unauthorized')).toBeInTheDocument()+ expect(screen.getByText('tools.auth.unauthorized'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('tools.auth.unauthorized'))- const call = mockSetShowModelModal.mock.calls[0][0]+ const call = mockSetShowModelModal.mock.calls[0]![0]act(() => {call.onSaveCallback()})@@ -497,7 +497,7 @@ describe('ProviderDetail', () => {expect(mockFetchCustomCollection).toHaveBeenCalled()})await waitFor(() => {- expect(screen.getByText('tools.createTool.editAction')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.editAction'))!.toBeInTheDocument()})})@@ -513,10 +513,10 @@ describe('ProviderDetail', () => {/>,)await waitFor(() => {- expect(screen.getByText('tools.createTool.editAction')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.editAction'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('tools.createTool.editAction'))- expect(screen.getByTestId('edit-custom-modal')).toBeInTheDocument()+ expect(screen.getByTestId('edit-custom-modal'))!.toBeInTheDocument()await act(async () => {fireEvent.click(screen.getByTestId('edit-save'))})@@ -538,11 +538,11 @@ describe('ProviderDetail', () => {/>,)await waitFor(() => {- expect(screen.getByText('tools.createTool.editAction')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.editAction'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('tools.createTool.editAction'))fireEvent.click(screen.getByTestId('edit-remove'))- expect(screen.getByText('tools.createTool.deleteToolConfirmTitle')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.deleteToolConfirmTitle'))!.toBeInTheDocument()await act(async () => {fireEvent.click(getDeleteConfirmButton())})@@ -574,10 +574,10 @@ describe('ProviderDetail', () => {/>,)await waitFor(() => {- expect(screen.getByText('query')).toBeInTheDocument()- expect(screen.getByText('string')).toBeInTheDocument()- expect(screen.getByText('Search query')).toBeInTheDocument()- expect(screen.getByText('limit')).toBeInTheDocument()+ expect(screen.getByText('query'))!.toBeInTheDocument()+ expect(screen.getByText('string'))!.toBeInTheDocument()+ expect(screen.getByText('Search query'))!.toBeInTheDocument()+ expect(screen.getByText('limit'))!.toBeInTheDocument()})})@@ -590,10 +590,10 @@ describe('ProviderDetail', () => {/>,)await waitFor(() => {- expect(screen.getByText('tools.createTool.editAction')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.editAction'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('tools.createTool.editAction'))- expect(screen.getByTestId('workflow-tool-modal')).toBeInTheDocument()+ expect(screen.getByTestId('workflow-tool-modal'))!.toBeInTheDocument()await act(async () => {fireEvent.click(screen.getByTestId('wf-save'))})@@ -612,11 +612,11 @@ describe('ProviderDetail', () => {/>,)await waitFor(() => {- expect(screen.getByText('tools.createTool.editAction')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.editAction'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('tools.createTool.editAction'))fireEvent.click(screen.getByTestId('wf-remove'))- expect(screen.getByText('tools.createTool.deleteToolConfirmTitle')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.deleteToolConfirmTitle'))!.toBeInTheDocument()await act(async () => {fireEvent.click(getDeleteConfirmButton())})@@ -637,10 +637,10 @@ describe('ProviderDetail', () => {/>,)await waitFor(() => {- expect(screen.getByText('tools.auth.unauthorized')).toBeInTheDocument()+ expect(screen.getByText('tools.auth.unauthorized'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('tools.auth.unauthorized'))- expect(screen.getByTestId('config-credential')).toBeInTheDocument()+ expect(screen.getByTestId('config-credential'))!.toBeInTheDocument()fireEvent.click(screen.getByTestId('credential-cancel'))expect(screen.queryByTestId('config-credential')).not.toBeInTheDocument()})@@ -657,10 +657,10 @@ describe('ProviderDetail', () => {/>,)await waitFor(() => {- expect(screen.getByText('tools.createTool.editAction')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.editAction'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('tools.createTool.editAction'))- expect(screen.getByTestId('edit-custom-modal')).toBeInTheDocument()+ expect(screen.getByTestId('edit-custom-modal'))!.toBeInTheDocument()fireEvent.click(screen.getByTestId('edit-close'))expect(screen.queryByTestId('edit-custom-modal')).not.toBeInTheDocument()})@@ -674,10 +674,10 @@ describe('ProviderDetail', () => {/>,)await waitFor(() => {- expect(screen.getByText('tools.createTool.editAction')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.editAction'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('tools.createTool.editAction'))- expect(screen.getByTestId('workflow-tool-modal')).toBeInTheDocument()+ expect(screen.getByTestId('workflow-tool-modal'))!.toBeInTheDocument()fireEvent.click(screen.getByTestId('wf-close'))expect(screen.queryByTestId('workflow-tool-modal')).not.toBeInTheDocument()})@@ -696,11 +696,11 @@ describe('ProviderDetail', () => {/>,)await waitFor(() => {- expect(screen.getByText('tools.createTool.editAction')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.editAction'))!.toBeInTheDocument()})fireEvent.click(screen.getByText('tools.createTool.editAction'))fireEvent.click(screen.getByTestId('edit-remove'))- expect(screen.getByText('tools.createTool.deleteToolConfirmTitle')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.deleteToolConfirmTitle'))!.toBeInTheDocument()fireEvent.click(getDeleteCancelButton())await waitFor(() => {expect(screen.queryByRole('alertdialog')).not.toBeInTheDocument()diff --git a/web/app/components/tools/provider/detail.tsx b/web/app/components/tools/provider/detail.tsxindex 7f24a6ec526..7480d114852 100644--- a/web/app/components/tools/provider/detail.tsx+++ b/web/app/components/tools/provider/detail.tsx@@ -244,7 +244,7 @@ const ProviderDetail = ({<Icon src={collection.icon} /><div className="ml-3 w-0 grow"><div className="flex h-5 items-center">- <Title title={collection.label[language]} />+ <Title title={collection.label[language]!} /></div><div className="mt-0.5 mb-1 flex h-4 items-center justify-between"><OrgInfodiff --git a/web/app/components/tools/utils/__tests__/to-form-schema.spec.ts b/web/app/components/tools/utils/__tests__/to-form-schema.spec.tsindex 19ae318b842..5a97f41bc74 100644--- a/web/app/components/tools/utils/__tests__/to-form-schema.spec.ts+++ b/web/app/components/tools/utils/__tests__/to-form-schema.spec.ts@@ -54,9 +54,9 @@ describe('to-form-schema utilities', () => {] as unknown as TriggerEventParameter[]const result = triggerEventParametersToFormSchemas(params)expect(result).toHaveLength(1)- expect(result[0].type).toBe('text-input')- expect(result[0]._type).toBe('string')- expect(result[0].tooltip).toEqual({ en_US: 'Search query', zh_Hans: '搜索查询' })+ expect(result[0]!.type).toBe('text-input')+ expect(result[0]!._type).toBe('string')+ expect(result[0]!.tooltip).toEqual({ en_US: 'Search query', zh_Hans: '搜索查询' })})it('preserves all original fields via spread', () => {@@ -71,9 +71,9 @@ describe('to-form-schema utilities', () => {},] as unknown as TriggerEventParameter[]const result = triggerEventParametersToFormSchemas(params)- expect(result[0].name).toBe('count')- expect(result[0].label).toEqual({ en_US: 'Count', zh_Hans: '数量' })- expect(result[0].required).toBe(false)+ expect(result[0]!.name).toBe('count')+ expect(result[0]!.label).toEqual({ en_US: 'Count', zh_Hans: '数量' })+ expect(result[0]!.required).toBe(false)})})@@ -98,11 +98,11 @@ describe('to-form-schema utilities', () => {]const result = toolParametersToFormSchemas(params)expect(result).toHaveLength(1)- expect(result[0].variable).toBe('input_text')- expect(result[0].type).toBe('text-input')- expect(result[0]._type).toBe('string')- expect(result[0].show_on).toEqual([])- expect(result[0].tooltip).toEqual({ en_US: 'Enter text', zh_Hans: '输入文本' })+ expect(result[0]!.variable).toBe('input_text')+ expect(result[0]!.type).toBe('text-input')+ expect(result[0]!._type).toBe('string')+ expect(result[0]!.show_on).toEqual([])+ expect(result[0]!.tooltip).toEqual({ en_US: 'Enter text', zh_Hans: '输入文本' })})it('maps options with show_on = []', () => {@@ -124,9 +124,9 @@ describe('to-form-schema utilities', () => {},]const result = toolParametersToFormSchemas(params)- expect(result[0].options).toHaveLength(2)- expect(result[0].options![0].show_on).toEqual([])- expect(result[0].options![1].show_on).toEqual([])+ expect(result[0]!.options).toHaveLength(2)+ expect(result[0]!.options![0]!.show_on).toEqual([])+ expect(result[0]!.options![1]!.show_on).toEqual([])})it('handles parameters without options', () => {@@ -144,7 +144,7 @@ describe('to-form-schema utilities', () => {},]const result = toolParametersToFormSchemas(params)- expect(result[0].options).toBeUndefined()+ expect(result[0]!.options).toBeUndefined()})})@@ -167,10 +167,10 @@ describe('to-form-schema utilities', () => {]const result = toolCredentialToFormSchemas(creds)expect(result).toHaveLength(1)- expect(result[0].variable).toBe('api_key')- expect(result[0].type).toBe('secret-input')- expect(result[0].tooltip).toEqual({ en_US: 'Enter your API key', zh_Hans: '输入你的 API 密钥' })- expect(result[0].show_on).toEqual([])+ expect(result[0]!.variable).toBe('api_key')+ expect(result[0]!.type).toBe('secret-input')+ expect(result[0]!.tooltip).toEqual({ en_US: 'Enter your API key', zh_Hans: '输入你的 API 密钥' })+ expect(result[0]!.show_on).toEqual([])})it('handles null help field → tooltip becomes undefined', () => {@@ -186,7 +186,7 @@ describe('to-form-schema utilities', () => {},]const result = toolCredentialToFormSchemas(creds)- expect(result[0].tooltip).toBeUndefined()+ expect(result[0]!.tooltip).toBeUndefined()})it('maps credential options with show_on = []', () => {@@ -206,8 +206,8 @@ describe('to-form-schema utilities', () => {},]const result = toolCredentialToFormSchemas(creds)- expect(result[0].options).toHaveLength(2)- result[0].options!.forEach(opt => expect(opt.show_on).toEqual([]))+ expect(result[0]!.options).toHaveLength(2)+ result[0]!.options!.forEach(opt => expect(opt.show_on).toEqual([]))})})@@ -364,8 +364,8 @@ describe('to-form-schema utilities', () => {const schemas = [{ variable: 'name', type: 'text-input', default: 'hello' }]const value = { name: { value: 'world' } }const result = generateAgentToolValue(value, schemas)- expect(result.name.value).toBeDefined()- expect(result.name.value!.type).toBe('mixed')+ expect(result.name!.value).toBeDefined()+ expect(result.name!.value!.type).toBe('mixed')})it('generates auto:1 for auto-mode parameters in reasoning mode', () => {@@ -379,30 +379,30 @@ describe('to-form-schema utilities', () => {const schemas = [{ variable: 'name', type: 'text-input' }]const value = { name: { auto: 0 as const, value: { type: 'constant', value: 'manual' } } }const result = generateAgentToolValue(value, schemas, true)- expect(result.name.auto).toBe(0)- expect(result.name.value).toEqual({ type: 'constant', value: 'manual' })+ expect(result.name!.auto).toBe(0)+ expect(result.name!.value).toEqual({ type: 'constant', value: 'manual' })})it('handles undefined value in reasoning mode with fallback', () => {const schemas = [{ variable: 'name', type: 'select' }]const value = { name: { auto: 0 as const, value: undefined } }const result = generateAgentToolValue(value, schemas, true)- expect(result.name.auto).toBe(0)- expect(result.name.value).toEqual({ type: 'constant', value: null })+ expect(result.name!.auto).toBe(0)+ expect(result.name!.value).toEqual({ type: 'constant', value: null })})it('applies correctInitialData for text-input type', () => {const schemas = [{ variable: 'query', type: 'text-input' }]const value = { query: { value: 'search term' } }const result = generateAgentToolValue(value, schemas)- expect(result.query.value!.type).toBe('mixed')+ expect(result.query!.value!.type).toBe('mixed')})it('applies correctInitialData for boolean type conversion', () => {const schemas = [{ variable: 'flag', type: 'boolean' }]const value = { flag: { value: 'true' } }const result = generateAgentToolValue(value, schemas)- expect(result.flag.value!.value).toBe(true)+ expect(result.flag!.value!.value).toBe(true)})})})diff --git a/web/app/components/tools/utils/to-form-schema.ts b/web/app/components/tools/utils/to-form-schema.tsindex 4171590375c..0d88b1424d8 100644--- a/web/app/components/tools/utils/to-form-schema.ts+++ b/web/app/components/tools/utils/to-form-schema.ts@@ -208,7 +208,7 @@ export const getPlainValue = (value: Record<string, { value: unknown }>) => {const plainValue: Record<string, unknown> = {}Object.keys(value).forEach((key) => {plainValue[key] = {- ...(value[key].value as object),+ ...(value[key]!.value as object),}})return plainValue@@ -260,7 +260,7 @@ export const generateAgentToolValue = (value: Record<string, { value?: unknown,value: itemValue?.value,},}- newValues[formSchema.variable].value = correctInitialData(formSchema.type, newValues[formSchema.variable].value!, itemValue?.value)+ newValues[formSchema.variable]!.value = correctInitialData(formSchema.type, newValues[formSchema.variable]!.value!, itemValue?.value)})}else {diff --git a/web/app/components/tools/workflow-tool/__tests__/configure-button.spec.tsx b/web/app/components/tools/workflow-tool/__tests__/configure-button.spec.tsxindex 5deed8174da..8240def4859 100644--- a/web/app/components/tools/workflow-tool/__tests__/configure-button.spec.tsx+++ b/web/app/components/tools/workflow-tool/__tests__/configure-button.spec.tsx@@ -263,7 +263,8 @@ describe('WorkflowToolConfigureButton', () => {render(<WorkflowToolConfigureButton {...props} />)// Assert- expect(screen.getByText('workflow.common.workflowAsTool')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('workflow.common.workflowAsTool'))!.toBeInTheDocument()})it('should render configure required badge when not published', () => {@@ -274,7 +275,8 @@ describe('WorkflowToolConfigureButton', () => {render(<WorkflowToolConfigureButton {...props} />)// Assert- expect(screen.getByText('workflow.common.configureRequired')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('workflow.common.configureRequired'))!.toBeInTheDocument()})it('should not render configure required badge when published', async () => {@@ -299,7 +301,7 @@ describe('WorkflowToolConfigureButton', () => {// Assertconst container = document.querySelector('.cursor-not-allowed')- expect(container).toBeInTheDocument()+ expect(container)!.toBeInTheDocument()})it('should render disabledReason when provided', () => {@@ -312,7 +314,8 @@ describe('WorkflowToolConfigureButton', () => {render(<WorkflowToolConfigureButton {...props} />)// Assert- expect(screen.getByText('Please save the workflow first')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('Please save the workflow first'))!.toBeInTheDocument()})it('should render loading state when published and fetching details', () => {@@ -325,7 +328,7 @@ describe('WorkflowToolConfigureButton', () => {// Assertconst loadingElement = document.querySelector('.pt-2')- expect(loadingElement).toBeInTheDocument()+ expect(loadingElement)!.toBeInTheDocument()})it('should render configure and manage buttons when published', async () => {@@ -337,8 +340,8 @@ describe('WorkflowToolConfigureButton', () => {// Assertawait waitFor(() => {- expect(screen.getByText('workflow.common.configure')).toBeInTheDocument()- expect(screen.getByText('workflow.common.manageInTools')).toBeInTheDocument()+ expect(screen.getByText('workflow.common.configure'))!.toBeInTheDocument()+ expect(screen.getByText('workflow.common.manageInTools'))!.toBeInTheDocument()})})@@ -352,7 +355,7 @@ describe('WorkflowToolConfigureButton', () => {// Assertconst textElement = screen.getByText('workflow.common.workflowAsTool')- expect(textElement).toHaveClass('text-text-tertiary')+ expect(textElement)!.toHaveClass('text-text-tertiary')})})@@ -405,7 +408,7 @@ describe('WorkflowToolConfigureButton', () => {// Assertawait waitFor(() => {- expect(screen.getByTestId('drawer')).toBeInTheDocument()+ expect(screen.getByTestId('drawer'))!.toBeInTheDocument()})})@@ -420,6 +423,37 @@ describe('WorkflowToolConfigureButton', () => {const triggerArea = screen.getByText('workflow.common.workflowAsTool').closest('.flex')await user.click(triggerArea!)+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert// Assertexpect(screen.queryByTestId('drawer')).not.toBeInTheDocument()})@@ -433,13 +467,44 @@ describe('WorkflowToolConfigureButton', () => {render(<WorkflowToolConfigureButton {...props} />)await waitFor(() => {- expect(screen.getByText('workflow.common.configure')).toBeInTheDocument()+ expect(screen.getByText('workflow.common.configure'))!.toBeInTheDocument()})// Click the main area (should not open modal)const mainArea = screen.getByText('workflow.common.workflowAsTool').closest('.flex')await user.click(mainArea!)+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click+ // Should not open modal from main click// Should not open modal from main clickexpect(screen.queryByTestId('drawer')).not.toBeInTheDocument()@@ -448,7 +513,7 @@ describe('WorkflowToolConfigureButton', () => {// Assertawait waitFor(() => {- expect(screen.getByTestId('drawer')).toBeInTheDocument()+ expect(screen.getByTestId('drawer'))!.toBeInTheDocument()})})})@@ -464,7 +529,7 @@ describe('WorkflowToolConfigureButton', () => {render(<WorkflowToolConfigureButton {...props} />)await waitFor(() => {- expect(screen.getByText('workflow.common.manageInTools')).toBeInTheDocument()+ expect(screen.getByText('workflow.common.manageInTools'))!.toBeInTheDocument()})await user.click(screen.getByText('workflow.common.manageInTools'))@@ -495,7 +560,8 @@ describe('WorkflowToolConfigureButton', () => {})// Assert - should not crash- expect(screen.getByText('workflow.common.workflowAsTool')).toBeInTheDocument()+ // Assert - should not crash+ expect(screen.getByText('workflow.common.workflowAsTool'))!.toBeInTheDocument()})it('should handle paragraph type input conversion', async () => {@@ -513,7 +579,7 @@ describe('WorkflowToolConfigureButton', () => {// Assert - should render without errorawait waitFor(() => {- expect(screen.getByTestId('drawer')).toBeInTheDocument()+ expect(screen.getByTestId('drawer'))!.toBeInTheDocument()})})})@@ -545,7 +611,7 @@ describe('WorkflowToolConfigureButton', () => {// Assertawait waitFor(() => {const configureButton = screen.getByText('workflow.common.configure')- expect(configureButton).toBeDisabled()+ expect(configureButton)!.toBeDisabled()})})})@@ -574,7 +640,8 @@ describe('WorkflowToolAsModal', () => {render(<WorkflowToolAsModal {...props} />)// Assert- expect(screen.getByTestId('drawer-title')).toHaveTextContent('workflow.common.workflowAsTool')+ // Assert+ expect(screen.getByTestId('drawer-title'))!.toHaveTextContent('workflow.common.workflowAsTool')})it('should render name input field', () => {@@ -589,7 +656,8 @@ describe('WorkflowToolAsModal', () => {render(<WorkflowToolAsModal {...props} />)// Assert- expect(screen.getByPlaceholderText('tools.createTool.toolNamePlaceHolder')).toBeInTheDocument()+ // Assert+ expect(screen.getByPlaceholderText('tools.createTool.toolNamePlaceHolder'))!.toBeInTheDocument()})it('should render name for tool call input', () => {@@ -604,7 +672,8 @@ describe('WorkflowToolAsModal', () => {render(<WorkflowToolAsModal {...props} />)// Assert- expect(screen.getByPlaceholderText('tools.createTool.nameForToolCallPlaceHolder')).toBeInTheDocument()+ // Assert+ expect(screen.getByPlaceholderText('tools.createTool.nameForToolCallPlaceHolder'))!.toBeInTheDocument()})it('should render description textarea', () => {@@ -619,7 +688,8 @@ describe('WorkflowToolAsModal', () => {render(<WorkflowToolAsModal {...props} />)// Assert- expect(screen.getByPlaceholderText('tools.createTool.descriptionPlaceholder')).toBeInTheDocument()+ // Assert+ expect(screen.getByPlaceholderText('tools.createTool.descriptionPlaceholder'))!.toBeInTheDocument()})it('should render tool input table', () => {@@ -634,7 +704,8 @@ describe('WorkflowToolAsModal', () => {render(<WorkflowToolAsModal {...props} />)// Assert- expect(screen.getByText('tools.createTool.toolInput.title')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('tools.createTool.toolInput.title'))!.toBeInTheDocument()})it('should render tool output table', () => {@@ -649,7 +720,8 @@ describe('WorkflowToolAsModal', () => {render(<WorkflowToolAsModal {...props} />)// Assert- expect(screen.getByText('tools.createTool.toolOutput.title')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('tools.createTool.toolOutput.title'))!.toBeInTheDocument()})it('should render reserved output parameters', () => {@@ -664,9 +736,10 @@ describe('WorkflowToolAsModal', () => {render(<WorkflowToolAsModal {...props} />)// Assert- expect(screen.getByText('text')).toBeInTheDocument()- expect(screen.getByText('files')).toBeInTheDocument()- expect(screen.getByText('json')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('text'))!.toBeInTheDocument()+ expect(screen.getByText('files'))!.toBeInTheDocument()+ expect(screen.getByText('json'))!.toBeInTheDocument()})it('should render label selector', () => {@@ -681,7 +754,8 @@ describe('WorkflowToolAsModal', () => {render(<WorkflowToolAsModal {...props} />)// Assert- expect(screen.getByTestId('label-selector')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('label-selector'))!.toBeInTheDocument()})it('should render privacy policy input', () => {@@ -696,7 +770,8 @@ describe('WorkflowToolAsModal', () => {render(<WorkflowToolAsModal {...props} />)// Assert- expect(screen.getByPlaceholderText('tools.createTool.privacyPolicyPlaceholder')).toBeInTheDocument()+ // Assert+ expect(screen.getByPlaceholderText('tools.createTool.privacyPolicyPlaceholder'))!.toBeInTheDocument()})it('should render delete button when editing and onRemove provided', () => {@@ -712,7 +787,8 @@ describe('WorkflowToolAsModal', () => {render(<WorkflowToolAsModal {...props} />)// Assert- expect(screen.getByText('common.operation.delete')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('common.operation.delete'))!.toBeInTheDocument()})it('should not render delete button when adding', () => {@@ -727,6 +803,37 @@ describe('WorkflowToolAsModal', () => {// Actrender(<WorkflowToolAsModal {...props} />)+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert// Assertexpect(screen.queryByText('common.operation.delete')).not.toBeInTheDocument()})@@ -751,9 +858,10 @@ describe('WorkflowToolAsModal', () => {render(<WorkflowToolAsModal {...props} />)// Assert- expect(screen.getByDisplayValue('Custom Label')).toBeInTheDocument()- expect(screen.getByDisplayValue('custom_name')).toBeInTheDocument()- expect(screen.getByDisplayValue('Custom description')).toBeInTheDocument()+ // Assert+ expect(screen.getByDisplayValue('Custom Label'))!.toBeInTheDocument()+ expect(screen.getByDisplayValue('custom_name'))!.toBeInTheDocument()+ expect(screen.getByDisplayValue('Custom description'))!.toBeInTheDocument()})it('should pass labels to label selector', () => {@@ -769,7 +877,8 @@ describe('WorkflowToolAsModal', () => {render(<WorkflowToolAsModal {...props} />)// Assert- expect(screen.getByTestId('label-values')).toHaveTextContent('tag1,tag2')+ // Assert+ expect(screen.getByTestId('label-values'))!.toHaveTextContent('tag1,tag2')})})@@ -790,7 +899,8 @@ describe('WorkflowToolAsModal', () => {await user.type(labelInput, 'New Label')// Assert- expect(labelInput).toHaveValue('New Label')+ // Assert+ expect(labelInput)!.toHaveValue('New Label')})it('should update name state on input change', async () => {@@ -808,7 +918,8 @@ describe('WorkflowToolAsModal', () => {await user.type(nameInput, 'new_name')// Assert- expect(nameInput).toHaveValue('new_name')+ // Assert+ expect(nameInput)!.toHaveValue('new_name')})it('should update description state on textarea change', async () => {@@ -826,7 +937,8 @@ describe('WorkflowToolAsModal', () => {await user.type(descInput, 'New description')// Assert- expect(descInput).toHaveValue('New description')+ // Assert+ expect(descInput)!.toHaveValue('New description')})it('should show emoji picker on icon click', async () => {@@ -844,7 +956,8 @@ describe('WorkflowToolAsModal', () => {await user.click(iconButton)// Assert- expect(screen.getByTestId('emoji-picker')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('emoji-picker'))!.toBeInTheDocument()})it('should update emoji on selection', async () => {@@ -868,8 +981,8 @@ describe('WorkflowToolAsModal', () => {// Assertconst updatedIcon = screen.getByTestId('app-icon')- expect(updatedIcon).toHaveAttribute('data-icon', '🚀')- expect(updatedIcon).toHaveAttribute('data-background', '#f0f0f0')+ expect(updatedIcon)!.toHaveAttribute('data-icon', '🚀')+ expect(updatedIcon)!.toHaveAttribute('data-background', '#f0f0f0')})it('should close emoji picker on close button', async () => {@@ -887,10 +1000,41 @@ describe('WorkflowToolAsModal', () => {const iconButton = screen.getByTestId('app-icon')await user.click(iconButton)- expect(screen.getByTestId('emoji-picker')).toBeInTheDocument()+ expect(screen.getByTestId('emoji-picker'))!.toBeInTheDocument()await user.click(screen.getByTestId('close-emoji-picker'))+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert// Assertexpect(screen.queryByTestId('emoji-picker')).not.toBeInTheDocument()})@@ -909,7 +1053,8 @@ describe('WorkflowToolAsModal', () => {await user.click(screen.getByTestId('add-label'))// Assert- expect(screen.getByTestId('label-values')).toHaveTextContent('initial,new-label')+ // Assert+ expect(screen.getByTestId('label-values'))!.toHaveTextContent('initial,new-label')})it('should update privacy policy on input change', async () => {@@ -927,7 +1072,8 @@ describe('WorkflowToolAsModal', () => {await user.type(privacyInput, 'https://example.com/privacy')// Assert- expect(privacyInput).toHaveValue('https://example.com/privacy')+ // Assert+ expect(privacyInput)!.toHaveValue('https://example.com/privacy')})})@@ -1025,7 +1171,8 @@ describe('WorkflowToolAsModal', () => {await user.click(screen.getByText('common.operation.save'))// Assert- expect(screen.getByText('tools.createTool.confirmTitle')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('tools.createTool.confirmTitle'))!.toBeInTheDocument()})it('should call onSave after confirm in edit mode', async () => {@@ -1073,7 +1220,8 @@ describe('WorkflowToolAsModal', () => {await user.type(descInput, 'New parameter description')// Assert- expect(descInput).toHaveValue('New parameter description')+ // Assert+ expect(descInput)!.toHaveValue('New parameter description')})})@@ -1136,7 +1284,8 @@ describe('WorkflowToolAsModal', () => {await user.type(nameInput, 'invalid name with spaces')// Assert- expect(screen.getByText('tools.createTool.nameForToolCallTip')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('tools.createTool.nameForToolCallTip'))!.toBeInTheDocument()})it('should accept valid name format', async () => {@@ -1153,6 +1302,37 @@ describe('WorkflowToolAsModal', () => {const nameInput = screen.getByPlaceholderText('tools.createTool.nameForToolCallPlaceHolder')await user.type(nameInput, 'valid_name_123')+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert+ // Assert// Assertexpect(screen.queryByText('tools.createTool.nameForToolCallTip')).not.toBeInTheDocument()})@@ -1204,7 +1384,8 @@ describe('WorkflowToolAsModal', () => {render(<WorkflowToolAsModal {...props} />)// Assert - __image should show method as text, not selector- expect(screen.getByText('tools.createTool.toolInput.methodParameter')).toBeInTheDocument()+ // Assert - __image should show method as text, not selector+ expect(screen.getByText('tools.createTool.toolInput.methodParameter'))!.toBeInTheDocument()})it('should show warning for reserved output parameter name collision', () => {@@ -1245,7 +1426,7 @@ describe('WorkflowToolAsModal', () => {// Show confirm modalawait waitFor(() => {- expect(screen.getByText('tools.createTool.confirmTitle')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.confirmTitle'))!.toBeInTheDocument()})// Assert - should not crash@@ -1282,12 +1463,12 @@ describe('WorkflowToolAsModal', () => {await user.click(screen.getByText('common.operation.save'))await waitFor(() => {- expect(screen.getByText('tools.createTool.confirmTitle')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.confirmTitle'))!.toBeInTheDocument()})// Click cancel in confirm modalconst cancelButtons = screen.getAllByText('common.operation.cancel')- await user.click(cancelButtons[cancelButtons.length - 1])+ await user.click(cancelButtons[cancelButtons.length - 1]!)// Assertawait waitFor(() => {@@ -1319,7 +1500,8 @@ describe('MethodSelector', () => {render(<MethodSelector {...props} />)// Assert- expect(screen.getByTestId('portal-trigger')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('portal-trigger'))!.toBeInTheDocument()})it('should display parameter method text when value is llm', () => {@@ -1333,7 +1515,8 @@ describe('MethodSelector', () => {render(<MethodSelector {...props} />)// Assert- expect(screen.getByText('tools.createTool.toolInput.methodParameter')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('tools.createTool.toolInput.methodParameter'))!.toBeInTheDocument()})it('should display setting method text when value is form', () => {@@ -1347,7 +1530,8 @@ describe('MethodSelector', () => {render(<MethodSelector {...props} />)// Assert- expect(screen.getByText('tools.createTool.toolInput.methodSetting')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('tools.createTool.toolInput.methodSetting'))!.toBeInTheDocument()})it('should display setting method text when value is undefined', () => {@@ -1361,7 +1545,8 @@ describe('MethodSelector', () => {render(<MethodSelector {...props} />)// Assert- expect(screen.getByText('tools.createTool.toolInput.methodSetting')).toBeInTheDocument()+ // Assert+ expect(screen.getByText('tools.createTool.toolInput.methodSetting'))!.toBeInTheDocument()})})@@ -1380,7 +1565,8 @@ describe('MethodSelector', () => {await user.click(screen.getByTestId('portal-trigger'))// Assert- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ // Assert+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()})it('should call onChange with llm when parameter option clicked', async () => {@@ -1397,7 +1583,7 @@ describe('MethodSelector', () => {await user.click(screen.getByTestId('portal-trigger'))const paramOption = screen.getAllByText('tools.createTool.toolInput.methodParameter')[0]- await user.click(paramOption)+ await user.click(paramOption!)// Assertexpect(onChange).toHaveBeenCalledWith('llm')@@ -1436,7 +1622,7 @@ describe('MethodSelector', () => {// First click - openawait user.click(screen.getByTestId('portal-trigger'))- expect(screen.getByTestId('portal-content')).toBeInTheDocument()+ expect(screen.getByTestId('portal-content'))!.toBeInTheDocument()// Second click - closeawait user.click(screen.getByTestId('portal-trigger'))@@ -1460,7 +1646,7 @@ describe('MethodSelector', () => {// Assert - the first option (llm) should have a check icon containerconst content = screen.getByTestId('portal-content')- expect(content).toBeInTheDocument()+ expect(content)!.toBeInTheDocument()})it('should show check icon for selected form value', async () => {@@ -1477,7 +1663,7 @@ describe('MethodSelector', () => {// Assertconst content = screen.getByTestId('portal-content')- expect(content).toBeInTheDocument()+ expect(content)!.toBeInTheDocument()})})@@ -1498,7 +1684,8 @@ describe('MethodSelector', () => {rerender(<MethodSelector {...props} value="form" />)// Assert - should not crash- expect(screen.getByText('tools.createTool.toolInput.methodSetting')).toBeInTheDocument()+ // Assert - should not crash+ expect(screen.getByText('tools.createTool.toolInput.methodSetting'))!.toBeInTheDocument()})it('should handle empty string value', () => {@@ -1545,7 +1732,7 @@ describe('Integration Tests', () => {await user.click(triggerArea!)await waitFor(() => {- expect(screen.getByTestId('drawer')).toBeInTheDocument()+ expect(screen.getByTestId('drawer'))!.toBeInTheDocument()})// Fill form@@ -1594,14 +1781,14 @@ describe('Integration Tests', () => {// Wait for detail to loadawait waitFor(() => {- expect(screen.getByText('workflow.common.configure')).toBeInTheDocument()+ expect(screen.getByText('workflow.common.configure'))!.toBeInTheDocument()})// Open modalawait user.click(screen.getByText('workflow.common.configure'))await waitFor(() => {- expect(screen.getByTestId('drawer')).toBeInTheDocument()+ expect(screen.getByTestId('drawer'))!.toBeInTheDocument()})// Modify description@@ -1614,7 +1801,7 @@ describe('Integration Tests', () => {// Confirmawait waitFor(() => {- expect(screen.getByText('tools.createTool.confirmTitle')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.confirmTitle'))!.toBeInTheDocument()})await user.click(screen.getByText('common.operation.confirm'))@@ -1643,7 +1830,8 @@ describe('Integration Tests', () => {rerender(<WorkflowToolConfigureButton {...props} />)// Assert - component should not crash and callbacks should be stable- expect(screen.getByText('workflow.common.workflowAsTool')).toBeInTheDocument()+ // Assert - component should not crash and callbacks should be stable+ expect(screen.getByText('workflow.common.workflowAsTool'))!.toBeInTheDocument()})})})diff --git a/web/app/components/tools/workflow-tool/__tests__/method-selector.spec.tsx b/web/app/components/tools/workflow-tool/__tests__/method-selector.spec.tsxindex 4379bec0355..d1126bf7628 100644--- a/web/app/components/tools/workflow-tool/__tests__/method-selector.spec.tsx+++ b/web/app/components/tools/workflow-tool/__tests__/method-selector.spec.tsx@@ -26,26 +26,28 @@ describe('MethodSelector', () => {renderComponent()// Should display the current method text- expect(screen.getByText('tools.createTool.toolInput.methodParameter')).toBeInTheDocument()+ // Should display the current method text+ expect(screen.getByText('tools.createTool.toolInput.methodParameter'))!.toBeInTheDocument()})it('should render with llm value selected', () => {renderComponent({ value: 'llm' })- expect(screen.getByText('tools.createTool.toolInput.methodParameter')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.toolInput.methodParameter'))!.toBeInTheDocument()})it('should render with form value selected', () => {renderComponent({ value: 'form' })- expect(screen.getByText('tools.createTool.toolInput.methodSetting')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.toolInput.methodSetting'))!.toBeInTheDocument()})it('should render with undefined value', () => {renderComponent({ value: undefined })// When value is undefined, it should show the form method text (else branch)- expect(screen.getByText('tools.createTool.toolInput.methodSetting')).toBeInTheDocument()+ // When value is undefined, it should show the form method text (else branch)+ expect(screen.getByText('tools.createTool.toolInput.methodSetting'))!.toBeInTheDocument()})it('should render arrow down icon', () => {@@ -53,7 +55,7 @@ describe('MethodSelector', () => {// The arrow icon is rendered with remixiconconst arrowIcon = document.querySelector('.remixicon')- expect(arrowIcon).toBeInTheDocument()+ expect(arrowIcon)!.toBeInTheDocument()})})@@ -62,19 +64,19 @@ describe('MethodSelector', () => {it('should display methodParameter when value is llm', () => {renderComponent({ value: 'llm' })- expect(screen.getByText('tools.createTool.toolInput.methodParameter')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.toolInput.methodParameter'))!.toBeInTheDocument()})it('should display methodSetting when value is form', () => {renderComponent({ value: 'form' })- expect(screen.getByText('tools.createTool.toolInput.methodSetting')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.toolInput.methodSetting'))!.toBeInTheDocument()})it('should handle empty string value as non-llm', () => {renderComponent({ value: '' })- expect(screen.getByText('tools.createTool.toolInput.methodSetting')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.toolInput.methodSetting'))!.toBeInTheDocument()})})@@ -90,8 +92,8 @@ describe('MethodSelector', () => {// Dropdown should now show both options with tipsawait waitFor(() => {- expect(screen.getByText('tools.createTool.toolInput.methodParameterTip')).toBeInTheDocument()- expect(screen.getByText('tools.createTool.toolInput.methodSettingTip')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.toolInput.methodParameterTip'))!.toBeInTheDocument()+ expect(screen.getByText('tools.createTool.toolInput.methodSettingTip'))!.toBeInTheDocument()})})@@ -106,12 +108,12 @@ describe('MethodSelector', () => {// Wait for dropdown to openawait waitFor(() => {- expect(screen.getByText('tools.createTool.toolInput.methodParameterTip')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.toolInput.methodParameterTip'))!.toBeInTheDocument()})// Click the llm option (by finding the method parameter option in dropdown)const llmOption = screen.getAllByText('tools.createTool.toolInput.methodParameter')[0]- await user.click(llmOption)+ await user.click(llmOption!)expect(onChange).toHaveBeenCalledWith('llm')})@@ -127,12 +129,12 @@ describe('MethodSelector', () => {// Wait for dropdown to openawait waitFor(() => {- expect(screen.getByText('tools.createTool.toolInput.methodSettingTip')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.toolInput.methodSettingTip'))!.toBeInTheDocument()})// Click the form option (by finding the method setting option in dropdown)const formOption = screen.getAllByText('tools.createTool.toolInput.methodSetting')[0]- await user.click(formOption)+ await user.click(formOption!)expect(onChange).toHaveBeenCalledWith('form')})@@ -146,7 +148,7 @@ describe('MethodSelector', () => {// First click - openawait user.click(trigger)await waitFor(() => {- expect(screen.getByText('tools.createTool.toolInput.methodParameterTip')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.toolInput.methodParameterTip'))!.toBeInTheDocument()})// Second click - close@@ -163,7 +165,7 @@ describe('MethodSelector', () => {renderComponent()const trigger = document.querySelector('.hover\\:bg-background-section-burn')- expect(trigger).toBeInTheDocument()+ expect(trigger)!.toBeInTheDocument()})it('should apply open state styles when dropdown is open', async () => {@@ -175,7 +177,7 @@ describe('MethodSelector', () => {await waitFor(() => {const openTrigger = document.querySelector('.bg-background-section-burn\\!')- expect(openTrigger).toBeInTheDocument()+ expect(openTrigger)!.toBeInTheDocument()})})@@ -189,7 +191,7 @@ describe('MethodSelector', () => {await waitFor(() => {// Check icon should be visible for llm optionconst checkIcon = document.querySelector('.text-text-accent')- expect(checkIcon).toBeInTheDocument()+ expect(checkIcon)!.toBeInTheDocument()})})@@ -203,7 +205,7 @@ describe('MethodSelector', () => {await waitFor(() => {// Check icon should be visible for form optionconst checkIcon = document.querySelector('.text-text-accent')- expect(checkIcon).toBeInTheDocument()+ expect(checkIcon)!.toBeInTheDocument()})})})@@ -219,8 +221,9 @@ describe('MethodSelector', () => {await waitFor(() => {// Should show both option titles and descriptions- expect(screen.getByText('tools.createTool.toolInput.methodParameterTip')).toBeInTheDocument()- expect(screen.getByText('tools.createTool.toolInput.methodSettingTip')).toBeInTheDocument()+ // Should show both option titles and descriptions+ expect(screen.getByText('tools.createTool.toolInput.methodParameterTip'))!.toBeInTheDocument()+ expect(screen.getByText('tools.createTool.toolInput.methodSettingTip'))!.toBeInTheDocument()})})@@ -233,9 +236,9 @@ describe('MethodSelector', () => {await waitFor(() => {const dropdown = document.querySelector('.w-\\[320px\\]')- expect(dropdown).toBeInTheDocument()- expect(dropdown).toHaveClass('rounded-lg')- expect(dropdown).toHaveClass('shadow-lg')+ expect(dropdown)!.toBeInTheDocument()+ expect(dropdown)!.toHaveClass('rounded-lg')+ expect(dropdown)!.toHaveClass('shadow-lg')})})@@ -267,7 +270,8 @@ describe('MethodSelector', () => {await user.click(trigger)// Should not crash and should be in a consistent state- expect(trigger).toBeInTheDocument()+ // Should not crash and should be in a consistent state+ expect(trigger)!.toBeInTheDocument()})it('should handle selecting the already selected value', async () => {@@ -279,12 +283,12 @@ describe('MethodSelector', () => {await user.click(trigger)await waitFor(() => {- expect(screen.getByText('tools.createTool.toolInput.methodParameterTip')).toBeInTheDocument()+ expect(screen.getByText('tools.createTool.toolInput.methodParameterTip'))!.toBeInTheDocument()})// Click the llm option in the dropdown (the one with the tip text nearby)const llmOptionContainer = screen.getByText('tools.createTool.toolInput.methodParameterTip').closest('.cursor-pointer')- expect(llmOptionContainer).toBeInTheDocument()+ expect(llmOptionContainer)!.toBeInTheDocument()await user.click(llmOptionContainer!)// Should call onChange@@ -298,7 +302,7 @@ describe('MethodSelector', () => {renderComponent()const trigger = document.querySelector('.cursor-pointer')- expect(trigger).toBeInTheDocument()+ expect(trigger)!.toBeInTheDocument()})it('should have clickable dropdown options', async () => {diff --git a/web/app/components/tools/workflow-tool/hooks/__tests__/use-configure-button.spec.ts b/web/app/components/tools/workflow-tool/hooks/__tests__/use-configure-button.spec.tsindex ac61872a180..6f9017bbea9 100644--- a/web/app/components/tools/workflow-tool/hooks/__tests__/use-configure-button.spec.ts+++ b/web/app/components/tools/workflow-tool/hooks/__tests__/use-configure-button.spec.ts@@ -150,14 +150,14 @@ describe('isParametersOutdated', () => {it('should return true when paragraph type does not match string', () => {const detail = createMockDetail()- detail.tool.parameters[0].type = 'number'+ detail.tool.parameters[0]!.type = 'number'const inputs = [createMockInputVar({ variable: 'test_var', type: InputVarType.paragraph })]expect(isParametersOutdated(detail, inputs)).toBe(true)})it('should return true when text-input type does not match string', () => {const detail = createMockDetail()- detail.tool.parameters[0].type = 'number'+ detail.tool.parameters[0]!.type = 'number'const inputs = [createMockInputVar({ variable: 'test_var', type: InputVarType.textInput })]expect(isParametersOutdated(detail, inputs)).toBe(true)})@@ -344,7 +344,7 @@ describe('useConfigureButton', () => {inputs: [createMockInputVar({ variable: 'test_var', type: InputVarType.paragraph })],})))- expect(result.current.payload.parameters[0].type).toBe('string')+ expect(result.current.payload.parameters[0]!.type).toBe('string')})})diff --git a/web/app/components/tools/workflow-tool/index.tsx b/web/app/components/tools/workflow-tool/index.tsxindex c9f19891397..fd18bf5fa73 100644--- a/web/app/components/tools/workflow-tool/index.tsx+++ b/web/app/components/tools/workflow-tool/index.tsx@@ -84,9 +84,9 @@ const WorkflowToolAsModal: FC<Props> = ({const handleParameterChange = (key: string, value: string, index: number) => {const newData = produce(parameters, (draft: WorkflowToolProviderParameter[]) => {if (key === 'description')- draft[index].description = value+ draft[index]!.description = valueelse- draft[index].form = value+ draft[index]!.form = value})setParameters(newData)}diff --git a/web/app/components/workflow-app/components/workflow-main.tsx b/web/app/components/workflow-app/components/workflow-main.tsxindex 957344a1daa..6114d7b6573 100644--- a/web/app/components/workflow-app/components/workflow-main.tsx+++ b/web/app/components/workflow-app/components/workflow-main.tsx@@ -102,7 +102,7 @@ const WorkflowMain = ({},enabled: !!(features.file_upload?.enabled || features.file_upload?.image?.enabled),allowed_file_types: features.file_upload?.allowed_file_types || [SupportUploadFileTypes.image],- allowed_file_extensions: features.file_upload?.allowed_file_extensions || FILE_EXTS[SupportUploadFileTypes.image].map(ext => `.${ext}`),+ allowed_file_extensions: features.file_upload?.allowed_file_extensions || FILE_EXTS[SupportUploadFileTypes.image]!.map(ext => `.${ext}`),allowed_file_upload_methods: features.file_upload?.allowed_file_upload_methods || features.file_upload?.image?.transfer_methods || ['local_file', 'remote_url'],number_limits: features.file_upload?.number_limits || features.file_upload?.image?.number_limits || 3,},diff --git a/web/app/components/workflow-app/hooks/__tests__/use-workflow-template.spec.ts b/web/app/components/workflow-app/hooks/__tests__/use-workflow-template.spec.tsindex 5d492a3b354..3e9934df745 100644--- a/web/app/components/workflow-app/hooks/__tests__/use-workflow-template.spec.ts+++ b/web/app/components/workflow-app/hooks/__tests__/use-workflow-template.spec.ts@@ -65,15 +65,15 @@ describe('useWorkflowTemplate', () => {},])expect(generateNewNodeCalls).toHaveLength(3)- expect(generateNewNodeCalls[0].data).toMatchObject({+ expect(generateNewNodeCalls[0]!.data).toMatchObject({type: 'start',title: 'workflow.blocks.start',})- expect(generateNewNodeCalls[1].data).toMatchObject({+ expect(generateNewNodeCalls[1]!.data).toMatchObject({type: 'llm',title: 'workflow.blocks.llm',})- expect(generateNewNodeCalls[2].data).toMatchObject({+ expect(generateNewNodeCalls[2]!.data).toMatchObject({type: 'answer',title: 'workflow.blocks.answer',answer: '{{#llm.text#}}',diff --git a/web/app/components/workflow-app/utils.ts b/web/app/components/workflow-app/utils.tsindex 1284c612ef0..df344e333b4 100644--- a/web/app/components/workflow-app/utils.ts+++ b/web/app/components/workflow-app/utils.ts@@ -88,7 +88,7 @@ export const buildInitialFeatures = (},enabled: !!(fileUpload?.enabled || imageUpload?.enabled),allowed_file_types: fileUpload?.allowed_file_types || [SupportUploadFileTypes.image],- allowed_file_extensions: fileUpload?.allowed_file_extensions || FILE_EXTS[SupportUploadFileTypes.image].map(ext => `.${ext}`),+ allowed_file_extensions: fileUpload?.allowed_file_extensions || FILE_EXTS[SupportUploadFileTypes.image]!.map(ext => `.${ext}`),allowed_file_upload_methods: fileUpload?.allowed_file_upload_methods || imageUpload?.transfer_methods || [TransferMethod.local_file, TransferMethod.remote_url],number_limits: fileUpload?.number_limits || imageUpload?.number_limits || 3,fileUploadConfig: fileUploadConfigResponse,diff --git a/web/app/components/workflow/__tests__/candidate-node-main.spec.tsx b/web/app/components/workflow/__tests__/candidate-node-main.spec.tsxindex 61e5410aac6..2e465c6df2c 100644--- a/web/app/components/workflow/__tests__/candidate-node-main.spec.tsx+++ b/web/app/components/workflow/__tests__/candidate-node-main.spec.tsx@@ -154,8 +154,8 @@ describe('CandidateNodeMain', () => {const { container } = render(<CandidateNodeMain candidateNode={candidateNode} />)- expect(screen.getByTestId('candidate-custom-node')).toHaveTextContent('candidate-webhook')- expect(container.firstChild).toHaveStyle({+ expect(screen.getByTestId('candidate-custom-node'))!.toHaveTextContent('candidate-webhook')+ expect(container.firstChild)!.toHaveStyle({left: '30px',top: '40px',transform: 'scale(1.5)',@@ -193,7 +193,7 @@ describe('CandidateNodeMain', () => {render(<CandidateNodeMain candidateNode={candidateNode} />)- expect(screen.getByTestId('candidate-note-node')).toHaveTextContent('candidate-note')+ expect(screen.getByTestId('candidate-note-node'))!.toHaveTextContent('candidate-note')eventHandlers.click?.({ preventDefault: vi.fn() })@@ -225,7 +225,7 @@ describe('CandidateNodeMain', () => {eventHandlers.click?.({ preventDefault: vi.fn() })expect(mockGetIterationStartNode).toHaveBeenCalledWith('candidate-iteration')- expect(mockSetNodes.mock.calls[0][0]).toEqual(expect.arrayContaining([+ expect(mockSetNodes.mock.calls[0]![0]).toEqual(expect.arrayContaining([expect.objectContaining({ id: 'candidate-iteration' }),expect.objectContaining({ id: 'iteration-start' }),]))@@ -234,7 +234,7 @@ describe('CandidateNodeMain', () => {eventHandlers.click?.({ preventDefault: vi.fn() })expect(mockGetLoopStartNode).toHaveBeenCalledWith('candidate-loop')- expect(mockSetNodes.mock.calls[1][0]).toEqual(expect.arrayContaining([+ expect(mockSetNodes.mock.calls[1]![0]).toEqual(expect.arrayContaining([expect.objectContaining({ id: 'candidate-loop' }),expect.objectContaining({ id: 'loop-start' }),]))diff --git a/web/app/components/workflow/__tests__/custom-edge-linear-gradient-render.spec.tsx b/web/app/components/workflow/__tests__/custom-edge-linear-gradient-render.spec.tsxindex 973dfacbc80..0b406dac944 100644--- a/web/app/components/workflow/__tests__/custom-edge-linear-gradient-render.spec.tsx+++ b/web/app/components/workflow/__tests__/custom-edge-linear-gradient-render.spec.tsx@@ -20,12 +20,12 @@ describe('CustomEdgeLinearGradientRender', () => {)const gradient = container.querySelector('linearGradient')- expect(gradient).toHaveAttribute('id', 'edge-gradient')- expect(gradient).toHaveAttribute('gradientUnits', 'userSpaceOnUse')- expect(gradient).toHaveAttribute('x1', '10')- expect(gradient).toHaveAttribute('y1', '20')- expect(gradient).toHaveAttribute('x2', '30')- expect(gradient).toHaveAttribute('y2', '40')+ expect(gradient)!.toHaveAttribute('id', 'edge-gradient')+ expect(gradient)!.toHaveAttribute('gradientUnits', 'userSpaceOnUse')+ expect(gradient)!.toHaveAttribute('x1', '10')+ expect(gradient)!.toHaveAttribute('y1', '20')+ expect(gradient)!.toHaveAttribute('x2', '30')+ expect(gradient)!.toHaveAttribute('y2', '40')})it('should render start and stop colors at both ends of the gradient', () => {@@ -47,11 +47,11 @@ describe('CustomEdgeLinearGradientRender', () => {const stops = container.querySelectorAll('stop')expect(stops).toHaveLength(2)- expect(stops[0]).toHaveAttribute('offset', '0%')- expect(stops[0].getAttribute('style')).toContain('stop-color: #111111')- expect(stops[0].getAttribute('style')).toContain('stop-opacity: 1')- expect(stops[1]).toHaveAttribute('offset', '100%')- expect(stops[1].getAttribute('style')).toContain('stop-color: #222222')- expect(stops[1].getAttribute('style')).toContain('stop-opacity: 1')+ expect(stops[0])!.toHaveAttribute('offset', '0%')+ expect(stops[0]!.getAttribute('style')).toContain('stop-color: #111111')+ expect(stops[0]!.getAttribute('style')).toContain('stop-opacity: 1')+ expect(stops[1])!.toHaveAttribute('offset', '100%')+ expect(stops[1]!.getAttribute('style')).toContain('stop-color: #222222')+ expect(stops[1]!.getAttribute('style')).toContain('stop-opacity: 1')})})diff --git a/web/app/components/workflow/__tests__/edge-contextmenu.spec.tsx b/web/app/components/workflow/__tests__/edge-contextmenu.spec.tsxindex 7156495a59d..5767409dbe2 100644--- a/web/app/components/workflow/__tests__/edge-contextmenu.spec.tsx+++ b/web/app/components/workflow/__tests__/edge-contextmenu.spec.tsx@@ -218,14 +218,14 @@ describe('EdgeContextmenu', () => {})const deleteAction = await screen.findByRole('menuitem', { name: /common:operation\.delete/i })- expect(screen.getByText(/^del$/i)).toBeInTheDocument()+ expect(screen.getByText(/^del$/i))!.toBeInTheDocument()await user.click(deleteAction)await waitFor(() => {expect(latestEdges).toHaveLength(1)- expect(latestEdges[0].id).toBe('e1')- expect(latestEdges[0].selected).toBe(true)+ expect(latestEdges[0]!.id).toBe('e1')+ expect(latestEdges[0]!.selected).toBe(true)expect(store.getState().edgeMenu).toBeUndefined()expect(screen.queryByRole('menu')).not.toBeInTheDocument()})@@ -260,8 +260,8 @@ describe('EdgeContextmenu', () => {clientY: 180,})- expect(await screen.findByRole('menu')).toBeInTheDocument()- expect(screen.getByRole('menuitem', { name: /common:operation\.delete/i })).toBeInTheDocument()+ expect(await screen.findByRole('menu'))!.toBeInTheDocument()+ expect(screen.getByRole('menuitem', { name: /common:operation\.delete/i }))!.toBeInTheDocument()expect(fromRectSpy).toHaveBeenLastCalledWith(expect.objectContaining({x: 320,y: 180,@@ -312,7 +312,7 @@ describe('EdgeContextmenu', () => {clientY: 120,})- expect(await screen.findByRole('menu')).toBeInTheDocument()+ expect(await screen.findByRole('menu'))!.toBeInTheDocument()fireEvent.keyDown(document.body, { key })@@ -346,7 +346,7 @@ describe('EdgeContextmenu', () => {clientY: 100,})- expect(await screen.findByRole('menu')).toBeInTheDocument()+ expect(await screen.findByRole('menu'))!.toBeInTheDocument()fireEvent.keyDown(document.body, { key: 'Delete' })@@ -373,7 +373,7 @@ describe('EdgeContextmenu', () => {clientX: 80,clientY: 60,})- expect(await screen.findByRole('menu')).toBeInTheDocument()+ expect(await screen.findByRole('menu'))!.toBeInTheDocument()fireEvent.contextMenu(edgeTwoButton, {clientX: 360,@@ -399,7 +399,7 @@ describe('EdgeContextmenu', () => {clientX: 160,clientY: 100,})- expect(await screen.findByRole('menu')).toBeInTheDocument()+ expect(await screen.findByRole('menu'))!.toBeInTheDocument()fireEvent.click(container.querySelector('button[aria-label="Remove edge e1"]') as HTMLButtonElement)diff --git a/web/app/components/workflow/__tests__/workflow-history-store.spec.tsx b/web/app/components/workflow/__tests__/workflow-history-store.spec.tsxindex 931cd97c024..bc2495748a6 100644--- a/web/app/components/workflow/__tests__/workflow-history-store.spec.tsx+++ b/web/app/components/workflow/__tests__/workflow-history-store.spec.tsx@@ -59,10 +59,10 @@ describe('WorkflowHistoryProvider', () => {</WorkflowHistoryProvider>,)- expect(screen.getByRole('button', { name: 'nodes:1 shortcuts:true' })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'nodes:1 shortcuts:true' }))!.toBeInTheDocument()await user.click(screen.getByRole('button', { name: 'nodes:1 shortcuts:true' }))- expect(screen.getByRole('button', { name: 'nodes:1 shortcuts:false' })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'nodes:1 shortcuts:false' }))!.toBeInTheDocument()})it('sanitizes selected flags when history state is replaced through the exposed store api', () => {@@ -85,8 +85,8 @@ describe('WorkflowHistoryProvider', () => {result.current.store.setState(nextState)- expect(result.current.store.getState().nodes[0].data.selected).toBe(false)- expect(result.current.store.getState().edges[0].selected).toBe(false)+ expect(result.current.store.getState().nodes[0]!.data.selected).toBe(false)+ expect(result.current.store.getState().edges[0]!.selected).toBe(false)})it('throws when consumed outside the provider', () => {diff --git a/web/app/components/workflow/__tests__/workflow-test-env.spec.tsx b/web/app/components/workflow/__tests__/workflow-test-env.spec.tsxindex de13828f2a8..f47da870bb3 100644--- a/web/app/components/workflow/__tests__/workflow-test-env.spec.tsx+++ b/web/app/components/workflow/__tests__/workflow-test-env.spec.tsx@@ -63,14 +63,14 @@ function FlowReader() {describe('renderWorkflowComponent', () => {it('should provide WorkflowContext with default store', () => {renderWorkflowComponent(React.createElement(StoreReader))- expect(screen.getByTestId('store-reader')).toHaveTextContent('no-confirm')+ expect(screen.getByTestId('store-reader'))!.toHaveTextContent('no-confirm')})it('should apply initialStoreState', () => {renderWorkflowComponent(React.createElement(StoreReader), {initialStoreState: { showConfirm: { title: 'Hey', onConfirm: () => {} } },})- expect(screen.getByTestId('store-reader')).toHaveTextContent('has-confirm')+ expect(screen.getByTestId('store-reader'))!.toHaveTextContent('has-confirm')})it('should return a live store that components can mutate', () => {@@ -85,14 +85,14 @@ describe('renderWorkflowComponent', () => {})expect(store.getState().showConfirm).toBeDefined()- expect(screen.getByTestId('store-reader')).toHaveTextContent('has-confirm')+ expect(screen.getByTestId('store-reader'))!.toHaveTextContent('has-confirm')})it('should provide HooksStoreContext when hooksStoreProps given', () => {renderWorkflowComponent(React.createElement(HooksStoreReader), {hooksStoreProps: { configsMap: { flowId: 'test-123', flowType: FlowType.appFlow, fileSettings: {} } },})- expect(screen.getByTestId('hooks-reader')).toHaveTextContent('test-123')+ expect(screen.getByTestId('hooks-reader'))!.toHaveTextContent('test-123')})it('should throw when HooksStoreContext is not provided', () => {@@ -124,7 +124,7 @@ describe('renderWorkflowComponent', () => {describe('renderNodeComponent', () => {it('should render node with default id and selected=false', () => {renderNodeComponent(NodeRenderer, { title: 'Hello' })- expect(screen.getByTestId('node-render')).toHaveTextContent('test-node-1:Hello:nosel')+ expect(screen.getByTestId('node-render'))!.toHaveTextContent('test-node-1:Hello:nosel')})it('should accept custom nodeId and selected', () => {@@ -132,7 +132,7 @@ describe('renderNodeComponent', () => {nodeId: 'custom-42',selected: true,})- expect(screen.getByTestId('node-render')).toHaveTextContent('custom-42:World:sel')+ expect(screen.getByTestId('node-render'))!.toHaveTextContent('custom-42:World:sel')})it('should provide WorkflowContext to node components', () => {@@ -144,7 +144,7 @@ describe('renderNodeComponent', () => {renderNodeComponent(NodeWithStore, {}, {initialStoreState: { controlMode: 'hand' as Shape['controlMode'] },})- expect(screen.getByTestId('node-store')).toHaveTextContent('test-node-1:hand')+ expect(screen.getByTestId('node-store'))!.toHaveTextContent('test-node-1:hand')})})@@ -158,7 +158,7 @@ describe('renderWorkflowFlowComponent', () => {initialStoreState: { showConfirm: { title: 'Hey', onConfirm: () => {} } },})- expect(screen.getByTestId('flow-reader')).toHaveTextContent('2:confirm')+ expect(screen.getByTestId('flow-reader'))!.toHaveTextContent('2:confirm')})})@@ -171,6 +171,6 @@ describe('renderWorkflowFlowHook', () => {})expect(result.current).toHaveLength(1)- expect(result.current[0].id).toBe('flow-1')+ expect(result.current[0]!.id).toBe('flow-1')})})diff --git a/web/app/components/workflow/block-selector/__tests__/index-bar.spec.tsx b/web/app/components/workflow/block-selector/__tests__/index-bar.spec.tsxindex 91b158344b3..cdf2e2afd4b 100644--- a/web/app/components/workflow/block-selector/__tests__/index-bar.spec.tsx+++ b/web/app/components/workflow/block-selector/__tests__/index-bar.spec.tsx@@ -64,10 +64,10 @@ describe('IndexBar', () => {const result = groupItems(items, item => item.label.zh_Hans[0] || item.label.en_US[0] || '')expect(result.letters).toEqual(['J', 'S', 'Z', '#'])- expect(result.groups.J.Builtin).toHaveLength(1)- expect(result.groups.Z[WORKFLOW_GROUP_NAME]).toHaveLength(1)- expect(result.groups.S[DATA_SOURCE_GROUP_NAME]).toHaveLength(1)- expect(result.groups['#'][CUSTOM_GROUP_NAME]).toHaveLength(1)+ expect(result.groups.J!.Builtin).toHaveLength(1)+ expect(result.groups.Z![WORKFLOW_GROUP_NAME]).toHaveLength(1)+ expect(result.groups.S![DATA_SOURCE_GROUP_NAME]).toHaveLength(1)+ expect(result.groups['#']![CUSTOM_GROUP_NAME]).toHaveLength(1)})})diff --git a/web/app/components/workflow/block-selector/__tests__/tabs.spec.tsx b/web/app/components/workflow/block-selector/__tests__/tabs.spec.tsxindex 7e73e1debdf..3ee21f9999c 100644--- a/web/app/components/workflow/block-selector/__tests__/tabs.spec.tsx+++ b/web/app/components/workflow/block-selector/__tests__/tabs.spec.tsx@@ -126,8 +126,8 @@ describe('Tabs', () => {it('should render start content and disabled tab tooltip text', () => {render(<Tabs {...baseProps} />)- expect(screen.getByText('start-content')).toBeInTheDocument()- expect(screen.getByText('workflow.tabs.startDisabledTip')).toBeInTheDocument()+ expect(screen.getByText('start-content'))!.toBeInTheDocument()+ expect(screen.getByText('workflow.tabs.startDisabledTip'))!.toBeInTheDocument()})it('should switch tabs through click handlers and render tools content with normalized icons', () => {@@ -144,10 +144,10 @@ describe('Tabs', () => {fireEvent.click(screen.getByText('Start'))expect(onActiveTabChange).toHaveBeenCalledWith(TabsEnum.Start)- expect(screen.getByText('tools-content')).toBeInTheDocument()- expect(screen.getByText('/console/tool.svg')).toBeInTheDocument()- expect(screen.getByText('featured-on')).toBeInTheDocument()- expect(screen.getByText('featured-idle')).toBeInTheDocument()+ expect(screen.getByText('tools-content'))!.toBeInTheDocument()+ expect(screen.getByText('/console/tool.svg'))!.toBeInTheDocument()+ expect(screen.getByText('featured-on'))!.toBeInTheDocument()+ expect(screen.getByText('featured-idle'))!.toBeInTheDocument()})it('should sync normalized tools into workflow store state', () => {@@ -183,7 +183,7 @@ describe('Tabs', () => {/>,)- expect(screen.getByText('sources-content')).toBeInTheDocument()+ expect(screen.getByText('sources-content'))!.toBeInTheDocument()})it('should keep the previous workflow store state when tool references do not change', () => {@@ -197,7 +197,7 @@ describe('Tabs', () => {workflowTools: mockToolsState.workflowTools,mcpTools: mockToolsState.mcpTools,}- const updateState = mockSetState.mock.calls[0][0] as (state: typeof previousState) => typeof previousState+ const updateState = mockSetState.mock.calls[0]![0] as (state: typeof previousState) => typeof previousStateexpect(updateState(previousState)).toBe(previousState)})@@ -210,9 +210,9 @@ describe('Tabs', () => {render(<Tabs {...baseProps} activeTab={TabsEnum.Tools} />)- expect(screen.getByText('object-icon')).toBeInTheDocument()+ expect(screen.getByText('object-icon'))!.toBeInTheDocument()- const updateState = mockSetState.mock.calls[0][0] as (state: {+ const updateState = mockSetState.mock.calls[0]![0] as (state: {buildInTools?: Array<{ icon: string | Record<string, string>, name: string }>customTools?: Array<{ icon: string | Record<string, string>, name: string }>workflowTools?: Array<{ icon: string | Record<string, string>, name: string }>@@ -242,7 +242,7 @@ describe('Tabs', () => {render(<Tabs {...baseProps} activeTab={TabsEnum.Tools} />)- expect(screen.getByText('tools-content')).toBeInTheDocument()+ expect(screen.getByText('tools-content'))!.toBeInTheDocument()})it('should force start content to render and invalidate built-in tools after featured installs', async () => {@@ -257,7 +257,7 @@ describe('Tabs', () => {await user.click(screen.getByRole('button', { name: 'Install featured tool' }))- expect(screen.getByText('tools-content')).toBeInTheDocument()+ expect(screen.getByText('tools-content'))!.toBeInTheDocument()expect(mockInvalidateBuiltInTools).toHaveBeenCalledTimes(1)})@@ -271,6 +271,6 @@ describe('Tabs', () => {/>,)- expect(screen.getByText('start-content')).toBeInTheDocument()+ expect(screen.getByText('start-content'))!.toBeInTheDocument()})})diff --git a/web/app/components/workflow/block-selector/__tests__/view-type-select.spec.tsx b/web/app/components/workflow/block-selector/__tests__/view-type-select.spec.tsxindex 40e5bacd830..b6a9cb20d7b 100644--- a/web/app/components/workflow/block-selector/__tests__/view-type-select.spec.tsx+++ b/web/app/components/workflow/block-selector/__tests__/view-type-select.spec.tsx@@ -20,8 +20,8 @@ describe('ViewTypeSelect', () => {const [flatOption, treeOption] = getViewOptions(container)- expect(flatOption).toHaveClass('bg-components-segmented-control-item-active-bg')- expect(treeOption).toHaveClass('cursor-pointer')+ expect(flatOption)!.toHaveClass('bg-components-segmented-control-item-active-bg')+ expect(treeOption)!.toHaveClass('cursor-pointer')})it('should call onChange when switching to a different view type', () => {@@ -34,7 +34,7 @@ describe('ViewTypeSelect', () => {)const [, treeOption] = getViewOptions(container)- fireEvent.click(treeOption)+ fireEvent.click(treeOption!)expect(onChange).toHaveBeenCalledWith(ViewType.tree)expect(onChange).toHaveBeenCalledTimes(1)@@ -50,7 +50,7 @@ describe('ViewTypeSelect', () => {)const [, treeOption] = getViewOptions(container)- fireEvent.click(treeOption)+ fireEvent.click(treeOption!)expect(onChange).not.toHaveBeenCalled()})diff --git a/web/app/components/workflow/block-selector/blocks.tsx b/web/app/components/workflow/block-selector/blocks.tsxindex 2425112335f..97792afd922 100644--- a/web/app/components/workflow/block-selector/blocks.tsx+++ b/web/app/components/workflow/block-selector/blocks.tsx@@ -69,7 +69,7 @@ const Blocks = ({const isEmpty = Object.values(groups).every(list => !list.length)const renderGroup = useCallback((classification: BlockClassificationEnum) => {- const list = groups[classification].sort((a, b) => (a.metaData.sort || 0) - (b.metaData.sort || 0))+ const list = groups[classification]!.sort((a, b) => (a.metaData.sort || 0) - (b.metaData.sort || 0))const { getNodes } = store.getState()const nodes = getNodes()const hasKnowledgeBaseNode = nodes.some(node => node.data.type === BlockEnum.KnowledgeBase)diff --git a/web/app/components/workflow/block-selector/data-sources.tsx b/web/app/components/workflow/block-selector/data-sources.tsxindex 71003ed5f3a..447442818a8 100644--- a/web/app/components/workflow/block-selector/data-sources.tsx+++ b/web/app/components/workflow/block-selector/data-sources.tsx@@ -51,7 +51,7 @@ const DataSources = ({return dataSources.filter((toolWithProvider) => {return isMatchingKeywords(toolWithProvider.name, searchText) || toolWithProvider.tools.some((tool) => {- return tool.label[language].toLowerCase().includes(searchText.toLowerCase()) || tool.name.toLowerCase().includes(searchText.toLowerCase())+ return tool.label[language]!.toLowerCase().includes(searchText.toLowerCase()) || tool.name.toLowerCase().includes(searchText.toLowerCase())})})}, [searchText, dataSources, language])diff --git a/web/app/components/workflow/block-selector/index-bar.tsx b/web/app/components/workflow/block-selector/index-bar.tsxindex ec03223238d..7565c087c34 100644--- a/web/app/components/workflow/block-selector/index-bar.tsx+++ b/web/app/components/workflow/block-selector/index-bar.tsx@@ -33,7 +33,7 @@ export const groupItems = (items: ToolWithProvider[], getFirstChar: (item: ToolW// transform Chinese to pinyinif (/[\u4E00-\u9FA5]/.test(firstChar))- letter = pinyin(firstChar, { pattern: 'first', toneType: 'none' })[0].toUpperCase()+ letter = pinyin(firstChar, { pattern: 'first', toneType: 'none' })[0]!.toUpperCase()elseletter = firstChar.toUpperCase()@@ -55,10 +55,10 @@ export const groupItems = (items: ToolWithProvider[], getFirstChar: (item: ToolWelsegroupName = AGENT_GROUP_NAME- if (!acc[letter][groupName])- acc[letter][groupName] = []+ if (!acc[letter]![groupName])+ acc[letter]![groupName] = []- acc[letter][groupName].push(item)+ acc[letter]![groupName]!.push(item)return acc}, {})diff --git a/web/app/components/workflow/block-selector/rag-tool-recommendations/list.tsx b/web/app/components/workflow/block-selector/rag-tool-recommendations/list.tsxindex 87e4863414f..d5873ddc1f1 100644--- a/web/app/components/workflow/block-selector/rag-tool-recommendations/list.tsx+++ b/web/app/components/workflow/block-selector/rag-tool-recommendations/list.tsx@@ -29,14 +29,14 @@ const List = ({const language = useGetLanguage()const isFlatView = viewType === ViewType.flat- const { letters, groups: withLetterAndGroupViewToolsData } = groupItems(tools, tool => tool.label[language][0])+ const { letters, groups: withLetterAndGroupViewToolsData } = groupItems(tools, tool => tool.label[language]![0]!)const treeViewToolsData = useMemo(() => {const result: Record<string, ToolWithProvider[]> = {}Object.keys(withLetterAndGroupViewToolsData).forEach((letter) => {- Object.keys(withLetterAndGroupViewToolsData[letter]).forEach((groupName) => {+ Object.keys(withLetterAndGroupViewToolsData[letter]!).forEach((groupName) => {if (!result[groupName])result[groupName] = []- result[groupName].push(...withLetterAndGroupViewToolsData[letter][groupName])+ result[groupName].push(...(withLetterAndGroupViewToolsData[letter]![groupName] ?? []))})})return result@@ -45,8 +45,8 @@ const List = ({const listViewToolData = useMemo(() => {const result: ToolWithProvider[] = []letters.forEach((letter) => {- Object.keys(withLetterAndGroupViewToolsData[letter]).forEach((groupName) => {- result.push(...withLetterAndGroupViewToolsData[letter][groupName].map((item) => {+ Object.keys(withLetterAndGroupViewToolsData[letter]!).forEach((groupName) => {+ result.push(...withLetterAndGroupViewToolsData[letter]![groupName]!.map((item) => {return {...item,letter,diff --git a/web/app/components/workflow/block-selector/tool/action-item.tsx b/web/app/components/workflow/block-selector/tool/action-item.tsxindex 723bcf54341..4afe1b1da31 100644--- a/web/app/components/workflow/block-selector/tool/action-item.tsx+++ b/web/app/components/workflow/block-selector/tool/action-item.tsx@@ -97,9 +97,9 @@ const ToolItem: FC<Props> = ({provider_icon: normalizedIcon,provider_icon_dark: normalizedIconDark,tool_name: payload.name,- tool_label: payload.label[language],+ tool_label: payload.label[language]!,tool_description: payload.description[language],- title: payload.label[language],+ title: payload.label[language]!,is_team_authorization: provider.is_team_authorization,paramSchemas: payload.parameters,params,diff --git a/web/app/components/workflow/block-selector/tool/tool-list-tree-view/list.tsx b/web/app/components/workflow/block-selector/tool/tool-list-tree-view/list.tsxindex 944cc285476..56e306895fd 100644--- a/web/app/components/workflow/block-selector/tool/tool-list-tree-view/list.tsx+++ b/web/app/components/workflow/block-selector/tool/tool-list-tree-view/list.tsx@@ -48,7 +48,7 @@ const ToolListTreeView: FC<Props> = ({<Itemkey={groupName}groupName={getI18nGroupName(groupName)}- toolList={payload[groupName]}+ toolList={payload[groupName]!}hasSearchText={hasSearchText}onSelect={onSelect}canNotSelectMultiple={canNotSelectMultiple}diff --git a/web/app/components/workflow/block-selector/tool/tool.tsx b/web/app/components/workflow/block-selector/tool/tool.tsxindex 5abc750fedd..9a25d102081 100644--- a/web/app/components/workflow/block-selector/tool/tool.tsx+++ b/web/app/components/workflow/block-selector/tool/tool.tsx@@ -24,7 +24,7 @@ import ActionItem from './action-item'const normalizeProviderIcon = (icon?: ToolWithProvider['icon']) => {if (!icon)- return icon+ return icon!if (typeof icon === 'string' && basePath && icon.startsWith('/') && !icon.startsWith(`${basePath}/`))return `${basePath}${icon}`return icon@@ -70,7 +70,7 @@ const Tool: FC<Props> = ({}, [payload.icon])const normalizedIconDark = useMemo(() => {if (!payload.icon_dark)- return undefined+ return undefined!return normalizeProviderIcon(payload.icon_dark) ?? payload.icon_dark}, [payload.icon_dark])const providerIcon = useMemo<ToolWithProvider['icon']>(() => {@@ -114,14 +114,14 @@ const Tool: FC<Props> = ({provider_id: payload.id,provider_type: payload.type,provider_name: payload.name,- plugin_id: payload.plugin_id,- plugin_unique_identifier: payload.plugin_unique_identifier,+ plugin_id: payload.plugin_id!,+ plugin_unique_identifier: payload.plugin_unique_identifier!,provider_icon: normalizedIcon,provider_icon_dark: normalizedIconDark,tool_name: tool.name,- tool_label: tool.label[language],+ tool_label: tool.label[language]!,tool_description: tool.description[language],- title: tool.label[language],+ title: tool.label[language]!,is_team_authorization: payload.is_team_authorization,paramSchemas: tool.parameters,params,@@ -187,8 +187,8 @@ const Tool: FC<Props> = ({const tool = actions[0]const params: Record<string, string> = {}- if (tool.parameters) {- tool.parameters.forEach((item) => {+ if (tool!.parameters) {+ tool!.parameters.forEach((item) => {params[item.name] = ''})}@@ -200,12 +200,12 @@ const Tool: FC<Props> = ({plugin_unique_identifier: payload.plugin_unique_identifier,provider_icon: normalizedIcon,provider_icon_dark: normalizedIconDark,- tool_name: tool.name,- tool_label: tool.label[language],- tool_description: tool.description[language],- title: tool.label[language],+ tool_name: tool!.name,+ tool_label: tool!.label[language]!,+ tool_description: tool!.description[language],+ title: tool!.label[language]!,is_team_authorization: payload.is_team_authorization,- paramSchemas: tool.parameters,+ paramSchemas: tool!.parameters,params,})}}diff --git a/web/app/components/workflow/block-selector/tools.tsx b/web/app/components/workflow/block-selector/tools.tsxindex 8c281e35294..cabc0797500 100644--- a/web/app/components/workflow/block-selector/tools.tsx+++ b/web/app/components/workflow/block-selector/tools.tsx@@ -56,14 +56,14 @@ const Tools = ({}}*/- const { letters, groups: withLetterAndGroupViewToolsData } = groupItems(tools, tool => tool.label[language][0])+ const { letters, groups: withLetterAndGroupViewToolsData } = groupItems(tools, tool => tool.label[language]![0]!)const treeViewToolsData = useMemo(() => {const result: Record<string, ToolWithProvider[]> = {}Object.keys(withLetterAndGroupViewToolsData).forEach((letter) => {- Object.keys(withLetterAndGroupViewToolsData[letter]).forEach((groupName) => {+ Object.keys(withLetterAndGroupViewToolsData[letter]!).forEach((groupName) => {if (!result[groupName])result[groupName] = []- result[groupName].push(...withLetterAndGroupViewToolsData[letter][groupName])+ result[groupName].push(...(withLetterAndGroupViewToolsData[letter]![groupName] ?? []))})})return result@@ -72,8 +72,8 @@ const Tools = ({const listViewToolData = useMemo(() => {const result: ToolWithProvider[] = []letters.forEach((letter) => {- Object.keys(withLetterAndGroupViewToolsData[letter]).forEach((groupName) => {- result.push(...withLetterAndGroupViewToolsData[letter][groupName].map((item) => {+ Object.keys(withLetterAndGroupViewToolsData[letter]!).forEach((groupName) => {+ result.push(...withLetterAndGroupViewToolsData[letter]![groupName]!.map((item) => {return {...item,letter,diff --git a/web/app/components/workflow/block-selector/trigger-plugin/action-item.tsx b/web/app/components/workflow/block-selector/trigger-plugin/action-item.tsxindex 34ee7444145..4ffb84e1b87 100644--- a/web/app/components/workflow/block-selector/trigger-plugin/action-item.tsx+++ b/web/app/components/workflow/block-selector/trigger-plugin/action-item.tsx@@ -65,10 +65,10 @@ const TriggerPluginActionItem: FC<Props> = ({provider_type: provider.type as string,provider_name: provider.name,event_name: payload.name,- event_label: payload.label[language],- event_description: payload.description[language],+ event_label: payload.label[language]!,+ event_description: payload.description[language]!,plugin_unique_identifier: provider.plugin_unique_identifier,- title: payload.label[language],+ title: payload.label[language]!,is_team_authorization: provider.is_team_authorization,output_schema: payload.output_schema || {},paramSchemas: payload.parameters,diff --git a/web/app/components/workflow/block-selector/trigger-plugin/item.tsx b/web/app/components/workflow/block-selector/trigger-plugin/item.tsxindex 35230810b84..9e6c315506c 100644--- a/web/app/components/workflow/block-selector/trigger-plugin/item.tsx+++ b/web/app/components/workflow/block-selector/trigger-plugin/item.tsx@@ -103,8 +103,8 @@ const TriggerPluginItem: FC<Props> = ({const event = actions[0]const params: Record<string, string> = {}- if (event.parameters) {- event.parameters.forEach((item: any) => {+ if (event!.parameters) {+ event!.parameters.forEach((item: any) => {params[item.name] = ''})}@@ -113,14 +113,14 @@ const TriggerPluginItem: FC<Props> = ({provider_id: payload.name,provider_type: payload.type,provider_name: payload.name,- event_name: event.name,- event_label: event.label[language],- event_description: event.description[language],- title: event.label[language],+ event_name: event!.name,+ event_label: event!.label[language]!,+ event_description: event!.description[language]!,+ title: event!.label[language]!,plugin_unique_identifier: payload.plugin_unique_identifier,is_team_authorization: payload.is_team_authorization,- output_schema: event.output_schema || {},- paramSchemas: event.parameters,+ output_schema: event!.output_schema || {},+ paramSchemas: event!.parameters,params,})}}diff --git a/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.test.ts b/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.test.tsindex 957ef76e862..c04c9f127d7 100644--- a/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.test.ts+++ b/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.test.ts@@ -325,7 +325,7 @@ describe('CollaborationManager syncNodes', () => {it('reflects the last writer when concurrent removal and edits happen', () => {const base = [createNodeSnapshot(['a', 'b'])]- internals.syncNodes([], [deepClone(base[0])])+ internals.syncNodes([], [deepClone(base[0])!])const userA = [{...createNodeSnapshot(['a']),@@ -407,7 +407,7 @@ describe('CollaborationManager syncNodes', () => {const final = (promptManager.getNodes() as Node[]).find(node => node.id === LLM_NODE_ID)const finalTemplates = getPromptTemplates(final!)expect(finalTemplates).toHaveLength(1)- expect(finalTemplates[0].text).toBe('updated system prompt')+ expect(finalTemplates[0]!.text).toBe('updated system prompt')})it('keeps parameter list in sync when nodes add, edit, or remove parameters', () => {@@ -500,7 +500,7 @@ describe('CollaborationManager syncNodes', () => {const stored = parameterManager.getNodes().find(n => n.id === PARAM_NODE_ID) as Node<ParameterExtractorNodeData>const mutatedNode = deepClone(stored)- mutatedNode.data.parameters[0].description = 'updated'+ mutatedNode.data.parameters[0]!.description = 'updated'parameterInternals.syncNodes([stored], [mutatedNode])@@ -509,7 +509,7 @@ describe('CollaborationManager syncNodes', () => {| undefinedconst params = storedAfter?.data.parameters ?? []expect(params).toHaveLength(1)- expect(params[0].description).toBe('updated')+ expect(params[0]!.description).toBe('updated')})it('filters out transient/private data keys while keeping allowlisted ones', () => {diff --git a/web/app/components/workflow/collaboration/core/__tests__/crdt-provider.test.ts b/web/app/components/workflow/collaboration/core/__tests__/crdt-provider.test.tsindex 613c2d1b750..d6a9e352283 100644--- a/web/app/components/workflow/collaboration/core/__tests__/crdt-provider.test.ts+++ b/web/app/components/workflow/collaboration/core/__tests__/crdt-provider.test.ts@@ -100,7 +100,7 @@ describe('CRDTProvider', () => {socket.trigger('graph_update', payload)expect(doc.import).toHaveBeenCalledWith(expect.any(Uint8Array))- expect(Array.from(doc.import.mock.calls[0][0])).toEqual([9, 9, 9])+ expect(Array.from(doc.import.mock.calls[0]![0])).toEqual([9, 9, 9])provider.destroy()})diff --git a/web/app/components/workflow/collaboration/utils/user-color.ts b/web/app/components/workflow/collaboration/utils/user-color.tsindex 51aee6a0380..a25e87dbe25 100644--- a/web/app/components/workflow/collaboration/utils/user-color.ts+++ b/web/app/components/workflow/collaboration/utils/user-color.ts@@ -8,5 +8,5 @@ export const getUserColor = (id: string): string => {a = ((a << 5) - a) + b.charCodeAt(0)return a & a}, 0)- return colors[Math.abs(hash) % colors.length]+ return colors[Math.abs(hash) % colors.length]!}diff --git a/web/app/components/workflow/comment/mention-input.tsx b/web/app/components/workflow/comment/mention-input.tsxindex ac708b979df..b5d75d67346 100644--- a/web/app/components/workflow/comment/mention-input.tsx+++ b/web/app/components/workflow/comment/mention-input.tsx@@ -111,7 +111,7 @@ const MentionInputInner = forwardRef<HTMLTextAreaElement, MentionInputProps>(({continueconst previousChar = searchStart > 0 ? value[searchStart - 1] : ''- if (searchStart > 0 && !/\s/.test(previousChar))+ if (searchStart > 0 && !/\s/.test(previousChar!))continueif (@@ -332,7 +332,7 @@ const MentionInputInner = forwardRef<HTMLTextAreaElement, MentionInputProps>(({const mentionMatch = textBeforeCursor.match(/@(\w*)$/)if (mentionMatch) {- setMentionQuery(mentionMatch[1])+ setMentionQuery(mentionMatch[1]!)setMentionPosition(cursorPosition - mentionMatch[0].length)setShowMentionDropdown(true)setSelectedMentionIndex(0)@@ -398,7 +398,7 @@ const MentionInputInner = forwardRef<HTMLTextAreaElement, MentionInputProps>(({const beforeMention = value.slice(0, mentionPosition)const afterMention = value.slice(textarea.selectionStart || 0)- const needsSpaceBefore = mentionPosition > 0 && !/\s/.test(value[mentionPosition - 1])+ const needsSpaceBefore = mentionPosition > 0 && !/\s/.test(value[mentionPosition - 1]!)const prefix = needsSpaceBefore ? ' ' : ''const newContent = `${beforeMention}${prefix}@${user.name} ${afterMention}`diff --git a/web/app/components/workflow/comment/thread.tsx b/web/app/components/workflow/comment/thread.tsxindex 3e449b66e51..a23ac4241df 100644--- a/web/app/components/workflow/comment/thread.tsx+++ b/web/app/components/workflow/comment/thread.tsx@@ -84,7 +84,7 @@ const ThreadMessage: FC<{continueconst previousChar = searchStart > 0 ? content[searchStart - 1] : ''- if (searchStart > 0 && !/\s/.test(previousChar))+ if (searchStart > 0 && !/\s/.test(previousChar!))continueif (diff --git a/web/app/components/workflow/features.tsx b/web/app/components/workflow/features.tsxindex 56b8b79ced3..eb0ec026123 100644--- a/web/app/components/workflow/features.tsx+++ b/web/app/components/workflow/features.tsx@@ -33,11 +33,11 @@ const Features = () => {const handleAddOpeningStatementVariable = (variables: PromptVariable[]) => {const newVariable = variables[0]const startNodeVariable: InputVar = {- variable: newVariable.key,- label: newVariable.name,+ variable: newVariable!.key,+ label: newVariable!.name,type: InputVarType.textInput,- max_length: newVariable.max_length,- required: newVariable.required || false,+ max_length: newVariable!.max_length,+ required: newVariable!.required || false,options: [],}handleAddVariable(startNodeVariable)diff --git a/web/app/components/workflow/header/__tests__/run-mode.spec.tsx b/web/app/components/workflow/header/__tests__/run-mode.spec.tsxindex 74dc529a62e..7bc5ef1b0c7 100644--- a/web/app/components/workflow/header/__tests__/run-mode.spec.tsx+++ b/web/app/components/workflow/header/__tests__/run-mode.spec.tsx@@ -85,7 +85,7 @@ vi.mock('../test-run-menu', async (importOriginal) => {}))return (<div>- <button data-testid="trigger-option" onClick={() => onSelect(options[0])}>+ <button data-testid="trigger-option" onClick={() => onSelect(options[0]!)}>Trigger option</button>{children}@@ -109,7 +109,7 @@ describe('RunMode', () => {it('should render the run trigger and start the workflow when a valid trigger is selected', () => {render(<RunMode />)- expect(screen.getByText(/run/i)).toBeInTheDocument()+ expect(screen.getByText(/run/i))!.toBeInTheDocument()fireEvent.click(screen.getByTestId('trigger-option'))expect(mockHandleWorkflowStartRunInWorkflow).toHaveBeenCalledTimes(1)@@ -137,7 +137,7 @@ describe('RunMode', () => {render(<RunMode />)- expect(screen.getByText(/running/i)).toBeInTheDocument()+ expect(screen.getByText(/running/i))!.toBeInTheDocument()fireEvent.click(screen.getByTestId('stop-circle').closest('button') as HTMLButtonElement)expect(mockHandleStopRun).toHaveBeenCalledWith('task-1')@@ -148,6 +148,6 @@ describe('RunMode', () => {render(<RunMode />)- expect(screen.getByText(/listening/i)).toBeInTheDocument()+ expect(screen.getByText(/listening/i))!.toBeInTheDocument()})})diff --git a/web/app/components/workflow/header/checklist/node-group.tsx b/web/app/components/workflow/header/checklist/node-group.tsxindex e914fd38f73..5cbddcc12aa 100644--- a/web/app/components/workflow/header/checklist/node-group.tsx+++ b/web/app/components/workflow/header/checklist/node-group.tsx@@ -26,7 +26,7 @@ export const ChecklistNodeGroup = memo(({const subItems = useMemo(() => {const items: ChecklistSubItem[] = []for (let i = 0; i < item.errorMessages.length; i++)- items.push({ key: `error-${i}`, message: item.errorMessages[i] })+ items.push({ key: `error-${i}`, message: item.errorMessages[i]! })if (item.unConnected)items.push({ key: 'unconnected', message: t('common.needConnectTip', { ns: 'workflow' }) })return itemsdiff --git a/web/app/components/workflow/header/checklist/plugin-group.tsx b/web/app/components/workflow/header/checklist/plugin-group.tsxindex 2c532f1ac45..f74b314a10d 100644--- a/web/app/components/workflow/header/checklist/plugin-group.tsx+++ b/web/app/components/workflow/header/checklist/plugin-group.tsx@@ -11,7 +11,7 @@ import { ItemIndicator } from './item-indicator'function getVersionFromMarketplaceIdentifier(identifier: string): string | undefined {const withoutHash = identifier.split('@')[0]- const [, version] = withoutHash.split(':')+ const [, version] = withoutHash!.split(':')return version || undefined}diff --git a/web/app/components/workflow/hooks/__tests__/use-edges-interactions.helpers.spec.ts b/web/app/components/workflow/hooks/__tests__/use-edges-interactions.helpers.spec.tsindex 3741bcc6537..1608cc18ce6 100644--- a/web/app/components/workflow/hooks/__tests__/use-edges-interactions.helpers.spec.ts+++ b/web/app/components/workflow/hooks/__tests__/use-edges-interactions.helpers.spec.ts@@ -38,8 +38,8 @@ describe('use-edges-interactions.helpers', () => {const result = applyConnectedHandleNodeData(nodes, edgeChanges)- expect(result[0].data._connectedSourceHandleIds).toEqual(['branch-a'])- expect(result[1].data._connectedSourceHandleIds).toEqual([])+ expect(result[0]!.data._connectedSourceHandleIds).toEqual(['branch-a'])+ expect(result[1]!.data._connectedSourceHandleIds).toEqual([])expect(mockGetNodesConnectedSourceOrTargetHandleIdsMap).toHaveBeenCalledWith(edgeChanges, nodes)})diff --git a/web/app/components/workflow/hooks/__tests__/use-node-data-update.spec.ts b/web/app/components/workflow/hooks/__tests__/use-node-data-update.spec.tsindex 7fcb10ff0e0..231c5afc0e9 100644--- a/web/app/components/workflow/hooks/__tests__/use-node-data-update.spec.ts+++ b/web/app/components/workflow/hooks/__tests__/use-node-data-update.spec.ts@@ -28,7 +28,7 @@ describe('useNodeDataUpdate', () => {})expect(rfState.setNodes).toHaveBeenCalledOnce()- const updatedNodes = rfState.setNodes.mock.calls[0][0]+ const updatedNodes = rfState.setNodes.mock.calls[0]![0]expect(updatedNodes.find((n: { id: string }) => n.id === 'node-1').data).toEqual({title: 'Node 1',value: 'updated',diff --git a/web/app/components/workflow/hooks/__tests__/use-nodes-interactions.spec.ts b/web/app/components/workflow/hooks/__tests__/use-nodes-interactions.spec.tsindex 2310df53b71..4117c85abd8 100644--- a/web/app/components/workflow/hooks/__tests__/use-nodes-interactions.spec.ts+++ b/web/app/components/workflow/hooks/__tests__/use-nodes-interactions.spec.ts@@ -122,7 +122,7 @@ describe('useNodesInteractions', () => {})it('persists node drags only when the node position actually changes', () => {- const node = currentNodes[0]+ const node = currentNodes[0]!const movedNode = {...node,position: { x: 120, y: 80 },@@ -136,7 +136,7 @@ describe('useNodesInteractions', () => {})act(() => {- result.current.handleNodeDragStart({} as never, node, currentNodes)+ result.current.handleNodeDragStart({} as never, node!, currentNodes)result.current.handleNodeDragStop({} as never, movedNode, currentNodes)})diff --git a/web/app/components/workflow/hooks/__tests__/use-workflow-interactions.spec.tsx b/web/app/components/workflow/hooks/__tests__/use-workflow-interactions.spec.tsxindex 8038fc528da..a8f78cfec4a 100644--- a/web/app/components/workflow/hooks/__tests__/use-workflow-interactions.spec.tsx+++ b/web/app/components/workflow/hooks/__tests__/use-workflow-interactions.spec.tsx@@ -224,7 +224,7 @@ describe('use-workflow-interactions exports', () => {})expect(mockSetNodes).toHaveBeenCalledTimes(1)- const nextNodes = mockSetNodes.mock.calls[0][0]+ const nextNodes = mockSetNodes.mock.calls[0]![0]expect(nextNodes.find((node: { id: string }) => node.id === 'loop-node')).toEqual(expect.objectContaining({width: expect.any(Number),height: expect.any(Number),diff --git a/web/app/components/workflow/hooks/__tests__/use-workflow-organize.helpers.spec.ts b/web/app/components/workflow/hooks/__tests__/use-workflow-organize.helpers.spec.tsindex 8346d7f9775..688c2724c9e 100644--- a/web/app/components/workflow/hooks/__tests__/use-workflow-organize.helpers.spec.ts+++ b/web/app/components/workflow/hooks/__tests__/use-workflow-organize.helpers.spec.ts@@ -88,7 +88,7 @@ describe('use-workflow-organize helpers', () => {const laidOut = applyLayoutToNodes({nodes: rootNodes,layout,- parentNodes: [rootNodes[2]],+ parentNodes: [rootNodes[2]!],childLayoutsMap,})expect(laidOut.find(node => node.id === 'root-b')?.position).toEqual({ x: 210, y: 100 })@@ -112,7 +112,7 @@ describe('use-workflow-organize helpers', () => {const laidOut = applyLayoutToNodes({nodes,layout,- parentNodes: [nodes[2]],+ parentNodes: [nodes[2]!],childLayoutsMap: {},})diff --git a/web/app/components/workflow/hooks/__tests__/use-workflow-organize.spec.tsx b/web/app/components/workflow/hooks/__tests__/use-workflow-organize.spec.tsxindex 424ad96630b..b3b4baa21c5 100644--- a/web/app/components/workflow/hooks/__tests__/use-workflow-organize.spec.tsx+++ b/web/app/components/workflow/hooks/__tests__/use-workflow-organize.spec.tsx@@ -120,7 +120,7 @@ describe('useWorkflowOrganize', () => {})expect(mockSetNodes).toHaveBeenCalledTimes(1)- const nextNodes = mockSetNodes.mock.calls[0][0]+ const nextNodes = mockSetNodes.mock.calls[0]![0]expect(nextNodes.find((node: { id: string }) => node.id === 'loop-node')).toEqual(expect.objectContaining({width: expect.any(Number),height: expect.any(Number),diff --git a/web/app/components/workflow/hooks/__tests__/use-workflow-variables.spec.ts b/web/app/components/workflow/hooks/__tests__/use-workflow-variables.spec.tsindex 685df81864e..70079d724e7 100644--- a/web/app/components/workflow/hooks/__tests__/use-workflow-variables.spec.ts+++ b/web/app/components/workflow/hooks/__tests__/use-workflow-variables.spec.ts@@ -48,7 +48,7 @@ describe('useWorkflowVariables', () => {})expect(mockToNodeAvailableVars).toHaveBeenCalledOnce()- const args = mockToNodeAvailableVars.mock.calls[0][0]+ const args = mockToNodeAvailableVars.mock.calls[0]![0]expect(args.isChatMode).toBe(true)expect(args.conversationVariables).toHaveLength(1)expect(args.environmentVariables).toHaveLength(1)@@ -68,7 +68,7 @@ describe('useWorkflowVariables', () => {hideEnv: true,})- const args = mockToNodeAvailableVars.mock.calls[0][0]+ const args = mockToNodeAvailableVars.mock.calls[0]![0]expect(args.environmentVariables).toEqual([])})@@ -85,7 +85,7 @@ describe('useWorkflowVariables', () => {filterVar: () => true,})- const args = mockToNodeAvailableVars.mock.calls[0][0]+ const args = mockToNodeAvailableVars.mock.calls[0]![0]expect(args.conversationVariables).toEqual([])})})@@ -141,7 +141,7 @@ describe('useWorkflowVariableType', () => {const { result } = renderWorkflowHook(() => useWorkflowVariableType())result.current({ nodeId: 'n2', valueSelector: ['n2', 'item'] })- const args = mockGetVarType.mock.calls[0][0]+ const args = mockGetVarType.mock.calls[0]![0]expect(args.parentNode).toBeDefined()expect((args.parentNode as { id: string }).id).toBe('iter-1')})diff --git a/web/app/components/workflow/hooks/use-checklist.ts b/web/app/components/workflow/hooks/use-checklist.tsindex 99536653ce8..abafcfd8ebf 100644--- a/web/app/components/workflow/hooks/use-checklist.ts+++ b/web/app/components/workflow/hooks/use-checklist.ts@@ -187,18 +187,18 @@ export const useChecklist = (nodes: Node[], edges: Edge[]) => {let moreDataForCheckValidlet usedVars: ValueSelector[] = []- if (node.data.type === BlockEnum.Tool)- moreDataForCheckValid = getToolCheckParams(node.data as ToolNodeType, buildInTools || [], customTools || [], workflowTools || [], language)+ if (node!.data.type === BlockEnum.Tool)+ moreDataForCheckValid = getToolCheckParams(node!.data as ToolNodeType, buildInTools || [], customTools || [], workflowTools || [], language)- if (node.data.type === BlockEnum.DataSource)- moreDataForCheckValid = getDataSourceCheckParams(node.data as DataSourceNodeType, dataSourceList || [], language)+ if (node!.data.type === BlockEnum.DataSource)+ moreDataForCheckValid = getDataSourceCheckParams(node!.data as DataSourceNodeType, dataSourceList || [], language)- if (node.data.type === BlockEnum.TriggerPlugin)- moreDataForCheckValid = getTriggerCheckParams(node.data as PluginTriggerNodeType, triggerPlugins, language)+ if (node!.data.type === BlockEnum.TriggerPlugin)+ moreDataForCheckValid = getTriggerCheckParams(node!.data as PluginTriggerNodeType, triggerPlugins, language)- const toolIcon = getToolIcon(node.data)- if (node.data.type === BlockEnum.Agent) {- const data = node.data as AgentNodeType+ const toolIcon = getToolIcon(node!.data)+ if (node!.data.type === BlockEnum.Agent) {+ const data = node!.data as AgentNodeTypeconst isReadyForCheckValid = !!strategyProvidersconst provider = strategyProviders?.find(provider => provider.declaration.identity.name === data.agent_strategy_provider_name)const strategy = provider?.declaration.strategies?.find(s => s.identity.name === data.agent_strategy_name)@@ -210,13 +210,13 @@ export const useChecklist = (nodes: Node[], edges: Edge[]) => {}}else {- usedVars = getNodeUsedVars(node).filter(v => v.length > 0)+ usedVars = getNodeUsedVars(node!).filter(v => v.length > 0)}- if (node.type === CUSTOM_NODE) {- const checkData = getCheckData(node.data)- const validator = nodesExtraData?.[node.data.type as BlockEnum]?.checkValid- const isPluginMissing = isNodePluginMissing(node.data, { builtInTools: buildInTools, customTools, workflowTools, mcpTools, triggerPlugins, dataSourceList })+ if (node!.type === CUSTOM_NODE) {+ const checkData = getCheckData(node!.data)+ const validator = nodesExtraData?.[node!.data.type as BlockEnum]?.checkValid+ const isPluginMissing = isNodePluginMissing(node!.data, { builtInTools: buildInTools, customTools, workflowTools, mcpTools, triggerPlugins, dataSourceList })const errorMessages: string[] = []@@ -224,8 +224,8 @@ export const useChecklist = (nodes: Node[], edges: Edge[]) => {errorMessages.push(t('nodes.common.pluginNotInstalled', { ns: 'workflow' }))}else {- if (node.data.type === BlockEnum.LLM) {- const modelProvider = (node.data as CommonNodeType<{ model?: ModelConfig }>).model?.provider+ if (node!.data.type === BlockEnum.LLM) {+ const modelProvider = (node!.data as CommonNodeType<{ model?: ModelConfig }>).model?.providerconst modelIssue = getLLMModelIssue({modelProvider,isModelProviderInstalled: isLLMModelProviderInstalled(modelProvider, installedPluginIds),@@ -240,12 +240,12 @@ export const useChecklist = (nodes: Node[], edges: Edge[]) => {errorMessages.push(validationError)}- const availableVars = map[node.id].availableVars+ const availableVars = map[node!.id]!.availableVarslet hasInvalidVar = falsefor (const variable of usedVars) {if (hasInvalidVar)break- if (isSpecialVar(variable[0]))+ if (isSpecialVar(variable[0]!))continueconst usedNode = availableVars.find(v => v.nodeId === variable?.[0])if (!usedNode || !usedNode.vars.some(v => v.variable === variable?.[1]))@@ -255,17 +255,17 @@ export const useChecklist = (nodes: Node[], edges: Edge[]) => {errorMessages.push(t('errorMsg.invalidVariable', { ns: 'workflow' }))}- const isStartNodeMeta = nodesExtraData?.[node.data.type as BlockEnum]?.metaData.isStart ?? false+ const isStartNodeMeta = nodesExtraData?.[node!.data.type as BlockEnum]?.metaData.isStart ?? falseconst canSkipConnectionCheck = shouldCheckStartNode ? isStartNodeMeta : true- const isUnconnected = !validNodes.some(n => n.id === node.id)+ const isUnconnected = !validNodes.some(n => n.id === node!.id)const shouldShowError = errorMessages.length > 0 || (isUnconnected && !canSkipConnectionCheck)if (shouldShowError) {list.push({- id: node.id,- type: node.data.type,- title: node.data.title,+ id: node!.id,+ type: node!.data.type,+ title: node!.data.title,toolIcon,unConnected: isUnconnected && !canSkipConnectionCheck,errorMessages,@@ -273,7 +273,7 @@ export const useChecklist = (nodes: Node[], edges: Edge[]) => {disableGoTo: isPluginMissing,isPluginMissing,pluginUniqueIdentifier: isPluginMissing- ? (node.data as { plugin_unique_identifier?: string }).plugin_unique_identifier+ ? (node!.data as { plugin_unique_identifier?: string }).plugin_unique_identifier: undefined,})}@@ -458,14 +458,14 @@ export const useChecklistBeforePublish = () => {const node = filteredNodes[i]let moreDataForCheckValidlet usedVars: ValueSelector[] = []- if (node.data.type === BlockEnum.Tool)- moreDataForCheckValid = getToolCheckParams(node.data as ToolNodeType, buildInTools || [], customTools || [], workflowTools || [], language)+ if (node!.data.type === BlockEnum.Tool)+ moreDataForCheckValid = getToolCheckParams(node!.data as ToolNodeType, buildInTools || [], customTools || [], workflowTools || [], language)- if (node.data.type === BlockEnum.DataSource)- moreDataForCheckValid = getDataSourceCheckParams(node.data as DataSourceNodeType, dataSourceList || [], language)+ if (node!.data.type === BlockEnum.DataSource)+ moreDataForCheckValid = getDataSourceCheckParams(node!.data as DataSourceNodeType, dataSourceList || [], language)- if (node.data.type === BlockEnum.Agent) {- const data = node.data as AgentNodeType+ if (node!.data.type === BlockEnum.Agent) {+ const data = node!.data as AgentNodeTypeconst isReadyForCheckValid = !!strategyProvidersconst provider = strategyProviders?.find(provider => provider.declaration.identity.name === data.agent_strategy_provider_name)const strategy = provider?.declaration.strategies?.find(s => s.identity.name === data.agent_strategy_name)@@ -477,55 +477,55 @@ export const useChecklistBeforePublish = () => {}}else {- usedVars = getNodeUsedVars(node).filter(v => v.length > 0)+ usedVars = getNodeUsedVars(node!).filter(v => v.length > 0)}- if (node.data.type === BlockEnum.LLM) {- const modelProvider = (node.data as CommonNodeType<{ model?: ModelConfig }>).model?.provider+ if (node!.data.type === BlockEnum.LLM) {+ const modelProvider = (node!.data as CommonNodeType<{ model?: ModelConfig }>).model?.providerconst modelIssue = getLLMModelIssue({modelProvider,isModelProviderInstalled: isLLMModelProviderInstalled(modelProvider, installedPluginIds),})if (modelIssue === LLMModelIssueCode.providerPluginUnavailable) {- toast.error(`[${node.data.title}] ${t('errorMsg.configureModel', { ns: 'workflow' })}`)+ toast.error(`[${node!.data.title}] ${t('errorMsg.configureModel', { ns: 'workflow' })}`)return false}}- const checkData = getCheckData(node.data, datasets, embeddingProviderModelMap)- const { errorMessage } = nodesExtraData![node.data.type as BlockEnum].checkValid(checkData, t, moreDataForCheckValid)+ const checkData = getCheckData(node!.data, datasets, embeddingProviderModelMap)+ const { errorMessage } = nodesExtraData![node!.data.type as BlockEnum].checkValid(checkData, t, moreDataForCheckValid)if (errorMessage) {- toast.error(`[${node.data.title}] ${errorMessage}`)+ toast.error(`[${node!.data.title}] ${errorMessage}`)return false}- const availableVars = map[node.id].availableVars+ const availableVars = map[node!.id]!.availableVarsfor (const variable of usedVars) {- const isSpecialVars = isSpecialVar(variable[0])+ const isSpecialVars = isSpecialVar(variable[0]!)if (!isSpecialVars) {const usedNode = availableVars.find(v => v.nodeId === variable?.[0])if (usedNode) {const usedVar = usedNode.vars.find(v => v.variable === variable?.[1])if (!usedVar) {- toast.error(`[${node.data.title}] ${t('errorMsg.invalidVariable', { ns: 'workflow' })}`)+ toast.error(`[${node!.data.title}] ${t('errorMsg.invalidVariable', { ns: 'workflow' })}`)return false}}else {- toast.error(`[${node.data.title}] ${t('errorMsg.invalidVariable', { ns: 'workflow' })}`)+ toast.error(`[${node!.data.title}] ${t('errorMsg.invalidVariable', { ns: 'workflow' })}`)return false}}}- const isStartNodeMeta = nodesExtraData?.[node.data.type as BlockEnum]?.metaData.isStart ?? false+ const isStartNodeMeta = nodesExtraData?.[node!.data.type as BlockEnum]?.metaData.isStart ?? falseconst canSkipConnectionCheck = shouldCheckStartNode ? isStartNodeMeta : true- const isUnconnected = !validNodes.some(n => n.id === node.id)+ const isUnconnected = !validNodes.some(n => n.id === node!.id)if (isUnconnected && !canSkipConnectionCheck) {- toast.error(`[${node.data.title}] ${t('common.needConnectTip', { ns: 'workflow' })}`)+ toast.error(`[${node!.data.title}] ${t('common.needConnectTip', { ns: 'workflow' })}`)return false}}diff --git a/web/app/components/workflow/hooks/use-edges-interactions.ts b/web/app/components/workflow/hooks/use-edges-interactions.tsindex 75486608dce..4f24c36a164 100644--- a/web/app/components/workflow/hooks/use-edges-interactions.ts+++ b/web/app/components/workflow/hooks/use-edges-interactions.ts@@ -38,14 +38,14 @@ export const useEdgesInteractions = () => {if (currentEdgeIndex < 0)return- const currentEdge = edges[currentEdgeIndex]+ const currentEdge = edges[currentEdgeIndex]!const newNodes = applyConnectedHandleNodeData(nodes, [{ type: 'remove', edge: currentEdge }])setNodes(newNodes)const newEdges = produce(edges, (draft) => {draft.splice(currentEdgeIndex, 1)})setEdges(newEdges)- if (clearEdgeMenuIfNeeded({ edgeMenu: workflowStore.getState().edgeMenu, edgeIds: [currentEdge.id] }))+ if (clearEdgeMenuIfNeeded({ edgeMenu: workflowStore.getState().edgeMenu, edgeIds: [currentEdge!.id] }))workflowStore.setState({ edgeMenu: undefined })handleSyncWorkflowDraft()saveStateToHistory(WorkflowHistoryEvent.EdgeDelete)diff --git a/web/app/components/workflow/hooks/use-fetch-workflow-inspect-vars.ts b/web/app/components/workflow/hooks/use-fetch-workflow-inspect-vars.tsindex f013402cd3e..eef710ef70a 100644--- a/web/app/components/workflow/hooks/use-fetch-workflow-inspect-vars.ts+++ b/web/app/components/workflow/hooks/use-fetch-workflow-inspect-vars.ts@@ -64,17 +64,17 @@ export const useSetWorkflowVarsWithValue = ({inspectVars.forEach((varItem) => {const nodeId = varItem.selector[0]- const node = nodesKeyValue[nodeId]+ const node = nodesKeyValue[nodeId!]if (!node)return- withValueNodeIds[nodeId] = true+ withValueNodeIds[nodeId!] = true})const withValueNodes = Object.keys(withValueNodeIds).map((nodeId) => {return nodesKeyValue[nodeId]})const res: NodeWithVar[] = withValueNodes.map((node) => {- const nodeId = node.id+ const nodeId = node!.idconst varsUnderTheNode = inspectVars.filter((varItem) => {return varItem.selector[0] === nodeId})@@ -82,9 +82,9 @@ export const useSetWorkflowVarsWithValue = ({const nodeWithVar = {nodeId,- nodePayload: node.data,- nodeType: node.data.type,- title: node.data.title,+ nodePayload: node!.data,+ nodeType: node!.data.type,+ title: node!.data.title,vars: varsUnderTheNode.map((item) => {const schemaType = nodeVar ? nodeVar.vars.find(v => v.variable === item.name)?.schemaType : ''return {diff --git a/web/app/components/workflow/hooks/use-helpline.ts b/web/app/components/workflow/hooks/use-helpline.tsindex d039d101289..3fda2528c1c 100644--- a/web/app/components/workflow/hooks/use-helpline.ts+++ b/web/app/components/workflow/hooks/use-helpline.ts@@ -82,17 +82,17 @@ const buildHorizontalHelpLine = ({const first = alignedNodes[0]const last = alignedNodes[alignedNodes.length - 1]- const firstPos = getNodeAlignPosition(first)- const lastPos = getNodeAlignPosition(last)+ const firstPos = getNodeAlignPosition(first!)+ const lastPos = getNodeAlignPosition(last!)const helpLine = {top: firstPos.y,left: firstPos.x,- width: lastPos.x + (isEntryNode(last) ? getEntryNodeDimension(last, 'width') : last.width ?? 0) - firstPos.x,+ width: lastPos.x + (isEntryNode(last!) ? getEntryNodeDimension(last!, 'width') : last!.width ?? 0) - firstPos.x,}if (nodeAlignPos.x < firstPos.x) {helpLine.left = nodeAlignPos.x- helpLine.width = firstPos.x + (isEntryNode(first) ? getEntryNodeDimension(first, 'width') : first.width ?? 0) - nodeAlignPos.x+ helpLine.width = firstPos.x + (isEntryNode(first!) ? getEntryNodeDimension(first!, 'width') : first!.width ?? 0) - nodeAlignPos.x}if (nodeAlignPos.x > lastPos.x)@@ -119,17 +119,17 @@ const buildVerticalHelpLine = ({const first = alignedNodes[0]const last = alignedNodes[alignedNodes.length - 1]- const firstPos = getNodeAlignPosition(first)- const lastPos = getNodeAlignPosition(last)+ const firstPos = getNodeAlignPosition(first!)+ const lastPos = getNodeAlignPosition(last!)const helpLine = {top: firstPos.y,left: firstPos.x,- height: lastPos.y + (isEntryNode(last) ? getEntryNodeDimension(last, 'height') : last.height ?? 0) - firstPos.y,+ height: lastPos.y + (isEntryNode(last!) ? getEntryNodeDimension(last!, 'height') : last!.height ?? 0) - firstPos.y,}if (nodeAlignPos.y < firstPos.y) {helpLine.top = nodeAlignPos.y- helpLine.height = firstPos.y + (isEntryNode(first) ? getEntryNodeDimension(first, 'height') : first.height ?? 0) - nodeAlignPos.y+ helpLine.height = firstPos.y + (isEntryNode(first!) ? getEntryNodeDimension(first!, 'height') : first!.height ?? 0) - nodeAlignPos.y}if (nodeAlignPos.y > lastPos.y)diff --git a/web/app/components/workflow/hooks/use-inspect-vars-crud-common.ts b/web/app/components/workflow/hooks/use-inspect-vars-crud-common.tsindex 316da71d9dc..2bacef7028f 100644--- a/web/app/components/workflow/hooks/use-inspect-vars-crud-common.ts+++ b/web/app/components/workflow/hooks/use-inspect-vars-crud-common.ts@@ -132,7 +132,7 @@ export const useInspectVarsCrudCommon = ({dataSourceList: dataSourceList || [],}const currentNodeOutputVars = toNodeOutputVars([currentNode], false, () => true, [], [], [], allPluginInfoList, schemaTypeDefinitions)- const vars = await fetchNodeInspectVars(flowType, flowId, nodeId)+ const vars = await fetchNodeInspectVars(flowType, flowId, nodeId!)const varsWithSchemaType = vars.map((varItem) => {const schemaType = currentNodeOutputVars[0]?.vars.find(v => v.variable === varItem.name)?.schemaType || ''return {@@ -140,7 +140,7 @@ export const useInspectVarsCrudCommon = ({schemaType,}})- setNodeInspectVars(nodeId, varsWithSchemaType)+ setNodeInspectVars(nodeId!, varsWithSchemaType)}, [workflowStore, flowType, flowId, invalidateSysVarValues, invalidateConversationVarValues, buildInTools, customTools, workflowTools, mcpTools])// after last run would call this@@ -163,9 +163,9 @@ export const useInspectVarsCrudCommon = ({})}else {- draft[index].vars = payload+ draft[index]!.vars = payload// put the node to the topAdd commentMore actions- draft.unshift(draft.splice(index, 1)[0])+ draft.unshift(draft.splice(index, 1)[0]!)}}})diff --git a/web/app/components/workflow/hooks/use-nodes-interactions.ts b/web/app/components/workflow/hooks/use-nodes-interactions.tsindex 7c97025fd6f..27b13bb42c4 100644--- a/web/app/components/workflow/hooks/use-nodes-interactions.ts+++ b/web/app/components/workflow/hooks/use-nodes-interactions.ts@@ -166,7 +166,7 @@ export const useNodesInteractions = () => {// X-axis alignment with offset considerationif (showVerticalHelpLineNodesLength > 0) {const targetNode = showVerticalHelpLineNodes[0]- const isTargetEntryNode = isTriggerNode(targetNode.data.type as any) || targetNode.data.type === BlockEnum.Start+ const isTargetEntryNode = isTriggerNode(targetNode!.data.type as any) || targetNode!.data.type === BlockEnum.Start// Calculate the wrapper position needed to align the inner nodes// Target inner position = target.position + target.offset@@ -175,7 +175,7 @@ export const useNodesInteractions = () => {// Therefore: current.position = target.position + target.offset - current.offsetconst targetOffset = isTargetEntryNode ? ENTRY_NODE_WRAPPER_OFFSET.x : 0const currentOffset = isCurrentEntryNode ? ENTRY_NODE_WRAPPER_OFFSET.x : 0- currentNode.position.x = targetNode.position.x + targetOffset - currentOffset+ currentNode.position.x = targetNode!.position.x + targetOffset - currentOffset}else if (restrictPosition.x !== undefined) {currentNode.position.x = restrictPosition.x@@ -190,11 +190,11 @@ export const useNodesInteractions = () => {// Y-axis alignment with offset considerationif (showHorizontalHelpLineNodesLength > 0) {const targetNode = showHorizontalHelpLineNodes[0]- const isTargetEntryNode = isTriggerNode(targetNode.data.type as any) || targetNode.data.type === BlockEnum.Start+ const isTargetEntryNode = isTriggerNode(targetNode!.data.type as any) || targetNode!.data.type === BlockEnum.Startconst targetOffset = isTargetEntryNode ? ENTRY_NODE_WRAPPER_OFFSET.y : 0const currentOffset = isCurrentEntryNode ? ENTRY_NODE_WRAPPER_OFFSET.y : 0- currentNode.position.y = targetNode.position.y + targetOffset - currentOffset+ currentNode.position.y = targetNode!.position.y + targetOffset - currentOffset}else if (restrictPosition.y !== undefined) {currentNode.position.y = restrictPosition.y@@ -661,7 +661,7 @@ export const useNodesInteractions = () => {}else {if (iterationChildren.length === 1) {- handleNodeDelete(iterationChildren[0].id)+ handleNodeDelete(iterationChildren[0]!.id)handleNodeDelete(nodeId)return@@ -701,7 +701,7 @@ export const useNodesInteractions = () => {}else {if (loopChildren.length === 1) {- handleNodeDelete(loopChildren[0].id)+ handleNodeDelete(loopChildren[0]!.id)handleNodeDelete(nodeId)return@@ -846,7 +846,7 @@ export const useNodesInteractions = () => {if (prevNodeId && !nextNodeId) {const prevNodeIndex = nodes.findIndex(node => node.id === prevNodeId)const prevNode = nodes[prevNodeIndex]- const outgoers = getOutgoers(prevNode, nodes, edges).sort(+ const outgoers = getOutgoers(prevNode!, nodes, edges).sort((a, b) => a.position.y - b.position.y,)const lastOutgoer = outgoers[outgoers.length - 1]@@ -857,22 +857,22 @@ export const useNodesInteractions = () => {newNode.position = {x: lastOutgoer? lastOutgoer.position.x- : prevNode.position.x + prevNode.width! + X_OFFSET,+ : prevNode!.position.x + prevNode!.width! + X_OFFSET,y: lastOutgoer? lastOutgoer.position.y + lastOutgoer.height! + Y_OFFSET- : prevNode.position.y,+ : prevNode!.position.y,}- newNode.parentId = prevNode.parentId- newNode.extent = prevNode.extent+ newNode.parentId = prevNode!.parentId+ newNode.extent = prevNode!.extentconst parentNode- = nodes.find(node => node.id === prevNode.parentId) || null+ = nodes.find(node => node.id === prevNode!.parentId) || nullconst isInIteration= !!parentNode && parentNode.data.type === BlockEnum.Iterationconst isInLoop= !!parentNode && parentNode.data.type === BlockEnum.Loop- if (prevNode.parentId) {+ if (prevNode!.parentId) {newNode.data.isInIteration = isInIterationnewNode.data.isInLoop = isInLoopif (isInIteration) {@@ -913,15 +913,15 @@ export const useNodesInteractions = () => {target: newNode.id,targetHandle,data: {- sourceType: prevNode.data.type,+ sourceType: prevNode!.data.type,targetType: newNode.data.type,isInIteration,isInLoop,- iteration_id: isInIteration ? prevNode.parentId : undefined,- loop_id: isInLoop ? prevNode.parentId : undefined,+ iteration_id: isInIteration ? prevNode!.parentId : undefined,+ loop_id: isInLoop ? prevNode!.parentId : undefined,_connectedNodeIsSelected: true,},- zIndex: prevNode.parentId+ zIndex: prevNode!.parentId? isInIteration? ITERATION_CHILDREN_Z_INDEX: LOOP_CHILDREN_Z_INDEX@@ -947,7 +947,7 @@ export const useNodesInteractions = () => {if (node.data.type === BlockEnum.Iteration- && prevNode.parentId === node.id+ && prevNode!.parentId === node.id) {node.data._children?.push({nodeId: newNode.id,@@ -957,7 +957,7 @@ export const useNodesInteractions = () => {if (node.data.type === BlockEnum.Loop- && prevNode.parentId === node.id+ && prevNode!.parentId === node.id) {node.data._children?.push({nodeId: newNode.id,@@ -981,8 +981,8 @@ export const useNodesInteractions = () => {const { setShowAssignVariablePopup } = workflowStore.getState()setShowAssignVariablePopup({- nodeId: prevNode.id,- nodeData: prevNode.data,+ nodeId: prevNode!.id,+ nodeData: prevNode!.data,variableAssignerNodeId: newNode.id,variableAssignerNodeData: newNode.data as VariableAssignerNodeType,variableAssignerNodeHandleId: targetHandle,@@ -1271,7 +1271,7 @@ export const useNodesInteractions = () => {const nodesConnectedSourceOrTargetHandleIdsMap= getNodesConnectedSourceOrTargetHandleIdsMap([- { type: 'remove', edge: edges[currentEdgeIndex] },+ { type: 'remove', edge: edges[currentEdgeIndex]! },...(newPrevEdge ? [{ type: 'add', edge: newPrevEdge }] : []),...(newNextEdge ? [{ type: 'add', edge: newNextEdge }] : []),],@@ -2182,7 +2182,7 @@ export const useNodesInteractions = () => {const outgoers = getOutgoers(selectedNode as Node, nodes as Node[], edges)for (let currIdx = 0; currIdx < outgoers.length; currIdx++) {const node = outgoers[currIdx]- const outgoersForNode = getOutgoers(node, nodes as Node[], edges)+ const outgoersForNode = getOutgoers(node!, nodes as Node[], edges)outgoersForNode.forEach((item) => {const existed = outgoers.some(v => v.id === item.id)if (!existed)diff --git a/web/app/components/workflow/hooks/use-workflow-comment.ts b/web/app/components/workflow/hooks/use-workflow-comment.tsindex be50654fd3a..5b3f2e17b0a 100644--- a/web/app/components/workflow/hooks/use-workflow-comment.ts+++ b/web/app/components/workflow/hooks/use-workflow-comment.ts@@ -237,7 +237,7 @@ export const useWorkflowComment = () => {activeCommentIdRef.current = comment.idsetActiveCommentId(comment.id)- const cachedDetail = commentDetailCacheRef.current[comment.id]+ const cachedDetail = commentDetailCacheRef.current[comment.id]!setActiveComment(cachedDetail || comment)const hasSelectedNode = reactflow.getNodes().some(node => node.data?.selected)@@ -341,7 +341,7 @@ export const useWorkflowComment = () => {}else if (currentComments.length > 0) {const nextComment = currentComments[0]- handleCommentIconClick(nextComment)+ handleCommentIconClick(nextComment!)}else {setActiveComment(null)diff --git a/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-agent-log.spec.ts b/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-agent-log.spec.tsindex cabfc0f6d16..cae785546ad 100644--- a/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-agent-log.spec.ts+++ b/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-agent-log.spec.ts@@ -21,8 +21,8 @@ describe('useWorkflowAgentLog', () => {} as AgentLogResponse)const trace = store.getState().workflowRunningData!.tracing![0]- expect(trace.execution_metadata!.agent_log).toHaveLength(1)- expect(trace.execution_metadata!.agent_log![0].message_id).toBe('m1')+ expect(trace!.execution_metadata!.agent_log).toHaveLength(1)+ expect(trace!.execution_metadata!.agent_log![0]!.message_id).toBe('m1')})it('appends to existing agent_log', () => {@@ -41,7 +41,7 @@ describe('useWorkflowAgentLog', () => {data: { node_id: 'n1', message_id: 'm2' },} as AgentLogResponse)- expect(store.getState().workflowRunningData!.tracing![0].execution_metadata!.agent_log).toHaveLength(2)+ expect(store.getState().workflowRunningData!.tracing![0]!.execution_metadata!.agent_log).toHaveLength(2)})it('updates an existing log entry by message_id', () => {@@ -60,7 +60,7 @@ describe('useWorkflowAgentLog', () => {data: { node_id: 'n1', message_id: 'm1', text: 'new' },} as unknown as AgentLogResponse)- const log = store.getState().workflowRunningData!.tracing![0].execution_metadata!.agent_log!+ const log = store.getState().workflowRunningData!.tracing![0]!.execution_metadata!.agent_log!expect(log).toHaveLength(1)expect((log[0] as unknown as { text: string }).text).toBe('new')})@@ -78,6 +78,6 @@ describe('useWorkflowAgentLog', () => {data: { node_id: 'n1', message_id: 'm1' },} as AgentLogResponse)- expect(store.getState().workflowRunningData!.tracing![0].execution_metadata!.agent_log).toHaveLength(1)+ expect(store.getState().workflowRunningData!.tracing![0]!.execution_metadata!.agent_log).toHaveLength(1)})})diff --git a/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-finished.spec.ts b/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-finished.spec.tsindex efcdc15d880..1a1aa03eff1 100644--- a/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-finished.spec.ts+++ b/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-finished.spec.ts@@ -31,7 +31,7 @@ describe('useWorkflowNodeFinished', () => {})const trace = store.getState().workflowRunningData!.tracing![0]- expect(trace.status).toBe(NodeRunningStatus.Succeeded)+ expect(trace!.status).toBe(NodeRunningStatus.Succeeded)await waitFor(() => {expect(getNodeRuntimeState(result.current.nodes[0])._runningStatus).toBe(NodeRunningStatus.Succeeded)diff --git a/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-human-input-form-filled.spec.ts b/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-human-input-form-filled.spec.tsindex aa8e89327ba..f3fe206eb1e 100644--- a/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-human-input-form-filled.spec.ts+++ b/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-human-input-form-filled.spec.ts@@ -21,7 +21,7 @@ describe('useWorkflowNodeHumanInputFormFilled', () => {const state = store.getState().workflowRunningData!expect(state.humanInputFormDataList).toHaveLength(0)expect(state.humanInputFilledFormDataList).toHaveLength(1)- expect(state.humanInputFilledFormDataList![0].node_id).toBe('n1')+ expect(state.humanInputFilledFormDataList![0]!.node_id).toBe('n1')})it('creates humanInputFilledFormDataList when it does not exist', () => {diff --git a/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-human-input-form-timeout.spec.ts b/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-human-input-form-timeout.spec.tsindex e528b49846d..1b09cabf59f 100644--- a/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-human-input-form-timeout.spec.ts+++ b/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-human-input-form-timeout.spec.ts@@ -18,6 +18,6 @@ describe('useWorkflowNodeHumanInputFormTimeout', () => {data: { node_id: 'n1', node_title: 'Node 1', expiration_time: 1000 },} as HumanInputFormTimeoutResponse)- expect(store.getState().workflowRunningData!.humanInputFormDataList![0].expiration_time).toBe(1000)+ expect(store.getState().workflowRunningData!.humanInputFormDataList![0]!.expiration_time).toBe(1000)})})diff --git a/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-human-input-required.spec.ts b/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-human-input-required.spec.tsindex 23fdf8a3c38..45fe510246b 100644--- a/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-human-input-required.spec.ts+++ b/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-human-input-required.spec.ts@@ -32,8 +32,8 @@ describe('useWorkflowNodeHumanInputRequired', () => {const state = store.getState().workflowRunningData!expect(state.humanInputFormDataList).toHaveLength(1)- expect(state.humanInputFormDataList![0].form_id).toBe('f1')- expect(state.tracing![0].status).toBe(NodeRunningStatus.Paused)+ expect(state.humanInputFormDataList![0]!.form_id).toBe('f1')+ expect(state.tracing![0]!.status).toBe(NodeRunningStatus.Paused)await waitFor(() => {expect(getNodeRuntimeState(result.current.nodes.find(item => item.id === 'n1'))._runningStatus).toBe(NodeRunningStatus.Paused)@@ -65,7 +65,7 @@ describe('useWorkflowNodeHumanInputRequired', () => {const formList = store.getState().workflowRunningData!.humanInputFormDataList!expect(formList).toHaveLength(1)- expect(formList[0].form_id).toBe('new')+ expect(formList[0]!.form_id).toBe('new')})it('appends a new form entry for a different node_id', () => {diff --git a/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-iteration-started.spec.ts b/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-iteration-started.spec.tsindex ccff1b288bb..9472c0cafad 100644--- a/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-iteration-started.spec.ts+++ b/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-iteration-started.spec.ts@@ -30,7 +30,7 @@ describe('useWorkflowNodeIterationStarted', () => {})const tracing = store.getState().workflowRunningData!.tracing!- expect(tracing[0].status).toBe(NodeRunningStatus.Running)+ expect(tracing[0]!.status).toBe(NodeRunningStatus.Running)expect(store.getState().iterTimes).toBe(DEFAULT_ITER_TIMES)await waitFor(() => {diff --git a/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-loop-finished.spec.ts b/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-loop-finished.spec.tsindex 7acd9897ed8..86e3d9cdc38 100644--- a/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-loop-finished.spec.ts+++ b/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-loop-finished.spec.ts@@ -30,7 +30,7 @@ describe('useWorkflowNodeLoopFinished', () => {result.current.handleWorkflowNodeLoopFinished(createLoopFinishedResponse())})- expect(store.getState().workflowRunningData!.tracing![0].status).toBe(NodeRunningStatus.Succeeded)+ expect(store.getState().workflowRunningData!.tracing![0]!.status).toBe(NodeRunningStatus.Succeeded)await waitFor(() => {expect(getNodeRuntimeState(result.current.nodes[0])._runningStatus).toBe(NodeRunningStatus.Succeeded)diff --git a/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-loop-started.spec.ts b/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-loop-started.spec.tsindex b0e8bf2cc5d..d1648968620 100644--- a/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-loop-started.spec.ts+++ b/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-loop-started.spec.ts@@ -25,7 +25,7 @@ describe('useWorkflowNodeLoopStarted', () => {)})- expect(store.getState().workflowRunningData!.tracing![0].status).toBe(NodeRunningStatus.Running)+ expect(store.getState().workflowRunningData!.tracing![0]!.status).toBe(NodeRunningStatus.Running)await waitFor(() => {const transform = result.current.reactFlowStore.getState().transformdiff --git a/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-started.spec.ts b/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-started.spec.tsindex a8a52e0a84f..60a17207bc6 100644--- a/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-started.spec.ts+++ b/web/app/components/workflow/hooks/use-workflow-run-event/__tests__/use-workflow-node-started.spec.ts@@ -22,7 +22,7 @@ describe('useWorkflowNodeStarted', () => {const tracing = store.getState().workflowRunningData!.tracing!expect(tracing).toHaveLength(1)- expect(tracing[0].status).toBe(NodeRunningStatus.Running)+ expect(tracing[0]!.status).toBe(NodeRunningStatus.Running)await waitFor(() => {const transform = result.current.reactFlowStore.getState().transform@@ -75,6 +75,6 @@ describe('useWorkflowNodeStarted', () => {const tracing = store.getState().workflowRunningData!.tracing!expect(tracing).toHaveLength(2)- expect(tracing[1].status).toBe(NodeRunningStatus.Running)+ expect(tracing[1]!.status).toBe(NodeRunningStatus.Running)})})diff --git a/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-agent-log.ts b/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-agent-log.tsindex 08fb5260001..3d6e655c730 100644--- a/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-agent-log.ts+++ b/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-agent-log.ts@@ -18,25 +18,25 @@ export const useWorkflowAgentLog = () => {if (currentIndex > -1) {const current = draft.tracing![currentIndex]- if (current.execution_metadata) {- if (current.execution_metadata.agent_log) {- const currentLogIndex = current.execution_metadata.agent_log.findIndex(log => log.message_id === data.message_id)+ if (current!.execution_metadata) {+ if (current!.execution_metadata.agent_log) {+ const currentLogIndex = current!.execution_metadata.agent_log.findIndex(log => log.message_id === data.message_id)if (currentLogIndex > -1) {- current.execution_metadata.agent_log[currentLogIndex] = {- ...current.execution_metadata.agent_log[currentLogIndex],+ current!.execution_metadata.agent_log[currentLogIndex] = {+ ...current!.execution_metadata.agent_log[currentLogIndex],...data,}}else {- current.execution_metadata.agent_log.push(data)+ current!.execution_metadata.agent_log.push(data)}}else {- current.execution_metadata.agent_log = [data]+ current!.execution_metadata.agent_log = [data]}}else {- current.execution_metadata = {+ current!.execution_metadata = {agent_log: [data],} as any}diff --git a/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-finished.ts b/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-finished.tsindex 5fc88078730..3858b1eed8d 100644--- a/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-finished.ts+++ b/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-finished.ts@@ -14,7 +14,7 @@ export const useWorkflowFinished = () => {setWorkflowRunningData,} = workflowStore.getState()- const isStringOutput = data.outputs && Object.keys(data.outputs).length === 1 && typeof data.outputs[Object.keys(data.outputs)[0]] === 'string'+ const isStringOutput = data.outputs && Object.keys(data.outputs).length === 1 && typeof data.outputs[Object.keys(data.outputs)[0]!] === 'string'setWorkflowRunningData(produce(workflowRunningData!, (draft) => {draft.result = {@@ -24,7 +24,7 @@ export const useWorkflowFinished = () => {} as anyif (isStringOutput) {draft.resultTabActive = true- draft.resultText = data.outputs[Object.keys(data.outputs)[0]]+ draft.resultText = data.outputs[Object.keys(data.outputs)[0]!]}}))}, [workflowStore])diff --git a/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-node-human-input-form-timeout.ts b/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-node-human-input-form-timeout.tsindex d3016eeb1da..7e636e0eed1 100644--- a/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-node-human-input-form-timeout.ts+++ b/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-node-human-input-form-timeout.ts@@ -16,7 +16,7 @@ export const useWorkflowNodeHumanInputFormTimeout = () => {const newWorkflowRunningData = produce(workflowRunningData!, (draft) => {if (draft.humanInputFormDataList?.length) {const currentFormIndex = draft.humanInputFormDataList.findIndex(item => item.node_id === data.node_id)- draft.humanInputFormDataList[currentFormIndex].expiration_time = data.expiration_time+ draft.humanInputFormDataList[currentFormIndex]!.expiration_time = data.expiration_time}})setWorkflowRunningData(newWorkflowRunningData)diff --git a/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-node-human-input-required.ts b/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-node-human-input-required.tsindex 87f82c69f20..b14e7bdb21b 100644--- a/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-node-human-input-required.ts+++ b/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-node-human-input-required.ts@@ -35,7 +35,7 @@ export const useWorkflowNodeHumanInputRequired = () => {const currentIndex = draft.tracing!.findIndex(item => item.node_id === data.node_id)if (currentIndex > -1) {draft.tracing![currentIndex] = {- ...draft.tracing![currentIndex],+ ...draft.tracing![currentIndex]!,status: NodeRunningStatus.Paused,}}@@ -49,7 +49,7 @@ export const useWorkflowNodeHumanInputRequired = () => {const nodes = getNodes()const currentNodeIndex = nodes.findIndex(node => node.id === data.node_id)const newNodes = produce(nodes, (draft) => {- draft[currentNodeIndex].data._runningStatus = NodeRunningStatus.Paused+ draft[currentNodeIndex]!.data._runningStatus = NodeRunningStatus.Paused})setNodes(newNodes)}, [store, workflowStore])diff --git a/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-node-iteration-started.ts b/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-node-iteration-started.tsindex 388d3936ed8..b6f254db145 100644--- a/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-node-iteration-started.ts+++ b/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-node-iteration-started.ts@@ -48,20 +48,20 @@ export const useWorkflowNodeIterationStarted = () => {} = reactflowconst currentNodeIndex = nodes.findIndex(node => node.id === data.node_id)const currentNode = nodes[currentNodeIndex]- const position = currentNode.position+ const position = currentNode!.positionconst zoom = transform[2]- if (!currentNode.parentId) {+ if (!currentNode!.parentId) {setViewport({- x: (containerParams.clientWidth - 400 - currentNode.width! * zoom) / 2 - position.x * zoom,- y: (containerParams.clientHeight - currentNode.height! * zoom) / 2 - position.y * zoom,+ x: (containerParams.clientWidth - 400 - currentNode!.width! * zoom) / 2 - position.x * zoom,+ y: (containerParams.clientHeight - currentNode!.height! * zoom) / 2 - position.y * zoom,zoom: transform[2],})}const newNodes = produce(nodes, (draft) => {- draft[currentNodeIndex].data._runningStatus = NodeRunningStatus.Running- draft[currentNodeIndex].data._iterationLength = data.metadata.iterator_length- draft[currentNodeIndex].data._waitingRun = false+ draft[currentNodeIndex]!.data._runningStatus = NodeRunningStatus.Running+ draft[currentNodeIndex]!.data._iterationLength = data.metadata.iterator_length+ draft[currentNodeIndex]!.data._waitingRun = false})setNodes(newNodes)const newEdges = produce(edges, (draft) => {diff --git a/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-node-loop-started.ts b/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-node-loop-started.tsindex c5ace9c6920..dcdf6519678 100644--- a/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-node-loop-started.ts+++ b/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-node-loop-started.ts@@ -45,20 +45,20 @@ export const useWorkflowNodeLoopStarted = () => {} = reactflowconst currentNodeIndex = nodes.findIndex(node => node.id === data.node_id)const currentNode = nodes[currentNodeIndex]- const position = currentNode.position+ const position = currentNode!.positionconst zoom = transform[2]- if (!currentNode.parentId) {+ if (!currentNode!.parentId) {setViewport({- x: (containerParams.clientWidth - 400 - currentNode.width! * zoom) / 2 - position.x * zoom,- y: (containerParams.clientHeight - currentNode.height! * zoom) / 2 - position.y * zoom,+ x: (containerParams.clientWidth - 400 - currentNode!.width! * zoom) / 2 - position.x * zoom,+ y: (containerParams.clientHeight - currentNode!.height! * zoom) / 2 - position.y * zoom,zoom: transform[2],})}const newNodes = produce(nodes, (draft) => {- draft[currentNodeIndex].data._runningStatus = NodeRunningStatus.Running- draft[currentNodeIndex].data._loopLength = data.metadata.loop_length- draft[currentNodeIndex].data._waitingRun = false+ draft[currentNodeIndex]!.data._runningStatus = NodeRunningStatus.Running+ draft[currentNodeIndex]!.data._loopLength = data.metadata.loop_length+ draft[currentNodeIndex]!.data._waitingRun = false})setNodes(newNodes)const newEdges = produce(edges, (draft) => {diff --git a/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-node-started.ts b/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-node-started.tsindex 01f60e12e9b..a435bbdda6e 100644--- a/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-node-started.ts+++ b/web/app/components/workflow/hooks/use-workflow-run-event/use-workflow-node-started.ts@@ -56,19 +56,19 @@ export const useWorkflowNodeStarted = () => {} = reactflowconst currentNodeIndex = nodes.findIndex(node => node.id === data.node_id)const currentNode = nodes[currentNodeIndex]- const position = currentNode.position+ const position = currentNode!.positionconst zoom = transform[2]- if (!currentNode.parentId) {+ if (!currentNode!.parentId) {setViewport({- x: (containerParams.clientWidth - 400 - currentNode.width! * zoom) / 2 - position.x * zoom,- y: (containerParams.clientHeight - currentNode.height! * zoom) / 2 - position.y * zoom,+ x: (containerParams.clientWidth - 400 - currentNode!.width! * zoom) / 2 - position.x * zoom,+ y: (containerParams.clientHeight - currentNode!.height! * zoom) / 2 - position.y * zoom,zoom: transform[2],})}const newNodes = produce(nodes, (draft) => {- draft[currentNodeIndex].data._runningStatus = NodeRunningStatus.Running- draft[currentNodeIndex].data._waitingRun = false+ draft[currentNodeIndex]!.data._runningStatus = NodeRunningStatus.Running+ draft[currentNodeIndex]!.data._waitingRun = false})setNodes(newNodes)const newEdges = produce(edges, (draft) => {diff --git a/web/app/components/workflow/hooks/use-workflow.ts b/web/app/components/workflow/hooks/use-workflow.tsindex 02353bb9517..7344496984c 100644--- a/web/app/components/workflow/hooks/use-workflow.ts+++ b/web/app/components/workflow/hooks/use-workflow.ts@@ -253,7 +253,7 @@ export const useWorkflow = () => {const isVarUsedInNodes = useCallback((varSelector: ValueSelector) => {const nodeId = varSelector[0]- const afterNodes = getAfterNodesInSameBranch(nodeId)+ const afterNodes = getAfterNodesInSameBranch(nodeId!)const effectNodes = findUsedVarNodes(varSelector, afterNodes)return effectNodes.length > 0}, [getAfterNodesInSameBranch])@@ -261,7 +261,7 @@ export const useWorkflow = () => {const removeUsedVarInNodes = useCallback((varSelector: ValueSelector) => {const nodeId = varSelector[0]const { nodes, setNodes } = collaborativeWorkflow.getState()- const afterNodes = getAfterNodesInSameBranch(nodeId)+ const afterNodes = getAfterNodesInSameBranch(nodeId!)const effectNodes = findUsedVarNodes(varSelector, afterNodes)if (effectNodes.length > 0) {const newNodes = nodes.map((node) => {diff --git a/web/app/components/workflow/index.tsx b/web/app/components/workflow/index.tsxindex 71d9366552b..12122c5b72f 100644--- a/web/app/components/workflow/index.tsx+++ b/web/app/components/workflow/index.tsx@@ -226,7 +226,7 @@ export const Workflow: FC<WorkflowProps> = memo(({if (workflowContainerRef.current) {const resizeContainerObserver = new ResizeObserver((entries) => {for (const entry of entries) {- const { inlineSize, blockSize } = entry.borderBoxSize[0]+ const { inlineSize, blockSize } = entry.borderBoxSize[0]!setWorkflowCanvasWidth(inlineSize)setWorkflowCanvasHeight(blockSize)}diff --git a/web/app/components/workflow/nodes/_base/components/before-run-form/form-item.tsx b/web/app/components/workflow/nodes/_base/components/before-run-form/form-item.tsxindex 595b38c7e2a..e3fd96e3c18 100644--- a/web/app/components/workflow/nodes/_base/components/before-run-form/form-item.tsx+++ b/web/app/components/workflow/nodes/_base/components/before-run-form/form-item.tsx@@ -236,10 +236,10 @@ const FormItem: FC<Props> = ({: payload.allowed_file_types,allowed_file_extensions: inStepRun && (!payload.allowed_file_extensions || payload.allowed_file_extensions.length === 0)? [- ...FILE_EXTS[SupportUploadFileTypes.image],- ...FILE_EXTS[SupportUploadFileTypes.document],- ...FILE_EXTS[SupportUploadFileTypes.audio],- ...FILE_EXTS[SupportUploadFileTypes.video],+ ...(FILE_EXTS[SupportUploadFileTypes.image] ?? []),+ ...(FILE_EXTS[SupportUploadFileTypes.document] ?? []),+ ...(FILE_EXTS[SupportUploadFileTypes.audio] ?? []),+ ...(FILE_EXTS[SupportUploadFileTypes.video] ?? []),]: payload.allowed_file_extensions,allowed_file_upload_methods: inStepRun ? [TransferMethod.local_file, TransferMethod.remote_url] : payload.allowed_file_upload_methods,@@ -263,10 +263,10 @@ const FormItem: FC<Props> = ({: payload.allowed_file_types,allowed_file_extensions: (inStepRun || isIteratorItemFile) && (!payload.allowed_file_extensions || payload.allowed_file_extensions.length === 0)? [- ...FILE_EXTS[SupportUploadFileTypes.image],- ...FILE_EXTS[SupportUploadFileTypes.document],- ...FILE_EXTS[SupportUploadFileTypes.audio],- ...FILE_EXTS[SupportUploadFileTypes.video],+ ...(FILE_EXTS[SupportUploadFileTypes.image] ?? []),+ ...(FILE_EXTS[SupportUploadFileTypes.document] ?? []),+ ...(FILE_EXTS[SupportUploadFileTypes.audio] ?? []),+ ...(FILE_EXTS[SupportUploadFileTypes.video] ?? []),]: payload.allowed_file_extensions,allowed_file_upload_methods: (inStepRun || isIteratorItemFile) ? [TransferMethod.local_file, TransferMethod.remote_url] : payload.allowed_file_upload_methods,diff --git a/web/app/components/workflow/nodes/_base/components/before-run-form/form.tsx b/web/app/components/workflow/nodes/_base/components/before-run-form/form.tsxindex a57428e79c7..55732ff1cbb 100644--- a/web/app/components/workflow/nodes/_base/components/before-run-form/form.tsx+++ b/web/app/components/workflow/nodes/_base/components/before-run-form/form.tsx@@ -60,13 +60,13 @@ const Form: FC<Props> = ({onChange(newValues)}}, [valuesRef, onChange, mapKeysWithSameValueSelector])- const isArrayLikeType = [InputVarType.contexts, InputVarType.iterator].includes(inputs[0]?.type)+ const isArrayLikeType = [InputVarType.contexts, InputVarType.iterator].includes(inputs[0]?.type!)const isIteratorItemFile = inputs[0]?.type === InputVarType.iterator && inputs[0]?.isFileItemconst isContext = inputs[0]?.type === InputVarType.contextsconst handleAddContext = useCallback(() => {const newValues = produce(values, (draft: any) => {- const key = inputs[0].variable+ const key = inputs[0]!.variableif (!draft[key])draft[key] = []draft[key].push(isContext ? RETRIEVAL_OUTPUT_STRUCT : '')diff --git a/web/app/components/workflow/nodes/_base/components/before-run-form/helpers.ts b/web/app/components/workflow/nodes/_base/components/before-run-form/helpers.tsindex c0e08f64ec5..35a9b559c35 100644--- a/web/app/components/workflow/nodes/_base/components/before-run-form/helpers.ts+++ b/web/app/components/workflow/nodes/_base/components/before-run-form/helpers.ts@@ -55,7 +55,7 @@ export const getFormErrorMessage = (const value = form.values[input.variable] as unknownconst missingRequired = input.required&& input.type !== InputVarType.checkbox- && !(input.variable in existVarValuesInForm)+ && !(input.variable in existVarValuesInForm!)&& (value === '' || value === undefined || value === null|| (diff --git a/web/app/components/workflow/nodes/_base/components/editor/code-editor/editor-support-vars.tsx b/web/app/components/workflow/nodes/_base/components/editor/code-editor/editor-support-vars.tsxindex 7e79738b104..4944b079de9 100644--- a/web/app/components/workflow/nodes/_base/components/editor/code-editor/editor-support-vars.tsx+++ b/web/app/components/workflow/nodes/_base/components/editor/code-editor/editor-support-vars.tsx@@ -110,7 +110,7 @@ const CodeEditor: FC<Props> = ({}const varName = varValue.slice(-1)[0]return {- name: getUniqVarName(varName),+ name: getUniqVarName(varName!),isExist: false,}}diff --git a/web/app/components/workflow/nodes/_base/components/error-handle/utils.ts b/web/app/components/workflow/nodes/_base/components/error-handle/utils.tsindex ac48407c039..4c8c6898e28 100644--- a/web/app/components/workflow/nodes/_base/components/error-handle/utils.ts+++ b/web/app/components/workflow/nodes/_base/components/error-handle/utils.ts@@ -73,8 +73,8 @@ export const getDefaultValue = (data: CommonNodeType) => {return Object.keys(outputs).map((key) => {return {key,- type: outputs[key].type,- value: getDefaultValueByType(outputs[key].type),+ type: outputs[key]!.type,+ value: getDefaultValueByType(outputs[key]!.type),}})}diff --git a/web/app/components/workflow/nodes/_base/components/file-type-item.tsx b/web/app/components/workflow/nodes/_base/components/file-type-item.tsxindex e4e1f53fc9b..0f1fd9bafa9 100644--- a/web/app/components/workflow/nodes/_base/components/file-type-item.tsx+++ b/web/app/components/workflow/nodes/_base/components/file-type-item.tsx@@ -66,7 +66,7 @@ const FileTypeItem: FC<Props> = ({<FileTypeIcon className="shrink-0" type={type} size="lg" /><div className="mx-2 grow"><div className="system-sm-medium text-text-primary">{t(`variableConfig.file.${type}.name`, { ns: 'appDebug' })}</div>- <div className="mt-1 system-2xs-regular-uppercase text-text-tertiary">{type !== SupportUploadFileTypes.custom ? FILE_EXTS[type].join(', ') : t('variableConfig.file.custom.description', { ns: 'appDebug' })}</div>+ <div className="mt-1 system-2xs-regular-uppercase text-text-tertiary">{type !== SupportUploadFileTypes.custom ? FILE_EXTS[type]!.join(', ') : t('variableConfig.file.custom.description', { ns: 'appDebug' })}</div></div><Checkbox className="shrink-0" checked={selected} /></div>diff --git a/web/app/components/workflow/nodes/_base/components/next-step/line.tsx b/web/app/components/workflow/nodes/_base/components/next-step/line.tsxindex 862657e34b8..cc61120c3c2 100644--- a/web/app/components/workflow/nodes/_base/components/next-step/line.tsx+++ b/web/app/components/workflow/nodes/_base/components/next-step/line.tsx@@ -16,14 +16,14 @@ const Line = ({return listHeight.slice(0, index).reduce((acc, cur) => acc + cur, 0) + item})const processedListLength = processedList.length- const svgHeight = processedList[processedListLength - 1] + (processedListLength - 1) * 8+ const svgHeight = processedList[processedListLength - 1]! + (processedListLength - 1) * 8return (<svg className="w-6 shrink-0" style={{ height: svgHeight }}>{processedList.map((item, index) => {const prevItem = index > 0 ? processedList[index - 1] : 0- const space = prevItem + index * 8 + 16+ const space = prevItem! + index * 8 + 16return (<g key={index}>{diff --git a/web/app/components/workflow/nodes/_base/components/readonly-input-with-select-var.tsx b/web/app/components/workflow/nodes/_base/components/readonly-input-with-select-var.tsxindex bba7cfa7fc7..fb6e0e42119 100644--- a/web/app/components/workflow/nodes/_base/components/readonly-input-with-select-var.tsx+++ b/web/app/components/workflow/nodes/_base/components/readonly-input-with-select-var.tsx@@ -41,7 +41,7 @@ const ReadonlyInputWithSelectVar: FC<Props> = ({const value = vars[index].split('.')const isSystem = isSystemVar(value)- const node = (isSystem ? startNode : getNodeInfoById(availableNodes, value[0]))?.data+ const node = (isSystem ? startNode : getNodeInfoById(availableNodes, value[0]!))?.dataconst isShowAPart = value.length > 2return (diff --git a/web/app/components/workflow/nodes/_base/components/support-var-input/index.tsx b/web/app/components/workflow/nodes/_base/components/support-var-input/index.tsxindex 77dd9d4c377..6a7d3ff2464 100644--- a/web/app/components/workflow/nodes/_base/components/support-var-input/index.tsx+++ b/web/app/components/workflow/nodes/_base/components/support-var-input/index.tsx@@ -32,7 +32,7 @@ const SupportVarInput: FC<Props> = ({return (<VarHighlightkey={`var-${index}`}- name={variableMatch[1]}+ name={variableMatch[1]!}/>)}diff --git a/web/app/components/workflow/nodes/_base/components/switch-plugin-version.tsx b/web/app/components/workflow/nodes/_base/components/switch-plugin-version.tsxindex f279b55d035..ccd92f7296c 100644--- a/web/app/components/workflow/nodes/_base/components/switch-plugin-version.tsx+++ b/web/app/components/workflow/nodes/_base/components/switch-plugin-version.tsx@@ -35,7 +35,7 @@ export const SwitchPluginVersion: FC<SwitchPluginVersionProps> = (props) => {pluginUniqueIden: string}>()const pluginDetails = useCheckInstalled({- pluginIds: [pluginId],+ pluginIds: [pluginId!],enabled: true,})const pluginDetail = pluginDetails.data?.plugins.at(0)diff --git a/web/app/components/workflow/nodes/_base/components/variable-tag.tsx b/web/app/components/workflow/nodes/_base/components/variable-tag.tsxindex a72e9b1da11..be2d8ed0aa5 100644--- a/web/app/components/workflow/nodes/_base/components/variable-tag.tsx+++ b/web/app/components/workflow/nodes/_base/components/variable-tag.tsx@@ -34,7 +34,7 @@ const VariableTag = ({if (startNode)return startNode}- return getNodeInfoById(availableNodes || nodes, isRagVar ? valueSelector[1] : valueSelector[0])+ return getNodeInfoById(availableNodes || nodes, isRagVar ? valueSelector[1]! : valueSelector[0]!)}, [nodes, valueSelector, availableNodes, isRagVar])const isEnv = isENV(valueSelector)diff --git a/web/app/components/workflow/nodes/_base/components/variable/__tests__/output-var-list.spec.tsx b/web/app/components/workflow/nodes/_base/components/variable/__tests__/output-var-list.spec.tsxindex 24464e4f082..e83fee6c551 100644--- a/web/app/components/workflow/nodes/_base/components/variable/__tests__/output-var-list.spec.tsx+++ b/web/app/components/workflow/nodes/_base/components/variable/__tests__/output-var-list.spec.tsx@@ -49,7 +49,7 @@ describe('OutputVarList', () => {)const inputs = screen.getAllByRole('textbox')- fireEvent.change(inputs[renameIndex], { target: { value: newName } })+ fireEvent.change(inputs[renameIndex]!, { target: { value: newName } })return captured!}@@ -119,7 +119,7 @@ describe('OutputVarList', () => {// The second remove button (index 1 in the row)const buttons = screen.getAllByRole('button')- fireEvent.click(buttons[1])+ fireEvent.click(buttons[1]!)expect(onRemove).toHaveBeenCalledWith(1)})@@ -142,8 +142,8 @@ describe('OutputVarList', () => {const inputs = screen.getAllByRole('textbox')expect(inputs).toHaveLength(2)- expect(inputs[0]).toHaveValue('a')- expect(inputs[1]).toHaveValue('b')+ expect(inputs[0])!.toHaveValue('a')+ expect(inputs[1])!.toHaveValue('b')})it('should call onChange with updated outputs when renaming', () => {@@ -203,7 +203,7 @@ describe('OutputVarList', () => {/>,)- expect(screen.getByRole('textbox')).toHaveAttribute('readonly')+ expect(screen.getByRole('textbox'))!.toHaveAttribute('readonly')})})})diff --git a/web/app/components/workflow/nodes/_base/components/variable/__tests__/var-reference-picker.trigger.spec.tsx b/web/app/components/workflow/nodes/_base/components/variable/__tests__/var-reference-picker.trigger.spec.tsxindex 60b7e34f292..f7264bcc99a 100644--- a/web/app/components/workflow/nodes/_base/components/variable/__tests__/var-reference-picker.trigger.spec.tsx+++ b/web/app/components/workflow/nodes/_base/components/variable/__tests__/var-reference-picker.trigger.spec.tsx@@ -55,7 +55,7 @@ describe('VarReferencePickerTrigger', () => {/>,)- expect(screen.getByText('Pick variable')).toBeInTheDocument()+ expect(screen.getByText('Pick variable'))!.toBeInTheDocument()fireEvent.click(screen.getByTestId('var-reference-picker-trigger'))expect(setOpen).toHaveBeenCalledWith(true)})@@ -79,8 +79,8 @@ describe('VarReferencePickerTrigger', () => {/>,)- expect(screen.getByText('Source Node')).toBeInTheDocument()- expect(screen.getByText('answer')).toBeInTheDocument()+ expect(screen.getByText('Source Node'))!.toBeInTheDocument()+ expect(screen.getByText('answer'))!.toBeInTheDocument()fireEvent.click(screen.getByText('Source Node'), { ctrlKey: true })expect(handleVariableJump).toHaveBeenCalledWith('node-a')@@ -128,7 +128,7 @@ describe('VarReferencePickerTrigger', () => {/>,)- expect(document.querySelector('button')).toBeInTheDocument()+ expect(document.querySelector('button'))!.toBeInTheDocument()})it('should stay inert in readonly mode and show value type placeholder badge', () => {@@ -148,8 +148,8 @@ describe('VarReferencePickerTrigger', () => {fireEvent.click(screen.getByTestId('var-reference-picker-trigger'))expect(setOpen).not.toHaveBeenCalled()- expect(screen.getByText('string')).toBeInTheDocument()- expect(screen.getByText('text')).toBeInTheDocument()+ expect(screen.getByText('string'))!.toBeInTheDocument()+ expect(screen.getByText('text'))!.toBeInTheDocument()})it('should show loading placeholder and remove rows in table mode', () => {@@ -167,10 +167,10 @@ describe('VarReferencePickerTrigger', () => {/>,)- expect(screen.getByText('Loading variable')).toBeInTheDocument()+ expect(screen.getByText('Loading variable'))!.toBeInTheDocument()const buttons = screen.getAllByRole('button')- fireEvent.click(buttons[buttons.length - 1])+ fireEvent.click(buttons[buttons.length - 1]!)expect(onRemove).toHaveBeenCalledTimes(1)})})diff --git a/web/app/components/workflow/nodes/_base/components/variable/__tests__/var-reference-vars.helpers.spec.ts b/web/app/components/workflow/nodes/_base/components/variable/__tests__/var-reference-vars.helpers.spec.tsindex 5b00464be1c..773ecacc395 100644--- a/web/app/components/workflow/nodes/_base/components/variable/__tests__/var-reference-vars.helpers.spec.ts+++ b/web/app/components/workflow/nodes/_base/components/variable/__tests__/var-reference-vars.helpers.spec.ts@@ -78,7 +78,7 @@ describe('var-reference-vars helpers', () => {] as NodeOutPutVar[], 'another')expect(vars).toHaveLength(1)- expect(vars[0].title).toBe('Node B')- expect(vars[0].vars).toEqual([expect.objectContaining({ variable: 'another_value' })])+ expect(vars[0]!.title).toBe('Node B')+ expect(vars[0]!.vars).toEqual([expect.objectContaining({ variable: 'another_value' })])})})diff --git a/web/app/components/workflow/nodes/_base/components/variable/object-child-tree-panel/picker/index.tsx b/web/app/components/workflow/nodes/_base/components/variable/object-child-tree-panel/picker/index.tsxindex 5cfb96fee46..c9ba9465d95 100644--- a/web/app/components/workflow/nodes/_base/components/variable/object-child-tree-panel/picker/index.tsx+++ b/web/app/components/workflow/nodes/_base/components/variable/object-child-tree-panel/picker/index.tsx@@ -59,7 +59,7 @@ export const PickerPanelMain: FC<Props> = ({<Fieldkey={name}name={name}- payload={schema.properties[name]}+ payload={schema.properties[name]!}readonly={readonly}valueSelector={[root.nodeId!, root.attrName]}onSelect={onSelect}diff --git a/web/app/components/workflow/nodes/_base/components/variable/object-child-tree-panel/show/index.tsx b/web/app/components/workflow/nodes/_base/components/variable/object-child-tree-panel/show/index.tsxindex 310c2dc9cfd..ba03c3b17a7 100644--- a/web/app/components/workflow/nodes/_base/components/variable/object-child-tree-panel/show/index.tsx+++ b/web/app/components/workflow/nodes/_base/components/variable/object-child-tree-panel/show/index.tsx@@ -28,7 +28,7 @@ const ShowPanel: FC<Props> = ({<Fieldkey={name}name={name}- payload={schema.schema.properties![name]}+ payload={schema.schema.properties![name]!}required={!!schema.schema.required?.includes(name)}rootClassName={rootClassName}/>diff --git a/web/app/components/workflow/nodes/_base/components/variable/output-var-list.tsx b/web/app/components/workflow/nodes/_base/components/variable/output-var-list.tsxindex 79238aa6de5..d43efc1b304 100644--- a/web/app/components/workflow/nodes/_base/components/variable/output-var-list.tsx+++ b/web/app/components/workflow/nodes/_base/components/variable/output-var-list.tsx@@ -33,7 +33,7 @@ const OutputVarList: FC<Props> = ({const list = outputKeyOrders.map((key) => {return {variable: key,- variable_type: outputs[key]?.type,+ variable_type: outputs[key]?.type!,}})@@ -50,7 +50,7 @@ const OutputVarList: FC<Props> = ({const handleVarNameChange = useCallback((index: number) => {return (e: React.ChangeEvent<HTMLInputElement>) => {- const oldKey = list[index].variable+ const oldKey = list[index]!.variablereplaceSpaceWithUnderscoreInVarNameInput(e.target)const newKey = e.target.value@@ -58,7 +58,7 @@ const OutputVarList: FC<Props> = ({validateVarInput(list.toSpliced(index, 1), newKey)const newOutputs = produce(outputs, (draft) => {- draft[newKey] = draft[oldKey]+ draft[newKey] = draft[oldKey]!// Only delete old key if no other entry shares this nameif (!list.some((item, i) => i !== index && item.variable === oldKey))delete draft[oldKey]@@ -69,9 +69,9 @@ const OutputVarList: FC<Props> = ({const handleVarTypeChange = useCallback((index: number) => {return (value: string) => {- const key = list[index].variable+ const key = list[index]!.variableconst newOutputs = produce(outputs, (draft) => {- draft[key].type = value as VarType+ draft[key]!.type = value as VarType})onChange(newOutputs)}diff --git a/web/app/components/workflow/nodes/_base/components/variable/utils.ts b/web/app/components/workflow/nodes/_base/components/variable/utils.tsindex c1314276488..3754058b509 100644--- a/web/app/components/workflow/nodes/_base/components/variable/utils.ts+++ b/web/app/components/workflow/nodes/_base/components/variable/utils.ts@@ -79,7 +79,7 @@ export const isGlobalVar = (valueSelector: ValueSelector) => {return falseconst second = valueSelector[1]- if (['query', 'files'].includes(second))+ if (['query', 'files'].includes(second!))return falsereturn true}@@ -176,9 +176,9 @@ const findExceptVarInStructuredProperties = (const res = produce(properties, (draft) => {Object.keys(properties).forEach((key) => {const item = properties[key]- const isObj = item.type === Type.object- const isArray = item.type === Type.array- const arrayType = item.items?.type+ const isObj = item!.type === Type.object+ const isArray = item!.type === Type.array+ const arrayType = item!.items?.typeif (!isObj@@ -186,7 +186,7 @@ const findExceptVarInStructuredProperties = ({variable: key,type: structTypeToVarType(- isArray ? arrayType! : item.type,+ isArray ? arrayType! : item!.type,isArray,),},@@ -196,9 +196,9 @@ const findExceptVarInStructuredProperties = (delete properties[key]return}- if (item.type === Type.object && item.properties) {- item.properties = findExceptVarInStructuredProperties(- item.properties,+ if (item!.type === Type.object && item!.properties) {+ item!.properties = findExceptVarInStructuredProperties(+ item!.properties,filterVar,)}@@ -216,16 +216,16 @@ const findExceptVarInStructuredOutput = (const properties = draft.schema.propertiesObject.keys(properties).forEach((key) => {const item = properties[key]- const isObj = item.type === Type.object- const isArray = item.type === Type.array- const arrayType = item.items?.type+ const isObj = item!.type === Type.object+ const isArray = item!.type === Type.array+ const arrayType = item!.items?.typeif (!isObj&& !filterVar({variable: key,type: structTypeToVarType(- isArray ? arrayType! : item.type,+ isArray ? arrayType! : item!.type,isArray,),},@@ -235,9 +235,9 @@ const findExceptVarInStructuredOutput = (delete properties[key]return}- if (item.type === Type.object && item.properties) {- item.properties = findExceptVarInStructuredProperties(- item.properties,+ if (item!.type === Type.object && item!.properties) {+ item!.properties = findExceptVarInStructuredProperties(+ item!.properties,filterVar,)}@@ -427,7 +427,7 @@ const formatItem = (? Object.keys(outputs).map((key) => {return {variable: key,- type: outputs[key].type,+ type: outputs[key]!.type,}}): []@@ -711,7 +711,7 @@ const formatItem = ((() => {const variableArr = v.variable.split('.')const [first] = variableArr- if (isSpecialVar(first))+ if (isSpecialVar(first!))return variableArrreturn [...selector, ...variableArr]@@ -1435,16 +1435,16 @@ export const getNodeUsedVars = (node: Node): ValueSelector[] => {const mixVars = matchNotSystemVars(Object.keys(payload.tool_parameters)?.filter(- key => payload.tool_parameters[key].type === ToolVarType.mixed,+ key => payload.tool_parameters[key]!.type === ToolVarType.mixed,)- .map(key => payload.tool_parameters[key].value) as string[],+ .map(key => payload.tool_parameters[key]!.value) as string[],)const vars= Object.keys(payload.tool_parameters).filter(- key => payload.tool_parameters[key].type === ToolVarType.variable,+ key => payload.tool_parameters[key]!.type === ToolVarType.variable,)- .map(key => payload.tool_parameters[key].value as string) || []+ .map(key => payload.tool_parameters[key]!.value as string) || []res = [...(mixVars as ValueSelector[]), ...(vars as any)]break}@@ -1454,17 +1454,17 @@ export const getNodeUsedVars = (node: Node): ValueSelector[] => {Object.keys(payload.datasource_parameters)?.filter(key =>- payload.datasource_parameters[key].type === ToolVarType.mixed,+ payload.datasource_parameters[key]!.type === ToolVarType.mixed,)- .map(key => payload.datasource_parameters[key].value) as string[],+ .map(key => payload.datasource_parameters[key]!.value) as string[],)const vars= Object.keys(payload.datasource_parameters).filter(key =>- payload.datasource_parameters[key].type === ToolVarType.variable,+ payload.datasource_parameters[key]!.type === ToolVarType.variable,)- .map(key => payload.datasource_parameters[key].value as string)+ .map(key => payload.datasource_parameters[key]!.value as string)|| []res = [...(mixVars as ValueSelector[]), ...(vars as any)]break@@ -1514,7 +1514,7 @@ export const getNodeUsedVars = (node: Node): ValueSelector[] => {breakObject.keys(payload.agent_parameters || {}).forEach((key) => {- const { value } = payload.agent_parameters![key]+ const { value } = payload.agent_parameters![key]!if (typeof value === 'string')valueSelectors.push(...matchNotSystemVars([value]))})@@ -1845,15 +1845,15 @@ export const updateNodeVars = (case BlockEnum.Tool: {const payload = data as ToolNodeTypeconst hasShouldRenameVar = Object.keys(payload.tool_parameters)?.filter(- key => payload.tool_parameters[key].type !== ToolVarType.constant,+ key => payload.tool_parameters[key]!.type !== ToolVarType.constant,)if (hasShouldRenameVar) {Object.keys(payload.tool_parameters).forEach((key) => {- const value = payload.tool_parameters[key]- const { type } = value+ const value = payload.tool_parameters[key]!+ const { type } = value!if (type === ToolVarType.variable- && value.value.join('.') === oldVarSelector.join('.')+ && value!.value.join('.') === oldVarSelector.join('.')) {payload.tool_parameters[key] = {...value,@@ -1865,7 +1865,7 @@ export const updateNodeVars = (payload.tool_parameters[key] = {...value,value: replaceOldVarInText(- payload.tool_parameters[key].value as string,+ payload.tool_parameters[key]!.value as string,oldVarSelector,newVarSelector,),@@ -1881,15 +1881,15 @@ export const updateNodeVars = (payload.datasource_parameters,)?.filter(key =>- payload.datasource_parameters[key].type !== ToolVarType.constant,+ payload.datasource_parameters[key]!.type !== ToolVarType.constant,)if (hasShouldRenameVar) {Object.keys(payload.datasource_parameters).forEach((key) => {- const value = payload.datasource_parameters[key]- const { type } = value+ const value = payload.datasource_parameters[key]!+ const { type } = value!if (type === ToolVarType.variable- && value.value.join('.') === oldVarSelector.join('.')+ && value!.value.join('.') === oldVarSelector.join('.')) {payload.datasource_parameters[key] = {...value,@@ -1901,7 +1901,7 @@ export const updateNodeVars = (payload.datasource_parameters[key] = {...value,value: replaceOldVarInText(- payload.datasource_parameters[key].value as string,+ payload.datasource_parameters[key]!.value as string,oldVarSelector,newVarSelector,),@@ -1915,13 +1915,13 @@ export const updateNodeVars = (const payload = data as AgentNodeTypeif (payload.agent_parameters) {Object.keys(payload.agent_parameters).forEach((key) => {- const value = payload.agent_parameters![key]- const { type } = value+ const value = payload.agent_parameters![key]!+ const { type } = value!if (type === ToolVarType.variable- && Array.isArray(value.value)- && value.value.join('.') === oldVarSelector.join('.')+ && Array.isArray(value!.value)+ && value!.value.join('.') === oldVarSelector.join('.')) {payload.agent_parameters![key] = {...value,@@ -1929,11 +1929,11 @@ export const updateNodeVars = (}}- if (type === ToolVarType.mixed && typeof value.value === 'string') {+ if (type === ToolVarType.mixed && typeof value!.value === 'string') {payload.agent_parameters![key] = {...value,value: replaceOldVarInText(- value.value,+ value!.value,oldVarSelector,newVarSelector,),@@ -2059,11 +2059,11 @@ const varToValueSelectorList = (Object.keys((v.children as StructuredOutput)?.schema?.properties || {},).forEach((key) => {- const type = (v.children as StructuredOutput)?.schema?.properties[key].type+ const type = (v.children as StructuredOutput)?.schema?.properties[key]!.typeconst isArray = type === Type.arrayconst arrayType = (v.children as StructuredOutput)?.schema?.properties[key- ].items?.type+ ]!.items?.typevarToValueSelectorList({variable: key,diff --git a/web/app/components/workflow/nodes/_base/components/variable/var-full-path-panel.tsx b/web/app/components/workflow/nodes/_base/components/variable/var-full-path-panel.tsxindex b2c63be8b61..1ca54888b6f 100644--- a/web/app/components/workflow/nodes/_base/components/variable/var-full-path-panel.tsx+++ b/web/app/components/workflow/nodes/_base/components/variable/var-full-path-panel.tsx@@ -31,11 +31,11 @@ const VarFullPathPanel: FC<Props> = ({for (let i = 1; i < path.length; i++) {const isLast = i === path.length - 1const name = path[i]- current.properties[name] = {+ current.properties[name!] = {type: isLast ? varType : Type.object,properties: {},} as Field- current = current.properties[name] as { type: Type.object, properties: { [key: string]: Field }, required: never[], additionalProperties: false }+ current = current.properties[name!] as { type: Type.object, properties: { [key: string]: Field }, required: never[], additionalProperties: false }}return {schema,@@ -49,7 +49,7 @@ const VarFullPathPanel: FC<Props> = ({</div><PanelclassName="px-1 pb-3 pt-2"- root={{ attrName: path[0] }}+ root={{ attrName: path[0]! }}payload={schema}readonly/>diff --git a/web/app/components/workflow/nodes/_base/components/variable/var-list.tsx b/web/app/components/workflow/nodes/_base/components/variable/var-list.tsxindex 3caf1327c9a..a0add3e7fda 100644--- a/web/app/components/workflow/nodes/_base/components/variable/var-list.tsx+++ b/web/app/components/workflow/nodes/_base/components/variable/var-list.tsx@@ -69,9 +69,9 @@ const VarList: FC<Props> = ({validateVarInput(list.toSpliced(index, 1), newKey)- onVarNameChange?.(list[index].variable, newKey)+ onVarNameChange?.(list[index]!.variable, newKey)const newList = produce(list, (draft) => {- draft[index].variable = newKey+ draft[index]!.variable = newKey})onChange(newList)}@@ -81,26 +81,26 @@ const VarList: FC<Props> = ({return (value: ValueSelector | string, varKindType: VarKindType, varInfo?: Var) => {const newList = produce(list, (draft) => {if (!isSupportConstantValue || varKindType === VarKindType.variable) {- draft[index].value_selector = value as ValueSelector- draft[index].value_type = varInfo?.type+ draft[index]!.value_selector = value as ValueSelector+ draft[index]!.value_type = varInfo?.typeif (isSupportConstantValue)- draft[index].variable_type = VarKindType.variable+ draft[index]!.variable_type = VarKindType.variable- if (!draft[index].variable) {+ if (!draft[index]!.variable) {const variables = draft.map(v => v.variable)- let newVarName = value[value.length - 1]+ let newVarName = value[value.length - 1]!let count = 1- while (variables.includes(newVarName)) {+ while (variables.includes(newVarName!)) {newVarName = `${value[value.length - 1]}_${count}`count++}- draft[index].variable = newVarName+ draft[index]!.variable = newVarName}}else {- draft[index].variable_type = VarKindType.constant- draft[index].value_selector = value as ValueSelector- draft[index].value = value as string+ draft[index]!.variable_type = VarKindType.constant+ draft[index]!.value_selector = value as ValueSelector+ draft[index]!.value = value as string}})onChange(newList)diff --git a/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.helpers.ts b/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.helpers.tsindex ae076626f8f..6cdcb916e60 100644--- a/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.helpers.ts+++ b/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.helpers.ts@@ -49,7 +49,7 @@ export const getIsIterationVar = () => {if (!isInIteration || !Array.isArray(value))return false- return value[0] === parentId && ['item', 'index'].includes(value[1])+ return value[0] === parentId && ['item', 'index'].includes(value[1]!)}export const getIsLoopVar = (@@ -59,7 +59,7 @@ export const getIsLoopVar = () => {if (!isInLoop || !Array.isArray(value))return false- return value[0] === parentId && ['item', 'index'].includes(value[1])+ return value[0] === parentId && ['item', 'index'].includes(value[1]!)}export const getOutputVarNode = ({diff --git a/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.tsx b/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.tsxindex 47bc60e22b9..1cfccf1622b 100644--- a/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.tsx+++ b/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.tsx@@ -186,7 +186,7 @@ const VarReferencePicker: FC<Props> = ({isLoopVar,iterationNode,loopNode,- outputVarNodeId,+ outputVarNodeId: outputVarNodeId!,startNode,value,}), [availableNodes, hasValue, isConstant, isIterationVar, isLoopVar, iterationNode, loopNode, outputVarNodeId, startNode, value])@@ -223,7 +223,7 @@ const VarReferencePicker: FC<Props> = ({const newValue = produce(value, (draft) => {if (draft[1] && draft[1].startsWith('sys.')) {draft.shift()- const paths = draft[0].split('.')+ const paths = draft[0]!.split('.')paths.forEach((p, i) => {draft[i] = p})@@ -254,10 +254,10 @@ const VarReferencePicker: FC<Props> = ({} = reactflowconst { transform } = store.getState()const zoom = transform[2]- const position = currentNode.position+ const position = currentNode!.positionsetViewport({- x: (clientWidth - 400 - currentNode.width! * zoom) / 2 - position.x * zoom,- y: (clientHeight - currentNode.height! * zoom) / 2 - position.y * zoom,+ x: (clientWidth - 400 - currentNode!.width! * zoom) / 2 - position.x * zoom,+ y: (clientHeight - currentNode!.height! * zoom) / 2 - position.y * zoom,zoom: transform[2],})}, [availableNodes, reactflow, store])diff --git a/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.helpers.ts b/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.helpers.tsindex 36418a298d2..d36dc807a80 100644--- a/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.helpers.ts+++ b/web/app/components/workflow/nodes/_base/components/variable/var-reference-vars.helpers.ts@@ -73,7 +73,7 @@ export const getValueSelector = ({}const getVisibleChildren = (vars: Var[]) => {- return vars.filter(variable => checkKeys([variable.variable], false).isValid || isSpecialVar(variable.variable.split('.')[0]))+ return vars.filter(variable => checkKeys([variable.variable], false).isValid || isSpecialVar(variable.variable.split('.')[0]!))}export const filterReferenceVars = (vars: NodeOutPutVar[], searchText: string) => {diff --git a/web/app/components/workflow/nodes/_base/components/workflow-panel/index.tsx b/web/app/components/workflow/nodes/_base/components/workflow-panel/index.tsxindex 4a1019954d5..5ebf5ae09b5 100644--- a/web/app/components/workflow/nodes/_base/components/workflow-panel/index.tsx+++ b/web/app/components/workflow/nodes/_base/components/workflow-panel/index.tsx@@ -322,7 +322,7 @@ const BasePanel: FC<BasePanelProps> = ({useEffect(() => {if (currentTriggerPlugin) {setDetail({- name: currentTriggerPlugin.label[language],+ name: currentTriggerPlugin.label[language]!,plugin_id: currentTriggerPlugin.plugin_id || '',plugin_unique_identifier: currentTriggerPlugin.plugin_unique_identifier || '',id: currentTriggerPlugin.id,diff --git a/web/app/components/workflow/nodes/_base/components/workflow-panel/last-run/use-last-run.ts b/web/app/components/workflow/nodes/_base/components/workflow-panel/last-run/use-last-run.tsindex d58c787bd82..b1efe258dfb 100644--- a/web/app/components/workflow/nodes/_base/components/workflow-panel/last-run/use-last-run.ts+++ b/web/app/components/workflow/nodes/_base/components/workflow-panel/last-run/use-last-run.ts@@ -209,7 +209,7 @@ const useLastRun = <T>({const formattedData: Record<string, any> = {}Object.keys(allVarObject).forEach((key) => {const [varSectorStr, nodeId] = key.split(DELIMITER)- formattedData[`${nodeId}.${allVarObject[key].inSingleRunPassedKey}`] = data[varSectorStr]+ formattedData[`${nodeId}.${allVarObject[key].inSingleRunPassedKey}`] = data[varSectorStr!]})if (isIterationNode) {const iteratorInputKey = `${id}.input_selector`@@ -291,7 +291,7 @@ const useLastRun = <T>({return truereturn vars.every((varItem) => {const [nodeId, varName] = varItem.slice(0, 2)- const inspectVarValue = hasSetInspectVar(nodeId, varName, systemVars, conversationVars) // also detect system var , env and conversation var+ const inspectVarValue = hasSetInspectVar(nodeId!, varName!, systemVars, conversationVars) // also detect system var , env and conversation varreturn inspectVarValue})}@@ -301,7 +301,7 @@ const useLastRun = <T>({return truereturn vars.some((varItem) => {const [nodeId, varName] = varItem.slice(0, 2)- const inspectVarValue = hasSetInspectVar(nodeId, varName, systemVars, conversationVars) // also detect system var , env and conversation var+ const inspectVarValue = hasSetInspectVar(nodeId!, varName!, systemVars, conversationVars) // also detect system var , env and conversation varreturn inspectVarValue})}@@ -315,7 +315,7 @@ const useLastRun = <T>({const existVarValuesInForm = existVarValuesInForms[i]const newForm = { ...form }const inputs = form.inputs.filter((input) => {- return !(input.variable in existVarValuesInForm)+ return !(input.variable in existVarValuesInForm!)})newForm.inputs = inputsreturn newFormdiff --git a/web/app/components/workflow/nodes/_base/hooks/use-one-step-run.ts b/web/app/components/workflow/nodes/_base/hooks/use-one-step-run.tsindex 1d309483163..a05c765a8e8 100644--- a/web/app/components/workflow/nodes/_base/hooks/use-one-step-run.ts+++ b/web/app/components/workflow/nodes/_base/hooks/use-one-step-run.ts@@ -234,10 +234,10 @@ const useOneStepRun = <T>({const index = draft.findIndex(node => node.nodeId === nodeId)if (index !== -1) {const targetNode = draft[index]- if (targetNode.isSingRunRunning !== isRunning) {- targetNode.isSingRunRunning = isRunning+ if (targetNode!.isSingRunRunning !== isRunning) {+ targetNode!.isSingRunRunning = isRunningif (isRunning)- targetNode.isValueFetched = false+ targetNode!.isValueFetched = falsehasChanges = true}}@@ -806,7 +806,7 @@ const useOneStepRun = <T>({const newIterationRunResult = produce(iterationRunResult, (draft) => {if (currentIndex > -1) {draft[currentIndex] = {- ...draft[currentIndex],+ ...draft[currentIndex]!,...data,}}@@ -910,7 +910,7 @@ const useOneStepRun = <T>({const newLoopRunResult = produce(loopRunResult, (draft) => {if (currentIndex > -1) {draft[currentIndex] = {- ...draft[currentIndex],+ ...draft[currentIndex]!,...data,}}@@ -1109,13 +1109,13 @@ const useOneStepRun = <T>({})const variables = unionBy(valueSelectors, item => item.join('.')).map((item) => {- const varInfo = getNodeInfoById(availableNodesIncludeParent, item[0])?.data+ const varInfo = getNodeInfoById(availableNodesIncludeParent, item[0]!)?.datareturn {label: {nodeType: varInfo?.type,nodeName: varInfo?.title || availableNodesIncludeParent[0]?.data.title, // default start node title- variable: isSystemVar(item) ? item.join('.') : item[item.length - 1],+ variable: isSystemVar(item) ? item.join('.') : item[item.length - 1]!,isChatVar: isConversationVar(item),},variable: `#${item.join('.')}#`,@@ -1129,7 +1129,7 @@ const useOneStepRun = <T>({const varSelectorsToVarInputs = (valueSelectors: ValueSelector[] | string[]): InputVar[] => {return valueSelectors.filter(item => !!item).map((item) => {- return getInputVars([`{{#${typeof item === 'string' ? item : item.join('.')}#}}`])[0]+ return getInputVars([`{{#${typeof item === 'string' ? item : item.join('.')}#}}`])[0]!})}diff --git a/web/app/components/workflow/nodes/_base/hooks/use-output-var-list.ts b/web/app/components/workflow/nodes/_base/hooks/use-output-var-list.tsindex a77af2daef5..188084345e3 100644--- a/web/app/components/workflow/nodes/_base/hooks/use-output-var-list.ts+++ b/web/app/components/workflow/nodes/_base/hooks/use-output-var-list.ts@@ -51,7 +51,7 @@ function useOutputVarList<T>({} = useDebounceFn((id: string, newName: string) => {const oldName = oldNameRecord.current[id]- renameInspectVarName(id, oldName, newName)+ renameInspectVarName(id, oldName!, newName)delete oldNameRecord.current[id]},{ wait: 500 },@@ -73,9 +73,9 @@ function useOutputVarList<T>({}if (newKey) {- handleOutVarRenameChange(id, [id, outputKeyOrders[changedIndex!]], [id, newKey])+ handleOutVarRenameChange(id, [id, outputKeyOrders[changedIndex!]!], [id, newKey])if (!(id in oldNameRecord.current))- oldNameRecord.current[id] = outputKeyOrders[changedIndex!]+ oldNameRecord.current[id] = outputKeyOrders[changedIndex!]!renameInspectNameWithDebounce(id, newKey)}else if (changedIndex === undefined) {@@ -126,7 +126,7 @@ function useOutputVarList<T>({hideRemoveVarConfirm()}, [deleteInspectVar, hideRemoveVarConfirm, id, nodesWithInspectVars, removeUsedVarInNodes, removedVar])const handleRemoveVariable = useCallback((index: number) => {- const key = outputKeyOrders[index]+ const key = outputKeyOrders[index]!if (isVarUsedInNodes([id, key])) {showRemoveVarConfirm()@@ -137,15 +137,15 @@ function useOutputVarList<T>({const newOutputKeyOrders = outputKeyOrders.filter((_, i) => i !== index)const newInputs = produce(inputs, (draft: any) => {// Only delete from outputs when no remaining entry shares this name- if (!newOutputKeyOrders.includes(key))- delete draft[varKey][key]+ if (!newOutputKeyOrders.includes(key!))+ delete draft[varKey][key!]if ((inputs as CodeNodeType).type === BlockEnum.Code && (inputs as CodeNodeType).error_strategy === ErrorHandleTypeEnum.defaultValue && varKey === 'outputs')draft.default_value = getDefaultValue(draft as any)})setInputs(newInputs)onOutputKeyOrdersChange(newOutputKeyOrders)- if (!newOutputKeyOrders.includes(key)) {+ if (!newOutputKeyOrders.includes(key!)) {const varId = nodesWithInspectVars.find(node => node.nodeId === id)?.vars.find((varItem) => {return varItem.name === key})?.iddiff --git a/web/app/components/workflow/nodes/agent/__tests__/use-single-run-form-params.spec.ts b/web/app/components/workflow/nodes/agent/__tests__/use-single-run-form-params.spec.tsindex 33075e685f1..75d356ae6ca 100644--- a/web/app/components/workflow/nodes/agent/__tests__/use-single-run-form-params.spec.ts+++ b/web/app/components/workflow/nodes/agent/__tests__/use-single-run-form-params.spec.ts@@ -110,14 +110,14 @@ describe('agent/use-single-run-form-params', () => {expect(getInputVars).toHaveBeenCalledWith(['#start.topic#', '#node-2.answer#'])expect(result.current.forms).toHaveLength(1)- expect(result.current.forms[0].inputs).toHaveLength(2)- expect(result.current.forms[0].values).toEqual({ topic: 'finance' })+ expect(result.current.forms[0]!.inputs).toHaveLength(2)+ expect(result.current.forms[0]!.values).toEqual({ topic: 'finance' })expect(result.current.nodeInfo).toEqual({id: 'agent-node',status: 'succeeded',})- result.current.forms[0].onChange({ topic: 'updated' })+ result.current.forms[0]!.onChange({ topic: 'updated' })expect(setRunInputData).toHaveBeenCalledWith({ topic: 'updated' })expect(result.current.getDependentVars()).toEqual([diff --git a/web/app/components/workflow/nodes/agent/use-config.ts b/web/app/components/workflow/nodes/agent/use-config.tsindex 0231f673c9e..7fdb249d1a7 100644--- a/web/app/components/workflow/nodes/agent/use-config.ts+++ b/web/app/components/workflow/nodes/agent/use-config.ts@@ -137,9 +137,9 @@ const useConfig = (id: string, payload: AgentNodeType) => {Object.keys(draft.agent_parameters || {}).forEach((key) => {const targetSchema = schemas.find(schema => schema.name === key)if (targetSchema?.type === FormTypeEnum.toolSelector)- draft.agent_parameters![key].value = formattingToolData(draft.agent_parameters![key].value)+ draft.agent_parameters![key]!.value = formattingToolData(draft.agent_parameters![key]!.value)if (targetSchema?.type === FormTypeEnum.multiToolSelector)- draft.agent_parameters![key].value = draft.agent_parameters![key].value.map((tool: any) => formattingToolData(tool))+ draft.agent_parameters![key]!.value = draft.agent_parameters![key]!.value.map((tool: any) => formattingToolData(tool))})draft.tool_node_version = '2'})diff --git a/web/app/components/workflow/nodes/assigner/__tests__/integration.spec.tsx b/web/app/components/workflow/nodes/assigner/__tests__/integration.spec.tsxindex 0b814b8b252..5cd378ffa27 100644--- a/web/app/components/workflow/nodes/assigner/__tests__/integration.spec.tsx+++ b/web/app/components/workflow/nodes/assigner/__tests__/integration.spec.tsx@@ -147,9 +147,9 @@ describe('assigner path', () => {)await user.click(screen.getByText('workflow.nodes.assigner.operations.over-write'))- expect(screen.getByText('workflow.nodes.assigner.operations.clear')).toBeInTheDocument()- expect(screen.getByText('workflow.nodes.assigner.operations.set')).toBeInTheDocument()- expect(screen.getByText('workflow.nodes.assigner.operations.+=')).toBeInTheDocument()+ expect(screen.getByText('workflow.nodes.assigner.operations.clear'))!.toBeInTheDocument()+ expect(screen.getByText('workflow.nodes.assigner.operations.set'))!.toBeInTheDocument()+ expect(screen.getByText('workflow.nodes.assigner.operations.+='))!.toBeInTheDocument()await user.click(screen.getByText('workflow.nodes.assigner.operations.+='))expect(onSelect).toHaveBeenCalledWith({ value: WriteMode.increment, name: WriteMode.increment })@@ -185,7 +185,7 @@ describe('assigner path', () => {/>,)- expect(screen.getByText('workflow.nodes.assigner.noVarTip')).toBeInTheDocument()+ expect(screen.getByText('workflow.nodes.assigner.noVarTip'))!.toBeInTheDocument()rerender(<VarList@@ -232,7 +232,7 @@ describe('assigner path', () => {/>,)- expect(screen.getByText('filter:false:true')).toBeInTheDocument()+ expect(screen.getByText('filter:false:true'))!.toBeInTheDocument()await user.click(screen.getByText('workflow.nodes.assigner.operations.over-write'))await user.click(screen.getByText('workflow.nodes.assigner.operations.set'))expect(onChange).toHaveBeenLastCalledWith([@@ -381,7 +381,7 @@ describe('assigner path', () => {},)- expect(screen.getByText('workflow.nodes.assigner.varNotSet')).toBeInTheDocument()+ expect(screen.getByText('workflow.nodes.assigner.varNotSet'))!.toBeInTheDocument()rerender(<Node@@ -392,9 +392,9 @@ describe('assigner path', () => {/>,)- expect(screen.getByText('Answer')).toBeInTheDocument()- expect(screen.getByText('node-1.count')).toBeInTheDocument()- expect(screen.getByText('workflow.nodes.assigner.operations.over-write')).toBeInTheDocument()+ expect(screen.getByText('Answer'))!.toBeInTheDocument()+ expect(screen.getByText('node-1.count'))!.toBeInTheDocument()+ expect(screen.getByText('workflow.nodes.assigner.operations.over-write'))!.toBeInTheDocument()rerender(<Node@@ -409,9 +409,9 @@ describe('assigner path', () => {/>,)- expect(screen.getByText('Start')).toBeInTheDocument()- expect(screen.getByText('sys.query')).toBeInTheDocument()- expect(screen.getByText('workflow.nodes.assigner.operations.append')).toBeInTheDocument()+ expect(screen.getByText('Start'))!.toBeInTheDocument()+ expect(screen.getByText('sys.query'))!.toBeInTheDocument()+ expect(screen.getByText('workflow.nodes.assigner.operations.append'))!.toBeInTheDocument()})it('should skip empty version 2 items and resolve system variables without an operation badge', () => {@@ -437,8 +437,8 @@ describe('assigner path', () => {},)- expect(screen.getByText('Start')).toBeInTheDocument()- expect(screen.getByText('sys.query')).toBeInTheDocument()+ expect(screen.getByText('Start'))!.toBeInTheDocument()+ expect(screen.getByText('sys.query'))!.toBeInTheDocument()expect(screen.queryByText('workflow.nodes.assigner.operations.over-write')).not.toBeInTheDocument()})@@ -479,9 +479,9 @@ describe('assigner path', () => {/>,)- expect(screen.getByText('Answer')).toBeInTheDocument()- expect(screen.getByText('node-1.count')).toBeInTheDocument()- expect(screen.getByText('workflow.nodes.assigner.operations.append')).toBeInTheDocument()+ expect(screen.getByText('Answer'))!.toBeInTheDocument()+ expect(screen.getByText('node-1.count'))!.toBeInTheDocument()+ expect(screen.getByText('workflow.nodes.assigner.operations.append'))!.toBeInTheDocument()})it('should add panel operations with the real variable list inside the panel', async () => {@@ -499,7 +499,7 @@ describe('assigner path', () => {/>,)- await user.click(screen.getAllByRole('button')[0])+ await user.click(screen.getAllByRole('button')[0]!)expect(mockHandleAddOperationItem).toHaveBeenCalledWith(createData().items)expect(config.handleOperationListChanges).toHaveBeenCalledWith([@@ -507,8 +507,8 @@ describe('assigner path', () => {createOperation({ variable_selector: [] }),])- expect(screen.getByText('workflow.nodes.assigner.variables')).toBeInTheDocument()- expect(screen.getByText('node-1.count')).toBeInTheDocument()+ expect(screen.getByText('workflow.nodes.assigner.variables'))!.toBeInTheDocument()+ expect(screen.getByText('node-1.count'))!.toBeInTheDocument()})})})diff --git a/web/app/components/workflow/nodes/assigner/__tests__/use-single-run-form-params.spec.ts b/web/app/components/workflow/nodes/assigner/__tests__/use-single-run-form-params.spec.tsindex 0551d1fd30f..e386d7718ff 100644--- a/web/app/components/workflow/nodes/assigner/__tests__/use-single-run-form-params.spec.ts+++ b/web/app/components/workflow/nodes/assigner/__tests__/use-single-run-form-params.spec.ts@@ -71,10 +71,10 @@ describe('assigner/use-single-run-form-params', () => {['node-3', 'items'],])expect(result.current.forms).toHaveLength(1)- expect(result.current.forms[0].inputs).toEqual(varInputs)- expect(result.current.forms[0].values).toEqual({ result: 'hello' })+ expect(result.current.forms[0]!.inputs).toEqual(varInputs)+ expect(result.current.forms[0]!.values).toEqual({ result: 'hello' })- result.current.forms[0].onChange({ result: 'updated' })+ result.current.forms[0]!.onChange({ result: 'updated' })expect(setRunInputData).toHaveBeenCalledWith({ result: 'updated' })expect(result.current.getDependentVars()).toEqual([diff --git a/web/app/components/workflow/nodes/assigner/components/var-list/index.tsx b/web/app/components/workflow/nodes/assigner/components/var-list/index.tsxindex 9c48a08091e..24fa999b492 100644--- a/web/app/components/workflow/nodes/assigner/components/var-list/index.tsx+++ b/web/app/components/workflow/nodes/assigner/components/var-list/index.tsx@@ -53,10 +53,10 @@ const VarList: FC<Props> = ({const handleAssignedVarChange = useCallback((index: number) => {return (value: ValueSelector | string) => {const newList = produce(list, (draft) => {- draft[index].variable_selector = value as ValueSelector- draft[index].operation = WriteMode.overwrite- draft[index].input_type = AssignerNodeInputType.variable- draft[index].value = undefined+ draft[index]!.variable_selector = value as ValueSelector+ draft[index]!.operation = WriteMode.overwrite+ draft[index]!.input_type = AssignerNodeInputType.variable+ draft[index]!.value = undefined})onChange(newList, value as ValueSelector)}@@ -65,16 +65,16 @@ const VarList: FC<Props> = ({const handleOperationChange = useCallback((index: number, varType: VarType) => {return (item: { value: string | number }) => {const newList = produce(list, (draft) => {- draft[index].operation = item.value as WriteMode- draft[index].value = '' // Clear value when operation changes+ draft[index]!.operation = item.value as WriteMode+ draft[index]!.value = '' // Clear value when operation changesif (item.value === WriteMode.set || item.value === WriteMode.increment || item.value === WriteMode.decrement|| item.value === WriteMode.multiply || item.value === WriteMode.divide) {if (varType === VarType.boolean)- draft[index].value = false- draft[index].input_type = AssignerNodeInputType.constant+ draft[index]!.value = false+ draft[index]!.input_type = AssignerNodeInputType.constant}else {- draft[index].input_type = AssignerNodeInputType.variable+ draft[index]!.input_type = AssignerNodeInputType.variable}})onChange(newList)@@ -84,7 +84,7 @@ const VarList: FC<Props> = ({const handleToAssignedVarChange = useCallback((index: number) => {return (value: ValueSelector | string | number | boolean) => {const newList = produce(list, (draft) => {- draft[index].value = value as ValueSelector+ draft[index]!.value = value as ValueSelector})onChange(newList, value as ValueSelector)}@@ -105,7 +105,7 @@ const VarList: FC<Props> = ({const handleFilterToAssignedVar = useCallback((index: number) => {return (payload: Var) => {- const { variable_selector, operation } = list[index]+ const { variable_selector, operation } = list[index]!if (!variable_selector || !operation || !filterToAssignedVar)return truediff --git a/web/app/components/workflow/nodes/code/code-parser.ts b/web/app/components/workflow/nodes/code/code-parser.tsindex cdd8a69a267..6e3fa876b7c 100644--- a/web/app/components/workflow/nodes/code/code-parser.ts+++ b/web/app/components/workflow/nodes/code/code-parser.ts@@ -17,7 +17,7 @@ export const extractFunctionParams = (code: string, language: CodeLanguage) => {params.push(...match[1].split(',').map(p => p.trim()).filter(Boolean)- .map(p => p.split(':')[0].trim()),+ .map(p => p.split(':')[0]!.trim()),)}@@ -74,7 +74,7 @@ export const extractReturnType = (code: string, language: CodeLanguage): OutputVfor (const match of matches) {// console.log(`Found key: "${match[1]}" from match: "${match[0]}"`)const key = match[1]- result[key] = {+ result[key!] = {type: VarType.string,children: null,}diff --git a/web/app/components/workflow/nodes/data-source-empty/hooks.ts b/web/app/components/workflow/nodes/data-source-empty/hooks.tsindex b3c33d699ec..9dd66b6b666 100644--- a/web/app/components/workflow/nodes/data-source-empty/hooks.ts+++ b/web/app/components/workflow/nodes/data-source-empty/hooks.ts@@ -32,8 +32,8 @@ export const useReplaceDataSourceNode = (id: string) => {...pluginDefaultValue,},position: {- x: emptyNode.position.x,- y: emptyNode.position.y,+ x: emptyNode!.position.x,+ y: emptyNode!.position.y,},})const newNodes = produce(nodes, (draft) => {diff --git a/web/app/components/workflow/nodes/data-source/hooks/use-before-run-form.ts b/web/app/components/workflow/nodes/data-source/hooks/use-before-run-form.tsindex 004da29bf5f..13eb0b5194a 100644--- a/web/app/components/workflow/nodes/data-source/hooks/use-before-run-form.ts+++ b/web/app/components/workflow/nodes/data-source/hooks/use-before-run-form.ts@@ -106,7 +106,7 @@ const useBeforeRunForm = ({const { currentCredentialId: credentialId } = dataSourceStore.getState()if (datasourceType === DatasourceType.localFile) {const { localFileList } = dataSourceStore.getState()- const { id, name, type, size, extension, mime_type } = localFileList[0].file+ const { id, name, type, size, extension, mime_type } = localFileList[0]!.fileconst documentInfo = {related_id: id,name,@@ -121,7 +121,7 @@ const useBeforeRunForm = ({}if (datasourceType === DatasourceType.onlineDocument) {const { onlineDocuments } = dataSourceStore.getState()- const { workspace_id, ...rest } = onlineDocuments[0]+ const { workspace_id, ...rest } = onlineDocuments[0]!const documentInfo = {workspace_id,page: rest,diff --git a/web/app/components/workflow/nodes/document-extractor/__tests__/integration.spec.tsx b/web/app/components/workflow/nodes/document-extractor/__tests__/integration.spec.tsxindex 3bcc58ecf5d..593bdd06649 100644--- a/web/app/components/workflow/nodes/document-extractor/__tests__/integration.spec.tsx+++ b/web/app/components/workflow/nodes/document-extractor/__tests__/integration.spec.tsx@@ -135,7 +135,7 @@ describe('document-extractor path', () => {/>,)- expect(container).toBeEmptyDOMElement()+ expect(container)!.toBeEmptyDOMElement()})it('should render the selected input variable on the node', () => {@@ -146,8 +146,8 @@ describe('document-extractor path', () => {/>,)- expect(screen.getByText('workflow.nodes.docExtractor.inputVar')).toBeInTheDocument()- expect(screen.getByText('Input Files:start:node-1.files')).toBeInTheDocument()+ expect(screen.getByText('workflow.nodes.docExtractor.inputVar'))!.toBeInTheDocument()+ expect(screen.getByText('Input Files:start:node-1.files'))!.toBeInTheDocument()})it('should wire panel input changes and format supported file types for english locales', async () => {@@ -172,16 +172,16 @@ describe('document-extractor path', () => {await user.click(screen.getByRole('button', { name: 'pick-file-var' }))expect(handleVarChanges).toHaveBeenCalledWith(['node-1', 'files'])- expect(screen.getByText('workflow.nodes.docExtractor.supportFileTypes:{"types":"pdf, markdown, docx"}')).toBeInTheDocument()- expect(screen.getByRole('link', { name: 'workflow.nodes.docExtractor.learnMore' })).toHaveAttribute(+ expect(screen.getByText('workflow.nodes.docExtractor.supportFileTypes:{"types":"pdf, markdown, docx"}'))!.toBeInTheDocument()+ expect(screen.getByRole('link', { name: 'workflow.nodes.docExtractor.learnMore' }))!.toHaveAttribute('href','https://docs.example.com/document-extractor',)- expect(screen.getByText('text:string')).toBeInTheDocument()+ expect(screen.getByText('text:string'))!.toBeInTheDocument()})it('should use chinese separators and array output types when the input is an array of files', () => {- mockLocale = LanguagesSupported[1]+ mockLocale = LanguagesSupported[1]!mockUseConfig.mockReturnValueOnce(createConfigResult({inputs: createData({is_array_file: true,@@ -198,7 +198,7 @@ describe('document-extractor path', () => {/>,)- expect(screen.getByText('workflow.nodes.docExtractor.supportFileTypes:{"types":"pdf、 markdown、 docx"}')).toBeInTheDocument()- expect(screen.getByText('text:array[string]')).toBeInTheDocument()+ expect(screen.getByText('workflow.nodes.docExtractor.supportFileTypes:{"types":"pdf、 markdown、 docx"}'))!.toBeInTheDocument()+ expect(screen.getByText('text:array[string]'))!.toBeInTheDocument()})})diff --git a/web/app/components/workflow/nodes/document-extractor/__tests__/panel.spec.tsx b/web/app/components/workflow/nodes/document-extractor/__tests__/panel.spec.tsxindex 06512f94c60..7e27c2379f4 100644--- a/web/app/components/workflow/nodes/document-extractor/__tests__/panel.spec.tsx+++ b/web/app/components/workflow/nodes/document-extractor/__tests__/panel.spec.tsx@@ -116,16 +116,16 @@ describe('document-extractor/panel', () => {await user.click(screen.getByRole('button', { name: 'pick-file-var' }))expect(handleVarChanges).toHaveBeenCalledWith(['node-1', 'files'])- expect(screen.getByText('workflow.nodes.docExtractor.supportFileTypes:{"types":"pdf, markdown, docx"}')).toBeInTheDocument()- expect(screen.getByRole('link', { name: 'workflow.nodes.docExtractor.learnMore' })).toHaveAttribute(+ expect(screen.getByText('workflow.nodes.docExtractor.supportFileTypes:{"types":"pdf, markdown, docx"}'))!.toBeInTheDocument()+ expect(screen.getByRole('link', { name: 'workflow.nodes.docExtractor.learnMore' }))!.toHaveAttribute('href','https://docs.example.com/document-extractor',)- expect(screen.getByText('text:string')).toBeInTheDocument()+ expect(screen.getByText('text:string'))!.toBeInTheDocument()})it('uses chinese separators and array output types when the input is an array of files', () => {- mockLocale = LanguagesSupported[1]+ mockLocale = LanguagesSupported[1]!mockUseConfig.mockReturnValueOnce(createConfigResult({inputs: createData({ is_array_file: true }),}))@@ -138,7 +138,7 @@ describe('document-extractor/panel', () => {/>,)- expect(screen.getByText('workflow.nodes.docExtractor.supportFileTypes:{"types":"pdf、 markdown、 docx"}')).toBeInTheDocument()- expect(screen.getByText('text:array[string]')).toBeInTheDocument()+ expect(screen.getByText('workflow.nodes.docExtractor.supportFileTypes:{"types":"pdf、 markdown、 docx"}'))!.toBeInTheDocument()+ expect(screen.getByText('text:array[string]'))!.toBeInTheDocument()})})diff --git a/web/app/components/workflow/nodes/document-extractor/__tests__/use-single-run-form-params.spec.ts b/web/app/components/workflow/nodes/document-extractor/__tests__/use-single-run-form-params.spec.tsindex 935118f26e6..8c44884e987 100644--- a/web/app/components/workflow/nodes/document-extractor/__tests__/use-single-run-form-params.spec.ts+++ b/web/app/components/workflow/nodes/document-extractor/__tests__/use-single-run-form-params.spec.ts@@ -27,14 +27,14 @@ describe('document-extractor/use-single-run-form-params', () => {}))expect(result.current.forms).toHaveLength(1)- expect(result.current.forms[0].inputs).toEqual([+ expect(result.current.forms[0]!.inputs).toEqual([expect.objectContaining({variable: 'files',required: true,}),])- result.current.forms[0].onChange({ files: ['new-file'] })+ result.current.forms[0]!.onChange({ files: ['new-file'] })expect(setRunInputData).toHaveBeenCalledWith({ files: ['new-file'] })expect(result.current.getDependentVars()).toEqual([['start', 'files']])diff --git a/web/app/components/workflow/nodes/end/__tests__/use-config.spec.ts b/web/app/components/workflow/nodes/end/__tests__/use-config.spec.tsindex 8d0cbff5477..a9d7def1445 100644--- a/web/app/components/workflow/nodes/end/__tests__/use-config.spec.ts+++ b/web/app/components/workflow/nodes/end/__tests__/use-config.spec.ts@@ -52,7 +52,7 @@ describe('end/use-config', () => {it('should build var-list handlers against outputs and surface the readonly state', () => {const { result } = renderHook(() => useConfig('end-node', currentInputs))- const config = mockUseVarList.mock.calls[0][0] as { setInputs: (inputs: EndNodeType) => void }+ const config = mockUseVarList.mock.calls[0]![0] as { setInputs: (inputs: EndNodeType) => void }expect(mockUseVarList).toHaveBeenCalledWith(expect.objectContaining({inputs: currentInputs,diff --git a/web/app/components/workflow/nodes/end/node.tsx b/web/app/components/workflow/nodes/end/node.tsxindex f6bace70586..dbcb258a80a 100644--- a/web/app/components/workflow/nodes/end/node.tsx+++ b/web/app/components/workflow/nodes/end/node.tsx@@ -38,7 +38,7 @@ const Node: FC<NodeProps<EndNodeType>> = ({return (<div className="mb-1 space-y-0.5 px-3 py-1">{filteredOutputs.map(({ value_selector }, index) => {- const node = getNode(value_selector[0])+ const node = getNode(value_selector[0]!)const varType = getCurrentVariableType({valueSelector: value_selector,availableNodes,diff --git a/web/app/components/workflow/nodes/http/__tests__/integration.spec.tsx b/web/app/components/workflow/nodes/http/__tests__/integration.spec.tsxindex 93a4d08c3d5..4389ad1f7b6 100644--- a/web/app/components/workflow/nodes/http/__tests__/integration.spec.tsx+++ b/web/app/components/workflow/nodes/http/__tests__/integration.spec.tsx@@ -289,7 +289,7 @@ describe('http path', () => {const inputs = screen.getAllByRole('textbox')fireEvent.change(inputs[0] as HTMLInputElement, { target: { value: 'X-Token' } })fireEvent.focus(inputs[1] as HTMLInputElement)- expect(inputs[1]).toHaveClass('border-components-input-border-active')+ expect(inputs[1])!.toHaveClass('border-components-input-border-active')fireEvent.change(inputs[1] as HTMLInputElement, { target: { value: 'secret-token' } })fireEvent.blur(inputs[1] as HTMLInputElement)await user.click(screen.getByText('common.operation.save'))@@ -339,7 +339,7 @@ describe('http path', () => {)expect(container.querySelector('svg')).toBeNull()- expect(screen.getByDisplayValue('https://api.example.com')).toHaveAttribute('placeholder', '')+ expect(screen.getByDisplayValue('https://api.example.com'))!.toHaveAttribute('placeholder', '')})it('should update focus styling for editable inputs and show the remove action again on blur-sm', () => {@@ -357,7 +357,7 @@ describe('http path', () => {const input = screen.getByDisplayValue('alice')fireEvent.focus(input)- expect(input).toHaveClass('bg-components-input-bg-active')+ expect(input)!.toHaveClass('bg-components-input-bg-active')expect(container.querySelector('button')).toBeNull()fireEvent.blur(input)expect(container.querySelector('button')).not.toBeNull()@@ -373,7 +373,7 @@ describe('http path', () => {/>,)- expect(screen.getByText('missing-value')).toBeInTheDocument()+ expect(screen.getByText('missing-value'))!.toBeInTheDocument()})it('should clamp timeout values and propagate changes', async () => {@@ -436,8 +436,8 @@ describe('http path', () => {</div>,)- fireEvent.change(screen.getAllByDisplayValue('name:alice')[0], { target: { value: 'name:bob' } })- fireEvent.blur(screen.getAllByDisplayValue('name:bob')[0])+ fireEvent.change(screen.getAllByDisplayValue('name:alice')[0]!, { target: { value: 'name:bob' } })+ fireEvent.blur(screen.getAllByDisplayValue('name:bob')[0]!)await user.click(screen.getByText('workflow.nodes.http.keyValueEdit'))expect(onChange).toHaveBeenCalled()@@ -455,7 +455,7 @@ describe('http path', () => {/>,)- expect(container).toBeEmptyDOMElement()+ expect(container)!.toBeEmptyDOMElement()})it('should edit standalone input items and key-value rows', async () => {@@ -494,7 +494,7 @@ describe('http path', () => {</div>,)- fireEvent.change(screen.getAllByDisplayValue('alice')[0], { target: { value: 'bob' } })+ fireEvent.change(screen.getAllByDisplayValue('alice')[0]!, { target: { value: 'bob' } })await user.click(screen.getAllByRole('combobox', { name: 'workflow.nodes.http.type' })[0]!)await user.click(screen.getByRole('option', { name: /file/i }))@@ -550,7 +550,7 @@ describe('http path', () => {)fireEvent.change(screen.getByDisplayValue('attachment'), { target: { value: 'upload' } })- expect(screen.getByText('file-filter:true:false')).toBeInTheDocument()+ expect(screen.getByText('file-filter:true:false'))!.toBeInTheDocument()await user.click(screen.getByText('pick-file'))await user.click(screen.getByText('remove-file'))@@ -579,7 +579,7 @@ describe('http path', () => {await user.click(screen.getByRole('combobox', { name: 'workflow.nodes.http.type' }))const fileOption = screen.getByRole('option', { name: /file/i })- expect(screen.getByRole('option', { name: /text/i })).toBeInTheDocument()+ expect(screen.getByRole('option', { name: /text/i }))!.toBeInTheDocument()expect(fileOption.closest('.h-7')).toBeNull()await user.click(fileOption)@@ -630,7 +630,7 @@ describe('http path', () => {/>,)- expect(screen.getByRole('textbox')).toHaveValue('')+ expect(screen.getByRole('textbox'))!.toHaveValue('')})it('should switch to key-value body types and propagate key-value edits', () => {@@ -698,7 +698,7 @@ describe('http path', () => {/>,)- expect(screen.getByText('file-filter:true:false')).toBeInTheDocument()+ expect(screen.getByText('file-filter:true:false'))!.toBeInTheDocument()await user.click(screen.getByText('pick-file'))expect(onChange).toHaveBeenCalledWith(expect.objectContaining({@@ -719,8 +719,8 @@ describe('http path', () => {{ nodes: [], edges: [] },)- expect(screen.getByText(Method.get)).toBeInTheDocument()- expect(screen.getByText('https://api.example.com')).toBeInTheDocument()+ expect(screen.getByText(Method.get))!.toBeInTheDocument()+ expect(screen.getByText('https://api.example.com'))!.toBeInTheDocument()})it('should render nothing when the request url is empty', () => {@@ -739,13 +739,13 @@ describe('http path', () => {it('should render the panel sections and output vars', async () => {renderPanel()- expect(screen.getByText('body:string')).toBeInTheDocument()- expect(screen.getByText('status_code:number')).toBeInTheDocument()- expect(screen.getByText('headers:object')).toBeInTheDocument()- expect(screen.getByText('files:Array[File]')).toBeInTheDocument()+ expect(screen.getByText('body:string'))!.toBeInTheDocument()+ expect(screen.getByText('status_code:number'))!.toBeInTheDocument()+ expect(screen.getByText('headers:object'))!.toBeInTheDocument()+ expect(screen.getByText('files:Array[File]'))!.toBeInTheDocument()expect(screen.getAllByText('workflow.nodes.http.authorization.authorization').length).toBeGreaterThan(0)- expect(screen.getByText('workflow.nodes.http.curl.title')).toBeInTheDocument()- expect(screen.getByText('curl-panel')).toBeInTheDocument()+ expect(screen.getByText('workflow.nodes.http.curl.title'))!.toBeInTheDocument()+ expect(screen.getByText('curl-panel'))!.toBeInTheDocument()})it('should hide modal overlays when the panel is readonly', () => {diff --git a/web/app/components/workflow/nodes/http/components/curl-parser.ts b/web/app/components/workflow/nodes/http/components/curl-parser.tsindex ba9319cbf0b..0e2aa1f6f0c 100644--- a/web/app/components/workflow/nodes/http/components/curl-parser.ts+++ b/web/app/components/workflow/nodes/http/components/curl-parser.ts@@ -37,7 +37,7 @@ const extractUrlParams = (url: string) => {return {url: urlParts[0],- params: urlParts[1].replace(/&/g, '\n').replace(/=/g, ': '),+ params: urlParts[1]!.replace(/&/g, '\n').replace(/=/g, ': '),}}@@ -46,7 +46,7 @@ const getNextArg = (args: string[], index: number, error: string): { value: strireturn { value: null, error }return {- value: stripWrappedQuotes(args[index + 1]),+ value: stripWrappedQuotes(args[index + 1]!),error: null,}}@@ -97,7 +97,7 @@ const applyFormArg = (node: Partial<HttpNodeType>, args: string[], index: numberconst typeMatch = /^(.+?);type=(.+)$/.exec(value)if (typeMatch) {const [, actualValue, mimeType] = typeMatch- value = actualValue+ value = actualValue!node.headers += `${node.headers ? '\n' : ''}Content-Type: ${mimeType}`}@@ -150,7 +150,7 @@ export const parseCurl = (curlCommand: string): { node: HttpNodeType | null, errlet hasData = falsefor (let i = 1; i < args.length; i++) {- const result = handleCurlArg(stripWrappedQuotes(args[i]), node, args, i)+ const result = handleCurlArg(stripWrappedQuotes(args[i]!), node, args, i)if (result.error)return { node: null, error: result.error }diff --git a/web/app/components/workflow/nodes/http/components/edit-body/index.tsx b/web/app/components/workflow/nodes/http/components/edit-body/index.tsxindex 5f3294903b9..76be3ba08ab 100644--- a/web/app/components/workflow/nodes/http/components/edit-body/index.tsx+++ b/web/app/components/workflow/nodes/http/components/edit-body/index.tsx@@ -114,7 +114,7 @@ const EditBody: FC<Props> = ({value: '',})}- (draft.data as BodyPayload)[0].value = value+ (draft.data as BodyPayload)[0]!.value = value})onChange(newBody)}, [onChange, payload])@@ -127,7 +127,7 @@ const EditBody: FC<Props> = ({type: BodyPayloadValueType.file,})}- (draft.data as BodyPayload)[0].file = value as ValueSelector+ (draft.data as BodyPayload)[0]!.file = value as ValueSelector})onChange(newBody)}, [onChange, payload])diff --git a/web/app/components/workflow/nodes/http/hooks/use-key-value-list.ts b/web/app/components/workflow/nodes/http/hooks/use-key-value-list.tsindex f48738b0597..cf749260bd0 100644--- a/web/app/components/workflow/nodes/http/hooks/use-key-value-list.ts+++ b/web/app/components/workflow/nodes/http/hooks/use-key-value-list.ts@@ -9,7 +9,7 @@ const strToKeyValueList = (value: string) => {const [key, ...others] = item.split(':')return {id: uniqueId(UNIQUE_ID_PREFIX),- key: key.trim(),+ key: key!.trim(),value: others.join(':').trim(),}})diff --git a/web/app/components/workflow/nodes/human-input/__tests__/human-input.spec.tsx b/web/app/components/workflow/nodes/human-input/__tests__/human-input.spec.tsxindex 661b856f3f8..cbc9cddd4a0 100644--- a/web/app/components/workflow/nodes/human-input/__tests__/human-input.spec.tsx+++ b/web/app/components/workflow/nodes/human-input/__tests__/human-input.spec.tsx@@ -161,7 +161,7 @@ describe('DSL Import with Human Input Node', () => {// No extra iteration/loop start nodes should be injectedexpect(result.nodes).toHaveLength(1)- expect(result.nodes[0].data.type).toBe(BlockEnum.HumanInput)+ expect(result.nodes[0]!.data.type).toBe(BlockEnum.HumanInput)})})@@ -190,7 +190,7 @@ describe('DSL Import with Human Input Node', () => {const result = initialNodes(nodes as Node[], [])const processed = result[0]- const nodeData = processed.data as HumanInputNodeType+ const nodeData = processed!.data as HumanInputNodeTypeexpect(nodeData.delivery_methods).toHaveLength(2)expect(nodeData.user_actions).toHaveLength(2)expect(nodeData.form_content).toBe('# Review Form\nPlease fill in the details below.')@@ -204,7 +204,7 @@ describe('DSL Import with Human Input Node', () => {const result = initialNodes([humanInputNode] as Node[], [])- expect(result[0].type).toBe('custom')+ expect(result[0]!.type).toBe('custom')})})@@ -234,8 +234,9 @@ describe('DSL Import with Human Input Node', () => {)// Delivery method type labels are rendered in lowercase- expect(screen.getByText('webapp')).toBeInTheDocument()- expect(screen.getByText('email')).toBeInTheDocument()+ // Delivery method type labels are rendered in lowercase+ expect(screen.getByText('webapp'))!.toBeInTheDocument()+ expect(screen.getByText('email'))!.toBeInTheDocument()})it('should display user action IDs', () => {@@ -248,8 +249,8 @@ describe('DSL Import with Human Input Node', () => {/>,)- expect(screen.getByText('approve')).toBeInTheDocument()- expect(screen.getByText('reject')).toBeInTheDocument()+ expect(screen.getByText('approve'))!.toBeInTheDocument()+ expect(screen.getByText('reject'))!.toBeInTheDocument()})it('should always display Timeout handle', () => {@@ -262,7 +263,7 @@ describe('DSL Import with Human Input Node', () => {/>,)- expect(screen.getByText('Timeout')).toBeInTheDocument()+ expect(screen.getByText('Timeout'))!.toBeInTheDocument()})it('should render without crashing when delivery_methods is empty', () => {@@ -277,6 +278,37 @@ describe('DSL Import with Human Input Node', () => {)}).not.toThrow()+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered+ // Delivery method section should not be rendered// Delivery method section should not be renderedexpect(screen.queryByText('webapp')).not.toBeInTheDocument()expect(screen.queryByText('email')).not.toBeInTheDocument()@@ -295,7 +327,8 @@ describe('DSL Import with Human Input Node', () => {}).not.toThrow()// Timeout handle should still exist- expect(screen.getByText('Timeout')).toBeInTheDocument()+ // Timeout handle should still exist+ expect(screen.getByText('Timeout'))!.toBeInTheDocument()})it('should render without crashing when both delivery_methods and user_actions are empty', () => {@@ -330,7 +363,7 @@ describe('DSL Import with Human Input Node', () => {/>,)- expect(screen.getByText('webapp')).toBeInTheDocument()+ expect(screen.getByText('webapp'))!.toBeInTheDocument()expect(screen.queryByText('email')).not.toBeInTheDocument()})@@ -350,9 +383,9 @@ describe('DSL Import with Human Input Node', () => {/>,)- expect(screen.getByText('action_1')).toBeInTheDocument()- expect(screen.getByText('action_2')).toBeInTheDocument()- expect(screen.getByText('action_3')).toBeInTheDocument()+ expect(screen.getByText('action_1'))!.toBeInTheDocument()+ expect(screen.getByText('action_2'))!.toBeInTheDocument()+ expect(screen.getByText('action_3'))!.toBeInTheDocument()})})diff --git a/web/app/components/workflow/nodes/human-input/components/__tests__/button-style-dropdown.spec.tsx b/web/app/components/workflow/nodes/human-input/components/__tests__/button-style-dropdown.spec.tsxindex 1662e88b797..544524110a8 100644--- a/web/app/components/workflow/nodes/human-input/components/__tests__/button-style-dropdown.spec.tsx+++ b/web/app/components/workflow/nodes/human-input/components/__tests__/button-style-dropdown.spec.tsx@@ -80,16 +80,16 @@ describe('ButtonStyleDropdown', () => {expect(mockButton).toHaveBeenCalledWith(expect.objectContaining({variant: 'ghost',}))- expect(screen.getByTestId('portal')).toHaveAttribute('data-open', 'false')+ expect(screen.getByTestId('portal'))!.toHaveAttribute('data-open', 'false')fireEvent.click(screen.getByTestId('portal-trigger'))- expect(screen.getByTestId('portal')).toHaveAttribute('data-open', 'true')- expect(screen.getByText('nodes.humanInput.userActions.chooseStyle')).toBeInTheDocument()+ expect(screen.getByTestId('portal'))!.toHaveAttribute('data-open', 'true')+ expect(screen.getByText('nodes.humanInput.userActions.chooseStyle'))!.toBeInTheDocument()fireEvent.click(screen.getByTestId('button-primary').parentElement as HTMLElement)fireEvent.click(screen.getByTestId('button-secondary').parentElement as HTMLElement)fireEvent.click(screen.getByTestId('button-secondary-accent').parentElement as HTMLElement)- fireEvent.click(screen.getAllByTestId('button-ghost')[1].parentElement as HTMLElement)+ fireEvent.click(screen.getAllByTestId('button-ghost')[1]!.parentElement as HTMLElement)expect(onChange).toHaveBeenNthCalledWith(1, UserActionButtonType.Primary)expect(onChange).toHaveBeenNthCalledWith(2, UserActionButtonType.Default)@@ -113,7 +113,7 @@ describe('ButtonStyleDropdown', () => {fireEvent.click(screen.getByTestId('portal-trigger'))- expect(screen.getByTestId('portal')).toHaveAttribute('data-open', 'false')+ expect(screen.getByTestId('portal'))!.toHaveAttribute('data-open', 'false')expect(screen.queryByTestId('portal-content')).not.toBeInTheDocument()expect(onChange).not.toHaveBeenCalled()})diff --git a/web/app/components/workflow/nodes/human-input/components/__tests__/form-content-preview.spec.tsx b/web/app/components/workflow/nodes/human-input/components/__tests__/form-content-preview.spec.tsxindex 7dab3e75e94..4e637724fd9 100644--- a/web/app/components/workflow/nodes/human-input/components/__tests__/form-content-preview.spec.tsx+++ b/web/app/components/workflow/nodes/human-input/components/__tests__/form-content-preview.spec.tsx@@ -67,7 +67,7 @@ vi.mock('../variable-in-markdown', () => ({Note: ({ defaultInput, nodeName }: {defaultInput: { selector: string[] }nodeName: (nodeId: string) => string- }) => <div data-testid="note">{nodeName(defaultInput.selector[0])}</div>,+ }) => <div data-testid="note">{nodeName(defaultInput.selector[0]!)}</div>,}))describe('FormContentPreview', () => {@@ -108,13 +108,13 @@ describe('FormContentPreview', () => {/>,)- expect(container.firstChild).toHaveStyle({ right: '328px' })- expect(screen.getByTestId('badge')).toHaveTextContent('nodes.humanInput.formContent.preview')- expect(screen.getByTestId('variable-path')).toHaveTextContent('#Classifier.answer#')- expect(screen.getByTestId('note')).toHaveTextContent('Classifier')- expect(screen.getByText(/Can't find note:/)).toHaveTextContent('missing_field')- expect(screen.getByTestId('action-primary')).toHaveTextContent('Approve')- expect(screen.getByText('nodes.humanInput.editor.previewTip')).toBeInTheDocument()+ expect(container.firstChild)!.toHaveStyle({ right: '328px' })+ expect(screen.getByTestId('badge'))!.toHaveTextContent('nodes.humanInput.formContent.preview')+ expect(screen.getByTestId('variable-path'))!.toHaveTextContent('#Classifier.answer#')+ expect(screen.getByTestId('note'))!.toHaveTextContent('Classifier')+ expect(screen.getByText(/Can't find note:/))!.toHaveTextContent('missing_field')+ expect(screen.getByTestId('action-primary'))!.toHaveTextContent('Approve')+ expect(screen.getByText('nodes.humanInput.editor.previewTip'))!.toBeInTheDocument()})it('should close the preview when the close action is clicked', () => {diff --git a/web/app/components/workflow/nodes/human-input/components/__tests__/user-action.spec.tsx b/web/app/components/workflow/nodes/human-input/components/__tests__/user-action.spec.tsxindex 08b3a30a1f0..13f84636762 100644--- a/web/app/components/workflow/nodes/human-input/components/__tests__/user-action.spec.tsx+++ b/web/app/components/workflow/nodes/human-input/components/__tests__/user-action.spec.tsx@@ -123,7 +123,7 @@ describe('UserActionItem', () => {fireEvent.change(screen.getByTestId('nodes.humanInput.userActions.actionNamePlaceholder'), { target: { value: ' ' } })fireEvent.click(screen.getByText('change-style'))- fireEvent.click(screen.getAllByRole('button')[1])+ fireEvent.click(screen.getAllByRole('button')[1]!)expect(onChange).toHaveBeenNthCalledWith(1, expect.objectContaining({ id: '' }))expect(onChange).toHaveBeenNthCalledWith(2, expect.objectContaining({ button_style: UserActionButtonType.Ghost }))@@ -138,8 +138,8 @@ describe('UserActionItem', () => {/>,)- expect(screen.getByTestId('nodes.humanInput.userActions.actionNamePlaceholder')).toBeDisabled()- expect(screen.getByTestId('nodes.humanInput.userActions.buttonTextPlaceholder')).toBeDisabled()+ expect(screen.getByTestId('nodes.humanInput.userActions.actionNamePlaceholder'))!.toBeDisabled()+ expect(screen.getByTestId('nodes.humanInput.userActions.buttonTextPlaceholder'))!.toBeDisabled()expect(screen.getAllByRole('button')).toHaveLength(1)})})diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/__tests__/method-item.spec.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/__tests__/method-item.spec.tsxindex 0c2ecac7ed9..5f11552c702 100644--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/__tests__/method-item.spec.tsx+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/__tests__/method-item.spec.tsx@@ -140,14 +140,14 @@ describe('human-input/delivery-method/method-item', () => {const row = getMethodRow('webapp')const actionButtons = within(row).getAllByRole('button')- const deleteButtonWrapper = actionButtons[0].parentElement as HTMLDivElement+ const deleteButtonWrapper = actionButtons[0]!.parentElement as HTMLDivElementfireEvent.mouseEnter(deleteButtonWrapper)- expect(row).toHaveClass('border-state-destructive-border')+ expect(row)!.toHaveClass('border-state-destructive-border')fireEvent.mouseLeave(deleteButtonWrapper)expect(row).not.toHaveClass('border-state-destructive-border')- fireEvent.click(actionButtons[0])+ fireEvent.click(actionButtons[0]!)expect(handleDelete).toHaveBeenCalledWith(DeliveryMethodType.WebApp)})@@ -173,26 +173,26 @@ describe('human-input/delivery-method/method-item', () => {/>,)- expect(screen.getByText('DEBUG')).toBeInTheDocument()+ expect(screen.getByText('DEBUG'))!.toBeInTheDocument()const actionButtons = within(getMethodRow('email')).getAllByRole('button')- fireEvent.click(actionButtons[0])- expect(screen.getByTestId('test-email-sender')).toBeInTheDocument()+ fireEvent.click(actionButtons[0]!)+ expect(screen.getByTestId('test-email-sender'))!.toBeInTheDocument()fireEvent.click(screen.getByRole('button', { name: 'close-test-sender' }))expect(screen.queryByTestId('test-email-sender')).not.toBeInTheDocument()- fireEvent.click(actionButtons[0])+ fireEvent.click(actionButtons[0]!)fireEvent.click(screen.getByRole('button', { name: 'jump-to-config' }))expect(screen.queryByTestId('test-email-sender')).not.toBeInTheDocument()- expect(screen.getByTestId('email-configure-modal')).toBeInTheDocument()+ expect(screen.getByTestId('email-configure-modal'))!.toBeInTheDocument()fireEvent.click(screen.getByRole('button', { name: 'close-email-config' }))expect(screen.queryByTestId('email-configure-modal')).not.toBeInTheDocument()- fireEvent.click(actionButtons[1])- expect(screen.getByTestId('email-configure-modal')).toBeInTheDocument()+ fireEvent.click(actionButtons[1]!)+ expect(screen.getByTestId('email-configure-modal'))!.toBeInTheDocument()fireEvent.click(screen.getByRole('button', { name: 'confirm-email-config' }))expect(handleChange).toHaveBeenCalledWith(expect.objectContaining({@@ -203,7 +203,7 @@ describe('human-input/delivery-method/method-item', () => {}),}))- fireEvent.click(actionButtons[2])+ fireEvent.click(actionButtons[2]!)expect(handleDelete).toHaveBeenCalledWith(DeliveryMethodType.Email)})@@ -226,7 +226,7 @@ describe('human-input/delivery-method/method-item', () => {)fireEvent.click(screen.getByRole('button', { name: /workflow.nodes.humanInput.deliveryMethod.notConfigured/i }))- expect(screen.getByTestId('email-configure-modal')).toBeInTheDocument()+ expect(screen.getByTestId('email-configure-modal'))!.toBeInTheDocument()fireEvent.click(screen.getByRole('button', { name: 'close-email-config' }))expect(screen.queryByTestId('email-configure-modal')).not.toBeInTheDocument()diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/email-input.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/email-input.tsxindex 99192ae580f..1f18ef076d1 100644--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/email-input.tsx+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/recipient/email-input.tsx@@ -113,7 +113,7 @@ const EmailInput = ({else if (e.key === 'Backspace') {if (searchKey === '' && value.length > 0) {e.preventDefault()- onDelete(value[value.length - 1])+ onDelete(value[value.length - 1]!)setSearchKey('')setOpen(false)}diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/test-email-sender.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/test-email-sender.tsxindex 7ff44542b3d..cef6d1380d9 100644--- a/web/app/components/workflow/nodes/human-input/components/delivery-method/test-email-sender.tsx+++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/test-email-sender.tsx@@ -99,13 +99,13 @@ const EmailSenderModal = ({}, [] as ValueSelector[])const valueSelectors = doGetInputVars((formContent || '') + (config?.body || ''))const variables = unionBy([...valueSelectors, ...defaultValueSelectors], item => item.join('.')).map((item) => {- const varInfo = getNodeInfoById(availableNodes, item[0])?.data+ const varInfo = getNodeInfoById(availableNodes, item[0]!)?.datareturn {label: {nodeType: varInfo?.type,- nodeName: varInfo?.title || availableNodes[0]?.data.title, // default start node title- variable: isSystemVar(item) ? item.join('.') : item[item.length - 1],+ nodeName: varInfo?.title || availableNodes[0]?.data.title!, // default start node title+ variable: isSystemVar(item) ? item.join('.') : item[item.length - 1]!,isChatVar: isConversationVar(item),},variable: `#${item.join('.')}#`,diff --git a/web/app/components/workflow/nodes/human-input/components/variable-in-markdown.tsx b/web/app/components/workflow/nodes/human-input/components/variable-in-markdown.tsxindex a09dc287b47..d0d20ed5b53 100644--- a/web/app/components/workflow/nodes/human-input/components/variable-in-markdown.tsx+++ b/web/app/components/workflow/nodes/human-input/components/variable-in-markdown.tsx@@ -61,8 +61,8 @@ const visitTextNodes = (let index = 0while (index < node.children.length) {const child = node.children[index]- if (child.type === 'text' && typeof child.value === 'string') {- const nextNodes = transform(child.value, node)+ if (child!.type === 'text' && typeof child!.value === 'string') {+ const nextNodes = transform(child!.value, node)if (nextNodes) {node.children.splice(index, 1, ...nextNodes)index += nextNodes.length@@ -70,7 +70,7 @@ const visitTextNodes = (}}- visitTextNodes(child, transform)+ visitTextNodes(child!, transform)index++}}@@ -114,7 +114,7 @@ export function rehypeNotes() {noteRegex.lastIndex = 0parent.tagName = 'div'return splitTextNode(value, noteRegex, (match) => {- const name = match[0].split('.').slice(-1)[0].replace('#}}', '')+ const name = match[0].split('.').slice(-1)[0]!.replace('#}}', '')return {tagName: 'section',properties: { dataName: name },diff --git a/web/app/components/workflow/nodes/human-input/hooks/__tests__/use-single-run-form-params.spec.ts b/web/app/components/workflow/nodes/human-input/hooks/__tests__/use-single-run-form-params.spec.tsindex 571708e87de..fa93c7d87ff 100644--- a/web/app/components/workflow/nodes/human-input/hooks/__tests__/use-single-run-form-params.spec.ts+++ b/web/app/components/workflow/nodes/human-input/hooks/__tests__/use-single-run-form-params.spec.ts@@ -138,7 +138,7 @@ describe('human-input/hooks/use-single-run-form-params', () => {}))act(() => {- result.current.forms[0].onChange?.({ topic: 'Updated' })+ result.current.forms[0]!.onChange?.({ topic: 'Updated' })})expect(mockSetRunInputData).toHaveBeenCalledWith({ topic: 'Updated' })diff --git a/web/app/components/workflow/nodes/if-else/components/condition-list/index.tsx b/web/app/components/workflow/nodes/if-else/components/condition-list/index.tsxindex 180c72b3e25..5e42502bc0c 100644--- a/web/app/components/workflow/nodes/if-else/components/condition-list/index.tsx+++ b/web/app/components/workflow/nodes/if-else/components/condition-list/index.tsx@@ -120,7 +120,7 @@ const ConditionList = ({availableNodes={availableNodes}filterVar={filterVar}numberVariables={numberVariables}- file={varsIsVarFileAttribute[condition.id] ? { key: (condition.variable_selector || []).slice(-1)[0] } : undefined}+ file={varsIsVarFileAttribute[condition.id] ? { key: (condition.variable_selector || []).slice(-1)[0]! } : undefined}isSubVariableKey={isSubVariable}/>))diff --git a/web/app/components/workflow/nodes/if-else/use-config.helpers.ts b/web/app/components/workflow/nodes/if-else/use-config.helpers.tsindex b6ed6af84c8..6c1b3ec0a3d 100644--- a/web/app/components/workflow/nodes/if-else/use-config.helpers.ts+++ b/web/app/components/workflow/nodes/if-else/use-config.helpers.ts@@ -106,7 +106,7 @@ export const addCondition = ({id: uuid4(),varType: variable.type,variable_selector: valueSelector,- comparison_operator: getOperators(variable.type, isVarFileAttribute ? { key: valueSelector.slice(-1)[0] } : undefined)[0],+ comparison_operator: getOperators(variable.type, isVarFileAttribute ? { key: valueSelector.slice(-1)[0]! } : undefined)[0],value: (variable.type === VarType.boolean || variable.type === VarType.arrayBoolean) ? false : '',})})diff --git a/web/app/components/workflow/nodes/index.tsx b/web/app/components/workflow/nodes/index.tsxindex 1a5c729fe57..7575a156cf9 100644--- a/web/app/components/workflow/nodes/index.tsx+++ b/web/app/components/workflow/nodes/index.tsx@@ -14,7 +14,7 @@ import {const CustomNode = (props: NodeProps) => {const nodeData = props.data- const NodeComponent = useMemo(() => NodeComponentMap[nodeData.type], [nodeData.type])+ const NodeComponent = useMemo(() => NodeComponentMap[nodeData.type], [nodeData.type])!return (<>@@ -40,9 +40,8 @@ export const Panel = memo((props: PanelProps) => {const PanelComponent = useMemo(() => {if (nodeClass === CUSTOM_NODE)return PanelComponentMap[nodeData.type]-return () => null- }, [nodeClass, nodeData.type])+ }, [nodeClass, nodeData.type])!if (nodeClass === CUSTOM_NODE) {return (diff --git a/web/app/components/workflow/nodes/iteration/__tests__/use-interactions.spec.tsx b/web/app/components/workflow/nodes/iteration/__tests__/use-interactions.spec.tsxindex 58671a23116..2b846eca366 100644--- a/web/app/components/workflow/nodes/iteration/__tests__/use-interactions.spec.tsx+++ b/web/app/components/workflow/nodes/iteration/__tests__/use-interactions.spec.tsx@@ -75,7 +75,7 @@ describe('useNodeIterationInteractions', () => {result.current.handleNodeIterationRerender('iteration-node')expect(mockSetNodes).toHaveBeenCalledTimes(1)- const updatedNodes = mockSetNodes.mock.calls[0][0]+ const updatedNodes = mockSetNodes.mock.calls[0]![0]const updatedIterationNode = updatedNodes.find((node: Node) => node.id === 'iteration-node')expect(updatedIterationNode.width).toBe(100 + 60 + ITERATION_PADDING.right)expect(updatedIterationNode.height).toBe(90 + 40 + ITERATION_PADDING.bottom)diff --git a/web/app/components/workflow/nodes/iteration/__tests__/use-single-run-form-params.spec.ts b/web/app/components/workflow/nodes/iteration/__tests__/use-single-run-form-params.spec.tsindex 7313b6945ee..f1845618cf4 100644--- a/web/app/components/workflow/nodes/iteration/__tests__/use-single-run-form-params.spec.ts+++ b/web/app/components/workflow/nodes/iteration/__tests__/use-single-run-form-params.spec.ts@@ -115,12 +115,12 @@ describe('iteration/use-single-run-form-params', () => {}),])expect(result.current.forms).toHaveLength(2)- expect(result.current.forms[0].inputs).toEqual([createInputVar('#start-node.answer#')])- expect(result.current.forms[0].values).toEqual({+ expect(result.current.forms[0]!.inputs).toEqual([createInputVar('#start-node.answer#')])+ expect(result.current.forms[0]!.values).toEqual({'query': 'hello','iteration-node.input_selector': ['start-node', 'items'],})- expect(result.current.forms[1].values).toEqual({+ expect(result.current.forms[1]!.values).toEqual({'iteration-node.input_selector': ['start-node', 'items'],})expect(result.current.allVarObject).toEqual({@@ -151,8 +151,8 @@ describe('iteration/use-single-run-form-params', () => {}))act(() => {- result.current.forms[0].onChange({ query: 'new' })- result.current.forms[1].onChange({+ result.current.forms[0]!.onChange({ query: 'new' })+ result.current.forms[1]!.onChange({'iteration-node.input_selector': ['source-node', 'next'],})})diff --git a/web/app/components/workflow/nodes/iteration/use-single-run-form-params.ts b/web/app/components/workflow/nodes/iteration/use-single-run-form-params.tsindex fd53a603a50..9cd5d51a3fd 100644--- a/web/app/components/workflow/nodes/iteration/use-single-run-form-params.ts+++ b/web/app/components/workflow/nodes/iteration/use-single-run-form-params.ts@@ -59,7 +59,7 @@ const useSingleRunFormParams = ({if (varSelector[0] === id) { // skip iteration node itself variable: item, indexreturn}- const isInIteration = isNodeInIteration(varSelector[0])+ const isInIteration = isNodeInIteration(varSelector[0]!)if (isInIteration) // not pass iteration inner variablereturn@@ -80,12 +80,12 @@ const useSingleRunFormParams = ({})})const res = toVarInputs(vars.map((item) => {- const varInfo = getNodeInfoById(canChooseVarNodes, item[0])+ const varInfo = getNodeInfoById(canChooseVarNodes, item[0]!)return {label: {nodeType: varInfo?.data.type,nodeName: varInfo?.data.title || canChooseVarNodes[0]?.data.title, // default start node title- variable: isSystemVar(item) ? item.join('.') : item[item.length - 1],+ variable: isSystemVar(item) ? item.join('.') : item[item.length - 1]!,},variable: `${item.join('.')}`,value_selector: item,diff --git a/web/app/components/workflow/nodes/knowledge-base/__tests__/use-single-run-form-params.spec.ts b/web/app/components/workflow/nodes/knowledge-base/__tests__/use-single-run-form-params.spec.tsindex ce0216b2752..7124c05b629 100644--- a/web/app/components/workflow/nodes/knowledge-base/__tests__/use-single-run-form-params.spec.ts+++ b/web/app/components/workflow/nodes/knowledge-base/__tests__/use-single-run-form-params.spec.ts@@ -42,13 +42,13 @@ describe('useSingleRunFormParams', () => {}))expect(result.current.forms).toHaveLength(1)- expect(result.current.forms[0].inputs).toEqual([{+ expect(result.current.forms[0]!.inputs).toEqual([{label: 'workflow.nodes.common.inputVars',variable: 'query',type: InputVarType.paragraph,required: true,}])- expect(result.current.forms[0].values).toEqual({ query: 'what is dify' })+ expect(result.current.forms[0]!.values).toEqual({ query: 'what is dify' })})it('should update run input data when the query changes', () => {@@ -63,7 +63,7 @@ describe('useSingleRunFormParams', () => {}))act(() => {- result.current.forms[0].onChange({ query: 'new query' })+ result.current.forms[0]!.onChange({ query: 'new query' })})expect(setRunInputData).toHaveBeenCalledWith({ query: 'new query' })diff --git a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/__tests__/search-method-option.spec.tsx b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/__tests__/search-method-option.spec.tsxindex 62aa379250c..6a7579dfd7c 100644--- a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/__tests__/search-method-option.spec.tsx+++ b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/__tests__/search-method-option.spec.tsx@@ -118,13 +118,13 @@ describe('SearchMethodOption', () => {render(<SearchMethodOption {...props} />)- expect(screen.getByText('Semantic title')).toBeInTheDocument()- expect(screen.getByText('common.modelProvider.rerankModel.key')).toBeInTheDocument()- expect(screen.getByText('plugin.detailPanel.configureModel')).toBeInTheDocument()+ expect(screen.getByText('Semantic title'))!.toBeInTheDocument()+ expect(screen.getByText('common.modelProvider.rerankModel.key'))!.toBeInTheDocument()+ expect(screen.getByText('plugin.detailPanel.configureModel'))!.toBeInTheDocument()expect(screen.getAllByRole('switch')).toHaveLength(2)fireEvent.click(screen.getByText('Semantic title'))- fireEvent.click(screen.getAllByRole('switch')[0])+ fireEvent.click(screen.getAllByRole('switch')[0]!)expect(props.onRetrievalSearchMethodChange).toHaveBeenCalledWith(RetrievalSearchMethodEnum.semantic)expect(props.onRerankingModelEnabledChange).toHaveBeenCalledWith(true)@@ -145,8 +145,8 @@ describe('SearchMethodOption', () => {/>,)- expect(screen.getByText('Full-text title')).toBeInTheDocument()- expect(screen.getByText('common.modelProvider.rerankModel.key')).toBeInTheDocument()+ expect(screen.getByText('Full-text title'))!.toBeInTheDocument()+ expect(screen.getByText('common.modelProvider.rerankModel.key'))!.toBeInTheDocument()fireEvent.click(screen.getByText('Full-text title'))@@ -170,10 +170,10 @@ describe('SearchMethodOption', () => {/>,)- expect(screen.getByText('Weighted mode')).toBeInTheDocument()- expect(screen.getByText('Rerank mode')).toBeInTheDocument()- expect(screen.getByText('dataset.weightedScore.semantic')).toBeInTheDocument()- expect(screen.getByText('dataset.weightedScore.keyword')).toBeInTheDocument()+ expect(screen.getByText('Weighted mode'))!.toBeInTheDocument()+ expect(screen.getByText('Rerank mode'))!.toBeInTheDocument()+ expect(screen.getByText('dataset.weightedScore.semantic'))!.toBeInTheDocument()+ expect(screen.getByText('dataset.weightedScore.keyword'))!.toBeInTheDocument()expect(screen.queryByText('common.modelProvider.rerankModel.key')).not.toBeInTheDocument()expect(screen.queryByText('datasetSettings.form.retrievalSetting.multiModalTip')).not.toBeInTheDocument()@@ -199,10 +199,10 @@ describe('SearchMethodOption', () => {/>,)- expect(screen.getByText('plugin.detailPanel.configureModel')).toBeInTheDocument()+ expect(screen.getByText('plugin.detailPanel.configureModel'))!.toBeInTheDocument()expect(screen.queryByText('common.modelProvider.rerankModel.key')).not.toBeInTheDocument()expect(screen.queryByText('dataset.weightedScore.semantic')).not.toBeInTheDocument()- expect(screen.getByText('datasetSettings.form.retrievalSetting.multiModalTip')).toBeInTheDocument()+ expect(screen.getByText('datasetSettings.form.retrievalSetting.multiModalTip'))!.toBeInTheDocument()})it('should hide the score-threshold control for keyword search', () => {diff --git a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/__tests__/top-k-and-score-threshold.spec.tsx b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/__tests__/top-k-and-score-threshold.spec.tsxindex 6de6365c896..47755ec101e 100644--- a/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/__tests__/top-k-and-score-threshold.spec.tsx+++ b/web/app/components/workflow/nodes/knowledge-base/components/retrieval-setting/__tests__/top-k-and-score-threshold.spec.tsx@@ -19,7 +19,7 @@ describe('TopKAndScoreThreshold', () => {render(<TopKAndScoreThreshold {...defaultProps} />)const [topKInput] = screen.getAllByRole('textbox')- fireEvent.change(topKInput, { target: { value: '3.7' } })+ fireEvent.change(topKInput!, { target: { value: '3.7' } })expect(defaultProps.onTopKChange).toHaveBeenCalledWith(4)})@@ -28,7 +28,7 @@ describe('TopKAndScoreThreshold', () => {render(<TopKAndScoreThreshold {...defaultProps} />)const [, scoreThresholdInput] = screen.getAllByRole('textbox')- fireEvent.change(scoreThresholdInput, { target: { value: '0.456' } })+ fireEvent.change(scoreThresholdInput!, { target: { value: '0.456' } })expect(defaultProps.onScoreThresholdChange).toHaveBeenCalledWith(0.46)})@@ -50,10 +50,10 @@ describe('TopKAndScoreThreshold', () => {)const [topKInput, scoreThresholdInput] = screen.getAllByRole('textbox')- fireEvent.change(topKInput, { target: { value: '' } })+ fireEvent.change(topKInput!, { target: { value: '' } })expect(defaultProps.onTopKChange).toHaveBeenCalledWith(0)- expect(scoreThresholdInput).toHaveValue('')+ expect(scoreThresholdInput)!.toHaveValue('')})it('should default the score-threshold switch to off when the flag is missing', () => {@@ -64,6 +64,6 @@ describe('TopKAndScoreThreshold', () => {/>,)- expect(screen.getByRole('switch')).toHaveAttribute('aria-checked', 'false')+ expect(screen.getByRole('switch'))!.toHaveAttribute('aria-checked', 'false')})})diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/__tests__/use-config.spec.ts b/web/app/components/workflow/nodes/knowledge-retrieval/__tests__/use-config.spec.tsindex 0b9c837f54d..292b7b57fd2 100644--- a/web/app/components/workflow/nodes/knowledge-retrieval/__tests__/use-config.spec.ts+++ b/web/app/components/workflow/nodes/knowledge-retrieval/__tests__/use-config.spec.ts@@ -423,16 +423,16 @@ describe('knowledge-retrieval/use-config', () => {expect(result.current.inputs.metadata_filtering_conditions?.conditions).toHaveLength(2)})- const firstCondition = result.current.inputs.metadata_filtering_conditions!.conditions[0]+ const firstCondition = result.current.inputs.metadata_filtering_conditions!.conditions[0]!act(() => {- result.current.handleUpdateCondition(firstCondition.id, {+ result.current.handleUpdateCondition(firstCondition!.id, {...firstCondition,value: 'agent',comparison_operator: ComparisonOperator.contains,})result.current.handleToggleConditionLogicalOperator()- result.current.handleRemoveCondition(firstCondition.id)+ result.current.handleRemoveCondition(firstCondition!.id)result.current.handleMetadataModelChange({ provider: 'openai', modelId: 'gpt-4.1-mini', mode: AppModeEnum.CHAT })result.current.handleMetadataCompletionParamsChange({ top_p: 0.3 })})diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/hooks/__tests__/use-knowledge-metadata-config.spec.ts b/web/app/components/workflow/nodes/knowledge-retrieval/hooks/__tests__/use-knowledge-metadata-config.spec.tsindex 1f81031a780..bb4bfe91474 100644--- a/web/app/components/workflow/nodes/knowledge-retrieval/hooks/__tests__/use-knowledge-metadata-config.spec.ts+++ b/web/app/components/workflow/nodes/knowledge-retrieval/hooks/__tests__/use-knowledge-metadata-config.spec.ts@@ -100,8 +100,8 @@ describe('use-knowledge-metadata-config', () => {})})- const firstCondition = setInputs.mock.calls[1][0].metadata_filtering_conditions!.conditions[0] as MetadataFilteringCondition- const secondCondition = setInputs.mock.calls[2][0].metadata_filtering_conditions!.conditions[1] as MetadataFilteringCondition+ const firstCondition = setInputs.mock.calls[1]![0].metadata_filtering_conditions!.conditions[0] as MetadataFilteringCondition+ const secondCondition = setInputs.mock.calls[2]![0].metadata_filtering_conditions!.conditions[1] as MetadataFilteringConditionact(() => {result.current.handleUpdateCondition(secondCondition.id, {diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/utils.ts b/web/app/components/workflow/nodes/knowledge-retrieval/utils.tsindex 65a2b6f0104..5f41550fef9 100644--- a/web/app/components/workflow/nodes/knowledge-retrieval/utils.ts+++ b/web/app/components/workflow/nodes/knowledge-retrieval/utils.ts@@ -135,8 +135,8 @@ export const getMultipleRetrievalConfig = (: allHighQualityFullTextSearch? DEFAULT_WEIGHTED_SCORE.allHighQualityFullTextSearch.semantic: DEFAULT_WEIGHTED_SCORE.other.semantic,- embedding_provider_name: selectedDatasets[0].embedding_model_provider,- embedding_model_name: selectedDatasets[0].embedding_model,+ embedding_provider_name: selectedDatasets[0]!.embedding_model_provider,+ embedding_model_name: selectedDatasets[0]!.embedding_model,},keyword_setting: {keyword_weight: allHighQualityVectorSearchdiff --git a/web/app/components/workflow/nodes/list-operator/components/__tests__/extract-input.spec.tsx b/web/app/components/workflow/nodes/list-operator/components/__tests__/extract-input.spec.tsxindex 72a4ec3ef67..7a5abfd040d 100644--- a/web/app/components/workflow/nodes/list-operator/components/__tests__/extract-input.spec.tsx+++ b/web/app/components/workflow/nodes/list-operator/components/__tests__/extract-input.spec.tsx@@ -77,7 +77,7 @@ describe('list-operator/extract-input', () => {/>,)- expect(mockInput.mock.calls[0][0]).toMatchObject({+ expect(mockInput.mock.calls[0]![0]).toMatchObject({readOnly: false,value: '5',placeholder: 'workflow.nodes.http.extractListPlaceholder',@@ -109,7 +109,7 @@ describe('list-operator/extract-input', () => {/>,)- expect(mockInput.mock.calls[0][0].placeholder).toBe('')- expect(mockInput.mock.calls[0][0].readOnly).toBe(true)+ expect(mockInput.mock.calls[0]![0].placeholder).toBe('')+ expect(mockInput.mock.calls[0]![0].readOnly).toBe(true)})})diff --git a/web/app/components/workflow/nodes/list-operator/components/__tests__/limit-config.spec.tsx b/web/app/components/workflow/nodes/list-operator/components/__tests__/limit-config.spec.tsxindex 0e502381c86..fbc3356b32c 100644--- a/web/app/components/workflow/nodes/list-operator/components/__tests__/limit-config.spec.tsx+++ b/web/app/components/workflow/nodes/list-operator/components/__tests__/limit-config.spec.tsx@@ -79,7 +79,7 @@ describe('list-operator/limit-config', () => {/>,)- expect(screen.getByText('workflow.nodes.listFilter.limit')).toBeInTheDocument()+ expect(screen.getByText('workflow.nodes.listFilter.limit'))!.toBeInTheDocument()expect(screen.queryByRole('button', { name: 'slider:10:false' })).not.toBeInTheDocument()fireEvent.click(screen.getByRole('button', { name: 'switch:false' }))@@ -102,8 +102,8 @@ describe('list-operator/limit-config', () => {/>,)- expect(screen.getByRole('button', { name: 'slider:6:true' })).toBeInTheDocument()- expect(mockSlider.mock.calls[0][0]).toMatchObject({+ expect(screen.getByRole('button', { name: 'slider:6:true' }))!.toBeInTheDocument()+ expect(mockSlider.mock.calls[0]![0]).toMatchObject({value: 6,min: 1,max: 20,diff --git a/web/app/components/workflow/nodes/list-operator/components/filter-condition.tsx b/web/app/components/workflow/nodes/list-operator/components/filter-condition.tsxindex 71d6bf2a08e..ce577b82ade 100644--- a/web/app/components/workflow/nodes/list-operator/components/filter-condition.tsx+++ b/web/app/components/workflow/nodes/list-operator/components/filter-condition.tsx@@ -217,7 +217,7 @@ const FilterCondition: FC<Props> = ({const handleSubVariableChange = useCallback((value: string) => {const operators = getOperators(expectedVarType ?? VarType.string, { key: value })- const newOperator = operators.length > 0 ? operators[0] : ComparisonOperator.equal+ const newOperator = operators.length > 0 ? operators[0]! : ComparisonOperator.equalonChange({key: value,comparison_operator: newOperator,diff --git a/web/app/components/workflow/nodes/list-operator/panel.tsx b/web/app/components/workflow/nodes/list-operator/panel.tsxindex e308191e675..365c3030863 100644--- a/web/app/components/workflow/nodes/list-operator/panel.tsx+++ b/web/app/components/workflow/nodes/list-operator/panel.tsx@@ -75,7 +75,7 @@ const Panel: FC<NodePanelProps<ListFilterNodeType>> = ({{inputs.filter_by?.enabled? (<FilterCondition- condition={inputs.filter_by.conditions[0]}+ condition={inputs.filter_by.conditions[0]!}onChange={handleFilterChange}varType={itemVarType}hasSubVariable={hasSubVariable}diff --git a/web/app/components/workflow/nodes/list-operator/use-config.helpers.ts b/web/app/components/workflow/nodes/list-operator/use-config.helpers.tsindex 114a1f0ac5a..d539ea3604a 100644--- a/web/app/components/workflow/nodes/list-operator/use-config.helpers.ts+++ b/web/app/components/workflow/nodes/list-operator/use-config.helpers.ts@@ -51,7 +51,7 @@ export const buildFilterCondition = ({existingKey?: string}): Condition => ({key: (isFileArray && !existingKey) ? 'name' : '',- comparison_operator: getOperators(itemVarType, isFileArray ? { key: 'name' } : undefined)[0],+ comparison_operator: getOperators(itemVarType, isFileArray ? { key: 'name' } : undefined)[0]!,value: itemVarType === WorkflowVarType.boolean ? false : '',})diff --git a/web/app/components/workflow/nodes/llm/__tests__/use-config.spec.ts b/web/app/components/workflow/nodes/llm/__tests__/use-config.spec.tsindex b67d5744cb1..363d2fa5aa0 100644--- a/web/app/components/workflow/nodes/llm/__tests__/use-config.spec.ts+++ b/web/app/components/workflow/nodes/llm/__tests__/use-config.spec.ts@@ -296,10 +296,10 @@ describe('llm/use-config', () => {await waitFor(() => {expect(appendDefaultPromptConfig).toHaveBeenCalled()- expect(appendDefaultPromptConfig.mock.calls[0][1]).toEqual(expect.objectContaining({+ expect(appendDefaultPromptConfig.mock.calls[0]![1]).toEqual(expect.objectContaining({prompt_templates: expect.any(Object),}))- expect(appendDefaultPromptConfig.mock.calls[0][2]).toBe(true)+ expect(appendDefaultPromptConfig.mock.calls[0]![2]).toBe(true)expect(setInputs).toHaveBeenCalledWith(expect.objectContaining({model: expect.objectContaining({provider: 'anthropic',diff --git a/web/app/components/workflow/nodes/llm/components/config-prompt.tsx b/web/app/components/workflow/nodes/llm/components/config-prompt.tsxindex c7fc1411134..8665966e3d6 100644--- a/web/app/components/workflow/nodes/llm/components/config-prompt.tsx+++ b/web/app/components/workflow/nodes/llm/components/config-prompt.tsx@@ -79,7 +79,7 @@ const ConfigPrompt: FC<Props> = ({const handleChatModePromptChange = useCallback((index: number) => {return (prompt: string) => {const newPrompt = produce(payload as PromptItem[], (draft) => {- draft[index][draft[index].edition_type === EditionType.jinja2 ? 'jinja2_text' : 'text'] = prompt+ draft[index]![draft[index]!.edition_type === EditionType.jinja2 ? 'jinja2_text' : 'text'] = prompt})onChange(newPrompt)}@@ -88,7 +88,7 @@ const ConfigPrompt: FC<Props> = ({const handleChatModeEditionTypeChange = useCallback((index: number) => {return (editionType: EditionType) => {const newPrompt = produce(payload as PromptItem[], (draft) => {- draft[index].edition_type = editionType+ draft[index]!.edition_type = editionType})onChange(newPrompt)}@@ -97,7 +97,7 @@ const ConfigPrompt: FC<Props> = ({const handleChatModeMessageRoleChange = useCallback((index: number) => {return (role: PromptRole) => {const newPrompt = produce(payload as PromptItem[], (draft) => {- draft[index].role = role+ draft[index]!.role = role})onChange(newPrompt)}@@ -110,7 +110,7 @@ const ConfigPrompt: FC<Props> = ({return}- const isLastItemUser = draft[draft.length - 1].role === PromptRole.user+ const isLastItemUser = draft[draft.length - 1]!.role === PromptRole.userdraft.push({ role: isLastItemUser ? PromptRole.assistant : PromptRole.user, text: '', id: uuid4() })})onChange(newPrompt)@@ -160,7 +160,7 @@ const ConfigPrompt: FC<Props> = ({className="space-y-1"list={payloadWithIds}setList={(list) => {- if ((payload as PromptItem[])?.[0]?.role === PromptRole.system && list[0].p?.role !== PromptRole.system)+ if ((payload as PromptItem[])?.[0]?.role === PromptRole.system && list[0]!.p?.role !== PromptRole.system)returnonChange(list.map(item => item.p))diff --git a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/hooks.ts b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/hooks.tsindex 4820b5a9dc0..cf7ef1571d1 100644--- a/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/hooks.ts+++ b/web/app/components/workflow/nodes/llm/components/json-schema-config-modal/visual-editor/hooks.ts@@ -296,28 +296,28 @@ export const useSchemaNodeOperations = (props: VisualEditorProps) => {// type changeif (oldType !== newType) {- if (schema.type === Type.object) {- delete schema.properties- delete schema.required+ if (schema!.type === Type.object) {+ delete schema!.properties+ delete schema!.required}- if (schema.type === Type.array)- delete schema.items+ if (schema!.type === Type.array)+ delete schema!.itemsswitch (newType) {case Type.object:- schema.type = Type.object- schema.properties = {}- schema.required = []- schema.additionalProperties = false+ schema!.type = Type.object+ schema!.properties = {}+ schema!.required = []+ schema!.additionalProperties = falsebreakcase ArrayType.string:- schema.type = Type.array- schema.items = {+ schema!.type = Type.array+ schema!.items = {type: Type.string,}breakcase ArrayType.number:- schema.type = Type.array- schema.items = {+ schema!.type = Type.array+ schema!.items = {type: Type.number,}break@@ -328,8 +328,8 @@ export const useSchemaNodeOperations = (props: VisualEditorProps) => {// }// breakcase ArrayType.object:- schema.type = Type.array- schema.items = {+ schema!.type = Type.array+ schema!.items = {type: Type.object,properties: {},required: [],@@ -337,13 +337,14 @@ export const useSchemaNodeOperations = (props: VisualEditorProps) => {}breakdefault:- schema.type = newType as Type+ schema!.type = newType as Type}}// other options change- schema.description = fields.description- schema.enum = fields.enum+ // other options change+ schema!.description = fields.description+ schema!.enum = fields.enum}if (parentSchema.type === Type.array && parentSchema.items && parentSchema.items.type === Type.object && parentSchema.items.properties) {@@ -382,28 +383,28 @@ export const useSchemaNodeOperations = (props: VisualEditorProps) => {const schema = parentSchema.items.properties[newName]// type changeif (oldType !== newType) {- if (schema.type === Type.object) {- delete schema.properties- delete schema.required+ if (schema!.type === Type.object) {+ delete schema!.properties+ delete schema!.required}- if (schema.type === Type.array)- delete schema.items+ if (schema!.type === Type.array)+ delete schema!.itemsswitch (newType) {case Type.object:- schema.type = Type.object- schema.properties = {}- schema.required = []- schema.additionalProperties = false+ schema!.type = Type.object+ schema!.properties = {}+ schema!.required = []+ schema!.additionalProperties = falsebreakcase ArrayType.string:- schema.type = Type.array- schema.items = {+ schema!.type = Type.array+ schema!.items = {type: Type.string,}breakcase ArrayType.number:- schema.type = Type.array- schema.items = {+ schema!.type = Type.array+ schema!.items = {type: Type.number,}break@@ -414,8 +415,8 @@ export const useSchemaNodeOperations = (props: VisualEditorProps) => {// }// breakcase ArrayType.object:- schema.type = Type.array- schema.items = {+ schema!.type = Type.array+ schema!.items = {type: Type.object,properties: {},required: [],@@ -423,13 +424,14 @@ export const useSchemaNodeOperations = (props: VisualEditorProps) => {}breakdefault:- schema.type = newType as Type+ schema!.type = newType as Type}}// other options change- schema.description = fields.description- schema.enum = fields.enum+ // other options change+ schema!.description = fields.description+ schema!.enum = fields.enum}})if (samePropertyNameError)diff --git a/web/app/components/workflow/nodes/llm/hooks/__tests__/use-llm-prompt-config.spec.ts b/web/app/components/workflow/nodes/llm/hooks/__tests__/use-llm-prompt-config.spec.tsindex 67ab2bc4618..518fe6e986c 100644--- a/web/app/components/workflow/nodes/llm/hooks/__tests__/use-llm-prompt-config.spec.ts+++ b/web/app/components/workflow/nodes/llm/hooks/__tests__/use-llm-prompt-config.spec.ts@@ -226,8 +226,8 @@ describe('use-llm-prompt-config', () => {})expect(handleSetInputs).toHaveBeenCalled()- expect(handleSetInputs.mock.calls[0][0].prompt_config?.jinja2_variables).toHaveLength(2)- expect(handleSetInputs.mock.calls[1][0].prompt_config?.jinja2_variables).toEqual([+ expect(handleSetInputs.mock.calls[0]![0].prompt_config?.jinja2_variables).toHaveLength(2)+ expect(handleSetInputs.mock.calls[1]![0].prompt_config?.jinja2_variables).toEqual([{variable: 'old_name',value_selector: ['start', 'old_name'],@@ -241,33 +241,35 @@ describe('use-llm-prompt-config', () => {value_selector: ['start', 'budget'],},])- expect(handleSetInputs.mock.calls[2][0].prompt_config?.jinja2_variables).toEqual([{+ expect(handleSetInputs.mock.calls[2]![0].prompt_config?.jinja2_variables).toEqual([{variable: 'city',value_selector: ['start', 'city'],}])- expect((handleSetInputs.mock.calls[3][0].prompt_template as Array<{ jinja2_text?: string }>)[0].jinja2_text).toBe('{{ new_name }}')- expect(handleSetInputs.mock.calls[4][0].context).toEqual({+ expect((handleSetInputs.mock.calls[3]![0].prompt_template as Array<{+ jinja2_text?: string+ }>)[0]!.jinja2_text).toBe('{{ new_name }}')+ expect(handleSetInputs.mock.calls[4]![0].context).toEqual({enabled: true,variable_selector: ['start', 'sys.query'],})- expect(handleSetInputs.mock.calls[5][0].context).toEqual({+ expect(handleSetInputs.mock.calls[5]![0].context).toEqual({enabled: false,variable_selector: [],})- expect(handleSetInputs.mock.calls[6][0].prompt_template).toEqual([{+ expect(handleSetInputs.mock.calls[6]![0].prompt_template).toEqual([{role: PromptRole.system,text: 'Updated prompt',edition_type: EditionType.basic,}])- expect(handleSetInputs.mock.calls[7][0].memory).toEqual({+ expect(handleSetInputs.mock.calls[7]![0].memory).toEqual({window: {enabled: false,size: 10,},query_prompt_template: '{{#sys.query#}}',})- expect(handleSetInputs.mock.calls[8][0].memory?.query_prompt_template).toBe('custom query')- expect(handleSetInputs.mock.calls[9][0].memory).toEqual({+ expect(handleSetInputs.mock.calls[8]![0].memory?.query_prompt_template).toBe('custom query')+ expect(handleSetInputs.mock.calls[9]![0].memory).toEqual({window: {enabled: true,size: 6,diff --git a/web/app/components/workflow/nodes/loop/__tests__/use-config.helpers.spec.ts b/web/app/components/workflow/nodes/loop/__tests__/use-config.helpers.spec.tsindex 33e67f84b78..eaf0eb51130 100644--- a/web/app/components/workflow/nodes/loop/__tests__/use-config.helpers.spec.ts+++ b/web/app/components/workflow/nodes/loop/__tests__/use-config.helpers.spec.ts@@ -154,7 +154,7 @@ describe('loop use-config helpers', () => {const unchangedAfterMissingRemove = removeSubVariableCondition(removed, 'missing-condition', 'sub-condition-2')expect(untouched).toEqual(inputs)- expect(withKeyedSubCondition.break_conditions?.[0].sub_variable_condition).toEqual({+ expect(withKeyedSubCondition.break_conditions?.[0]!.sub_variable_condition).toEqual({logical_operator: LogicalOperator.and,conditions: [{id: 'sub-condition-1',@@ -164,19 +164,19 @@ describe('loop use-config helpers', () => {value: '',}],})- expect(withDefaultKeySubCondition.break_conditions?.[0].sub_variable_condition?.conditions[1]).toEqual({+ expect(withDefaultKeySubCondition.break_conditions?.[0]!.sub_variable_condition?.conditions[1]).toEqual({id: 'sub-condition-2',key: '',varType: VarType.string,comparison_operator: undefined,value: '',})- expect(updated.break_conditions?.[0].sub_variable_condition?.conditions[0]).toEqual(expect.objectContaining({+ expect(updated.break_conditions?.[0]!.sub_variable_condition?.conditions[0]).toEqual(expect.objectContaining({comparison_operator: ComparisonOperator.notIn,value: ['remote_url'],}))- expect(toggled.break_conditions?.[0].sub_variable_condition?.logical_operator).toBe(LogicalOperator.or)- expect(removed.break_conditions?.[0].sub_variable_condition?.conditions).toEqual([+ expect(toggled.break_conditions?.[0]!.sub_variable_condition?.logical_operator).toBe(LogicalOperator.or)+ expect(removed.break_conditions?.[0]!.sub_variable_condition?.conditions).toEqual([expect.objectContaining({ id: 'sub-condition-2' }),])expect(unchangedAfterMissingRemove).toEqual(removed)diff --git a/web/app/components/workflow/nodes/loop/__tests__/use-interactions.spec.tsx b/web/app/components/workflow/nodes/loop/__tests__/use-interactions.spec.tsxindex ac7da5bf2cd..e28bd4865f2 100644--- a/web/app/components/workflow/nodes/loop/__tests__/use-interactions.spec.tsx+++ b/web/app/components/workflow/nodes/loop/__tests__/use-interactions.spec.tsx@@ -68,7 +68,7 @@ describe('useNodeLoopInteractions', () => {result.current.handleNodeLoopRerender('loop-node')expect(mockSetNodes).toHaveBeenCalledTimes(1)- const updatedNodes = mockSetNodes.mock.calls[0][0]+ const updatedNodes = mockSetNodes.mock.calls[0]![0]const updatedLoopNode = updatedNodes.find((node: Node) => node.id === 'loop-node')expect(updatedLoopNode.width).toBe(100 + 60 + LOOP_PADDING.right)expect(updatedLoopNode.height).toBe(90 + 40 + LOOP_PADDING.bottom)diff --git a/web/app/components/workflow/nodes/loop/__tests__/use-single-run-form-params.spec.ts b/web/app/components/workflow/nodes/loop/__tests__/use-single-run-form-params.spec.tsindex 7ff89492cd1..dfe13b79e4f 100644--- a/web/app/components/workflow/nodes/loop/__tests__/use-single-run-form-params.spec.ts+++ b/web/app/components/workflow/nodes/loop/__tests__/use-single-run-form-params.spec.ts@@ -167,12 +167,12 @@ describe('useSingleRunFormParams', () => {expect.objectContaining({ variable: 'start-node.answer' }),])expect(result.current.forms).toHaveLength(1)- expect(result.current.forms[0].inputs).toEqual([+ expect(result.current.forms[0]!.inputs).toEqual([createInputVar('start-node.answer'),createInputVar('tool-a.result'),createInputVar('start-node.answer'),])- expect(result.current.forms[0].values).toEqual({ question: 'hello' })+ expect(result.current.forms[0]!.values).toEqual({ question: 'hello' })expect(result.current.allVarObject).toEqual({'start-node.answer@@@tool-a@@@0': {inSingleRunPassedKey: 'passed_key',@@ -201,7 +201,7 @@ describe('useSingleRunFormParams', () => {}))act(() => {- result.current.forms[0].onChange({ retry: true })+ result.current.forms[0]!.onChange({ retry: true })})expect(setRunInputData).toHaveBeenCalledWith({ retry: true })diff --git a/web/app/components/workflow/nodes/loop/use-config.helpers.ts b/web/app/components/workflow/nodes/loop/use-config.helpers.tsindex edeca0b7662..dadd0aa6395 100644--- a/web/app/components/workflow/nodes/loop/use-config.helpers.ts+++ b/web/app/components/workflow/nodes/loop/use-config.helpers.ts@@ -41,7 +41,7 @@ export const addBreakCondition = ({id: uuid4(),varType: variable.type,variable_selector: valueSelector,- comparison_operator: getOperators(variable.type, isVarFileAttribute ? { key: valueSelector.slice(-1)[0] } : undefined)[0],+ comparison_operator: getOperators(variable.type, isVarFileAttribute ? { key: valueSelector.slice(-1)[0]! } : undefined)[0],value: variable.type === VarType.boolean ? 'false' : '',})})@@ -164,7 +164,7 @@ export const updateLoopVariable = (const index = draft.loop_variables?.findIndex(item => item.id === id) ?? -1if (index > -1) {draft.loop_variables![index] = {- ...draft.loop_variables![index],+ ...draft.loop_variables![index]!,...updateData,}}diff --git a/web/app/components/workflow/nodes/loop/use-single-run-form-params.helpers.ts b/web/app/components/workflow/nodes/loop/use-single-run-form-params.helpers.tsindex 02db10c1737..90df2d57775 100644--- a/web/app/components/workflow/nodes/loop/use-single-run-form-params.helpers.ts+++ b/web/app/components/workflow/nodes/loop/use-single-run-form-params.helpers.ts@@ -68,7 +68,7 @@ export const buildUsedOutVars = ({nodeVars.forEach((varSelector) => {if (varSelector[0] === currentNodeId)return- if (isNodeInLoop(varSelector[0]))+ if (isNodeInLoop(varSelector[0]!))returnconst varSelectorStr = varSelector.join('.')@@ -90,12 +90,12 @@ export const buildUsedOutVars = ({})const usedOutVars = toVarInputs(vars.map((valueSelector) => {- const varInfo = getNodeInfoById(canChooseVarNodes, valueSelector[0])+ const varInfo = getNodeInfoById(canChooseVarNodes, valueSelector[0]!)return {label: {nodeType: varInfo?.data.type,- nodeName: varInfo?.data.title || canChooseVarNodes[0]?.data.title,- variable: isSystemVar(valueSelector) ? valueSelector.join('.') : valueSelector[valueSelector.length - 1],+ nodeName: varInfo?.data.title || canChooseVarNodes[0]?.data.title!,+ variable: isSystemVar(valueSelector) ? valueSelector.join('.') : valueSelector[valueSelector.length - 1]!,},variable: valueSelector.join('.'),value_selector: valueSelector,diff --git a/web/app/components/workflow/nodes/parameter-extractor/__tests__/use-single-run-form-params.spec.ts b/web/app/components/workflow/nodes/parameter-extractor/__tests__/use-single-run-form-params.spec.tsindex 9122dd52e0b..f3bc4da8837 100644--- a/web/app/components/workflow/nodes/parameter-extractor/__tests__/use-single-run-form-params.spec.ts+++ b/web/app/components/workflow/nodes/parameter-extractor/__tests__/use-single-run-form-params.spec.ts@@ -99,7 +99,7 @@ describe('parameter-extractor/use-single-run-form-params', () => {}))expect(result.current.forms).toHaveLength(2)- expect(result.current.forms[0].inputs).toEqual(expect.arrayContaining([+ expect(result.current.forms[0]!.inputs).toEqual(expect.arrayContaining([expect.objectContaining({variable: 'query',type: InputVarType.paragraph,@@ -108,15 +108,15 @@ describe('parameter-extractor/use-single-run-form-params', () => {variable: '#node-2.answer#',}),]))- expect(result.current.forms[1].inputs).toEqual([{+ expect(result.current.forms[1]!.inputs).toEqual([{label: 'image',variable: '#files#',type: InputVarType.singleFile,required: false,}])- result.current.forms[0].onChange({ query: 'updated' })- result.current.forms[1].onChange({ '#files#': ['file-2'] })+ result.current.forms[0]!.onChange({ query: 'updated' })+ result.current.forms[1]!.onChange({ '#files#': ['file-2'] })expect(setRunInputData).toHaveBeenNthCalledWith(1, {'query': 'updated',@@ -128,7 +128,7 @@ describe('parameter-extractor/use-single-run-form-params', () => {'#context#': 'ctx','#files#': ['file-2'],})- const availableVarOptions = mockUseAvailableVarList.mock.calls[0][1] as { filterVar: (payload: { type: VarType }) => boolean }+ const availableVarOptions = mockUseAvailableVarList.mock.calls[0]![1] as { filterVar: (payload: { type: VarType }) => boolean }expect(availableVarOptions.filterVar({ type: VarType.file })).toBe(true)expect(availableVarOptions.filterVar({ type: VarType.string })).toBe(false)diff --git a/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/__tests__/import-from-tool.spec.tsx b/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/__tests__/import-from-tool.spec.tsxindex ca7be465117..f1da87bed27 100644--- a/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/__tests__/import-from-tool.spec.tsx+++ b/web/app/components/workflow/nodes/parameter-extractor/components/extract-parameter/__tests__/import-from-tool.spec.tsx@@ -94,7 +94,7 @@ describe('parameter-extractor/extract-parameter/import-from-tool', () => {human_description: { en_US: 'Internal', zh_Hans: 'Internal' },}),] satisfies ToolWithProvider['tools'][number]['parameters']- provider.tools[0].parameters = builtInParameters+ provider.tools[0]!.parameters = builtInParametersmockToolCollections.builtIn = [provider]renderWorkflowComponent(@@ -133,7 +133,7 @@ describe('parameter-extractor/extract-parameter/import-from-tool', () => {human_description: { en_US: 'Summary', zh_Hans: 'Summary' },}),] satisfies ToolWithProvider['tools'][number]['parameters']- provider.tools[0].parameters = workflowParameters+ provider.tools[0]!.parameters = workflowParametersmockToolCollections.workflow = [provider]renderWorkflowComponent(diff --git a/web/app/components/workflow/nodes/question-classifier/__tests__/use-single-run-form-params.spec.ts b/web/app/components/workflow/nodes/question-classifier/__tests__/use-single-run-form-params.spec.tsindex a34bb2e9ad5..13fa9f62e62 100644--- a/web/app/components/workflow/nodes/question-classifier/__tests__/use-single-run-form-params.spec.ts+++ b/web/app/components/workflow/nodes/question-classifier/__tests__/use-single-run-form-params.spec.ts@@ -92,7 +92,7 @@ describe('question-classifier/use-single-run-form-params', () => {}))expect(result.current.forms).toHaveLength(2)- expect(result.current.forms[0].inputs).toEqual(expect.arrayContaining([+ expect(result.current.forms[0]!.inputs).toEqual(expect.arrayContaining([expect.objectContaining({variable: 'query',type: InputVarType.paragraph,@@ -101,15 +101,15 @@ describe('question-classifier/use-single-run-form-params', () => {variable: '#node-2.answer#',}),]))- expect(result.current.forms[1].inputs).toEqual([{+ expect(result.current.forms[1]!.inputs).toEqual([{label: 'image',variable: '#files#',type: InputVarType.singleFile,required: false,}])- result.current.forms[0].onChange({ query: 'updated' })- result.current.forms[1].onChange({ '#files#': ['file-2'] })+ result.current.forms[0]!.onChange({ query: 'updated' })+ result.current.forms[1]!.onChange({ '#files#': ['file-2'] })expect(setRunInputData).toHaveBeenNthCalledWith(1, {'query': 'updated',@@ -119,7 +119,7 @@ describe('question-classifier/use-single-run-form-params', () => {'query': 'hello','#files#': ['file-2'],})- const availableVarOptions = mockUseAvailableVarList.mock.calls[0][1] as { filterVar: (payload: { type: VarType }) => boolean }+ const availableVarOptions = mockUseAvailableVarList.mock.calls[0]![1] as { filterVar: (payload: { type: VarType }) => boolean }expect(availableVarOptions.filterVar({ type: VarType.file })).toBe(true)expect(availableVarOptions.filterVar({ type: VarType.string })).toBe(false)diff --git a/web/app/components/workflow/nodes/question-classifier/components/class-list.tsx b/web/app/components/workflow/nodes/question-classifier/components/class-list.tsxindex 55dbb43cc83..8f62c27bb11 100644--- a/web/app/components/workflow/nodes/question-classifier/components/class-list.tsx+++ b/web/app/components/workflow/nodes/question-classifier/components/class-list.tsx@@ -65,7 +65,7 @@ const ClassList: FC<Props> = ({const handleRemoveClass = useCallback((index: number) => {return () => {- handleEdgeDeleteByDeleteBranch(nodeId, list[index].id)+ handleEdgeDeleteByDeleteBranch(nodeId, list[index]!.id)const newList = produce(list, (draft) => {draft.splice(index, 1)})@@ -150,7 +150,7 @@ const ClassList: FC<Props> = ({className={cn(canDrag && 'handle')}headerClassName={cn(canDrag && 'cursor-grab group-hover:pl-5')}nodeId={nodeId}- key={list[index].id}+ key={list[index]!.id}payload={item}onChange={handleClassChange(index)}onRemove={handleRemoveClass(index)}diff --git a/web/app/components/workflow/nodes/start/__tests__/use-config.spec.ts b/web/app/components/workflow/nodes/start/__tests__/use-config.spec.tsindex 330b1ac776d..16d37a6a8fa 100644--- a/web/app/components/workflow/nodes/start/__tests__/use-config.spec.ts+++ b/web/app/components/workflow/nodes/start/__tests__/use-config.spec.ts@@ -143,7 +143,7 @@ describe('start/use-config', () => {it('should block removal when the variable is still in use and confirm the deletion later', () => {mockIsVarUsedInNodes.mockReturnValue(true)const { result } = renderHook(() => useConfig('start-node', currentInputs))- const nextList = [currentInputs.variables[1]]+ const nextList = [currentInputs.variables[1]!]act(() => {result.current.handleVarListChange(nextList, {@@ -215,7 +215,7 @@ describe('start/use-config', () => {variable: 'query',type: InputVarType.paragraph,}),- currentInputs.variables[1],+ currentInputs.variables[1]!,]act(() => {diff --git a/web/app/components/workflow/nodes/start/__tests__/use-single-run-form-params.spec.ts b/web/app/components/workflow/nodes/start/__tests__/use-single-run-form-params.spec.tsindex 4372c2a02d2..dc6de703e2e 100644--- a/web/app/components/workflow/nodes/start/__tests__/use-single-run-form-params.spec.ts+++ b/web/app/components/workflow/nodes/start/__tests__/use-single-run-form-params.spec.ts@@ -51,14 +51,14 @@ describe('start/use-single-run-form-params', () => {}))expect(result.current.forms).toHaveLength(1)- expect(result.current.forms[0].label).toBe('nodes.llm.singleRun.variable')- expect(result.current.forms[0].inputs).toEqual(expect.arrayContaining([+ expect(result.current.forms[0]!.label).toBe('nodes.llm.singleRun.variable')+ expect(result.current.forms[0]!.inputs).toEqual(expect.arrayContaining([expect.objectContaining({ variable: 'query' }),expect.objectContaining({ variable: '#sys.query#', required: true }),expect.objectContaining({ variable: '#sys.files#', required: false }),]))- result.current.forms[0].onChange({ query: 'updated' })+ result.current.forms[0]!.onChange({ query: 'updated' })expect(setRunInputData).toHaveBeenCalledWith({ query: 'updated' })expect(result.current.getDependentVars()).toEqual([@@ -82,7 +82,7 @@ describe('start/use-single-run-form-params', () => {toVarInputs: () => [],}))- expect(result.current.forms[0].inputs).toEqual(expect.not.arrayContaining([+ expect(result.current.forms[0]!.inputs).toEqual(expect.not.arrayContaining([expect.objectContaining({ variable: '#sys.query#' }),]))expect(result.current.getDependentVars()).toEqual([diff --git a/web/app/components/workflow/nodes/start/components/var-list.tsx b/web/app/components/workflow/nodes/start/components/var-list.tsxindex ac29aae3e8c..d4f6511cdbd 100644--- a/web/app/components/workflow/nodes/start/components/var-list.tsx+++ b/web/app/components/workflow/nodes/start/components/var-list.tsx@@ -61,7 +61,7 @@ const VarList: FC<Props> = ({payload: {type: ChangeType.remove,payload: {- beforeKey: list[index].variable,+ beforeKey: list[index]!.variable,},},})diff --git a/web/app/components/workflow/nodes/start/use-config.ts b/web/app/components/workflow/nodes/start/use-config.tsindex 12ec1575c98..e9542535614 100644--- a/web/app/components/workflow/nodes/start/use-config.ts+++ b/web/app/components/workflow/nodes/start/use-config.ts@@ -63,8 +63,8 @@ const useConfig = (id: string, payload: StartNodeType) => {setInputs(newInputs)if (moreInfo?.payload?.type === ChangeType.changeVarName) {const changedVar = newList[moreInfo.index]- handleOutVarRenameChange(id, [id, inputs.variables[moreInfo.index].variable], [id, changedVar.variable])- renameInspectVarName(id, inputs.variables[moreInfo.index].variable, changedVar.variable)+ handleOutVarRenameChange(id, [id, inputs.variables[moreInfo.index]!.variable], [id, changedVar!.variable])+ renameInspectVarName(id, inputs.variables[moreInfo.index]!.variable, changedVar!.variable)}else if (moreInfo?.payload?.type !== ChangeType.remove) { // edit var typedeleteNodeInspectorVars(id)diff --git a/web/app/components/workflow/nodes/template-transform/__tests__/use-single-run-form-params.spec.ts b/web/app/components/workflow/nodes/template-transform/__tests__/use-single-run-form-params.spec.tsindex 260dd9f9001..1e3381a13fb 100644--- a/web/app/components/workflow/nodes/template-transform/__tests__/use-single-run-form-params.spec.ts+++ b/web/app/components/workflow/nodes/template-transform/__tests__/use-single-run-form-params.spec.ts@@ -57,10 +57,10 @@ describe('template-transform/use-single-run-form-params', () => {}))expect(result.current.forms).toHaveLength(1)- expect(result.current.forms[0].inputs).toEqual(varInputs)- expect(result.current.forms[0].values).toEqual({ input_text: 'hello' })+ expect(result.current.forms[0]!.inputs).toEqual(varInputs)+ expect(result.current.forms[0]!.values).toEqual({ input_text: 'hello' })- result.current.forms[0].onChange({ input_text: 'updated' })+ result.current.forms[0]!.onChange({ input_text: 'updated' })expect(setRunInputData).toHaveBeenCalledWith({ input_text: 'updated' })expect(result.current.getDependentVars()).toEqual([['node-1', 'input_text']])diff --git a/web/app/components/workflow/nodes/tool/__tests__/panel.spec.tsx b/web/app/components/workflow/nodes/tool/__tests__/panel.spec.tsxindex d15c8a44782..e7fc98b58ad 100644--- a/web/app/components/workflow/nodes/tool/__tests__/panel.spec.tsx+++ b/web/app/components/workflow/nodes/tool/__tests__/panel.spec.tsx@@ -192,7 +192,7 @@ describe('ToolPanel', () => {renderPanel()- expect(screen.getByRole('status')).toBeInTheDocument()+ expect(screen.getByRole('status'))!.toBeInTheDocument()expect(screen.queryByText('workflow.nodes.tool.inputVars')).not.toBeInTheDocument()expect(mockToolForm).not.toHaveBeenCalled()})@@ -213,21 +213,21 @@ describe('ToolPanel', () => {renderPanel()- expect(screen.getByText('workflow.nodes.tool.inputVars')).toBeInTheDocument()- expect(screen.getByText('workflow.nodes.tool.settings')).toBeInTheDocument()+ expect(screen.getByText('workflow.nodes.tool.inputVars'))!.toBeInTheDocument()+ expect(screen.getByText('workflow.nodes.tool.settings'))!.toBeInTheDocument()expect(screen.getAllByTestId('split')).toHaveLength(2)fireEvent.click(screen.getByRole('button', { name: 'Manage Input Field' }))expect(mockToolForm).toHaveBeenCalledTimes(2)- expect(mockToolForm.mock.calls[0][0]).toEqual(expect.objectContaining({+ expect(mockToolForm.mock.calls[0]![0]).toEqual(expect.objectContaining({nodeId: 'tool-node-1',showManageInputField: true,}))- expect(mockToolForm.mock.calls[1][0]).toEqual(expect.objectContaining({+ expect(mockToolForm.mock.calls[1]![0]).toEqual(expect.objectContaining({nodeId: 'tool-node-1',}))- expect(mockToolForm.mock.calls[1][0]).not.toHaveProperty('showManageInputField')+ expect(mockToolForm.mock.calls[1]![0]).not.toHaveProperty('showManageInputField')expect(mockWorkflowStoreState.setShowInputFieldPanel).toHaveBeenCalledWith(true)})@@ -242,9 +242,9 @@ describe('ToolPanel', () => {expect(screen.queryByText('workflow.nodes.tool.inputVars')).not.toBeInTheDocument()expect(screen.queryByText('workflow.nodes.tool.settings')).not.toBeInTheDocument()- expect(screen.getByText('text')).toBeInTheDocument()- expect(screen.getByText('files')).toBeInTheDocument()- expect(screen.getByText('json')).toBeInTheDocument()+ expect(screen.getByText('text'))!.toBeInTheDocument()+ expect(screen.getByText('files'))!.toBeInTheDocument()+ expect(screen.getByText('json'))!.toBeInTheDocument()expect(mockToolForm).not.toHaveBeenCalled()})})@@ -274,10 +274,10 @@ describe('ToolPanel', () => {renderPanel()- expect(screen.getByText('summary')).toBeInTheDocument()- expect(screen.getByText('string (qa_structured)')).toBeInTheDocument()- expect(screen.getByText('Summary field')).toBeInTheDocument()- expect(screen.getByTestId('structured-output')).toHaveTextContent('details-object_structured')+ expect(screen.getByText('summary'))!.toBeInTheDocument()+ expect(screen.getByText('string (qa_structured)'))!.toBeInTheDocument()+ expect(screen.getByText('Summary field'))!.toBeInTheDocument()+ expect(screen.getByTestId('structured-output'))!.toHaveTextContent('details-object_structured')expect(mockWrapStructuredVarItem).toHaveBeenCalledWith(expect.objectContaining({name: 'details',}), 'object_structured')@@ -301,8 +301,8 @@ describe('ToolPanel', () => {renderPanel()- expect(screen.getByTestId('var-item-summary')).toHaveTextContent('summary')- expect(screen.getByTestId('var-item-summary')).toHaveTextContent('String'.toLowerCase())+ expect(screen.getByTestId('var-item-summary'))!.toHaveTextContent('summary')+ expect(screen.getByTestId('var-item-summary'))!.toHaveTextContent('String'.toLowerCase())expect(screen.getByTestId('var-item-summary')).not.toHaveTextContent('qa_structured')})})diff --git a/web/app/components/workflow/nodes/tool/components/mixed-variable-text-input/__tests__/index.spec.tsx b/web/app/components/workflow/nodes/tool/components/mixed-variable-text-input/__tests__/index.spec.tsxindex 04559b2174a..59cdd1264d9 100644--- a/web/app/components/workflow/nodes/tool/components/mixed-variable-text-input/__tests__/index.spec.tsx+++ b/web/app/components/workflow/nodes/tool/components/mixed-variable-text-input/__tests__/index.spec.tsx@@ -84,7 +84,7 @@ describe('tool/mixed-variable-text-input', () => {fireEvent.click(screen.getByRole('button', { name: 'prompt-editor' }))expect(handleChange).toHaveBeenCalledWith('updated value')- expect(mockPromptEditor.mock.calls[0][0]).toMatchObject({+ expect(mockPromptEditor.mock.calls[0]![0]).toMatchObject({editable: true,value: 'initial value',workflowVariableBlock: {@@ -108,7 +108,7 @@ describe('tool/mixed-variable-text-input', () => {},},})- expect(isValidElement(mockPromptEditor.mock.calls[0][0].placeholder)).toBe(true)+ expect(isValidElement(mockPromptEditor.mock.calls[0]![0].placeholder)).toBe(true)})it('should disable editing and variable insertion when requested', () => {@@ -119,7 +119,7 @@ describe('tool/mixed-variable-text-input', () => {/>,)- expect(mockPromptEditor.mock.calls[0][0]).toMatchObject({+ expect(mockPromptEditor.mock.calls[0]![0]).toMatchObject({editable: false,value: '',workflowVariableBlock: {@@ -130,6 +130,6 @@ describe('tool/mixed-variable-text-input', () => {onManageInputField: undefined,},})- expect(isValidElement(mockPromptEditor.mock.calls[0][0].placeholder)).toBe(true)+ expect(isValidElement(mockPromptEditor.mock.calls[0]![0].placeholder)).toBe(true)})})diff --git a/web/app/components/workflow/nodes/tool/components/mixed-variable-text-input/__tests__/placeholder.spec.tsx b/web/app/components/workflow/nodes/tool/components/mixed-variable-text-input/__tests__/placeholder.spec.tsxindex 366bb0f01ff..bf8b91d9c7e 100644--- a/web/app/components/workflow/nodes/tool/components/mixed-variable-text-input/__tests__/placeholder.spec.tsx+++ b/web/app/components/workflow/nodes/tool/components/mixed-variable-text-input/__tests__/placeholder.spec.tsx@@ -38,16 +38,16 @@ describe('tool/mixed-variable-text-input/placeholder', () => {const root = screen.getByText('workflow.nodes.tool.insertPlaceholder1').closest('.cursor-text') as HTMLElement- expect(screen.getByText('workflow.nodes.tool.insertPlaceholder1')).toBeInTheDocument()- expect(screen.getByText('workflow.nodes.tool.insertPlaceholder2')).toBeInTheDocument()- expect(screen.getByText('String')).toBeInTheDocument()+ expect(screen.getByText('workflow.nodes.tool.insertPlaceholder1'))!.toBeInTheDocument()+ expect(screen.getByText('workflow.nodes.tool.insertPlaceholder2'))!.toBeInTheDocument()+ expect(screen.getByText('String'))!.toBeInTheDocument()fireEvent.click(root)- expect(mockInsertNodes.mock.calls[0][0][0]).toMatchObject({ text: '' })+ expect(mockInsertNodes.mock.calls[0]![0][0]).toMatchObject({ text: '' })expect(mockDispatchCommand).toHaveBeenCalledWith('FOCUS_COMMAND', undefined)fireEvent.mouseDown(screen.getByText('workflow.nodes.tool.insertPlaceholder2'))- expect(mockInsertNodes.mock.calls[1][0][0]).toMatchObject({ text: '/' })+ expect(mockInsertNodes.mock.calls[1]![0][0]).toMatchObject({ text: '/' })expect(mockDispatchCommand).toHaveBeenNthCalledWith(2, 'FOCUS_COMMAND', undefined)})@@ -59,10 +59,10 @@ describe('tool/mixed-variable-text-input/placeholder', () => {/>,)- expect(screen.getByText('workflow.nodes.tool.insertPlaceholder1')).toBeInTheDocument()+ expect(screen.getByText('workflow.nodes.tool.insertPlaceholder1'))!.toBeInTheDocument()expect(screen.queryByText('workflow.nodes.tool.insertPlaceholder2')).not.toBeInTheDocument()expect(screen.queryByText('String')).not.toBeInTheDocument()- expect(container.firstChild).toHaveClass('items-start')- expect(container.firstChild).toHaveClass('py-1')+ expect(container.firstChild)!.toHaveClass('items-start')+ expect(container.firstChild)!.toHaveClass('py-1')})})diff --git a/web/app/components/workflow/nodes/tool/components/tool-form/__tests__/index.spec.tsx b/web/app/components/workflow/nodes/tool/components/tool-form/__tests__/index.spec.tsxindex 4db6808c14e..95c2cdd95dd 100644--- a/web/app/components/workflow/nodes/tool/components/tool-form/__tests__/index.spec.tsx+++ b/web/app/components/workflow/nodes/tool/components/tool-form/__tests__/index.spec.tsx@@ -79,10 +79,10 @@ describe('tool/tool-form', () => {/>,)- expect(screen.getByTestId('tool-form-item-api_key')).toBeInTheDocument()- expect(screen.getByTestId('tool-form-item-region')).toBeInTheDocument()+ expect(screen.getByTestId('tool-form-item-api_key'))!.toBeInTheDocument()+ expect(screen.getByTestId('tool-form-item-region'))!.toBeInTheDocument()expect(mockToolFormItem).toHaveBeenCalledTimes(2)- expect(mockToolFormItem.mock.calls[0][0]).toMatchObject({+ expect(mockToolFormItem.mock.calls[0]![0]).toMatchObject({readOnly: true,nodeId: 'tool-node',schema: expect.objectContaining({ variable: 'api_key' }),@@ -107,7 +107,7 @@ describe('tool/tool-form', () => {/>,)- expect(container.firstChild).toHaveClass('space-y-1')+ expect(container.firstChild)!.toHaveClass('space-y-1')expect(screen.queryByTestId(/tool-form-item-/)).not.toBeInTheDocument()expect(mockToolFormItem).not.toHaveBeenCalled()})diff --git a/web/app/components/workflow/nodes/tool/components/tool-form/__tests__/item.spec.tsx b/web/app/components/workflow/nodes/tool/components/tool-form/__tests__/item.spec.tsxindex 896897a777b..e935085fe90 100644--- a/web/app/components/workflow/nodes/tool/components/tool-form/__tests__/item.spec.tsx+++ b/web/app/components/workflow/nodes/tool/components/tool-form/__tests__/item.spec.tsx@@ -103,12 +103,12 @@ describe('tool/tool-form/item', () => {/>,)- expect(screen.getByText('API Key')).toBeInTheDocument()- expect(screen.getByText('*')).toBeInTheDocument()- expect(screen.getByText('Enter API key')).toBeInTheDocument()+ expect(screen.getByText('API Key'))!.toBeInTheDocument()+ expect(screen.getByText('*'))!.toBeInTheDocument()+ expect(screen.getByText('Enter API key'))!.toBeInTheDocument()expect(screen.queryByRole('button', { name: 'JSON Schema' })).not.toBeInTheDocument()- expect(screen.getByTestId('form-input-item')).toHaveAttribute('data-provider-type', 'tool')- expect(mockFormInputItem.mock.calls[0][0]).toMatchObject({+ expect(screen.getByTestId('form-input-item'))!.toHaveAttribute('data-provider-type', 'tool')+ expect(mockFormInputItem.mock.calls[0]![0]).toMatchObject({readOnly: true,nodeId: 'tool-node',schema: expect.objectContaining({ variable: 'api_key' }),@@ -140,10 +140,10 @@ describe('tool/tool-form/item', () => {)const link = screen.getByRole('link', { name: 'https://docs.dify.ai/tools' })- expect(link).toHaveAttribute('href', 'https://docs.dify.ai/tools')- expect(link).toHaveAttribute('target', '_blank')- expect(link).toHaveAttribute('rel', 'noopener noreferrer')- expect(link.parentElement).toHaveTextContent('Visit https://docs.dify.ai/tools for docs')+ expect(link)!.toHaveAttribute('href', 'https://docs.dify.ai/tools')+ expect(link)!.toHaveAttribute('target', '_blank')+ expect(link)!.toHaveAttribute('rel', 'noopener noreferrer')+ expect(link.parentElement)!.toHaveTextContent('Visit https://docs.dify.ai/tools for docs')})// Non-text fields keep their descriptions inside the tooltip and support JSON schema preview.@@ -183,13 +183,13 @@ describe('tool/tool-form/item', () => {)fireEvent.mouseEnter(container.querySelector('svg')?.parentElement as HTMLElement)- expect(screen.getByText('Select from tools')).toBeInTheDocument()+ expect(screen.getByText('Select from tools'))!.toBeInTheDocument()fireEvent.click(screen.getByRole('button', { name: 'JSON Schema' }))const schemaModal = screen.getByTestId('schema-modal')- expect(schemaModal).toBeInTheDocument()- expect(within(schemaModal).getByText('tool_config')).toBeInTheDocument()- expect(mockFormInputItem.mock.calls[0][0].providerType).toBe('trigger')+ expect(schemaModal)!.toBeInTheDocument()+ expect(within(schemaModal).getByText('tool_config'))!.toBeInTheDocument()+ expect(mockFormInputItem.mock.calls[0]![0].providerType).toBe('trigger')fireEvent.click(screen.getByRole('button', { name: 'close-schema' }))expect(screen.queryByTestId('schema-modal')).not.toBeInTheDocument()diff --git a/web/app/components/workflow/nodes/tool/hooks/__tests__/use-single-run-form-params.spec.ts b/web/app/components/workflow/nodes/tool/hooks/__tests__/use-single-run-form-params.spec.tsindex 2e0dc13cb34..a0b9a746bf6 100644--- a/web/app/components/workflow/nodes/tool/hooks/__tests__/use-single-run-form-params.spec.ts+++ b/web/app/components/workflow/nodes/tool/hooks/__tests__/use-single-run-form-params.spec.ts@@ -121,12 +121,12 @@ describe('useSingleRunFormParams', () => {'prefix {{#tool.result#}}',])expect(result.current.forms).toHaveLength(1)- expect(result.current.forms[0].inputs).toEqual([+ expect(result.current.forms[0]!.inputs).toEqual([createInputVar('#start.query#'),createInputVar(undefined as unknown as string),createInputVar('#legacy.answer#'),])- expect(result.current.forms[0].values).toEqual({})+ expect(result.current.forms[0]!.values).toEqual({})expect(result.current.toolIcon).toBe('tool-icon')expect(result.current.getDependentVars()).toEqual([['start', 'query'],@@ -159,7 +159,7 @@ describe('useSingleRunFormParams', () => {}))act(() => {- result.current.forms[0].onChange({+ result.current.forms[0]!.onChange({query: 'weather',tool_parameters: {nullable_constant: 'temp-value',@@ -173,7 +173,7 @@ describe('useSingleRunFormParams', () => {nullable_constant: 'temp-value',},})- expect(result.current.forms[0].values).toEqual({+ expect(result.current.forms[0]!.values).toEqual({query: 'weather',tool_parameters: {nullable_constant: 'temp-value',diff --git a/web/app/components/workflow/nodes/tool/hooks/use-single-run-form-params.ts b/web/app/components/workflow/nodes/tool/hooks/use-single-run-form-params.tsindex fcef11d5781..a7b5687b72c 100644--- a/web/app/components/workflow/nodes/tool/hooks/use-single-run-form-params.ts+++ b/web/app/components/workflow/nodes/tool/hooks/use-single-run-form-params.ts@@ -32,7 +32,7 @@ const useSingleRunFormParams = ({const { inputs } = useNodeCrud<ToolNodeType>(id, payload)const hadVarParams = Object.keys(inputs.tool_parameters)- .filter(key => inputs.tool_parameters[key].type !== VarType.constant)+ .filter(key => inputs.tool_parameters[key]!.type !== VarType.constant).map(k => inputs.tool_parameters[k])const hadVarSettings = Object.keys(inputs.tool_configurations)@@ -59,7 +59,7 @@ const useSingleRunFormParams = ({const inputVarValuesWithConstantValue = useCallback(() => {const res = produce(inputVarValues, (draft) => {Object.keys(inputs.tool_parameters).forEach((key: string) => {- const { type, value } = inputs.tool_parameters[key]+ const { type, value } = inputs.tool_parameters[key]!if (type === VarType.constant && (value === undefined || value === null)) {if (!draft.tool_parameters || !draft.tool_parameters[key])returndiff --git a/web/app/components/workflow/nodes/tool/output-schema-utils.ts b/web/app/components/workflow/nodes/tool/output-schema-utils.tsindex 630673e3e98..5120aee67ba 100644--- a/web/app/components/workflow/nodes/tool/output-schema-utils.ts+++ b/web/app/components/workflow/nodes/tool/output-schema-utils.ts@@ -13,7 +13,7 @@ const resolveDifyCompactTypeString = (typeStr: string): VarType | undefined => {const m = /^array\[(string|number|integer|boolean|object|file|any)\]$/i.exec(trimmed)if (!m)return undefined- const inner = m[1].toLowerCase()+ const inner = m[1]!.toLowerCase()const map: Record<string, VarType> = {string: VarType.arrayString,number: VarType.arrayNumber,diff --git a/web/app/components/workflow/nodes/trigger-schedule/default.ts b/web/app/components/workflow/nodes/trigger-schedule/default.tsindex 587a125c2da..ba6cd1c686f 100644--- a/web/app/components/workflow/nodes/trigger-schedule/default.ts+++ b/web/app/components/workflow/nodes/trigger-schedule/default.ts@@ -12,13 +12,13 @@ const isValidTimeFormat = (time: string): boolean => {return falseconst [timePart, period] = time.split(' ')- const [hour, minute] = timePart.split(':')- const hourNum = Number.parseInt(hour, 10)- const minuteNum = Number.parseInt(minute, 10)+ const [hour, minute] = timePart!.split(':')+ const hourNum = Number.parseInt(hour!, 10)+ const minuteNum = Number.parseInt(minute!, 10)return hourNum >= 1 && hourNum <= 12&& minuteNum >= 0 && minuteNum <= 59- && ['AM', 'PM'].includes(period)+ && ['AM', 'PM'].includes(period!)}const validateHourlyConfig = (config: any, t: any): string => {diff --git a/web/app/components/workflow/nodes/trigger-schedule/utils/__tests__/integration.spec.ts b/web/app/components/workflow/nodes/trigger-schedule/utils/__tests__/integration.spec.tsindex 9eacc9128d3..b4f79b9b97b 100644--- a/web/app/components/workflow/nodes/trigger-schedule/utils/__tests__/integration.spec.ts+++ b/web/app/components/workflow/nodes/trigger-schedule/utils/__tests__/integration.spec.ts@@ -49,9 +49,9 @@ describe('cron-parser + execution-time-calculator integration', () => {// Results should be identicaldirectResult.forEach((directDate, index) => {const calcDate = calculatorResult[index]- expect(calcDate.getTime()).toBe(directDate.getTime())- expect(calcDate.getHours()).toBe(directDate.getHours())- expect(calcDate.getMinutes()).toBe(directDate.getMinutes())+ expect(calcDate!.getTime()).toBe(directDate.getTime())+ expect(calcDate!.getHours()).toBe(directDate.getHours())+ expect(calcDate!.getMinutes()).toBe(directDate.getMinutes())})})})@@ -77,7 +77,7 @@ describe('cron-parser + execution-time-calculator integration', () => {// Cross-validation: results should be identicaldirectResult.forEach((directDate, index) => {- expect(calculatorResult[index].getTime()).toBe(directDate.getTime())+ expect(calculatorResult[index]!.getTime()).toBe(directDate.getTime())})})})@@ -205,8 +205,8 @@ describe('cron-parser + execution-time-calculator integration', () => {expect(calculatorResult.length).toBeGreaterThan(0)// Results should be consistent- expect(calculatorResult[0].getHours()).toBe(directResult[0].getHours())- expect(calculatorResult[0].getMinutes()).toBe(directResult[0].getMinutes())+ expect(calculatorResult[0]!.getHours()).toBe(directResult[0]!.getHours())+ expect(calculatorResult[0]!.getMinutes()).toBe(directResult[0]!.getMinutes())})})})@@ -233,7 +233,7 @@ describe('cron-parser + execution-time-calculator integration', () => {// Results should be identicaldirectResult.forEach((directDate, index) => {- expect(calculatorResult[index].getTime()).toBe(directDate.getTime())+ expect(calculatorResult[index]!.getTime()).toBe(directDate.getTime())})})@@ -264,7 +264,7 @@ describe('cron-parser + execution-time-calculator integration', () => {})// Cross-validate consistency- expect(calculatorResult[0].getTime()).toBe(directResult[0].getTime())+ expect(calculatorResult[0]!.getTime()).toBe(directResult[0]!.getTime())})})})@@ -293,7 +293,7 @@ describe('cron-parser + execution-time-calculator integration', () => {// Results should be consistentdirectResult.forEach((directDate, index) => {- expect(calculatorResult[index].getTime()).toBe(directDate.getTime())+ expect(calculatorResult[index]!.getTime()).toBe(directDate.getTime())})})})@@ -320,7 +320,7 @@ describe('cron-parser + execution-time-calculator integration', () => {// Validate consistency where results existconst minLength = Math.min(directResult.length, calculatorResult.length)for (let i = 0; i < minLength; i++)- expect(calculatorResult[i].getTime()).toBe(directResult[i].getTime())+ expect(calculatorResult[i]!.getTime()).toBe(directResult[i]!.getTime())}})})diff --git a/web/app/components/workflow/nodes/trigger-schedule/utils/cron-parser.ts b/web/app/components/workflow/nodes/trigger-schedule/utils/cron-parser.tsindex 90f65db0aa4..3832f449889 100644--- a/web/app/components/workflow/nodes/trigger-schedule/utils/cron-parser.ts+++ b/web/app/components/workflow/nodes/trigger-schedule/utils/cron-parser.ts@@ -9,12 +9,12 @@ const convertToUserTimezoneRepresentation = (utcDate: Date, timezone: string): Dhour12: false,})const [dateStr, timeStr] = userTimeStr.split(', ')- const [year, month, day] = dateStr.split('-').map(Number)- const [hour, minute, second] = timeStr.split(':').map(Number)+ const [year, month, day] = dateStr!.split('-').map(Number)+ const [hour, minute, second] = timeStr!.split(':').map(Number)// Create a new Date object representing this time as "local" time// This matches the behavior expected by the execution-time-calculator- return new Date(year, month - 1, day, hour, minute, second)+ return new Date(year!, month! - 1, day, hour, minute, second)}/**diff --git a/web/app/components/workflow/nodes/trigger-schedule/utils/execution-time-calculator.ts b/web/app/components/workflow/nodes/trigger-schedule/utils/execution-time-calculator.tsindex c7aaa13f496..72fabae0fcc 100644--- a/web/app/components/workflow/nodes/trigger-schedule/utils/execution-time-calculator.ts+++ b/web/app/components/workflow/nodes/trigger-schedule/utils/execution-time-calculator.ts@@ -25,9 +25,9 @@ const getUserTimezoneCurrentTime = (timezone?: string): Date => {hour12: false,})const [dateStr, timeStr] = userTimeStr.split(', ')- const [year, month, day] = dateStr.split('-').map(Number)- const [hour, minute, second] = timeStr.split(':').map(Number)- return new Date(year, month - 1, day, hour, minute, second)+ const [year, month, day] = dateStr!.split('-').map(Number)+ const [hour, minute, second] = timeStr!.split(':').map(Number)+ return new Date(year!, month! - 1, day, hour, minute, second)}// Format date that is already in user timezone, no timezone conversion@@ -74,7 +74,7 @@ export const getNextExecutionTimes = (data: ScheduleTriggerNodeType, count: numbconst now = new Date()const userTodayStr = now.toLocaleDateString('en-CA', { timeZone: timezone })const [year, month, day] = userTodayStr.split('-').map(Number)- const userToday = new Date(year, month - 1, day, 0, 0, 0, 0)+ const userToday = new Date(year!, month! - 1, day, 0, 0, 0, 0)if (data.frequency === 'hourly') {const onMinute = data.visual_config?.on_minute ?? 0@@ -99,8 +99,8 @@ export const getNextExecutionTimes = (data: ScheduleTriggerNodeType, count: numb}else if (data.frequency === 'daily') {const [time, period] = defaultTime.split(' ')- const [hour, minute] = time.split(':')- let displayHour = Number.parseInt(hour)+ const [hour, minute] = time!.split(':')+ let displayHour = Number.parseInt(hour!)if (period === 'PM' && displayHour !== 12)displayHour += 12if (period === 'AM' && displayHour === 12)@@ -108,7 +108,7 @@ export const getNextExecutionTimes = (data: ScheduleTriggerNodeType, count: numb// Check if today's configured time has already passedconst todayExecution = new Date(userToday)- todayExecution.setHours(displayHour, Number.parseInt(minute), 0, 0)+ todayExecution.setHours(displayHour, Number.parseInt(minute!), 0, 0)const userCurrentTime = getUserTimezoneCurrentTime(timezone)@@ -117,7 +117,7 @@ export const getNextExecutionTimes = (data: ScheduleTriggerNodeType, count: numbfor (let i = 0; i < count; i++) {const execution = new Date(userToday)execution.setDate(userToday.getDate() + startOffset + i)- execution.setHours(displayHour, Number.parseInt(minute), 0, 0)+ execution.setHours(displayHour, Number.parseInt(minute!), 0, 0)times.push(execution)}}@@ -126,8 +126,8 @@ export const getNextExecutionTimes = (data: ScheduleTriggerNodeType, count: numbconst dayMap = { sun: 0, mon: 1, tue: 2, wed: 3, thu: 4, fri: 5, sat: 6 }const [time, period] = defaultTime.split(' ')- const [hour, minute] = time.split(':')- let displayHour = Number.parseInt(hour)+ const [hour, minute] = time!.split(':')+ let displayHour = Number.parseInt(hour!)if (period === 'PM' && displayHour !== 12)displayHour += 12if (period === 'AM' && displayHour === 12)@@ -157,7 +157,7 @@ export const getNextExecutionTimes = (data: ScheduleTriggerNodeType, count: numb// Check if today's configured time has already passedconst todayAtTargetTime = new Date(userToday)- todayAtTargetTime.setHours(displayHour, Number.parseInt(minute), 0, 0)+ todayAtTargetTime.setHours(displayHour, Number.parseInt(minute!), 0, 0)let adjustedDays = daysUntilTargetif (daysUntilTarget === 0 && todayAtTargetTime <= userCurrentTime)@@ -165,7 +165,7 @@ export const getNextExecutionTimes = (data: ScheduleTriggerNodeType, count: numbconst execution = new Date(userToday)execution.setDate(userToday.getDate() + adjustedDays + (weekOffset * 7))- execution.setHours(displayHour, Number.parseInt(minute), 0, 0)+ execution.setHours(displayHour, Number.parseInt(minute!), 0, 0)// Only add if execution time is in the futureif (execution > userCurrentTime) {@@ -191,8 +191,8 @@ export const getNextExecutionTimes = (data: ScheduleTriggerNodeType, count: numbconst selectedDays = [...new Set(getSelectedDays())]const [time, period] = defaultTime.split(' ')- const [hour, minute] = time.split(':')- let displayHour = Number.parseInt(hour)+ const [hour, minute] = time!.split(':')+ let displayHour = Number.parseInt(hour!)if (period === 'PM' && displayHour !== 12)displayHour += 12if (period === 'AM' && displayHour === 12)@@ -230,7 +230,7 @@ export const getNextExecutionTimes = (data: ScheduleTriggerNodeType, count: numbprocessedDays.add(targetDay)- const execution = new Date(targetMonth.getFullYear(), targetMonth.getMonth(), targetDay, displayHour, Number.parseInt(minute), 0, 0)+ const execution = new Date(targetMonth.getFullYear(), targetMonth.getMonth(), targetDay, displayHour, Number.parseInt(minute!), 0, 0)// Only add if execution time is in the futureif (execution > userCurrentTime)@@ -295,5 +295,5 @@ export const getNextExecutionTime = (data: ScheduleTriggerNodeType): string => {// Format the first execution time without timezone for node displayconst includeWeekday = data.mode === 'visual' && data.frequency === 'weekly'- return formatExecutionTime(times[0], timezone, includeWeekday, false) // Node doesn't show timezone+ return formatExecutionTime(times[0]!, timezone, includeWeekday, false) // Node doesn't show timezone}diff --git a/web/app/components/workflow/nodes/trigger-webhook/components/__tests__/generic-table.spec.tsx b/web/app/components/workflow/nodes/trigger-webhook/components/__tests__/generic-table.spec.tsxindex 6cb2eb13bbf..f191fbb6877 100644--- a/web/app/components/workflow/nodes/trigger-webhook/components/__tests__/generic-table.spec.tsx+++ b/web/app/components/workflow/nodes/trigger-webhook/components/__tests__/generic-table.spec.tsx@@ -100,8 +100,8 @@ describe('GenericTable', () => {expect(inputs).toHaveLength(3)expect(screen.getAllByRole('button', { name: 'Delete row' })).toHaveLength(2)- const blurSpy = vi.spyOn(inputs[0], 'blur')- fireEvent.keyDown(inputs[0], { key: 'Enter' })+ const blurSpy = vi.spyOn(inputs[0]!, 'blur')+ fireEvent.keyDown(inputs[0]!, { key: 'Enter' })expect(blurSpy).toHaveBeenCalledTimes(1)})@@ -120,9 +120,9 @@ describe('GenericTable', () => {/>,)- expect(screen.getByText('Name')).toBeInTheDocument()+ expect(screen.getByText('Name'))!.toBeInTheDocument()- await user.click(screen.getAllByRole('checkbox')[0])+ await user.click(screen.getAllByRole('checkbox')[0]!)expect(onChange).toHaveBeenCalledWith([{ name: 'alpha', enabled: true }])await user.click(screen.getByRole('button', { name: 'Delete row' }))@@ -158,11 +158,11 @@ describe('GenericTable', () => {await waitFor(() => {expect(onChange).toHaveBeenCalledWith([{ method: 'post', preview: '' }])- expect(screen.getByRole('button', { name: 'POST' })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'POST' }))!.toBeInTheDocument()})onChange.mockClear()- await user.click(screen.getAllByRole('button', { name: 'custom-render' })[0])+ await user.click(screen.getAllByRole('button', { name: 'custom-render' })[0]!)await waitFor(() => {expect(onChange).toHaveBeenCalledWith([{ method: 'post', preview: '0:post' }])@@ -202,7 +202,7 @@ describe('GenericTable', () => {/>,)- expect(screen.getByText('No data')).toBeInTheDocument()+ expect(screen.getByText('No data'))!.toBeInTheDocument()expect(screen.queryByRole('textbox')).not.toBeInTheDocument()})})diff --git a/web/app/components/workflow/nodes/trigger-webhook/components/__tests__/header-table.spec.tsx b/web/app/components/workflow/nodes/trigger-webhook/components/__tests__/header-table.spec.tsxindex 97e3da98d8d..22e89b3cf1e 100644--- a/web/app/components/workflow/nodes/trigger-webhook/components/__tests__/header-table.spec.tsx+++ b/web/app/components/workflow/nodes/trigger-webhook/components/__tests__/header-table.spec.tsx@@ -19,14 +19,14 @@ describe('trigger-webhook/header-table', () => {/>,)- fireEvent.change(screen.getAllByRole('textbox')[0], { target: { value: 'Auth Token' } })+ fireEvent.change(screen.getAllByRole('textbox')[0]!, { target: { value: 'Auth Token' } })expect(onChange).toHaveBeenLastCalledWith([{name: 'Auth_Token',required: false,}])onChange.mockClear()- await user.click(screen.getAllByRole('checkbox')[0])+ await user.click(screen.getAllByRole('checkbox')[0]!)expect(onChange).toHaveBeenCalledWith([{name: 'x-request-id',@@ -43,7 +43,7 @@ describe('trigger-webhook/header-table', () => {/>,)- expect(screen.getByDisplayValue('authorization')).toBeDisabled()+ expect(screen.getByDisplayValue('authorization'))!.toBeDisabled()expect(screen.getAllByRole('checkbox')).toHaveLength(1)})})diff --git a/web/app/components/workflow/nodes/trigger-webhook/components/__tests__/parameter-table.spec.tsx b/web/app/components/workflow/nodes/trigger-webhook/components/__tests__/parameter-table.spec.tsxindex 47da11f650b..9e0053b761d 100644--- a/web/app/components/workflow/nodes/trigger-webhook/components/__tests__/parameter-table.spec.tsx+++ b/web/app/components/workflow/nodes/trigger-webhook/components/__tests__/parameter-table.spec.tsx@@ -56,7 +56,7 @@ describe('trigger-webhook/parameter-table', () => {})onChange.mockClear()- await user.click(screen.getAllByRole('checkbox')[0])+ await user.click(screen.getAllByRole('checkbox')[0]!)expect(onChange).toHaveBeenCalledWith([{name: 'page',@@ -82,7 +82,7 @@ describe('trigger-webhook/parameter-table', () => {/>,)- await user.click(screen.getAllByRole('checkbox')[0])+ await user.click(screen.getAllByRole('checkbox')[0]!)expect(onChange).toHaveBeenCalledWith([{name: 'message',diff --git a/web/app/components/workflow/nodes/trigger-webhook/components/parameter-table.tsx b/web/app/components/workflow/nodes/trigger-webhook/components/parameter-table.tsxindex baf5f26d737..11e9265a4b8 100644--- a/web/app/components/workflow/nodes/trigger-webhook/components/parameter-table.tsx+++ b/web/app/components/workflow/nodes/trigger-webhook/components/parameter-table.tsx@@ -58,7 +58,7 @@ const ParameterTable: FC<ParameterTableProps> = ({]// Choose sensible default type for new rows according to content type- const defaultTypeValue: VarType = typeOptions[0]?.value || 'string'+ const defaultTypeValue: VarType = typeOptions[0]?.value! || 'string'// Empty row template for new rowsconst emptyRowData: GenericTableRow = {diff --git a/web/app/components/workflow/nodes/variable-assigner/__tests__/use-single-run-form-params.spec.ts b/web/app/components/workflow/nodes/variable-assigner/__tests__/use-single-run-form-params.spec.tsindex daa710a956b..acb5c8204f7 100644--- a/web/app/components/workflow/nodes/variable-assigner/__tests__/use-single-run-form-params.spec.ts+++ b/web/app/components/workflow/nodes/variable-assigner/__tests__/use-single-run-form-params.spec.ts@@ -70,7 +70,7 @@ describe('variable-assigner/use-single-run-form-params', () => {['source-node', 'uniqueVar'],['source-node', 'sharedVar'],])- expect(result.current.forms[0].inputs).toEqual([+ expect(result.current.forms[0]!.inputs).toEqual([{label: 'Shared',variable: 'sharedVar',@@ -85,7 +85,7 @@ describe('variable-assigner/use-single-run-form-params', () => {},])- result.current.forms[0].onChange({ sharedVar: 'updated' })+ result.current.forms[0]!.onChange({ sharedVar: 'updated' })expect(setRunInputData).toHaveBeenCalledWith({ sharedVar: 'updated' })expect(result.current.getDependentVars()).toEqual([diff --git a/web/app/components/workflow/nodes/variable-assigner/components/__tests__/node-group-item.spec.tsx b/web/app/components/workflow/nodes/variable-assigner/components/__tests__/node-group-item.spec.tsxindex 7fd29a5b38c..4f400db572c 100644--- a/web/app/components/workflow/nodes/variable-assigner/components/__tests__/node-group-item.spec.tsx+++ b/web/app/components/workflow/nodes/variable-assigner/components/__tests__/node-group-item.spec.tsx@@ -94,8 +94,8 @@ describe('variable-assigner/node-group-item', () => {},)- expect(screen.getByText('workflow.nodes.variableAssigner.varNotSet')).toBeInTheDocument()- expect(container.querySelector('.relative.rounded-lg')).toHaveClass('border-text-accent!')+ expect(screen.getByText('workflow.nodes.variableAssigner.varNotSet'))!.toBeInTheDocument()+ expect(container.querySelector('.relative.rounded-lg'))!.toHaveClass('border-text-accent!')expect(mockGetAvailableVars).toHaveBeenCalledWith('assigner-node','group-1',@@ -103,7 +103,7 @@ describe('variable-assigner/node-group-item', () => {true,)- const filter = mockGetAvailableVars.mock.calls[0][2] as (payload: { type: VarType }) => boolean+ const filter = mockGetAvailableVars.mock.calls[0]![2] as (payload: { type: VarType }) => booleanexpect(filter({ type: VarType.string })).toBe(true)expect(filter({ type: VarType.number })).toBe(false)@@ -142,13 +142,13 @@ describe('variable-assigner/node-group-item', () => {},)- expect(container.querySelector('.relative.rounded-lg')).toHaveClass('border-dashed!')- expect(screen.getByText('Start')).toBeInTheDocument()- expect(screen.getByText('query')).toBeInTheDocument()- expect(screen.getByText('Source Node')).toBeInTheDocument()- expect(screen.getByText('answer')).toBeInTheDocument()+ expect(container.querySelector('.relative.rounded-lg'))!.toHaveClass('border-dashed!')+ expect(screen.getByText('Start'))!.toBeInTheDocument()+ expect(screen.getByText('query'))!.toBeInTheDocument()+ expect(screen.getByText('Source Node'))!.toBeInTheDocument()+ expect(screen.getByText('answer'))!.toBeInTheDocument()- const filter = mockGetAvailableVars.mock.calls[0][2] as (payload: { type: VarType }) => boolean+ const filter = mockGetAvailableVars.mock.calls[0]![2] as (payload: { type: VarType }) => booleanexpect(filter({ type: VarType.number })).toBe(true)expect(filter({ type: VarType.string })).toBe(false)})@@ -178,7 +178,7 @@ describe('variable-assigner/node-group-item', () => {expect(container.querySelector('.relative.rounded-lg')).not.toHaveClass('border-dashed!')expect(container.querySelector('.relative.rounded-lg')).not.toHaveClass('border-text-accent!')- const filter = mockGetAvailableVars.mock.calls[0][2] as (payload: { type: VarType }) => boolean+ const filter = mockGetAvailableVars.mock.calls[0]![2] as (payload: { type: VarType }) => booleanexpect(filter({ type: VarType.boolean })).toBe(true)expect(filter({ type: VarType.string })).toBe(false)})diff --git a/web/app/components/workflow/nodes/variable-assigner/components/node-group-item.tsx b/web/app/components/workflow/nodes/variable-assigner/components/node-group-item.tsxindex 32a6af9eef5..24621701d10 100644--- a/web/app/components/workflow/nodes/variable-assigner/components/node-group-item.tsx+++ b/web/app/components/workflow/nodes/variable-assigner/components/node-group-item.tsx@@ -64,7 +64,7 @@ const NodeGroupItem = ({if (hoveringAssignVariableGroupId)return hoveringAssignVariableGroupId !== item.targetHandleIdelse- return enteringNodePayload?.nodeData.advanced_settings?.groups[0].groupId !== item.targetHandleId+ return enteringNodePayload?.nodeData.advanced_settings?.groups[0]!.groupId !== item.targetHandleId}return false@@ -74,7 +74,7 @@ const NodeGroupItem = ({if (hoveringAssignVariableGroupId)return hoveringAssignVariableGroupId === item.targetHandleIdelse- return enteringNodePayload?.nodeData.advanced_settings?.groups[0].groupId === item.targetHandleId+ return enteringNodePayload?.nodeData.advanced_settings?.groups[0]!.groupId === item.targetHandleId}return falsediff --git a/web/app/components/workflow/nodes/variable-assigner/use-config.helpers.ts b/web/app/components/workflow/nodes/variable-assigner/use-config.helpers.tsindex 2cc91c65aca..809ba21808b 100644--- a/web/app/components/workflow/nodes/variable-assigner/use-config.helpers.ts+++ b/web/app/components/workflow/nodes/variable-assigner/use-config.helpers.ts@@ -34,7 +34,7 @@ export const updateNestedVarGroupItem = (returndraft.advanced_settings.groups[index] = {- ...draft.advanced_settings.groups[index],+ ...draft.advanced_settings.groups[index]!,...payload,}})@@ -72,8 +72,8 @@ export const toggleGroupEnabled = ({}}else if (draft.advanced_settings.groups.length > 0) {- draft.output_type = draft.advanced_settings.groups[0].output_type- draft.variables = draft.advanced_settings.groups[0].variables+ draft.output_type = draft.advanced_settings.groups[0]!.output_type+ draft.variables = draft.advanced_settings.groups[0]!.variables}draft.advanced_settings.group_enabled = enabled@@ -85,7 +85,7 @@ export const addGroup = (inputs: VariableAssignerNodeType) => {groups.forEach((item) => {const match = /(\d+)$/.exec(item.group_name)if (match) {- const num = Number.parseInt(match[1], 10)+ const num = Number.parseInt(match[1]!, 10)if (num > maxInGroupName)maxInGroupName = num}@@ -116,5 +116,5 @@ export const renameGroup = (if (index < 0)return- draft.advanced_settings.groups[index].group_name = name+ draft.advanced_settings.groups[index]!.group_name = name})diff --git a/web/app/components/workflow/nodes/variable-assigner/use-config.ts b/web/app/components/workflow/nodes/variable-assigner/use-config.tsindex cecf185d4f4..08ccc3d42fb 100644--- a/web/app/components/workflow/nodes/variable-assigner/use-config.ts+++ b/web/app/components/workflow/nodes/variable-assigner/use-config.ts@@ -59,7 +59,7 @@ const useConfig = (id: string, payload: VariableAssignerNodeType) => {if (index < 0)return- const groupName = groups[index].group_name+ const groupName = groups[index]!.group_nameif (isVarUsedInNodes([id, groupName, 'output'])) {showRemoveVarConfirm()setRemovedVars([[id, groupName, 'output']])@@ -89,7 +89,7 @@ const useConfig = (id: string, payload: VariableAssignerNodeType) => {}}- handleOutVarRenameChange(id, [id, groups[0].group_name, 'output'], [id, 'output'])+ handleOutVarRenameChange(id, [id, groups[0]!.group_name, 'output'], [id, 'output'])}setInputs(toggleGroupEnabled({ inputs, enabled }))@@ -109,7 +109,7 @@ const useConfig = (id: string, payload: VariableAssignerNodeType) => {} = useDebounceFn((id: string, newName: string) => {const oldName = oldNameRef.current[id]- renameInspectVarName(id, oldName, newName)+ renameInspectVarName(id, oldName!, newName)delete oldNameRef.current[id]},{ wait: 500 },@@ -122,7 +122,7 @@ const useConfig = (id: string, payload: VariableAssignerNodeType) => {if (index < 0)return- const oldName = groups[index].group_name+ const oldName = groups[index]!.group_namehandleOutVarRenameChange(id, [id, oldName, 'output'], [id, name, 'output'])setInputs(renameGroup(inputs, groupId, name))if (!(id in oldNameRef.current))diff --git a/web/app/components/workflow/note-node/index.tsx b/web/app/components/workflow/note-node/index.tsxindex bfaadff387b..5050041a05e 100644--- a/web/app/components/workflow/note-node/index.tsx+++ b/web/app/components/workflow/note-node/index.tsx@@ -60,8 +60,8 @@ const NoteNode = ({<divclassName={cn('relative flex flex-col rounded-md border shadow-xs hover:shadow-md',- THEME_MAP[theme].bg,- data.selected ? THEME_MAP[theme].border : 'border-black/5',+ THEME_MAP[theme]!.bg,+ data.selected ? THEME_MAP[theme]!.border : 'border-black/5',)}style={{width: data.width,@@ -89,7 +89,7 @@ const NoteNode = ({<divclassName={cn('h-2 shrink-0 rounded-t-md opacity-50',- THEME_MAP[theme].title,+ THEME_MAP[theme]!.title,)}></div>diff --git a/web/app/components/workflow/note-node/note-editor/toolbar/color-picker.tsx b/web/app/components/workflow/note-node/note-editor/toolbar/color-picker.tsxindex da5b1d3b9a1..e8c50559621 100644--- a/web/app/components/workflow/note-node/note-editor/toolbar/color-picker.tsx+++ b/web/app/components/workflow/note-node/note-editor/toolbar/color-picker.tsx@@ -14,33 +14,33 @@ import { NoteTheme } from '../../types'export const COLOR_LIST = [{key: NoteTheme.blue,- inner: THEME_MAP[NoteTheme.blue].title,- outer: THEME_MAP[NoteTheme.blue].outer,+ inner: THEME_MAP[NoteTheme.blue]!.title,+ outer: THEME_MAP[NoteTheme.blue]!.outer,},{key: NoteTheme.cyan,- inner: THEME_MAP[NoteTheme.cyan].title,- outer: THEME_MAP[NoteTheme.cyan].outer,+ inner: THEME_MAP[NoteTheme.cyan]!.title,+ outer: THEME_MAP[NoteTheme.cyan]!.outer,},{key: NoteTheme.green,- inner: THEME_MAP[NoteTheme.green].title,- outer: THEME_MAP[NoteTheme.green].outer,+ inner: THEME_MAP[NoteTheme.green]!.title,+ outer: THEME_MAP[NoteTheme.green]!.outer,},{key: NoteTheme.yellow,- inner: THEME_MAP[NoteTheme.yellow].title,- outer: THEME_MAP[NoteTheme.yellow].outer,+ inner: THEME_MAP[NoteTheme.yellow]!.title,+ outer: THEME_MAP[NoteTheme.yellow]!.outer,},{key: NoteTheme.pink,- inner: THEME_MAP[NoteTheme.pink].title,- outer: THEME_MAP[NoteTheme.pink].outer,+ inner: THEME_MAP[NoteTheme.pink]!.title,+ outer: THEME_MAP[NoteTheme.pink]!.outer,},{key: NoteTheme.violet,- inner: THEME_MAP[NoteTheme.violet].title,- outer: THEME_MAP[NoteTheme.violet].outer,+ inner: THEME_MAP[NoteTheme.violet]!.title,+ outer: THEME_MAP[NoteTheme.violet]!.outer,},]@@ -70,7 +70,7 @@ const ColorPicker = ({<divclassName={cn('h-4 w-4 rounded-full border border-black/5',- THEME_MAP[theme].title,+ THEME_MAP[theme]!.title,)}></div>diff --git a/web/app/components/workflow/operator/index.tsx b/web/app/components/workflow/operator/index.tsxindex e41d506022f..d13758c87d0 100644--- a/web/app/components/workflow/operator/index.tsx+++ b/web/app/components/workflow/operator/index.tsx@@ -57,7 +57,7 @@ const Operator = ({ handleUndo, handleRedo }: OperatorProps) => {if (bottomPanelRef.current) {const resizeContainerObserver = new ResizeObserver((entries) => {for (const entry of entries) {- const { inlineSize, blockSize } = entry.borderBoxSize[0]+ const { inlineSize, blockSize } = entry.borderBoxSize[0]!setBottomPanelWidth(inlineSize)setBottomPanelHeight(blockSize)}diff --git a/web/app/components/workflow/panel/__tests__/human-input-filled-form-list.spec.tsx b/web/app/components/workflow/panel/__tests__/human-input-filled-form-list.spec.tsxindex 19edbecf5fe..e3d0557180f 100644--- a/web/app/components/workflow/panel/__tests__/human-input-filled-form-list.spec.tsx+++ b/web/app/components/workflow/panel/__tests__/human-input-filled-form-list.spec.tsx@@ -31,12 +31,12 @@ describe('HumanInputFilledFormList', () => {/>,)- expect(screen.getByText('Approval')).toBeInTheDocument()- expect(screen.getByText('Review')).toBeInTheDocument()+ expect(screen.getByText('Approval'))!.toBeInTheDocument()+ expect(screen.getByText('Review'))!.toBeInTheDocument()expect(screen.getAllByTestId('submitted-content')).toHaveLength(2)expect(screen.getAllByTestId('executed-action')).toHaveLength(2)- await user.click(screen.getAllByTestId('expand-icon')[0])+ await user.click(screen.getAllByTestId('expand-icon')[0]!)expect(screen.getAllByTestId('submitted-content')).toHaveLength(1)})diff --git a/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/handle-resume.spec.ts b/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/handle-resume.spec.tsindex 328de5a0af5..04c19f50e92 100644--- a/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/handle-resume.spec.ts+++ b/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/handle-resume.spec.ts@@ -502,8 +502,8 @@ describe('useChat – handleResume', () => {let answer = result.current.chatList.find(item => item.id === 'msg-resume')expect(answer!.workflowProcess!.tracing).toHaveLength(1)- expect(answer!.workflowProcess!.tracing[0].id).toBe('iter-r1')- expect(answer!.workflowProcess!.tracing[0].status).toBe('running')+ expect(answer!.workflowProcess!.tracing[0]!.id).toBe('iter-r1')+ expect(answer!.workflowProcess!.tracing[0]!.status).toBe('running')act(() => {capturedResumeOptions.onIterationFinish({@@ -513,7 +513,7 @@ describe('useChat – handleResume', () => {answer = result.current.chatList.find(item => item.id === 'msg-resume')expect(answer!.workflowProcess!.tracing).toHaveLength(1)- expect(answer!.workflowProcess!.tracing[0].status).toBe('succeeded')+ expect(answer!.workflowProcess!.tracing[0]!.status).toBe('succeeded')})it('should handle iteration finish when no match found', async () => {@@ -539,8 +539,8 @@ describe('useChat – handleResume', () => {let answer = result.current.chatList.find(item => item.id === 'msg-resume')expect(answer!.workflowProcess!.tracing).toHaveLength(1)- expect(answer!.workflowProcess!.tracing[0].id).toBe('loop-r1')- expect(answer!.workflowProcess!.tracing[0].status).toBe('running')+ expect(answer!.workflowProcess!.tracing[0]!.id).toBe('loop-r1')+ expect(answer!.workflowProcess!.tracing[0]!.status).toBe('running')act(() => {capturedResumeOptions.onLoopFinish({@@ -550,7 +550,7 @@ describe('useChat – handleResume', () => {answer = result.current.chatList.find(item => item.id === 'msg-resume')expect(answer!.workflowProcess!.tracing).toHaveLength(1)- expect(answer!.workflowProcess!.tracing[0].status).toBe('succeeded')+ expect(answer!.workflowProcess!.tracing[0]!.status).toBe('succeeded')})it('should handle loop finish when no match found', async () => {@@ -661,8 +661,8 @@ describe('useChat – handleResume', () => {const answer = result.current.chatList.find(item => item.id === 'msg-resume')const matchingTraces = answer!.workflowProcess!.tracing.filter((t: any) => t.node_id === 'rn-1')expect(matchingTraces).toHaveLength(1)- expect(matchingTraces[0].id).toBe('rtrace-1-v2')- expect(matchingTraces[0].status).toBe('running')+ expect(matchingTraces[0]!.id).toBe('rtrace-1-v2')+ expect(matchingTraces[0]!.status).toBe('running')})it('should match nodeFinished with parallel_id', async () => {@@ -956,9 +956,9 @@ describe('useChat – handleResume with bare prevChatTree (no humanInputFormDataconst answer = result.current.chatList.find(item => item.id === 'bare-msg-nt')expect(answer!.workflowProcess!.tracing).toHaveLength(1)- expect(answer!.workflowProcess!.tracing[0].id).toBe('loop-bare')- expect(answer!.workflowProcess!.tracing[0].node_id).toBe('n-loop-bare')- expect(answer!.workflowProcess!.tracing[0].status).toBe('running')+ expect(answer!.workflowProcess!.tracing[0]!.id).toBe('loop-bare')+ expect(answer!.workflowProcess!.tracing[0]!.node_id).toBe('n-loop-bare')+ expect(answer!.workflowProcess!.tracing[0]!.status).toBe('running')})it('onLoopFinish should return early when no tracing', () => {@@ -982,9 +982,9 @@ describe('useChat – handleResume with bare prevChatTree (no humanInputFormDataconst answer = result.current.chatList.find(item => item.id === 'bare-msg-nt')expect(answer!.workflowProcess!.tracing).toHaveLength(1)- expect(answer!.workflowProcess!.tracing[0].id).toBe('iter-bare')- expect(answer!.workflowProcess!.tracing[0].node_id).toBe('n-iter-bare')- expect(answer!.workflowProcess!.tracing[0].status).toBe('running')+ expect(answer!.workflowProcess!.tracing[0]!.id).toBe('iter-bare')+ expect(answer!.workflowProcess!.tracing[0]!.node_id).toBe('n-iter-bare')+ expect(answer!.workflowProcess!.tracing[0]!.status).toBe('running')})it('onIterationFinish should return early when no tracing', () => {@@ -1008,9 +1008,9 @@ describe('useChat – handleResume with bare prevChatTree (no humanInputFormDataconst answer = result.current.chatList.find(item => item.id === 'bare-msg-nt')expect(answer!.workflowProcess!.tracing).toHaveLength(1)- expect(answer!.workflowProcess!.tracing[0].id).toBe('rtrace-bare')- expect(answer!.workflowProcess!.tracing[0].node_id).toBe('rn-bare')- expect(answer!.workflowProcess!.tracing[0].status).toBe('running')+ expect(answer!.workflowProcess!.tracing[0]!.id).toBe('rtrace-bare')+ expect(answer!.workflowProcess!.tracing[0]!.node_id).toBe('rn-bare')+ expect(answer!.workflowProcess!.tracing[0]!.status).toBe('running')})it('onNodeFinished should return early when no tracing', () => {diff --git a/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/handle-send.spec.ts b/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/handle-send.spec.tsindex 1acd5636226..0f6ae5d713c 100644--- a/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/handle-send.spec.ts+++ b/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/handle-send.spec.ts@@ -83,7 +83,7 @@ describe('useChat – handleSend', () => {})expect(mockHandleRun).toHaveBeenCalledTimes(1)- const [bodyParams] = mockHandleRun.mock.calls[0]+ const [bodyParams] = (mockHandleRun.mock.calls[0] ?? []) as [any]expect(bodyParams.query).toBe('hello')})@@ -166,7 +166,7 @@ describe('useChat – handleSend', () => {})expect(mockHandleRun).toHaveBeenCalledTimes(1)- const [bodyParams] = mockHandleRun.mock.calls[0]+ const [bodyParams] = (mockHandleRun.mock.calls[0] ?? []) as [any]const localFile = bodyParams.files.find((f: any) => f.transfer_method === 'local_file')const remoteFile = bodyParams.files.find((f: any) => f.transfer_method === 'remote_url')expect(localFile.url).toBe('')diff --git a/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/opening-statement.spec.ts b/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/opening-statement.spec.tsindex 9fdfc3bbd47..57db5502b54 100644--- a/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/opening-statement.spec.ts+++ b/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/opening-statement.spec.ts@@ -88,7 +88,7 @@ describe('workflow debug useChat – opening statement stability', () => {it('should use stable id "opening-statement" instead of Date.now()', () => {const config = { opening_statement: 'Welcome!' }const { result } = renderHook(() => useChat(config))- expect(result.current.chatList[0].id).toBe('opening-statement')+ expect(result.current.chatList[0]!.id).toBe('opening-statement')})it('should preserve reference when inputs change but produce identical content', () => {@@ -104,7 +104,7 @@ describe('workflow debug useChat – opening statement stability', () => {)const openerBefore = result.current.chatList[0]- expect(openerBefore.content).toBe('Hello Alice')+ expect(openerBefore!.content).toBe('Hello Alice')rerender({ fs: { inputs: { name: 'Alice' }, inputsForm: [] } })@@ -124,12 +124,12 @@ describe('workflow debug useChat – opening statement stability', () => {)const openerBefore = result.current.chatList[0]- expect(openerBefore.content).toBe('Hello Alice')+ expect(openerBefore!.content).toBe('Hello Alice')rerender({ fs: { inputs: { name: 'Bob' }, inputsForm: [] } })const openerAfter = result.current.chatList[0]- expect(openerAfter.content).toBe('Hello Bob')+ expect(openerAfter!.content).toBe('Hello Bob')expect(openerAfter).not.toBe(openerBefore)})@@ -152,7 +152,7 @@ describe('workflow debug useChat – opening statement stability', () => {)const openerBefore = result.current.chatList[0]- expect(openerBefore.content).toBe('Updated welcome')+ expect(openerBefore!.content).toBe('Updated welcome')rerender({ cfg: config })@@ -167,13 +167,13 @@ describe('workflow debug useChat – opening statement stability', () => {}const { result } = renderHook(() => useChat(config))const opener = result.current.chatList[0]- expect(opener.suggestedQuestions).toEqual(['How are you?', 'What can you do?'])+ expect(opener!.suggestedQuestions).toEqual(['How are you?', 'What can you do?'])})it('should not include suggestedQuestions when config has none', () => {const config = { opening_statement: 'Welcome!' }const { result } = renderHook(() => useChat(config))const opener = result.current.chatList[0]- expect(opener.suggestedQuestions).toBeUndefined()+ expect(opener!.suggestedQuestions).toBeUndefined()})})diff --git a/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/sse-callbacks.spec.ts b/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/sse-callbacks.spec.tsindex 8ab2a275600..03857ce3d6a 100644--- a/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/sse-callbacks.spec.ts+++ b/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/sse-callbacks.spec.ts@@ -494,9 +494,9 @@ describe('useChat – handleSend SSE callbacks', () => {const answer = result.current.chatList.find(item => item.isAnswer && !item.isOpeningStatement)expect(answer!.workflowProcess!.tracing).toHaveLength(1)const trace = answer!.workflowProcess!.tracing[0]- expect(trace.id).toBe('iter-1')- expect(trace.node_id).toBe('n-iter')- expect(trace.status).toBe('running')+ expect(trace!.id).toBe('iter-1')+ expect(trace!.node_id).toBe('n-iter')+ expect(trace!.status).toBe('running')})it('should update matching tracing on finish', () => {@@ -558,9 +558,9 @@ describe('useChat – handleSend SSE callbacks', () => {const answer = result.current.chatList.find(item => item.isAnswer && !item.isOpeningStatement)expect(answer!.workflowProcess!.tracing).toHaveLength(1)const trace = answer!.workflowProcess!.tracing[0]- expect(trace.id).toBe('loop-1')- expect(trace.node_id).toBe('n-loop')- expect(trace.status).toBe('running')+ expect(trace!.id).toBe('loop-1')+ expect(trace!.node_id).toBe('n-loop')+ expect(trace!.status).toBe('running')})it('should update matching tracing on finish', () => {@@ -582,8 +582,8 @@ describe('useChat – handleSend SSE callbacks', () => {const answer = result.current.chatList.find(item => item.isAnswer && !item.isOpeningStatement)expect(answer!.workflowProcess!.tracing).toHaveLength(1)const trace = answer!.workflowProcess!.tracing[0]- expect(trace.id).toBe('loop-1')- expect(trace.node_id).toBe('n-loop')+ expect(trace!.id).toBe('loop-1')+ expect(trace!.node_id).toBe('n-loop')expect((trace as any).output).toBe('done')})@@ -618,9 +618,9 @@ describe('useChat – handleSend SSE callbacks', () => {const answer = result.current.chatList.find(item => item.isAnswer && !item.isOpeningStatement)expect(answer!.workflowProcess!.tracing).toHaveLength(1)const trace = answer!.workflowProcess!.tracing[0]- expect(trace.id).toBe('trace-1')- expect(trace.node_id).toBe('node-1')- expect(trace.status).toBe('running')+ expect(trace!.id).toBe('trace-1')+ expect(trace!.node_id).toBe('node-1')+ expect(trace!.status).toBe('running')})it('should update existing tracing entry with same node_id', () => {@@ -632,9 +632,9 @@ describe('useChat – handleSend SSE callbacks', () => {const answer = result.current.chatList.find(item => item.isAnswer && !item.isOpeningStatement)expect(answer!.workflowProcess!.tracing).toHaveLength(1)const trace = answer!.workflowProcess!.tracing[0]- expect(trace.id).toBe('trace-1-v2')- expect(trace.node_id).toBe('node-1')- expect(trace.status).toBe('running')+ expect(trace!.id).toBe('trace-1-v2')+ expect(trace!.node_id).toBe('node-1')+ expect(trace!.status).toBe('running')})it('should push retry data to tracing', () => {@@ -650,8 +650,8 @@ describe('useChat – handleSend SSE callbacks', () => {const answer = result.current.chatList.find(item => item.isAnswer && !item.isOpeningStatement)expect(answer!.workflowProcess!.tracing).toHaveLength(1)const trace = answer!.workflowProcess!.tracing[0]- expect(trace.id).toBe('retry-1')- expect(trace.node_id).toBe('node-1')+ expect(trace!.id).toBe('retry-1')+ expect(trace!.node_id).toBe('node-1')expect((trace as any).retry_index).toBe(1)})@@ -669,8 +669,8 @@ describe('useChat – handleSend SSE callbacks', () => {const answer = result.current.chatList.find(item => item.isAnswer && !item.isOpeningStatement)expect(answer!.workflowProcess!.tracing).toHaveLength(1)const trace = answer!.workflowProcess!.tracing[0]- expect(trace.id).toBe('trace-1')- expect(trace.status).toBe('succeeded')+ expect(trace!.id).toBe('trace-1')+ expect(trace!.status).toBe('succeeded')expect((trace as any).outputs).toEqual({ text: 'done' })})@@ -688,8 +688,8 @@ describe('useChat – handleSend SSE callbacks', () => {const answer = result.current.chatList.find(item => item.isAnswer && !item.isOpeningStatement)expect(answer!.workflowProcess!.tracing).toHaveLength(1)const trace = answer!.workflowProcess!.tracing[0]- expect(trace.id).toBe('trace-1')- expect(trace.status).toBe('running')+ expect(trace!.id).toBe('trace-1')+ expect(trace!.status).toBe('running')})})@@ -790,7 +790,7 @@ describe('useChat – handleSend SSE callbacks', () => {const answer = result.current.chatList.find(item => item.isAnswer && !item.isOpeningStatement)expect(answer!.humanInputFormDataList).toHaveLength(1)- expect(answer!.humanInputFormDataList![0].node_id).toBe('human-node')+ expect(answer!.humanInputFormDataList![0]!.node_id).toBe('human-node')expect((answer!.humanInputFormDataList![0] as any).form_token).toBe('token-1')})@@ -834,8 +834,8 @@ describe('useChat – handleSend SSE callbacks', () => {const answer = result.current.chatList.find(item => item.isAnswer && !item.isOpeningStatement)expect(answer!.humanInputFormDataList).toHaveLength(2)- expect(answer!.humanInputFormDataList![0].node_id).toBe('human-node-1')- expect(answer!.humanInputFormDataList![1].node_id).toBe('human-node-2')+ expect(answer!.humanInputFormDataList![0]!.node_id).toBe('human-node-1')+ expect(answer!.humanInputFormDataList![1]!.node_id).toBe('human-node-2')})it('should set tracing node status to Paused when tracing index found', () => {@@ -875,7 +875,7 @@ describe('useChat – handleSend SSE callbacks', () => {const answer = result.current.chatList.find(item => item.isAnswer && !item.isOpeningStatement)expect(answer!.humanInputFormDataList).toHaveLength(0)expect(answer!.humanInputFilledFormDataList).toHaveLength(1)- expect(answer!.humanInputFilledFormDataList![0].node_id).toBe('human-node')+ expect(answer!.humanInputFilledFormDataList![0]!.node_id).toBe('human-node')expect((answer!.humanInputFilledFormDataList![0] as any).form_data).toEqual({ answer: 'yes' })})})diff --git a/web/app/components/workflow/panel/debug-and-preview/conversation-variable-modal.tsx b/web/app/components/workflow/panel/debug-and-preview/conversation-variable-modal.tsxindex f6cfa21ab95..573d3e56421 100644--- a/web/app/components/workflow/panel/debug-and-preview/conversation-variable-modal.tsx+++ b/web/app/components/workflow/panel/debug-and-preview/conversation-variable-modal.tsx@@ -37,7 +37,7 @@ const ConversationVariableModal = ({const { formatTime } = useTimestamp()const varList = useStore(s => s.conversationVariables) as ConversationVariable[]const appID = useStore(s => s.appId)- const [currentVar, setCurrentVar] = React.useState<ConversationVariable>(varList[0])+ const [currentVar, setCurrentVar] = React.useState<ConversationVariable>(varList[0]!)const [latestValueMap, setLatestValueMap] = React.useState<Record<string, string>>({})const [latestValueTimestampMap, setLatestValueTimestampMap] = React.useState<Record<string, number>>({})@@ -118,7 +118,7 @@ const ConversationVariableModal = ({{!!latestValueTimestampMap[currentVar.id] && (<div className="shrink-0 system-xs-regular text-text-tertiary">{t('chatVariable.updatedAt', { ns: 'workflow' })}- {formatTime(latestValueTimestampMap[currentVar.id], t('dateTimeFormat', { ns: 'appLog' }) as string)}+ {formatTime(latestValueTimestampMap[currentVar.id]!, t('dateTimeFormat', { ns: 'appLog' }) as string)}</div>)}</div>diff --git a/web/app/components/workflow/panel/debug-and-preview/hooks.ts b/web/app/components/workflow/panel/debug-and-preview/hooks.tsindex 2529d505be4..6eef69bfdb1 100644--- a/web/app/components/workflow/panel/debug-and-preview/hooks.ts+++ b/web/app/components/workflow/panel/debug-and-preview/hooks.ts@@ -556,27 +556,27 @@ export const useChat = (onAgentLog: ({ data }) => {const currentNodeIndex = responseItem.workflowProcess!.tracing!.findIndex(item => item.node_id === data.node_id)if (currentNodeIndex > -1) {- const current = responseItem.workflowProcess!.tracing![currentNodeIndex]+ const current = responseItem.workflowProcess!.tracing![currentNodeIndex]!- if (current.execution_metadata) {- if (current.execution_metadata.agent_log) {- const currentLogIndex = current.execution_metadata.agent_log.findIndex(log => log.message_id === data.message_id)+ if (current!.execution_metadata) {+ if (current!.execution_metadata.agent_log) {+ const currentLogIndex = current!.execution_metadata.agent_log.findIndex(log => log.message_id === data.message_id)if (currentLogIndex > -1) {- current.execution_metadata.agent_log[currentLogIndex] = {- ...current.execution_metadata.agent_log[currentLogIndex],+ current!.execution_metadata.agent_log[currentLogIndex] = {+ ...current!.execution_metadata.agent_log[currentLogIndex],...data,}}else {- current.execution_metadata.agent_log.push(data)+ current!.execution_metadata.agent_log.push(data)}}else {- current.execution_metadata.agent_log = [data]+ current!.execution_metadata.agent_log = [data]}}else {- current.execution_metadata = {+ current!.execution_metadata = {agent_log: [data],} as any}@@ -608,7 +608,7 @@ export const useChat = (}const currentTracingIndex = responseItem.workflowProcess!.tracing!.findIndex(item => item.node_id === data.node_id)if (currentTracingIndex > -1) {- responseItem.workflowProcess!.tracing[currentTracingIndex].status = NodeRunningStatus.Paused+ responseItem.workflowProcess!.tracing[currentTracingIndex]!.status = NodeRunningStatus.PausedupdateCurrentQAOnTree({placeholderQuestionId,questionItem,@@ -638,7 +638,7 @@ export const useChat = (onHumanInputFormTimeout: ({ data }) => {if (responseItem.humanInputFormDataList?.length) {const currentFormIndex = responseItem.humanInputFormDataList.findIndex(item => item.node_id === data.node_id)- responseItem.humanInputFormDataList[currentFormIndex].expiration_time = data.expiration_time+ responseItem.humanInputFormDataList[currentFormIndex]!.expiration_time = data.expiration_time}updateCurrentQAOnTree({placeholderQuestionId,@@ -879,7 +879,7 @@ export const useChat = (if (responseItem.workflowProcess?.tracing) {const currentTracingIndex = responseItem.workflowProcess.tracing.findIndex(item => item.node_id === humanInputRequiredData.node_id)if (currentTracingIndex > -1)- responseItem.workflowProcess.tracing[currentTracingIndex].status = NodeRunningStatus.Paused+ responseItem.workflowProcess.tracing[currentTracingIndex]!.status = NodeRunningStatus.Paused}})},@@ -902,7 +902,7 @@ export const useChat = (updateChatTreeNode(messageId, (responseItem) => {if (responseItem.humanInputFormDataList?.length) {const currentFormIndex = responseItem.humanInputFormDataList.findIndex(item => item.node_id === humanInputFormTimeoutData.node_id)- responseItem.humanInputFormDataList[currentFormIndex].expiration_time = humanInputFormTimeoutData.expiration_time+ responseItem.humanInputFormDataList[currentFormIndex]!.expiration_time = humanInputFormTimeoutData.expiration_time}})},diff --git a/web/app/components/workflow/panel/index.tsx b/web/app/components/workflow/panel/index.tsxindex 7c8e4e4ed34..89e8419b5f7 100644--- a/web/app/components/workflow/panel/index.tsx+++ b/web/app/components/workflow/panel/index.tsx@@ -26,7 +26,7 @@ export type PanelProps = {*/const getEntryWidth = (entry: ResizeObserverEntry, element: HTMLElement): number => {if (entry.borderBoxSize?.length > 0)- return entry.borderBoxSize[0].inlineSize+ return entry.borderBoxSize[0]!.inlineSizeif (entry.contentRect.width > 0)return entry.contentRect.widthdiff --git a/web/app/components/workflow/panel/inputs-panel.tsx b/web/app/components/workflow/panel/inputs-panel.tsxindex 2eb597b5dff..4e6255a2c0a 100644--- a/web/app/components/workflow/panel/inputs-panel.tsx+++ b/web/app/components/workflow/panel/inputs-panel.tsx@@ -51,7 +51,7 @@ const InputsPanel = ({ onRun }: Props) => {if (variable.default)result[variable.variable] = variable.defaultif (inputs[variable.variable] !== undefined)- result[variable.variable] = inputs[variable.variable]+ result[variable.variable] = inputs[variable.variable]!})}return resultdiff --git a/web/app/components/workflow/panel/version-history-panel/index.tsx b/web/app/components/workflow/panel/version-history-panel/index.tsxindex 22caa14201f..10dd0e794a1 100644--- a/web/app/components/workflow/panel/version-history-panel/index.tsx+++ b/web/app/components/workflow/panel/version-history-panel/index.tsx@@ -298,7 +298,7 @@ export const VersionHistoryPanel = ({)})))}- {!isFetching && (!versionHistory?.pages?.length || !versionHistory.pages[0].items.length) && (+ {!isFetching && (!versionHistory?.pages?.length || !versionHistory.pages[0]!.items.length) && (<Empty onResetFilter={handleResetFilter} />)}</>diff --git a/web/app/components/workflow/run/__tests__/tracing-panel.spec.tsx b/web/app/components/workflow/run/__tests__/tracing-panel.spec.tsxindex f5445f5f9fe..af584e3df28 100644--- a/web/app/components/workflow/run/__tests__/tracing-panel.spec.tsx+++ b/web/app/components/workflow/run/__tests__/tracing-panel.spec.tsx@@ -105,11 +105,11 @@ describe('TracingPanel', () => {</div>,)- expect(screen.getByText('Parallel Group')).toBeInTheDocument()- expect(screen.getByText('Branch A')).toBeInTheDocument()- expect(screen.getByText('Branch B')).toBeInTheDocument()- expect(screen.getByTestId('node-child-1')).toBeInTheDocument()- expect(screen.getByTestId('node-node-2')).toBeInTheDocument()+ expect(screen.getByText('Parallel Group'))!.toBeInTheDocument()+ expect(screen.getByText('Branch A'))!.toBeInTheDocument()+ expect(screen.getByText('Branch B'))!.toBeInTheDocument()+ expect(screen.getByTestId('node-child-1'))!.toBeInTheDocument()+ expect(screen.getByTestId('node-node-2'))!.toBeInTheDocument()fireEvent.click(container.querySelector('.py-2') as HTMLElement)expect(parentClick).not.toHaveBeenCalled()@@ -132,9 +132,9 @@ describe('TracingPanel', () => {fireEvent.mouseLeave(hoverTarget)- fireEvent.click(screen.getAllByRole('button')[0])- expect(container.querySelector('[data-parallel-id="parallel-1"] > div:last-child')).toHaveClass('hidden')- fireEvent.click(screen.getAllByRole('button')[0])+ fireEvent.click(screen.getAllByRole('button')[0]!)+ expect(container.querySelector('[data-parallel-id="parallel-1"] > div:last-child'))!.toHaveClass('hidden')+ fireEvent.click(screen.getAllByRole('button')[0]!)expect(container.querySelector('[data-parallel-id="parallel-1"] > div:last-child')).not.toHaveClass('hidden')expect(mockNodePanel).toHaveBeenCalledWith(expect.objectContaining({hideInfo: true,@@ -170,7 +170,7 @@ describe('TracingPanel', () => {render(<TracingPanel list={[]} />)- expect(screen.getByTestId('special-result-panel')).toBeInTheDocument()+ expect(screen.getByTestId('special-result-panel'))!.toBeInTheDocument()expect(mockSpecialResultPanel).toHaveBeenCalledWith(expect.objectContaining({showRetryDetail: true,retryResultList: [{ id: 'retry-1' }],diff --git a/web/app/components/workflow/run/agent-log/agent-result-panel.tsx b/web/app/components/workflow/run/agent-log/agent-result-panel.tsxindex 1819696679b..50d30d7708f 100644--- a/web/app/components/workflow/run/agent-log/agent-result-panel.tsx+++ b/web/app/components/workflow/run/agent-log/agent-result-panel.tsx@@ -16,7 +16,7 @@ const AgentResultPanel = ({}: AgentResultPanelProps) => {const { t } = useTranslation()const top = agentOrToolLogItemStack[agentOrToolLogItemStack.length - 1]- const list = agentOrToolLogListMap[top.message_id]+ const list = agentOrToolLogListMap[top!.message_id]return (<div className="overflow-y-auto bg-background-section">@@ -26,7 +26,7 @@ const AgentResultPanel = ({/><div className="space-y-1 p-2">{- list.map(item => (+ list!.map(item => (<AgentLogItemkey={item.message_id}item={item}@@ -36,7 +36,7 @@ const AgentResultPanel = ({}</div>{- top.hasCircle && (+ top!.hasCircle && (<div className="mt-1 flex items-center rounded-xl border border-components-panel-border bg-components-panel-bg-blur px-3 pr-2 shadow-md"><divclassName="absolute inset-0 rounded-xl opacity-[0.4]"diff --git a/web/app/components/workflow/run/loop-log/__tests__/loop-log-trigger.spec.tsx b/web/app/components/workflow/run/loop-log/__tests__/loop-log-trigger.spec.tsxindex 085e680f914..3be1d7f8e25 100644--- a/web/app/components/workflow/run/loop-log/__tests__/loop-log-trigger.spec.tsx+++ b/web/app/components/workflow/run/loop-log/__tests__/loop-log-trigger.spec.tsx@@ -77,8 +77,8 @@ describe('LoopLogTrigger', () => {</div>,)- expect(screen.getByText(/workflow\.nodes\.loop\.loop/)).toBeInTheDocument()- expect(screen.getByText(/workflow\.nodes\.loop\.error/)).toBeInTheDocument()+ expect(screen.getByText(/workflow\.nodes\.loop\.loop/))!.toBeInTheDocument()+ expect(screen.getByText(/workflow\.nodes\.loop\.error/))!.toBeInTheDocument()await user.click(screen.getByRole('button'))@@ -134,7 +134,7 @@ describe('LoopLogTrigger', () => {await user.click(screen.getByRole('button'))expect(onShowLoopResultList).toHaveBeenCalledTimes(1)- const [structuredList, durations, variableMap] = onShowLoopResultList.mock.calls[0]+ const [structuredList, durations, variableMap] = (onShowLoopResultList.mock.calls[0] ?? []) as [any, any, any]expect(structuredList).toHaveLength(2)expect(structuredList).toEqual(expect.arrayContaining([diff --git a/web/app/components/workflow/run/output-panel.tsx b/web/app/components/workflow/run/output-panel.tsxindex 9f432990590..f40470244e5 100644--- a/web/app/components/workflow/run/output-panel.tsx+++ b/web/app/components/workflow/run/output-panel.tsx@@ -26,7 +26,7 @@ const OutputPanel: FC<OutputPanelProps> = ({if (!outputs || typeof outputs !== 'object')return falseconst keys = Object.keys(outputs)- const value = outputs[keys[0]]+ const value = outputs[keys[0]!]return keys.length === 1 && (typeof value === 'string'|| (Array.isArray(value) && value.every(item => typeof item === 'string'))@@ -74,9 +74,9 @@ const OutputPanel: FC<OutputPanelProps> = ({<div className="px-4 py-2"><Markdowncontent={- Array.isArray(outputs[Object.keys(outputs)[0]])- ? outputs[Object.keys(outputs)[0]].join('\n')- : (outputs[Object.keys(outputs)[0]] || '')+ Array.isArray(outputs[Object.keys(outputs)[0]!])+ ? outputs[Object.keys(outputs)[0]!].join('\n')+ : (outputs[Object.keys(outputs)[0]!] || '')}/></div>diff --git a/web/app/components/workflow/run/utils/format-log/__tests__/index.spec.ts b/web/app/components/workflow/run/utils/format-log/__tests__/index.spec.tsindex 53acbb72186..dab7ccdba38 100644--- a/web/app/components/workflow/run/utils/format-log/__tests__/index.spec.ts+++ b/web/app/components/workflow/run/utils/format-log/__tests__/index.spec.ts@@ -118,8 +118,8 @@ describe('formatToTracingNodeList', () => {expect.objectContaining({ node_id: 'c' }),expect.objectContaining({ node_id: 'b' }),])- expect(mockFormatHumanInputNode).toHaveBeenCalledWith(mockFormatAgentNode.mock.results[0].value)- expect(mockFormatRetryNode).toHaveBeenCalledWith(mockFormatHumanInputNode.mock.results[0].value)+ expect(mockFormatHumanInputNode).toHaveBeenCalledWith(mockFormatAgentNode.mock.results[0]!.value)+ expect(mockFormatRetryNode).toHaveBeenCalledWith(mockFormatHumanInputNode.mock.results[0]!.value)expect(mockFormatParallelNode).toHaveBeenLastCalledWith(expect.any(Array), t)expect(result).toEqual([expect.objectContaining({ node_id: 'a', parallelFormatted: true }),diff --git a/web/app/components/workflow/run/utils/format-log/graph-to-log-struct.ts b/web/app/components/workflow/run/utils/format-log/graph-to-log-struct.tsindex 55e1c2b4060..4f62a6cf6bd 100644--- a/web/app/components/workflow/run/utils/format-log/graph-to-log-struct.ts+++ b/web/app/components/workflow/run/utils/format-log/graph-to-log-struct.ts@@ -80,10 +80,10 @@ function parseNode(nodeStr: string, parentIterationId?: string, parentLoopId?: s// Extract nodeType, nodeId, and paramsconst [nodeType, nodeId, ...paramsRaw] = parts- const params = parseParams(paramsRaw, nodeType === 'iteration' ? nodeId.trim() : parentIterationId, nodeType === 'loop' ? nodeId.trim() : parentLoopId)+ const params = parseParams(paramsRaw, nodeType === 'iteration' ? nodeId!.trim() : parentIterationId, nodeType === 'loop' ? nodeId!.trim() : parentLoopId)const complexNode = {- nodeType: nodeType.trim(),- nodeId: nodeId.trim(),+ nodeType: nodeType!.trim(),+ nodeId: nodeId!.trim(),params,}if (parentIterationId) {diff --git a/web/app/components/workflow/run/utils/format-log/iteration/index.ts b/web/app/components/workflow/run/utils/format-log/iteration/index.tsindex 5bd6b822e05..91235dd0fc1 100644--- a/web/app/components/workflow/run/utils/format-log/iteration/index.ts+++ b/web/app/components/workflow/run/utils/format-log/iteration/index.ts@@ -27,7 +27,7 @@ export function addChildrenToIterationNode(iterationNode: NodeTracing, childrenNif (!details[runIndex])details[runIndex] = []- details[runIndex].push(item)+ details[runIndex]!.push(item)lastResolvedIndex = runIndex})return {diff --git a/web/app/components/workflow/selection-contextmenu.tsx b/web/app/components/workflow/selection-contextmenu.tsxindex 06abad65e54..64a6f87c557 100644--- a/web/app/components/workflow/selection-contextmenu.tsx+++ b/web/app/components/workflow/selection-contextmenu.tsx@@ -182,8 +182,8 @@ const distributeNodes = (const lastNode = sortedNodes[sortedNodes.length - 1]const totalGap = isHorizontal- ? lastNode.position.x + (lastNode.width || 0) - firstNode.position.x- : lastNode.position.y + (lastNode.height || 0) - firstNode.position.y+ ? lastNode!.position.x + (lastNode!.width || 0) - firstNode!.position.x+ : lastNode!.position.y + (lastNode!.height || 0) - firstNode!.position.yconst fixedSpace = sortedNodes.reduce((sum, node) =>sum + (isHorizontal ? (node.width || 0) : (node.height || 0)), 0)@@ -194,12 +194,12 @@ const distributeNodes = (return produce(nodes, (draft) => {let currentPosition = isHorizontal- ? firstNode.position.x + (firstNode.width || 0)- : firstNode.position.y + (firstNode.height || 0)+ ? firstNode!.position.x + (firstNode!.width || 0)+ : firstNode!.position.y + (firstNode!.height || 0)for (let index = 1; index < sortedNodes.length - 1; index++) {const nodeToAlign = sortedNodes[index]- const currentNode = draft.find(node => node.id === nodeToAlign.id)+ const currentNode = draft.find(node => node.id === nodeToAlign!.id)if (!currentNode)continue@@ -208,14 +208,14 @@ const distributeNodes = (currentNode.position.x = nextXif (currentNode.positionAbsolute)currentNode.positionAbsolute.x = nextX- currentPosition = nextX + (nodeToAlign.width || 0)+ currentPosition = nextX + (nodeToAlign!.width || 0)}else {const nextY = currentPosition + spacingcurrentNode.position.y = nextYif (currentNode.positionAbsolute)currentNode.positionAbsolute.y = nextY- currentPosition = nextY + (nodeToAlign.height || 0)+ currentPosition = nextY + (nodeToAlign!.height || 0)}}})diff --git a/web/app/components/workflow/store/__tests__/datasets-detail-store.spec.ts b/web/app/components/workflow/store/__tests__/datasets-detail-store.spec.tsindex 3728aeda8e5..ad313f05f75 100644--- a/web/app/components/workflow/store/__tests__/datasets-detail-store.spec.ts+++ b/web/app/components/workflow/store/__tests__/datasets-detail-store.spec.ts@@ -48,7 +48,7 @@ describe('DatasetsDetailStore', () => {store.getState().updateDatasetsDetail([ds1v1])store.getState().updateDatasetsDetail([ds1v2])- expect(store.getState().datasetsDetail['ds-1'].name).toBe('Version 2')+ expect(store.getState().datasetsDetail['ds-1']!.name).toBe('Version 2')})it('should handle empty array without errors', () => {@@ -56,7 +56,7 @@ describe('DatasetsDetailStore', () => {store.getState().updateDatasetsDetail([makeDataset('ds-1', 'Test')])store.getState().updateDatasetsDetail([])- expect(store.getState().datasetsDetail['ds-1'].name).toBe('Test')+ expect(store.getState().datasetsDetail['ds-1']!.name).toBe('Test')})})})diff --git a/web/app/components/workflow/store/__tests__/inspect-vars-slice.spec.ts b/web/app/components/workflow/store/__tests__/inspect-vars-slice.spec.tsindex 4ecbbda092a..5eaf34ebcc8 100644--- a/web/app/components/workflow/store/__tests__/inspect-vars-slice.spec.ts+++ b/web/app/components/workflow/store/__tests__/inspect-vars-slice.spec.ts@@ -64,8 +64,8 @@ describe('Inspect Vars Slice', () => {store.getState().setNodeInspectVars('n1', [v2])const node = store.getState().nodesWithInspectVars[0]- expect(node.vars).toEqual([v2])- expect(node.isValueFetched).toBe(true)+ expect(node!.vars).toEqual([v2])+ expect(node!.isValueFetched).toBe(true)})it('should not modify state when node is not found', () => {@@ -74,7 +74,7 @@ describe('Inspect Vars Slice', () => {store.getState().setNodeInspectVars('non-existent', [])- expect(store.getState().nodesWithInspectVars[0].vars).toHaveLength(1)+ expect(store.getState().nodesWithInspectVars[0]!.vars).toHaveLength(1)})})@@ -89,7 +89,7 @@ describe('Inspect Vars Slice', () => {store.getState().deleteNodeInspectVars('n1')expect(store.getState().nodesWithInspectVars).toHaveLength(1)- expect(store.getState().nodesWithInspectVars[0].nodeId).toBe('n2')+ expect(store.getState().nodesWithInspectVars[0]!.nodeId).toBe('n2')})})@@ -101,9 +101,9 @@ describe('Inspect Vars Slice', () => {store.getState().setInspectVarValue('n1', 'v1', 'new')- const updated = store.getState().nodesWithInspectVars[0].vars[0]- expect(updated.value).toBe('new')- expect(updated.edited).toBe(true)+ const updated = store.getState().nodesWithInspectVars[0]!.vars[0]+ expect(updated!.value).toBe('new')+ expect(updated!.edited).toBe(true)})it('should not change state when var is not found', () => {@@ -113,7 +113,7 @@ describe('Inspect Vars Slice', () => {store.getState().setInspectVarValue('n1', 'wrong-id', 'new')- expect(store.getState().nodesWithInspectVars[0].vars[0].value).toBe('old')+ expect(store.getState().nodesWithInspectVars[0]!.vars[0]!.value).toBe('old')})it('should not change state when node is not found', () => {@@ -123,7 +123,7 @@ describe('Inspect Vars Slice', () => {store.getState().setInspectVarValue('wrong-node', 'v1', 'new')- expect(store.getState().nodesWithInspectVars[0].vars[0].value).toBe('old')+ expect(store.getState().nodesWithInspectVars[0]!.vars[0]!.value).toBe('old')})})@@ -135,9 +135,9 @@ describe('Inspect Vars Slice', () => {store.getState().resetToLastRunVar('n1', 'v1', 'original')- const updated = store.getState().nodesWithInspectVars[0].vars[0]- expect(updated.value).toBe('original')- expect(updated.edited).toBe(false)+ const updated = store.getState().nodesWithInspectVars[0]!.vars[0]+ expect(updated!.value).toBe('original')+ expect(updated!.edited).toBe(false)})it('should not change state when node is not found', () => {@@ -146,7 +146,7 @@ describe('Inspect Vars Slice', () => {store.getState().resetToLastRunVar('wrong-node', 'v1', 'val')- expect(store.getState().nodesWithInspectVars[0].vars[0].edited).toBe(false)+ expect(store.getState().nodesWithInspectVars[0]!.vars[0]!.edited).toBe(false)})it('should not change state when var is not found', () => {@@ -155,7 +155,7 @@ describe('Inspect Vars Slice', () => {store.getState().resetToLastRunVar('n1', 'wrong-var', 'val')- expect(store.getState().nodesWithInspectVars[0].vars[0].edited).toBe(true)+ expect(store.getState().nodesWithInspectVars[0]!.vars[0]!.edited).toBe(true)})})@@ -167,9 +167,9 @@ describe('Inspect Vars Slice', () => {store.getState().renameInspectVarName('n1', 'v1', ['n1', 'new_name'])- const updated = store.getState().nodesWithInspectVars[0].vars[0]- expect(updated.name).toBe('new_name')- expect(updated.selector).toEqual(['n1', 'new_name'])+ const updated = store.getState().nodesWithInspectVars[0]!.vars[0]+ expect(updated!.name).toBe('new_name')+ expect(updated!.selector).toEqual(['n1', 'new_name'])})it('should not change state when node is not found', () => {@@ -179,7 +179,7 @@ describe('Inspect Vars Slice', () => {store.getState().renameInspectVarName('wrong-node', 'v1', ['x', 'y'])- expect(store.getState().nodesWithInspectVars[0].vars[0].name).toBe('old')+ expect(store.getState().nodesWithInspectVars[0]!.vars[0]!.name).toBe('old')})it('should not change state when var is not found', () => {@@ -189,7 +189,7 @@ describe('Inspect Vars Slice', () => {store.getState().renameInspectVarName('n1', 'wrong-var', ['x', 'y'])- expect(store.getState().nodesWithInspectVars[0].vars[0].name).toBe('old')+ expect(store.getState().nodesWithInspectVars[0]!.vars[0]!.name).toBe('old')})})@@ -202,9 +202,9 @@ describe('Inspect Vars Slice', () => {store.getState().deleteInspectVar('n1', 'v1')- const vars = store.getState().nodesWithInspectVars[0].vars+ const vars = store.getState().nodesWithInspectVars[0]!.varsexpect(vars).toHaveLength(1)- expect(vars[0].id).toBe('v2')+ expect(vars[0]!.id).toBe('v2')})it('should not change state when var is not found', () => {@@ -214,7 +214,7 @@ describe('Inspect Vars Slice', () => {store.getState().deleteInspectVar('n1', 'wrong-id')- expect(store.getState().nodesWithInspectVars[0].vars).toHaveLength(1)+ expect(store.getState().nodesWithInspectVars[0]!.vars).toHaveLength(1)})it('should not change state when node is not found', () => {@@ -223,7 +223,7 @@ describe('Inspect Vars Slice', () => {store.getState().deleteInspectVar('wrong-node', 'v1')- expect(store.getState().nodesWithInspectVars[0].vars).toHaveLength(1)+ expect(store.getState().nodesWithInspectVars[0]!.vars).toHaveLength(1)})})diff --git a/web/app/components/workflow/store/workflow/debug/__tests__/inspect-vars-slice.spec.ts b/web/app/components/workflow/store/workflow/debug/__tests__/inspect-vars-slice.spec.tsindex a8aa86850fc..0dca4fdde2f 100644--- a/web/app/components/workflow/store/workflow/debug/__tests__/inspect-vars-slice.spec.ts+++ b/web/app/components/workflow/store/workflow/debug/__tests__/inspect-vars-slice.spec.ts@@ -61,25 +61,25 @@ describe('createInspectVarsSlice', () => {])store.getState().setInspectVarValue('node-1', 'var-1', 'edited')- expect(store.getState().nodesWithInspectVars[0].vars[0]).toMatchObject({+ expect(store.getState().nodesWithInspectVars[0]!.vars[0]).toMatchObject({value: 'edited',edited: true,})store.getState().renameInspectVarName('node-1', 'var-1', ['node-1', 'renamed'])- expect(store.getState().nodesWithInspectVars[0].vars[0]).toMatchObject({+ expect(store.getState().nodesWithInspectVars[0]!.vars[0]).toMatchObject({name: 'renamed',selector: ['node-1', 'renamed'],})store.getState().resetToLastRunVar('node-1', 'var-1', 'restored')- expect(store.getState().nodesWithInspectVars[0].vars[0]).toMatchObject({+ expect(store.getState().nodesWithInspectVars[0]!.vars[0]).toMatchObject({value: 'restored',edited: false,})store.getState().deleteInspectVar('node-1', 'var-1')- expect(store.getState().nodesWithInspectVars[0].vars).toEqual([])+ expect(store.getState().nodesWithInspectVars[0]!.vars).toEqual([])store.getState().deleteNodeInspectVars('node-1')expect(store.getState().nodesWithInspectVars).toEqual([])diff --git a/web/app/components/workflow/store/workflow/debug/inspect-vars-slice.ts b/web/app/components/workflow/store/workflow/debug/inspect-vars-slice.tsindex cb1998befdc..5a0f5741166 100644--- a/web/app/components/workflow/store/workflow/debug/inspect-vars-slice.ts+++ b/web/app/components/workflow/store/workflow/debug/inspect-vars-slice.ts@@ -49,8 +49,8 @@ export const createInspectVarsSlice: StateCreator<InspectVarsSliceShape> = (set)const nodes = produce(prevNodes, (draft) => {const index = prevNodes.findIndex(node => node.nodeId === nodeId)if (index !== -1) {- draft[index].vars = payload- draft[index].isValueFetched = true+ draft[index]!.vars = payload+ draft[index]!.isValueFetched = true}})@@ -111,7 +111,7 @@ export const createInspectVarsSlice: StateCreator<InspectVarsSliceShape> = (set)const targetVar = targetNode.vars.find(varItem => varItem.id === varId)if (!targetVar)return- targetVar.name = selector[1]+ targetVar.name = selector[1]!targetVar.selector = selector})return {diff --git a/web/app/components/workflow/update-dsl-modal.helpers.ts b/web/app/components/workflow/update-dsl-modal.helpers.tsindex fafe22f16b2..4d2c2adcda6 100644--- a/web/app/components/workflow/update-dsl-modal.helpers.ts+++ b/web/app/components/workflow/update-dsl-modal.helpers.ts@@ -92,7 +92,7 @@ export const normalizeWorkflowFeatures = (features: WorkflowFeatures) => {},enabled: !!(features.file_upload?.enabled || features.file_upload?.image?.enabled),allowed_file_types: features.file_upload?.allowed_file_types || [SupportUploadFileTypes.image],- allowed_file_extensions: features.file_upload?.allowed_file_extensions || FILE_EXTS[SupportUploadFileTypes.image].map(ext => `.${ext}`),+ allowed_file_extensions: features.file_upload?.allowed_file_extensions || FILE_EXTS[SupportUploadFileTypes.image]!.map(ext => `.${ext}`),allowed_file_upload_methods: features.file_upload?.allowed_file_upload_methods || features.file_upload?.image?.transfer_methods || ['local_file', 'remote_url'],number_limits: features.file_upload?.number_limits || features.file_upload?.image?.number_limits || 3,},diff --git a/web/app/components/workflow/utils/__tests__/elk-layout.spec.ts b/web/app/components/workflow/utils/__tests__/elk-layout.spec.tsindex 54eb289abe3..7cbd5478e39 100644--- a/web/app/components/workflow/utils/__tests__/elk-layout.spec.ts+++ b/web/app/components/workflow/utils/__tests__/elk-layout.spec.ts@@ -152,7 +152,7 @@ describe('getLayoutByELK', () => {await getLayoutByELK(nodes, edges)const ifElkNode = layoutCallArgs!.children!.find((c: ElkChild) => c.id === 'if-1')!expect(ifElkNode.ports).toHaveLength(1)- expect(ifElkNode.ports![0].layoutOptions!['elk.port.side']).toBe('EAST')+ expect(ifElkNode.ports![0]!.layoutOptions!['elk.port.side']).toBe('EAST')})it('should build ports for HumanInput nodes with multiple branches', async () => {@@ -187,7 +187,7 @@ describe('getLayoutByELK', () => {await getLayoutByELK(nodes, edges)const hiElkNode = layoutCallArgs!.children!.find((c: ElkChild) => c.id === 'hi-1')!expect(hiElkNode.ports).toHaveLength(1)- expect(hiElkNode.ports![0].layoutOptions!['elk.port.side']).toBe('EAST')+ expect(hiElkNode.ports![0]!.layoutOptions!['elk.port.side']).toBe('EAST')})it('should normalise bounds so minX and minY start at 0', async () => {@@ -537,7 +537,7 @@ describe('getLayoutByELK', () => {await getLayoutByELK(nodes, edges)const qcNode = layoutCallArgs!.children!.find((c: ElkChild) => c.id === 'qc-1')!expect(qcNode.ports).toHaveLength(1)- expect(qcNode.ports![0].layoutOptions!['elk.port.side']).toBe('EAST')+ expect(qcNode.ports![0]!.layoutOptions!['elk.port.side']).toBe('EAST')})it('should only create output (EAST) ports, not input (WEST) ports', async () => {@@ -692,8 +692,8 @@ describe('getLayoutByELK', () => {await getLayoutByELK(nodes, edges)const elkEdges = layoutCallArgs!.edges as Array<{ sources: string[], targets: string[] }>const ifEdges = elkEdges.filter(e => e.sources[0] === 'if-1')- expect(ifEdges[0].targets[0]).toBe('a')- expect(ifEdges[1].targets[0]).toBe('b')+ expect(ifEdges[0]!.targets[0]).toBe('a')+ expect(ifEdges[1]!.targets[0]).toBe('b')})it('should keep edges for components where every node has an incoming edge', async () => {@@ -918,8 +918,8 @@ describe('getLayoutForChildNodes', () => {const qcElk = layoutCallArgs!.children!.find((c: ElkChild) => c.id === 'qc-child')!expect(qcElk.ports).toHaveLength(2)- expect(qcElk.ports![0].id).toContain('cls-1')- expect(qcElk.ports![1].id).toContain('cls-2')+ expect(qcElk.ports![0]!.id).toContain('cls-1')+ expect(qcElk.ports![1]!.id).toContain('cls-2')const childIds = layoutCallArgs!.children!.map((c: ElkChild) => c.id)expect(childIds.indexOf('upper')).toBeLessThan(childIds.indexOf('lower'))diff --git a/web/app/components/workflow/utils/__tests__/node-navigation.spec.ts b/web/app/components/workflow/utils/__tests__/node-navigation.spec.tsindex 8ccdff0604d..012bdf1e18f 100644--- a/web/app/components/workflow/utils/__tests__/node-navigation.spec.ts+++ b/web/app/components/workflow/utils/__tests__/node-navigation.spec.ts@@ -13,7 +13,7 @@ describe('selectWorkflowNode', () => {selectWorkflowNode('node-1', true)expect(handler).toHaveBeenCalledTimes(1)- const event = handler.mock.calls[0][0] as CustomEvent+ const event = handler.mock.calls[0]![0] as CustomEventexpect(event.detail).toEqual({ nodeId: 'node-1', focus: true })document.removeEventListener('workflow:select-node', handler)@@ -25,7 +25,7 @@ describe('selectWorkflowNode', () => {selectWorkflowNode('node-2')- const event = handler.mock.calls[0][0] as CustomEvent+ const event = handler.mock.calls[0]![0] as CustomEventexpect(event.detail.focus).toBe(false)document.removeEventListener('workflow:select-node', handler)@@ -40,7 +40,7 @@ describe('scrollToWorkflowNode', () => {scrollToWorkflowNode('node-5')expect(handler).toHaveBeenCalledTimes(1)- const event = handler.mock.calls[0][0] as CustomEvent+ const event = handler.mock.calls[0]![0] as CustomEventexpect(event.detail).toEqual({ nodeId: 'node-5' })document.removeEventListener('workflow:scroll-to-node', handler)@@ -112,7 +112,7 @@ describe('setupScrollToNodeListener', () => {scrollToWorkflowNode('n1')expect(reactflow.setCenter).toHaveBeenCalledTimes(1)- const [targetX, targetY, options] = reactflow.setCenter.mock.calls[0]+ const [targetX, targetY, options] = (reactflow.setCenter.mock.calls[0] ?? []) as [any, any, any]expect(targetX).toBeGreaterThan(100)expect(targetY).toBeGreaterThan(200)expect(options).toEqual({ zoom: 1, duration: 800 })diff --git a/web/app/components/workflow/utils/__tests__/tool.spec.ts b/web/app/components/workflow/utils/__tests__/tool.spec.tsindex baa61d8a4ee..5f5327cc2dd 100644--- a/web/app/components/workflow/utils/__tests__/tool.spec.ts+++ b/web/app/components/workflow/utils/__tests__/tool.spec.ts@@ -66,7 +66,7 @@ describe('getToolCheckParams', () => {{ label: 'Query', variable: 'query', type: 'string', required: true },])expect(result.toolSettingSchema).toHaveLength(1)- expect(result.toolSettingSchema[0].variable).toBe('api_key')+ expect(result.toolSettingSchema[0]!.variable).toBe('api_key')})it('should mark notAuthed for builtin tools without team auth', () => {@@ -157,7 +157,7 @@ describe('getToolCheckParams', () => {'ja_JP',)- expect(result.toolInputsSchema[0].label).toBe('Query')+ expect(result.toolInputsSchema[0]!.label).toBe('Query')})})diff --git a/web/app/components/workflow/utils/__tests__/trigger.spec.ts b/web/app/components/workflow/utils/__tests__/trigger.spec.tsindex b74126d69fe..f3cd2a0c719 100644--- a/web/app/components/workflow/utils/__tests__/trigger.spec.ts+++ b/web/app/components/workflow/utils/__tests__/trigger.spec.ts@@ -79,7 +79,7 @@ describe('getTriggerCheckParams', () => {'zh_Hans',)- expect(result.triggerInputsSchema[0].label).toBe('频道')+ expect(result.triggerInputsSchema[0]!.label).toBe('频道')})it('should fall back to en_US when language label is missing', () => {@@ -89,7 +89,7 @@ describe('getTriggerCheckParams', () => {'ja_JP',)- expect(result.triggerInputsSchema[0].label).toBe('Channel')+ expect(result.triggerInputsSchema[0]!.label).toBe('Channel')})it('should fall back to parameter name when no labels exist', () => {@@ -103,7 +103,7 @@ describe('getTriggerCheckParams', () => {const result = getTriggerCheckParams(createTriggerData(), [provider], 'en_US')- expect(result.triggerInputsSchema[0].label).toBe('raw_param')+ expect(result.triggerInputsSchema[0]!.label).toBe('raw_param')})it('should match provider by provider_id', () => {diff --git a/web/app/components/workflow/utils/__tests__/workflow-init.spec.ts b/web/app/components/workflow/utils/__tests__/workflow-init.spec.tsindex 15aa2a933d5..f7c85341118 100644--- a/web/app/components/workflow/utils/__tests__/workflow-init.spec.ts+++ b/web/app/components/workflow/utils/__tests__/workflow-init.spec.ts@@ -22,7 +22,7 @@ vi.mock('reactflow', async (importOriginal) => {...actual,getConnectedEdges: vi.fn((_nodes: Node[], edges: Edge[]) => {const node = _nodes[0]- return edges.filter(e => e.source === node.id || e.target === node.id)+ return edges.filter(e => e.source === node!.id || e.target === node!.id)}),}})@@ -57,7 +57,7 @@ describe('preprocessNodesAndEdges', () => {const result = preprocessNodesAndEdges(nodes as Node[], [])const startNodes = result.nodes.filter(n => n.data.type === BlockEnum.IterationStart)expect(startNodes).toHaveLength(1)- expect(startNodes[0].parentId).toBe('iter-1')+ expect(startNodes[0]!.parentId).toBe('iter-1')})it('should add iteration start node when iteration has start_node_id but node type does not match', () => {@@ -142,9 +142,9 @@ describe('preprocessNodesAndEdges', () => {const result = preprocessNodesAndEdges(nodes as Node[], [])const newEdges = result.edgesexpect(newEdges).toHaveLength(1)- expect(newEdges[0].target).toBe('child-1')- expect(newEdges[0].data!.sourceType).toBe(BlockEnum.IterationStart)- expect(newEdges[0].data!.isInIteration).toBe(true)+ expect(newEdges[0]!.target).toBe('child-1')+ expect(newEdges[0]!.data!.sourceType).toBe(BlockEnum.IterationStart)+ expect(newEdges[0]!.data!.isInIteration).toBe(true)})it('should create edges for loop nodes with start_node_id', () => {@@ -162,8 +162,8 @@ describe('preprocessNodesAndEdges', () => {const result = preprocessNodesAndEdges(nodes as Node[], [])const newEdges = result.edgesexpect(newEdges).toHaveLength(1)- expect(newEdges[0].target).toBe('child-1')- expect(newEdges[0].data!.isInLoop).toBe(true)+ expect(newEdges[0]!.target).toBe('child-1')+ expect(newEdges[0]!.data!.isInLoop).toBe(true)})it('should update start_node_id on iteration and loop nodes', () => {@@ -194,19 +194,19 @@ describe('initialNodes', () => {nodes.forEach(n => Reflect.deleteProperty(n, 'position'))const result = initialNodes(nodes, [])- expect(result[0].position).toBeDefined()- expect(result[1].position).toBeDefined()- expect(result[1].position.x).toBeGreaterThan(result[0].position.x)+ expect(result[0]!.position).toBeDefined()+ expect(result[1]!.position).toBeDefined()+ expect(result[1]!.position.x).toBeGreaterThan(result[0]!.position.x)})it('should set type to CUSTOM_NODE when type is missing', () => {const nodes = [createNode({ id: 'n1', data: { type: BlockEnum.Start, title: '', desc: '' } }),]- Reflect.deleteProperty(nodes[0], 'type')+ Reflect.deleteProperty(nodes[0]!, 'type')const result = initialNodes(nodes, [])- expect(result[0].type).toBe(CUSTOM_NODE)+ expect(result[0]!.type).toBe(CUSTOM_NODE)})it('should set connected source and target handle ids', () => {@@ -219,8 +219,8 @@ describe('initialNodes', () => {]const result = initialNodes(nodes, edges)- expect(result[0].data._connectedSourceHandleIds).toContain('source')- expect(result[1].data._connectedTargetHandleIds).toContain('target')+ expect(result[0]!.data._connectedSourceHandleIds).toContain('source')+ expect(result[1]!.data._connectedTargetHandleIds).toContain('target')})it('should handle IfElse node with cases', () => {@@ -239,8 +239,8 @@ describe('initialNodes', () => {]const result = initialNodes(nodes, [])- expect(result[0].data._targetBranches).toBeDefined()- expect(result[0].data._targetBranches).toHaveLength(2)+ expect(result[0]!.data._targetBranches).toBeDefined()+ expect(result[0]!.data._targetBranches).toHaveLength(2)})it('should migrate legacy IfElse node without cases to cases format', () => {@@ -259,9 +259,9 @@ describe('initialNodes', () => {]const result = initialNodes(nodes, [])- const data = result[0].data as IfElseNodeType+ const data = result[0]!.data as IfElseNodeTypeexpect(data.cases).toHaveLength(1)- expect(data.cases[0].case_id).toBe('true')+ expect(data.cases[0]!.case_id).toBe('true')})it('should delete legacy conditions/logical_operator when cases exist', () => {@@ -282,7 +282,7 @@ describe('initialNodes', () => {]const result = initialNodes(nodes, [])- const data = result[0].data as IfElseNodeType+ const data = result[0]!.data as IfElseNodeTypeexpect(data.conditions).toBeUndefined()expect(data.logical_operator).toBeUndefined()})@@ -302,7 +302,7 @@ describe('initialNodes', () => {]const result = initialNodes(nodes, [])- expect(result[0].data._targetBranches).toHaveLength(1)+ expect(result[0]!.data._targetBranches).toHaveLength(1)})it('should set iteration node defaults', () => {@@ -382,7 +382,7 @@ describe('initialNodes', () => {]const result = initialNodes(nodes, [])- expect((result[0].data as LLMNodeType).model.provider).toBe('corrected/openai')+ expect((result[0]!.data as LLMNodeType).model.provider).toBe('corrected/openai')})it('should correct model provider for KnowledgeRetrieval reranking_model', () => {@@ -401,7 +401,7 @@ describe('initialNodes', () => {]const result = initialNodes(nodes, [])- expect((result[0].data as KnowledgeRetrievalNodeType).multiple_retrieval_config!.reranking_model!.provider).toBe('corrected/cohere')+ expect((result[0]!.data as KnowledgeRetrievalNodeType).multiple_retrieval_config!.reranking_model!.provider).toBe('corrected/cohere')})it('should correct model provider for ParameterExtractor nodes', () => {@@ -418,7 +418,7 @@ describe('initialNodes', () => {]const result = initialNodes(nodes, [])- expect((result[0].data as ParameterExtractorNodeType).model.provider).toBe('corrected/anthropic')+ expect((result[0]!.data as ParameterExtractorNodeType).model.provider).toBe('corrected/anthropic')})it('should add default retry_config for HttpRequest nodes', () => {@@ -434,7 +434,7 @@ describe('initialNodes', () => {]const result = initialNodes(nodes, [])- expect(result[0].data.retry_config).toEqual({+ expect(result[0]!.data.retry_config).toEqual({retry_enabled: true,max_retries: DEFAULT_RETRY_MAX,retry_interval: DEFAULT_RETRY_INTERVAL,@@ -456,7 +456,7 @@ describe('initialNodes', () => {]const result = initialNodes(nodes, [])- expect(result[0].data.retry_config).toEqual(existingConfig)+ expect(result[0]!.data.retry_config).toEqual(existingConfig)})it('should migrate legacy Tool node configurations', () => {@@ -476,7 +476,7 @@ describe('initialNodes', () => {]const result = initialNodes(nodes, [])- const data = result[0].data as ToolNodeType+ const data = result[0]!.data as ToolNodeTypeexpect(data.tool_node_version).toBe('2')expect(data.tool_configurations.api_key).toEqual({type: 'constant',@@ -503,7 +503,7 @@ describe('initialNodes', () => {]const result = initialNodes(nodes, [])- const data = result[0].data as ToolNodeType+ const data = result[0]!.data as ToolNodeTypeexpect(data.tool_configurations).toEqual({ key: 'val' })})@@ -522,7 +522,7 @@ describe('initialNodes', () => {]const result = initialNodes(nodes, [])- const data = result[0].data as ToolNodeType+ const data = result[0]!.data as ToolNodeTypeexpect(data.tool_configurations).toEqual({ key: 'val' })})@@ -540,7 +540,7 @@ describe('initialNodes', () => {]const result = initialNodes(nodes, [])- const data = result[0].data as ToolNodeType+ const data = result[0]!.data as ToolNodeTypeexpect(data.tool_configurations.key).toEqual({ type: 'constant', value: null })})@@ -558,7 +558,7 @@ describe('initialNodes', () => {]const result = initialNodes(nodes, [])- const data = result[0].data as ToolNodeType+ const data = result[0]!.data as ToolNodeTypeexpect(data.tool_node_version).toBe('2')})})@@ -572,7 +572,7 @@ describe('initialEdges', () => {const edges = [createEdge({ source: 'a', target: 'b' })]const result = initialEdges(edges, nodes)- expect(result[0].type).toBe('custom')+ expect(result[0]!.type).toBe('custom')})it('should set default sourceHandle and targetHandle', () => {@@ -585,8 +585,8 @@ describe('initialEdges', () => {Reflect.deleteProperty(edge, 'targetHandle')const result = initialEdges([edge], nodes)- expect(result[0].sourceHandle).toBe('source')- expect(result[0].targetHandle).toBe('target')+ expect(result[0]!.sourceHandle).toBe('source')+ expect(result[0]!.targetHandle).toBe('target')})it('should set sourceType and targetType from nodes', () => {@@ -595,12 +595,12 @@ describe('initialEdges', () => {createNode({ id: 'b', data: { type: BlockEnum.Code, title: '', desc: '' } }),]const edges = [createEdge({ source: 'a', target: 'b' })]- Reflect.deleteProperty(edges[0].data!, 'sourceType')- Reflect.deleteProperty(edges[0].data!, 'targetType')+ Reflect.deleteProperty(edges[0]!.data!, 'sourceType')+ Reflect.deleteProperty(edges[0]!.data!, 'targetType')const result = initialEdges(edges, nodes)- expect(result[0].data!.sourceType).toBe(BlockEnum.Start)- expect(result[0].data!.targetType).toBe(BlockEnum.Code)+ expect(result[0]!.data!.sourceType).toBe(BlockEnum.Start)+ expect(result[0]!.data!.targetType).toBe(BlockEnum.Code)})it('should set _connectedNodeIsSelected when a node is selected', () => {@@ -611,7 +611,7 @@ describe('initialEdges', () => {const edges = [createEdge({ source: 'a', target: 'b' })]const result = initialEdges(edges, nodes)- expect(result[0].data!._connectedNodeIsSelected).toBe(true)+ expect(result[0]!.data!._connectedNodeIsSelected).toBe(true)})it('should filter cycle edges', () => {@@ -648,8 +648,8 @@ describe('initialEdges', () => {const result = initialEdges(edges, nodes)expect(result).toHaveLength(1)- expect(result[0].source).toBe('a')- expect(result[0].target).toBe('b')+ expect(result[0]!.source).toBe('a')+ expect(result[0]!.target).toBe('b')})it('should handle empty edges', () => {@@ -678,7 +678,7 @@ describe('initialEdges', () => {const edges = [createEdge({ source: 'a', target: 'b' })]const result = initialEdges(edges, nodes)- expect(result[0].data!._connectedNodeIsSelected).toBe(true)+ expect(result[0]!.data!._connectedNodeIsSelected).toBe(true)})it('should not set default sourceHandle when sourceHandle already exists', () => {@@ -689,8 +689,8 @@ describe('initialEdges', () => {const edges = [createEdge({ source: 'a', target: 'b', sourceHandle: 'custom-src', targetHandle: 'custom-tgt' })]const result = initialEdges(edges, nodes)- expect(result[0].sourceHandle).toBe('custom-src')- expect(result[0].targetHandle).toBe('custom-tgt')+ expect(result[0]!.sourceHandle).toBe('custom-src')+ expect(result[0]!.targetHandle).toBe('custom-tgt')})it('should handle graph with edges referencing nodes not in the node list', () => {diff --git a/web/app/components/workflow/utils/__tests__/workflow.spec.ts b/web/app/components/workflow/utils/__tests__/workflow.spec.tsindex 165b4d5ee69..d3a0e9e9249 100644--- a/web/app/components/workflow/utils/__tests__/workflow.spec.ts+++ b/web/app/components/workflow/utils/__tests__/workflow.spec.ts@@ -403,10 +403,10 @@ describe('changeNodesAndEdgesId', () => {const [newNodes, newEdges] = changeNodesAndEdgesId(nodes, edges)- expect(newNodes[0].id).not.toBe('old-1')- expect(newNodes[1].id).not.toBe('old-2')- expect(newEdges[0].source).toBe(newNodes[0].id)- expect(newEdges[0].target).toBe(newNodes[1].id)+ expect(newNodes[0]!.id).not.toBe('old-1')+ expect(newNodes[1]!.id).not.toBe('old-2')+ expect(newEdges[0]!.source).toBe(newNodes[0]!.id)+ expect(newEdges[0]!.target).toBe(newNodes[1]!.id)})it('should generate unique ids for all nodes', () => {diff --git a/web/app/components/workflow/utils/node.ts b/web/app/components/workflow/utils/node.tsindex b26e350b2a0..d6163ea1c83 100644--- a/web/app/components/workflow/utils/node.ts+++ b/web/app/components/workflow/utils/node.ts@@ -109,7 +109,7 @@ export const genNewNodeTitleFromOld = (oldTitle: string) => {if (match) {const title = match[1]- const num = Number.parseInt(match[2], 10)+ const num = Number.parseInt(match[2]!, 10)return `${title} (${num + 1})`}else {diff --git a/web/app/components/workflow/utils/workflow-init.ts b/web/app/components/workflow/utils/workflow-init.tsindex 77a2ccefaca..4cfe2ea3f94 100644--- a/web/app/components/workflow/utils/workflow-init.ts+++ b/web/app/components/workflow/utils/workflow-init.ts@@ -40,14 +40,14 @@ const isCyclicUtil = (nodeId: string, color: Record<string, string>, adjList: Recolor[nodeId] = GRAYstack.push(nodeId)- for (let i = 0; i < adjList[nodeId].length; ++i) {- const childId = adjList[nodeId][i]+ for (let i = 0; i < adjList[nodeId]!.length; ++i) {+ const childId = adjList[nodeId]![i]- if (color[childId] === GRAY) {- stack.push(childId)+ if (color[childId!] === GRAY) {+ stack.push(childId!)return true}- if (color[childId] === WHITE && isCyclicUtil(childId, color, adjList, stack))+ if (color[childId!] === WHITE && isCyclicUtil(childId!, color, adjList, stack))return true}color[nodeId] = BLACK@@ -70,8 +70,8 @@ const getCycleEdges = (nodes: Node[], edges: Edge[]) => {adjList[edge.source]?.push(edge.target)for (let i = 0; i < nodes.length; i++) {- if (color[nodes[i].id] === WHITE)- isCyclicUtil(nodes[i].id, color, adjList, stack)+ if (color[nodes[i]!.id] === WHITE)+ isCyclicUtil(nodes[i]!.id, color, adjList, stack)}const cycleEdges = []@@ -151,12 +151,12 @@ export const preprocessNodesAndEdges = (nodes: Node[], edges: Edge[]) => {const isIteration = nodeItem.data.type === BlockEnum.Iterationconst newNode = (isIteration ? newIterationStartNodesMap : newLoopStartNodesMap)[nodeItem.id]const startNode = nodesMap[nodeItem.data.start_node_id]- const source = newNode.id+ const source = newNode!.idconst sourceHandle = 'source'- const target = startNode.id+ const target = startNode!.idconst targetHandle = 'target'- const parentNode = nodes.find(node => node.id === startNode.parentId) || null+ const parentNode = nodes.find(node => node.id === startNode!.parentId) || nullconst isInIteration = !!parentNode && parentNode.data.type === BlockEnum.Iterationconst isInLoop = !!parentNode && parentNode.data.type === BlockEnum.Loop@@ -168,12 +168,12 @@ export const preprocessNodesAndEdges = (nodes: Node[], edges: Edge[]) => {target,targetHandle,data: {- sourceType: newNode.data.type,- targetType: startNode.data.type,+ sourceType: newNode!.data.type,+ targetType: startNode!.data.type,isInIteration,- iteration_id: isInIteration ? startNode.parentId : undefined,+ iteration_id: isInIteration ? startNode!.parentId : undefined,isInLoop,- loop_id: isInLoop ? startNode.parentId : undefined,+ loop_id: isInLoop ? startNode!.parentId : undefined,_connectedNodeIsSelected: true,},zIndex: isIteration ? ITERATION_CHILDREN_Z_INDEX : LOOP_CHILDREN_Z_INDEX,@@ -181,10 +181,10 @@ export const preprocessNodesAndEdges = (nodes: Node[], edges: Edge[]) => {})nodes.forEach((node) => {if (node.data.type === BlockEnum.Iteration && newIterationStartNodesMap[node.id])- (node.data as IterationNodeType).start_node_id = newIterationStartNodesMap[node.id].id+ (node.data as IterationNodeType).start_node_id = newIterationStartNodesMap[node.id]!.idif (node.data.type === BlockEnum.Loop && newLoopStartNodesMap[node.id])- (node.data as LoopNodeType).start_node_id = newLoopStartNodesMap[node.id].id+ (node.data as LoopNodeType).start_node_id = newLoopStartNodesMap[node.id]!.id})return {@@ -209,7 +209,7 @@ export const initialNodes = (originNodes: Node[], originEdges: Edge[]) => {const iterationOrLoopNodeMap = nodes.reduce((acc, node) => {if (node.parentId) {if (acc[node.parentId])- acc[node.parentId].push({ nodeId: node.id, nodeType: node.data.type })+ acc[node.parentId]!.push({ nodeId: node.id, nodeType: node.data.type })elseacc[node.parentId] = [{ nodeId: node.id, nodeType: node.data.type }]}@@ -338,14 +338,14 @@ export const initialEdges = (originEdges: Edge[], originNodes: Node[]) => {if (!edge.data?.sourceType && edge.source && nodesMap[edge.source]) {edge.data = {...edge.data,- sourceType: nodesMap[edge.source].data.type!,+ sourceType: nodesMap[edge.source]!.data.type!,} as any}if (!edge.data?.targetType && edge.target && nodesMap[edge.target]) {edge.data = {...edge.data,- targetType: nodesMap[edge.target].data.type!,+ targetType: nodesMap[edge.target]!.data.type!,} as any}diff --git a/web/app/components/workflow/variable-inspect/__tests__/group.spec.tsx b/web/app/components/workflow/variable-inspect/__tests__/group.spec.tsxindex 9c64466d568..f87bc3b896a 100644--- a/web/app/components/workflow/variable-inspect/__tests__/group.spec.tsx+++ b/web/app/components/workflow/variable-inspect/__tests__/group.spec.tsx@@ -71,7 +71,7 @@ describe('VariableInspect Group', () => {fireEvent.click(screen.getByText('API_KEY'))- expect(screen.getByText('workflow.debug.variableInspect.envNode')).toBeInTheDocument()+ expect(screen.getByText('workflow.debug.variableInspect.envNode'))!.toBeInTheDocument()expect(handleSelect).toHaveBeenCalledWith({nodeId: VarInInspectType.environment,nodeType: VarInInspectType.environment,@@ -97,7 +97,7 @@ describe('VariableInspect Group', () => {/>,)- expect(screen.getByText('visible_var')).toBeInTheDocument()+ expect(screen.getByText('visible_var'))!.toBeInTheDocument()expect(screen.queryByText('hidden_var')).not.toBeInTheDocument()fireEvent.click(screen.getByText('Code'))@@ -122,8 +122,8 @@ describe('VariableInspect Group', () => {const actionButtons = screen.getAllByRole('button')- fireEvent.click(actionButtons[0])- fireEvent.click(actionButtons[1])+ fireEvent.click(actionButtons[0]!)+ fireEvent.click(actionButtons[1]!)expect(handleView).toHaveBeenCalledTimes(1)expect(handleClear).toHaveBeenCalledTimes(1)diff --git a/web/app/components/workflow/variable-inspect/__tests__/panel.spec.tsx b/web/app/components/workflow/variable-inspect/__tests__/panel.spec.tsxindex cafed9ce4ee..0519fc4f94a 100644--- a/web/app/components/workflow/variable-inspect/__tests__/panel.spec.tsx+++ b/web/app/components/workflow/variable-inspect/__tests__/panel.spec.tsx@@ -139,7 +139,7 @@ describe('VariableInspect Panel', () => {fireEvent.click(screen.getByRole('button', { name: 'workflow.debug.variableInspect.listening.stopButton' }))- expect(screen.getByText('workflow.debug.variableInspect.listening.title')).toBeInTheDocument()+ expect(screen.getByText('workflow.debug.variableInspect.listening.title'))!.toBeInTheDocument()expect(mockEmit).toHaveBeenCalledWith({type: EVENT_WORKFLOW_STOP,})@@ -150,9 +150,9 @@ describe('VariableInspect Panel', () => {showVariableInspectPanel: true,})- fireEvent.click(screen.getAllByRole('button')[0])+ fireEvent.click(screen.getAllByRole('button')[0]!)- expect(screen.getByText('workflow.debug.variableInspect.emptyTip')).toBeInTheDocument()+ expect(screen.getByText('workflow.debug.variableInspect.emptyTip'))!.toBeInTheDocument()expect(store.getState().showVariableInspectPanel).toBe(false)})@@ -166,8 +166,8 @@ describe('VariableInspect Panel', () => {await waitFor(() => expect(screen.getAllByText('API_KEY').length).toBeGreaterThan(1))- expect(screen.getByText('workflow.debug.variableInspect.envNode')).toBeInTheDocument()+ expect(screen.getByText('workflow.debug.variableInspect.envNode'))!.toBeInTheDocument()expect(screen.getAllByText('string').length).toBeGreaterThan(0)- expect(screen.getByText('env-value')).toBeInTheDocument()+ expect(screen.getByText('env-value'))!.toBeInTheDocument()})})diff --git a/web/app/components/workflow/variable-inspect/__tests__/value-content-sections.spec.tsx b/web/app/components/workflow/variable-inspect/__tests__/value-content-sections.spec.tsxindex 52d0c285874..2ebe5271046 100644--- a/web/app/components/workflow/variable-inspect/__tests__/value-content-sections.spec.tsx+++ b/web/app/components/workflow/variable-inspect/__tests__/value-content-sections.spec.tsx@@ -98,7 +98,7 @@ describe('value-content sections', () => {const onChange = vi.fn()render(<BoolArraySection values={[true, false]} onChange={onChange} />)- fireEvent.click(screen.getAllByText('True')[1])+ fireEvent.click(screen.getAllByText('True')[1]!)expect(onChange).toHaveBeenCalledWith([true, true])})@@ -123,8 +123,8 @@ describe('value-content sections', () => {fireEvent.change(screen.getByTestId('schema-editor'), { target: { value: '{"foo":1}' } })expect(onChange).toHaveBeenCalledWith('{"foo":1}')- expect(screen.getByText('Broken JSON')).toBeInTheDocument()- expect(screen.getByText('Too deep')).toBeInTheDocument()+ expect(screen.getByText('Broken JSON'))!.toBeInTheDocument()+ expect(screen.getByText('Too deep'))!.toBeInTheDocument()})it('should render chunk preview when the json editor has chunks', () => {@@ -140,7 +140,7 @@ describe('value-content sections', () => {/>,)- expect(screen.getByTestId('schema-editor')).toBeInTheDocument()+ expect(screen.getByTestId('schema-editor'))!.toBeInTheDocument()})it('should render the file editor section', () => {diff --git a/web/app/components/workflow/variable-inspect/value-content-sections.tsx b/web/app/components/workflow/variable-inspect/value-content-sections.tsxindex b1682ce990a..8d892343cd8 100644--- a/web/app/components/workflow/variable-inspect/value-content-sections.tsx+++ b/web/app/components/workflow/variable-inspect/value-content-sections.tsx@@ -155,10 +155,10 @@ export const FileEditorSection = ({SupportUploadFileTypes.video,],allowed_file_extensions: [- ...FILE_EXTS[SupportUploadFileTypes.image],- ...FILE_EXTS[SupportUploadFileTypes.document],- ...FILE_EXTS[SupportUploadFileTypes.audio],- ...FILE_EXTS[SupportUploadFileTypes.video],+ ...(FILE_EXTS[SupportUploadFileTypes.image] ?? []),+ ...(FILE_EXTS[SupportUploadFileTypes.document] ?? []),+ ...(FILE_EXTS[SupportUploadFileTypes.audio] ?? []),+ ...(FILE_EXTS[SupportUploadFileTypes.video] ?? []),],allowed_file_upload_methods: [TransferMethod.local_file, TransferMethod.remote_url],number_limits: currentVar.value_type === 'file' ? 1 : fileUploadConfig?.workflow_file_upload_limit || 5,diff --git a/web/app/components/workflow/variable-inspect/value-content.tsx b/web/app/components/workflow/variable-inspect/value-content.tsxindex aaff853fc6f..a87f37e3c29 100644--- a/web/app/components/workflow/variable-inspect/value-content.tsx+++ b/web/app/components/workflow/variable-inspect/value-content.tsx@@ -119,7 +119,7 @@ const ValueContent = ({if (contentContainerRef.current && errorMessageRef.current) {const errorMessageObserver = new ResizeObserver((entries) => {for (const entry of entries) {- const { inlineSize } = entry.borderBoxSize[0]+ const { inlineSize } = entry.borderBoxSize[0]!const height = (contentContainerRef.current as any).clientHeight - inlineSizesetEditorHeight(height)}diff --git a/web/app/components/workflow/workflow-preview/components/__tests__/zoom-in-out.spec.tsx b/web/app/components/workflow/workflow-preview/components/__tests__/zoom-in-out.spec.tsxindex 810116f9974..4991ae7b04e 100644--- a/web/app/components/workflow/workflow-preview/components/__tests__/zoom-in-out.spec.tsx+++ b/web/app/components/workflow/workflow-preview/components/__tests__/zoom-in-out.spec.tsx@@ -35,9 +35,9 @@ const getZoomControls = () => {throw new Error('Missing zoom controls')return {- zoomOutTrigger: icons[0].parentElement as HTMLElement,+ zoomOutTrigger: icons[0]!.parentElement as HTMLElement,label,- zoomInTrigger: icons[1].parentElement as HTMLElement,+ zoomInTrigger: icons[1]!.parentElement as HTMLElement,}}diff --git a/web/app/components/workflow/workflow-preview/components/nodes/loop/__tests__/hooks.spec.tsx b/web/app/components/workflow/workflow-preview/components/nodes/loop/__tests__/hooks.spec.tsxindex 40156711aa0..5d93983a4a1 100644--- a/web/app/components/workflow/workflow-preview/components/nodes/loop/__tests__/hooks.spec.tsx+++ b/web/app/components/workflow/workflow-preview/components/nodes/loop/__tests__/hooks.spec.tsx@@ -46,7 +46,7 @@ describe('workflow preview loop interactions', () => {result.current.handleNodeLoopRerender('loop-node')expect(mockSetNodes).toHaveBeenCalledTimes(1)- const updatedLoopNode = mockSetNodes.mock.calls[0][0].find((node: Node) => node.id === 'loop-node')+ const updatedLoopNode = mockSetNodes.mock.calls[0]![0].find((node: Node) => node.id === 'loop-node')expect(updatedLoopNode.width).toBe(100 + 60 + LOOP_PADDING.right)expect(updatedLoopNode.height).toBe(90 + 40 + LOOP_PADDING.bottom)})diff --git a/web/app/components/workflow/workflow-preview/components/note-node/index.tsx b/web/app/components/workflow/workflow-preview/components/note-node/index.tsxindex 38dee9d6d07..c9b2d8cdbe2 100644--- a/web/app/components/workflow/workflow-preview/components/note-node/index.tsx+++ b/web/app/components/workflow/workflow-preview/components/note-node/index.tsx@@ -23,8 +23,8 @@ const NoteNode = ({<divclassName={cn('relative flex flex-col rounded-md border shadow-xs hover:shadow-md',- THEME_MAP[theme].bg,- data.selected ? THEME_MAP[theme].border : 'border-black/5',+ THEME_MAP[theme]!.bg,+ data.selected ? THEME_MAP[theme]!.border : 'border-black/5',)}style={{width: data.width,@@ -40,7 +40,7 @@ const NoteNode = ({<divclassName={cn('h-2 shrink-0 rounded-t-md opacity-50',- THEME_MAP[theme].title,+ THEME_MAP[theme]!.title,)}></div>diff --git a/web/app/signin/invite-settings/page.tsx b/web/app/signin/invite-settings/page.tsxindex fc9bdf6b0ae..91973f07f9f 100644--- a/web/app/signin/invite-settings/page.tsx+++ b/web/app/signin/invite-settings/page.tsx@@ -55,7 +55,7 @@ export default function InviteSettingsPage() {})if (res.result === 'success') {// Tokens are now stored in cookies by the backend- await setLocaleOnClient(language, false)+ await setLocaleOnClient(language!, false)const redirectUrl = resolvePostLoginRedirect()router.replace(redirectUrl || '/apps')}diff --git a/web/context/modal-context.test.tsx b/web/context/modal-context.test.tsxindex 6fac2e0cd59..ce5efdb8d99 100644--- a/web/context/modal-context.test.tsx+++ b/web/context/modal-context.test.tsx@@ -112,7 +112,7 @@ describe('ModalContextProvider trigger events limit modal', () => {renderProvider()- await waitFor(() => expect(screen.getByTestId('trigger-limit-modal')).toBeInTheDocument())+ await waitFor(() => expect(screen.getByTestId('trigger-limit-modal'))!.toBeInTheDocument())expect(latestTriggerEventsModalProps).toMatchObject({usage: 3000,total: 3000,@@ -127,7 +127,7 @@ describe('ModalContextProvider trigger events limit modal', () => {await waitFor(() => {expect(setItemSpy.mock.calls.length).toBeGreaterThan(0)})- const [key, value] = setItemSpy.mock.calls[0]+ const [key, value] = (setItemSpy.mock.calls[0] ?? []) as [any, any]expect(key).toContain('trigger-events-limit-dismissed-workspace-1-professional-3000-')expect(value).toBe('1')})@@ -150,7 +150,7 @@ describe('ModalContextProvider trigger events limit modal', () => {renderProvider()- await waitFor(() => expect(screen.getByTestId('trigger-limit-modal')).toBeInTheDocument())+ await waitFor(() => expect(screen.getByTestId('trigger-limit-modal'))!.toBeInTheDocument())act(() => {latestTriggerEventsModalProps.onClose()@@ -178,7 +178,7 @@ describe('ModalContextProvider trigger events limit modal', () => {renderProvider()- await waitFor(() => expect(screen.getByTestId('trigger-limit-modal')).toBeInTheDocument())+ await waitFor(() => expect(screen.getByTestId('trigger-limit-modal'))!.toBeInTheDocument())act(() => {latestTriggerEventsModalProps.onClose()diff --git a/web/eslint-suppressions.json b/web/eslint-suppressions.jsonindex a53c1b4de91..db5a22797c4 100644--- a/web/eslint-suppressions.json+++ b/web/eslint-suppressions.json@@ -400,6 +400,11 @@"count": 3}},+ "app/components/app/configuration/config-var/__tests__/index.spec.tsx": {+ "ts/no-explicit-any": {+ "count": 2+ }+ },"app/components/app/configuration/config-var/config-modal/index.tsx": {"no-restricted-imports": {"count": 1@@ -564,6 +569,11 @@"count": 1}},+ "app/components/app/configuration/dataset-config/params-config/__tests__/config-content.spec.tsx": {+ "ts/no-explicit-any": {+ "count": 1+ }+ },"app/components/app/configuration/dataset-config/params-config/config-content.tsx": {"no-restricted-imports": {"count": 1@@ -600,6 +610,11 @@"count": 1}},+ "app/components/app/configuration/debug/__tests__/index.spec.tsx": {+ "ts/no-explicit-any": {+ "count": 1+ }+ },"app/components/app/configuration/debug/chat-user-input.tsx": {"no-restricted-imports": {"count": 1@@ -1158,6 +1173,9 @@"app/components/base/chat/chat/index.tsx": {"ts/no-explicit-any": {"count": 3+ },+ "ts/no-non-null-asserted-optional-chain": {+ "count": 1}},"app/components/base/chat/chat/type.ts": {@@ -1887,6 +1905,11 @@"count": 1}},+ "app/components/base/image-uploader/__tests__/utils.spec.ts": {+ "ts/no-explicit-any": {+ "count": 3+ }+ },"app/components/base/image-uploader/audio-preview.tsx": {"tailwindcss/enforce-consistent-class-order": {"count": 1@@ -2368,6 +2391,11 @@"count": 2}},+ "app/components/base/prompt-editor/utils.ts": {+ "ts/no-explicit-any": {+ "count": 4+ }+ },"app/components/base/prompt-log-modal/card.tsx": {"tailwindcss/enforce-consistent-class-order": {"count": 1@@ -2534,6 +2562,11 @@"count": 1}},+ "app/components/base/tag-management/__tests__/panel.spec.tsx": {+ "ts/no-explicit-any": {+ "count": 2+ }+ },"app/components/base/tag-management/index.tsx": {"no-restricted-imports": {"count": 1@@ -2600,6 +2633,11 @@"count": 1}},+ "app/components/base/voice-input/__tests__/index.spec.tsx": {+ "ts/no-explicit-any": {+ "count": 3+ }+ },"app/components/base/voice-input/index.stories.tsx": {"no-console": {"count": 2@@ -2642,6 +2680,11 @@"count": 1}},+ "app/components/billing/billing-page/__tests__/index.spec.tsx": {+ "ts/no-explicit-any": {+ "count": 4+ }+ },"app/components/billing/plan-upgrade-modal/index.tsx": {"no-restricted-imports": {"count": 1@@ -3242,6 +3285,11 @@"count": 1}},+ "app/components/datasets/documents/detail/completed/components/segment-list-content.tsx": {+ "ts/no-non-null-asserted-optional-chain": {+ "count": 1+ }+ },"app/components/datasets/documents/detail/completed/display-toggle.tsx": {"no-restricted-imports": {"count": 1@@ -3333,6 +3381,11 @@"count": 1}},+ "app/components/datasets/documents/detail/metadata/components/metadata-field-list.tsx": {+ "ts/no-non-null-asserted-optional-chain": {+ "count": 1+ }+ },"app/components/datasets/documents/detail/metadata/hooks/use-metadata-state.ts": {"react-hooks-extra/no-direct-set-state-in-use-effect": {"count": 4@@ -3497,6 +3550,9 @@"app/components/datasets/metadata/hooks/use-metadata-document.ts": {"ts/no-explicit-any": {"count": 1+ },+ "ts/no-non-null-asserted-optional-chain": {+ "count": 2}},"app/components/datasets/metadata/metadata-dataset/create-content.tsx": {@@ -4050,6 +4106,11 @@"count": 2}},+ "app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/__tests__/use-activate-credential.spec.tsx": {+ "ts/no-explicit-any": {+ "count": 2+ }+ },"app/components/header/account-setting/model-provider-page/provider-added-card/model-auth-dropdown/credits-fallback-alert.tsx": {"tailwindcss/enforce-consistent-class-order": {"count": 3@@ -4163,6 +4224,11 @@"count": 2}},+ "app/components/plugins/card/index.tsx": {+ "ts/no-non-null-asserted-optional-chain": {+ "count": 1+ }+ },"app/components/plugins/install-plugin/hooks.ts": {"ts/no-explicit-any": {"count": 4@@ -4462,6 +4528,11 @@"count": 2}},+ "app/components/plugins/plugin-detail-panel/subscription-list/__tests__/index.spec.tsx": {+ "ts/no-explicit-any": {+ "count": 2+ }+ },"app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx": {"no-restricted-imports": {"count": 1@@ -5570,6 +5641,9 @@"app/components/workflow/nodes/_base/components/before-run-form/form.tsx": {"ts/no-explicit-any": {"count": 3+ },+ "ts/no-non-null-asserted-optional-chain": {+ "count": 1}},"app/components/workflow/nodes/_base/components/before-run-form/index.tsx": {@@ -5832,6 +5906,11 @@"count": 1}},+ "app/components/workflow/nodes/_base/components/variable/output-var-list.tsx": {+ "ts/no-non-null-asserted-optional-chain": {+ "count": 1+ }+ },"app/components/workflow/nodes/_base/components/variable/utils.ts": {"ts/no-explicit-any": {"count": 32@@ -6282,6 +6361,9 @@},"ts/no-explicit-any": {"count": 2+ },+ "ts/no-non-null-asserted-optional-chain": {+ "count": 1}},"app/components/workflow/nodes/human-input/components/delivery-method/upgrade-modal.tsx": {@@ -6849,6 +6931,11 @@"count": 2}},+ "app/components/workflow/nodes/loop/use-single-run-form-params.helpers.ts": {+ "ts/no-non-null-asserted-optional-chain": {+ "count": 1+ }+ },"app/components/workflow/nodes/loop/use-single-run-form-params.ts": {"ts/no-explicit-any": {"count": 3@@ -7146,6 +7233,11 @@"count": 1}},+ "app/components/workflow/nodes/trigger-webhook/components/parameter-table.tsx": {+ "ts/no-non-null-asserted-optional-chain": {+ "count": 1+ }+ },"app/components/workflow/nodes/trigger-webhook/default.ts": {"ts/no-explicit-any": {"count": 1@@ -7448,6 +7540,11 @@"count": 1}},+ "app/components/workflow/run/loop-log/__tests__/loop-log-trigger.spec.tsx": {+ "ts/no-explicit-any": {+ "count": 3+ }+ },"app/components/workflow/run/loop-log/index.tsx": {"no-barrel-files/no-barrel-files": {"count": 2@@ -7580,6 +7677,11 @@"count": 1}},+ "app/components/workflow/utils/__tests__/node-navigation.spec.ts": {+ "ts/no-explicit-any": {+ "count": 3+ }+ },"app/components/workflow/utils/data-source.ts": {"ts/no-explicit-any": {"count": 1@@ -7840,7 +7942,7 @@},"context/modal-context.test.tsx": {"ts/no-explicit-any": {- "count": 3+ "count": 5}},"context/modal-context.ts": {@@ -8009,6 +8111,11 @@"count": 1}},+ "plugins/dev-proxy/server.spec.ts": {+ "ts/no-explicit-any": {+ "count": 1+ }+ },"scripts/component-analyzer.js": {"regexp/no-unused-capturing-group": {"count": 6@@ -8117,6 +8224,9 @@},"ts/no-explicit-any": {"count": 3+ },+ "ts/no-non-null-asserted-optional-chain": {+ "count": 1}},"service/use-tools.ts": {diff --git a/web/hooks/use-app-favicon.ts b/web/hooks/use-app-favicon.tsindex 32b8f6893a9..6d1ba9979ce 100644--- a/web/hooks/use-app-favicon.ts+++ b/web/hooks/use-app-favicon.ts@@ -39,6 +39,6 @@ export function useAppFavicon(options: UseAppFaviconOptions) {link.rel = 'shortcut icon'link.type = 'image/svg'- document.getElementsByTagName('head')[0].appendChild(link)+ document.getElementsByTagName('head')[0]!.appendChild(link)}, [enable, icon, icon_background])}diff --git a/web/hooks/use-async-window-open.spec.ts b/web/hooks/use-async-window-open.spec.tsindex 5441481d1f1..f51d0c6bef1 100644--- a/web/hooks/use-async-window-open.spec.ts+++ b/web/hooks/use-async-window-open.spec.ts@@ -68,7 +68,7 @@ describe('useAsyncWindowOpen', () => {})expect(onError).toHaveBeenCalled()- const errArg = onError.mock.calls[0][0] as Error+ const errArg = onError.mock.calls[0]![0] as Errorexpect(errArg.message).toBe('Failed to open new window')expect(getUrl).not.toHaveBeenCalled()})@@ -160,7 +160,7 @@ describe('useAsyncWindowOpen', () => {expect(close).toHaveBeenCalled()expect(onError).toHaveBeenCalled()- const errArg = onError.mock.calls[0][0] as Error+ const errArg = onError.mock.calls[0]![0] as Errorexpect(errArg.message).toBe('No url resolved for new window')})@@ -176,7 +176,7 @@ describe('useAsyncWindowOpen', () => {})expect(onError).toHaveBeenCalled()- const errArg = onError.mock.calls[0][0] as Error+ const errArg = onError.mock.calls[0]![0] as Errorexpect(errArg.message).toBe('Failed to open new window')expect(getUrl).not.toHaveBeenCalled()})diff --git a/web/hooks/use-query-params.spec.tsx b/web/hooks/use-query-params.spec.tsxindex ef744742cf0..8c51bea1e2e 100644--- a/web/hooks/use-query-params.spec.tsx+++ b/web/hooks/use-query-params.spec.tsx@@ -79,7 +79,7 @@ describe('useQueryParams hooks', () => {// Assertawait waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.get(PRICING_MODAL_QUERY_PARAM)).toBe(PRICING_MODAL_QUERY_VALUE)})@@ -94,7 +94,7 @@ describe('useQueryParams hooks', () => {// Assertawait waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.options.history).toBe('push')})@@ -112,7 +112,7 @@ describe('useQueryParams hooks', () => {// Assertawait waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.has(PRICING_MODAL_QUERY_PARAM)).toBe(false)})@@ -130,7 +130,7 @@ describe('useQueryParams hooks', () => {// Assertawait waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.options.history).toBe('push')})@@ -145,7 +145,7 @@ describe('useQueryParams hooks', () => {// Assertawait waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.options.history).toBe('replace')})})@@ -205,7 +205,7 @@ describe('useQueryParams hooks', () => {// Assertawait waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.get('action')).toBe(ACCOUNT_SETTING_MODAL_ACTION)expect(update.searchParams.get('tab')).toBe('members')})@@ -221,7 +221,7 @@ describe('useQueryParams hooks', () => {// Assertawait waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.options.history).toBe('push')})@@ -239,7 +239,7 @@ describe('useQueryParams hooks', () => {// Assertawait waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.get('tab')).toBe('provider')})@@ -257,7 +257,7 @@ describe('useQueryParams hooks', () => {// Assertawait waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.options.history).toBe('replace')})@@ -275,7 +275,7 @@ describe('useQueryParams hooks', () => {// Assertawait waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.has('action')).toBe(false)expect(update.searchParams.has('tab')).toBe(false)})@@ -294,7 +294,7 @@ describe('useQueryParams hooks', () => {// Assertawait waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.options.history).toBe('replace')})})@@ -356,7 +356,7 @@ describe('useQueryParams hooks', () => {// Assertawait waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.get('package-ids')).toBe('["org/plugin"]')})@@ -372,7 +372,7 @@ describe('useQueryParams hooks', () => {// Assertawait waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.get('bundle-info')).toBe(JSON.stringify(bundleInfo))})@@ -391,7 +391,7 @@ describe('useQueryParams hooks', () => {// Assertawait waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.has('package-ids')).toBe(false)expect(update.searchParams.has('bundle-info')).toBe(false)})@@ -411,7 +411,7 @@ describe('useQueryParams hooks', () => {// Assertawait waitFor(() => expect(onUrlUpdate).toHaveBeenCalled())- const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1][0]+ const update = onUrlUpdate.mock.calls[onUrlUpdate.mock.calls.length - 1]![0]expect(update.searchParams.get('bundle-info')).toBe(JSON.stringify(bundleInfo))})})diff --git a/web/i18n-config/index.ts b/web/i18n-config/index.tsindex e24fd8533d0..ff8bd4ff029 100644--- a/web/i18n-config/index.ts+++ b/web/i18n-config/index.ts@@ -26,5 +26,5 @@ export const renderI18nObject = (obj: Record<string, string>, language: string)return obj[language]if (obj?.en_US)return obj.en_US- return Object.values(obj)[0]+ return Object.values(obj)[0]!}diff --git a/web/i18n-config/language.ts b/web/i18n-config/language.tsindex 397c361cdae..343a634abcd 100644--- a/web/i18n-config/language.ts+++ b/web/i18n-config/language.ts@@ -14,7 +14,7 @@ export const getLanguage = (locale: Locale): Locale => {if (['zh-Hans', 'ja-JP'].includes(locale))return locale.replace('-', '_') as Locale- return LanguagesSupported[0].replace('-', '_') as Locale+ return LanguagesSupported[0]!.replace('-', '_') as Locale}const DOC_LANGUAGE: Record<string, DocLanguage | undefined> = {diff --git a/web/knip.config.ts b/web/knip.config.tsindex 2700e007178..2a81d06141b 100644--- a/web/knip.config.ts+++ b/web/knip.config.ts@@ -17,9 +17,7 @@ const config: KnipConfig = {],ignoreDependencies: ['@iconify-json/*',-'@storybook/addon-onboarding',-],/// keep-sortedrules: {diff --git a/web/plugins/dev-proxy/cookies.ts b/web/plugins/dev-proxy/cookies.tsindex a7444938926..c606322e969 100644--- a/web/plugins/dev-proxy/cookies.ts+++ b/web/plugins/dev-proxy/cookies.ts@@ -57,13 +57,13 @@ export const rewriteCookieHeaderForUpstream = (cookieHeader?: string) => {const rewriteSetCookieValueForLocal = (setCookieValue: string) => {const [rawCookiePair, ...rawAttributes] = setCookieValue.split(';')- const separatorIndex = rawCookiePair.indexOf('=')+ const separatorIndex = rawCookiePair!.indexOf('=')if (separatorIndex === -1)return setCookieValue- const cookieName = rawCookiePair.slice(0, separatorIndex).trim()- const cookieValue = rawCookiePair.slice(separatorIndex + 1)+ const cookieName = rawCookiePair!.slice(0, separatorIndex).trim()+ const cookieValue = rawCookiePair!.slice(separatorIndex + 1)const rewrittenAttributes = rawAttributes.map(attribute => attribute.trim()).filter(attribute =>diff --git a/web/plugins/dev-proxy/server.spec.ts b/web/plugins/dev-proxy/server.spec.tsindex c57ec8b4feb..d9c9ee22ba8 100644--- a/web/plugins/dev-proxy/server.spec.ts+++ b/web/plugins/dev-proxy/server.spec.ts@@ -75,7 +75,7 @@ describe('dev proxy server', () => {}),)- const [, requestInit] = fetchImpl.mock.calls[0]+ const [, requestInit] = (fetchImpl.mock.calls[0] ?? []) as [unknown, any]const requestHeaders = requestInit?.headers as Headersexpect(requestHeaders.get('cookie')).toBe('__Host-access_token=abc')expect(requestHeaders.get('origin')).toBe('https://cloud.dify.ai')diff --git a/web/plugins/vite/utils.ts b/web/plugins/vite/utils.tsindex 52bcc5bbbe9..67f00074f98 100644--- a/web/plugins/vite/utils.ts+++ b/web/plugins/vite/utils.ts@@ -1,8 +1,8 @@export const normalizeViteModuleId = (id: string): string => {- const withoutQuery = id.split('?', 1)[0]+ const withoutQuery = id.split('?', 1)[0]!- if (withoutQuery.startsWith('/@fs/'))- return withoutQuery.slice('/@fs'.length)+ if (withoutQuery!.startsWith('/@fs/'))+ return withoutQuery!.slice('/@fs'.length)return withoutQuery}diff --git a/web/scripts/analyze-i18n-diff.ts b/web/scripts/analyze-i18n-diff.tsindex bd830c55237..44e8c675f93 100644--- a/web/scripts/analyze-i18n-diff.ts+++ b/web/scripts/analyze-i18n-diff.ts@@ -241,11 +241,11 @@ function analyzeFile(baseName: string): AnalysisResult {// Check for changed valuesfor (const [key, oldValue] of Object.entries(mainFlat)) {- if (key in currentContent && !valuesEqual(currentContent[key], oldValue)) {+ if (key in currentContent && !valuesEqual(currentContent[key]!, oldValue)) {result.changedValues.push({key,oldValue,- newValue: currentContent[key],+ newValue: currentContent[key]!,})}}diff --git a/web/scripts/gen-doc-paths.ts b/web/scripts/gen-doc-paths.tsindex e5cf8aeb584..fd9cdea02a5 100644--- a/web/scripts/gen-doc-paths.ts+++ b/web/scripts/gen-doc-paths.ts@@ -227,10 +227,10 @@ function groupPathsBySection(paths: Set<string>): Record<string, Set<string>> {const parts = withoutLang.split('/')const section = parts[0]- if (!groups[section])- groups[section] = new Set()+ if (!groups[section!])+ groups[section!] = new Set()- groups[section].add(withoutLang)+ groups[section!]!.add(withoutLang)}return groups@@ -334,10 +334,10 @@ function generateTypeDefinitions(for (const enPath of sortedEnPaths) {const translations = apiPathTranslations[enPath]const parts: string[] = []- if (translations.zh)- parts.push(`zh: '${translations.zh}'`)- if (translations.ja)- parts.push(`ja: '${translations.ja}'`)+ if (translations!.zh)+ parts.push(`zh: '${translations!.zh}'`)+ if (translations!.ja)+ parts.push(`ja: '${translations!.ja}'`)if (parts.length > 0)lines.push(` '${enPath}': { ${parts.join(', ')} },`)}@@ -387,7 +387,7 @@ async function main(): Promise<void> {console.log(`Fetching OpenAPI spec: ${openapiPath}`)const pathMap = await fetchOpenAPIAndExtractPaths(openapiPath)- endpointMapsByLang[lang].set(fileKey, pathMap)+ endpointMapsByLang[lang!]!.set(fileKey, pathMap)}// Build English paths and mapping to other languages@@ -395,9 +395,9 @@ async function main(): Promise<void> {const apiPathTranslations: Record<string, { zh?: string, ja?: string }> = {}// Iterate through English endpoint maps- for (const [fileKey, enPathMap] of endpointMapsByLang.en) {- const zhPathMap = endpointMapsByLang.zh.get(fileKey)- const jaPathMap = endpointMapsByLang.ja.get(fileKey)+ for (const [fileKey, enPathMap] of endpointMapsByLang.en!) {+ const zhPathMap = endpointMapsByLang.zh!.get(fileKey)+ const jaPathMap = endpointMapsByLang.ja!.get(fileKey)for (const [endpointKey, enPath] of enPathMap) {enApiPaths.push(enPath)diff --git a/web/service/base.ts b/web/service/base.tsindex ad4f8cef44a..2063b5bc37e 100644--- a/web/service/base.ts+++ b/web/service/base.ts@@ -360,7 +360,7 @@ export const handleStream = (}}})- buffer = lines[lines.length - 1]+ buffer = lines[lines.length - 1]!}catch (e) {onData('', false, {@@ -403,7 +403,7 @@ export const upload = async (options: UploadOptions, isPublicAPI?: boolean, url?url: (url ? `${urlPrefix}${url}` : `${urlPrefix}/files/upload`) + (searchParams || ''),headers: {[CSRF_HEADER_NAME]: Cookies.get(CSRF_COOKIE_NAME()) || '',- [PASSPORT_HEADER_NAME]: getWebAppPassport(shareCode),+ [PASSPORT_HEADER_NAME]: getWebAppPassport(shareCode!),[WEB_APP_SHARE_CODE_HEADER_NAME]: shareCode,},}@@ -417,7 +417,7 @@ export const upload = async (options: UploadOptions, isPublicAPI?: boolean, url?const xhr = mergedOptions.xhrxhr.open(mergedOptions.method, mergedOptions.url)for (const key in mergedOptions.headers)- xhr.setRequestHeader(key, mergedOptions.headers[key])+ xhr.setRequestHeader(key, mergedOptions.headers[key]!)xhr.withCredentials = truexhr.responseType = 'json'@@ -481,14 +481,14 @@ export const ssePost = async (// No need to get token from localStorage, cookies will be sent automaticallyconst baseOptions = getBaseOptions()- const shareCode = globalThis.location.pathname.split('/').slice(-1)[0]+ const shareCode = globalThis.location.pathname.split('/').slice(-1)[0]!const options = Object.assign({}, baseOptions, {method: 'POST',signal: abortController.signal,headers: new Headers({- [CSRF_HEADER_NAME]: Cookies.get(CSRF_COOKIE_NAME()) || '',+ [CSRF_HEADER_NAME]: Cookies.get(CSRF_COOKIE_NAME())! || '',[WEB_APP_SHARE_CODE_HEADER_NAME]: shareCode,- [PASSPORT_HEADER_NAME]: getWebAppPassport(shareCode),+ [PASSPORT_HEADER_NAME]: getWebAppPassport(shareCode!),}),} as RequestInit, fetchOptions)@@ -633,13 +633,13 @@ export const sseGet = async (const abortController = new AbortController()const baseOptions = getBaseOptions()- const shareCode = globalThis.location.pathname.split('/').slice(-1)[0]+ const shareCode = globalThis.location.pathname.split('/').slice(-1)[0]!const options = Object.assign({}, baseOptions, {signal: abortController.signal,headers: new Headers({- [CSRF_HEADER_NAME]: Cookies.get(CSRF_COOKIE_NAME()) || '',+ [CSRF_HEADER_NAME]: Cookies.get(CSRF_COOKIE_NAME())! || '',[WEB_APP_SHARE_CODE_HEADER_NAME]: shareCode,- [PASSPORT_HEADER_NAME]: getWebAppPassport(shareCode),+ [PASSPORT_HEADER_NAME]: getWebAppPassport(shareCode!),}),} as RequestInit, fetchOptions)diff --git a/web/service/knowledge/use-create-dataset.ts b/web/service/knowledge/use-create-dataset.tsindex 297bb44827e..9c511b5fd6a 100644--- a/web/service/knowledge/use-create-dataset.ts+++ b/web/service/knowledge/use-create-dataset.ts@@ -39,7 +39,7 @@ export const getNotionInfo = (return {credential_id: credentialId,workspace_id: workspace.workspaceId,- pages: workspace.pages.map((page) => {+ pages: workspace.pages!.map((page) => {const { page_id, page_name, page_icon, type } = pagereturn {page_id,diff --git a/web/service/use-plugins.ts b/web/service/use-plugins.tsindex a4296628f2c..6004ecde56d 100644--- a/web/service/use-plugins.ts+++ b/web/service/use-plugins.ts@@ -162,7 +162,7 @@ export const useInstalledPluginList = (disable?: boolean, pageSize = 100) => {})const plugins = data?.pages.flatMap(page => page.plugins) ?? []- const total = data?.pages[0].total ?? 0+ const total = data?.pages[0]!.total ?? 0return {data: disable@@ -336,7 +336,7 @@ export const useInstallOrUpdate = ({}if (item.type === 'marketplace') {const data = item as GitHubItemAndMarketPlaceDependency- uniqueIdentifier = data.value.marketplace_plugin_unique_identifier! || plugin[i]?.plugin_id+ uniqueIdentifier = data.value.marketplace_plugin_unique_identifier! || plugin[i]?.plugin_id!if (uniqueIdentifier === installedPayload?.uniqueIdentifier) {return {status: TaskStatus.success,@@ -615,7 +615,7 @@ export const usePluginInfo = (providerName?: string) => {const org = parts[0]const name = parts[1]try {- const response = await fetchPluginInfoFromMarketPlace({ org, name })+ const response = await fetchPluginInfoFromMarketPlace({ org: org!, name: name! })return response.data.plugin.category === PluginCategoryEnum.model ? response.data.plugin : null}catch {diff --git a/web/tsconfig.json b/web/tsconfig.jsonindex 6df4f56bf1f..003da18aa2f 100644--- a/web/tsconfig.json+++ b/web/tsconfig.json@@ -25,6 +25,7 @@],"allowJs": true,"strict": true,+ "noUncheckedIndexedAccess": true,"noEmit": true,"esModuleInterop": true,"forceConsistentCasingInFileNames": true,diff --git a/web/utils/emoji.ts b/web/utils/emoji.tsindex 7d58f12b45a..ec961dd69a6 100644--- a/web/utils/emoji.ts+++ b/web/utils/emoji.ts@@ -5,7 +5,7 @@ export async function searchEmoji(value: string) {const emojis: Emoji[] = await SearchIndex.search(value) || []const results = emojis.map((emoji) => {- return emoji.skins[0].native+ return emoji.skins[0]!.native})return results}diff --git a/web/utils/error-parser.ts b/web/utils/error-parser.tsindex f19bad3add5..56acdd9cea5 100644--- a/web/utils/error-parser.ts+++ b/web/utils/error-parser.ts@@ -35,7 +35,7 @@ export const parsePluginErrorMessage = async (error: any): Promise<string> => {if (match) {try {- const errorData = JSON.parse(match[1])+ const errorData = JSON.parse(match[1]!)// Return the inner message if existsif (errorData.message)return errorData.messagediff --git a/web/utils/format.ts b/web/utils/format.tsindex 804a2c1180e..1e6df2ea8c4 100644--- a/web/utils/format.ts+++ b/web/utils/format.ts@@ -43,9 +43,9 @@ export const formatNumber = (num: number | string) => {let precision: numberif (match) {// Scientific notation: precision is exponent + decimal digits in mantissa- const exponent = Number.parseInt(match[1], 10)+ const exponent = Number.parseInt(match[1]!, 10)const mantissa = str.split('e')[0]- const mantissaDecimalPart = mantissa.split('.')[1]+ const mantissaDecimalPart = mantissa!.split('.')[1]precision = exponent + (mantissaDecimalPart?.length || 0)}else {@@ -60,7 +60,7 @@ export const formatNumber = (num: number | string) => {}const parts = numStr.split('.')- parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',')+ parts[0] = parts[0]!.replace(/\B(?=(\d{3})+(?!\d))/g, ',')return parts.join('.')}@@ -125,8 +125,8 @@ export const formatNumberAbbreviated = (num: number) => {]for (let i = 0; i < units.length; i++) {- if (num >= units[i].value) {- const value = num / units[i].value+ if (num >= units[i]!.value) {+ const value = num / units[i]!.valuelet rounded = Math.round(value * 10) / 10let unitIndex = i@@ -138,8 +138,8 @@ export const formatNumberAbbreviated = (num: number) => {const formatted = rounded.toFixed(1)return formatted.endsWith('.0')- ? `${Number.parseInt(formatted)}${units[unitIndex].symbol}`- : `${formatted}${units[unitIndex].symbol}`+ ? `${Number.parseInt(formatted)}${units[unitIndex]!.symbol}`+ : `${formatted}${units[unitIndex]!.symbol}`}}// Fallback: if no threshold matched, return the number stringdiff --git a/web/utils/model-config.spec.ts b/web/utils/model-config.spec.tsindex 9e39883e619..f4b6b642784 100644--- a/web/utils/model-config.spec.ts+++ b/web/utils/model-config.spec.ts@@ -322,7 +322,7 @@ describe('Model Config Utilities', () => {const result = userInputsFormToPromptVariables(userInputs, 'query')- expect(result[0].is_context_var).toBe(true)+ expect(result[0]!.is_context_var).toBe(true)})/**@@ -365,9 +365,9 @@ describe('Model Config Utilities', () => {const result = userInputsFormToPromptVariables(userInputs)expect(result).toHaveLength(3)- expect(result[0].type).toBe('string')- expect(result[1].type).toBe('number')- expect(result[2].type).toBe('select')+ expect(result[0]!.type).toBe('string')+ expect(result[1]!.type).toBe('number')+ expect(result[2]!.type).toBe('select')})})diff --git a/web/utils/urlValidation.ts b/web/utils/urlValidation.tsindex e78639b15b6..196c6105c59 100644--- a/web/utils/urlValidation.ts+++ b/web/utils/urlValidation.ts@@ -46,7 +46,7 @@ export function isPrivateOrLocalAddress(url: string): boolean {if (a === 10)return true// 172.16.0.0/12- if (a === 172 && b >= 16 && b <= 31)+ if (a === 172 && b! >= 16 && b! <= 31)return true// 192.168.0.0/16if (a === 192 && b === 168)diff --git a/web/utils/var.ts b/web/utils/var.tsindex 1c024408005..8c06c7e8c90 100644--- a/web/utils/var.ts+++ b/web/utils/var.ts@@ -64,7 +64,7 @@ export const checkKey = (key: string, canBeEmpty?: boolean, _keys?: string[]): treturn 'tooLong'if (otherAllowedRegex.test(key)) {- if (/\d/.test(key[0]))+ if (/\d/.test(key[0]!))return 'notStartWithNumber'return true@@ -102,7 +102,7 @@ export const hasDuplicateStr = (strArr: string[]) => {elsestrObj[str] = 1})- return !!Object.keys(strObj).find(key => strObj[key] > 1)+ return !!Object.keys(strObj).find(key => strObj[key]! > 1)}const varRegex = /\{\{([a-z_]\w*)\}\}/gi