Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
af84f96
feat(webui): Add compression job submission with input file listing.
junhaoliao Sep 9, 2025
f148177
feat(webui): Refactor path resolution and add "path not found" UI.
junhaoliao Sep 9, 2025
c763142
feat(webui): Improve tree data handling and add parent node loading.
junhaoliao Sep 9, 2025
ef523af
stop more listing if listing one parent fails; improve icons visual
junhaoliao Sep 9, 2025
8930af8
remove LsRoot reference
junhaoliao Sep 9, 2025
9b87c4e
fix(webui): Remove os listing api; simplify compression job schema; lint
junhaoliao Sep 9, 2025
30ced50
fix(webui): Revert unnecessary input logs mount from start script.
junhaoliao Sep 9, 2025
aea137c
revert change at all
junhaoliao Sep 9, 2025
d697a1b
fix(webui): Specify type for isSubmitting state and rename isClpS var…
junhaoliao Sep 9, 2025
dd64ac3
fix(webui): Remove unused compression job type definitions and consta…
junhaoliao Sep 9, 2025
4d82aa2
Merge branch 'refs/heads/main' into local-submit-sans-ls
junhaoliao Sep 17, 2025
cb291dc
remove unused JOB_COMPLETION_STATUS_POLL_INTERVAL_MILLIS
junhaoliao Sep 17, 2025
d22eff7
move schema definitions to common
junhaoliao Sep 17, 2025
9108763
Populate compression job config from the package.
junhaoliao Sep 17, 2025
8049e8d
refactor: Replace settings import with config constants for storage e…
junhaoliao Sep 17, 2025
e45ea84
feat: Implement compression job submission using react-query mutation
junhaoliao Sep 17, 2025
138c553
lint
junhaoliao Sep 17, 2025
b21b823
lint
junhaoliao Sep 17, 2025
6aa742b
refactor: Clean up comment formatting in query.ts
junhaoliao Sep 17, 2025
b8da979
reorder server_settings_json_updates
junhaoliao Sep 17, 2025
ab1bef7
move CLP_STORAGE_ENGINES enum into common and update imports across f…
junhaoliao Sep 17, 2025
6d7a3af
refactor: Update submitCompressionJob to return AxiosResponse and adj…
junhaoliao Sep 17, 2025
67f571e
fix type import issues caused by merging from main
junhaoliao Sep 18, 2025
3a3654b
refactor: Remove unused CLP_QUERY_ENGINES export from index.ts
junhaoliao Sep 19, 2025
b2eefdf
refactor: Rename compression job schemas for clarity and update impor…
junhaoliao Sep 19, 2025
ceb52a3
refactor: Simplify submitCompressionJob function and integrate useMut…
junhaoliao Sep 19, 2025
a1d314e
Merge branch 'main' into local-submit-sans-ls
junhaoliao Sep 19, 2025
aab5486
refactor: Move CompressionJobConfig interface to typings.ts
junhaoliao Sep 19, 2025
285beb4
refactor: Move CONTAINER_INPUT_LOGS_ROOT_DIR constant to typings.ts a…
junhaoliao Sep 19, 2025
4bb46c4
refactor: Extract form items into separate components for better orga…
junhaoliao Sep 19, 2025
d13fd52
refactor: Introduce CLP_DEFAULT_DATASET_NAME constant and set default…
junhaoliao Sep 19, 2025
44033bf
refactor: Add helper text tooltips for dataset and timestamp key form…
junhaoliao Sep 19, 2025
01cba4d
rename css class name jobsGrid -> fullRow
junhaoliao Sep 24, 2025
542a9f1
remove COMPRESSION_JOB_STATUS enum; update exports
junhaoliao Sep 24, 2025
0bce379
remove messageApi usage and cleanup error handling.
junhaoliao Sep 24, 2025
c8a8065
fix(ingestpage): Update dataset input placeholder and helper text.
junhaoliao Sep 24, 2025
23dcd12
Update timestamp key placeholder and helper text.
junhaoliao Sep 24, 2025
e260129
Update dataset helper text and format timestamp key placeholder.
junhaoliao Sep 24, 2025
1110684
Merge branch 'main' into local-submit-sans-ls
junhaoliao Sep 24, 2025
d5ff9a7
fix(ingestpage): Remove unused message import.
junhaoliao Sep 24, 2025
ac26e2c
fix: Add SqlDbCompressionJobsTableName to start_clp webui server conf…
junhaoliao Sep 24, 2025
64a8d18
remove all @enum from JSDoc
junhaoliao Sep 24, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,7 @@ def start_webui(
"SqlDbPort": clp_config.database.port,
"SqlDbName": clp_config.database.name,
"SqlDbQueryJobsTableName": QUERY_JOBS_TABLE_NAME,
"SqlDbCompressionJobsTableName": COMPRESSION_JOBS_TABLE_NAME,
"MongoDbHost": clp_config.results_cache.host,
"MongoDbPort": clp_config.results_cache.port,
"MongoDbName": clp_config.results_cache.db_name,
Expand All @@ -888,7 +889,13 @@ def start_webui(
"ClientDir": str(container_webui_dir / "client"),
"LogViewerDir": str(container_webui_dir / "yscope-log-viewer"),
"StreamTargetUncompressedSize": container_clp_config.stream_output.target_uncompressed_size,
"ArchiveOutputCompressionLevel": clp_config.archive_output.compression_level,
"ArchiveOutputTargetArchiveSize": clp_config.archive_output.target_archive_size,
"ArchiveOutputTargetDictionariesSize": clp_config.archive_output.target_dictionaries_size,
"ArchiveOutputTargetEncodedFileSize": clp_config.archive_output.target_encoded_file_size,
"ArchiveOutputTargetSegmentSize": clp_config.archive_output.target_segment_size,
"ClpQueryEngine": clp_config.package.query_engine,
"ClpStorageEngine": clp_config.package.storage_engine,
}
Comment on lines +892 to 899
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick

🧩 Analysis chain

New archive-output + storage-engine keys: verify server settings support; consider container_clp_config for consistency.

  • Verify all new keys exist in server settings templates/schemas; otherwise update_settings_object will raise.
  • Optional: Use container_clp_config for symmetry with StreamTargetUncompressedSize.

Apply:

-        "ArchiveOutputCompressionLevel": clp_config.archive_output.compression_level,
-        "ArchiveOutputTargetArchiveSize": clp_config.archive_output.target_archive_size,
-        "ArchiveOutputTargetDictionariesSize": clp_config.archive_output.target_dictionaries_size,
-        "ArchiveOutputTargetEncodedFileSize": clp_config.archive_output.target_encoded_file_size,
-        "ArchiveOutputTargetSegmentSize": clp_config.archive_output.target_segment_size,
+        "ArchiveOutputCompressionLevel": container_clp_config.archive_output.compression_level,
+        "ArchiveOutputTargetArchiveSize": container_clp_config.archive_output.target_archive_size,
+        "ArchiveOutputTargetDictionariesSize": container_clp_config.archive_output.target_dictionaries_size,
+        "ArchiveOutputTargetEncodedFileSize": container_clp_config.archive_output.target_encoded_file_size,
+        "ArchiveOutputTargetSegmentSize": container_clp_config.archive_output.target_segment_size,
-        "ClpStorageEngine": clp_config.package.storage_engine,
+        "ClpStorageEngine": container_clp_config.package.storage_engine,

Run:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Check presence of the new keys in server settings/templates/schemas
rg -n -C2 -e 'ArchiveOutputCompressionLevel' \
           -e 'ArchiveOutputTargetArchiveSize' \
           -e 'ArchiveOutputTargetDictionariesSize' \
           -e 'ArchiveOutputTargetEncodedFileSize' \
           -e 'ArchiveOutputTargetSegmentSize' \
           -e 'ClpStorageEngine' \
           components/webui

Length of output: 3455


Verified: ArchiveOutput keys + ClpStorageEngine exist; optional refactor available

  • Keys found in components/webui/server/settings.json and client/public/settings.json; server references in components/webui/server/src/routes/api/compress/index.ts and client config in components/webui/client/src/config/index.ts — update_settings_object should not raise for missing keys.
  • Optional: for symmetry with StreamTargetUncompressedSize, consider switching clp_config → container_clp_config in components/clp-package-utils/clp_package_utils/scripts/start_clp.py (lines 892–899).
🤖 Prompt for AI Agents
In components/clp-package-utils/clp_package_utils/scripts/start_clp.py around
lines 892 to 899, the settings object currently uses clp_config and contains
ArchiveOutput* and ClpStorageEngine keys that are present in server and client
configs so update_settings_object should not error; ensure you do not remove or
rename these keys and avoid raising for missing keys, and optionally rename the
reference from clp_config to container_clp_config for symmetry with
StreamTargetUncompressedSize (update all usages in this block accordingly).


container_cmd_extra_opts = []
Expand Down
23 changes: 23 additions & 0 deletions components/webui/client/src/api/compress/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import {
CompressionJob,
CompressionJobCreation,
} from "@webui/common/schemas/compression";
Comment on lines +1 to +4
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick

Use type‑only imports for TS types.

Avoids emitting unused runtime imports under strict TS configs.

-import {
+import type {
     CompressionJob,
     CompressionJobCreation,
 } from "@webui/common/schemas/compression";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import {
CompressionJob,
CompressionJobCreation,
} from "@webui/common/schemas/compression";
import type {
CompressionJob,
CompressionJobCreation,
} from "@webui/common/schemas/compression";
🤖 Prompt for AI Agents
In components/webui/client/src/api/compress/index.ts around lines 5 to 8, the
import of CompressionJob and CompressionJobCreation is currently a regular
import which can emit runtime code under strict TS settings; change it to a
type-only import by using "import type { CompressionJob, CompressionJobCreation
} from '@webui/common/schemas/compression';" so the compiler treats them purely
as types and removes any runtime import emission.

import axios from "axios";


/**
* Submits a compression job.
*
* @param payload
* @return
*/
const submitCompressionJob = async (payload: CompressionJobCreation)
: Promise<CompressionJob> => {
console.log("Submitting compression job:", JSON.stringify(payload));
const {data} = await axios.post<CompressionJob>("/api/compress", payload);

return data;
};


export {submitCompressionJob};
15 changes: 4 additions & 11 deletions components/webui/client/src/config/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import {CLP_QUERY_ENGINES} from "@webui/common/config";
import {
CLP_QUERY_ENGINES,
CLP_STORAGE_ENGINES,
} from "@webui/common/config";
Comment on lines +1 to +4
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick

Good consolidation; add a small runtime guard for settings sanity.

Defensively assert settings.ClpStorageEngine is a supported value to fail fast on misconfigurations.

Add near the settings reads:

const VALID_ENGINES = new Set(Object.values(CLP_STORAGE_ENGINES));
if (!VALID_ENGINES.has(SETTINGS_STORAGE_ENGINE)) {
  throw new Error(`Invalid ClpStorageEngine: ${String(SETTINGS_STORAGE_ENGINE)}`);
}
🤖 Prompt for AI Agents
In components/webui/client/src/config/index.ts around lines 1 to 4, add a
runtime sanity check that ensures the runtime setting SETTINGS_STORAGE_ENGINE is
one of the supported CLP_STORAGE_ENGINES; create a Set from
Object.values(CLP_STORAGE_ENGINES) and if the current SETTINGS_STORAGE_ENGINE is
not contained, throw a clear Error like "Invalid ClpStorageEngine: <value>" so
misconfigurations fail fast.


import {settings} from "../settings";


/**
* CLP variants.
*/
enum CLP_STORAGE_ENGINES {
CLP = "clp",
CLP_S = "clp-s",
}

const SETTINGS_STORAGE_ENGINE = settings.ClpStorageEngine as CLP_STORAGE_ENGINES;
const SETTINGS_QUERY_ENGINE = settings.ClpQueryEngine as CLP_QUERY_ENGINES;

Expand All @@ -22,8 +17,6 @@ const STREAM_TYPE = CLP_STORAGE_ENGINES.CLP === SETTINGS_STORAGE_ENGINE ?
"json";

export {
CLP_QUERY_ENGINES,
CLP_STORAGE_ENGINES,
Copy link
Contributor

Choose a reason for hiding this comment

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

should probably remove query engines export as well

SETTINGS_QUERY_ENGINE,
SETTINGS_STORAGE_ENGINE,
STREAM_TYPE,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import {CLP_DEFAULT_DATASET_NAME} from "@webui/common/config";
import {
Form,
Input,
} from "antd";


const DATASET_HELPER_TEXT = `If left empty, dataset "${CLP_DEFAULT_DATASET_NAME}" will be used.`;
const DATASET_PLACEHOLDER_TEXT = "The dataset for new archives";
const TIMESTAMP_KEY_HELPER_TEXT = "If not provided, events will not have assigned" +
" timestamps and can only be searched from the command line without a timestamp filter.";
const TIMESTAMP_KEY_PLACEHOLDER_TEXT =
"The path (e.g. x.y) for the field containing the log event's timestamp";
Copy link
Member Author

Choose a reason for hiding this comment

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

putting this on a new line; otherwise the string has to be broken into two to avoid line length violations


/**
* Renders additional compression job submission form items for CLP-S storage engine.
*
* @return
*/
const ClpSFormItems = () => (
<>
<Form.Item
label={"Dataset"}
name={"dataset"}
tooltip={DATASET_HELPER_TEXT}
>
<Input placeholder={DATASET_PLACEHOLDER_TEXT}/>
</Form.Item>
<Form.Item
label={"Timestamp Key"}
name={"timestampKey"}
tooltip={TIMESTAMP_KEY_HELPER_TEXT}
>
<Input placeholder={TIMESTAMP_KEY_PLACEHOLDER_TEXT}/>
</Form.Item>
</>
);


export default ClpSFormItems;
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import {
Form,
Input,
} from "antd";


/**
* Renders a form item for inputting file paths for compression job submission.
*
* @return
*/
const PathsInputFormItem = () => (
<Form.Item
label={"Paths"}
name={"paths"}
rules={[{required: true, message: "Please enter at least one path"}]}
>
<Input.TextArea
autoSize={{minRows: 4, maxRows: 10}}
placeholder={"Enter paths to compress, one per line"}/>
</Form.Item>
);


export default PathsInputFormItem;
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import {
Button,
Form,
} from "antd";


interface SubmitFormItemProps {
isSubmitting: boolean;
}

/**
* Render a submit button for a form.
*
* @param props
* @param props.isSubmitting
* @return
*/
const SubmitFormItem = ({isSubmitting}: SubmitFormItemProps) => (
<Form.Item>
<Button
htmlType={"submit"}
loading={isSubmitting}
type={"primary"}
>
Submit
</Button>
</Form.Item>
);


export default SubmitFormItem;
108 changes: 108 additions & 0 deletions components/webui/client/src/pages/IngestPage/Compress/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import {
useMutation,
useQueryClient,
} from "@tanstack/react-query";
import {CLP_STORAGE_ENGINES} from "@webui/common/config";
import {CompressionJobCreation} from "@webui/common/schemas/compression";
import {
Form,
Typography,
} from "antd";

import {submitCompressionJob} from "../../../api/compress";
import {DashboardCard} from "../../../components/DashboardCard";
import {SETTINGS_STORAGE_ENGINE} from "../../../config";
import ClpSFormItems from "./ClpSFormItems";
import PathsInputFormItem from "./PathsInputFormItem";
import SubmitFormItem from "./SubmitFormItem";


type FormValues = {
paths: string;
dataset?: string;
timestampKey?: string;
};


/**
* Renders a compression job submission form.
*
* @return
*/
const Compress = () => {
const [form] = Form.useForm<FormValues>();

const queryClient = useQueryClient();
const {
mutate,
isPending: isSubmitting,
isSuccess,
isError,
data,
error,
} = useMutation({
mutationFn: submitCompressionJob,
onSettled: async () => {
// Invalidate queries that are affected by a new compression job.
await queryClient.invalidateQueries({queryKey: ["jobs"]});
Copy link
Contributor

Choose a reason for hiding this comment

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

any reason not to put this in the success handler?

Copy link
Member Author

Choose a reason for hiding this comment

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

while we don't expect contents in the job table to change if a row cannot be inserted into the table, i think we should always refresh the job table so it's less error prone and future proof.

for example, if the INSERT query submitted by CompressionJobDbManager was executed but the SQL connection drops right after, mysql2 can still throw and Fastify will report an error status.

},
onSuccess: () => {
form.resetFields();
},
});
Comment on lines +43 to +52
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick

Optional: add explicit generics to useMutation for stronger typing.

Keeps the mutation’s data/error/variables types explicit.

-    } = useMutation({
+    } = useMutation<{ jobId: string }, Error, CompressionJobCreation>({
         mutationFn: submitCompressionJob,
         onSettled: async () => {
             // Invalidate queries that are affected by a new compression job.
             await queryClient.invalidateQueries({queryKey: ["jobs"]});
         },
         onSuccess: () => {
             form.resetFields();
         },
     });

Committable suggestion skipped: line range outside the PR's diff.


const handleSubmit = (values: FormValues) => {
// eslint-disable-next-line no-warning-comments
// TODO: replace the UI with a file selector and remove below string manipulation.
// Convert multiline input to array of paths.
const paths = values.paths
.split("\n")
.map((path) => path.trim())
.filter((path) => 0 < path.length);

const payload: CompressionJobCreation = {paths};

if ("undefined" !== typeof values.dataset) {
payload.dataset = values.dataset;
}
if ("undefined" !== typeof values.timestampKey) {
payload.timestampKey = values.timestampKey;
}

mutate(payload);
};

return (
<DashboardCard title={"Start Ingestion"}>
<Form
form={form}
layout={"vertical"}
onFinish={handleSubmit}
>
<PathsInputFormItem/>
{CLP_STORAGE_ENGINES.CLP_S === SETTINGS_STORAGE_ENGINE && <ClpSFormItems/>}
<SubmitFormItem isSubmitting={isSubmitting}/>

{isSuccess && (
<Typography.Text type={"success"}>
Compression job submitted successfully with ID:
{" "}
{data.jobId}
</Typography.Text>
)}
{isError && (
<Typography.Text type={"danger"}>
Failed to submit compression job:
{" "}
{error instanceof Error ?
error.message :
"Unknown error"}
</Typography.Text>
)}
</Form>
</DashboardCard>
);
};


export default Compress;
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import {useQuery} from "@tanstack/react-query";
import {CLP_STORAGE_ENGINES} from "@webui/common/config";
import dayjs from "dayjs";

import {
CLP_STORAGE_ENGINES,
SETTINGS_STORAGE_ENGINE,
} from "../../../config";
import {SETTINGS_STORAGE_ENGINE} from "../../../config";
import {fetchDatasetNames} from "../../SearchPage/SearchControls/Dataset/sql";
import Files from "./Files";
import styles from "./index.module.css";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import {useQuery} from "@tanstack/react-query";
import {CLP_STORAGE_ENGINES} from "@webui/common/config";
import {theme} from "antd";

import {DashboardCard} from "../../../components/DashboardCard";
import Stat from "../../../components/Stat";
import {
CLP_STORAGE_ENGINES,
SETTINGS_STORAGE_ENGINE,
} from "../../../config";
import {SETTINGS_STORAGE_ENGINE} from "../../../config";
import {fetchDatasetNames} from "../../SearchPage/SearchControls/Dataset/sql";
import CompressedSize from "./CompressedSize";
import styles from "./index.module.css";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
gap: 20px;
}

.jobsGrid {
.fullRow {
grid-column: 1 / -1;
}
6 changes: 5 additions & 1 deletion components/webui/client/src/pages/IngestPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Compress from "./Compress";
import Details from "./Details";
import styles from "./index.module.css";
import Jobs from "./Jobs";
Expand All @@ -14,7 +15,10 @@ const IngestPage = () => {
<div className={styles["ingestPageGrid"]}>
<SpaceSavings/>
<Details/>
<div className={styles["jobsGrid"] || ""}>
<div className={styles["fullRow"] || ""}>
<Compress/>
</div>
<div className={styles["fullRow"] || ""}>
<Jobs/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
CLP_STORAGE_ENGINES,
SETTINGS_STORAGE_ENGINE,
} from "../../../config";
import {CLP_STORAGE_ENGINES} from "@webui/common/config";

import {SETTINGS_STORAGE_ENGINE} from "../../../config";
import Dataset from "./Dataset";
import styles from "./index.module.css";
import QueryInput from "./QueryInput";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import {useCallback} from "react";

import {SearchOutlined} from "@ant-design/icons";
import {CLP_STORAGE_ENGINES} from "@webui/common/config";
import {
Button,
Tooltip,
} from "antd";

import {
CLP_STORAGE_ENGINES,
SETTINGS_STORAGE_ENGINE,
} from "../../../../../config";
import {SETTINGS_STORAGE_ENGINE} from "../../../../../config";
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick

Avoid split config sources (consider co-locating).

If @webui/common/config also exports SETTINGS_STORAGE_ENGINE, import both from there to prevent drift between modules; otherwise, consider re-exporting to keep a single source of truth.

Can you confirm whether SETTINGS_STORAGE_ENGINE is (or can be) exported from @webui/common/config as part of this consolidation?

🤖 Prompt for AI Agents
In
components/webui/client/src/pages/SearchPage/SearchControls/SearchButton/SubmitButton/index.tsx
around line 10, the module imports SETTINGS_STORAGE_ENGINE from a relative
config path which risks config drift; update the import to come from
@webui/common/config (or, if that package doesn't currently export
SETTINGS_STORAGE_ENGINE, add a re-export there so it becomes the single source
of truth), then update this file to import SETTINGS_STORAGE_ENGINE from
@webui/common/config and remove the relative import; verify that the constant is
exported from @webui/common/config and adjust its export if necessary so all
modules can import the same symbol.

import {computeTimelineConfig} from "../../../SearchResults/SearchResultsTimeline/utils";
import useSearchStore from "../../../SearchState/index";
import {SEARCH_UI_STATE} from "../../../SearchState/typings";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
CLP_QUERY_ENGINES,
SETTINGS_QUERY_ENGINE,
} from "../../../config";
import {CLP_QUERY_ENGINES} from "@webui/common/config";

import {SETTINGS_QUERY_ENGINE} from "../../../config";
import usePrestoSearchState from "../SearchState/Presto";
import {PRESTO_SQL_INTERFACE} from "../SearchState/Presto/typings";
import NativeControls from "./NativeControls";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {CLP_STORAGE_ENGINES} from "@webui/common/config";
import {
type QueryJob,
type QueryJobCreation,
Expand All @@ -9,10 +10,7 @@ import {
clearQueryResults,
submitQuery,
} from "../../../api/search";
import {
CLP_STORAGE_ENGINES,
SETTINGS_STORAGE_ENGINE,
} from "../../../config";
import {SETTINGS_STORAGE_ENGINE} from "../../../config";
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

🧩 Analysis chain

Mixed config sources; align types/values for engine comparison.

Confirm SETTINGS_STORAGE_ENGINE is one of Object.values(CLP_STORAGE_ENGINES); otherwise the equality check will silently fail. Consider consolidating SETTINGS_STORAGE_ENGINE into @webui/common/config or exporting a shared StorageEngine type from there to enforce compatibility.


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Locate SETTINGS_STORAGE_ENGINE definition/initialization:"
rg -nC3 'SETTINGS_STORAGE_ENGINE' components/webui/client/src/config

echo; echo "Inspect CLP_STORAGE_ENGINES values:"
rg -nC3 'export\s+const\s+CLP_STORAGE_ENGINES' components/webui/common/src/config.ts

Length of output: 1370


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Show client config ==="
sed -n '1,240p' components/webui/client/src/config/index.ts || true

echo
echo "=== Search repo for CLP_STORAGE_ENGINES occurrences ==="
rg -n --hidden --no-ignore -S 'CLP_STORAGE_ENGINES' -g '!*node_modules/*' -C2 || true

echo
echo "=== Look specifically for enum/const definitions for CLP_STORAGE_ENGINES ==="
rg -n --hidden --no-ignore -S 'export\s+(const|enum)\s+CLP_STORAGE_ENGINES|enum\s+CLP_STORAGE_ENGINES|CLP_STORAGE_ENGINES\s*=' -g '!*node_modules/*' -C2 || true

echo
echo "=== Search for CLP_QUERY_ENGINES occurrences ==="
rg -n --hidden --no-ignore -S 'CLP_QUERY_ENGINES' -g '!*node_modules/*' -C2 || true

echo
echo "=== Find where settings.ClpStorageEngine is defined/used ==="
rg -n --hidden --no-ignore -S 'ClpStorageEngine' -g '!*node_modules/*' -C2 || true

echo
echo "=== Print likely settings files (if present) ==="
sed -n '1,240p' components/webui/client/src/settings.ts || true
sed -n '1,240p' components/webui/client/src/settings/index.ts || true
sed -n '1,240p' components/webui/client/src/settings/index.tsx || true

echo
echo "=== Search common config directory for storage engine definitions ==="
rg -n --hidden --no-ignore -S 'CLP_STORAGE_ENGINES|CLP_QUERY_ENGINES' components/webui/common -g '!*node_modules/*' -C2 || true

Length of output: 2694


Ensure runtime value of SETTINGS_STORAGE_ENGINE matches CLP_STORAGE_ENGINES

settings.ClpStorageEngine is declared as string and loaded from settings.json but only type-asserted to CLP_STORAGE_ENGINES; the STREAM_TYPE equality can silently fail at runtime.

  • Fix options: (A) export a shared StorageEngine enum/type from @webui/common/config and use it for Settings.ClpStorageEngine (compile-time safety), or (B) add a runtime check (e.g. if (!Object.values(CLP_STORAGE_ENGINES).includes(settings.ClpStorageEngine)) throw or fallback).
  • Fix locations: components/webui/client/src/config/index.ts (STREAM_TYPE equality) and components/webui/client/src/settings.ts (Settings.ClpStorageEngine typing/loading).
🤖 Prompt for AI Agents
In
components/webui/client/src/pages/SearchPage/SearchControls/search-requests.ts
around line 13, the import of SETTINGS_STORAGE_ENGINE highlights a runtime/type
mismatch: Settings.ClpStorageEngine is typed as string and only type-asserted to
CLP_STORAGE_ENGINES, so STREAM_TYPE equality can silently fail; update code to
ensure runtime safety by either exporting a shared StorageEngine enum/type from
@webui/common/config and using that type for Settings.ClpStorageEngine (change
components/webui/client/src/settings.ts to type the value as the shared enum and
ensure parsed settings.json is validated/typed), and update
components/webui/client/src/config/index.ts to import and compare against the
shared enum, OR add an explicit runtime validation where settings are loaded
(components/webui/client/src/settings.ts) that checks
Object.values(CLP_STORAGE_ENGINES).includes(settings.ClpStorageEngine) and
throws or falls back if invalid, and then adjust
components/webui/client/src/config/index.ts to rely on the validated value;
apply the change consistently in both mentioned files.

import useSearchStore, {SEARCH_STATE_DEFAULT} from "../SearchState/";
import {SEARCH_UI_STATE} from "../SearchState/typings";
import {unquoteString} from "./utils";
Expand Down
Loading
Loading