Repository navigation
Closed
Labels
vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
- Link the environment settings file to a file in a separate configuration directory.
- Open Settings → Maintenance.
- Change the log retention value in the linked file and see the new value in Maintenance.
- Replace the directory containing the linked file with a restored copy at the same path.
- Change the log retention value in the restored directory.
Expected behavior
Maintenance shows the value saved in the restored directory.
Actual behavior
Maintenance keeps showing the value from before the restore.
Impact
Minor bug or occasional failure. People who replace the directory holding their symlinked settings can keep seeing stale values even after further edits.
Version or commit
main at 94baff19c6. The cause is at apps/server/src/serverSettings.ts:1335.
Environment
Linux x64 boat.dev default machine, a fresh checkout.
Logs or stack traces
expected: value "9"Automated repro
Fails in 2 of 2 runs on main: apply the patch with git apply, then run the command.
diff --git a/scripts/scenarios/restored-settings-directory-stays-live.e2e.ts b/scripts/scenarios/restored-settings-directory-stays-live.e2e.ts
new file mode 100644
index 0000000000..e375d7b51f
--- /dev/null
+++ b/scripts/scenarios/restored-settings-directory-stays-live.e2e.ts
@@ -0,0 +1,84 @@
+import { expect } from "e2e";
+import * as Effect from "effect/Effect";
+import * as FileSystem from "effect/FileSystem";
+import * as Schema from "effect/Schema";
+
+import { T3_HOME } from "../e2e.config.ts";
+import { runPromise, test, WEB } from "./t3.ts";
+
+const decodeSettings = Schema.decodeSync(
+ Schema.fromJsonString(Schema.Record(Schema.String, Schema.Unknown)),
+);
+
+test(
+ "Maintenance reflects edits to a symlinked settings file after restoring its directory",
+ WEB,
+ async ({ t3, app, screen }) => {
+ await t3.project("settings-restore");
+ const settingsPath = `${T3_HOME}/userdata/settings.json`;
+ const active = `${T3_HOME}/active-settings`;
+ const previous = `${T3_HOME}/old-settings`;
+ const restored = `${T3_HOME}/restored-settings`;
+ const original = await runPromise(
+ Effect.gen(function* () {
+ const fs = yield* FileSystem.FileSystem;
+ return yield* fs.readFileString(settingsPath);
+ }),
+ );
+ const settings = decodeSettings(original);
+ const contents = (days: number) =>
+ JSON.stringify({
+ ...settings,
+ storageCleanup: { logsAfterDays: days },
+ });
+
+ await runPromise(
+ Effect.gen(function* () {
+ const fs = yield* FileSystem.FileSystem;
+ yield* fs.makeDirectory(active);
+ yield* fs.makeDirectory(restored);
+ yield* fs.writeFileString(`${active}/settings.json`, contents(5));
+ yield* fs.writeFileString(`${restored}/settings.json`, contents(7));
+ yield* fs.symlink(`${active}/settings.json`, `${settingsPath}.link`);
+ yield* fs.rename(`${settingsPath}.link`, settingsPath);
+ }),
+ );
+ try {
+ await t3.open("/settings/maintenance");
+ const days = screen.getByLabel("Delete old rotated logs in days");
+ await days.scrollIntoView();
+ await expect(days).toHaveValue("5");
+ await runPromise(
+ Effect.flatMap(FileSystem.FileSystem, (fs) =>
+ fs.writeFileString(`${active}/settings.json`, contents(7)),
+ ),
+ );
+ await expect(days).toHaveValue("7");
+
+ await runPromise(
+ Effect.gen(function* () {
+ const fs = yield* FileSystem.FileSystem;
+ yield* fs.rename(active, previous);
+ yield* fs.rename(restored, active);
+ yield* fs.writeFileString(`${active}/settings.json`, contents(9));
+ }),
+ );
+ try {
+ await expect(days).toHaveValue("9");
+ } finally {
+ await app.screenshot("retention-after-settings-directory-restore");
+ }
+ } finally {
+ await runPromise(
+ Effect.gen(function* () {
+ const fs = yield* FileSystem.FileSystem;
+ yield* fs.writeFileString(`${settingsPath}.original`, original);
+ yield* fs.rename(`${settingsPath}.original`, settingsPath);
+ for (const directory of [active, previous, restored]) {
+ yield* fs.remove(directory, { recursive: true, force: true });
+ }
+ }),
+ );
+ }
+ },
+);pnpm scenarios:prove scripts/scenarios/restored-settings-directory-stays-live.e2e.ts --base mainWorkaround
No response
Metadata
Metadata
Assignees
Labels
vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.


Activity