Skip to content

Conversation

@sseemayer
Copy link
Owner

@sseemayer sseemayer commented Sep 13, 2025

This mega-PR is not intended to be merged, but to inform and get feedback from everyone. I want to explore a new design for this crate that hopefully is cleaner, plus easier to use, understand, and extend.

@louib @varjolintu @droidmonkey I would appreciate suggestions on how to break down this PR into several smaller PRs that can be reviewed individually.

  • replace the previous design keepass::db using nested Group structs with a flat design that stores Groups, Entrys, BinaryAttachments in the Database
    • Newtypes (e.g. GroupId(Uuid)) to refer to the internal objects
    • Accessor types (e.g. GroupRef and GroupMut) to safely and conveniently expose database state, while enforcing internal consistency.
  • replace keepass::error with module-local, more granular error enums that #[derive(thiserror::Error)]
  • rewrite xml_db using quick-xml with serde (de)serialization of XML instead of xml-rs event-based parsing
  • reimplement KDB loading
  • reimplement KDBX3 loading
  • reimplement KDBX4 loading
  • reimplement History parsing
  • reimplement KDBX4 writing
  • reimplement merging
  • implement immutable iterators for groups and entries
  • implement mutable iterators for groups and entries
  • ensure the same or better test coverage than before

BREAKING CHANGE: Different database types and how they are accessed. Removes the Node, NodeRef, etc concepts.
BREAKING CHANGE: Completely replaced error types to make them more granular

@droidmonkey
Copy link
Collaborator

FWIW, I had copilot agent analyze and propose a solution to transactional edits to the database. It also proposed a JSON & API based method for these transactions. This was a thought project on how we could implement immutable database/group/entry sharing in KeePassXC and move all editing into a centralized place. droidmonkey/keepassxc#6

@sseemayer
Copy link
Owner Author

FWIW, I had copilot agent analyze and propose a solution to transactional edits to the database. It also proposed a JSON & API based method for these transactions. This was a thought project on how we could implement immutable database/group/entry sharing in KeePassXC and move all editing into a centralized place. droidmonkey/keepassxc#6

Controlled mutable access via GroupMut / EntryMut / etc is one of the benefits of this new design. I was imagining some sort of GroupTracked that is GroupMut, but tracks what changes it performs and persists them to the history upon drop.

@sseemayer sseemayer force-pushed the refactor/nonrecursive branch 5 times, most recently from 4017d26 to 4876936 Compare September 20, 2025 16:59
@sseemayer sseemayer force-pushed the refactor/nonrecursive branch from 7d75de4 to 6563f11 Compare September 20, 2025 20:32
@sseemayer sseemayer force-pushed the refactor/nonrecursive branch from f9b25f4 to d08bb0f Compare January 21, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants