kp-sync 0.7.0__tar.gz → 0.7.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. {kp_sync-0.7.0 → kp_sync-0.7.2}/CHANGES.md +35 -0
  2. {kp_sync-0.7.0 → kp_sync-0.7.2}/PKG-INFO +1 -1
  3. {kp_sync-0.7.0 → kp_sync-0.7.2}/PLAN.md +6 -4
  4. {kp_sync-0.7.0 → kp_sync-0.7.2}/design/configuration-cli.md +1 -1
  5. {kp_sync-0.7.0 → kp_sync-0.7.2}/design/history-and-sync.md +3 -1
  6. {kp_sync-0.7.0 → kp_sync-0.7.2}/design/interaction.md +9 -1
  7. {kp_sync-0.7.0 → kp_sync-0.7.2}/man/man1/kp-sync.1 +7 -1
  8. {kp_sync-0.7.0 → kp_sync-0.7.2}/pyproject.toml +1 -1
  9. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/__init__.py +1 -1
  10. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/baseline.py +17 -9
  11. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/cli.py +11 -1
  12. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/engine.py +108 -14
  13. kp_sync-0.7.2/src/kp_sync/history_command.py +342 -0
  14. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/integration.py +14 -0
  15. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync.egg-info/PKG-INFO +1 -1
  16. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_cloud_sync.py +127 -0
  17. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_database_identity.py +268 -0
  18. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_engine.py +6 -1
  19. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_integration.py +24 -0
  20. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_skeleton.py +10 -2
  21. kp_sync-0.7.0/src/kp_sync/history_command.py +0 -171
  22. {kp_sync-0.7.0 → kp_sync-0.7.2}/.pycodestyle +0 -0
  23. {kp_sync-0.7.0 → kp_sync-0.7.2}/DESIGN.md +0 -0
  24. {kp_sync-0.7.0 → kp_sync-0.7.2}/LICENSE +0 -0
  25. {kp_sync-0.7.0 → kp_sync-0.7.2}/MANIFEST.in +0 -0
  26. {kp_sync-0.7.0 → kp_sync-0.7.2}/README.md +0 -0
  27. {kp_sync-0.7.0 → kp_sync-0.7.2}/design/architecture.md +0 -0
  28. {kp_sync-0.7.0 → kp_sync-0.7.2}/design/development.md +0 -0
  29. {kp_sync-0.7.0 → kp_sync-0.7.2}/design/endpoints-and-access.md +0 -0
  30. {kp_sync-0.7.0 → kp_sync-0.7.2}/design/lifecycle.md +0 -0
  31. {kp_sync-0.7.0 → kp_sync-0.7.2}/docs/_ext/cli_help.py +0 -0
  32. {kp_sync-0.7.0 → kp_sync-0.7.2}/docs/_ext/module_reference.py +0 -0
  33. {kp_sync-0.7.0 → kp_sync-0.7.2}/docs/_static/layout.css +0 -0
  34. {kp_sync-0.7.0 → kp_sync-0.7.2}/docs/api.rst +0 -0
  35. {kp_sync-0.7.0 → kp_sync-0.7.2}/docs/cli.rst +0 -0
  36. {kp_sync-0.7.0 → kp_sync-0.7.2}/docs/conf.py +0 -0
  37. {kp_sync-0.7.0 → kp_sync-0.7.2}/docs/contributing.rst +0 -0
  38. {kp_sync-0.7.0 → kp_sync-0.7.2}/docs/getting-started.rst +0 -0
  39. {kp_sync-0.7.0 → kp_sync-0.7.2}/docs/index.rst +0 -0
  40. {kp_sync-0.7.0 → kp_sync-0.7.2}/docs/integration.rst +0 -0
  41. {kp_sync-0.7.0 → kp_sync-0.7.2}/docs/internals.rst +0 -0
  42. {kp_sync-0.7.0 → kp_sync-0.7.2}/docs/modules.rst +0 -0
  43. {kp_sync-0.7.0 → kp_sync-0.7.2}/docs/reusing-documentation.rst +0 -0
  44. {kp_sync-0.7.0 → kp_sync-0.7.2}/examples/README.md +0 -0
  45. {kp_sync-0.7.0 → kp_sync-0.7.2}/examples/bash-completion/kps +0 -0
  46. {kp_sync-0.7.0 → kp_sync-0.7.2}/examples/configs/cloud-only.toml +0 -0
  47. {kp_sync-0.7.0 → kp_sync-0.7.2}/examples/configs/cloud-rcd.toml +0 -0
  48. {kp_sync-0.7.0 → kp_sync-0.7.2}/examples/configs/dropbox.toml +0 -0
  49. {kp_sync-0.7.0 → kp_sync-0.7.2}/examples/configs/everything.toml +0 -0
  50. {kp_sync-0.7.0 → kp_sync-0.7.2}/examples/configs/pendrives-only.toml +0 -0
  51. {kp_sync-0.7.0 → kp_sync-0.7.2}/examples/configs/persistent-hub-folders.toml +0 -0
  52. {kp_sync-0.7.0 → kp_sync-0.7.2}/examples/keepass +0 -0
  53. {kp_sync-0.7.0 → kp_sync-0.7.2}/examples/main-laptop.toml +0 -0
  54. {kp_sync-0.7.0 → kp_sync-0.7.2}/examples/second-laptop.toml +0 -0
  55. {kp_sync-0.7.0 → kp_sync-0.7.2}/examples/udevmon/main-laptop.toml +0 -0
  56. {kp_sync-0.7.0 → kp_sync-0.7.2}/examples/udevmon/second-laptop.toml +0 -0
  57. {kp_sync-0.7.0 → kp_sync-0.7.2}/man/man5/kp-sync-config.5 +0 -0
  58. {kp_sync-0.7.0 → kp_sync-0.7.2}/setup.cfg +0 -0
  59. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/__main__.py +0 -0
  60. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/access_op.py +0 -0
  61. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/access_ops.py +0 -0
  62. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/backups.py +0 -0
  63. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/classify.py +0 -0
  64. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/cleanup.py +0 -0
  65. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/cloud_contact.py +0 -0
  66. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/completion.py +0 -0
  67. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/config.py +0 -0
  68. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/content.py +0 -0
  69. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/credentials.py +0 -0
  70. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/daemon/__init__.py +0 -0
  71. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/daemon/apps.py +0 -0
  72. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/daemon/client.py +0 -0
  73. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/daemon/dbus.py +0 -0
  74. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/daemon/inhibit.py +0 -0
  75. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/daemon/leases.py +0 -0
  76. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/daemon/protocol.py +0 -0
  77. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/daemon/rescue.py +0 -0
  78. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/daemon/server.py +0 -0
  79. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/daemon/systemd.py +0 -0
  80. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/daemon/triggers.py +0 -0
  81. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/drive_retire.py +0 -0
  82. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/drive_setup.py +0 -0
  83. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/drive_sync.py +0 -0
  84. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/drives.py +0 -0
  85. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/endpoints/__init__.py +0 -0
  86. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/endpoints/access.py +0 -0
  87. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/endpoints/base.py +0 -0
  88. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/endpoints/command.py +0 -0
  89. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/endpoints/file.py +0 -0
  90. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/endpoints/rclone.py +0 -0
  91. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/endpoints/session.py +0 -0
  92. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/history.py +0 -0
  93. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/idle.py +0 -0
  94. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/kdbx.py +0 -0
  95. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/keepassxc.py +0 -0
  96. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/lock.py +0 -0
  97. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/log.py +0 -0
  98. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/merge.py +0 -0
  99. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/paths.py +0 -0
  100. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/pending.py +0 -0
  101. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/rclone_credentials.py +0 -0
  102. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/rclone_rcd.py +0 -0
  103. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/reach.py +0 -0
  104. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/repair.py +0 -0
  105. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/services.py +0 -0
  106. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/sessions/__init__.py +0 -0
  107. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/sessions/authkeys.py +0 -0
  108. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/sessions/diagnostic.py +0 -0
  109. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/sessions/records.py +0 -0
  110. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/sessions/session.py +0 -0
  111. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/sessions/sftp_serve.py +0 -0
  112. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/setup_host.py +0 -0
  113. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/state.py +0 -0
  114. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/udevmon.py +0 -0
  115. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/ui/__init__.py +0 -0
  116. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/ui/base.py +0 -0
  117. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/ui/factory.py +0 -0
  118. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/ui/fake.py +0 -0
  119. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/ui/gui.py +0 -0
  120. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/ui/none.py +0 -0
  121. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/ui/progress.py +0 -0
  122. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/ui/tty.py +0 -0
  123. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync/verify.py +0 -0
  124. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync.egg-info/SOURCES.txt +0 -0
  125. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync.egg-info/dependency_links.txt +0 -0
  126. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync.egg-info/entry_points.txt +0 -0
  127. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync.egg-info/requires.txt +0 -0
  128. {kp_sync-0.7.0 → kp_sync-0.7.2}/src/kp_sync.egg-info/top_level.txt +0 -0
  129. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/__init__.py +0 -0
  130. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/acceptance_sessions.py +0 -0
  131. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/data/keepassxc.xml +0 -0
  132. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/fixtures.py +0 -0
  133. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_access_ops.py +0 -0
  134. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_baseline.py +0 -0
  135. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_cleanup.py +0 -0
  136. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_cloud_contact.py +0 -0
  137. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_compatibility.py +0 -0
  138. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_completion.py +0 -0
  139. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_config.py +0 -0
  140. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_content.py +0 -0
  141. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_credentials.py +0 -0
  142. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_daemon.py +0 -0
  143. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_desktop.py +0 -0
  144. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_documentation.py +0 -0
  145. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_drive_retire.py +0 -0
  146. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_drive_setup.py +0 -0
  147. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_drives.py +0 -0
  148. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_endpoints.py +0 -0
  149. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_examples.py +0 -0
  150. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_history.py +0 -0
  151. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_history_command.py +0 -0
  152. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_idle.py +0 -0
  153. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_isolation.py +0 -0
  154. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_kdbx.py +0 -0
  155. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_keepassxc.py +0 -0
  156. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_keepassxc_settings.py +0 -0
  157. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_license.py +0 -0
  158. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_log.py +0 -0
  159. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_merge.py +0 -0
  160. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_pending.py +0 -0
  161. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_rclone.py +0 -0
  162. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_rclone_credentials.py +0 -0
  163. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_rclone_rcd.py +0 -0
  164. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_reach.py +0 -0
  165. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_releases.py +0 -0
  166. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_repair.py +0 -0
  167. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_run_tests.py +0 -0
  168. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_services.py +0 -0
  169. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_sessions.py +0 -0
  170. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_setup_host.py +0 -0
  171. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_status.py +0 -0
  172. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_udevmon.py +0 -0
  173. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/test_ui.py +0 -0
  174. {kp_sync-0.7.0 → kp_sync-0.7.2}/tests/udevmon_fake.py +0 -0
  175. {kp_sync-0.7.0 → kp_sync-0.7.2}/tools/docs.py +0 -0
  176. {kp_sync-0.7.0 → kp_sync-0.7.2}/tools/releases.py +0 -0
  177. {kp_sync-0.7.0 → kp_sync-0.7.2}/tools/run_tests.py +0 -0
