You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 42e4f5a
Browse filesBrowse the repository at this point in the historyBrowse files
fix(knowledge): report what a bulk document sweep did, and refuse tag slots it cannot show
A bulk document update dropped ids that matched nothing and said so only in
a server log, then answered a selection where nothing matched with a 404 —
refusing a request that had nothing to refuse. It was never atomic, so
there was no guarantee to preserve. It now reports unmatched ids the way
the chunk sweep beside it always has, and a selection that matches nothing
is the same answer as one that matches some of what was asked for.
Its count is renamed to match that sibling, which also corrects it: the
update returns every row it matched, so the old name promised a count of
what changed.
Uploading a document could write a value into a tag slot the knowledge base
has not defined. Nothing could then read it back — every filter refuses an
undefined tag, and the app renders a slot only when a definition covers it.
Refused now rather than defined automatically: a slot write carries no
display name, so inventing one would put a name the caller never chose into
the vocabulary every later reader sees. Clearing such a slot still works,
so anything already written can be removed.
Reading an archived knowledge base answers not-found, which is deliberate —
the same answer conceals a workspace the caller cannot reach, so the
message cannot say more without telling the two apart. The parameter now
says which lifecycle it addresses, which reaches both the reference and the
terminal.
Copy file name to clipboardExpand all lines: apps/sim/lib/api/contracts/v2/__tests__/transport-neutral-descriptions.test.ts
-4Lines changed: 0 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -49,10 +49,6 @@ const ALLOWED = new Map<string, string>([
49
49
'ISO 8601 timestamp when the knowledge base was archived by `DELETE /knowledge/{knowledgeBaseId}`, or null while the knowledge base is active. Only `GET /knowledge?scope=archived` returns knowledge bases with a non-null value.',
50
50
'not touched here: lives in v2/knowledge.ts',
51
51
],
52
-
[
53
-
'Which lifecycle set to list: `active` (default) for live knowledge bases, `archived` for knowledge bases a `DELETE` archived and `POST /knowledge/{knowledgeBaseId}/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.',
54
-
'not touched here: lives in v2/knowledge.ts',
55
-
],
56
52
[
57
53
'Structured tag filters, at most 10 of them. Every filter must hold, including two that name the same tag: repeating one tag narrows the result rather than widening it, matching `GET /api/v2/knowledge/{knowledgeBaseId}/documents`. To match either of two values for one tag, issue a search per value. Each filtered tag must resolve to the same slot and field type in every knowledge base selected; one missing from any of them, or defined inconsistently across them, is rejected rather than ignored, and those knowledge bases must be searched separately. List the available names with `GET /api/v2/knowledge/{knowledgeBaseId}/tags`.',
Copy file name to clipboardExpand all lines: apps/sim/lib/api/contracts/v2/knowledge.ts
+42-7Lines changed: 42 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -627,7 +627,7 @@ export const v2ListKnowledgeBasesQuerySchema = z
627
627
scope: v2KnowledgeBaseScopeSchema
628
628
.default('active')
629
629
.describe(
630
-
'Which lifecycle set to list: `active` (default) for live knowledge bases, `archived` for knowledge bases a `DELETE` archived and `POST /knowledge/{knowledgeBaseId}/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.'
630
+
'Which lifecycle set to list: `active` (default) for live knowledge bases, `archived` for knowledge bases a delete archived and the restore operation 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.'
'Knowledge base to read. Active knowledge bases only: an archived one answers 404 here, is listed by `scope=archived`, and is brought back by the restore endpoint.'
/** Bulk update outcome — one object, not a page. */
1499
+
/**
1500
+
* Bulk update outcome — one object, not a page.
1501
+
*
1502
+
* Best-effort, and reported the same way {@link v2BulkKnowledgeChunksDataSchema}
1503
+
* reports it: an identifier naming no updatable document in the knowledge base
1504
+
* lands in `errors` rather than failing the request, and a request whose every
1505
+
* identifier missed answers `200` with `processed: 0` instead of `404`. The
1506
+
* selection has always applied to what it matched, so the shared shape describes
1507
+
* what the operation already did rather than changing it.
1508
+
*
1509
+
* `processed`, not `updatedCount`: the count is the documents the selection
1510
+
* matched, and disabling a document that was already disabled counts it, so it
1511
+
* is not a count of changes. That is the same quantity `processed` names on the
1512
+
* chunk sibling, and naming it the same way keeps the two readable side by side.
1513
+
*/
1486
1514
exportconstv2BulkKnowledgeDocumentsDataSchema=z
1487
1515
.object({
1488
1516
operation: z.enum(['enable','disable']).describe('Operation that was applied.'),
1489
-
updatedCount: z
1517
+
processed: z
1490
1518
.number()
1491
1519
.int()
1492
1520
.nonnegative()
1493
-
.describe('Number of documents the operation changed.')
1521
+
.describe(
1522
+
'Number of documents in this knowledge base the operation matched. Documents already in the requested state are counted too, so this is not a count of changes.'
1523
+
)
1494
1524
.meta({examples: [42]}),
1525
+
errors: z
1526
+
.array(z.string())
1527
+
.describe(
1528
+
'Per-document failures, including any identifier that named no updatable document in the knowledge base. A populated array still answers 200, and a `selectAll` request reports an empty one.'
1529
+
),
1495
1530
documentIds: z
1496
1531
.array(z.string())
1497
1532
.optional()
1498
1533
.describe(
1499
-
'Identifiers of the documents the operation changed. Present only for an explicit `documentIds` request, which is bounded to '+
1500
-
`${MAX_V2_BULK_KNOWLEDGE_DOCUMENTS} documents; a \`selectAll\` request omits it because the selection is unbounded, and reports \`updatedCount\` instead.`
1534
+
'Identifiers of the documents the operation matched. Present only for an explicit `documentIds` request, which is bounded to '+
1535
+
`${MAX_V2_BULK_KNOWLEDGE_DOCUMENTS} documents; a \`selectAll\` request omits it because the selection is unbounded, and reports \`processed\` instead.`
0 commit comments