Skip to content

Commit 7697d7f

Browse files
committed
fix(v2): name the folder filter the same way on every list that has one
Three list surfaces describe the same filter, and one still named the request field rather than the concept — the spelling a caller reading the reference wants and the one a caller typing a command cannot use. The workflows sibling was reworded already; tables and knowledge now match, and a test pins the three together so they cannot drift apart again. The two bulk knowledge surfaces are pinned against each other rather than against a literal, since what matters is that they answer the same question under the same names.
1 parent aee6a90 commit 7697d7f

2 files changed

Lines changed: 49 additions & 1 deletion

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**
2+
* @vitest-environment node
3+
*/
4+
import { describe, expect, it } from 'vitest'
5+
import {
6+
v2BulkKnowledgeDocumentsDataSchema,
7+
v2GetKnowledgeBaseContract,
8+
} from '@/lib/api/contracts/v2/knowledge'
9+
import { v2BulkKnowledgeChunksDataSchema } from '@/lib/api/contracts/v2/knowledge-chunks'
10+
11+
/**
12+
* The two bulk surfaces answer the same question — "which of the ids I named
13+
* did nothing?" — so they are pinned against each other rather than against a
14+
* literal, which is what stops one of them being renamed on its own again.
15+
*/
16+
describe('bulk knowledge outcomes', () => {
17+
it('reports the matched count and the unmatched ids under the same names on both', () => {
18+
const documents = Object.keys(v2BulkKnowledgeDocumentsDataSchema.shape)
19+
const chunks = Object.keys(v2BulkKnowledgeChunksDataSchema.shape)
20+
21+
for (const field of ['operation', 'processed', 'errors']) {
22+
expect(chunks).toContain(field)
23+
expect(documents).toContain(field)
24+
}
25+
expect(documents).not.toContain('updatedCount')
26+
})
27+
28+
it('accepts a zero-match document sweep as a success body rather than an error', () => {
29+
const parsed = v2BulkKnowledgeDocumentsDataSchema.safeParse({
30+
operation: 'disable',
31+
processed: 0,
32+
errors: ['No matching documents found to disable: document-missing'],
33+
documentIds: [],
34+
})
35+
36+
expect(parsed.success).toBe(true)
37+
})
38+
})
39+
40+
describe('knowledge base read lifecycle', () => {
41+
it('says which lifecycle the read addresses on the identifier a caller types', () => {
42+
const described = v2GetKnowledgeBaseContract.params?.shape.knowledgeBaseId.description
43+
44+
expect(described).toBeTypeOf('string')
45+
expect(described).toContain('Active knowledge bases only')
46+
expect(described).toContain('archived')
47+
})
48+
})

apps/sim/lib/api/contracts/v2/tables.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ export const v2ListTablesQuerySchema = z
436436
scope: v2TableScopeSchema
437437
.default('active')
438438
.describe(
439-
'Which lifecycle set to list: `active` (default) for live tables, `archived` for tables a delete archived and a table restore can bring back. `folderPath` resolves against active folders only, so pairing it with `scope=archived` returns an empty page when the containing folder was archived too.'
439+
'Which lifecycle set to list: `active` (default) for live tables, `archived` for tables a delete archived and a table restore can bring back. The folder filter resolves against active folders only, so pairing it with `archived` returns an empty page when the containing folder was archived too.'
440440
),
441441
folderPath: v2FolderPathInputSchema
442442
.optional()

0 commit comments

Comments
 (0)