Subject: Re: [PATCH] services: syncthing: Improve Syncthnig code standard compliance.

From: Zacchaeus Scheffer <[email-masked]>
Date: Tue, 11 Mar 2025 17:19:09 -0400

Hi Leo,

Regarding your irc question about steps to upgrade, I did explain what
was backwards-incompatible in the patch annotation, but for completion I
can enumerate all possible implications.  I was able to handle data type
changes in a backwards-compatible way.  There are two considerations,
file locations, and record field renames, which I will list below in two
respective groups with tl;dr's:

FILE LOCATIONS:

tl;dr make sure the id (*.pem) files you want to use are in
`~/.local/state/syncthing/` and make sure
`~/.config/syncthing/config.xml` does not exist after upgrade.

If `config-file` was non-nil, then Guix will have generated configuration
in ~/.config/syncthing.  To avoid a change in device ID, the user should
move the .pem files from there to ~/.local/state/syncthing.  Also move
the config file itself in case it became a non-simlink for one of a few
reasons[1].

mv ~/.config/syncthing/*.pem ~/.config/syncthing/*.xml ~/.local/state/syncthing/

Of course, if the user had *.pem in ~/.local/state/syncthing which they
prefer to use (and were annoyed when the first version of this patch
changed their device ID), they may want to keep the *.pem files in
~/.local/state/syncthing.  Regardless, they should make sure
~/.config/syncthnig/config.xml does not exist, or it will override the
one provided by the service.

[1] Users might have a config.xml in ~/.config/syncthing/ which does not
get removed on upgrade because it is not a symlink, either because they
modified something in-gui which rewrote the file as not a symlink,
because they have a very old Syncthing install (which respects old
config paths after upgrade), or because they manually chose to switch
their config to ~/.config/syncthing/ at some point (more people than you
might think).

RECORD FIELD RENAMES:

tl;dr a bunch of record field names changed, but they are ones that are
rarely used, and guix will (loudly) tell you which fields are wrong.

In short, boolean fields now end in '?', and the following name
expansions were made:

s -> seconds
m -> minutes
h -> hours
fs -> file-system
pct -> percentage
perms -> permissions
mcaddr -> mac-address

more verbosely, here are the name changes by record:

syncthing-device:
introducer -> introducer?
skip-introduction-removals -> skip-introduction-removals?
paused -> paused?
auto-accept-folders -> auto-accept-folders?
untrusted -> untrusted?
recv -> receive
auth -> authorization

syncthing-folder:
versioning-fs-path -> versioning-file-system-path
versioning-fs-type -> versioning-file-system-type
versioning-cleanup-interval-s -> versioning-cleanup-interval-seconds
ignore-delete -> ignore-delete?
scan-progress-interval-s -> scan-progress-interval-seconds
puller-pause-s -> puller-pause-seconds
disable-sparse-files -> disable-sparse-files?
disable-temp-indexes -> disable-temp-indexes?
paused -> paused?
weak-hash-threshold-pct -> weak-hash-threshold-percentage
copy-ownership-from-parent -> copy-ownership-from-parent?
mod-time-window-s -> mod-time-window-seconds
disable-fsync -> disable-fsync?
case-sensitive-fs -> case-sensitive-file-system?
junctions-as-dirs -> junctions-as-dirs?
sync-ownership -> sync-ownership?
send-ownership -> send-ownership?
sync-xattrs -> sync-xattrs?
send-xattrs -> send-xattrs?
rescan-interval-s -> rescan-interval-seconds
fs-watcher-enabled -> file-system-watcher-enabled?
fs-watcher-delay-s -> file-system-watcher-delay-seconds
fs-watcher-timeout-s -> file-system-watcher-timeout-seconds
ignore-perms -> ignore-permissions?
auto-normalize -> auto-normalize?

syncthing-config-file
announce-lan-addresses -> announce-lan-addresses?
send-full-index-on-upgrade -> send-full-index-on-upgrade?
insecure-allow-old-tls-versions -> insecure-allow-old-tls-versions?
crash-reporting-enabled -> crash-reporting-enabled?
stun-keepalive-start-s -> stun-keepalive-start-seconds
stun-keepalive-min-s -> stun-keepalive-min-seconds
set-low-priority -> set-low-priority?
overwrite-remote-device-names-on-connect -> overwrite-remote-device-names-on-connect?
global-announce-enabled -> global-announce-enabled?
local-announce-enabled -> local-announce-enabled?
local-announce-mcaddr -> local-announce-mac-address
max-recv-kbps -> max-receive-kbps
reconnection-interval-s -> reconnection-interval-seconds
relays-enabled -> relays-enabled?
relay-reconnect-interval-m -> relay-reconnect-interval-minutes
start-browser -> start-browser?
nat-enabled -> nat-enabled?
ur-accepted -> usage-reporting-accepted
ur-seen -> usage-reporting-seen
ur-unique-id -> usage-reporting-unique-id
ur-url -> usage-reporting-url
ur-post-insecurely -> usage-reporting-post-insecurely?
ur-initial-delay-s -> usage-reporting-initial-delay-seconds
auto-upgrade-interval-h -> auto-upgrade-interval-hours
upgrade-to-pre-releases -> upgrade-to-pre-releases?
keep-temporaries-h -> keep-temporaries-hours
cache-ignored-files -> cache-ignored-files?
progress-update-interval-s -> progress-update-interval-seconds
limit-bandwidth-in-lan -> limit-bandwidth-in-lan?
ldap-enabled -> ldap-enabled?
gui-enabled -> gui-enabled?
gui-tls -> gui-tls?
gui-debugging -> gui-debugging?
gui-send-basic-auth-prompt -> gui-send-basic-authorization-prompt?

eikcaz-