Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/thoughtspot/thoughtspot-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,9 @@ export class ThoughtSpotService {
});

const results = resp
.filter(d => d.metadata_header.type === "WORKSHEET" || d.metadata_header.subType === "WORKSHEET")
// Tables can also be used for spotter now
//.filter(d => d.metadata_header.type === "WORKSHEET" || d.metadata_header.subType === "WORKSHEET")
.filter(d => d.metadata_header.aiAnswerGenerationDisabled === false)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The current filter d.metadata_header.aiAnswerGenerationDisabled === false will exclude datasources where aiAnswerGenerationDisabled is undefined or null. If the absence of this property implies that AI answer generation is enabled, this filter is too strict and might hide datasources that should be visible.

A more robust approach would be to check for explicit disablement, like so: d.metadata_header.aiAnswerGenerationDisabled !== true. This ensures that only datasources explicitly marked as disabled are filtered out, while those with false, null, or undefined values are correctly included.

To ensure this behavior is covered, you could also add a test case in test/thoughtspot/thoughtspot-service.spec.ts for a datasource where aiAnswerGenerationDisabled is missing.

Suggested change
.filter(d => d.metadata_header.aiAnswerGenerationDisabled === false)
.filter(d => d.metadata_header.aiAnswerGenerationDisabled !== true)

.map(d => ({
name: d.metadata_header.name,
id: d.metadata_header.id,
Expand Down
2 changes: 2 additions & 0 deletions test/servers/mcp-server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ describe("MCP Server", () => {
name: "Sales Data",
description: "Sales data for the current year",
type: "WORKSHEET",
aiAnswerGenerationDisabled: false,
},
},
{
Expand All @@ -58,6 +59,7 @@ describe("MCP Server", () => {
name: "Customer Data",
description: "Customer information and demographics",
type: "WORKSHEET",
aiAnswerGenerationDisabled: false,
},
},
]),
Expand Down
34 changes: 30 additions & 4 deletions test/thoughtspot/thoughtspot-service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,23 +510,44 @@ describe('thoughtspot-service', () => {
type: 'WORKSHEET',
name: 'Sales Data',
id: 'ws1',
description: 'Sales information'
description: 'Sales information',
aiAnswerGenerationDisabled: false
}
},
{
metadata_header: {
type: 'WORKSHEET',
name: 'Revenue Data',
id: 'ws2',
description: 'Revenue information'
description: 'Revenue information',
aiAnswerGenerationDisabled: false
}
},
{
metadata_header: {
type: 'LOGICAL_TABLE', // This should be filtered out
type: 'WORKSHEET',
name: 'Revenue Data aiAnswerGenerationDisabled',
id: 'ws3',
description: 'Revenue information',
aiAnswerGenerationDisabled: true
}
},
{
metadata_header: {
type: 'LOGICAL_TABLE', // This should be filtered out due to aiAnswerGenerationDisabled: true
name: 'Other Data',
id: 'lt1',
description: 'Other information'
description: 'Other information',
aiAnswerGenerationDisabled: true
}
},
{
metadata_header: {
type: 'LOGICAL_TABLE', // This should be filtered out due to aiAnswerGenerationDisabled: true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This comment is misleading. It states that this data source should be filtered out, but aiAnswerGenerationDisabled is false, and this data source (lt2) is correctly included in the test's expected results. The comment appears to be a copy-paste error from the object above. Please correct or remove it to avoid confusion.

Suggested change
type: 'LOGICAL_TABLE', // This should be filtered out due to aiAnswerGenerationDisabled: true
type: 'LOGICAL_TABLE', // This is included because aiAnswerGenerationDisabled is false

name: 'Other Data 2',
id: 'lt2',
description: 'Other information',
aiAnswerGenerationDisabled: false
}
}
];
Expand Down Expand Up @@ -554,6 +575,11 @@ describe('thoughtspot-service', () => {
name: 'Revenue Data',
id: 'ws2',
description: 'Revenue information'
},
{
name: 'Other Data 2',
id: 'lt2',
description: 'Other information'
}
]);
});
Expand Down