feat(rename): complete searchSpace to workspace transition across frontend and backend

- Introduced a comprehensive specification for renaming `searchSpace` to `workspace` in `surfsense_web` and `surfsense_desktop`, ensuring all TypeScript identifiers, React props, and local data structures are updated.
- Implemented migration shims for persisted local state to prevent data loss during the transition.
- Updated observability metrics and IPC channels to reflect the new naming convention.
- Removed legacy `active-search-space` module and replaced it with `active-workspace` to maintain consistency.
- Ensured no behavioral changes or data loss for users during the renaming process.
This commit is contained in:
Anish Sarkar 2026-07-06 15:12:40 +05:30
parent 2a020629c5
commit a8c1fb660d
259 changed files with 5480 additions and 2285 deletions

View file

@ -41,7 +41,7 @@ import {
} from "@/lib/supported-extensions";
interface DocumentUploadTabProps {
searchSpaceId: string;
workspaceId: string;
onSuccess?: () => void;
onAccordionStateChange?: (isExpanded: boolean) => void;
}
@ -132,7 +132,7 @@ const toggleRowClass =
"flex items-center justify-between rounded-lg bg-slate-400/5 dark:bg-white/5 p-3";
export function DocumentUploadTab({
searchSpaceId,
workspaceId,
onSuccess,
onAccordionStateChange,
}: DocumentUploadTabProps) {
@ -319,7 +319,7 @@ export function DocumentUploadTab({
setUploadProgress(0);
setIsFolderUploading(true);
const total = folderUpload.entries.length;
trackDocumentUploadStarted(Number(searchSpaceId), total, totalFileSize);
trackDocumentUploadStarted(Number(workspaceId), total, totalFileSize);
try {
const batches: FolderEntry[][] = [];
@ -364,7 +364,7 @@ export function DocumentUploadTab({
batch.map((e) => e.file),
{
folder_name: folderUpload.folderName,
workspace_id: Number(searchSpaceId),
workspace_id: Number(workspaceId),
relative_paths: batch.map((e) => e.relativePath),
root_folder_id: rootFolderId,
use_vision_llm: useVisionLlm,
@ -380,13 +380,13 @@ export function DocumentUploadTab({
setUploadProgress(Math.round((uploaded / total) * 100));
}
trackDocumentUploadSuccess(Number(searchSpaceId), total);
trackDocumentUploadSuccess(Number(workspaceId), total);
toast(t("upload_initiated"), { description: t("upload_initiated_desc") });
setFolderUpload(null);
onSuccess?.();
} catch (error) {
const message = error instanceof Error ? error.message : "Upload failed";
trackDocumentUploadFailure(Number(searchSpaceId), message);
trackDocumentUploadFailure(Number(workspaceId), message);
toast(t("upload_error"), {
description: `${t("upload_error_desc")}: ${message}`,
});
@ -403,7 +403,7 @@ export function DocumentUploadTab({
}
setUploadProgress(0);
trackDocumentUploadStarted(Number(searchSpaceId), files.length, totalFileSize);
trackDocumentUploadStarted(Number(workspaceId), files.length, totalFileSize);
progressIntervalRef.current = setInterval(() => {
setUploadProgress((prev) => (prev >= 90 ? prev : prev + Math.random() * 10));
@ -413,7 +413,7 @@ export function DocumentUploadTab({
uploadDocuments(
{
files: rawFiles,
workspace_id: Number(searchSpaceId),
workspace_id: Number(workspaceId),
use_vision_llm: useVisionLlm,
processing_mode: processingMode,
},
@ -421,7 +421,7 @@ export function DocumentUploadTab({
onSuccess: () => {
if (progressIntervalRef.current) clearInterval(progressIntervalRef.current);
setUploadProgress(100);
trackDocumentUploadSuccess(Number(searchSpaceId), files.length);
trackDocumentUploadSuccess(Number(workspaceId), files.length);
toast(t("upload_initiated"), { description: t("upload_initiated_desc") });
onSuccess?.();
},
@ -429,7 +429,7 @@ export function DocumentUploadTab({
if (progressIntervalRef.current) clearInterval(progressIntervalRef.current);
setUploadProgress(0);
const message = error instanceof Error ? error.message : "Upload failed";
trackDocumentUploadFailure(Number(searchSpaceId), message);
trackDocumentUploadFailure(Number(workspaceId), message);
toast(t("upload_error"), {
description: `${t("upload_error_desc")}: ${message}`,
});

View file

@ -24,7 +24,7 @@ export interface SelectedFolder {
interface FolderWatchDialogProps {
open: boolean;
onOpenChange: (open: boolean) => void;
searchSpaceId: number;
workspaceId: number;
onSuccess?: () => void;
initialFolder?: SelectedFolder | null;
}
@ -41,7 +41,7 @@ export const DEFAULT_EXCLUDE_PATTERNS = [
export function FolderWatchDialog({
open,
onOpenChange,
searchSpaceId,
workspaceId,
onSuccess,
initialFolder,
}: FolderWatchDialogProps) {
@ -91,7 +91,7 @@ export function FolderWatchDialog({
const rootFolderId = await uploadFolderScan({
folderPath: selectedFolder.path,
folderName: selectedFolder.name,
searchSpaceId,
workspaceId,
excludePatterns: DEFAULT_EXCLUDE_PATTERNS,
fileExtensions: supportedExtensions,
onProgress: setProgress,
@ -104,7 +104,7 @@ export function FolderWatchDialog({
excludePatterns: DEFAULT_EXCLUDE_PATTERNS,
fileExtensions: supportedExtensions,
rootFolderId: rootFolderId ?? null,
searchSpaceId,
workspaceId,
active: true,
});
@ -124,7 +124,7 @@ export function FolderWatchDialog({
setSubmitting(false);
setProgress(null);
}
}, [selectedFolder, searchSpaceId, supportedExtensions, onOpenChange, onSuccess]);
}, [selectedFolder, workspaceId, supportedExtensions, onOpenChange, onSuccess]);
const handleOpenChange = useCallback(
(nextOpen: boolean) => {