@@ -3,6 +3,41 @@
3
3
  User-visible changes per release, newest first. Commit history and tags
4
4
  hold the details; design decisions live in the `design/` chapters.
5
5
 
6
+ ## 0.7.2 (2026-11-30)
7
+
8
+ ### Added
9
+
10
+ - `kp-sync doctor --history` also reads each history store (the cloud
11
+ and attached drives, read-only) and checks which database it records:
12
+ another database's history (a wrong `remote` or `[baseline] dir`) and
13
+ two histories of one database fail, before a sync finds them.
14
+
15
+ ### Fixed
16
+
17
+ - Recording the first version no longer waits up to 15 minutes, with
18
+ "database could not be opened with the supplied credentials", when
19
+ the cached password does not open the copy (the password was changed,
20
+ or the cache was another database's under the same profile): the
21
+ password is asked for once and replaces the cached one if it opens
22
+ the copy. If the same password is typed again, the wait names the key
23
+ file as the likely cause.
24
+ - `kp-sync history` no longer removes the record of a drive whose mount
25
+ is gone, which the daemon's drive handling may still need.
26
+
27
+ ## 0.7.1 (2026-11-29)
28
+
29
+ ### Fixed
30
+
31
+ - A sync no longer fails with "copies kept changing during sync" when a
32
+ change must be written while an endpoint is left out as another
33
+ database's (its history store or its copy): the check before writing
34
+ took that unread copy for one that changed, and restarted until the
35
+ limit.
36
+ - `on_unavailable = "fail"` now also stops the run when an endpoint is
37
+ left out as another database's; that endpoint is still neither read
38
+ nor written, and a copy of another database keeps its pending
39
+ decision.
40
+
6
41
  ## 0.7.0 (2026-11-29)
7
42
 
8
43
  ### Changed (needs udevmon 0.9.0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kp-sync
3
- Version: 0.7.0
3
+ Version: 0.7.2
4
4
  Summary: Synchronize a KeePass database across trusted copies
5
5
  Author-email: Juan Domingo Martín <juando.martin@gmail.com>
6
6
  License-Expression: GPL-3.0-or-later
@@ -187,8 +187,9 @@ line and wait their turn.
187
187
  hand. Not yet seen: duplicate names on Drive and the PLAN 15 path
188
188
  through `kp-sync setup`.
189
189
 
190
- 17. **Database identity from the root group UUID.** Implemented on
191
- branch `cloud-fill`, not yet released; approved 2026-11-20 (rules in
190
+ 17. **Database identity from the root group UUID.** Released in 0.7.0
191
+ (0.7.1: syncs while another database's endpoint is left out);
192
+ approved 2026-11-20 (rules in
192
193
  "Database identity" in the baseline store, history chapter). The
193
194
  history records the root group UUID of its database (nothing is
194
195
  written into the database), learned at the first commit verified
@@ -210,8 +211,9 @@ line and wait their turn.
210
211
  detection and its retention gap, the commit check, the remembered
211
212
  copy and the first-version record. pykeepass-created fixtures share
212
213
  one template root UUID; `create_database(..., another_database=True)`
213
- makes another database. Not done: `doctor`'s store check (doctor
214
- reads no history store today; to decide whether it should). Root
214
+ makes another database. `doctor --history` (opt-in, it contacts
215
+ the stores) reads each store read-only and reports its record,
216
+ another database's store and two histories of one database. Root
215
217
  group UUID kept (2026-11-21, the cloud file's revisions): one edit
216
218
  each from KeePassXC 2.6.6, 2.7.10 and the one phone app that saves
217
219
  the database. Live 2026-11-20 with kp-test's
@@ -205,7 +205,7 @@ source = "runtime"
205
205
  | `kp-sync service install daemon [--desktop]` | write or refresh selected-profile units and required shared templates; reload systemd without enabling or starting; desktop entries opt-in |
206
206
  | `kp-sync setup HOST [--hub PATH \| --runtime-hub] [--key-file PATH] [--remote REMOTE] [--rclone-config PATH] [--drive-dir NAME] [--history-dir NAME] [--drive MOUNT=NAME]... [--alias NAME] [--no-desktop] [--dry-run] [--yes]` | PLAN 3: set up this machine for profile `HOST` by running the steps of "Setting up another machine" (`examples/README.md`) in order, each as the existing command it names, so each behaves and reports as when typed: (1) write `~/.config/kp-sync/HOST.toml` (0600, atomic) from the answers (a persistent hub with `--hub` on an encrypted disk, or the runtime hub; key file, cloud remote, its `rclone_config`, drive and history folder names), or keep an existing one unchanged; (2) `service install daemon` (`--desktop` unless `--no-desktop`) and `service enable daemon --now`; (3) `sync --dry-run`, then `sync`; (4) `drive-setup MOUNT NAME` for each `--drive`; (5) `completion install --alias NAME` with `--alias`, printing the `alias` line for `~/.bashrc`; (6) `doctor`. Missing answers are asked on a terminal (defaults shown) and are an error elsewhere. It prints the whole plan first and asks once before changing anything (`--yes` skips the question, and is required without a terminal); `--dry-run` prints the plan only. It stops at the first failing step, saying which steps remain; running it again repeats the idempotent steps and keeps the profile. It never installs packages, edits `~/.bashrc` or shell files, creates, moves or overwrites a database, retires old scripts or starts an application itself (a main-mode `drive-setup` does, as plugging the drive would) |
207
207
  | `kp-sync completion install [--alias NAME]... [--dry-run]` | since 0.5.1: write kp-sync's argcomplete registration (generated in-process, so the `register-python-argcomplete` helper need not be on `PATH`) and, per `--alias`, `examples/bash-completion/kps` with the alias name filled in, into bash-completion's per-user directory (`$BASH_COMPLETION_USER_DIR/completions`, else `$XDG_DATA_HOME/bash-completion/completions`). Files already identical are left alone; others are replaced atomically. Loads no configuration (no `--profile` needed) and contacts nothing; the alias itself stays the user's (`~/.bashrc`) |
208
- | `kp-sync doctor [--self-test]` | check the installation and report what to fix: units installed and enabled, socket reachable and protocol version, menu entry override still in effect and still calling `kp-sync run` (a KeePassXC update may change the system entry), KeePassXC's reload option, key file readable, rclone remote and probe working (a generated probe lists the remote folder as a sync does, since PLAN 16: a database not yet in an existing remote folder is a warning that the next sync installs it only when that folder's history store is read and holds this database's history or none, a missing remote folder fails with the `rclone mkdir` hint; and that the reach check agrees with a working probe: `reach:NAME` fails, saying to set `reach_check`, when the check fails while rclone reaches the cloud), hub on an encrypted disk when `require_encrypted`, a key written by a client readable by the daemon (keyring possession), swap encrypted or absent (`$XDG_RUNTIME_DIR` is tmpfs, which can be swapped out), that every `kp-sync` call in udevmon's actions and kp-access's `[owner] file-op-cmd` selects an existing profile (no `--profile` only with `config.toml`) and, for this profile, that kp-access's `db-path` is its staged copy, and for sessions `bwrap` (and unprivileged user namespaces), `sftp-server`, `~/.ssh/authorized_keys` editable (regular file, owned, not group/other-writable), no stale `kp-sync-session-*` lines, and the system sshd reachable on localhost. With udevmon 0.9.0+, the `udevmon` checks: the features kp-sync needs are installed; `status --json` shows a running daemon of the installed version (an older one still running: restart udevmon with the key drives unplugged); `check --json` has no errors, and its warnings about kp-sync's entries are shown (by source with udevmon 0.10.0, else by name); each kp-sync action's `program` exists and is this kp-sync (by real path); the last result of each kp-sync action since the daemon started succeeded (otherwise its time, status, `failure` and output lines). The action list for the profile check comes from `actions list --json`. Older udevmon: the check fails with what to upgrade and the udevmon parts of the profile check are skipped. Explicit `--self-test` authorizes a five-minute restricted key and a confined localhost SFTP put/get round trip; removes only its own key and runtime artifacts afterwards, never uses the database/key file, and catches shell startup output that breaks SFTP |
208
+ | `kp-sync doctor [--history] [--self-test]` | check the installation and report what to fix: units installed and enabled, socket reachable and protocol version, menu entry override still in effect and still calling `kp-sync run` (a KeePassXC update may change the system entry), KeePassXC's reload option, key file readable, rclone remote and probe working (a generated probe lists the remote folder as a sync does, since PLAN 16: a database not yet in an existing remote folder is a warning that the next sync installs it only when that folder's history store is read and holds this database's history or none, a missing remote folder fails with the `rclone mkdir` hint; and that the reach check agrees with a working probe: `reach:NAME` fails, saying to set `reach_check`, when the check fails while rclone reaches the cloud), hub on an encrypted disk when `require_encrypted`, a key written by a client readable by the daemon (keyring possession), swap encrypted or absent (`$XDG_RUNTIME_DIR` is tmpfs, which can be swapped out), that every `kp-sync` call in udevmon's actions and kp-access's `[owner] file-op-cmd` selects an existing profile (no `--profile` only with `config.toml`) and, for this profile, that kp-access's `db-path` is its staged copy, and for sessions `bwrap` (and unprivileged user namespaces), `sftp-server`, `~/.ssh/authorized_keys` editable (regular file, owned, not group/other-writable), no stale `kp-sync-session-*` lines, and the system sshd reachable on localhost. With udevmon 0.9.0+, the `udevmon` checks: the features kp-sync needs are installed; `status --json` shows a running daemon of the installed version (an older one still running: restart udevmon with the key drives unplugged); `check --json` has no errors, and its warnings about kp-sync's entries are shown (by source with udevmon 0.10.0, else by name); each kp-sync action's `program` exists and is this kp-sync (by real path); the last result of each kp-sync action since the daemon started succeeded (otherwise its time, status, `failure` and output lines). The action list for the profile check comes from `actions list --json`. Older udevmon: the check fails with what to upgrade and the udevmon parts of the profile check are skipped. Explicit `--history` also reads each history store as `history` does (the cloud and attached drives are contacted; read-only, no password, the persistent history cache unchanged): it names the database's root group UUID, fails a store that holds another database's history and two histories of one database (the load checks of "Database identity"), and warns about a store without a record yet, without history, unavailable, or configured but not attached. Explicit `--self-test` authorizes a five-minute restricted key and a confined localhost SFTP put/get round trip; removes only its own key and runtime artifacts afterwards, never uses the database/key file, and catches shell startup output that breaks SFTP |
209
209
  | `kp-sync daemon [--foreground] [--debug]` | run the daemon in the terminal for debugging (the service must be stopped); it never detaches, so `--foreground` changes nothing |
210
210
 
211
211
  ### Status presentation (implemented)
@@ -53,7 +53,9 @@ Rules:
53
53
  this run's history, receives no publication and no database (its
54
54
  endpoint is skipped for the run, reported, without a pending
55
55
  decision): "LOCATION holds the history of another database: wrong
56
- `remote` or `[baseline] dir`?". A store with this database's record
56
+ `remote` or `[baseline] dir`?". An endpoint left out this way (or
57
+ for its copy, below) is not re-checked before the run's writes,
58
+ and with `on_unavailable = "fail"` it stops the run instead. A store with this database's record
57
59
  needs no lineage test before an empty cloud folder is filled (PLAN
58
60
  16); one without a record keeps it.
59
61
  - *Two histories of one database* (the same UUID, no common version,
@@ -292,7 +292,15 @@ send a request to the daemon, and in time-limited contexts return at once
292
292
  A newly entered password is checked against an observed local copy
293
293
  before the run relies on it; a rejected one is removed from the keyring
294
294
  (`forget`) and asked again, up to three times, then the run fails
295
- without caching it.
295
+ without caching it. A cached password is used as it is (checking it
296
+ would open a copy on every run); where nothing else can open the copy,
297
+ the first version of a lone copy, a cached password the copy rejects
298
+ (changed since, or another database's under this profile name) is
299
+ asked for once, with a notice. A mismatched key file fails the same
300
+ way, so the cached password is replaced only when the typed one opens
301
+ the copy; retyping the same password names the key file instead, and
302
+ a failure (or a keyring error) leaves the run waiting with the earlier
303
+ password still cached.
296
304
  - A copy that opens with neither the cached password nor one learned in the
297
305
  run (an old pendrive with a former master key) gets its own key,
298
306
  `kp-sync:PROFILE:copy:SLOT`, so its password never replaces the main one.
@@ -755,7 +755,7 @@ a file completing that alias of
755
755
  Unchanged files are left alone. Needs no profile and contacts nothing;
756
756
  run it again after upgrading argcomplete.
757
757
  .TP
758
- \fBdoctor\fR [\fB\-\-self\-test\fR]
758
+ \fBdoctor\fR [\fB\-\-history\fR] [\fB\-\-self\-test\fR]
759
759
  Check the installation and print one
760
760
  .BR OK ,
761
761
  .B WARNING
@@ -777,6 +777,12 @@ kp-sync, and their last runs succeeded. Some checks contact
777
777
  configured endpoints. Exits 1 if any check fails.
778
778
  .RS
779
779
  .TP
780
+ .B \-\-history
781
+ Also read each history store (the cloud and attached drives; read-only,
782
+ without the password) and check that it records this database: a store
783
+ holding another database's history, or two separate histories of one
784
+ database, fails; a store without a record yet is a warning.
785
+ .TP
780
786
  .B \-\-self\-test
781
787
  Also authorize a five-minute restricted localhost key and perform a
782
788
  confined SFTP upload and download with synthetic data. Only the test's own
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "kp-sync"
7
- version = "0.7.0"
7
+ version = "0.7.2"
8
8
  description = "Synchronize a KeePass database across trusted copies"
9
9
  readme = "README.md"
10
10
  license = "GPL-3.0-or-later"
@@ -2,4 +2,4 @@
2
2
  # Copyright (C) 2026 Juan Domingo Martín
3
3
  """KeePass database synchronization."""
4
4
 
5
- __version__ = "0.7.0"
5
+ __version__ = "0.7.2"
@@ -419,12 +419,18 @@ class BaselineManager:
419
419
  self.publication_outcomes[store_name] = reason
420
420
 
421
421
  def load(
422
- self, temporary: Path, *, read_only: bool = False
422
+ self,
423
+ temporary: Path,
424
+ *,
425
+ read_only: bool = False,
426
+ report_foreign: bool = True,
423
427
  ) -> HistoryState:
424
428
  """Load and merge cached and available shared state.
425
429
 
426
430
  ``temporary`` is the private download directory. Unavailable
427
- stores are skipped; snapshots support checks.
431
+ stores are skipped; snapshots support checks. Without
432
+ ``report_foreign``, another database's store is only recorded in
433
+ ``foreign`` (``doctor`` reports it itself).
428
434
  """
429
435
  cache = HistoryState.load(self.runtime / "state.json")
430
436
  self.cache = cache
@@ -461,13 +467,15 @@ class BaselineManager:
461
467
  and state.database is not None
462
468
  and state.database.root_uuid != identity.root_uuid
463
469
  ):
464
- error(
465
- f"{store_location(store)} holds the history of another "
466
- "database (root group "
467
- f"{state.database.root_uuid}, not "
468
- f"{identity.root_uuid}): wrong `remote` or "
469
- "`[baseline] dir`? It is neither read nor published to."
470
- )
470
+ if report_foreign:
471
+ error(
472
+ f"{store_location(store)} holds the history of "
473
+ "another database (root group "
474
+ f"{state.database.root_uuid}, not "
475
+ f"{identity.root_uuid}): wrong `remote` or "
476
+ "`[baseline] dir`? It is neither read nor "
477
+ "published to."
478
+ )
471
479
  self.foreign[store.name] = state.database.root_uuid
472
480
  self.publication_outcomes[store.name] = "another database"
473
481
  continue
@@ -237,6 +237,14 @@ def _build_parser() -> argparse.ArgumentParser:
237
237
  command_parser.set_defaults(restore_mode="merge")
238
238
  command_parser.add_argument("--dry-run", action="store_true")
239
239
  elif name == "doctor":
240
+ command_parser.add_argument(
241
+ "--history",
242
+ action="store_true",
243
+ help=(
244
+ "also read each history store (the cloud and attached "
245
+ "drives) and check it records this database"
246
+ ),
247
+ )
240
248
  command_parser.add_argument(
241
249
  "--self-test",
242
250
  action="store_true",
@@ -686,7 +694,9 @@ def _dispatch(parser: argparse.ArgumentParser, args) -> int:
686
694
  if args.command == "doctor":
687
695
  from kp_sync.integration import doctor
688
696
 
689
- checks = doctor(config, self_test=args.self_test)
697
+ checks = doctor(
698
+ config, self_test=args.self_test, history=args.history
699
+ )
690
700
  for check in checks:
691
701
  print(_doctor_line(check))
692
702
  return 0 if all(check.ok for check in checks) else 1
@@ -1039,6 +1039,7 @@ class SyncEngine:
1039
1039
  self._foreign_skipped: dict[str, str] = {}
1040
1040
  self._copy_failures: dict[str, str] = {}
1041
1041
  self._absent: set[str] = set()
1042
+ self._left_out: set[str] = set()
1042
1043
  self._refilled: set[str] = set()
1043
1044
  # Versions whose lost base stopped this run publishing history.
1044
1045
  self._unpublished_lost: set[str] = set()
@@ -1661,6 +1662,9 @@ class SyncEngine:
1661
1662
  self._baseline.check(temporary, max_age=RECHECK_WINDOW)
1662
1663
  # The baseline check listed remotes; reuse it.
1663
1664
  for observation in observations:
1665
+ if observation.identity in self._left_out:
1666
+ # Not read: its bytes are not this run's to check.
1667
+ continue
1664
1668
  self._check_unchanged(observation, temporary, cached=True)
1665
1669
 
1666
1670
  if candidate_sha not in state.versions:
@@ -2011,6 +2015,8 @@ class SyncEngine:
2011
2015
  self._absent: set[str] = set()
2012
2016
  # Absent cloud copies that had a record: refilled with a notice.
2013
2017
  self._refilled: set[str] = set()
2018
+ # Left out as another database's (PLAN 17): never targets.
2019
+ self._left_out: set[str] = set()
2014
2020
  foreign_stores = {
2015
2021
  store.endpoint.identity: root
2016
2022
  for store in self._baseline.stores
@@ -2131,9 +2137,18 @@ class SyncEngine:
2131
2137
  """
2132
2138
  from kp_sync.log import info
2133
2139
 
2134
- info(f"{reason}; skipped")
2135
2140
  if pending:
2136
2141
  self._foreign_skipped[endpoint.identity] = reason
2142
+ if endpoint.on_unavailable == "fail":
2143
+ # Kept unchanged either way; a required endpoint stops the
2144
+ # run, a copy keeping its decision.
2145
+ if pending and not self._dry_run:
2146
+ PendingStore(self.run_directory).save(
2147
+ f"foreign:{endpoint.identity}", reason, {}
2148
+ )
2149
+ raise SyncError(f"{reason}; not synchronized")
2150
+ info(f"{reason}; skipped")
2151
+ self._left_out.add(endpoint.identity)
2137
2152
  if not endpoint.optional:
2138
2153
  missing.append(endpoint.identity)
2139
2154
  observations.append(
@@ -3019,8 +3034,8 @@ class SyncEngine:
3019
3034
  if password != previous and not self._opens_an_observed_copy(
3020
3035
  password, key_file
3021
3036
  ):
3022
- # A mistyped password must not stay cached for the
3023
- # The keyring times out; copies may differ after a
3037
+ # A mistyped password must not stay cached until
3038
+ # the keyring times out. Copies may differ after a
3024
3039
  # password change, so any accepting copy suffices.
3025
3040
  forget = getattr(self.credentials, "forget", None)
3026
3041
  if forget is not None:
@@ -3036,6 +3051,82 @@ class SyncEngine:
3036
3051
  raise SyncError(str(exc)) from exc
3037
3052
  raise SyncError("the supplied password was rejected three times")
3038
3053
 
3054
+ def _verify_first_version(
3055
+ self, source: Observation, password: str, key_file: Path
3056
+ ):
3057
+ return verify_candidate(
3058
+ source.local_path,
3059
+ password=password,
3060
+ key_file=key_file,
3061
+ require_keepassxc=True,
3062
+ max_entry_drop=self.config.verify["max_entry_drop"],
3063
+ min_entry_drop=self.config.verify["min_entry_drop"],
3064
+ )
3065
+
3066
+ def _retry_first_version_password(
3067
+ self, source: Observation, cached: str, error: Exception
3068
+ ):
3069
+ """Ask once when the cached password does not open the copy.
3070
+
3071
+ A cached password is not checked when it is read: one left from
3072
+ a password change, or another database's under this profile,
3073
+ fails here. The key file fails the same way, so the cached
3074
+ password is kept unless a newly typed one opens the copy.
3075
+ Returns ``(verification, password, key_file)`` or a reason.
3076
+ """
3077
+ reason = f"the copy cannot become the first version: {error}"
3078
+ try:
3079
+ if (
3080
+ cached in self._transient_passwords
3081
+ or self.credentials.cached_password() != cached
3082
+ ):
3083
+ return reason
3084
+ self.ui.notify(
3085
+ "The cached password and the key file do not open the "
3086
+ "database copy."
3087
+ )
3088
+ typed = self.ui.password("KeePass database password")
3089
+ if typed is None:
3090
+ return reason
3091
+ if typed == cached:
3092
+ return (
3093
+ f"{reason}; the password was confirmed, so the key "
3094
+ "file may not be this database's"
3095
+ )
3096
+ key_file = self.credentials.key_file(self.ui)
3097
+ if key_file is None:
3098
+ self._restore_cached_password(cached)
3099
+ return reason
3100
+ try:
3101
+ verification = self._verify_first_version(
3102
+ source, typed, key_file
3103
+ )
3104
+ except VerificationCredentialError as exc:
3105
+ # Neither opens it: keep the earlier password (a daemon
3106
+ # client has already cached the typed one).
3107
+ self._restore_cached_password(cached)
3108
+ self.ui.notify(
3109
+ "The password does not open the database copy either."
3110
+ )
3111
+ return f"the copy cannot become the first version: {exc}"
3112
+ except VerificationError as exc:
3113
+ self.credentials.cache_password(typed)
3114
+ return f"the copy cannot become the first version: {exc}"
3115
+ self.credentials.cache_password(typed)
3116
+ except CredentialError as exc:
3117
+ return f"{reason}; the password cache failed: {exc}"
3118
+ self._known_credentials = [
3119
+ item for item in self._known_credentials if item[0] != cached
3120
+ ]
3121
+ if (typed, key_file) not in self._known_credentials:
3122
+ self._known_credentials.append((typed, key_file))
3123
+ return verification, typed, key_file
3124
+
3125
+ def _restore_cached_password(self, password: str) -> None:
3126
+ # Only if replaced: caching it again would renew its timeout.
3127
+ if self.credentials.cached_password() != password:
3128
+ self.credentials.cache_password(password)
3129
+
3039
3130
  def _cache_selected_password(self, password: str) -> None:
3040
3131
  if password not in self._transient_passwords:
3041
3132
  self.credentials.cache_password(password)
@@ -3484,18 +3575,18 @@ class SyncEngine:
3484
3575
  password, key_file = self._request_credentials()
3485
3576
  if password is None or key_file is None:
3486
3577
  return wait(
3487
- "the first version needs the password and a readable key "
3488
- "file; copies were left unchanged"
3578
+ "the first version needs the password and a readable "
3579
+ "key file; copies were left unchanged"
3489
3580
  )
3490
3581
  try:
3491
- verification = verify_candidate(
3492
- source.local_path,
3493
- password=password,
3494
- key_file=key_file,
3495
- require_keepassxc=True,
3496
- max_entry_drop=self.config.verify["max_entry_drop"],
3497
- min_entry_drop=self.config.verify["min_entry_drop"],
3582
+ verification = self._verify_first_version(
3583
+ source, password, key_file
3498
3584
  )
3585
+ except VerificationCredentialError as exc:
3586
+ retried = self._retry_first_version_password(source, password, exc)
3587
+ if isinstance(retried, str):
3588
+ return wait(retried)
3589
+ verification, password, key_file = retried
3499
3590
  except VerificationError as exc:
3500
3591
  return wait(f"the copy cannot become the first version: {exc}")
3501
3592
  if not verification.verified:
@@ -5287,11 +5378,14 @@ def endpoints_from_config(
5287
5378
  run_directory: str | os.PathLike[str],
5288
5379
  *,
5289
5380
  rclone_daemons: dict | None = None,
5381
+ remove_stale_drives: bool = True,
5290
5382
  ) -> tuple[Endpoint, ...]:
5291
5383
  """Create endpoint adapters from configuration and attached drives.
5292
5384
 
5293
5385
  Runtime-discovered sessions are added by ``session_endpoints``. This
5294
- constructs adapters without probing remote endpoints.
5386
+ constructs adapters without probing remote endpoints. Read-only
5387
+ commands pass ``remove_stale_drives=False``: stale drive records
5388
+ are then skipped but left for the daemon's drive handling.
5295
5389
 
5296
5390
  ``rclone_daemons`` is the daemon's registry of owned ``rclone rcd``
5297
5391
  transports for endpoints with ``rclone_transport = "auto"``, kept
@@ -5341,7 +5435,7 @@ def endpoints_from_config(
5341
5435
 
5342
5436
  endpoints.extend(session_endpoints(config, run_directory))
5343
5437
  try:
5344
- drives = list_drives(run_directory)
5438
+ drives = list_drives(run_directory, remove_stale=remove_stale_drives)
5345
5439
  except DriveError as exc:
5346
5440
  raise SyncError(f"cannot inspect attached drives: {exc}") from exc
5347
5441
  for drive in drives: