@devries-cameron20 / t3code Mirror · read-only / commits / d65249074b
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 22:00 UTC

fix(contracts): settings save again when the writing style has default fields (#22203)

Co-authored-by: Claude Code <noreply@anthropic.com>

MatiasGadeberg committed Oct 20, 2026 at 19:09 UTC d65249074b54d7e8a72cb9a9e7f8b37bbd0a89a6
2 files changed +37 -13
apps/server/src/serverSettings.test.ts
+23
@@ -1407,6 +1407,29 @@ it.layer(NodeServices.layer)("server settings", (it) => {
1407 }).pipe(Effect.provide(layerServerSettings())),
1408 );
1409
1410 + it.effect("saves a writing style whose other fields are defaults", () =>
1411 + Effect.gen(function* () {
1412 + const serverSettings = yield* ServerSettingsModule.ServerSettingsService;
1413 + const serverConfig = yield* ServerConfig.ServerConfig;
1414 + const fileSystem = yield* FileSystem.FileSystem;
1415 + yield* serverSettings.updateSettings({
1416 + sourceControlWritingStyle: { mode: "conventional_commits" },
1417 + });
1418 + yield* serverSettings.updateSettings({ addProjectBaseDirectory: "~/Development" });
1419 +
1420 + const raw = yield* fileSystem.readFileString(serverConfig.settingsPath);
1421 + assert.deepEqual(JSON.parse(raw), {
1422 + addProjectBaseDirectory: "~/Development",
1423 + sourceControlWritingStyle: { mode: "conventional_commits" },
1424 + });
1425 + assert.deepEqual((yield* serverSettings.getSettings).sourceControlWritingStyle, {
1426 + mode: "conventional_commits",
1427 + customInstructions: "",
1428 + followChangeRequestTemplates: true,
1429 + });
1430 + }).pipe(Effect.provide(layerServerSettings())),
1431 + );
1432 +
1433 it.effect("keeps the inline value on disk when secret migration fails", () => {
1434 const cause = new ServerSecretStore.SecretStorePersistError({
1435 resource: "provider environment secret",
packages/contracts/src/settings.ts
+14 -13
@@ -819,26 +819,27 @@ export const SourceControlWritingStyleSettings = Schema.Struct({
819 });
820 export type SourceControlWritingStyleSettings = typeof SourceControlWritingStyleSettings.Type;
821
822 -const SourceControlWritingStyleSetting = Schema.Union([
823 - TrimmedString,
824 - SourceControlWritingStyleSettings,
825 -]).pipe(
822 +const LegacySourceControlWritingStyle = TrimmedString.pipe(
823 Schema.decodeTo(
824 Schema.toType(SourceControlWritingStyleSettings),
825 SchemaTransformation.transform({
829 - decode: (value) =>
830 - typeof value === "string"
831 - ? {
832 - mode: value.length > 0 ? ("custom" as const) : ("repo_conventions" as const),
833 - customInstructions: value,
834 - followChangeRequestTemplates: true,
835 - }
836 - : value,
837 - encode: (value) => value,
826 + decode: (value): SourceControlWritingStyleSettings => ({
827 + mode: value.length > 0 ? "custom" : "repo_conventions",
828 + customInstructions: value,
829 + followChangeRequestTemplates: true,
830 + }),
831 + encode: (value) => value.customInstructions,
832 }),
833 ),
834 );
835
836 +// The struct member comes first so encoding uses its defaulted fields: the server strips
837 +// default sub-fields before writing settings.json, and a toType target would reject them.
838 +const SourceControlWritingStyleSetting = Schema.Union([
839 + SourceControlWritingStyleSettings,
840 + LegacySourceControlWritingStyle,
841 +]);
842 +
843 export const BranchNamingMode = Schema.Literals(["static", "semantic", "custom"]);
844 export type BranchNamingMode = typeof BranchNamingMode.Type;
845