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
16 changes: 16 additions & 0 deletions ui/src/config-editor/store.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,22 @@ describe("ConfigEditorStore", () => {
expect(store.serializeSelectedFile()).toBe("motd=hello\n");
});

it("preserves unresolved numeric runtime placeholders without validation errors", () => {
const store = loadedStore(
"motd=hello\nserver-port=__DRUID_PORT_MAIN__\n",
fileSchema([
baseField({ key: "motd", type: "string", min: undefined, max: undefined }),
baseField({ key: "server-port" }),
]),
);

expect(store.snapshot().fields["server-port"]!.issues).toEqual([]);
store.setDisplayValue("motd", "updated");
expect(store.serializeSelectedFile()).toBe(
"motd=updated\nserver-port=__DRUID_PORT_MAIN__\n",
);
});

it("redacts secret values from change summaries and immutable snapshots", () => {
const store = loadedStore(
"password=old-secret\n",
Expand Down
7 changes: 7 additions & 0 deletions ui/src/config-editor/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,13 @@ export class ConfigEditorStore {
): { value: ConfigValue | undefined; issues: ValidationIssue[] } {
const raw = this.adapter.get(document, field.key);
if (raw === undefined) return { value: undefined, issues: [] };
if (
typeof raw === "string" &&
(field.type === "integer" || field.type === "number") &&
/^__DRUID_[A-Z0-9_]+__$/.test(raw)
) {
return { value: undefined, issues: [] };
}
try {
const value = coerceFieldValue(field, raw);
return { value, issues: validateField(field, value) };
Expand Down
Loading