diff --git a/src/cli/repl/commands/repl-commands.ts b/src/cli/repl/commands/repl-commands.ts index a1f3d887a02..36ce4a645ee 100644 --- a/src/cli/repl/commands/repl-commands.ts +++ b/src/cli/repl/commands/repl-commands.ts @@ -17,7 +17,6 @@ import { type OutputFormatter , bold, italic } from '../../../util/text/ansi'; import { splitAtEscapeSensitive } from '../../../util/text/args'; import { guard } from '../../../util/assert'; import { scripts } from '../../common/scripts-info'; -import { lineageCommand } from './repl-lineage'; import { queryCommand, queryStarCommand } from './repl-query'; function printHelpForScript(script: [string, ReplBaseCommand], f: OutputFormatter, starredVersion?: ReplBaseCommand): string { @@ -95,7 +94,6 @@ const _commands: Record = { 'controlflow*': controlflowStarCommand, 'controlflowbb': controlflowBbCommand, 'controlflowbb*': controlflowBbStarCommand, - 'lineage': lineageCommand, 'query': queryCommand, 'query*': queryStarCommand }; diff --git a/src/cli/repl/commands/repl-lineage.ts b/src/cli/repl/commands/repl-lineage.ts deleted file mode 100644 index 392bbc61edd..00000000000 --- a/src/cli/repl/commands/repl-lineage.ts +++ /dev/null @@ -1,74 +0,0 @@ -import type { ReplCodeCommand } from './repl-main'; -import { type SingleSlicingCriterion , slicingCriterionToId } from '../../../slicing/criterion/parse'; -import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id'; -import type { DataflowGraph, OutgoingEdges } from '../../../dataflow/graph/graph'; -import { type DataflowGraphEdge , edgeIncludesType, EdgeType } from '../../../dataflow/graph/edge'; -import type { AstIdMap } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate'; -import { guard } from '../../../util/assert'; -import { startAndEndsWith } from '../../../util/text/strings'; - -function splitAt(str: string, idx: number) { - return [str.slice(0, idx), str.slice(idx)]; -} - -function filterRelevantEdges(edge: DataflowGraphEdge) { - return edgeIncludesType(EdgeType.DefinedBy | EdgeType.DefinedByOnCall | EdgeType.Returns | EdgeType.Reads, edge.types); -} - -function pushRelevantEdges(queue: [NodeId, DataflowGraphEdge][], outgoingEdges: OutgoingEdges) { - queue.push(...[...outgoingEdges].filter(([_, edge]) => filterRelevantEdges(edge))); -} - -/** - * Get the lineage of a node in the dataflow graph - * @param criterion - The criterion to get the lineage of - * @param graph - The dataflow graph to search in - * @param idMap - The ID map to use for resolving the criterion (will default to that shipped with the dfgraph) - * @returns The lineage of the node represented as a set of node ids - */ -export function getLineage(criterion: SingleSlicingCriterion, graph: DataflowGraph, idMap?: AstIdMap): Set { - idMap ??= graph.idMap; - guard(idMap !== undefined, 'The ID map is required to get the lineage of a node'); - const src = graph.get(slicingCriterionToId(criterion, idMap)); - guard(src !== undefined, 'The ID pointed to by the criterion does not exist in the dataflow graph'); - const [vertex, outgoingEdges] = src; - const result: Set = new Set([vertex.id]); - const edgeQueue: [NodeId, DataflowGraphEdge][] = []; - pushRelevantEdges(edgeQueue, outgoingEdges); - - while(edgeQueue.length > 0) { - const [target] = edgeQueue.shift() as [NodeId, DataflowGraphEdge]; - if(result.has(target)) { - continue; - } - - result.add(target); - - const outgoingEdges = graph.outgoingEdges(target); - if(outgoingEdges !== undefined) { - pushRelevantEdges(edgeQueue, outgoingEdges); - } - } - - return result; -} - -export const lineageCommand: ReplCodeCommand = { - description: 'Get the lineage of an R object', - isCodeCommand: true, - usageExample: ':lineage', - aliases: ['lin'], - script: false, - argsParser: (args: string) => { - const [criterion, rest] = splitAt(args, args.indexOf(' ')); - const code = rest.trim(); - return { - rCode: startAndEndsWith(code, '"') ? JSON.parse(code) as string : code, - remaining: [criterion] - }; - }, - fn: async({ output, analyzer, remainingArgs }) => { - const lineageIds = getLineage(remainingArgs[0] as SingleSlicingCriterion, (await analyzer.dataflow()).graph); - output.stdout([...lineageIds].join('\n')); - } -}; diff --git a/src/cli/repl/server/connection.ts b/src/cli/repl/server/connection.ts index afb1351be6e..b5ec97c12ed 100644 --- a/src/cli/repl/server/connection.ts +++ b/src/cli/repl/server/connection.ts @@ -31,8 +31,6 @@ import { DataflowGraph } from '../../../dataflow/graph/graph'; import * as tmp from 'tmp'; import fs from 'fs'; import type { RParseRequests } from '../../../r-bridge/retriever'; -import { type LineageRequestMessage, type LineageResponseMessage , requestLineageMessage } from './messages/message-lineage'; -import { getLineage } from '../commands/repl-lineage'; import { type QueryRequestMessage, type QueryResponseMessage , requestQueryMessage } from './messages/message-query'; import type { KnownParser, ParseStepOutput } from '../../../r-bridge/parser'; import { compact } from './compact'; @@ -107,9 +105,6 @@ export class FlowRServerConnection { case 'request-repl-execution': this.handleRepl(request.message as ExecuteRequestMessage); break; - case 'request-lineage': - void this.handleLineageRequest(request.message as LineageRequestMessage); - break; case 'request-query': this.handleQueryRequest(request.message as QueryRequestMessage); break; @@ -313,37 +308,6 @@ export class FlowRServerConnection { }); } - private async handleLineageRequest(base: LineageRequestMessage) { - const requestResult = validateMessage(base, requestLineageMessage); - - if(requestResult.type === 'error') { - answerForValidationError(this.socket, requestResult, base.id); - return; - } - - const request = requestResult.message; - this.logger.info(`[${this.name}] Received lineage request for criterion ${request.criterion}`); - - const fileInformation = this.fileMap.get(request.filetoken); - if(!fileInformation) { - sendMessage(this.socket, { - id: request.id, - type: 'error', - fatal: false, - reason: `The file token ${request.filetoken} has never been analyzed.` - }); - return; - } - - const analyzer = fileInformation.analyzer; - const lineageIds = getLineage(request.criterion, (await analyzer.dataflow()).graph, (await analyzer.normalize()).idMap); - sendMessage(this.socket, { - type: 'response-lineage', - id: request.id, - lineage: [...lineageIds] - }); - } - private handleQueryRequest(base: QueryRequestMessage) { const requestResult = validateMessage(base, requestQueryMessage); diff --git a/src/cli/repl/server/messages/all-messages.ts b/src/cli/repl/server/messages/all-messages.ts index 8b416777750..6a83ac8b0b9 100644 --- a/src/cli/repl/server/messages/all-messages.ts +++ b/src/cli/repl/server/messages/all-messages.ts @@ -8,7 +8,6 @@ import type { FileAnalysisRequestMessage, FileAnalysisResponseMessageJson } from import type { ExecuteEndMessage, ExecuteIntermediateResponseMessage, ExecuteRequestMessage } from './message-repl'; import type { SliceRequestMessage, SliceResponseMessage } from './message-slice'; import type { FlowrErrorMessage } from './message-error'; -import type { LineageRequestMessage, LineageResponseMessage } from './message-lineage'; import type { QueryRequestMessage, QueryResponseMessage } from './message-query'; /** @@ -52,8 +51,6 @@ export type FlowrMessage = FlowrHelloResponseMessage | ExecuteEndMessage | SliceRequestMessage | SliceResponseMessage - | LineageRequestMessage - | LineageResponseMessage | QueryRequestMessage | QueryResponseMessage | FlowrErrorMessage diff --git a/src/cli/repl/server/messages/message-lineage.ts b/src/cli/repl/server/messages/message-lineage.ts deleted file mode 100644 index ef60f0f47f5..00000000000 --- a/src/cli/repl/server/messages/message-lineage.ts +++ /dev/null @@ -1,37 +0,0 @@ -import type { SingleSlicingCriterion } from '../../../../slicing/criterion/parse'; -import type { IdMessageBase, MessageDefinition } from './all-messages'; -import type { NodeId } from '../../../../r-bridge/lang-4.x/ast/model/processing/node-id'; -import Joi from 'joi'; - -export interface LineageRequestMessage extends IdMessageBase { - type: 'request-lineage', - /** The {@link FileAnalysisRequestMessage#filetoken} of the file/data */ - filetoken: string, - /** The criterion to start the lineage from */ - criterion: SingleSlicingCriterion, -} - -export const requestLineageMessage: MessageDefinition = { - type: 'request-lineage', - schema: Joi.object({ - type: Joi.string().valid('request-lineage').required().description('The type of the message.'), - id: Joi.string().optional().description('If you give the id, the response will be sent to the client with the same id.'), - filetoken: Joi.string().required().description('The filetoken of the file/data retrieved from the analysis request.'), - criterion: Joi.string().required().description('The criterion to start the lineage from.') - }) -}; - -export interface LineageResponseMessage extends IdMessageBase { - type: 'response-lineage', - /** The lineage of the given criterion. With this being the representation of a set, there is no guarantee about order. */ - lineage: NodeId[] -} - -export const responseLineageMessage: MessageDefinition = { - type: 'response-lineage', - schema: Joi.object({ - type: Joi.string().valid('response-lineage').required(), - id: Joi.string().optional().description('The id of the message, will be the same for the request.'), - lineage: Joi.array().items(Joi.string()).required().description('The lineage of the given criterion.') - }) -}; diff --git a/src/documentation/data/server/doc-data-server-messages.ts b/src/documentation/data/server/doc-data-server-messages.ts index df869685403..5c6b8d5f343 100644 --- a/src/documentation/data/server/doc-data-server-messages.ts +++ b/src/documentation/data/server/doc-data-server-messages.ts @@ -24,7 +24,6 @@ import { responseQueryMessage } from '../../../cli/repl/server/messages/message-query'; import { exampleQueryCode } from '../query/example-query-code'; -import { requestLineageMessage, responseLineageMessage } from '../../../cli/repl/server/messages/message-lineage'; import { CallTargets } from '../../../queries/catalog/call-context-query/identify-link-to-last-call-relation'; @@ -85,7 +84,7 @@ Requests for the [REPL](#message-request-repl) are independent of that. return ` The request allows the server to analyze a file and prepare it for slicing. -The message can contain a \`filetoken\`, which is used to identify the file in later slice or lineage requests (if you do not add one, the request will not be stored and therefore, it is not available for subsequent requests). +The message can contain a \`filetoken\`, which is used to identify the file in later slice or query requests (if you do not add one, the request will not be stored and therefore, it is not available for subsequent requests). > **Please note!**\\ > If you want to send and process a lot of analysis requests, but do not want to slice them, please do not pass the \`filetoken\` field. This will save the server a lot of memory allocation. @@ -519,68 +518,4 @@ See [above](#message-request-file-analysis) for the general structure of the res `; } }); - - documentServerMessage({ - title: 'Lineage', - type: 'request', - definitionPath: '../cli/repl/server/messages/message-lineage.ts', - defRequest: requestLineageMessage, - defResponse: responseLineageMessage, - mermaidSequenceDiagram: ` - Client->>+Server: request-lineage - - alt - Server-->>Client: response-lineage - else - Server-->>Client: error - end - deactivate Server - `, - shortDescription: `${deprecatedByQuery} Obtain the lineage of a given slicing criterion.`, - text: async(shell: RShell) => { - return ` - -**We deprecated the lineage request in favor of the \`lineage\` [Query](${FlowrWikiBaseRef}/Query%20API).** - -In order to retrieve the lineage of an object, you have to send a file analysis request first. The \`filetoken\` you assign is of use here as you can re-use it to repeatedly retrieve the lineage of the same file. -Besides that, you will need to add a [criterion](${FlowrWikiBaseRef}/Terminology#slicing-criterion) that specifies the object whose lineage you're interested in. - -${ - await documentServerMessageResponse({ - shell, - messageType: 'request-query', - messages: [{ - type: 'request', - message: { - type: 'request-file-analysis', - id: '1', - filetoken: 'x', - content: 'x <- 1\nx + 1' - } - }, { - type: 'response', - expectedType: 'response-file-analysis', - description: ` -See [above](#message-request-file-analysis) for the general structure of the response. - ` - }, { - type: 'request', - message: { - type: 'request-lineage', - id: '2', - filetoken: 'x', - criterion: '2@x' - }, - mark: true - }, { - type: 'response', - expectedType: 'response-lineage', - description: 'The response contains the lineage of the desired object in form of an array of IDs (as the representation of a set).' - }] - }) -} - - `; - } - }); } diff --git a/src/documentation/print-query-wiki.ts b/src/documentation/print-query-wiki.ts index b91900556ec..9ced4e76098 100644 --- a/src/documentation/print-query-wiki.ts +++ b/src/documentation/print-query-wiki.ts @@ -24,7 +24,6 @@ import { executeIdMapQuery } from '../queries/catalog/id-map-query/id-map-query- import { executeNormalizedAstQuery } from '../queries/catalog/normalized-ast-query/normalized-ast-query-executor'; import { executeDataflowClusterQuery } from '../queries/catalog/cluster-query/cluster-query-executor'; import { executeStaticSliceQuery } from '../queries/catalog/static-slice-query/static-slice-query-executor'; -import { executeLineageQuery } from '../queries/catalog/lineage-query/lineage-query-executor'; import { executeDependenciesQuery } from '../queries/catalog/dependencies-query/dependencies-query-executor'; import { getReplCommand } from './doc-util/doc-cli-option'; import { NewIssueUrl } from './doc-util/doc-issue'; @@ -186,41 +185,6 @@ ${ } }); -registerQueryDocumentation('lineage', { - name: 'Lineage Query', - type: 'active', - shortDescription: 'Returns lineage of a criteria.', - functionName: executeLineageQuery.name, - functionFile: '../queries/catalog/lineage-query/lineage-query-executor.ts', - buildExplanation: async(shell: RShell) => { - const exampleCode = 'x <- 1\nx'; - - return ` -This query calculates the _lineage_ of a given slicing criterion. The lineage traces back all parts that the -respective variables stems from given the reads, definitions, and returns in the dataflow graph. - -To understand this, let's start with a simple example query, to get the lineage of the second use of \`x\` in the following code: -${codeBlock('r', exampleCode)} - -For this, we use the criterion \`2@x\` (which is the first use of \`x\` in the second line). - -${ - await showQuery(shell, exampleCode, [{ - type: 'lineage', - criterion: '2@x' - }], { showCode: false }) -} - -In this simple scenario, the _lineage_ is equivalent to the slice (and in-fact the complete code). -In general the lineage is smaller and makes no guarantees on executability. -It is just a quick and neither complete nor sound way to get information on where the variable originates from. - -This query replaces the old [\`request-lineage\`](${FlowrWikiBaseRef}/Interface#message-request-lineage) message. - - `; - } -}); - registerQueryDocumentation('dataflow-cluster', { name: 'Dataflow Cluster Query', type: 'active', diff --git a/src/queries/catalog/lineage-query/lineage-query-executor.ts b/src/queries/catalog/lineage-query/lineage-query-executor.ts deleted file mode 100644 index f9839d6b6a3..00000000000 --- a/src/queries/catalog/lineage-query/lineage-query-executor.ts +++ /dev/null @@ -1,26 +0,0 @@ -import type { LineageQuery, LineageQueryResult } from './lineage-query-format'; -import { log } from '../../../util/log'; -import { getLineage } from '../../../cli/repl/commands/repl-lineage'; -import type { BasicQueryData } from '../../base-query-format'; - -/** - * Executes the given lineage queries. - * @see {@link getLineage} - */ -export async function executeLineageQuery({ analyzer }: BasicQueryData, queries: readonly LineageQuery[]): Promise { - const start = Date.now(); - const result: LineageQueryResult['lineages'] = {}; - for(const { criterion } of queries) { - if(result[criterion]) { - log.warn('Duplicate criterion in lineage query:', criterion); - } - result[criterion] = getLineage(criterion, (await analyzer.dataflow()).graph, (await analyzer.normalize()).idMap); - } - - return { - '.meta': { - timing: Date.now() - start - }, - lineages: result - }; -} diff --git a/src/queries/catalog/lineage-query/lineage-query-format.ts b/src/queries/catalog/lineage-query/lineage-query-format.ts deleted file mode 100644 index 362745595fe..00000000000 --- a/src/queries/catalog/lineage-query/lineage-query-format.ts +++ /dev/null @@ -1,64 +0,0 @@ -import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format'; -import type { SingleSlicingCriterion } from '../../../slicing/criterion/parse'; -import type { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id'; -import type { ParsedQueryLine, QueryResults, SupportedQuery } from '../../query'; -import { bold, ColorEffect, Colors, FontStyles } from '../../../util/text/ansi'; -import { printAsMs } from '../../../util/text/time'; -import Joi from 'joi'; -import { executeLineageQuery } from './lineage-query-executor'; -import { summarizeIdsIfTooLong } from '../../query-print'; -import { sliceCriterionParser } from '../../../cli/repl/parser/slice-query-parser'; -import type { ReplOutput } from '../../../cli/repl/commands/repl-main'; -import type { FlowrConfigOptions } from '../../../config'; - -/** - * Calculates the lineage of the given criterion. - */ -export interface LineageQuery extends BaseQueryFormat { - readonly type: 'lineage'; - readonly criterion: SingleSlicingCriterion; -} - -export interface LineageQueryResult extends BaseQueryResult { - /** Maps each criterion to the found lineage, duplicates are ignored. */ - readonly lineages: Record>; -} - -function lineageQueryLineParser(output: ReplOutput, line: readonly string[], _config: FlowrConfigOptions): ParsedQueryLine<'lineage'> { - const criterion = sliceCriterionParser(line[0]); - - if(!criterion) { - output.stderr(output.formatter.format('Invalid lineage query format, slicing criterion must be given in parentheses, e.g. (2@var), (1:5) or ($10)', - { color: Colors.Red, effect: ColorEffect.Foreground, style: FontStyles.Bold })); - return { query: [] }; - } - - return { - query: { - type: 'lineage', - criterion: criterion - }, - rCode: line[1] - }; -} - -export const LineageQueryDefinition = { - executor: executeLineageQuery, - asciiSummarizer: (formatter, _analyzer, queryResults, result) => { - const out = queryResults as QueryResults<'lineage'>['lineage']; - result.push(`Query: ${bold('lineage', formatter)} (${printAsMs(out['.meta'].timing, 0)})`); - for(const [criteria, lineage] of Object.entries(out.lineages)) { - result.push(` ╰ ${criteria}: {${summarizeIdsIfTooLong(formatter, [...lineage])}}`); - } - return true; - }, - fromLine: lineageQueryLineParser, - schema: Joi.object({ - type: Joi.string().valid('lineage').required().description('The type of the query.'), - criterion: Joi.string().required().description('The slicing criterion of the node to get the lineage of.') - }).description('Lineage query used to find the lineage of a node in the dataflow graph'), - flattenInvolvedNodes: (queryResults: BaseQueryResult): NodeId[] => { - const out = queryResults as QueryResults<'lineage'>['lineage']; - return Object.values(out.lineages).flatMap(lineage => [...lineage]); - } -} as const satisfies SupportedQuery<'lineage'>; diff --git a/src/queries/query.ts b/src/queries/query.ts index 54b715c98ab..ff672de808f 100644 --- a/src/queries/query.ts +++ b/src/queries/query.ts @@ -6,7 +6,6 @@ import type { VirtualCompoundConstraint } from './virtual-query/compound-query'; import { type DataflowQuery , DataflowQueryDefinition } from './catalog/dataflow-query/dataflow-query-format'; import { type IdMapQuery , IdMapQueryDefinition } from './catalog/id-map-query/id-map-query-format'; import { type NormalizedAstQuery , NormalizedAstQueryDefinition } from './catalog/normalized-ast-query/normalized-ast-query-format'; -import { type LineageQuery , LineageQueryDefinition } from './catalog/lineage-query/lineage-query-format'; import { type StaticSliceQuery , StaticSliceQueryDefinition } from './catalog/static-slice-query/static-slice-query-format'; import { type DataflowClusterQuery , ClusterQueryDefinition } from './catalog/cluster-query/cluster-query-format'; import { type DependenciesQuery , DependenciesQueryDefinition } from './catalog/dependencies-query/dependencies-query-format'; @@ -48,7 +47,6 @@ export type Query = CallContextQuery | IdMapQuery | DataflowClusterQuery | StaticSliceQuery - | LineageQuery | DependenciesQuery | LocationMapQuery | HappensBeforeQuery @@ -105,7 +103,6 @@ export const SupportedQueries = { 'normalized-ast': NormalizedAstQueryDefinition, 'dataflow-cluster': ClusterQueryDefinition, 'static-slice': StaticSliceQueryDefinition, - 'lineage': LineageQueryDefinition, 'dependencies': DependenciesQueryDefinition, 'location-map': LocationMapQueryDefinition, 'search': SearchQueryDefinition, diff --git a/test/functionality/_helper/label.ts b/test/functionality/_helper/label.ts index 68023e5be96..1d92fc9a4b7 100644 --- a/test/functionality/_helper/label.ts +++ b/test/functionality/_helper/label.ts @@ -19,7 +19,7 @@ function uniqueTestId(): string { } -const _TestLabelContexts = ['parse', 'desugar-shell', 'desugar-tree-sitter', 'dataflow', 'other', 'slice', 'output', 'lineage', 'query', 'search', 'linter', 'resolve', 'absint'] as const; +const _TestLabelContexts = ['parse', 'desugar-shell', 'desugar-tree-sitter', 'dataflow', 'other', 'slice', 'output', 'query', 'search', 'linter', 'resolve', 'absint'] as const; export type TestLabelContext = typeof _TestLabelContexts[number] export interface TestLabel extends MergeableRecord { diff --git a/test/functionality/cli/repl/query/lineage-query-repl.test.ts b/test/functionality/cli/repl/query/lineage-query-repl.test.ts deleted file mode 100644 index 7496dd4b2e0..00000000000 --- a/test/functionality/cli/repl/query/lineage-query-repl.test.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { describe } from 'vitest'; -import { SupportedQueries } from '../../../../../src/queries/query'; -import { assertReplParser } from '../../../_helper/repl'; - -describe('Lineage Query REPL Parser', () => { - const parser = SupportedQueries['lineage'].fromLine; - assertReplParser({ parser, - label: 'empty line', - line: [''], - expectedParse: { - query: [], - }, - }); - assertReplParser({ parser, - label: 'invalid line', - line: ['(partial'], - expectedParse: { - query: [], - }, - }); - assertReplParser({ parser, - label: 'single criterion', - line: ['(1@var)'], - expectedParse: { - query: { - type: 'lineage', - criterion: '1@var', - }, - rCode: undefined - }, - }); - assertReplParser({ parser, - label: 'with code', - line: ['(1@var)', 'someCode'], - expectedParse: { - query: { - type: 'lineage', - criterion: '1@var', - }, - rCode: 'someCode', - }, - }); -}); diff --git a/test/functionality/dataflow/query/lineage-query.test.ts b/test/functionality/dataflow/query/lineage-query.test.ts deleted file mode 100644 index f49faff825c..00000000000 --- a/test/functionality/dataflow/query/lineage-query.test.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { assertQuery } from '../../_helper/query'; -import { label } from '../../_helper/label'; -import type { - LineageQuery, - LineageQueryResult -} from '../../../../src/queries/catalog/lineage-query/lineage-query-format'; -import { getLineage } from '../../../../src/cli/repl/commands/repl-lineage'; -import { describe } from 'vitest'; -import { withTreeSitter } from '../../_helper/shell'; - -describe('Lineage Query', withTreeSitter(parser => { - function testQuery(name: string, code: string, query: readonly LineageQuery[]) { - assertQuery(label(name), parser, code, query, ({ dataflow }) => ({ - 'lineage': { - lineages: query.reduce((acc, { criterion }) => { - acc[criterion] = getLineage(criterion, dataflow.graph); - return acc; - }, {} as LineageQueryResult['lineages']) - } - })); - } - - testQuery('Single Expression', 'x + 1', [{ type: 'lineage', criterion: '1@x' }]); - testQuery('Multiple Queries', 'x + 1', [{ type: 'lineage', criterion: '1@x' }, { type: 'lineage', criterion: '1@x' }, { type: 'lineage', criterion: '1@x' }]); -})); diff --git a/test/functionality/lineage/lineage.test.ts b/test/functionality/lineage/lineage.test.ts deleted file mode 100644 index 8b9b6cc7619..00000000000 --- a/test/functionality/lineage/lineage.test.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { withShell } from '../_helper/shell'; -import { PipelineExecutor } from '../../../src/core/pipeline-executor'; -import { DEFAULT_DATAFLOW_PIPELINE } from '../../../src/core/steps/pipeline/default-pipelines'; -import { requestFromInput } from '../../../src/r-bridge/retriever'; -import type { SingleSlicingCriterion } from '../../../src/slicing/criterion/parse'; -import { getLineage } from '../../../src/cli/repl/commands/repl-lineage'; -import { type TestLabel , decorateLabelContext, label } from '../_helper/label'; -import type { NodeId } from '../../../src/r-bridge/lang-4.x/ast/model/processing/node-id'; -import { setEquals } from '../../../src/util/collections/set'; -import { OperatorDatabase } from '../../../src/r-bridge/lang-4.x/ast/model/operators'; -import { assert, describe, test } from 'vitest'; -import { builtInId } from '../../../src/dataflow/environments/built-in'; -import { defaultConfigOptions } from '../../../src/config'; - -describe.sequential('Test lineage', withShell(shell => { - - function assertLineage(title: string | TestLabel, request: string, criterion: SingleSlicingCriterion, expected: NodeId[]) { - const effectiveName = decorateLabelContext(title, ['lineage']); - - return test(effectiveName, async() => { - const result = await new PipelineExecutor(DEFAULT_DATAFLOW_PIPELINE, { - parser: shell, - request: requestFromInput(request) - }, defaultConfigOptions).allRemainingSteps(); - const lineageIds = getLineage(criterion, result.dataflow.graph); - assert.isTrue(setEquals(lineageIds, new Set(expected)), `Expected ${JSON.stringify(expected)} but got ${JSON.stringify([...lineageIds])}`); - }); - } - - assertLineage(label('The demo lineage', [ - 'name-normal', ...OperatorDatabase['<-'].capabilities, 'newlines' - ]), `c <- x -b <- c -a <- b`, '3@a', [0, 1, 2, 3, 4, 5, 6, 7, 8, builtInId('<-')]); -}));